https://github.com/innovativeinventor/lambda-etudes
Little exercises in Haskell
https://github.com/innovativeinventor/lambda-etudes
Last synced: 9 months ago
JSON representation
Little exercises in Haskell
- Host: GitHub
- URL: https://github.com/innovativeinventor/lambda-etudes
- Owner: InnovativeInventor
- License: gpl-3.0
- Created: 2020-12-04T15:22:16.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-06T02:15:54.000Z (over 5 years ago)
- Last Synced: 2025-01-09T07:20:46.520Z (over 1 year ago)
- Language: Haskell
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Lambda-etudes
Inspired from: https://github.com/norvig/pytudes
"An *étude* (a French word meaning *study*) is an instrumental musical composition, usually short,
of considerable difficulty, and designed to provide practice material for perfecting a particular
musical skill." — [Wikipedia](https://en.wikipedia.org/wiki/%C3%89tude)
This project is intended to derive common lambda calculus functions from the ground up with automatic testing (with QuickCheck) and Haskell's excellent type system.
Designed to be readable to non-Haskellers familiar with lambda calculus.
[`etudes.hs`](/etudes.hs) contains all the preliminary etudes.
## Running Tests
To run tests, load [`etudes.hs`](/etudes.hs) into `ghci` and run `runTests` like so:
``` haskell
>>> :l etudes.hs
>>> runTests
```
Sample output:
``` shell
GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help
Prelude> :l etudes.hs
[1 of 1] Compiling Main ( etudes.hs, interpreted )
Ok, one module loaded.
*Main> runTests
=== prop_zero from etudes.hs:24 ===
+++ OK, passed 1 test.
=== prop_one from etudes.hs:27 ===
+++ OK, passed 1 test.
=== prop_iszero from etudes.hs:34 ===
+++ OK, passed 100 tests; 91 discarded.
=== prop_succ from etudes.hs:41 ===
+++ OK, passed 100 tests; 93 discarded.
=== prop_plus from etudes.hs:44 ===
+++ OK, passed 100 tests; 276 discarded.
=== prop_pred from etudes.hs:50 ===
+++ OK, passed 100 tests; 96 discarded.
=== prop_numeralisinverseConversion from etudes.hs:70 ===
+++ OK, passed 100 tests; 85 discarded.
=== prop_boolisinverseConversion from etudes.hs:71 ===
+++ OK, passed 100 tests.
True
*Main>
```