[Haskell-cafe] difference between type and newtype

Andrea Rossato mailing_list at istitutocolli.org
Fri Aug 25 14:47:42 EDT 2006


Hello!

I cannot understand this piece of code:

type Z = Int                                                                                                                               
type T a = Z -> (a, Z)                                                                                                                                                
newtype T1 a = T1 (Z -> (a,Z))

mkT :: a -> T a                                                                                                                                                       
mkT a = \x -> (a, x) 

mkT1 :: a -> b -> (a,b)
mkT1 a = \x -> (a, x) 

why mkT is a type constructor and mkT1 seems not to be?

thanks for your kind attention.
Andrea


More information about the Haskell-Cafe mailing list