GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:50:59Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/7178Panic in coVarsOfTcCo2019-07-07T18:50:59ZSimon Peyton JonesPanic in coVarsOfTcCoGanesh says: I'm getting the panic below when building darcs 2.8 with GHC 7.6. It'll take some effort to cut it down or give repro instructions for an uncut-down version (I needed to hack a lot of underlying packages to be able to even g...Ganesh says: I'm getting the panic below when building darcs 2.8 with GHC 7.6. It'll take some effort to cut it down or give repro instructions for an uncut-down version (I needed to hack a lot of underlying packages to be able to even get as far as doing this build), so could someone confirm that it's worth it before I do so? I can't spot anything already reporting this in trac.
```
ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.6.0.20120810 for i386-unknown-mingw32):
coVarsOfTcCo:Bind
cobox{v a6Czs} [lid]
= cobox{v a6CTr} [lid] `cast`
(<main:Darcs.Test.Patch.WithState.WithState{tc r1LL8}
model{tv tC} [tv]
..blah blah..
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.4.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | highest |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Panic in coVarsOfTcCo","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"7.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.4.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Ganesh says: I'm getting the panic below when building darcs 2.8 with GHC 7.6. It'll take some effort to cut it down or give repro instructions for an uncut-down version (I needed to hack a lot of underlying packages to be able to even get as far as doing this build), so could someone confirm that it's worth it before I do so? I can't spot anything already reporting this in trac.\r\n{{{\r\nghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 7.6.0.20120810 for i386-unknown-mingw32):\r\n coVarsOfTcCo:Bind\r\n cobox{v a6Czs} [lid]\r\n = cobox{v a6CTr} [lid] `cast`\r\n(<main:Darcs.Test.Patch.WithState.WithState{tc r1LL8}\r\n model{tv tC} [tv]\r\n ..blah blah..\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/7137Unnecessary -XRank2Types requirement involving type alias containing "forall"...2019-07-07T18:51:10ZjoeyadamsUnnecessary -XRank2Types requirement involving type alias containing "forall" from another moduleThe following builds with GHC 7.4, but not 7.6.
**Bottom.hs**
```
{-# LANGUAGE Rank2Types #-}
module Bottom where
type Bottom = forall a. a
data Pipe l i o u m r = Pipe
type GSource m o = forall l i u. Pipe l i o u m ()
```
**Main.h...The following builds with GHC 7.4, but not 7.6.
**Bottom.hs**
```
{-# LANGUAGE Rank2Types #-}
module Bottom where
type Bottom = forall a. a
data Pipe l i o u m r = Pipe
type GSource m o = forall l i u. Pipe l i o u m ()
```
**Main.hs**
```
import Bottom
myBottom :: Int -> Bottom
myBottom _ = error "Bottom"
main :: IO ()
main = myBottom 3
```
Note that Main.hs does not have the Rank2Types extension turned on.
myBottom does not have a rank-2 type. After expanding the type alias, you get:
```
myBottom :: Int -> forall a. a
```
This is logically equivalent to:
```
myBottom :: forall a. Int -> a
```
GHC 7.4.2 accepts this use of type alias, but GHC 7.6 does not.
Note that if we make something that does in fact expand to a rank-2 type:
```
foo :: Bottom -> Int
foo x = x
```
GHC 7.4.2 correctly rejects the program unless you enable Rank2Types.
Also, if we use a standalone Bottom type alias:
```
myBottom :: Bottom
```
Then GHC 7.6 accepts the program. It does not accept Int -\> Bottom without Rank2Types, but it does accept Bottom by itself.
This issue is easy to work around: just add {-\# LANGUAGE Rank2Types \#-} or {-\# LANGUAGE RankNTypes \#-} to the top of the module.
Is this a bug, or have the rules for type aliases and forall been deliberately tightened?
P.S.: This ticket is for GHC 7.6.1-rc1. That version tag is not available, though.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | |
| 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":"Unnecessary -XRank2Types requirement involving type alias containing \"forall\" from another module","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following builds with GHC 7.4, but not 7.6.\r\n\r\n'''Bottom.hs'''\r\n{{{\r\n{-# LANGUAGE Rank2Types #-}\r\nmodule Bottom where\r\n\r\ntype Bottom = forall a. a\r\n\r\ndata Pipe l i o u m r = Pipe\r\ntype GSource m o = forall l i u. Pipe l i o u m ()\r\n}}}\r\n\r\n\r\n'''Main.hs'''\r\n{{{\r\nimport Bottom\r\n\r\nmyBottom :: Int -> Bottom\r\nmyBottom _ = error \"Bottom\"\r\n\r\nmain :: IO ()\r\nmain = myBottom 3\r\n}}}\r\n\r\nNote that Main.hs does not have the Rank2Types extension turned on.\r\n\r\nmyBottom does not have a rank-2 type. After expanding the type alias, you get:\r\n\r\n{{{\r\nmyBottom :: Int -> forall a. a\r\n}}}\r\n\r\nThis is logically equivalent to:\r\n\r\n{{{\r\nmyBottom :: forall a. Int -> a\r\n}}}\r\n\r\nGHC 7.4.2 accepts this use of type alias, but GHC 7.6 does not.\r\n\r\nNote that if we make something that does in fact expand to a rank-2 type:\r\n\r\n{{{\r\nfoo :: Bottom -> Int\r\nfoo x = x\r\n}}}\r\n\r\nGHC 7.4.2 correctly rejects the program unless you enable Rank2Types.\r\n\r\nAlso, if we use a standalone Bottom type alias:\r\n\r\n{{{\r\nmyBottom :: Bottom\r\n}}}\r\n\r\nThen GHC 7.6 accepts the program. It does not accept Int -> Bottom without Rank2Types, but it does accept Bottom by itself.\r\n\r\nThis issue is easy to work around: just add {-# LANGUAGE Rank2Types #-} or {-# LANGUAGE RankNTypes #-} to the top of the module.\r\n\r\nIs this a bug, or have the rules for type aliases and forall been deliberately tightened?\r\n\r\nP.S.: This ticket is for GHC 7.6.1-rc1. That version tag is not available, though.","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/7124polykinds tests failing2019-07-07T18:51:16Zpcapriottipolykinds tests failingSome of the `polykinds` tests are failing with `-fhpc` with core lint errors, namely:
- `Freeman`
- `PolyKinds13`
- `T6015`Some of the `polykinds` tests are failing with `-fhpc` with core lint errors, namely:
- `Freeman`
- `PolyKinds13`
- `T6015`7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/7014RULES for bitwise logic and shift primops2019-07-07T18:51:47Ztakano-akioRULES for bitwise logic and shift primopsI think it will be useful if expressions like (x .\|. 0) and (shiftL x 0) are optimized away.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version ...I think it will be useful if expressions like (x .\|. 0) and (shiftL x 0) are optimized away.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 7.4.2 |
| 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":"RULES for bitwise logic and shift primops","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.4.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"I think it will be useful if expressions like (x .|. 0) and (shiftL x 0) are optimized away.","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/6097tc078(hpc,optasm,profasm) are failing with core lint errors2019-07-07T18:52:12ZIan Lynagh <igloo@earth.li>tc078(hpc,optasm,profasm) are failing with core lint errors`tc078(hpc,optasm,profasm)` are failing with core lint errors.
Here's the code:
```
-- !!! instance decls with no binds
--
module ShouldFail where
data Bar a = MkBar Int a
instance Eq a => Eq (Bar a)
instance Ord a => Ord (Bar a)
```...`tc078(hpc,optasm,profasm)` are failing with core lint errors.
Here's the code:
```
-- !!! instance decls with no binds
--
module ShouldFail where
data Bar a = MkBar Int a
instance Eq a => Eq (Bar a)
instance Ord a => Ord (Bar a)
```
And the `optasm` failure:
```
=====> tc078(optasm) 75 of 326 [0, 0, 0]
cd . && '/home/ian/ghc/git/ghc/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-conf -rtsopts -fno-ghci-history -c tc078.hs -O -fasm -fno-warn-incomplete-patterns >tc078.comp.stderr 2>&1
Compile failed (status 256) errors were:
*** Core Lint errors : in result of Common sub-expression ***
<no location info>: Warning:
[RHS of $cmax_ah8 :: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
ShouldFail.Bar a_ag5
-> ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5]
The type of this binder doesn't match the type of its RHS: $cmax_ah8
Binder's type: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
ShouldFail.Bar a_ag5
-> ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5
Rhs type: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Bool
*** Offending Program ***
Rec {
$c==_agv [InlPrag=INLINE (sat-args=2), Occ=LoopBreaker]
:: forall a_ag6.
GHC.Classes.Eq a_ag6 =>
ShouldFail.Bar a_ag6 -> ShouldFail.Bar a_ag6 -> GHC.Types.Bool
[LclId,
Arity=3,
Str=DmdType AAAb,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=False,boring_ok=True)
Tmpl= \ (@ a_ag6)
($dEq_agt [Occ=Once] :: GHC.Classes.Eq a_ag6)
(x_ahu [Occ=Once] :: ShouldFail.Bar a_ag6)
(y_ahv [Occ=Once] :: ShouldFail.Bar a_ag6) ->
$c==_agv @ a_ag6 $dEq_agt x_ahu y_ahv}]
$c==_agv =
\ (@ a_ag6)
($dEq_agt :: GHC.Classes.Eq a_ag6)
(eta_B2 :: ShouldFail.Bar a_ag6)
(eta_B1 :: ShouldFail.Bar a_ag6) ->
$c==_agv @ a_ag6 $dEq_agt eta_B2 eta_B1
end Rec }
$c/=_agz [InlPrag=INLINE (sat-args=2)]
:: forall a_ag6.
GHC.Classes.Eq a_ag6 =>
ShouldFail.Bar a_ag6 -> ShouldFail.Bar a_ag6 -> GHC.Types.Bool
[LclId,
Arity=3,
Str=DmdType AAAb,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=False,boring_ok=True)
Tmpl= \ (@ a_ag6)
($dEq_agt [Occ=Once] :: GHC.Classes.Eq a_ag6)
(x_ahk [Occ=Once] :: ShouldFail.Bar a_ag6)
(y_ahl [Occ=Once] :: ShouldFail.Bar a_ag6) ->
$c==_agv @ a_ag6 $dEq_agt x_ahk y_ahl}]
$c/=_agz = $c==_agv
ShouldFail.$fEqBar [InlPrag=[ALWAYS] CONLIKE]
:: forall a_ag6.
GHC.Classes.Eq a_ag6 =>
GHC.Classes.Eq (ShouldFail.Bar a_ag6)
[LclIdX[DFunId],
Arity=1,
Str=DmdType Lm,
Unf=DFun(arity=2) GHC.Classes.D:Eq [$c==_agv, $c/=_agz]]
ShouldFail.$fEqBar =
\ (@ a_ag6) ($dEq_agt [Dmd=Just L] :: GHC.Classes.Eq a_ag6) ->
GHC.Classes.D:Eq
@ (ShouldFail.Bar a_ag6)
($c==_agv @ a_ag6 $dEq_agt)
($c/=_agz @ a_ag6 $dEq_agt)
$c$p1Ord_agG
:: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
GHC.Classes.Eq (ShouldFail.Bar a_ag5)
[LclId,
Arity=1,
Str=DmdType Lm,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)
Tmpl= \ (@ a_ag5)
($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5) ->
ShouldFail.$fEqBar @ a_ag5 (GHC.Classes.$p1Ord @ a_ag5 $dOrd_agD)}]
$c$p1Ord_agG =
\ (@ a_ag5) ($dOrd_agD :: GHC.Classes.Ord a_ag5) ->
ShouldFail.$fEqBar @ a_ag5 (GHC.Classes.$p1Ord @ a_ag5 $dOrd_agD)
eta_skd :: forall a_ag5. ShouldFail.Bar a_ag5
[LclId]
eta_skd =
\ (@ a_ag5) ->
Control.Exception.Base.absentError
@ (ShouldFail.Bar a_ag5)
"w_sk3{v} [lid] main:ShouldFail.Bar{tc r9Z} a{tv ag5} [tv]"
eta_skc :: forall a_ag5. ShouldFail.Bar a_ag5
[LclId]
eta_skc =
\ (@ a_ag5) ->
Control.Exception.Base.absentError
@ (ShouldFail.Bar a_ag5)
"w_sk2{v} [lid] main:ShouldFail.Bar{tc r9Z} a{tv ag5} [tv]"
$dOrd_skb :: forall a_ag5. GHC.Classes.Ord a_ag5
[LclId]
$dOrd_skb =
\ (@ a_ag5) ->
Control.Exception.Base.absentError
@ (GHC.Classes.Ord a_ag5)
"w_sk1{v} [lid] ghc-prim:GHC.Classes.Ord{tc 2c} a{tv ag5} [tv]"
lvl_skh :: forall a_ag5. GHC.Classes.Eq a_ag5
[LclId]
lvl_skh =
\ (@ a_ag5) -> GHC.Classes.$p1Ord @ a_ag5 ($dOrd_skb @ a_ag5)
$w$ccompare_sk5 :: forall a_ag5. GHC.Types.Ordering
[LclId, Str=DmdType b]
$w$ccompare_sk5 =
\ (@ a_ag5) ->
case $c==_agv
@ a_ag5 (lvl_skh @ a_ag5) (eta_skc @ a_ag5) (eta_skd @ a_ag5)
of wild_00 {
}
$ccompare_agI [InlPrag=INLINE[0]]
:: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Ordering
[LclId,
Arity=3,
Str=DmdType AAAb,
Unf=Unf{Src=Worker=$w$ccompare_sk5, TopLvl=True, Arity=3,
Value=True, ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=True)
Tmpl= \ (@ a_ag5) _ _ _ -> $w$ccompare_sk5 @ a_ag5}]
$ccompare_agI = \ (@ a_ag5) _ _ _ -> $w$ccompare_sk5 @ a_ag5
$c<=_ah4
:: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Bool
[LclId,
Arity=3,
Str=DmdType AAAb,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)
Tmpl= \ (@ a_ag5)
($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)
(x_ahU [Occ=Once] :: ShouldFail.Bar a_ag5)
(y_ahV [Occ=Once] :: ShouldFail.Bar a_ag5) ->
case $ccompare_agI @ a_ag5 $dOrd_agD x_ahU y_ahV of _ { }}]
$c<=_ah4 = \ (@ a_ag5) _ _ _ -> case $w$ccompare_sk5 of wild_00 { }
$c<_agS
:: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Bool
[LclId,
Arity=3,
Str=DmdType AAAb,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)
Tmpl= \ (@ a_ag5)
($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)
(x_aii [Occ=Once] :: ShouldFail.Bar a_ag5)
(y_aij [Occ=Once] :: ShouldFail.Bar a_ag5) ->
case $ccompare_agI @ a_ag5 $dOrd_agD x_aii y_aij of _ { }}]
$c<_agS = $c<=_ah4
$c>=_agW
:: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Bool
[LclId,
Arity=3,
Str=DmdType AAAb,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)
Tmpl= \ (@ a_ag5)
($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)
(x_aia [Occ=Once] :: ShouldFail.Bar a_ag5)
(y_aib [Occ=Once] :: ShouldFail.Bar a_ag5) ->
case $ccompare_agI @ a_ag5 $dOrd_agD x_aia y_aib of _ { }}]
$c>=_agW = $c<=_ah4
$c>_ah0
:: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Bool
[LclId,
Arity=3,
Str=DmdType AAAb,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)
Tmpl= \ (@ a_ag5)
($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)
(x_ai2 [Occ=Once] :: ShouldFail.Bar a_ag5)
(y_ai3 [Occ=Once] :: ShouldFail.Bar a_ag5) ->
case $ccompare_agI @ a_ag5 $dOrd_agD x_ai2 y_ai3 of _ { }}]
$c>_ah0 = $c<=_ah4
$cmax_ah8
:: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
ShouldFail.Bar a_ag5
-> ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5
[LclId,
Arity=3,
Str=DmdType ASSb,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)
Tmpl= \ (@ a_ag5)
($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)
(x_ahK [Occ=Once] :: ShouldFail.Bar a_ag5)
(y_ahL [Occ=Once] :: ShouldFail.Bar a_ag5) ->
case $ccompare_agI @ a_ag5 $dOrd_agD x_ahK y_ahL of _ { }}]
$cmax_ah8 = $c<=_ah4
$cmin_ahc
:: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
ShouldFail.Bar a_ag5
-> ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5
[LclId,
Arity=3,
Str=DmdType ASSb,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)
Tmpl= \ (@ a_ag5)
($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)
(x_ahy [Occ=Once] :: ShouldFail.Bar a_ag5)
(y_ahz [Occ=Once] :: ShouldFail.Bar a_ag5) ->
case $ccompare_agI @ a_ag5 $dOrd_agD x_ahy y_ahz of _ { }}]
$cmin_ahc = $c<=_ah4
lvl_ski
:: forall a_ag5.
ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Ordering
[LclId, Arity=2, Str=DmdType TTb]
lvl_ski = \ (@ a_ag5) _ _ -> $w$ccompare_sk5 @ a_ag5
ShouldFail.$fOrdBar [InlPrag=[ALWAYS] CONLIKE]
:: forall a_ag5.
GHC.Classes.Ord a_ag5 =>
GHC.Classes.Ord (ShouldFail.Bar a_ag5)
[LclIdX[DFunId],
Arity=1,
Str=DmdType Lm,
Unf=DFun(arity=2) GHC.Classes.D:Ord [$c$p1Ord_agG, $ccompare_agI,
$c<_agS, $c>=_agW, $c>_ah0, $c<=_ah4, $cmax_ah8, $cmin_ahc]]
ShouldFail.$fOrdBar =
\ (@ a_ag5) ($dOrd_agD [Dmd=Just L] :: GHC.Classes.Ord a_ag5) ->
GHC.Classes.D:Ord
@ (ShouldFail.Bar a_ag5)
($c$p1Ord_agG @ a_ag5 $dOrd_agD)
(lvl_ski @ a_ag5)
($c<_agS @ a_ag5 $dOrd_agD)
($c>=_agW @ a_ag5 $dOrd_agD)
($c>_ah0 @ a_ag5 $dOrd_agD)
($c<=_ah4 @ a_ag5 $dOrd_agD)
($cmax_ah8 @ a_ag5 $dOrd_agD)
($cmin_ahc @ a_ag5 $dOrd_agD)
*** End of Offense ***
<no location info>:
Compilation had errors
*** unexpected failure for tc078(optasm)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.5 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"tc078(hpc,optasm,profasm) are failing with core lint errors","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"7.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.5","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"`tc078(hpc,optasm,profasm)` are failing with core lint errors.\r\n\r\nHere's the code:\r\n{{{\r\n-- !!! instance decls with no binds\r\n--\r\nmodule ShouldFail where\r\n\r\ndata Bar a = MkBar Int a\r\n\r\ninstance Eq a => Eq (Bar a)\r\ninstance Ord a => Ord (Bar a)\r\n}}}\r\n\r\nAnd the `optasm` failure:\r\n{{{\r\n=====> tc078(optasm) 75 of 326 [0, 0, 0]\r\ncd . && '/home/ian/ghc/git/ghc/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-conf -rtsopts -fno-ghci-history -c tc078.hs -O -fasm -fno-warn-incomplete-patterns >tc078.comp.stderr 2>&1\r\nCompile failed (status 256) errors were:\r\n*** Core Lint errors : in result of Common sub-expression ***\r\n<no location info>: Warning:\r\n [RHS of $cmax_ah8 :: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n ShouldFail.Bar a_ag5\r\n -> ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5]\r\n The type of this binder doesn't match the type of its RHS: $cmax_ah8\r\n Binder's type: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n ShouldFail.Bar a_ag5\r\n -> ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5\r\n Rhs type: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Bool\r\n*** Offending Program ***\r\nRec {\r\n$c==_agv [InlPrag=INLINE (sat-args=2), Occ=LoopBreaker]\r\n :: forall a_ag6.\r\n GHC.Classes.Eq a_ag6 =>\r\n ShouldFail.Bar a_ag6 -> ShouldFail.Bar a_ag6 -> GHC.Types.Bool\r\n[LclId,\r\n Arity=3,\r\n Str=DmdType AAAb,\r\n Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,\r\n ConLike=True, WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(unsat_ok=False,boring_ok=True)\r\n Tmpl= \\ (@ a_ag6)\r\n ($dEq_agt [Occ=Once] :: GHC.Classes.Eq a_ag6)\r\n (x_ahu [Occ=Once] :: ShouldFail.Bar a_ag6)\r\n (y_ahv [Occ=Once] :: ShouldFail.Bar a_ag6) ->\r\n $c==_agv @ a_ag6 $dEq_agt x_ahu y_ahv}]\r\n$c==_agv =\r\n \\ (@ a_ag6)\r\n ($dEq_agt :: GHC.Classes.Eq a_ag6)\r\n (eta_B2 :: ShouldFail.Bar a_ag6)\r\n (eta_B1 :: ShouldFail.Bar a_ag6) ->\r\n $c==_agv @ a_ag6 $dEq_agt eta_B2 eta_B1\r\nend Rec }\r\n\r\n$c/=_agz [InlPrag=INLINE (sat-args=2)]\r\n :: forall a_ag6.\r\n GHC.Classes.Eq a_ag6 =>\r\n ShouldFail.Bar a_ag6 -> ShouldFail.Bar a_ag6 -> GHC.Types.Bool\r\n[LclId,\r\n Arity=3,\r\n Str=DmdType AAAb,\r\n Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,\r\n ConLike=True, WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(unsat_ok=False,boring_ok=True)\r\n Tmpl= \\ (@ a_ag6)\r\n ($dEq_agt [Occ=Once] :: GHC.Classes.Eq a_ag6)\r\n (x_ahk [Occ=Once] :: ShouldFail.Bar a_ag6)\r\n (y_ahl [Occ=Once] :: ShouldFail.Bar a_ag6) ->\r\n $c==_agv @ a_ag6 $dEq_agt x_ahk y_ahl}]\r\n$c/=_agz = $c==_agv\r\n\r\nShouldFail.$fEqBar [InlPrag=[ALWAYS] CONLIKE]\r\n :: forall a_ag6.\r\n GHC.Classes.Eq a_ag6 =>\r\n GHC.Classes.Eq (ShouldFail.Bar a_ag6)\r\n[LclIdX[DFunId],\r\n Arity=1,\r\n Str=DmdType Lm,\r\n Unf=DFun(arity=2) GHC.Classes.D:Eq [$c==_agv, $c/=_agz]]\r\nShouldFail.$fEqBar =\r\n \\ (@ a_ag6) ($dEq_agt [Dmd=Just L] :: GHC.Classes.Eq a_ag6) ->\r\n GHC.Classes.D:Eq\r\n @ (ShouldFail.Bar a_ag6)\r\n ($c==_agv @ a_ag6 $dEq_agt)\r\n ($c/=_agz @ a_ag6 $dEq_agt)\r\n\r\n$c$p1Ord_agG\r\n :: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n GHC.Classes.Eq (ShouldFail.Bar a_ag5)\r\n[LclId,\r\n Arity=1,\r\n Str=DmdType Lm,\r\n Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True,\r\n ConLike=True, WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)\r\n Tmpl= \\ (@ a_ag5)\r\n ($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5) ->\r\n ShouldFail.$fEqBar @ a_ag5 (GHC.Classes.$p1Ord @ a_ag5 $dOrd_agD)}]\r\n$c$p1Ord_agG =\r\n \\ (@ a_ag5) ($dOrd_agD :: GHC.Classes.Ord a_ag5) ->\r\n ShouldFail.$fEqBar @ a_ag5 (GHC.Classes.$p1Ord @ a_ag5 $dOrd_agD)\r\n\r\neta_skd :: forall a_ag5. ShouldFail.Bar a_ag5\r\n[LclId]\r\neta_skd =\r\n \\ (@ a_ag5) ->\r\n Control.Exception.Base.absentError\r\n @ (ShouldFail.Bar a_ag5)\r\n \"w_sk3{v} [lid] main:ShouldFail.Bar{tc r9Z} a{tv ag5} [tv]\"\r\n\r\neta_skc :: forall a_ag5. ShouldFail.Bar a_ag5\r\n[LclId]\r\neta_skc =\r\n \\ (@ a_ag5) ->\r\n Control.Exception.Base.absentError\r\n @ (ShouldFail.Bar a_ag5)\r\n \"w_sk2{v} [lid] main:ShouldFail.Bar{tc r9Z} a{tv ag5} [tv]\"\r\n\r\n$dOrd_skb :: forall a_ag5. GHC.Classes.Ord a_ag5\r\n[LclId]\r\n$dOrd_skb =\r\n \\ (@ a_ag5) ->\r\n Control.Exception.Base.absentError\r\n @ (GHC.Classes.Ord a_ag5)\r\n \"w_sk1{v} [lid] ghc-prim:GHC.Classes.Ord{tc 2c} a{tv ag5} [tv]\"\r\n\r\nlvl_skh :: forall a_ag5. GHC.Classes.Eq a_ag5\r\n[LclId]\r\nlvl_skh =\r\n \\ (@ a_ag5) -> GHC.Classes.$p1Ord @ a_ag5 ($dOrd_skb @ a_ag5)\r\n\r\n$w$ccompare_sk5 :: forall a_ag5. GHC.Types.Ordering\r\n[LclId, Str=DmdType b]\r\n$w$ccompare_sk5 =\r\n \\ (@ a_ag5) ->\r\n case $c==_agv\r\n @ a_ag5 (lvl_skh @ a_ag5) (eta_skc @ a_ag5) (eta_skd @ a_ag5)\r\n of wild_00 {\r\n }\r\n\r\n$ccompare_agI [InlPrag=INLINE[0]]\r\n :: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Ordering\r\n[LclId,\r\n Arity=3,\r\n Str=DmdType AAAb,\r\n Unf=Unf{Src=Worker=$w$ccompare_sk5, TopLvl=True, Arity=3,\r\n Value=True, ConLike=True, WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=True)\r\n Tmpl= \\ (@ a_ag5) _ _ _ -> $w$ccompare_sk5 @ a_ag5}]\r\n$ccompare_agI = \\ (@ a_ag5) _ _ _ -> $w$ccompare_sk5 @ a_ag5\r\n\r\n$c<=_ah4\r\n :: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Bool\r\n[LclId,\r\n Arity=3,\r\n Str=DmdType AAAb,\r\n Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,\r\n ConLike=True, WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)\r\n Tmpl= \\ (@ a_ag5)\r\n ($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)\r\n (x_ahU [Occ=Once] :: ShouldFail.Bar a_ag5)\r\n (y_ahV [Occ=Once] :: ShouldFail.Bar a_ag5) ->\r\n case $ccompare_agI @ a_ag5 $dOrd_agD x_ahU y_ahV of _ { }}]\r\n$c<=_ah4 = \\ (@ a_ag5) _ _ _ -> case $w$ccompare_sk5 of wild_00 { }\r\n\r\n$c<_agS\r\n :: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Bool\r\n[LclId,\r\n Arity=3,\r\n Str=DmdType AAAb,\r\n Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,\r\n ConLike=True, WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)\r\n Tmpl= \\ (@ a_ag5)\r\n ($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)\r\n (x_aii [Occ=Once] :: ShouldFail.Bar a_ag5)\r\n (y_aij [Occ=Once] :: ShouldFail.Bar a_ag5) ->\r\n case $ccompare_agI @ a_ag5 $dOrd_agD x_aii y_aij of _ { }}]\r\n$c<_agS = $c<=_ah4\r\n\r\n$c>=_agW\r\n :: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Bool\r\n[LclId,\r\n Arity=3,\r\n Str=DmdType AAAb,\r\n Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,\r\n ConLike=True, WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)\r\n Tmpl= \\ (@ a_ag5)\r\n ($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)\r\n (x_aia [Occ=Once] :: ShouldFail.Bar a_ag5)\r\n (y_aib [Occ=Once] :: ShouldFail.Bar a_ag5) ->\r\n case $ccompare_agI @ a_ag5 $dOrd_agD x_aia y_aib of _ { }}]\r\n$c>=_agW = $c<=_ah4\r\n\r\n$c>_ah0\r\n :: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Bool\r\n[LclId,\r\n Arity=3,\r\n Str=DmdType AAAb,\r\n Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,\r\n ConLike=True, WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)\r\n Tmpl= \\ (@ a_ag5)\r\n ($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)\r\n (x_ai2 [Occ=Once] :: ShouldFail.Bar a_ag5)\r\n (y_ai3 [Occ=Once] :: ShouldFail.Bar a_ag5) ->\r\n case $ccompare_agI @ a_ag5 $dOrd_agD x_ai2 y_ai3 of _ { }}]\r\n$c>_ah0 = $c<=_ah4\r\n\r\n$cmax_ah8\r\n :: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n ShouldFail.Bar a_ag5\r\n -> ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5\r\n[LclId,\r\n Arity=3,\r\n Str=DmdType ASSb,\r\n Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,\r\n ConLike=True, WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)\r\n Tmpl= \\ (@ a_ag5)\r\n ($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)\r\n (x_ahK [Occ=Once] :: ShouldFail.Bar a_ag5)\r\n (y_ahL [Occ=Once] :: ShouldFail.Bar a_ag5) ->\r\n case $ccompare_agI @ a_ag5 $dOrd_agD x_ahK y_ahL of _ { }}]\r\n$cmax_ah8 = $c<=_ah4\r\n\r\n$cmin_ahc\r\n :: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n ShouldFail.Bar a_ag5\r\n -> ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5\r\n[LclId,\r\n Arity=3,\r\n Str=DmdType ASSb,\r\n Unf=Unf{Src=InlineStable, TopLvl=True, Arity=3, Value=True,\r\n ConLike=True, WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)\r\n Tmpl= \\ (@ a_ag5)\r\n ($dOrd_agD [Occ=Once] :: GHC.Classes.Ord a_ag5)\r\n (x_ahy [Occ=Once] :: ShouldFail.Bar a_ag5)\r\n (y_ahz [Occ=Once] :: ShouldFail.Bar a_ag5) ->\r\n case $ccompare_agI @ a_ag5 $dOrd_agD x_ahy y_ahz of _ { }}]\r\n$cmin_ahc = $c<=_ah4\r\n\r\nlvl_ski\r\n :: forall a_ag5.\r\n ShouldFail.Bar a_ag5 -> ShouldFail.Bar a_ag5 -> GHC.Types.Ordering\r\n[LclId, Arity=2, Str=DmdType TTb]\r\nlvl_ski = \\ (@ a_ag5) _ _ -> $w$ccompare_sk5 @ a_ag5\r\n\r\nShouldFail.$fOrdBar [InlPrag=[ALWAYS] CONLIKE]\r\n :: forall a_ag5.\r\n GHC.Classes.Ord a_ag5 =>\r\n GHC.Classes.Ord (ShouldFail.Bar a_ag5)\r\n[LclIdX[DFunId],\r\n Arity=1,\r\n Str=DmdType Lm,\r\n Unf=DFun(arity=2) GHC.Classes.D:Ord [$c$p1Ord_agG, $ccompare_agI,\r\n $c<_agS, $c>=_agW, $c>_ah0, $c<=_ah4, $cmax_ah8, $cmin_ahc]]\r\nShouldFail.$fOrdBar =\r\n \\ (@ a_ag5) ($dOrd_agD [Dmd=Just L] :: GHC.Classes.Ord a_ag5) ->\r\n GHC.Classes.D:Ord\r\n @ (ShouldFail.Bar a_ag5)\r\n ($c$p1Ord_agG @ a_ag5 $dOrd_agD)\r\n (lvl_ski @ a_ag5)\r\n ($c<_agS @ a_ag5 $dOrd_agD)\r\n ($c>=_agW @ a_ag5 $dOrd_agD)\r\n ($c>_ah0 @ a_ag5 $dOrd_agD)\r\n ($c<=_ah4 @ a_ag5 $dOrd_agD)\r\n ($cmax_ah8 @ a_ag5 $dOrd_agD)\r\n ($cmin_ahc @ a_ag5 $dOrd_agD)\r\n\r\n*** End of Offense ***\r\n\r\n\r\n<no location info>: \r\nCompilation had errors\r\n\r\n\r\n\r\n*** unexpected failure for tc078(optasm)\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/6072Irrefutable pattern error while compiling GHC2019-07-07T18:52:19ZSjoerd VisscherIrrefutable pattern error while compiling GHCWhile doing "make" on GHC HEAD I got this error:
```
"inplace/bin/ghc-stage1" -prof -H32m -O -package-name ghc-7.5.20120503 -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/...While doing "make" on GHC HEAD I got this error:
```
"inplace/bin/ghc-stage1" -prof -H32m -O -package-name ghc-7.5.20120503 -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -icompiler/stage2/build -icompiler/stage2/build/autogen -Icompiler/stage2/build -Icompiler/stage2/build/autogen -Icompiler/../rts/dist/build -Icompiler/stage2 -Icompiler/. -Icompiler/parser -Icompiler/utils -optP-DGHCI -optP-include -optPcompiler/stage2/build/autogen/cabal_macros.h -package Cabal-1.14.0 -package array-0.3.0.3 -package base-4.5.0.0 -package bin-package-db-0.0.0.0 -package bytestring-0.10.0.0 -package containers-0.5.0.0 -package directory-1.1.0.1 -package filepath-1.2.0.1 -package hoopl-3.8.7.2 -package hpc-0.5.1.0 -package process-1.1.0.0 -package template-haskell-2.6.0.0 -package time-1.4 -package unix-2.5.1.0 -Wall -fno-warn-name-shadowing -fno-warn-orphans -XHaskell98 -XNondecreasingIndentation -XCPP -XMagicHash -XUnboxedTuples -XPatternGuards -XForeignFunctionInterface -XEmptyDataDecls -XTypeSynonymInstances -XMultiParamTypeClasses -XFlexibleInstances -XRankNTypes -XScopedTypeVariables -XDeriveDataTypeable -XBangPatterns -DGHCI_TABLES_NEXT_TO_CODE -DSTAGE=2 -O2 -no-user-package-conf -rtsopts -odir compiler/stage2/build -hidir compiler/stage2/build -stubdir compiler/stage2/build -hisuf p_hi -osuf p_o -hcsuf p_hc -c compiler/main/HscMain.hs -o compiler/stage2/build/HscMain.p_o
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 7.5.20120503 for x86_64-apple-darwin):
compiler/simplCore/SimplUtils.lhs:1668:5-25: Irrefutable pattern failed for pattern ((_, _, rhs1) : _)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
make[1]: *** [compiler/stage2/build/HscMain.p_o] Error 1
make: *** [all] Error 2
```7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/5837Context reduction stack overflow can take very long2019-07-07T18:53:23ZdreixelContext reduction stack overflow can take very longThe following code, taken from the "Haskell Type Constraints Unleashed" paper:
```
{-# LANGUAGE TypeFamilies #-}
type family TF a :: *
type instance TF (a,b) = (TF a, TF b)
t :: (a ~ TF (a,Int)) => Int
t = undefined
```
fails almost ...The following code, taken from the "Haskell Type Constraints Unleashed" paper:
```
{-# LANGUAGE TypeFamilies #-}
type family TF a :: *
type instance TF (a,b) = (TF a, TF b)
t :: (a ~ TF (a,Int)) => Int
t = undefined
```
fails almost immediately with `Context reduction stack overflow` on GHC 7.2, but seems to loop forever with 7.4.1-rc2. Setting `-fcontext-stack` to `20` results in near immediate termination with the same error. But #5395 raised the context stack size default to `200`, which makes this code (that does not use `-XUndecidableInstances`) take "forever" to compile.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 7.4.1-rc2 |
| 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":"Context reduction stack overflow can take very long","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.4.1-rc2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following code, taken from the \"Haskell Type Constraints Unleashed\" paper:\r\n{{{\r\n{-# LANGUAGE TypeFamilies #-}\r\n\r\ntype family TF a :: *\r\ntype instance TF (a,b) = (TF a, TF b)\r\n\r\nt :: (a ~ TF (a,Int)) => Int\r\nt = undefined\r\n}}}\r\nfails almost immediately with `Context reduction stack overflow` on GHC 7.2, but seems to loop forever with 7.4.1-rc2. Setting `-fcontext-stack` to `20` results in near immediate termination with the same error. But #5395 raised the context stack size default to `200`, which makes this code (that does not use `-XUndecidableInstances`) take \"forever\" to compile.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/5832PolyKinds03 and PolyKinds13 fail an ASSERT2019-07-07T18:53:24ZIan Lynagh <igloo@earth.li>PolyKinds03 and PolyKinds13 fail an ASSERTWith a slow validate build on OSX, `PolyKinds03` fails:
```
cd . && '/Users/ian/ghc/7.4-branch/val64/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-conf -rtsopts -fno-ghci-history -c Po...With a slow validate build on OSX, `PolyKinds03` fails:
```
cd . && '/Users/ian/ghc/7.4-branch/val64/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-conf -rtsopts -fno-ghci-history -c PolyKinds03.hs >PolyKinds03.comp.stderr 2>&1
Compile failed (status 256) errors were:
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 7.4.0.20120126 for x86_64-apple-darwin):
ASSERT failed! file compiler/types/Kind.lhs line 254
ghc-prim:GHC.Prim.BOX{(w) tc 347} ghc-prim:GHC.Prim.ArgKind{(w) tc 34p}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
`PolyKinds13` fails similarly.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.4.1-rc2 |
| 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":"PolyKinds03 and PolyKinds13 fail an ASSERT","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"7.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.4.1-rc2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"With a slow validate build on OSX, `PolyKinds03` fails:\r\n{{{\r\ncd . && '/Users/ian/ghc/7.4-branch/val64/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-conf -rtsopts -fno-ghci-history -c PolyKinds03.hs >PolyKinds03.comp.stderr 2>&1\r\nCompile failed (status 256) errors were:\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 7.4.0.20120126 for x86_64-apple-darwin):\r\n ASSERT failed! file compiler/types/Kind.lhs line 254\r\nghc-prim:GHC.Prim.BOX{(w) tc 347} ghc-prim:GHC.Prim.ArgKind{(w) tc 34p}\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\n`PolyKinds13` fails similarly.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/5676Typeclass instance function type declarations2019-07-07T18:54:05ZDan BurtonTypeclass instance function type declarationsSee discussion at http://stackoverflow.com/questions/8367426/why-cant-one-put-type-signatures-in-instance-declarations-in-haskell
Basically, it would be nice to be able to do something like this:
```
instance Functor Maybe where
fmap...See discussion at http://stackoverflow.com/questions/8367426/why-cant-one-put-type-signatures-in-instance-declarations-in-haskell
Basically, it would be nice to be able to do something like this:
```
instance Functor Maybe where
fmap :: (a -> b) -> Maybe a -> Maybe b
fmap = undefined
```
This currently produces a "misplaced type signature" error.
It seems like a simple enough extension (we could call it SuperfluousTypeclassSignatures, because "Superfluous" is a cool word). It might be a good idea for Haskell Prime, but let's test it out as a Glasgow extension first.
We (a few of us on \#haskell irc right now) think it best that only the precisely correct type signatures be accepted (reject signatures that are too lose or too strong), and it would be nice if, given an incorrect type signature, a custom error message were displayed stating the correct type signature.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | |
| 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":"Typeclass instance function type declarations","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":["declaration","function","instance","type","typeclass"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"See discussion at http://stackoverflow.com/questions/8367426/why-cant-one-put-type-signatures-in-instance-declarations-in-haskell\r\n\r\nBasically, it would be nice to be able to do something like this:\r\n\r\n{{{\r\ninstance Functor Maybe where\r\n fmap :: (a -> b) -> Maybe a -> Maybe b\r\n fmap = undefined\r\n}}}\r\n\r\nThis currently produces a \"misplaced type signature\" error.\r\n\r\nIt seems like a simple enough extension (we could call it SuperfluousTypeclassSignatures, because \"Superfluous\" is a cool word). It might be a good idea for Haskell Prime, but let's test it out as a Glasgow extension first.\r\n\r\nWe (a few of us on #haskell irc right now) think it best that only the precisely correct type signatures be accepted (reject signatures that are too lose or too strong), and it would be nice if, given an incorrect type signature, a custom error message were displayed stating the correct type signature.","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/5595Unification under a forall doesn't allow full constraint solving2019-07-07T18:54:35ZbasvandijkUnification under a forall doesn't allow full constraint solvingAs [mentioned](http://www.haskell.org/pipermail/glasgow-haskell-users/2011-October/021109.html) on the glasgow-haskell-users mailinglist, I'm working on a new design of [monad-control](http://hackage.haskell.org/package/monad-control). H...As [mentioned](http://www.haskell.org/pipermail/glasgow-haskell-users/2011-October/021109.html) on the glasgow-haskell-users mailinglist, I'm working on a new design of [monad-control](http://hackage.haskell.org/package/monad-control). However I get a type error I don't understand. Here's an isolated example:
```
{-# LANGUAGE UnicodeSyntax, RankNTypes, TypeFamilies #-}
class MonadTransControl t where
type St t ∷ * → *
liftControl ∷ Monad m ⇒ (Run t → m α) → t m α
restore ∷ Monad o ⇒ St t γ → t o γ
type Run t = ∀ n β. Monad n ⇒ t n β → n (St t β)
foo :: (Monad m, MonadTransControl t) => (Run t -> m α) -> t m α
foo f = liftControl f
```
Type checking `foo` this gives the following error:
```
Couldn't match expected type `Run t' with actual type `Run t'
Expected type: Run t -> m α
Actual type: Run t -> m α
In the first argument of `liftControl', namely `f'
In the expression: liftControl f
```
When I remove the type annotation of `foo` the program type checks.
But when I ask ghci the type of `foo` it tells me it's the same type:
```
> :t foo
foo :: (Monad m, MonadTransControl t) => (Run t -> m α) -> t m α
```
Note that when I change the associated type synonym to a associated data type the error disappears.
Is this a bug in GHC?
I'm using ghc-7.2.1.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.2.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":"Type error: expected type = actual type ???","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.2.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"As [http://www.haskell.org/pipermail/glasgow-haskell-users/2011-October/021109.html mentioned] on the glasgow-haskell-users mailinglist, I'm working on a new design of [http://hackage.haskell.org/package/monad-control monad-control]. However I get a type error I don't understand. Here's an isolated example:\r\n\r\n{{{\r\n{-# LANGUAGE UnicodeSyntax, RankNTypes, TypeFamilies #-}\r\n\r\nclass MonadTransControl t where\r\n type St t ∷ * → *\r\n\r\n liftControl ∷ Monad m ⇒ (Run t → m α) → t m α\r\n\r\n restore ∷ Monad o ⇒ St t γ → t o γ\r\n\r\ntype Run t = ∀ n β. Monad n ⇒ t n β → n (St t β)\r\n\r\nfoo :: (Monad m, MonadTransControl t) => (Run t -> m α) -> t m α\r\nfoo f = liftControl f\r\n}}}\r\n\r\nType checking `foo` this gives the following error:\r\n\r\n{{{\r\n Couldn't match expected type `Run t' with actual type `Run t'\r\n Expected type: Run t -> m α\r\n Actual type: Run t -> m α\r\n In the first argument of `liftControl', namely `f'\r\n In the expression: liftControl f\r\n}}}\r\n\r\nWhen I remove the type annotation of `foo` the program type checks.\r\nBut when I ask ghci the type of `foo` it tells me it's the same type:\r\n\r\n{{{\r\n> :t foo\r\nfoo :: (Monad m, MonadTransControl t) => (Run t -> m α) -> t m α\r\n}}}\r\n\r\nNote that when I change the associated type synonym to a associated data type the error disappears.\r\n\r\nIs this a bug in GHC?\r\n\r\nI'm using ghc-7.2.1.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/5469Reorganisation of exports in template-haskell library2019-07-07T18:55:08ZreinerpReorganisation of exports in template-haskell libraryWhen working on documentation for the template-haskell library (see #4429), I noticed a few inconveniences with the library. Here are some changes I would suggest:
- I think `runQ` should not be exported from `Language.Haskell.TH` -- ra...When working on documentation for the template-haskell library (see #4429), I noticed a few inconveniences with the library. Here are some changes I would suggest:
- I think `runQ` should not be exported from `Language.Haskell.TH` -- rather, it should only be exported from `Language.Haskell.TH.Syntax.Internals`. It should only be used by GHC internals or debugging, and not for ordinary use of template haskell
- I think the "Internal functions" in `Language.Haskell.TH.Syntax` should be moved to `Language.Haskell.TH.Syntax.Internals`.
- it is quite annoying that `Language.Haskell.TH` manually reexports almost all functions from `Language.Haskell.TH.Syntax` and indeed all functions from `Language.Haskell.TH.Lib`. I would like to turn these name-by-name exports into module exports like so:
```
module Language.Haskell.TH(
module Language.Haskell.TH.Syntax,
module Language.Haskell.TH.Lib,
-- * Pretty-printing
...
)
```
There are a few reasons I would like to do this last change:
- it is a constant effort to keep the export list of `Language.Haskell.TH` synchronised with those of `Language.Haskell.TH.Syntax` and `Language.Haskell.TH.Lib`
- I've added a number of notes (like the `$unresolvedinfix` note I added earlier) to `Language.Haskell.TH.Syntax`, and it is not possible to also export these from `Language.Haskell.TH` without copy-pasting the notes. This means that the documentation of `Language.Haskell.TH.Syntax` is *better* than the documentation for `Language.Haskell.TH`, so users will eventually have to look there. Why not just link them there directly?
I'm not sure what the correct place is for a discussion like this of library design, so I posted here.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 7.2.1 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Reorganisation of exports in template-haskell library","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.2.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"When working on documentation for the template-haskell library (see #4429), I noticed a few inconveniences with the library. Here are some changes I would suggest:\r\n\r\n * I think {{{runQ}}} should not be exported from {{{Language.Haskell.TH}}} -- rather, it should only be exported from {{{Language.Haskell.TH.Syntax.Internals}}}. It should only be used by GHC internals or debugging, and not for ordinary use of template haskell\r\n\r\n * I think the \"Internal functions\" in {{{Language.Haskell.TH.Syntax}}} should be moved to {{{Language.Haskell.TH.Syntax.Internals}}}.\r\n\r\n * it is quite annoying that {{{Language.Haskell.TH}}} manually reexports almost all functions from {{{Language.Haskell.TH.Syntax}}} and indeed all functions from {{{Language.Haskell.TH.Lib}}}. I would like to turn these name-by-name exports into module exports like so:\r\n\r\n{{{\r\nmodule Language.Haskell.TH(\r\n module Language.Haskell.TH.Syntax,\r\n module Language.Haskell.TH.Lib,\r\n -- * Pretty-printing\r\n ...\r\n )\r\n}}}\r\n\r\nThere are a few reasons I would like to do this last change:\r\n\r\n * it is a constant effort to keep the export list of {{{Language.Haskell.TH}}} synchronised with those of {{{Language.Haskell.TH.Syntax}}} and {{{Language.Haskell.TH.Lib}}}\r\n\r\n * I've added a number of notes (like the {{{$unresolvedinfix}}} note I added earlier) to {{{Language.Haskell.TH.Syntax}}}, and it is not possible to also export these from {{{Language.Haskell.TH}}} without copy-pasting the notes. This means that the documentation of {{{Language.Haskell.TH.Syntax}}} is ''better'' than the documentation for {{{Language.Haskell.TH}}}, so users will eventually have to look there. Why not just link them there directly?\r\n\r\nI'm not sure what the correct place is for a discussion like this of library design, so I posted here.","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/2534Odd probable cause given by type checker2019-07-07T19:08:10Zred5_2@hotmail.comOdd probable cause given by type checkerIn the following code, a function has been applied to zero arguments, which the type checker suggests is too many.
```
Prelude> foldr (>>=) [] []
<interactive>:1:6:
Occurs check: cannot construct the infinite type: b = a -> b
P...In the following code, a function has been applied to zero arguments, which the type checker suggests is too many.
```
Prelude> foldr (>>=) [] []
<interactive>:1:6:
Occurs check: cannot construct the infinite type: b = a -> b
Probable cause: `>>=' is applied to too many arguments
In the first argument of `foldr', namely `(>>=)'
In the expression: foldr (>>=) [] []
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Unknown |
| Architecture | Unknown |
</details>
<!-- {"blocked_by":[],"summary":"Odd probable cause given by type checker","status":"New","operating_system":"Unknown","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.8.2","keywords":[],"differentials":[],"test_case":"","architecture":"Unknown","cc":[""],"type":"Bug","description":"In the following code, a function has been applied to zero arguments, which the type checker suggests is too many.\r\n\r\n{{{\r\nPrelude> foldr (>>=) [] []\r\n\r\n<interactive>:1:6:\r\n Occurs check: cannot construct the infinite type: b = a -> b\r\n Probable cause: `>>=' is applied to too many arguments\r\n In the first argument of `foldr', namely `(>>=)'\r\n In the expression: foldr (>>=) [] []\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/2078INLINE and strictness2019-07-07T19:10:18ZSimon Peyton JonesINLINE and strictnessConsider this code
```
module A where
{-# INLINE [0] foo #-}
{#- RULE foo (reverse xs) = xs #-}
foo xs = reverse $ xs
module B where
import A( foo )
g b ys = foo (case b of
True -> reverse ys
...Consider this code
```
module A where
{-# INLINE [0] foo #-}
{#- RULE foo (reverse xs) = xs #-}
foo xs = reverse $ xs
module B where
import A( foo )
g b ys = foo (case b of
True -> reverse ys
False -> ys)
h xs = map foo xs
```
At the moment the body of `foo` is not optimised at all, because it's going to be inlined. But that means that
- The `foo` executed by the `map` in `h` is very inefficient, because it actually calls `$` etc.
- The strictness analyser doesn't see that `foo` is strict, because again the `$` gets in the way. So the rule for `foo` does not match in the RHS of `g`. (If `foo` were strict, we'd push the call to `foo` inside the case branches.)
For both reasons it'd be better to
- Retain the original RHS of `foo` for inlining purposes
- But otherwise optimise `foo` normally, so that if it is not inlined, we get the efficient version, and so that strictness analysis does the right thing.
Hmm. Maybe INLINE should turn into a RULE, rather than (as now) a `Note` in Core?
Anyway, this ticket is to make sure I don't forget this point.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------------- |
| Version | 6.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | ndp@cse.unsw.edu.au |
| Operating system | Unknown |
| Architecture | Unknown |
</details>
<!-- {"blocked_by":[],"summary":"INLINE and strictness","status":"New","operating_system":"Unknown","component":"Compiler","related":[],"milestone":"6.10 branch","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"simonpj"},"version":"6.8.2","keywords":[],"differentials":[],"test_case":"","architecture":"Unknown","cc":["ndp@cse.unsw.edu.au"],"type":"Bug","description":"Consider this code \r\n{{{\r\nmodule A where\r\n {-# INLINE [0] foo #-}\r\n {#- RULE foo (reverse xs) = xs #-}\r\n foo xs = reverse $ xs\r\n\r\nmodule B where\r\n import A( foo )\r\n g b ys = foo (case b of \r\n True -> reverse ys\r\n False -> ys)\r\n\r\n h xs = map foo xs\r\n}}}\r\nAt the moment the body of `foo` is not optimised at all, because it's going to be inlined. But that means that\r\n\r\n * The `foo` executed by the `map` in `h` is very inefficient, because it actually calls `$` etc.\r\n\r\n * The strictness analyser doesn't see that `foo` is strict, because again the `$` gets in the way. So the rule for `foo` does not match in the RHS of `g`. (If `foo` were strict, we'd push the call to `foo` inside the case branches.)\r\n\r\nFor both reasons it'd be better to \r\n * Retain the original RHS of `foo` for inlining purposes\r\n * But otherwise optimise `foo` normally, so that if it is not inlined, we get the efficient version, and so that strictness analysis does the right thing.\r\n\r\nHmm. Maybe INLINE should turn into a RULE, rather than (as now) a `Note` in Core?\r\n\r\nAnyway, this ticket is to make sure I don't forget this point.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1Simon Peyton JonesSimon Peyton Jones