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

runTSimple fails to compile when eta-reduced #454

Closed
qwbarch opened this issue Sep 17, 2022 · 6 comments
Closed

runTSimple fails to compile when eta-reduced #454

qwbarch opened this issue Sep 17, 2022 · 6 comments

Comments

@qwbarch
Copy link

qwbarch commented Sep 17, 2022

This is a pretty minor issue, but it's bothering me since I can't compose functions when using runTSimple.
Here is an example of what compiles and what doesn't:

import Polysemy (InterpreterFor, interpretH, makeSem, runTSimple)

data Foo m a where
  Bar :: (Int -> m a) -> Foo m ()

makeSem ''Foo

interpretFoo :: InterpreterFor Foo r
interpretFoo = interpretH $ \case
  Bar f -> do
    let getInt = pure 0
    -- this compiles
    getInt >>= \x -> runTSimple (f x)
    -- this fails to compile
    getInt >>= (runTSimple . f)

Any ideas on why this is happening?

@tek
Copy link
Member

tek commented Sep 17, 2022

Assuming you mean runTSimple . f, this is certainly due to the temporary change introduced in GHC 9 and reverted in 9.2.4 called Simplified Subsumption. There is no way around it other than upgrading GHC.

@qwbarch
Copy link
Author

qwbarch commented Sep 17, 2022

Whoops good catch, I didn't notice the missing compose function earlier.
I'm just going to bump my ghc version to avoid the change then. Thanks a lot!

@qwbarch qwbarch closed this as completed Sep 17, 2022
@tek
Copy link
Member

tek commented Sep 17, 2022

note that HLS does not work well with Polysemy on GHC 9.2 (issue)

@qwbarch
Copy link
Author

qwbarch commented Sep 17, 2022

Hmm that's unfortunate. I'll try downgrading to 8.10.7 for now then. Thanks for pointing that out

@tek
Copy link
Member

tek commented Sep 17, 2022

I think it might be easier to just eta-expand 🙂

@qwbarch
Copy link
Author

qwbarch commented Sep 17, 2022

My code-base should be compatible with 8.10.7, so I might as well take the extra step to get rid of the ugliness of eta-expansions hehe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants