GHC.Prim.Int# is not at TyThing?
Simon Peyton Jones
simonpj at microsoft.com
Fri Jun 29 14:36:25 UTC 2018
Well what is lexically in scope is, well, whatever should be lexically in scope at that point. Yes, I suppose your lexicial environment might have changed, but I can’t speculate as to why.
Starting with Strings makes you vulnerable to this.
Starting with an “Orig” RdrName would be more robust.
Simon
From: Ranjit Jhala <jhala at cs.ucsd.edu>
Sent: 29 June 2018 15:26
To: Simon Peyton Jones <simonpj at microsoft.com>
Cc: ghc-devs at haskell.org
Subject: Re: GHC.Prim.Int# is not at TyThing?
Dear Simon,
Yes I expect that the notion of what is in scope in the GlobalRdrEnv has changed across the GHC versions?
Earlier, these lookups would succeed but now (likely due to some artifact of how we are using the API) they fail.
You are right that we can get Int# from the wiredInTyCons; but the issue arises with other names (eg “Fractional”)
Which are not (?) wiredIn.
The silver lining is this may force us to redo the LH name resolution entirely in a “lazy” fashion only using those Var and Type
That actually appear in the core being analyzed (as opposed to the current “eager” fashion where we use the hscenv to
lookup all names in the LH prelude...)
Thanks!
Ranjit.
On Fri, Jun 29, 2018 at 12:21 AM Simon Peyton Jones <simonpj at microsoft.com<mailto:simonpj at microsoft.com>> wrote:
Are you sure that Int# is in (lexical scope) in the GlobalRdrEnv of the HscEnv? If not, looking up the String in the lexicial environment will fail.
You can always just grab TysPrim.intPrimTyCon.
Simon
From: Ranjit Jhala <jhala at cs.ucsd.edu<mailto:jhala at cs.ucsd.edu>>
Sent: 29 June 2018 00:55
To: Simon Peyton Jones <simonpj at microsoft.com<mailto:simonpj at microsoft.com>>
Cc: ghc-devs at haskell.org<mailto:ghc-devs at haskell.org>
Subject: Re: GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7C61970cfbaa144ccb18a008d5ddcc39ca%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636658791571090137&sdata=e4FS49z0DGAtfTTc1uT1mn4z5WyLxiDko8%2BbebrM%2BeM%3D&reserved=0> is not at TyThing?
Dear Simon (and all),
Thanks! Then it seems my problem is much worse: somehow the code
I had that used the `HscEnv` to "resolve" names (i.e. get `Name`
and then `TyThing` and then `TyCon`) from plain strings is no
longer working with the GHC 8.4.3.
My efforts to distill the relevant LH code into a simple test that
shows the difference between the two versions (GHC 8.2 and 8.4) have
proven fruitless so far.
Can anyone point me to a (small?) example of using the GHC API
that implements something like:
lookupVarType :: String -> IO String
which
takes a `String` corresponding to the name of a top-level binder as input,
and returns a `String` containing the TYPE of the binder as output?
Thanks!
- Ranjit.
On Thu, Jun 28, 2018 at 3:48 AM Simon Peyton Jones <simonpj at microsoft.com<mailto:simonpj at microsoft.com>> wrote:
Does the above indicate that in fact, `GHC.Prim.Int#`<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23%60&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738480488&sdata=wjMjCtlPxk9zJjXh9LmBD3MFX5jZWHZOXIky92i0%2Fr8%3D&reserved=0> DOES NOT (any longer) correspond to a `TyCon`?
No, it does not indicate that! There still is a TyCon for Int#. Indeed you can see it defined in TysPrim.intPrimTyCon.
Simon
From: Ranjit Jhala <jhala at cs.ucsd.edu<mailto:jhala at cs.ucsd.edu>>
Sent: 28 June 2018 06:08
To: ghc-devs at haskell.org<mailto:ghc-devs at haskell.org>; Simon Peyton Jones <simonpj at microsoft.com<mailto:simonpj at microsoft.com>>
Subject: GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7Cc28a305b5d2b41bab86e08d5dd528c47%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636658268973561968&sdata=E2TQ6gQUP30NCjj0I9JVGQfHnA416qG4Fuy62V9jSS4%3D&reserved=0> is not at TyThing?
Hi all,
I am trying to update LiquidHaskell to GHC 8.4.
In doing so, I find that I can no longer resolve
(i.e. get the `TyThing`, and hence `TyCon`)
corresponding to the name:
GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738430452&sdata=UJf7MulnJzYw1hlbcvcTm13z%2FDCthgAueixMRBm03A8%3D&reserved=0>
It seems like in older versions, we had
λ> :i GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738430452&sdata=UJf7MulnJzYw1hlbcvcTm13z%2FDCthgAueixMRBm03A8%3D&reserved=0>
data GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738440460&sdata=rjNbL7wVonyqZ%2ByApAjEm95%2FNAtW7AZ5rxul%2FaX4rOo%3D&reserved=0> -- Defined in ‘GHC.Prim’
λ> :k GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738440460&sdata=rjNbL7wVonyqZ%2ByApAjEm95%2FNAtW7AZ5rxul%2FaX4rOo%3D&reserved=0>
GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738450468&sdata=PHl1FNZIA%2BjAwkokb1EkESg8ubKDanDq8XVd5Tx%2FzBA%3D&reserved=0> :: #
but in GHC 8.4 this is changed so:
λ> :i GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738460476&sdata=xBguuP%2F0N8yDKAf2L6epMwLxjSTPW4zVRxcPT82P4vw%3D&reserved=0>
data GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738460476&sdata=xBguuP%2F0N8yDKAf2L6epMwLxjSTPW4zVRxcPT82P4vw%3D&reserved=0> :: TYPE 'GHC.Types.IntRep
-- Defined in ‘GHC.Prim’
λ> :k GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738470484&sdata=4BLfL0OEweHSELHYA8c4IYUDNUhwai%2FxrZf7ljWEGuE%3D&reserved=0>
GHC.Prim.Int#<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738470484&sdata=4BLfL0OEweHSELHYA8c4IYUDNUhwai%2FxrZf7ljWEGuE%3D&reserved=0> :: TYPE 'GHC.Types.IntRep
Does the above indicate that in fact, `GHC.Prim.Int#`<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2FGHC.Prim.Int%23%60&data=02%7C01%7Csimonpj%40microsoft.com%7C713e3d8011294dfe122008d5dcb51974%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636657592738480488&sdata=wjMjCtlPxk9zJjXh9LmBD3MFX5jZWHZOXIky92i0%2Fr8%3D&reserved=0>
DOES NOT (any longer) correspond to a `TyCon`? If so,
what does it correspond to? i.e. how is it represented
as a `Type` in GHC?
Any pointers would be most appreciated!
Thanks!
- Ranjit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180629/65045fa8/attachment.html>
More information about the ghc-devs
mailing list