Update example to include polymorphism

This commit is contained in:
Danila Fedorin 2020-04-14 15:58:13 -07:00
parent 50326ffcc3
commit a18c30dca8

View File

@ -1,4 +1,4 @@
data List = { Nil, Cons Int List }
data List a = { Nil, Cons a (List a) }
data Bool = { True, False }
defn length l = {
case l of {
@ -6,4 +6,4 @@ defn length l = {
Cons x xs -> { 1 + length xs }
}
}
defn main = { length (Cons True (Cons False (Cons True Nil))) }
defn main = { length (Cons 1 (Cons 2 (Cons 3 Nil))) + length (Cons True (Cons False (Cons True Nil))) }