An open API service indexing awesome lists of open source software.

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

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