[Haskell-cafe] Re: unification
Christian Maeder
Christian.Maeder at dfki.de
Thu Mar 13 05:11:04 EDT 2008
andrea wrote:
>> 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:
http://www.haskell.org/haskellwiki/Research_papers/Type_systems
Typing Haskell in Haskell
The first few pages will be enough (substitution is on page 7)
However, the link
http://www.cse.ogi.edu/~mpj/pubs/thih.html
does not work for me
Could someone correct that link?
Christian
More information about the Haskell-Cafe
mailing list