comparison lib/ur/list.ur @ 830:d07980bf1444

Defer pattern-matching exhaustiveness checks and normalize pattern types more thoroughly
author Adam Chlipala <adamc@hcoop.net>
date Sat, 30 May 2009 14:44:29 -0400
parents 78504d97410b
children b2413e4dd109
comparison
equal deleted inserted replaced
829:20fe00fd81da 830:d07980bf1444
72 | x :: ls => x' <- f x; mapM' (x' :: acc) ls 72 | x :: ls => x' <- f x; mapM' (x' :: acc) ls
73 in 73 in
74 mapM' [] 74 mapM' []
75 end 75 end
76 76
77 fun mapXM [m ::: (Type -> Type)] (_ : monad m) [a] [ctx ::: {Unit}] f =
78 let
79 fun mapXM' ls =
80 case ls of
81 [] => return <xml/>
82 | x :: ls =>
83 this <- f x;
84 rest <- mapXM' ls;
85 return <xml>{this}{rest}</xml>
86 in
87 mapXM'
88 end
89
77 fun filter [a] f = 90 fun filter [a] f =
78 let 91 let
79 fun fil acc ls = 92 fun fil acc ls =
80 case ls of 93 case ls of
81 [] => rev acc 94 [] => rev acc