Yet another crash from typed holes
{-# OPTIONS_GHC -fdefer-typed-holes #-}
hylo a b = h where h = b . fmap h . a
foo a b = hylo a' b'
where a' x = _
b' = _
bar :: [Int]
bar = []
main = print bar
Loading this up in ghci and attempting to run main prints:
GHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help
unknown option: 'c'
[1 of 1] Compiling Main ( bad.hs, interpreted )
bad.hs:6:16: Warning:
Found hole ‘_’ with type: t4
Where: ‘t4’ is a rigid type variable bound by
the inferred type of a' :: t3 -> t4 at bad.hs:6:9
Relevant bindings include
x :: t3 (bound at bad.hs:6:12)
a' :: t3 -> t4 (bound at bad.hs:6:9)
b' :: forall t. t (bound at bad.hs:7:9)
b :: t1 (bound at bad.hs:5:7)
a :: t (bound at bad.hs:5:5)
foo :: t -> t1 -> t2 -> b (bound at bad.hs:5:1)
In the expression: _
In an equation for ‘a'’: a' x = _
In an equation for ‘foo’:
foo a b
= hylo a' b'
where
a' x = _
b' = _
bad.hs:7:14: Warning:
Found hole ‘_’ with type: t3
Where: ‘t3’ is a rigid type variable bound by
the inferred type of b' :: t3 at bad.hs:7:9
Relevant bindings include
b' :: t3 (bound at bad.hs:7:9)
b :: t1 (bound at bad.hs:5:7)
a :: t (bound at bad.hs:5:5)
foo :: t -> t1 -> t2 -> b (bound at bad.hs:5:1)
In the expression: _
In an equation for ‘b'’: b' = _
In an equation for ‘foo’:
foo a b
= hylo a' b'
where
a' x = _
b' = _
Ok, modules loaded: Main.
*Main> main
ghc: panic! (the 'impossible' happened)
(GHC version 7.10.2 for x86_64-unknown-linux):
nameModule $dFunctor_aKj
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Compiling with ghc and then running the resulting binary works.
Attempting to replicate with a recent version of GHC HEAD gives
GHCi, version 7.11.20150812: http://www.haskell.org/ghc/ :? for help
unknown option: 'c'
[1 of 1] Compiling Main ( bad.hs, interpreted )
bad.hs:5:11: error:
No instance for (Functor f0) arising from a use of ‘hylo’
The type variable ‘f0’ is ambiguous
Note: there are several potential instances:
instance Functor Maybe -- Defined in ‘GHC.Base’
instance Functor IO -- Defined in ‘GHC.Base’
instance Functor ((->) r) -- Defined in ‘GHC.Base’
...plus two others
In the expression: hylo a' b'
In an equation for ‘foo’:
foo a b
= hylo a' b'
where
a' x = _
b' = _
Failed, modules loaded: none.
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |