-
Notifications
You must be signed in to change notification settings - Fork 62
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
Heapster programs <<loop>>
when SAW is built with GHC 9.0+ (but not with GHC 8.10)
#1742
Comments
Upon further investigation, this has nothing to do with the goal sequents patch (#1742) at all. Rather, it is due to my GHC version: I was using GHC 9.0 to compile SAW. It turns out that the example above will I suppose we should report this to the GHC issue tracker, although the thought of minimizing the code in SAW makes me a little squeamish. At the very least, I'll update the title of this issue accordingly. |
<<loop>>
when SAW is built with GHC 9.0+ (but not with GHC 8.10)
I have filed GHC#22492 for this issue upstream. |
With Matthew Pickering's invaluable help on GHC#22492, I have determined that this is not a bug in GHC, but rather a series of unfortunate (but expected) behaviors in the {-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE UndecidableInstances #-}
module Main (main) where
data P a = MkP
instance Show (P a) where
show MkP = "MkP"
class C a where
m :: P a
class C1 a where
m1 :: P a
instance {-# INCOHERENT #-} C1 a => C a where
m = m1
instance C1 Int where
m1 = m
$(return [])
instance C Int where
m = MkP
main :: IO ()
main = print $ m1 @Int Somewhat surprisingly, this program will terminate on GHC 8.10:
But not on GHC 9.0 or later:
The root cause of this difference is that GHC 9.0 changed the behavior of Template Haskell declaration splices such that any declarations before a splice (such as
In the actual
Of the two possible ways to fix this issue, I like (2) the best. Does this sound agreeable, @eddywestbrook? |
@RyanGlScott I think you're right, that choice 2 sounds like the right approach. |
This makes the necessary changes to adapt to (TODO RGS: fill in hobbits PR here), which turns `NuMatchingAny1` into an alias for a quantified `NuMatching` constraint. See #1742 and https://gitlab.haskell.org/ghc/ghc/-/issues/22492 for the motivation behind this. One unfortunate hiccup with this patch is that combining quantified superclasses and `TypeFamilies` doesn't quite work out of the box on pre-9.2 GHCs due to https://gitlab.haskell.org/ghc/ghc/-/issues/14860. As a result, I have to introduce explicit equality constraints to work around the issue. I have added a `Note [QuantifiedConstraints + TypeFamilies trick]` to describe why the workaround is necessary. Credit goes to Matthew Pickering for helping me identify this issue and for authoring a separate fix. I have tweaked his fix and turned it into this patch, adding him as a co-author in the process. Fixes #1742. Co-authored-by: Matthew Pickering <[email protected]>
This makes the necessary changes to adapt to eddywestbrook/hobbits#8, which turns `NuMatchingAny1` into an alias for a quantified `NuMatching` constraint. See #1742 and https://gitlab.haskell.org/ghc/ghc/-/issues/22492 for the motivation behind this. One unfortunate hiccup with this patch is that combining quantified superclasses and `TypeFamilies` doesn't quite work out of the box on pre-9.2 GHCs due to https://gitlab.haskell.org/ghc/ghc/-/issues/14860. As a result, I have to introduce explicit equality constraints to work around the issue. I have added a `Note [QuantifiedConstraints + TypeFamilies trick]` to describe why the workaround is necessary. Credit goes to Matthew Pickering for helping me identify this issue and for authoring a separate fix. I have tweaked his fix and turned it into this patch, adding him as a co-author in the process. Fixes #1742. Co-authored-by: Matthew Pickering <[email protected]>
This makes the necessary changes to adapt to eddywestbrook/hobbits#8, which turns `NuMatchingAny1` into an alias for a quantified `NuMatching` constraint. See #1742 and https://gitlab.haskell.org/ghc/ghc/-/issues/22492 for the motivation behind this. One unfortunate hiccup with this patch is that combining quantified superclasses and `TypeFamilies` doesn't quite work out of the box on pre-9.2 GHCs due to https://gitlab.haskell.org/ghc/ghc/-/issues/14860. As a result, I have to introduce explicit equality constraints to work around the issue. I have added a `Note [QuantifiedConstraints + TypeFamilies trick]` to describe why the workaround is necessary. Credit goes to Matthew Pickering for helping me identify this issue and for authoring a separate fix. I have tweaked his fix and turned it into this patch, adding him as a co-author in the process. Fixes #1742. Co-authored-by: Matthew Pickering <[email protected]>
After the goal sequents patch (#1689), the following simple Heapster program loops instead of terminating:
First, compile
column.c
:Prior to the goal sequents patch, this would terminate:
After the goal sequents patch, however, this happens:
The text was updated successfully, but these errors were encountered: