diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-01-19 22:46:39 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-01-19 22:46:39 +0100 |
commit | c7619a27f841d24b5acb4c99ed486e95bd5130d8 (patch) | |
tree | 9aae2e1c9665b83090e1c3d80f71c0b9fdffea34 /examples/tc.hs | |
parent | e13b0a681108697f8b67d8c836edd54c042aad55 (diff) |
Noodling on the type checker
Diffstat (limited to 'examples/tc.hs')
-rw-r--r-- | examples/tc.hs | 10 |
1 files changed, 10 insertions, 0 deletions
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) |