comparison lib/ur/list.ur @ 1547:553a5cc3a4b5

Fix another list unurlification segfault bug; List.foldlMi
author Adam Chlipala <adam@chlipala.net>
date Sun, 21 Aug 2011 13:41:57 -0400
parents dde3bd82cb3d
children f4cb4eebf7ae
comparison
equal deleted inserted replaced
1546:133c71008bef 1547:553a5cc3a4b5
253 foldlM' acc ls 253 foldlM' acc ls
254 in 254 in
255 foldlM' 255 foldlM'
256 end 256 end
257 257
258 fun foldlMi [m] (_ : monad m) [a] [b] f =
259 let
260 fun foldlMi' i acc ls =
261 case ls of
262 [] => return acc
263 | x :: ls =>
264 acc <- f i x acc;
265 foldlMi' (i + 1) acc ls
266 in
267 foldlMi' 0
268 end
269
258 fun all [m] f = 270 fun all [m] f =
259 let 271 let
260 fun all' ls = 272 fun all' ls =
261 case ls of 273 case ls of
262 [] => True 274 [] => True