From 2af7855a77aebfb868246236831ee4f4eaa2de96 Mon Sep 17 00:00:00 2001 From: sebastian Date: Sun, 26 Mar 2023 14:12:09 +0200 Subject: [PATCH] documented 3 bugs --- src/TypeChecker/Bugs.md | 29 +++++++++++++++++++++++++++++ test_program.chf | 30 ------------------------------ test_program.crf | 28 ++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 30 deletions(-) create mode 100644 src/TypeChecker/Bugs.md delete mode 100644 test_program.chf create mode 100644 test_program.crf diff --git a/src/TypeChecker/Bugs.md b/src/TypeChecker/Bugs.md new file mode 100644 index 0000000..b111435 --- /dev/null +++ b/src/TypeChecker/Bugs.md @@ -0,0 +1,29 @@ +# Bugs + +## Using uninstantiated type variables + +Program below should not type check + +```hs +data Test (a) where { + Test : b -> Test (a) + }; +``` + +## Duplicate definitions of functions + +Program below should not type check + +```hs +id x = x ; +id x = x ; +``` + +## What? + +Program below should not type check + +```hs +main : a -> b ; +main x = x; +``` diff --git a/test_program.chf b/test_program.chf deleted file mode 100644 index ccc6291..0000000 --- a/test_program.chf +++ /dev/null @@ -1,30 +0,0 @@ -data Maybe (a) where { - Nothing : Maybe (a) - Just : a -> Maybe (a) - }; - -fmap : (a -> b) -> Maybe (a) -> Maybe (b) ; -fmap f ma = case ma of { - Nothing => Nothing ; - Just a => Just (f a) ; -}; - -pure : a -> Maybe (a) ; -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 ; -}; - - diff --git a/test_program.crf b/test_program.crf new file mode 100644 index 0000000..0c7ce1e --- /dev/null +++ b/test_program.crf @@ -0,0 +1,28 @@ +-- data Maybe (a) where { +-- Nothing : Maybe (a) +-- Just : a -> Maybe (a) +-- }; + +-- fmap : (a -> b) -> Maybe (a) -> Maybe (b) ; +-- fmap f ma = case ma of { +-- Nothing => Nothing ; +-- Just a => Just (f a) ; +-- }; + +-- pure : a -> Maybe (a) ; +-- 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 ; +-- };