[commit: ghc] master: Fix AMP warnings for explicit Prelude imports (#8004) (b9127f4)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[commit: ghc] master: Fix AMP warnings for explicit Prelude imports (#8004) (b9127f4)

Patrick Palka
On Sun, Sep 29, 2013 at 9:10 PM, <git at git.haskell.org> wrote:

> +    isPrelude :: ImportDecl Name -> Bool
> +    isPrelude = (== "Prelude") .  moduleNameString . unLoc . ideclName


Can't you just do unLoc (ideclName imp) == pRELUDE_NAME here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130929/bcd4a7cb/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

[commit: ghc] master: Fix AMP warnings for explicit Prelude imports (#8004) (b9127f4)

David Luposchainsky
On 2013-09-30 04:00, Patrick Palka wrote:
> + isPrelude :: ImportDecl Name -> Bool
> + isPrelude = (== "Prelude") .  moduleNameString . unLoc . ideclName
>
> Can't you just do unLoc (ideclName imp) == pRELUDE_NAME here?

I think I hardcoded the name because I wanted to make sure not to run
into the problem we've had before again, the "tryTc oddity": what
happens when the Prelude isn't compiled yet and the typechecker refers
to it?

In case Prelude is handled specially here (i.e. pRELUDE_NAME always
makes sense), your suggestion looks like it's a much better way of
writing that definition.

David/quchen