Il Fri, Aug 25, 2006 at 08:35:01PM +0100, Brian Hulley ebbe a scrivere: > It is maybe easier to just think of a newtype decl as being the same as a > data decl except for the fact that you can only have one constructor on the > rhs whereas a data decl allows multiple constructors, and a type decl by > contrast as just introducing a simple alias for convenience.
First my apologies for being a bit confusing in my question: I'm tired and wrote the code too quickly...;-) So I'll rephrase: type T a = Int -> (a, Int) mkT :: a -> T a mkT a = \x -> (a, x) newtype T1 a = T1 (Int -> (a,Int)) mkT1 :: a -> T1 a mkT1 a = T1 (\x -> (a, x)) data T2 a = T2 (Int -> (a,Int)) mkT2 :: a -> T2 a mkT2 a = T2 (\x -> (a, x)) makeT a b = mkT a b --makeT1 a b = mkT1 a b --makeT2 a b = mkT2 a b why makeT 1 2 works while makeT1 a makeT2 will not compile? That is to say: why mkT1 and mkT2 cannot be used (even though the compiler does not complain)? That is to say, can someone explain this behaviour? I do not grasp it. Thanks for your kind attention. Andrea _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe