progress
This commit is contained in:
parent
33c156fc5c
commit
afd78c3b3e
5 changed files with 54 additions and 8 deletions
50
progress.txt
50
progress.txt
|
|
@ -10,8 +10,56 @@ status:
|
|||
2) experimental implementation of polymorphic types and type inferencing
|
||||
values currently treated as white-box, hardcoded generic types (e.g., list, function) in type inferencing algorithm
|
||||
|
||||
todo:
|
||||
wip:
|
||||
- interfaces via typeclasses?
|
||||
|
||||
- revise the way types are encoded
|
||||
we need only one 'type of type' (called 'kind' in Haskell), and we can call it 'Type'.
|
||||
types explicitly contain their underlying types. the type inferencing algorithm needs this information.
|
||||
|
||||
Int
|
||||
{ symbol: Int, params: [] }
|
||||
|
||||
[Int]
|
||||
{ symbol: List, params: [{ symbol: Int, params: [] }] }
|
||||
|
||||
[[Int]]
|
||||
{ symbol: List,
|
||||
params: [{ symbol: List, params: [{symbol: Int, params: []}]}]}
|
||||
|
||||
Int -> Bool
|
||||
{ symbol: Function, params: [
|
||||
{ symbol: Int, params: [] },
|
||||
{ symbol: Bool, params: [] },
|
||||
]
|
||||
}
|
||||
|
||||
Int | Bool
|
||||
{ symbol: Sum, params: [
|
||||
{ symbol: Int, params: [] },
|
||||
{ symbol: Bool, params: [] },
|
||||
]
|
||||
}
|
||||
|
||||
(Int, Bool)
|
||||
{ symbol: Product, params: [
|
||||
{ symbol: Int, params: [] },
|
||||
{ symbol: Bool, params: [] },
|
||||
]
|
||||
}
|
||||
|
||||
Point2D <-- custom nominal type! maybe it contains two Doubles, but we don't expose this
|
||||
{ symbol: Point2D, params: [] }
|
||||
|
||||
Type constructors are just functions that return a 'Type'.
|
||||
For instance:
|
||||
lsType :: Type -> Type
|
||||
fnType :: Type -> Type -> Type
|
||||
|
||||
The sad(?) part about all of this, is that I'm converging with Haskell/Lean.
|
||||
|
||||
- treat all values as polymorphic? (non-polymorphic values simply have empty set of type variables)
|
||||
|
||||
todo:
|
||||
- type inferencing can be reduced to finding a graph isomorphism?
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue