https://github.com/statusfailed/double-dhall
Demo adding Double arithmetic to Dhall
https://github.com/statusfailed/double-dhall
Last synced: 12 months ago
JSON representation
Demo adding Double arithmetic to Dhall
- Host: GitHub
- URL: https://github.com/statusfailed/double-dhall
- Owner: statusfailed
- License: mit
- Created: 2019-01-09T11:16:54.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-11T11:31:02.000Z (about 7 years ago)
- Last Synced: 2025-01-31T08:19:09.531Z (about 1 year ago)
- Language: Haskell
- Size: 6.84 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Double-Dhall
This repository is a simple example of how Double arithmetic can be added to
[Dhall](https://github.com/dhall-lang/dhall-lang/).
It adds four functions:
* `Double/add`
* `Double/sub`
* `Double/mul`
* `Double/div`
[readme.dhall](readme.dhall) contains usage examples of these functions, and is
used to generate this file (README.md).
Here are some typical examples of how you might use these functions:
Double/add 2.0 3.0 = 5.0
Double/sub 1.0 0.5 = 0.5
Double/mul 5.5 1.5 = 8.25
Double/div 8.0 2.0 = 4.0
Edge cases for division work as you might expect for Double:
Double/div 1.0 0.0 = Infinity
Double/div 0.0 0.0 = NaN
This code was adapted from [this
guide](https://github.com/dhall-lang/dhall-lang/wiki/How-to-add-a-new-built-in-function),
the main difference being it adds multiple functions instead of just one.
# Generating README.md
This README is generated by running the following command:
cat readme.dhall | cabal run