From 47e7627e05f2f961794e312e28bf8a437a1e0c78 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 18 Dec 2016 15:35:10 -0400 Subject: - Tested monad transformer for Error. --- stdlib/test/test/lux/data/error.lux | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'stdlib/test') 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) + (^open "io/") io;Monad] + (assert "Can add error functionality to any monad." + (|> (io;run (do (&;ErrorT io;Monad) + [a (lift (io/wrap 123)) + b (wrap 456)] + (wrap (i.+ a b)))) + (case> (#;Right 579) true + _ false))))) -- cgit v1.2.3