#2846: Impredicativity bug: GHC crash by type signature
---------------------------------+------------------------------------------
Reporter: mm_freak | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.12 branch
Component: Compiler | Version: 6.10.1
Severity: major | Resolution:
Keywords: crash, type | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
---------------------------------+------------------------------------------
Comment (by nccb):
Just to add another example, I believe this is the same bug:
{{{
forFD :: (forall a. Floating a => a -> IO ()) -> [forall a. Floating a =>
a] -> IO ()
forFD f xs = mapM_ f xsf >> mapM_ f xsd
where
xsf :: [Float]
xsf = [x | x <- xs]
xsd :: [Double]
xsd = [x | x <- xs]
forIFD :: (forall a. Num a => a -> IO ()) -> [forall a. Num a => a] -> IO
()
forIFD f xs = mapM_ f xsi >> forFD f xs'
where
xsi :: [Int]
xsi = [x | x <- xs]
xs' :: [Floating a => a]
xs' = [x | x <- xs]
}}}
Then "ghc -XRank2Types -XImpredicativeTypes -XFlexibleContexts tmp.hs"
gives:
{{{
ghc: panic! (the 'impossible' happened)
(GHC version 6.10.1 for x86_64-unknown-linux):
TcTyFuns.flattenType: unexpected PredType
}}}
Adding "forall a." to the type of the list xs' fixes the bug (even if the
code cannot type-check in its current form) but I thought I'd post it here
in case it helps.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2846#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs