Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kamirus/purescript-functional-concepts
Elaborated examples concerning functional concepts e.g. gadt, eadt, church encodings
https://github.com/kamirus/purescript-functional-concepts
church-encoding eadt exists gadt gadts higher-order-functions leibniz-equality row-polymorphism tagless typeclasses
Last synced: 4 days ago
JSON representation
Elaborated examples concerning functional concepts e.g. gadt, eadt, church encodings
- Host: GitHub
- URL: https://github.com/kamirus/purescript-functional-concepts
- Owner: Kamirus
- Created: 2018-10-28T11:46:06.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-16T10:06:43.000Z (22 days ago)
- Last Synced: 2024-10-17T22:18:15.508Z (21 days ago)
- Topics: church-encoding, eadt, exists, gadt, gadts, higher-order-functions, leibniz-equality, row-polymorphism, tagless, typeclasses
- Language: PureScript
- Homepage:
- Size: 32.2 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Purescript - functional concepts
How to run?
- using pulp: `$ pulp run --main `## Files
#### Equal
Leibniz equality pure implementation
#### Exists and Exists.Example
Exists implementation without GADTs nor cheats
Example shows simple uses, and points out that sometimes we need some constraints for 'hidden' type.
That would require to write new Exists data type for such use case. Further research is needed in this field.#### GADTs/ExprLeibnizTagless
Express `Expr a` GADT without this extension
- using Leibniz equality
- using tagless approach```haskell
data Expr a where
I ∷ Int → Expr Int
B ∷ Bool → Expr Bool
Add ∷ Expr Int → Expr Int → Expr Int
Eq ∷ Eq a ⇒ Expr a → Expr a → Expr Booleval ∷ Expr a → a
eval (I n) = n
eval (B b) = b
eval (Add e1 e2) = eval e1 + eval e2
eval (Eq e1 e2) = eval e1 == eval e2
```#### GADTs/ExprIf
Simple tagless form for operations: `+` and `if`
#### Tagless
[tagless-final embedding of the simply-typed lambda-calculus with integers and constants, and its uniform interpretations with three different evaluation strategies: call-by-name, call-by-value and call-by-need](http://okmij.org/ftp/tagless-final/cookbook.html#call-by-any)
On why tagless final is better than Leibniz - https://hgiasac.github.io/posts/2018-12-18-PureScript-GADTs-Alternatives---Recap.html