Mercurial > urweb
annotate tests/unpoly.ur @ 2185:cbd294994c69
Monad.mapR3
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 31 Oct 2015 11:49:30 -0400 |
parents | 338be96f8533 |
children |
rev | line source |
---|---|
adamc@1185 | 1 val current = return (Some "1") |
adamc@1185 | 2 fun resolve (_ : string) = return (Some "2") |
adamc@1185 | 3 |
adamc@1185 | 4 fun checkDeps deps = |
adamc@1185 | 5 u <- current; |
adamc@1185 | 6 List.foldlM (fn s (good, errs) => |
adamc@1185 | 7 v' <- resolve s; |
adamc@1185 | 8 case v' of |
adamc@1185 | 9 None => |
adamc@1185 | 10 return (False, <xml> |
adamc@1185 | 11 {errs} |
adamc@1185 | 12 Unknown library path <tt>{[s]}</tt>.<br/> |
adamc@1185 | 13 </xml>) |
adamc@1185 | 14 | Some v' => |
adamc@1185 | 15 b <- return True; |
adamc@1185 | 16 if b then |
adamc@1185 | 17 return (good, errs) |
adamc@1185 | 18 else |
adamc@1185 | 19 return (False, <xml> |
adamc@1185 | 20 {errs} |
adamc@1185 | 21 Access denied to <tt>{[s]}</tt>.<br/> |
adamc@1185 | 22 </xml>)) (True, <xml/>) deps |
adamc@1185 | 23 |
adamc@1185 | 24 fun main () = |
adamc@1185 | 25 p <- checkDeps ("a" :: "b" :: []); |
adamc@1185 | 26 return <xml><body> |
adamc@1185 | 27 {p.2} |
adamc@1185 | 28 </body></xml> |