From 9ea3a3dc56f1d12ac768bf1ffcd2dbf362f03d5e Mon Sep 17 00:00:00 2001 From: Samuel Hammersberg Date: Sun, 26 Mar 2023 18:37:55 +0200 Subject: [PATCH] Added another bug. --- src/TypeChecker/Bugs.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/TypeChecker/Bugs.md b/src/TypeChecker/Bugs.md index b111435..2eefcc0 100644 --- a/src/TypeChecker/Bugs.md +++ b/src/TypeChecker/Bugs.md @@ -27,3 +27,39 @@ Program below should not type check main : a -> b ; main x = x; ``` + +## Bugged error message +```hs +data Maybe () where { + Nothing : Maybe + Just : Int -> Maybe + }; + +fmap : (Int -> Int) -> Maybe -> Maybe ; +fmap f ma = case ma of { + Nothing => Nothing ; + Just a => Just (f a) ; +}; + +pure : Int -> Maybe ; +pure x = Just x ; + +ap mf ma = case mf of { + Just f => case ma of { + Nothing => Nothing; + Just a => Just (f a); + }; + Nothing => Nothing; +}; + +return = pure; + +bind ma f = case ma of { + Nothing => Nothing ; + Just a => f a ; +}; +``` +``` +TYPECHECKER ERROR +Inferred type '("c" -> "Int") -> "Maybe" -> "Maybe" does not match specified type '("Int" -> "Int") -> "Maybe" -> "Maybe"' +``` \ No newline at end of file