Here are two that I found useful:
fun mapXiM [m ::: (Type -> Type)] (_ : monad m) [a] [ctx ::: {Unit}] (f :
int -> a -> m (xml ctx [] [])) : list a -> m (xml ctx [] []) =
let
fun mapXiM' i ls =
case ls of
[] => return <xml/>
| x :: ls =>
this <- f i x;
rest <- mapXiM' (i+1) ls;
return <xml>{this}{rest}</xml>
in
mapXiM' 0
end
fun liftM2 [m ::: (Type -> Type)] (_ : monad m) [a] [b] [c] (f : a -> b ->
c) (mx : m a) (my : m b) : m c =
x <- mx;
y <- my;
return (f x y)
It would also be nice for us Haskell folks if we had a 'val liftM = mp'
somewhere too :-)
Edward
_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur