Re: Getting all variables in scope in CoreM

2023-08-06 Thread Simon Peyton Jones
>
> My question is then “How can I get all variables in scope in the module
> underlying this CoreM computation, to pass in the LintConfig?”.
>

What do you have in your hand?  A [CoreBinding]?  If so, just do
`bindersOfBinds`.

You only need the LocalIds.  You don't need (imported) GlobalIds

Simon

On Sun, 6 Aug 2023 at 11:02, Rodrigo Mesquita 
wrote:

> Dear GHC devs,
>
> I’m trying to invoke the GHC.Core.Lint linting functions from a Core GHC
> plugin.
> These functions take a LintConfig that can mostly be constructed from
> DynFlags,
> the exception being
>
> * l_vars :: ![Var]* — ^ Ids that should be treated as being in scope
>
> My question is then “How can I get all variables in scope in the module
> underlying this CoreM computation, to pass in the LintConfig?”.
>
> My ultimate goal is to run LintM to determine the usage environment of a
> given core expression.
> In that sense, the “Id out of scope” errors aren’t that important to me,
> but they do make the linting action fail.
>
> Thanks in advance!
> Rodrigo
> ___
> ghc-devs mailing list
> ghc-devs@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Getting all variables in scope in CoreM

2023-08-06 Thread Rodrigo Mesquita
Dear GHC devs,

I’m trying to invoke the GHC.Core.Lint linting functions from a Core GHC plugin.
These functions take a LintConfig that can m <>ostly be constructed from 
DynFlags, <>
the exception being <>

 <>
l_vars :: ![Var] — ^ Ids that should be treated as being in scope

My question is then “How can I get all variables in scope in the module 
underlying this CoreM computation, to pass in the LintConfig?”.

My ultimate goal is to run LintM to determine the usage environment of a given 
core expression.
In that sense, the “Id out of scope” errors aren’t that important to me, but 
they do make the linting action fail.

Thanks in advance!
Rodrigo___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs