diff options
author | Camil Staps | 2016-09-24 15:01:04 +0200 |
---|---|---|
committer | Camil Staps | 2016-09-24 15:01:04 +0200 |
commit | babe62b2320dc7a937ef30437b59c7b7e73f3c37 (patch) | |
tree | e557dc908aa95c5f7984fb3aa88d134fea898b07 /examples/monad.fusp | |
parent | cleanup (diff) |
Added examples
Diffstat (limited to 'examples/monad.fusp')
-rw-r--r-- | examples/monad.fusp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/monad.fusp b/examples/monad.fusp new file mode 100644 index 0000000..b71e1c1 --- /dev/null +++ b/examples/monad.fusp @@ -0,0 +1,14 @@ +left x = (x, 0); +right x = (0, x); + +pure = right; +bind (l,0) f = (l,0); +bind (0,r) f = f r; + +mul a b = code mul a b; +sub a b = code sub a b; + +mulM x y = right (mul x y); +subM x y = right (sub x y); + +main = bind (bind (pure 5) (mulM 10)) (subM 10); |