[GHC] #13536: Program which terminated in GHC 8.0.2 loops with 8.2.1
GHC
ghc-devs at haskell.org
Thu Apr 6 13:25:38 UTC 2017
#13536: Program which terminated in GHC 8.0.2 loops with 8.2.1
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: highest | Milestone: 8.2.1
Component: Compiler | Version: 8.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
Actually, `vector` isn't needed here. Here's an example that only requires
`QuickCheck`:
{{{#!hs
{-# LANGUAGE TypeFamilies #-}
module Main (main) where
import Test.QuickCheck
import Text.Show.Functions ()
main :: IO ()
main = verboseCheck foldlTest
type FoldlTest a = (a -> a -> a) -> a -> [a] -> Bool
foldlTest :: FoldlTest (Int, Int)
foldlTest f (i, b) v =
foldl f (i, b) v == foldl (\x -> f (unmodel x)) (i, b) v
class TestData a where
type Model a
unmodel :: Model a -> a
instance TestData Int where
type Model Int = Int
unmodel = id
instance (Eq a, Eq b, TestData a, TestData b) => TestData (a,b) where
type Model (a,b) = (Model a, Model b)
unmodel (a,b) = (unmodel a, unmodel b)
}}}
Another observation is that the type `(Int, Int)` is crucial for
triggering the infinite loop. If you use, say, `FoldlTest Int` instead of
`FoldlTest (Int, Int)`, then it terminates again.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13536#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list