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

ghc 9 support #70

Closed funketh closed 3 years ago

funketh commented 3 years ago

I inlined absorbMonadCatch and changed the type application which fixed #69. Should probably still look into if/why this is necessary.

funketh commented 3 years ago

now I'm getting this error:

[18 of 31] Compiling Polysemy.ConstraintAbsorber.MonadCont

/home/theo/prj/polysemy-zoo/src/Polysemy/ConstraintAbsorber/MonadCont.hs:31:14: error:
    * Couldn't match type: forall b1. a1 -> Sem r b1
                     with: a1 -> Sem r b
      Expected: ((a1 -> Sem r b) -> Sem r a1) -> Sem r a1
        Actual: ((forall b. a1 -> Sem r b) -> Sem r a1) -> Sem r a1
    * In the first argument of `ContDict', namely `(callCC @ref)'
      In the third argument of `absorbWithSem', namely
        `(ContDict (callCC @ref))'
      In the expression:
        absorbWithSem
          @C.MonadCont @Action (ContDict (callCC @ref)) (Sub Dict)
    * Relevant bindings include
        absorbCont :: (C.MonadCont (Sem r) => Sem r a) -> Sem r a
          (bound at src/Polysemy/ConstraintAbsorber/MonadCont.hs:30:1)
   |
31 |   (ContDict (callCC @ref))
   |              ^^^^^^^^^^^
funketh commented 3 years ago

the new error seems to be related to #66

funketh commented 3 years ago

could have something to do with the minor changes to type variable quantification in ghc 9 (I don't see how though...)

Are we sure that the current version compiled before ghc 9? (I'm getting a ghc panic with the repo's stack.yaml, will have to try a different snapshot)

KingoftheHomeless commented 3 years ago

The new error is definitely a victim of the loss of function contravariance. Violent eta-expansion should fix it.

(ContDict (\main -> callCC @ref $ \exit -> main exit))

maybe even this is required:

(ContDict (\main -> callCC @ref $ \exit -> main $ \a -> exit a))
funketh commented 3 years ago

now builds with ghc 9 for me