documented 3 bugs
This commit is contained in:
parent
213741407b
commit
2af7855a77
3 changed files with 57 additions and 30 deletions
29
src/TypeChecker/Bugs.md
Normal file
29
src/TypeChecker/Bugs.md
Normal file
|
|
@ -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;
|
||||
```
|
||||
|
|
@ -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 ;
|
||||
};
|
||||
|
||||
|
||||
28
test_program.crf
Normal file
28
test_program.crf
Normal file
|
|
@ -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 ;
|
||||
-- };
|
||||
Loading…
Add table
Add a link
Reference in a new issue