-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTODO
More file actions
51 lines (34 loc) · 1.05 KB
/
TODO
File metadata and controls
51 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
- Tests
- ADTs
- Recursive def's
- Mutually recursive def's
- Parse type tags
- Parse type vars
- Record type checking got messed up along with way:
> def x(x) = x.x
: { x : a } -> a
> x({x = 1})
= 1 : Int
> x({y = 3})
runtime error: RecordLookupError(Id(x),Record(Map(Id(y) -> Int(3))))
- Polymorphic types should grow:
Currently they can be compared to a smaller type:
> :type +(int_to_real(43), 3)
: Real
But until this expression is fully typed, the polymorphic should not be fully
bound to Int and should be allowed to grow into a Real (because Real contains
Int):
> :type +(2, int_to_real(34))
type error: UnificationError(IntType,RealType)
- Polymorphic types need proper covariance/contravariance checks:
> import Prelude exposing (+, ref!, set!, get!, int_to_real)
< ok
> def int_ref = ref!(0)
: Ref(Int)
> def increment_int_ref(r) =
set!(r, +(int_to_real(3), get!(r)))
: Ref(Real) -> Ref(Real)
> increment_int_ref(int_ref)
= ref!(3.0) : Ref(Real)
> increment_int_ref(int_ref)
= ref!(6.0) : Ref(Real)