
7 Dec
2001
7 Dec
'01
11:20 a.m.
| Does the compiler keep a unique copy of expressions which | consist of just a single zero arity constructor (eg. | [],True,Nothing..) as a CAF which is referenced each time the | constructor appears in an expression Yes, it does. | The second is.. | If, following pattern matching, the matched pattern appears | in an expression, is it shared or duplicated.. e.g. (a:as) -> | f (a:as) Maybe I should write something like this.. | x@(a:as) -> f x | (I know that sometimes the type checker won't allow you to do this) The compiler will share it if you are using -O; but only if the type checker would also allow it. (The internal language is typed!) Simon