comparison lib/ur/list.ur @ 800:e92cfac1608f

Proper lifting of MonoEnv stored expressions; avoidance of onchange clobbering
author Adam Chlipala <adamc@hcoop.net>
date Thu, 14 May 2009 13:18:31 -0400
parents 6271f0e3c272
children 066493f7f008
comparison
equal deleted inserted replaced
799:9330ba3a2799 800:e92cfac1608f
37 [] => <xml/> 37 [] => <xml/>
38 | x :: ls => <xml>{f x}{mapX' ls}</xml> 38 | x :: ls => <xml>{f x}{mapX' ls}</xml>
39 in 39 in
40 mapX' 40 mapX'
41 end 41 end
42
43 fun mapM (m ::: (Type -> Type)) (_ : monad m) (a ::: Type) (b ::: Type) f =
44 let
45 fun mapM' acc ls =
46 case ls of
47 [] => acc
48 | x :: ls => mapM' (x' <- f x; ls' <- acc; return (x' :: ls')) ls
49 in
50 mapM' (return [])
51 end