Two things that i still can't understand in Haskell standard

Hello haskell-prime, first is the monomorphism restriction. why isn't it possible to check _kind_ of parameter-less equation and apply monomorphism restrictions only to values of kind '*'? so, this: sum = foldr1 (*) will become polymorphic because its kind is '*->*' while this exps = 1 : map (2*) exps will become monomorphic because its kind is * second is lack of support for prefix/postfix operations. why it is impossible to do in first pass only lexical analysis of Haskell program, then split it into sentences, extract all import/infix operations and only after processing of these operations, having all the information about operator types and precedence, do the syntax analysis? -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

You don't mean checking kind, but checking type. The same argument that can be made for the monomorphism restriction at base type can be used for function types too. There is nothing impossible about prefix&postfix operator. Haskell just happens not to have them. They could be added. -- Lennart On Oct 14, 2006, at 10:57 , Bulat Ziganshin wrote:
Hello haskell-prime,
first is the monomorphism restriction. why isn't it possible to check _kind_ of parameter-less equation and apply monomorphism restrictions only to values of kind '*'? so, this:
sum = foldr1 (*)
will become polymorphic because its kind is '*->*' while this
exps = 1 : map (2*) exps
will become monomorphic because its kind is *
second is lack of support for prefix/postfix operations. why it is impossible to do in first pass only lexical analysis of Haskell program, then split it into sentences, extract all import/infix operations and only after processing of these operations, having all the information about operator types and precedence, do the syntax analysis?
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
participants (2)
-
Bulat Ziganshin
-
Lennart Augustsson