[GHC] #11824: GHC error in desugarer lookup

Ben Gamari ben at well-typed.com
Sun Apr 17 09:44:04 UTC 2016


Simon Peyton Jones <simonpj at microsoft.com> writes:

> | 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160417/8514b30d/attachment.sig>


More information about the ghc-devs mailing list