GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T19:05:07Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/3154Type families bug with data family instances2019-07-07T19:05:07ZtrevorType families bug with data family instancesThis data family definition led to the ability to define a generic cast:
```
{-# LANGUAGE TypeFamilies #-}
data family T a b t
data instance T a b t = L a
data instance T a b () = R b
cast :: a -> b
cast x = let L i = R x in i
get :...This data family definition led to the ability to define a generic cast:
```
{-# LANGUAGE TypeFamilies #-}
data family T a b t
data instance T a b t = L a
data instance T a b () = R b
cast :: a -> b
cast x = let L i = R x in i
get :: IO Char
get = cast ()
```
This bug was observed in ghc version 6.10.1, 6.10.1.20090326 and 6.10.2.
```
% ghci test.hs
GHCi, version 6.10.2: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( test.hs, interpreted )
Ok, modules loaded: Main.
*Main> get
'\4312564'
*Main> get
<interactive>: internal error: stg_ap_v_ret
(GHC version 6.10.2 for x86_64_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
zsh: abort ghci test.hs
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Type families bug with data family instances","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.2","keywords":["families","type"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This data family definition led to the ability to define a generic cast:\r\n\r\n{{{\r\n{-# LANGUAGE TypeFamilies #-}\r\n\r\ndata family T a b t\r\ndata instance T a b t = L a\r\ndata instance T a b () = R b\r\n\r\ncast :: a -> b\r\ncast x = let L i = R x in i\r\n\r\nget :: IO Char\r\nget = cast ()\r\n}}}\r\n\r\nThis bug was observed in ghc version 6.10.1, 6.10.1.20090326 and 6.10.2.\r\n\r\n{{{\r\n% ghci test.hs\r\nGHCi, version 6.10.2: http://www.haskell.org/ghc/ :? for help\r\nLoading package ghc-prim ... linking ... done.\r\nLoading package integer ... linking ... done.\r\nLoading package base ... linking ... done.\r\n[1 of 1] Compiling Main ( test.hs, interpreted )\r\nOk, modules loaded: Main.\r\n*Main> get\r\n'\\4312564'\r\n*Main> get\r\n<interactive>: internal error: stg_ap_v_ret\r\n (GHC version 6.10.2 for x86_64_unknown_linux)\r\n Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\nzsh: abort ghci test.hs\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/3150Overlapping data instances can segfault2019-07-07T19:05:08ZguestOverlapping data instances can segfaultWhen exploring data families for some fast unboxed tuple representation, we came across the following scenario.
```
class Foo a where
data Bar a :: *
instance Foo a where
data Bar a = PBar a
instance Foo () where
data Bar ...When exploring data families for some fast unboxed tuple representation, we came across the following scenario.
```
class Foo a where
data Bar a :: *
instance Foo a where
data Bar a = PBar a
instance Foo () where
data Bar () = PUnit
```
```
GHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( Foo.hs, interpreted )
Ok, modules loaded: Main.
*Main> case PUnit of PBar x -> x
Segmentation fault
```
It appears the compiler is allowing the refinement of a into () because they overlap, when it shouldn't.
This is less academic than this example, because it affects doing similar operations to automatically unbox tuples of primitives when possible.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | ekmett@gmail.com |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Overlapping data instances can segfault","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["ekmett@gmail.com"],"type":"Bug","description":"When exploring data families for some fast unboxed tuple representation, we came across the following scenario.\r\n\r\n{{{\r\nclass Foo a where\r\n data Bar a :: *\r\n\r\ninstance Foo a where\r\n data Bar a = PBar a\r\n\r\ninstance Foo () where\r\n data Bar () = PUnit\r\n}}}\r\n\r\n{{{\r\n\r\nGHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help\r\nLoading package ghc-prim ... linking ... done.\r\nLoading package integer ... linking ... done.\r\nLoading package base ... linking ... done.\r\n[1 of 1] Compiling Main ( Foo.hs, interpreted )\r\nOk, modules loaded: Main.\r\n*Main> case PUnit of PBar x -> x\r\nSegmentation fault\r\n}}}\r\n\r\nIt appears the compiler is allowing the refinement of a into () because they overlap, when it shouldn't.\r\n\r\nThis is less academic than this example, because it affects doing similar operations to automatically unbox tuples of primitives when possible.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/3108Do a better job of solving recursive type-class constraints with functional d...2019-07-07T19:05:21ZSimon Peyton JonesDo a better job of solving recursive type-class constraints with functional dependenciesThis ticket is just to track this interesting thread on the Haskell list, concerning recursive type-class constraints:
http://www.haskell.org/pipermail/haskell/2009-March/021115.html.
We might want to get back to this when the new constr...This ticket is just to track this interesting thread on the Haskell list, concerning recursive type-class constraints:
http://www.haskell.org/pipermail/haskell/2009-March/021115.html.
We might want to get back to this when the new constraint solver is in place.
The question concerns the interaction of solving recursive type-class constraints, where it is important to aggressively apply functional dependencies. Here's Tom Schrijvers's analysis of Ralf's example:
"The cyclic dictionaries approach is a bit fragile. The problem appears to
be here that GHC alternates exhaustive phases of constraint reduction and
functional dependency improvement. The problem is that in your example you
need both for detecting a cycle.
This can happen:
```
C1 Int
==> 3rd C1 inst
C2 Int y, C1 (y,Bool)
==> 1st C1 inst
C2 Int y, C1 y, C1 Bool
==> 2nd C1 inst
C2 Int y, C1 y
==> 3rd C1 inst
C2 Int y, C2 y z, C1 (z,Bool)
==>
...
```
where all the constraint are different because fresh variables are
introduced.
What you want to happen is:
```
C1 Int
==> 3rd C1 inst
C2 Int y, C1 (y,Bool)
==> 1st C1 inst
C2 Int y, C1 y, C1 Bool
==> 2nd C1 inst
C2 Int y, C1 y
==> C2 FD improvement {Int/y} <<<<
C2 Int Int, C1 Int
==> C1 Int cycle detected
C2 Int Int
==> C2 1st instance
{}
```
It seems that you want improvement to happen at a higher priority than GHC
does now."
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Do a better job of solving recursive type-class constraints with functional dependencies","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"6.12 branch","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This ticket is just to track this interesting thread on the Haskell list, concerning recursive type-class constraints:\r\nhttp://www.haskell.org/pipermail/haskell/2009-March/021115.html.\r\nWe might want to get back to this when the new constraint solver is in place.\r\n\r\nThe question concerns the interaction of solving recursive type-class constraints, where it is important to aggressively apply functional dependencies. Here's Tom Schrijvers's analysis of Ralf's example:\r\n\r\n\"The cyclic dictionaries approach is a bit fragile. The problem appears to\r\nbe here that GHC alternates exhaustive phases of constraint reduction and\r\nfunctional dependency improvement. The problem is that in your example you\r\nneed both for detecting a cycle.\r\n\r\nThis can happen:\r\n{{{\r\n C1 Int\r\n ==> 3rd C1 inst\r\n C2 Int y, C1 (y,Bool)\r\n ==> 1st C1 inst\r\n C2 Int y, C1 y, C1 Bool\r\n ==> 2nd C1 inst\r\n C2 Int y, C1 y\r\n ==> 3rd C1 inst\r\n C2 Int y, C2 y z, C1 (z,Bool)\r\n ==>\r\n ...\r\n}}}\r\nwhere all the constraint are different because fresh variables are\r\nintroduced.\r\n\r\nWhat you want to happen is:\r\n{{{\r\n C1 Int\r\n ==> 3rd C1 inst\r\n C2 Int y, C1 (y,Bool)\r\n ==> 1st C1 inst\r\n C2 Int y, C1 y, C1 Bool\r\n ==> 2nd C1 inst\r\n C2 Int y, C1 y\r\n ==> C2 FD improvement {Int/y} <<<<\r\n C2 Int Int, C1 Int\r\n ==> C1 Int cycle detected\r\n C2 Int Int\r\n ==> C2 1st instance\r\n {}\r\n}}}\r\nIt seems that you want improvement to happen at a higher priority than GHC\r\ndoes now.\"\r\n","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/3102The impossible happened with implicit parameters2019-07-07T19:05:23ZAshley YakeleyThe impossible happened with implicit parameters```
{-# OPTIONS -XImplicitParams -XRankNTypes #-}
module Bug where
t :: forall a. ((?p :: Int) => a) -> String
t _ = "Hello"
f :: (forall a. a -> String) -> Int
f _ = 3
result :: Int
result = f t
```
```
$ ghc -c Bug.hs
ghc: panic! (...```
{-# OPTIONS -XImplicitParams -XRankNTypes #-}
module Bug where
t :: forall a. ((?p :: Int) => a) -> String
t _ = "Hello"
f :: (forall a. a -> String) -> Int
f _ = 3
result :: Int
result = f t
```
```
$ ghc -c Bug.hs
ghc: panic! (the 'impossible' happened)
(GHC version 6.10.1 for x86_64-unknown-linux):
TcTyFuns.flattenType: unexpected PredType
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"The impossible happened with implicit parameters","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\r\n{-# OPTIONS -XImplicitParams -XRankNTypes #-}\r\nmodule Bug where\r\n\r\nt :: forall a. ((?p :: Int) => a) -> String\r\nt _ = \"Hello\"\r\n\r\nf :: (forall a. a -> String) -> Int\r\nf _ = 3\r\n\r\nresult :: Int\r\nresult = f t\r\n}}}\r\n\r\n{{{\r\n$ ghc -c Bug.hs\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 6.10.1 for x86_64-unknown-linux):\r\n\tTcTyFuns.flattenType: unexpected PredType\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->6.12.1Ian Lynagh <igloo@earth.li>Ian Lynagh <igloo@earth.li>https://gitlab.haskell.org/ghc/ghc/-/issues/3064Very long compile times with type functions2019-07-07T19:05:34ZSimon Peyton JonesVery long compile times with type functionsthe attached module is a much reduced version of some type-level assurance
stuff (inspired by the Lightweight Monadic Regions paper) I am trying to
do. I am almost certain that it could be reduced further but it is late and
I want to get...the attached module is a much reduced version of some type-level assurance
stuff (inspired by the Lightweight Monadic Regions paper) I am trying to
do. I am almost certain that it could be reduced further but it is late and
I want to get this off my desk.
Note the 4 test functions, test11 .. test14. The following are timings for
compiling the module only with all test functions commented out, except
respectively, test11, test12, test13, and test14:
```
ben@sarun[1] > time ghc -c Bug2.hs
ghc -c Bug2.hs 1,79s user 0,04s system 99% cpu 1,836 total
ben@sarun[1] > time ghc -c Bug2.hs
ghc -c Bug2.hs 5,87s user 0,14s system 99% cpu 6,028 total
ben@sarun[1] > time ghc -c Bug2.hs
ghc -c Bug2.hs 23,52s user 0,36s system 99% cpu 23,899 total
ben@sarun[1] > time ghc -c Bug2.hs
ghc -c Bug2.hs 102,20s user 1,32s system 97% cpu 1:45,89 total
```
It seems something is scaling very badly. You really don't want to wait for
a version with 20 levels of nesting to compile...
If anyone has a good explanation for this, I'd be grateful.
BTW, I am not at all certain that this is ghc's fault, it may well be my
program, i.e. the constraints are too complex, whatever. I have no idea how
hard it is for the compiler to do all the unification. Also, the problem is
not of much practical relevance, as no sensible program will use more than
a handful levels of nesting.
SLPJ says: let's investigate this once the new solver is done.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | ben.franksen@online.de |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Very long compile times with type functions","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"chak"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["ben.franksen@online.de"],"type":"Bug","description":"the attached module is a much reduced version of some type-level assurance\r\nstuff (inspired by the Lightweight Monadic Regions paper) I am trying to\r\ndo. I am almost certain that it could be reduced further but it is late and\r\nI want to get this off my desk.\r\n\r\nNote the 4 test functions, test11 .. test14. The following are timings for\r\ncompiling the module only with all test functions commented out, except\r\nrespectively, test11, test12, test13, and test14:\r\n{{{\r\nben@sarun[1] > time ghc -c Bug2.hs\r\nghc -c Bug2.hs 1,79s user 0,04s system 99% cpu 1,836 total\r\n\r\nben@sarun[1] > time ghc -c Bug2.hs\r\nghc -c Bug2.hs 5,87s user 0,14s system 99% cpu 6,028 total\r\n\r\nben@sarun[1] > time ghc -c Bug2.hs\r\nghc -c Bug2.hs 23,52s user 0,36s system 99% cpu 23,899 total\r\n\r\nben@sarun[1] > time ghc -c Bug2.hs\r\nghc -c Bug2.hs 102,20s user 1,32s system 97% cpu 1:45,89 total\r\n}}}\r\nIt seems something is scaling very badly. You really don't want to wait for\r\na version with 20 levels of nesting to compile...\r\n\r\nIf anyone has a good explanation for this, I'd be grateful.\r\n\r\nBTW, I am not at all certain that this is ghc's fault, it may well be my\r\nprogram, i.e. the constraints are too complex, whatever. I have no idea how\r\nhard it is for the compiler to do all the unification. Also, the problem is\r\nnot of much practical relevance, as no sensible program will use more than\r\na handful levels of nesting.\r\n\r\nSLPJ says: let's investigate this once the new solver is done.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1https://gitlab.haskell.org/ghc/ghc/-/issues/3043An unrelated definition monomorphizes a type even without the MR2019-07-07T19:05:41ZDeewiantAn unrelated definition monomorphizes a type even without the MRThe following code:
```
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FunctionalDependencies #-}
class Id a b | b -> a where id' :: a -> b
instance Id [Char] [Char] where id' = id
cl...The following code:
```
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FunctionalDependencies #-}
class Id a b | b -> a where id' :: a -> b
instance Id [Char] [Char] where id' = id
class Fst a where fst' :: a -> String
instance Fst ([Char],a) where fst' = fst
data Void a = Void
void :: (String,a) -> Void a
void _ = Void
fst'' (a,b) =
let x = (id' a, b)
y = void x :: Void Int -- remove this line and the code compiles
in fst' x
```
Results in:
```
arst.hs:18:6:
No instance for (Fst (b, Int))
arising from a use of `fst'' at arst.hs:18:6-11
Possible fix: add an instance declaration for (Fst (b, Int))
In the expression: fst' x
In the expression:
let
x = (id' a, b)
y = void x :: Void Int
in fst' x
In the definition of `fst''':
fst'' (a, b)
= let
x = ...
y = ...
in fst' x
arst.hs:18:11:
No instance for (Id [Char] b)
arising from a use of `x' at arst.hs:18:11
Possible fix: add an instance declaration for (Id [Char] b)
In the first argument of `fst'', namely `x'
In the expression: fst' x
In the expression:
let
x = (id' a, b)
y = void x :: Void Int
in fst' x
```
It seems that the definition of `y` locks down the type of `x` somewhat even though the monomorphism restriction is disabled. If we remove the definition:
```
*Main> :t fst''
fst'' :: (Id t b, Fst (b, t1)) => (t, t1) -> String
```
To be completely honest I'm not sure whether the code should be accepted or not, since `(Id t b, Fst (b, t1))` can't be satisfied. Only the fully monomorphic signature `([Char], Int) -> String`, which is obtained with the definition of `y` in place and the monomorphism restriction enabled, works.
In any case, I think it's a bug that the results of the type check depend on whether `y` is defined or not: surely that shouldn't matter at all, no matter what the end result is.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"An unrelated definition monomorphizes a type even without the MR","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following code:\r\n{{{\r\n{-# LANGUAGE NoMonomorphismRestriction #-}\r\n{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FunctionalDependencies #-}\r\n\r\nclass Id a b | b -> a where id' :: a -> b\r\ninstance Id [Char] [Char] where id' = id\r\n\r\nclass Fst a where fst' :: a -> String\r\ninstance Fst ([Char],a) where fst' = fst\r\n\r\ndata Void a = Void\r\n\r\nvoid :: (String,a) -> Void a\r\nvoid _ = Void\r\n\r\nfst'' (a,b) =\r\n let x = (id' a, b)\r\n y = void x :: Void Int -- remove this line and the code compiles\r\n in fst' x\r\n}}}\r\nResults in:\r\n{{{\r\narst.hs:18:6:\r\n No instance for (Fst (b, Int))\r\n arising from a use of `fst'' at arst.hs:18:6-11\r\n Possible fix: add an instance declaration for (Fst (b, Int))\r\n In the expression: fst' x\r\n In the expression:\r\n let\r\n x = (id' a, b)\r\n y = void x :: Void Int\r\n in fst' x\r\n In the definition of `fst''':\r\n fst'' (a, b)\r\n = let\r\n x = ...\r\n y = ...\r\n in fst' x\r\n\r\narst.hs:18:11:\r\n No instance for (Id [Char] b)\r\n arising from a use of `x' at arst.hs:18:11\r\n Possible fix: add an instance declaration for (Id [Char] b)\r\n In the first argument of `fst'', namely `x'\r\n In the expression: fst' x\r\n In the expression:\r\n let\r\n x = (id' a, b)\r\n y = void x :: Void Int\r\n in fst' x\r\n}}}\r\n\r\nIt seems that the definition of `y` locks down the type of `x` somewhat even though the monomorphism restriction is disabled. If we remove the definition:\r\n{{{\r\n*Main> :t fst''\r\nfst'' :: (Id t b, Fst (b, t1)) => (t, t1) -> String\r\n}}}\r\n\r\nTo be completely honest I'm not sure whether the code should be accepted or not, since `(Id t b, Fst (b, t1))` can't be satisfied. Only the fully monomorphic signature `([Char], Int) -> String`, which is obtained with the definition of `y` in place and the monomorphism restriction enabled, works.\r\n\r\nIn any case, I think it's a bug that the results of the type check depend on whether `y` is defined or not: surely that shouldn't matter at all, no matter what the end result is.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/3023Wrong inferred type shown2019-07-07T19:05:50ZguestWrong inferred type shownWhen the warning for missing type signatures is turned on the displayed type is sometimes totally bogus.
```
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances #-}
module Bug where
class C a b | a -> b, b ...When the warning for missing type signatures is turned on the displayed type is sometimes totally bogus.
```
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances #-}
module Bug where
class C a b | a -> b, b -> a where
f :: a -> b
instance C Int Bool where
f = undefined
instance (C a c, C b d) => C (a -> b) (c -> d) where
f = undefined
foo :: Int -> Int
foo = undefined
bar = f foo
```
GHC says:
```
Warning: Definition but no type signature for `bar'
Inferred type: bar :: c -> d
```
The type for bar is, of course, Bool-\>Bool, and nothing else.
> -- Lennart
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | lennart@augustsson.net |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Wrong inferred type shown","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["lennart@augustsson.net"],"type":"Bug","description":"When the warning for missing type signatures is turned on the displayed type is sometimes totally bogus.\r\n\r\n{{{\r\n{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances #-}\r\nmodule Bug where\r\n\r\nclass C a b | a -> b, b -> a where\r\n f :: a -> b\r\n\r\ninstance C Int Bool where\r\n f = undefined\r\ninstance (C a c, C b d) => C (a -> b) (c -> d) where\r\n f = undefined\r\n\r\nfoo :: Int -> Int\r\nfoo = undefined\r\n\r\nbar = f foo\r\n}}}\r\nGHC says:\r\n{{{\r\n Warning: Definition but no type signature for `bar'\r\n Inferred type: bar :: c -> d\r\n}}}\r\nThe type for bar is, of course, Bool->Bool, and nothing else.\r\n\r\n -- Lennart\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/3014Any type being derived in Haskell 98 module2019-07-07T19:05:53Ziampure@gmail.comAny type being derived in Haskell 98 moduleLoad the attached module with ghci -ignore-dot-ghci, do :browse and observe the type of z, z :: GHC.Prim.Any -\> Double
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ----------------...Load the attached module with ghci -ignore-dot-ghci, do :browse and observe the type of z, z :: GHC.Prim.Any -\> Double
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Any type being derived in Haskell 98 module","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":["any","type"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Load the attached module with ghci -ignore-dot-ghci, do :browse and observe the type of z, z :: GHC.Prim.Any -> Double\r\n\r\n\r\n\r\n ","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/3011ASSERT failed: file typecheck/TcMType.lhs line 526 t_a32G{tv}2019-07-07T19:05:53ZbatterseapowerASSERT failed: file typecheck/TcMType.lhs line 526 t_a32G{tv}NB: this is NOT AFAIK a duplicate of the previous ticket about the TcMType ASSERT failure. It was observed on a recent HEAD (as of 6th February 2009) while I happened to be using a stage 2 compiler with -DDEBUG on to compile some code I ...NB: this is NOT AFAIK a duplicate of the previous ticket about the TcMType ASSERT failure. It was observed on a recent HEAD (as of 6th February 2009) while I happened to be using a stage 2 compiler with -DDEBUG on to compile some code I was working on.
Error is as follows:
```
$ ./Setup clean && ./Setup configure --with-compiler=/Users/mbolingbroke/Programming/Checkouts/ghc.working/ghc/stage2-inplace/ghc --with-hc-pkg=/Users/mbolingbroke/Programming/Checkouts/ghc.working/ghc/stage2-inplace/ghc-pkg --ghc --global && ./Setup build && dist/build/vector-tests/vector-tests
cleaning...
Configuring vector-tests-0.2...
Preprocessing executables for vector-tests-0.2...
Building vector-tests-0.2...
[1 of 3] Compiling Utilities ( Utilities.hs, dist/build/vector-tests/vector-tests-tmp/Utilities.o )
WARNING: file simplCore/SimplCore.lhs line 545
Simplifier still going after 4 iterations; bailing out. Size = 1398
[2 of 3] Compiling Properties ( Properties.hs, dist/build/vector-tests/vector-tests-tmp/Properties.o )
WARNING: file typecheck/TcTyFuns.lhs line 284
(This warning is harmless; for Simon & Manuel)
[Wanted t_a32G{tv} [tau] :: ghc-prim:GHC.Types.[]{(w) tc 317}
~
v{tv a2S9} [sk]]
ghc: panic! (the 'impossible' happened)
(GHC version 6.11.20090204 for i386-apple-darwin):
ASSERT failed! file typecheck/TcMType.lhs line 526 t_a32G{tv} [tau]
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
Where that code look something like this:
```
do { ASSERTM2( do { details <- readMetaTyVar tyvar; return (isFlexi details) }, ppr tyvar )
; traceTc (text "writeMetaTyVar" <+> ppr tyvar <+> text ":=" <+> ppr ty)
; writeMutVar (metaTvRef tyvar) (Indirect ty) }
```
Full program is attached.
Actually, the program has a type error (as rerunning with a non -DDEBUG build showed):
```
Properties.hs:78:25:
Could not deduce (Data.Vector.Unboxed.IVector [] a)
from the context (Eq a,
Ord a,
Eq (v a),
Ord (v a),
Show a,
Arbitrary a,
Model a a,
Show (v a),
Arbitrary (v a),
Model (v a) [a],
Data.Vector.Unboxed.IVector v a,
Show (v Bool),
Arbitrary (v Bool),
Model (v Bool) [Bool],
Data.Vector.Unboxed.IVector v Bool)
arising from a use of `Data.Vector.Unboxed.length'
at Properties.hs:78:25-32
Possible fix:
add (Data.Vector.Unboxed.IVector [] a) to the context of
the type signature for `testVersusLists'
or add an instance declaration for
(Data.Vector.Unboxed.IVector [] a)
In the first argument of `eq1', namely
`(Data.Vector.Unboxed.length :: v a -> Int)'
In the expression:
(Data.Vector.Unboxed.length :: v a -> Int) `eq1` length
In the definition of `prop_length':
prop_length = (Data.Vector.Unboxed.length :: v a -> Int)
`eq1`
length
Properties.hs:83:25:
No instance for (Data.Vector.Unboxed.IVector [] Bool)
arising from a use of `Data.Vector.Unboxed.and'
at Properties.hs:83:25-29
Possible fix:
add an instance declaration for
(Data.Vector.Unboxed.IVector [] Bool)
In the first argument of `eq1', namely
`(Data.Vector.Unboxed.and :: v Bool -> Bool)'
In the expression:
(Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and
In the definition of `prop_and':
prop_and = (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and
Properties.hs:95:24:
Could not deduce (Eq ([a] -> [a]))
from the context (Eq a,
Ord a,
Eq (v a),
Ord (v a),
Show a,
Arbitrary a,
Model a a,
Show (v a),
Arbitrary (v a),
Model (v a) [a],
Data.Vector.Unboxed.IVector v a,
Show (v Bool),
Arbitrary (v Bool),
Model (v Bool) [Bool],
Data.Vector.Unboxed.IVector v Bool)
arising from a use of `eq2' at Properties.hs:95:24-86
Possible fix:
add (Eq ([a] -> [a])) to the context of
the type signature for `testVersusLists'
or add an instance declaration for (Eq ([a] -> [a]))
In the expression:
(Data.Vector.Unboxed.zipWith :: (a -> a -> a) -> v a -> v a -> v a)
`eq2`
zipWith
In the definition of `prop_zipWith':
prop_zipWith = (Data.Vector.Unboxed.zipWith ::
(a -> a -> a) -> v a -> v a -> v a)
`eq2`
zipWith
In the definition of `testVersusLists':
testVersusLists _ = [testGroup "Prelude" prelude_tests,
testGroup "Data.List" data_list_tests,
testGroup "Extras" extra_tests]
where
prelude_tests = [testProperty "length" prop_length, ....]
prop_length = (Data.Vector.Unboxed.length :: v a -> Int)
`eq1`
length
prop_null = (Data.Vector.Unboxed.null :: v a -> Bool) `eq1` null
prop_and = (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and
....
Properties.hs:114:25:
Couldn't match expected type `v' against inferred type `[]'
`v' is a rigid type variable bound by
the type signature for `testVersusLists' at Properties.hs:19:28
In the first argument of `eq2', namely
`(enumFromTo :: a -> a -> v a)'
In the expression: (enumFromTo :: a -> a -> v a) `eq2` enumFromTo
In the definition of `prop_enumFromTo':
prop_enumFromTo = (enumFromTo :: a -> a -> v a) `eq2` enumFromTo
Properties.hs:115:76:
Could not deduce (Enum a)
from the context (Eq a,
Ord a,
Eq (v a),
Ord (v a),
Show a,
Arbitrary a,
Model a a,
Show (v a),
Arbitrary (v a),
Model (v a) [a],
Data.Vector.Unboxed.IVector v a,
Show (v Bool),
Arbitrary (v Bool),
Model (v Bool) [Bool],
Data.Vector.Unboxed.IVector v Bool)
arising from a use of `enumFromThenTo' at Properties.hs:115:76-89
Possible fix:
add (Enum a) to the context of
the type signature for `testVersusLists'
In the second argument of `eq3', namely `enumFromThenTo'
In the expression:
(enumFromThenTo :: a -> a -> a -> v a) `eq3` enumFromThenTo
In the definition of `prop_enumFromThenTo':
prop_enumFromThenTo = (enumFromThenTo :: a -> a -> a -> v a)
`eq3`
enumFromThenTo
Properties.hs:176:16:
Could not deduce (Model [a] [a])
from the context (Eq a,
Ord a,
Eq (v a),
Ord (v a),
Show a,
Arbitrary a,
Model a a,
Show (v a),
Arbitrary (v a),
Model (v a) [a],
Data.Vector.Unboxed.IVector v a,
Show (v Bool),
Arbitrary (v Bool),
Model (v Bool) [Bool],
Data.Vector.Unboxed.IVector v Bool)
arising from a use of `eq2' at Properties.hs:176:16-71
Possible fix:
add (Model [a] [a]) to the context of
the type signature for `testVersusLists'
or add an instance declaration for (Model [a] [a])
In the expression:
(Data.Vector.Unboxed.snoc :: v a -> a -> v a) `eq2` snoc
In the definition of `prop_snoc':
prop_snoc = (Data.Vector.Unboxed.snoc :: v a -> a -> v a)
`eq2`
snoc
In the definition of `testVersusLists':
testVersusLists _ = [testGroup "Prelude" prelude_tests,
testGroup "Data.List" data_list_tests,
testGroup "Extras" extra_tests]
where
prelude_tests = [testProperty "length" prop_length, ....]
prop_length = (Data.Vector.Unboxed.length :: v a -> Int)
`eq1`
length
prop_null = (Data.Vector.Unboxed.null :: v a -> Bool) `eq1` null
prop_and = (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and
....
```
But we probably still shouldn't get the ASSERT.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.11 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ASSERT failed: file typecheck/TcMType.lhs line 526 t_a32G{tv}","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.11","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"NB: this is NOT AFAIK a duplicate of the previous ticket about the TcMType ASSERT failure. It was observed on a recent HEAD (as of 6th February 2009) while I happened to be using a stage 2 compiler with -DDEBUG on to compile some code I was working on.\r\n\r\nError is as follows:\r\n{{{\r\n$ ./Setup clean && ./Setup configure --with-compiler=/Users/mbolingbroke/Programming/Checkouts/ghc.working/ghc/stage2-inplace/ghc --with-hc-pkg=/Users/mbolingbroke/Programming/Checkouts/ghc.working/ghc/stage2-inplace/ghc-pkg --ghc --global && ./Setup build && dist/build/vector-tests/vector-tests\r\ncleaning...\r\nConfiguring vector-tests-0.2...\r\nPreprocessing executables for vector-tests-0.2...\r\nBuilding vector-tests-0.2...\r\n[1 of 3] Compiling Utilities ( Utilities.hs, dist/build/vector-tests/vector-tests-tmp/Utilities.o )\r\nWARNING: file simplCore/SimplCore.lhs line 545\r\nSimplifier still going after 4 iterations; bailing out. Size = 1398\r\n\r\n[2 of 3] Compiling Properties ( Properties.hs, dist/build/vector-tests/vector-tests-tmp/Properties.o )\r\nWARNING: file typecheck/TcTyFuns.lhs line 284\r\n(This warning is harmless; for Simon & Manuel)\r\n[Wanted t_a32G{tv} [tau] :: ghc-prim:GHC.Types.[]{(w) tc 317}\r\n ~\r\n v{tv a2S9} [sk]]\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 6.11.20090204 for i386-apple-darwin):\r\n ASSERT failed! file typecheck/TcMType.lhs line 526 t_a32G{tv} [tau]\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nWhere that code look something like this:\r\n\r\n{{{\r\n do\t{ ASSERTM2( do { details <- readMetaTyVar tyvar; return (isFlexi details) }, ppr tyvar )\r\n\t; traceTc (text \"writeMetaTyVar\" <+> ppr tyvar <+> text \":=\" <+> ppr ty)\r\n\t; writeMutVar (metaTvRef tyvar) (Indirect ty) }\r\n}}}\r\n\r\nFull program is attached.\r\n\r\nActually, the program has a type error (as rerunning with a non -DDEBUG build showed):\r\n\r\n{{{\r\nProperties.hs:78:25:\r\n Could not deduce (Data.Vector.Unboxed.IVector [] a)\r\n from the context (Eq a,\r\n Ord a,\r\n Eq (v a),\r\n Ord (v a),\r\n Show a,\r\n Arbitrary a,\r\n Model a a,\r\n Show (v a),\r\n Arbitrary (v a),\r\n Model (v a) [a],\r\n Data.Vector.Unboxed.IVector v a,\r\n Show (v Bool),\r\n Arbitrary (v Bool),\r\n Model (v Bool) [Bool],\r\n Data.Vector.Unboxed.IVector v Bool)\r\n arising from a use of `Data.Vector.Unboxed.length'\r\n at Properties.hs:78:25-32\r\n Possible fix:\r\n add (Data.Vector.Unboxed.IVector [] a) to the context of\r\n the type signature for `testVersusLists'\r\n or add an instance declaration for\r\n (Data.Vector.Unboxed.IVector [] a)\r\n In the first argument of `eq1', namely\r\n `(Data.Vector.Unboxed.length :: v a -> Int)'\r\n In the expression:\r\n (Data.Vector.Unboxed.length :: v a -> Int) `eq1` length\r\n In the definition of `prop_length':\r\n prop_length = (Data.Vector.Unboxed.length :: v a -> Int)\r\n `eq1`\r\n length\r\n\r\nProperties.hs:83:25:\r\n No instance for (Data.Vector.Unboxed.IVector [] Bool)\r\n arising from a use of `Data.Vector.Unboxed.and'\r\n at Properties.hs:83:25-29\r\n Possible fix:\r\n add an instance declaration for\r\n (Data.Vector.Unboxed.IVector [] Bool)\r\n In the first argument of `eq1', namely\r\n `(Data.Vector.Unboxed.and :: v Bool -> Bool)'\r\n In the expression:\r\n (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and\r\n In the definition of `prop_and':\r\n prop_and = (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and\r\n\r\nProperties.hs:95:24:\r\n Could not deduce (Eq ([a] -> [a]))\r\n from the context (Eq a,\r\n Ord a,\r\n Eq (v a),\r\n Ord (v a),\r\n Show a,\r\n Arbitrary a,\r\n Model a a,\r\n Show (v a),\r\n Arbitrary (v a),\r\n Model (v a) [a],\r\n Data.Vector.Unboxed.IVector v a,\r\n Show (v Bool),\r\n Arbitrary (v Bool),\r\n Model (v Bool) [Bool],\r\n Data.Vector.Unboxed.IVector v Bool)\r\n arising from a use of `eq2' at Properties.hs:95:24-86\r\n Possible fix:\r\n add (Eq ([a] -> [a])) to the context of\r\n the type signature for `testVersusLists'\r\n or add an instance declaration for (Eq ([a] -> [a]))\r\n In the expression:\r\n (Data.Vector.Unboxed.zipWith :: (a -> a -> a) -> v a -> v a -> v a)\r\n `eq2`\r\n zipWith\r\n In the definition of `prop_zipWith':\r\n prop_zipWith = (Data.Vector.Unboxed.zipWith ::\r\n (a -> a -> a) -> v a -> v a -> v a)\r\n `eq2`\r\n zipWith\r\n In the definition of `testVersusLists':\r\n testVersusLists _ = [testGroup \"Prelude\" prelude_tests,\r\n testGroup \"Data.List\" data_list_tests,\r\n testGroup \"Extras\" extra_tests]\r\n where\r\n prelude_tests = [testProperty \"length\" prop_length, ....]\r\n prop_length = (Data.Vector.Unboxed.length :: v a -> Int)\r\n `eq1`\r\n length\r\n prop_null = (Data.Vector.Unboxed.null :: v a -> Bool) `eq1` null\r\n prop_and = (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and\r\n ....\r\n\r\nProperties.hs:114:25:\r\n Couldn't match expected type `v' against inferred type `[]'\r\n `v' is a rigid type variable bound by\r\n the type signature for `testVersusLists' at Properties.hs:19:28\r\n In the first argument of `eq2', namely\r\n `(enumFromTo :: a -> a -> v a)'\r\n In the expression: (enumFromTo :: a -> a -> v a) `eq2` enumFromTo\r\n In the definition of `prop_enumFromTo':\r\n prop_enumFromTo = (enumFromTo :: a -> a -> v a) `eq2` enumFromTo\r\n\r\nProperties.hs:115:76:\r\n Could not deduce (Enum a)\r\n from the context (Eq a,\r\n Ord a,\r\n Eq (v a),\r\n Ord (v a),\r\n Show a,\r\n Arbitrary a,\r\n Model a a,\r\n Show (v a),\r\n Arbitrary (v a),\r\n Model (v a) [a],\r\n Data.Vector.Unboxed.IVector v a,\r\n Show (v Bool),\r\n Arbitrary (v Bool),\r\n Model (v Bool) [Bool],\r\n Data.Vector.Unboxed.IVector v Bool)\r\n arising from a use of `enumFromThenTo' at Properties.hs:115:76-89\r\n Possible fix:\r\n add (Enum a) to the context of\r\n the type signature for `testVersusLists'\r\n In the second argument of `eq3', namely `enumFromThenTo'\r\n In the expression:\r\n (enumFromThenTo :: a -> a -> a -> v a) `eq3` enumFromThenTo\r\n In the definition of `prop_enumFromThenTo':\r\n prop_enumFromThenTo = (enumFromThenTo :: a -> a -> a -> v a)\r\n `eq3`\r\n enumFromThenTo\r\n\r\nProperties.hs:176:16:\r\n Could not deduce (Model [a] [a])\r\n from the context (Eq a,\r\n Ord a,\r\n Eq (v a),\r\n Ord (v a),\r\n Show a,\r\n Arbitrary a,\r\n Model a a,\r\n Show (v a),\r\n Arbitrary (v a),\r\n Model (v a) [a],\r\n Data.Vector.Unboxed.IVector v a,\r\n Show (v Bool),\r\n Arbitrary (v Bool),\r\n Model (v Bool) [Bool],\r\n Data.Vector.Unboxed.IVector v Bool)\r\n arising from a use of `eq2' at Properties.hs:176:16-71\r\n Possible fix:\r\n add (Model [a] [a]) to the context of\r\n the type signature for `testVersusLists'\r\n or add an instance declaration for (Model [a] [a])\r\n In the expression:\r\n (Data.Vector.Unboxed.snoc :: v a -> a -> v a) `eq2` snoc\r\n In the definition of `prop_snoc':\r\n prop_snoc = (Data.Vector.Unboxed.snoc :: v a -> a -> v a)\r\n `eq2`\r\n snoc\r\n In the definition of `testVersusLists':\r\n testVersusLists _ = [testGroup \"Prelude\" prelude_tests,\r\n testGroup \"Data.List\" data_list_tests,\r\n testGroup \"Extras\" extra_tests]\r\n where\r\n prelude_tests = [testProperty \"length\" prop_length, ....]\r\n prop_length = (Data.Vector.Unboxed.length :: v a -> Int)\r\n `eq1`\r\n length\r\n prop_null = (Data.Vector.Unboxed.null :: v a -> Bool) `eq1` null\r\n prop_and = (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and\r\n ....\r\n}}}\r\n\r\nBut we probably still shouldn't get the ASSERT.","type_of_failure":"OtherFailure","blocking":[]} -->7.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/2999yi darcs crashes ghc 6.11.200902012019-07-07T19:05:57ZIlmari Vacklinyi darcs crashes ghc 6.11.20090201```
Building yi-0.5.3...
[ 1 of 107] Compiling System.FriendlyPath ( System/FriendlyPath.hs, dist/build/System/FriendlyPath.o )
[ 2 of 107] Compiling Shim.ProjectContent ( Shim/ProjectContent.hs, dist/build/Shim/ProjectContent.o )
WARN...```
Building yi-0.5.3...
[ 1 of 107] Compiling System.FriendlyPath ( System/FriendlyPath.hs, dist/build/System/FriendlyPath.o )
[ 2 of 107] Compiling Shim.ProjectContent ( Shim/ProjectContent.hs, dist/build/Shim/ProjectContent.o )
WARNING: file simplCore/SimplCore.lhs line 545
Simplifier still going after 4 iterations; bailing out. Size = 4969
[ 3 of 107] Compiling Parser.Incremental ( Parser/Incremental.hs, dist/build/Parser/Incremental.o )
ghc: panic! (the 'impossible' happened)
(GHC version 6.11.20090201 for x86_64-unknown-linux):
ASSERT failed! file typecheck/TcTyFuns.lhs line 286
[Wanted t_a89i{tv} [tau] :: a{tv a89b} [sk]
~
a{tv a89a} [sk] -> t_a89h{tv} [tau]]
```Manuel M T ChakravartyManuel M T Chakravartyhttps://gitlab.haskell.org/ghc/ghc/-/issues/2944Mutually recursive equality constraints2019-07-07T19:06:11ZMartijnVanSteenbergenMutually recursive equality constraintsGiven this piece of code:
```
{-# LANGUAGE TypeFamilies #-}
class C a where
type T a :: *
f1 :: T a ~ () => a
f1 = f2
f2 :: T a ~ () => a
f2 = f1
```
GHC complains:
```
Couldn't match expected type `T a ~ ()'
again...Given this piece of code:
```
{-# LANGUAGE TypeFamilies #-}
class C a where
type T a :: *
f1 :: T a ~ () => a
f1 = f2
f2 :: T a ~ () => a
f2 = f1
```
GHC complains:
```
Couldn't match expected type `T a ~ ()'
against inferred type `T a1 ~ ()'
When matching the contexts of the signatures for
f1 :: forall a. (T a ~ ()) => a
f2 :: forall a. (T a ~ ()) => a
The signature contexts in a mutually recursive group should all be identical
When generalising the type(s) for f1, f2
```
Is this a bug? Enabling RelaxedPolyRec fixes the problem. Should TypeFamilies—just like GADTs—imply RelaxedPolyRec?
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Mutually recursive equality constraints","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Given this piece of code:\r\n\r\n{{{\r\n{-# LANGUAGE TypeFamilies #-}\r\n\r\nclass C a where\r\n type T a :: *\r\n\r\nf1 :: T a ~ () => a\r\nf1 = f2\r\n\r\nf2 :: T a ~ () => a\r\nf2 = f1\r\n}}}\r\n\r\nGHC complains:\r\n\r\n{{{\r\n Couldn't match expected type `T a ~ ()'\r\n against inferred type `T a1 ~ ()'\r\n When matching the contexts of the signatures for\r\n f1 :: forall a. (T a ~ ()) => a\r\n f2 :: forall a. (T a ~ ()) => a\r\n The signature contexts in a mutually recursive group should all be identical\r\n When generalising the type(s) for f1, f2\r\n}}}\r\n\r\nIs this a bug? Enabling RelaxedPolyRec fixes the problem. Should TypeFamilies—just like GADTs—imply RelaxedPolyRec?\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->Ian Lynagh <igloo@earth.li>Ian Lynagh <igloo@earth.li>https://gitlab.haskell.org/ghc/ghc/-/issues/2900Confusing error message for monadic function with wrong number of arguments2019-07-07T19:06:21Zchevalier@alum.wellesley.eduConfusing error message for monadic function with wrong number of argumentsIf I compile the following code:
```
import Control.Monad.State
foo :: MonadIO m => Int -> m ()
foo x y = return ()
```
I get the error message:
```
bug.hs:6:10:
Couldn't match expected type `()' against inferred type `m ()'
...If I compile the following code:
```
import Control.Monad.State
foo :: MonadIO m => Int -> m ()
foo x y = return ()
```
I get the error message:
```
bug.hs:6:10:
Couldn't match expected type `()' against inferred type `m ()'
In the expression: return ()
In the definition of `foo': foo x y = return ()
```
On the other hand, if I change foo's type signature to:
```
foo :: Int -> IO ()
```
I get the more helpful:
```
bug.hs:6:0:
The equation(s) for `foo' have two arguments,
but its type `Int -> IO ()' has only one
```
It would be good if the second error message appeared in the first case as well.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Confusing error message for monadic function with wrong number of arguments","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"If I compile the following code:\r\n\r\n{{{\r\nimport Control.Monad.State\r\n\r\nfoo :: MonadIO m => Int -> m ()\r\nfoo x y = return ()\r\n}}}\r\n\r\nI get the error message:\r\n\r\n{{{\r\nbug.hs:6:10:\r\n Couldn't match expected type `()' against inferred type `m ()'\r\n In the expression: return ()\r\n In the definition of `foo': foo x y = return ()\r\n}}}\r\n\r\nOn the other hand, if I change foo's type signature to:\r\n{{{\r\nfoo :: Int -> IO ()\r\n}}}\r\nI get the more helpful:\r\n{{{\r\nbug.hs:6:0:\r\n The equation(s) for `foo' have two arguments,\r\n but its type `Int -> IO ()' has only one\r\n}}}\r\n\r\nIt would be good if the second error message appeared in the first case as well.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/2899GADT type inference with existentials2019-07-07T19:06:22ZjochembGADT type inference with existentialsThe following code works in GHC 6.8.2:
```
{-# OPTIONS -fglasgow-exts #-}
module Test where
data Existential = forall a. Ex (GADT a)
data GADT :: * -> * where
GCon :: Int -> GADT ()
-- g :: Existential -> Int
g (Ex (GCon x)) ...The following code works in GHC 6.8.2:
```
{-# OPTIONS -fglasgow-exts #-}
module Test where
data Existential = forall a. Ex (GADT a)
data GADT :: * -> * where
GCon :: Int -> GADT ()
-- g :: Existential -> Int
g (Ex (GCon x)) = x
```
The compiler correctly infers the type of x in the definition of g, and correctly infers the type of g.
In GHC 6.10.1, however, this fails with:
```
Test.hs:10:12:
GADT pattern match with non-rigid result type `t'
Solution: add a type signature
In the definition of `g': g (Ex (GCon x)) = x
Failed, modules loaded: none.
```
The solution, to include the type signature of g (that I have commented out), works, but why can't GHC figure out the type of g? GHC 6.8.2 could!
An equivalent version with a non-GADT instead, works correctly:
```
data GADT a = GCon Int
```
Ticket #2206 might be related.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GADT type inference with existentials","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":["GADT,","existential","types"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"\r\nThe following code works in GHC 6.8.2:\r\n\r\n{{{\r\n{-# OPTIONS -fglasgow-exts #-}\r\nmodule Test where\r\n\r\ndata Existential = forall a. Ex (GADT a)\r\n\r\ndata GADT :: * -> * where\r\n GCon :: Int -> GADT ()\r\n\r\n-- g :: Existential -> Int\r\ng (Ex (GCon x)) = x\r\n}}}\r\n\r\nThe compiler correctly infers the type of x in the definition of g, and correctly infers the type of g.\r\n\r\nIn GHC 6.10.1, however, this fails with:\r\n{{{\r\nTest.hs:10:12:\r\n GADT pattern match with non-rigid result type `t'\r\n Solution: add a type signature\r\n In the definition of `g': g (Ex (GCon x)) = x\r\nFailed, modules loaded: none.\r\n}}}\r\n\r\nThe solution, to include the type signature of g (that I have commented out), works, but why can't GHC figure out the type of g? GHC 6.8.2 could!\r\n\r\nAn equivalent version with a non-GADT instead, works correctly:\r\n{{{\r\ndata GADT a = GCon Int\r\n}}}\r\n\r\nTicket #2206 might be related.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/2851Improve error message for failed deriving2019-07-07T19:06:33ZguestImprove error message for failed derivingThe following does not work:
```
type family F a :: *
data D a = D (F a)
deriving (Show)
```
The natural way of adding an instance does work (with enough extensions turned on):
```
instance (Show (F a)) => Show (D a) where
sh...The following does not work:
```
type family F a :: *
data D a = D (F a)
deriving (Show)
```
The natural way of adding an instance does work (with enough extensions turned on):
```
instance (Show (F a)) => Show (D a) where
show (D x) = "D " ++ show x
```
It would be nice if the deriving mechanism could derive this code.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 6.10.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Deriving doesn't work when type families are involved","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"The following does not work:\r\n\r\n{{{\r\ntype family F a :: *\r\n\r\ndata D a = D (F a)\r\n deriving (Show)\r\n}}}\r\n\r\nThe natural way of adding an instance does work (with enough extensions turned on):\r\n\r\n{{{\r\ninstance (Show (F a)) => Show (D a) where\r\n show (D x) = \"D \" ++ show x\r\n}}}\r\n\r\nIt would be nice if the deriving mechanism could derive this code.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->Ian Lynagh <igloo@earth.li>Ian Lynagh <igloo@earth.li>https://gitlab.haskell.org/ghc/ghc/-/issues/2787Panic (core lint failure) with type synonym in GHC 6.10.12019-07-07T19:06:50ZBenMoseleyPanic (core lint failure) with type synonym in GHC 6.10.1This causes a panic:
```
{-# LANGUAGE TypeFamilies, GADTs #-}
module GHCBug (
PVR(..),
Core(..),
analyseCore
)
where
data Core a where Ctr :: Core Double
data PVR a = PVR a deriving (Eq, Show)
class Sub a where
type AssocSy...This causes a panic:
```
{-# LANGUAGE TypeFamilies, GADTs #-}
module GHCBug (
PVR(..),
Core(..),
analyseCore
)
where
data Core a where Ctr :: Core Double
data PVR a = PVR a deriving (Eq, Show)
class Sub a where
type AssocSyn a :: * -> *
instance Sub Double where
type AssocSyn Double = PVR
analyseCore :: Core a -> ((AssocSyn a) a)
analyseCore Ctr = pvr
where
-- GHC panics if we use the below as the type sig for 'pvr'
pvr :: PVR ~ AssocSyn a => (AssocSyn a) a
-- pvr :: (AssocSyn a) a
pvr = undefined
main :: IO ()
main = print "ok"
```
The basic compiler panic is:
```
c:/ws/main/depot/QA/EDG/EDG_priv/FPF_Dev.br/src $ ghc -main-is GHCBug ~/GHCBug.hs
ghc.exe: panic! (the 'impossible' happened)
(GHC version 6.10.1 for i386-unknown-mingw32):
initC: srt_lbl
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
The core lint failure part is:
```
*** Checking old interface for main:GHCBug:
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 199
*** Core Lint Errors: in result of Desugar ***
{-# LINE 21 "F:\ME\GHCBug.hs #-}:
[RHS of pvr_awa :: GHCBug.AssocSyn
GHC.Types.Double GHC.Types.Double]
pvr_afN is out of scope
*** Offending Program ***
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Windows |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Panic (core lint failure) with type synonym in GHC 6.10.1","status":"New","operating_system":"Windows","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This causes a panic:\r\n\r\n{{{\r\n{-# LANGUAGE TypeFamilies, GADTs #-}\r\nmodule GHCBug (\r\n PVR(..),\r\n Core(..),\r\n analyseCore\r\n)\r\nwhere\r\n\r\ndata Core a where Ctr :: Core Double\r\ndata PVR a = PVR a deriving (Eq, Show)\r\n\r\n\r\nclass Sub a where\r\n type AssocSyn a :: * -> *\r\n\r\ninstance Sub Double where\r\n type AssocSyn Double = PVR\r\n\r\n\r\nanalyseCore :: Core a -> ((AssocSyn a) a)\r\nanalyseCore Ctr = pvr\r\n where\r\n -- GHC panics if we use the below as the type sig for 'pvr'\r\n pvr :: PVR ~ AssocSyn a => (AssocSyn a) a\r\n -- pvr :: (AssocSyn a) a\r\n pvr = undefined\r\n\r\nmain :: IO ()\r\nmain = print \"ok\"\r\n}}}\r\n\r\nThe basic compiler panic is:\r\n{{{\r\nc:/ws/main/depot/QA/EDG/EDG_priv/FPF_Dev.br/src $ ghc -main-is GHCBug ~/GHCBug.hs\r\nghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 6.10.1 for i386-unknown-mingw32):\r\n\tinitC: srt_lbl\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nThe core lint failure part is:\r\n{{{\r\n*** Checking old interface for main:GHCBug:\r\n*** Parser:\r\n*** Renamer/typechecker:\r\n*** Desugar:\r\n Result size = 199\r\n*** Core Lint Errors: in result of Desugar ***\r\n{-# LINE 21 \"F:\\ME\\GHCBug.hs #-}:\r\n [RHS of pvr_awa :: GHCBug.AssocSyn\r\n GHC.Types.Double GHC.Types.Double]\r\n pvr_afN is out of scope\r\n*** Offending Program ***\r\n}}}\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->Manuel M T ChakravartyManuel M T Chakravartyhttps://gitlab.haskell.org/ghc/ghc/-/issues/2767Type family bug ?2019-07-07T19:06:58ZtestType family bug ?I get this error when compiling a program with associated type families:
```
$ ghc --make Queens_v2.hs
[1 of 5] Compiling Domain ( Domain.hs, Domain.o )
[2 of 5] Compiling Solver ( Solver.hs, Solver.o )
[3 of 5] Com...I get this error when compiling a program with associated type families:
```
$ ghc --make Queens_v2.hs
[1 of 5] Compiling Domain ( Domain.hs, Domain.o )
[2 of 5] Compiling Solver ( Solver.hs, Solver.o )
[3 of 5] Compiling FD ( FD.hs, FD.o )
[4 of 5] Compiling SearchTree ( SearchTree.hs, SearchTree.o )
[5 of 5] Compiling Main ( Queens_v2.hs, Queens_v2.o )
ghc: panic! (the 'impossible' happened)
(GHC version 6.10.1 for i386-apple-darwin):
idInfo co{v a629} [tv]
```
Tom Schrijvers
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | MacOS X |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Type family bug ?","status":"New","operating_system":"MacOS X","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I get this error when compiling a program with associated type families:\r\n{{{\r\n$ ghc --make Queens_v2.hs \r\n[1 of 5] Compiling Domain ( Domain.hs, Domain.o )\r\n[2 of 5] Compiling Solver ( Solver.hs, Solver.o )\r\n[3 of 5] Compiling FD ( FD.hs, FD.o )\r\n[4 of 5] Compiling SearchTree ( SearchTree.hs, SearchTree.o )\r\n[5 of 5] Compiling Main ( Queens_v2.hs, Queens_v2.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 6.10.1 for i386-apple-darwin):\r\n\tidInfo co{v a629} [tv]\r\n}}}\r\n\r\nTom Schrijvers","type_of_failure":"OtherFailure","blocking":[]} -->6.12 branchManuel M T ChakravartyManuel M T Chakravartyhttps://gitlab.haskell.org/ghc/ghc/-/issues/2761type checker bug2019-07-07T19:07:00Zguesttype checker bugThis causes a type error:
```
foo :: forall b. (b -> String, Int)
foo = (const "hi", 0)
bar :: (forall b. b -> String, Int)
bar = foo
```
This should compile fine since the types are equivalent.This causes a type error:
```
foo :: forall b. (b -> String, Int)
foo = (const "hi", 0)
bar :: (forall b. b -> String, Int)
bar = foo
```
This should compile fine since the types are equivalent.https://gitlab.haskell.org/ghc/ghc/-/issues/2738Regression in type checking of sections in records2019-07-07T19:07:06ZdonsRegression in type checking of sections in recordsLooks like a GHC 6.10 regression.
The following code, from xmonad-contrib, fails with an error under 6.10, but not under other compilers,
```
[ 74 of 138] Compiling XMonad.Hooks.UrgencyHook ( XMonad/Hooks/UrgencyHook.hs, dist/build/XMo...Looks like a GHC 6.10 regression.
The following code, from xmonad-contrib, fails with an error under 6.10, but not under other compilers,
```
[ 74 of 138] Compiling XMonad.Hooks.UrgencyHook ( XMonad/Hooks/UrgencyHook.hs, dist/build/XMonad/Hooks/UrgencyHook.o )
XMonad/Hooks/UrgencyHook.hs:424:48:
The section `5 `seconds`' takes one argument,
but its type `Int' has none
In the `duration' field of a record
In the expression:
DzenUrgencyHook {duration = (5 `seconds`), args = []}
In the definition of `dzenUrgencyHook':
dzenUrgencyHook = DzenUrgencyHook
{duration = (5 `seconds`), args = []}
```
The relevant code is:
```
-- | Flashes when a window requests your attention and you can't see it.
-- Defaults to a duration of five seconds, and no extra args to dzen.
-- See 'DzenUrgencyHook'.
dzenUrgencyHook :: DzenUrgencyHook
dzenUrgencyHook = DzenUrgencyHook { duration = (5 `seconds`), args = [] }
```
Which looks harmless enough. In fact, rearranging the section let's it pass type checking:
```
dzenUrgencyHook = DzenUrgencyHook { duration = seconds 5, args = [] }
```
The relevant code can be found here: http://code.haskell.org/XMonadContrib/XMonad/Hooks/UrgencyHook.hs, line 424.
To reproduce, assuming ghc 6.10 is installed, and X11,
```
$ cd XMonadContrib
$ cabal install
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Regression in type checking of sections in records","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Looks like a GHC 6.10 regression.\r\n\r\nThe following code, from xmonad-contrib, fails with an error under 6.10, but not under other compilers,\r\n\r\n{{{\r\n[ 74 of 138] Compiling XMonad.Hooks.UrgencyHook ( XMonad/Hooks/UrgencyHook.hs, dist/build/XMonad/Hooks/UrgencyHook.o )\r\n\r\nXMonad/Hooks/UrgencyHook.hs:424:48:\r\n The section `5 `seconds`' takes one argument,\r\n but its type `Int' has none\r\n In the `duration' field of a record\r\n In the expression:\r\n DzenUrgencyHook {duration = (5 `seconds`), args = []}\r\n In the definition of `dzenUrgencyHook':\r\n dzenUrgencyHook = DzenUrgencyHook\r\n {duration = (5 `seconds`), args = []}\r\n}}}\r\n\r\nThe relevant code is:\r\n\r\n{{{\r\n-- | Flashes when a window requests your attention and you can't see it.\r\n-- Defaults to a duration of five seconds, and no extra args to dzen.\r\n-- See 'DzenUrgencyHook'.\r\ndzenUrgencyHook :: DzenUrgencyHook\r\ndzenUrgencyHook = DzenUrgencyHook { duration = (5 `seconds`), args = [] }\r\n}}}\r\n\r\nWhich looks harmless enough. In fact, rearranging the section let's it pass type checking:\r\n\r\n{{{\r\ndzenUrgencyHook = DzenUrgencyHook { duration = seconds 5, args = [] }\r\n}}}\r\n\r\nThe relevant code can be found here: http://code.haskell.org/XMonadContrib/XMonad/Hooks/UrgencyHook.hs, line 424.\r\n\r\nTo reproduce, assuming ghc 6.10 is installed, and X11,\r\n\r\n{{{\r\n$ cd XMonadContrib \r\n$ cabal install\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/2715Equality constraint in superclass not supported2019-07-07T19:07:12ZrodpriceEquality constraint in superclass not supportedThe code in "bug.hs" causes a GHC panic; the nearly identical code in "unbug.hs" does not.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version ...The code in "bug.hs" causes a GHC panic; the nearly identical code in "unbug.hs" does not.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC panic","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The code in \"bug.hs\" causes a GHC panic; the nearly identical code in \"unbug.hs\" does not.","type_of_failure":"OtherFailure","blocking":[]} -->7.2.1Manuel M T ChakravartyManuel M T Chakravartyhttps://gitlab.haskell.org/ghc/ghc/-/issues/2714No match in record selector Var.tcTyVarDetails2019-07-07T19:07:12ZmorrowNo match in record selector Var.tcTyVarDetailsSummary:
```
ghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)
*** Exception: No match in record selector Var.tcTyVarDetails
```
I stumbled across this while in ghci with flags:
```
:set -fglasgow-exts -O2 -fno-print-bind-result
...Summary:
```
ghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)
*** Exception: No match in record selector Var.tcTyVarDetails
```
I stumbled across this while in ghci with flags:
```
:set -fglasgow-exts -O2 -fno-print-bind-result
:set -XQuasiQuotes -XTemplateHaskell
```
Beginning with where I came across it and proceeding
in reverse chrono order wrt ghc versions:
```
[m@ganon feio]$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 6.10.0.20080927
ghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)
*** Exception: No match in record selector Var.tcTyVarDetails
```
```
[m@ganon feio]$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 6.9.20080504
ghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)
*** Exception: No match in record selector Var.tcTyVarDetails
```
```
[m@ganon feio]$ /usr/bin/ghc-6.8.2 -V
The Glorious Glasgow Haskell Compilation System, version 6.8.2
ghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)
<interactive>:1:0:
Couldn't match expected type `c'
against inferred type `f (f b -> b)'
`c' is a rigid type variable bound by
the polymorphic type `forall c. c -> a' at <interactive>:1:0
Probable cause: `fmap' is applied to too few arguments
<interactive>:1:0:
Couldn't match expected type `a' against inferred type `f b'
`a' is a rigid type variable bound by
the polymorphic type
`forall a b. ((a -> b) -> b) -> forall c. c -> a'
at <interactive>:1:0
Probable cause: `fmap' is applied to too few arguments
```
```
[m@ganon feio]$ /usr/bin/ghc-6.8.1 -V
The Glorious Glasgow Haskell Compilation System, version 6.8.1
ghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)
<interactive>:1:0:
Couldn't match expected type `c'
against inferred type `f (f b -> b)'
`c' is a rigid type variable bound by
the polymorphic type `forall c. c -> a' at <interactive>:1:0
Probable cause: `fmap' is applied to too few arguments
```
Aside from filing a bug rpt, I'm curious in general about what
change to whathaveyou, some way or another, had this as a side-effect.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | mjm2002@gmail.com |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"No match in record selector Var.tcTyVarDetails","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.10.1","keywords":["Var,","record","selector","tcTyVarDetails,"],"differentials":[],"test_case":"","architecture":"","cc":["mjm2002@gmail.com"],"type":"Bug","description":"Summary:\r\n\r\n{{{\r\nghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)\r\n*** Exception: No match in record selector Var.tcTyVarDetails\r\n}}}\r\n\r\nI stumbled across this while in ghci with flags:\r\n\r\n{{{\r\n:set -fglasgow-exts -O2 -fno-print-bind-result\r\n:set -XQuasiQuotes -XTemplateHaskell\r\n}}}\r\n\r\nBeginning with where I came across it and proceeding\r\nin reverse chrono order wrt ghc versions:\r\n\r\n{{{\r\n[m@ganon feio]$ ghc -V\r\nThe Glorious Glasgow Haskell Compilation System, version 6.10.0.20080927\r\n\r\nghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)\r\n*** Exception: No match in record selector Var.tcTyVarDetails\r\n}}}\r\n\r\n{{{\r\n[m@ganon feio]$ ghc -V\r\nThe Glorious Glasgow Haskell Compilation System, version 6.9.20080504\r\n\r\nghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)\r\n*** Exception: No match in record selector Var.tcTyVarDetails\r\n}}}\r\n\r\n\r\n{{{\r\n[m@ganon feio]$ /usr/bin/ghc-6.8.2 -V\r\nThe Glorious Glasgow Haskell Compilation System, version 6.8.2\r\n\r\nghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)\r\n\r\n<interactive>:1:0:\r\n Couldn't match expected type `c'\r\n against inferred type `f (f b -> b)'\r\n `c' is a rigid type variable bound by\r\n the polymorphic type `forall c. c -> a' at <interactive>:1:0\r\n Probable cause: `fmap' is applied to too few arguments\r\n\r\n<interactive>:1:0:\r\n Couldn't match expected type `a' against inferred type `f b'\r\n `a' is a rigid type variable bound by\r\n the polymorphic type\r\n `forall a b. ((a -> b) -> b) -> forall c. c -> a'\r\n at <interactive>:1:0\r\n Probable cause: `fmap' is applied to too few arguments\r\n}}}\r\n\r\n{{{\r\n[m@ganon feio]$ /usr/bin/ghc-6.8.1 -V\r\nThe Glorious Glasgow Haskell Compilation System, version 6.8.1\r\n\r\nghci> :t fmap :: ((a -> b) -> b) -> (forall c. c -> a)\r\n\r\n<interactive>:1:0:\r\n Couldn't match expected type `c'\r\n against inferred type `f (f b -> b)'\r\n `c' is a rigid type variable bound by\r\n the polymorphic type `forall c. c -> a' at <interactive>:1:0\r\n Probable cause: `fmap' is applied to too few arguments\r\n}}}\r\n\r\nAside from filing a bug rpt, I'm curious in general about what\r\nchange to whathaveyou, some way or another, had this as a side-effect.","type_of_failure":"OtherFailure","blocking":[]} -->6.10.1mergemerge