diff options
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))))) |