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

Minimal support for 9.10 #512

Merged
merged 2 commits into from
Oct 1, 2024
Merged

Minimal support for 9.10 #512

merged 2 commits into from
Oct 1, 2024

Conversation

Ericson2314
Copy link
Member

PR #502 contains some other orthogonal cleanups.

PR #502 contains some other orthogonal cleanups.
@Ericson2314
Copy link
Member Author

Ericson2314 commented Sep 27, 2024

src/Reflex/PerformEvent/Base.hs:76:10: error: [GHC-39999]
Error:     • Could not deduce ‘Monad (HostFrame t)’
        arising from the superclasses of an instance declaration
      from the context: (ReflexHost t, Ref m ~ Ref IO)
        bound by the instance declaration
        at src/Reflex/PerformEvent/Base.hs:76:10-77
      Possible fix:
        If the constraint looks soluble from a superclass of the instance context,
        read 'Undecidable instances and loopy superclasses' in the user manual
    • In the instance declaration for
        ‘PerformEvent t (PerformEventT t m)’
   |
76 | instance (ReflexHost t, Ref m ~ Ref IO) => PerformEvent t (PerformEventT t m) where
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Note that ReflexClass looks like this

class ( Reflex t
      , MonadReflexCreateTrigger t (HostFrame t)
      , MonadSample t (HostFrame t)
      , MonadHold t (HostFrame t)
      , MonadFix (HostFrame t)
      , MonadSubscribeEvent t (HostFrame t)
      ) => ReflexHost t where

I see @ymeister fixed the build in #502, but I don't get why 9.10 is no longer accepting constraints as written.

@ymeister
Copy link
Contributor

ymeister commented Sep 28, 2024

src/Reflex/PerformEvent/Base.hs:76:10: error: [GHC-39999]
Error:     • Could not deduce ‘Monad (HostFrame t)’
        arising from the superclasses of an instance declaration
      from the context: (ReflexHost t, Ref m ~ Ref IO)
        bound by the instance declaration
        at src/Reflex/PerformEvent/Base.hs:76:10-77
      Possible fix:
        If the constraint looks soluble from a superclass of the instance context,
        read 'Undecidable instances and loopy superclasses' in the user manual
    • In the instance declaration for
        ‘PerformEvent t (PerformEventT t m)’
   |
76 | instance (ReflexHost t, Ref m ~ Ref IO) => PerformEvent t (PerformEventT t m) where
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Note that ReflexClass looks like this

class ( Reflex t
      , MonadReflexCreateTrigger t (HostFrame t)
      , MonadSample t (HostFrame t)
      , MonadHold t (HostFrame t)
      , MonadFix (HostFrame t)
      , MonadSubscribeEvent t (HostFrame t)
      ) => ReflexHost t where

I see @ymeister fixed the build in #502, but I don't get why 9.10 is no longer accepting constraints as written.

It might be related to this - https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0287-simplify-subsumption.rst

Maybe 9.10 made things stricter.

GHC 9.0 made a switch to a type inference scheme for higher rank polymorphism called simplified subsumption. Consquently, expressions like g f in the below, which passed the type checker in the GHC 8 series, stopped passing the type checker in the GHC 9 series.

{-# LANGUAGE RankNTypes #-}

f :: Int -> (forall a. a -> a)
f _ = id

g :: (forall a. Int -> a -> a) -> ()
g _ = ()

main :: IO ()
main = print (g f)

@maralorn
Copy link
Contributor

I don't think anything related to simplified subsumption changed from 9.8 to 9.10. At least the big breaking change was much earlier.

@Ericson2314
Copy link
Member Author

https://gitlab.haskell.org/ghc/ghc/-/issues/25318 I made a GHC issue on this for hopefully better visibility to get to the bottom of it.

This is deprecated in at least 9.8, and removed in 9.10.

Co-Authored-By: ymeister <[email protected]>
@Ericson2314
Copy link
Member Author

See the GHC issue I linked, this typechecker change is intentional

If the constraint looks soluble from a superclass of the instance context,
read 'Undecidable instances and loopy superclasses' in the user manual

and 🤦 that bit in the type error did indeed tell me exactly what to do.

@Ericson2314 Ericson2314 merged commit 4cb53c5 into develop Oct 1, 2024
41 checks passed
@Ericson2314 Ericson2314 deleted the 9.10 branch October 1, 2024 19:00
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

Successfully merging this pull request may close these issues.

3 participants