From c7619a27f841d24b5acb4c99ed486e95bd5130d8 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 19 Jan 2025 22:46:39 +0100 Subject: Noodling on the type checker --- examples/tc.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 examples/tc.hs (limited to 'examples/tc.hs') diff --git a/examples/tc.hs b/examples/tc.hs new file mode 100644 index 0000000..c27c736 --- /dev/null +++ b/examples/tc.hs @@ -0,0 +1,10 @@ +data Bool = False | True +data List a = Nil | Cons a (List a) + +isNil :: List a -> Bool +isNil Nil = True +isNil (Cons _ _) = False + +map :: (a -> b) -> List a -> List b +map _ Nil = Nil +map f (Cons x l) = Cons (f x) (map f l) -- cgit v1.2.3-70-g09d2