Simon Peyton Jones <[email protected]> writes:

> Ben
>
> I'm offline, so can't reply on Phab.
>
> Calling mkTypeableBinds in tcRnHsBootDecls isn't quite right, because it'll 
> generate lots of *bindings* whereas all we want is the *Ids* in the 
> GlobalValEnv.
>
> (It's possible that tcg_binds is ignored in the boot-module case, but it's 
> unsavoury to generate the bindings at all.  They are generated when we 
> process the main module.)
>
> I suggest the easiest fix is, in mkModIdBinding and mkTypeableTyConBinds, 
> guard the binding-generation with a test for whether isHsBootOrSig is true.
>
Are you concerned about the bindings being generated at all or merely
that they are being added to the typechecking environment?

If the latter there is no reason to fear: TcBinds.addTypecheckedBinds
(which TcTypeable uses) ensures that no bindings are added to the
environment if we are compiling a boot module,

    addTypecheckedBinds :: TcGblEnv -> [LHsBinds Id] -> TcGblEnv
    addTypecheckedBinds tcg_env binds
      | isHsBootOrSig (tcg_src tcg_env) = tcg_env
        -- Do not add the code for record-selector bindings
        -- when compiling hs-boot files
      | otherwise = tcg_env { tcg_binds = foldr unionBags
                                                (tcg_binds tcg_env)
                                                binds }

Of course, we are still doing the work of producing the bindings; if it
is this that you are concerned about then I can be more careful in
guarding their production.

Cheers,

- Ben

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ghc-devs mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to