[Haskell-cafe] Re: unification
Christian.Maeder at dfki.de
Thu Mar 13 05:11:04 EDT 2008
>> data Tipo = Var Int | Const String | Tipo :-> Tipo deriving (Show, Eq)
> But now how can I do to make the set of Const fixed??
> I want just a few base types, like "int" and "string", how could I
> define it?
your base types could be:
Const "String" :: Tipo
Const "Int" :: Tipo
and the polymorphic type of the identity function could be:
Var 1 :-> Var 1 :: Tipo
(and with "infixr :->") the type of binary function like (+)
Const "Int" :-> Const "Int" :-> Const "Int"
Note: the data type does not support type constructors like "List".
I recommend from:
Typing Haskell in Haskell
The first few pages will be enough (substitution is on page 7)
However, the link
does not work for me
Could someone correct that link?
More information about the Haskell-Cafe