Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public export TTImp reflection functions #2947

Merged
merged 3 commits into from
May 5, 2023

Conversation

madman-bob
Copy link
Collaborator

This allows using these functions in elaborator scripts.

I want to use mapMTTImp in a script, but people could plausibly want to use any of them.

@buzden
Copy link
Contributor

buzden commented Apr 14, 2023

Does using import public Language.Reflection.TTImp in the module with your elaboration script help instead of this change? I don't remember any problems with using mapTTImp and mapMTTImp from inside elaboration scripts, considering the issue #2439 (especially what's written in the comments section regarding to import public).

@madman-bob
Copy link
Collaborator Author

I already had import public before this.

Digging more deeply, the problem wasn't the script itself, but using the result of a script at the type-level.

Here's a simplified example of what I was trying to achieve, without even using a script:

import Control.Monad.State

import Language.Reflection

addName : TTImp -> State (List String) TTImp
addName v@(IVar fc (UN (Basic nm))) = do
    modify (nm ::)
    pure v
addName s = pure s

names : TTImp -> List String
names s = execState [] $ mapMTTImp addName s

checkNames : names `(x * y) = ["y", "x", "*"]
checkNames = Refl

Tests the `public export` of `TTImp` functionality.
@gallais gallais merged commit a00b7ee into idris-lang:main May 5, 2023
@madman-bob madman-bob deleted the public-ttimp branch May 5, 2023 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants