diff options
author | Eduardo Julian | 2016-12-18 15:35:10 -0400 |
---|---|---|
committer | Eduardo Julian | 2016-12-18 15:35:10 -0400 |
commit | 47e7627e05f2f961794e312e28bf8a437a1e0c78 (patch) | |
tree | a907281e0d55fe09038d1951c552614f69eb3c77 /stdlib/test | |
parent | c85654fe58058eb1b5529e6c392b1bc55bd05862 (diff) |
- Tested monad transformer for Error.
Diffstat (limited to '')
-rw-r--r-- | stdlib/test/test/lux/data/error.lux | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/stdlib/test/test/lux/data/error.lux b/stdlib/test/test/lux/data/error.lux index 7cc7c2f4c..6127c37c1 100644 --- a/stdlib/test/test/lux/data/error.lux +++ b/stdlib/test/test/lux/data/error.lux @@ -7,7 +7,8 @@ lux (lux (codata [io]) (control monad) - (data ["&" error]) + (data text/format + ["&" error]) pipe) lux/test) @@ -47,3 +48,14 @@ (case> (#;Left "YOLO") true _ false)) )) ))) + +(test: "Monad transformer" + (let [lift (&;lift-error io;Monad<IO>) + (^open "io/") io;Monad<IO>] + (assert "Can add error functionality to any monad." + (|> (io;run (do (&;ErrorT io;Monad<IO>) + [a (lift (io/wrap 123)) + b (wrap 456)] + (wrap (i.+ a b)))) + (case> (#;Right 579) true + _ false))))) |