pure
pure copied to clipboard
Type signature support
Type inferencer ignores type signatures. Example:
foo :: String -> Int -> UndefinedType -> [Bool]
foo i = ()
main = Ret (foo 1)
The parser discards type signatures, as the cexp
datatype does not support them. But inference runs on cexp
and so cannot see type signatures. We will need to consider how to support type signatures through the frontend effectively, aside from upgrading inference to handle them. We could simply add type signatures to cexp
, or consider something more involved.
As discussed in a meeting, we have decided to keep the cexp
datatype as-is and instead pass top-level signatures to inference alongside user-defined datatype/exception declaration information. Inference will need to be upgraded to use signatures correctly. Note that local type signatures can't be supported in this way.
This works well in the short-term, but as we support more features it will be cumbersome to continue passing extra information which does not fit into cexp
to inference. We will need to re-think the design and usage of the AST and cexp
datatypes.