.hs -> .cr

update examples
This commit is contained in:
crumbtoo
2024-02-08 14:02:03 -07:00
parent d2e301fad7
commit 055fbfd40c
4 changed files with 12 additions and 9 deletions

12
examples/sumList.cr Normal file
View File

@@ -0,0 +1,12 @@
{-# PackData Nil 0 0 #-}
{-# PackData Cons 1 2 #-}
foldr f z l = case l of
{ Nil -> z
; Cons x xs -> f x (foldr f z xs)
};
list = Cons 1 (Cons 2 (Cons 3 Nil));
main = foldr (+#) 0 list;