
Simon Peyton Jones
| The problem is this: we must generate and typecheck record selectors on | a per-group basis, since they may be used by later groups.
Why? Record selectors are value bindings which aren't used when typechecking data types.
Yes, they are value bindings and may be used in bindings in later groups. For instance, let's consider the following, data ARecord = ARecord { aField :: Int } $(return []) -- group delimiter aFieldIncr :: ARecord -> Int aFieldIncr = succ . aField My point in,
| we must generate and typecheck record selectors on a per-group basis
is that we must generate the `aField` binding before proceeding to typecheck the second group (containing `aFieldIncr`). Failing to do this would result in `aField` being out of scope when we attempted to typecheck the RHS of `aFieldIncr`. Perhaps I have misunderstood? Cheers, - Ben