polysemy-research / polysemy-zoo

:monkey::panda_face: Experimental, user-contributed effects and interpreters for polysemy
BSD 3-Clause "New" or "Revised" License
70 stars 21 forks source link

Don't use polysemy-plugin, remove IdempotentLoweringSpec #66

Closed KingoftheHomeless closed 4 years ago

KingoftheHomeless commented 4 years ago

Stop-gap for https://github.com/polysemy-research/polysemy-zoo/issues/65. This does not address the underlying bug, so I won't close that issue. This wasn't as much work as I thought it would be.

KingoftheHomeless commented 4 years ago

@adamConnerSax Can you confirm if this works? I personally have issues trying to get 8.10 working with stack.

adamConnerSax commented 4 years ago

Looks like it. I had to do an "allow-newer: ghc-prim" for my case. Also, I wanted to do "allow-newer: random"--because the newer random is a major performance upgrade--but then I got a compilation error:

src/Polysemy/Random.hs:54:8: error:
    • Could not deduce: Polysemy.Internal.Union.LocateEffect
                          (Embed m0) r
                        ~ '()
        arising from a use of ‘embed’
      from the context: Member (Embed IO) r
        bound by the type signature for:
                   runRandomIO :: forall (r :: [(* -> *) -> * -> *]) a.
                                  Member (Embed IO) r =>
                                  Sem (Random : r) a -> Sem r a
        at src/Polysemy/Random.hs:52:1-68
      The type variable ‘m0’ is ambiguous
    • In a stmt of a 'do' block: q <- embed R.newStdGen
      In the expression:
        do q <- embed R.newStdGen
           snd <$> runRandom q m
      In an equation for ‘runRandomIO’:
          runRandomIO m
            = do q <- embed R.newStdGen
                 snd <$> runRandom q m
    • Relevant bindings include
        m :: Sem (Random : r) a (bound at src/Polysemy/Random.hs:53:13)
        runRandomIO :: Sem (Random : r) a -> Sem r a
          (bound at src/Polysemy/Random.hs:53:1)
   |
54 |   q <- embed R.newStdGen
   |        ^^^^^^^^^^^^^^^^^
adamConnerSax commented 4 years ago

So maybe, while you're there, it's worth bumping all the bounds, or at least all but random, though if that's easy to fix, it might be worth it...

adamConnerSax commented 4 years ago

Anyway, thanks for working on it!

KingoftheHomeless commented 4 years ago

Does that do it?

KingoftheHomeless commented 4 years ago

Forgot the tests. Those are significantly more hellish to rewrite, so I'm going with enabling the plugin for the tests only. Also, for some reason Travis now trips up on building IdempotentLoweringSpec, compared to in February. I have no idea why. Considering Idempotent Lowering has long since been de-facto deprecated in favour of Final, and ImpredicativeTypes has unspecified behaviour, I'll simply be removing that test, and not lose any sleep over it.

@adamConnerSax I'll merge this when you confirm this works.

adamConnerSax commented 4 years ago

I’ll test tomorrow AM!

adamConnerSax commented 4 years ago

All works on my end, thanks!