[Haskell-cafe] difference between type and newtype
Andrea Rossato
mailing_list at istitutocolli.org
Fri Aug 25 20:02:36 EDT 2006
Il Sat, Aug 26, 2006 at 01:27:38AM +0200, Daniel Fischer ebbe a scrivere:
> Because T a is a function type, namely Int -> (a,Int), so
...
> iHowever, neither T1 a nor T2 a is a function type, a value of type
> T1 a is a function _wrapped by the data (or value) constructor T1_ (the same
> applies to T2, of course), so before you can apply mkT1 a to an Int, you have
> to unwrap it:
so, if I understand correctly, mkT is just a partial application
*becase* of its "fake" type signature...
that's a bit confusing...
also because that "type" cannot be instance of a class.
moreover why it is possible to declare something like this?
data T2 a = T2 (Int -> (a,Int))
is there any usefulness?
I hoped it could work as with types declared with "type".
perhaps this is silly, but it is not possible to declare function
types?
could you please indicate me some documentation that explains this
kind of stuff? So far I didn't find anything on that.
Thank you.
Andrea
More information about the Haskell-Cafe
mailing list