Bernie Pope answered: > > 1. Why do the rules of the monomorphism restriction explicitly mention > > *simple* pattern bindings? > > Where is the difference, especially as there is a translation to > > simple pattern bindings? > > Why should > > > > p | "a"=="b" = 2 > > | otherwise = 3 > > > > be treated different than > > > > p = if "a"=="b" then 2 else 3 > > > They are the same (both are simple pattern bindings). The report says > in section 4.4.3.2 that the first can be translated into the second.
Indeed, I meant to allude to this translation. > A simple pattern binding is one where the lhs is a variable only. That's consistent with the second reason for rule one of the MR. However, the mentioned section 4.4.3.2 defines it differently: A simple pattern binding has form p = e. And if there is any doubt about what p stands for, it goes on: The pattern p ... Contrasting to that: The general form of a pattern binding is p match, where a match is the same structure as for function bindings above; in other words, a pattern binding is: p | g1 = e1 | g2 = e2 ... | gm = em where { decls } So according to this definition, a pattern binding is simple iff there are no guards (unless they are in the expression). Also the translation to a "simple pattern binding" only gets rid of guards. So there seems to be an error in the report, which can be fixed by either redefining "simple pattern binding", or using a differnet description in the MR. Bye Christian Sievers _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe