GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2023-07-18T07:32:47Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/21814Module loops and multiple home units leads to a panic2023-07-18T07:32:47ZMatthew PickeringModule loops and multiple home units leads to a panicIf you have a unit with module loops and it depends on another home unit then it leads to a panic where we try to access a module in the HPT (when it's actually from another home unit). Patch and test incoming.If you have a unit with module loops and it depends on another home unit then it leads to a panic where we try to access a module in the HPT (when it's actually from another home unit). Patch and test incoming.9.4.1Matthew PickeringMatthew Pickeringhttps://gitlab.haskell.org/ghc/ghc/-/issues/21762the 'impossible' happened at compile time on PowerMac with Intel Core i5, but...2022-06-21T15:02:33Zfwburtonfwburton@gmail.comthe 'impossible' happened at compile time on PowerMac with Intel Core i5, but not on Apple M1## Summary
When compiling a program using ghc --make the compiler crashed reporting:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-apple-darwin):
Prelude.chr: bad argument: 3204448294
Please report this as...## Summary
When compiling a program using ghc --make the compiler crashed reporting:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-apple-darwin):
Prelude.chr: bad argument: 3204448294
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
See above
## Steps to reproduce
Compile my program on Macintosh with Intel Core i5, or perhaps any intelligent processor.
## Expected behavior
Report the same error message
## Environment
* GHC version used:
```
Version 8.2.2, stage 2 booted by GHC version 7.10.3
Using binary package database: /Library/Frameworks/GHC.framework/Versions/8.2.2-x86_64/usr/lib/ghc-8.2.2/package.conf.d/package.cache
Using binary package database: /Users/warren/.ghc/x86_64-darwin-8.2.2/package.conf.d/package.cache
package flags []
loading package database /Library/Frameworks/GHC.framework/Versions/8.2.2-x86_64/usr/lib/ghc-8.2.2/package.conf.d
loading package database /Users/warren/.ghc/x86_64-darwin-8.2.2/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.1.1
wired-in package integer-gmp mapped to integer-gmp-1.0.1.0
wired-in package base mapped to base-4.10.1.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.12.0.0
wired-in package ghc mapped to ghc-8.2.2
wired-in package dph-seq not found.
wired-in package dph-par not found.
```
Optional:
* Operating System: MAcOS 11.6.7[PB12.hs](/uploads/06258736069910cf2ea4f3f20dec8d18/PB12.hs)
* System Architecture: MacBook Pro (Retina, 13-inch, Late 2013)https://gitlab.haskell.org/ghc/ghc/-/issues/21704[ghc-9.2.3] ghc: panic! (the 'impossible' happened) - Can't find slot2022-06-07T17:57:17ZJan Synacek[ghc-9.2.3] ghc: panic! (the 'impossible' happened) - Can't find slot## Summary
I get `ghc: panic! (the 'impossible' happened)` when I compile my package.
## Steps to reproduce
Minimal reproducer:
1) mkdir primitive-unlifted-ghc-bug; cd primitive-unlifted-ghc-bug
2) Create cabal.project
```
$ cat cab...## Summary
I get `ghc: panic! (the 'impossible' happened)` when I compile my package.
## Steps to reproduce
Minimal reproducer:
1) mkdir primitive-unlifted-ghc-bug; cd primitive-unlifted-ghc-bug
2) Create cabal.project
```
$ cat cabal.project
packages: ./
source-repository-package
type: git
location: https://github.com/haskell-primitive/primitive-unlifted.git
tag: 9b16b79318cbe294d3fdf730b8bd0e4191bf422e
```
3) Create dot cabal file
```
cat primitive-unlifted-ghc-bug.cabal
cabal-version: 3.6
name: primitive-unlifted-ghc-bug
version: 0.1.0.0
author: Jan Synáček
maintainer: your.email@mmm.com
executable primitive-unlifted-ghc-bug
main-is: Main.hs
build-depends: base ^>=4.16.2.0
, primitive-unlifted == 1.0.0.0
hs-source-dirs: app
default-language: Haskell2010
```
4) Use simple main.
```
$ cat app/Main.hs
module Main where
main :: IO ()
main = putStrLn "Hello, Haskell!"
```
5) Build the package
```
$ cabal build -w ghc-9.2.3
...
[ 4 of 19] Compiling Data.Primitive.Unlifted.MVar.Primops ( src/Data/Primitive/Unlifted/MVar/Primops.hs, dist/build/Data/Primitive/Unlifted/MVar/Primops.o, dist/build/Data/Primitive/Unlifted/MVar/Primops.dyn_o )
ghc: panic! (the 'impossible' happened)
(GHC version 9.2.3:
findSlot
Can't find slot
[PtrUnliftedSlot]
[PtrLiftedSlot]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Types/RepType.hs:220:9 in ghc:GHC.Types.RepType
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```
## Expected behavior
No panics.
## Environment
* GHC version used: 9.2.3 installed with ghcup.
* cabal-3.6.3.0
Optional:
* Operating System: Archlinux
* System Architecture: x86-64https://gitlab.haskell.org/ghc/ghc/-/issues/21689GHC HEAD panics (lookupIdSubst) when building fixed-vector-1.2.1.02023-08-21T02:06:18ZRyan ScottGHC HEAD panics (lookupIdSubst) when building fixed-vector-1.2.1.0_(Originally noticed in a `head.hackage` build [here](https://gitlab.haskell.org/ghc/head.hackage/-/jobs/1072936#L5098).)_
The `fixed-vector-1.2.1.0` Hackage library fails to compile with GHC HEAD, but does compile with GHC 9.4, 9.2, an..._(Originally noticed in a `head.hackage` build [here](https://gitlab.haskell.org/ghc/head.hackage/-/jobs/1072936#L5098).)_
The `fixed-vector-1.2.1.0` Hackage library fails to compile with GHC HEAD, but does compile with GHC 9.4, 9.2, and earlier. I have made an attempt to minimize it as much as I could. The panic goes away (AFAICT) if you try to combine all of the relevant code into a single module, but it suffices to split things up into the following two modules:
<details>
```hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module UnboxedAux
( Arity
, Dim
, DimM
, IVector
, Mutable
, MVector
, Vector(..)
, constructVec
, inspectVec
, gfoldl'
, gunfold'
) where
import Control.Monad.ST (ST, runST)
import Data.Coerce (coerce)
import Data.Data (Data)
import Data.Functor.Const (Const(..))
import Data.Kind (Type)
import GHC.TypeLits (KnownNat, Nat, type (+), type (-))
-----
-- Data.Vector.Fixed.Cont
-----
data PeanoNum = Z
| S PeanoNum
type family Peano (n :: Nat) :: PeanoNum where
Peano 0 = 'Z
Peano n = 'S (Peano (n - 1))
type family Fn (n :: PeanoNum) (a :: Type) (b :: Type) where
Fn 'Z a b = b
Fn ('S n) a b = a -> Fn n a b
newtype Fun n a b = Fun { unFun :: Fn n a b }
type family Dim (v :: Type -> Type) :: Nat
class Arity (Dim v) => Vector v a where
construct :: Fun (Peano (Dim v)) a (v a)
inspect :: v a -> Fun (Peano (Dim v)) a b -> b
type Arity n = ( ArityPeano (Peano n)
, KnownNat n
, Peano (n+1) ~ 'S (Peano n)
)
class ArityPeano n where
accum :: (forall k. t ('S k) -> a -> t k)
-> (t 'Z -> b)
-> t n
-> Fun n a b
applyFun :: (forall k. t ('S k) -> (a, t k))
-> t n
-> (CVecPeano n a, t 'Z)
gunfoldF :: (Data a)
=> (forall b x. Data b => c (b -> x) -> c x)
-> T_gunfold c r a n -> c r
newtype T_gunfold c r a n = T_gunfold (c (Fn n a r))
gfoldl' :: forall c v a. (Vector v a, Data a)
=> (forall x y. Data x => c (x -> y) -> x -> c y)
-> (forall x . x -> c x)
-> v a -> c (v a)
gfoldl' f inj v
= inspect v
$ gfoldlF f (inj $ unFun (construct :: Fun (Peano (Dim v)) a (v a)))
gunfold' :: forall con c v a. (Vector v a, Data a)
=> (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> con -> c (v a)
gunfold' f inj _
= gunfoldF f gun
where
con = construct :: Fun (Peano (Dim v)) a (v a)
gun = T_gunfold (inj $ unFun con) :: T_gunfold c (v a) a (Peano (Dim v))
gfoldlF :: (ArityPeano n, Data a)
=> (forall x y. Data x => c (x -> y) -> x -> c y)
-> c (Fn n a r) -> Fun n a (c r)
gfoldlF f c0 = accum
(\(T_gfoldl c) x -> T_gfoldl (f c x))
(\(T_gfoldl c) -> c)
(T_gfoldl c0)
newtype T_gfoldl c r a n = T_gfoldl (c (Fn n a r))
newtype ContVec n a = ContVec (forall r. Fun (Peano n) a r -> r)
type instance Dim (ContVec n) = n
instance Arity n => Vector (ContVec n) a where
construct = accum
(\(T_mkN f) a -> T_mkN (f . consPeano a))
(\(T_mkN f) -> toContVec $ f (CVecPeano unFun))
(T_mkN id)
inspect (ContVec c) f = c f
{-# INLINE construct #-}
{-# INLINE inspect #-}
newtype T_mkN n_tot a n = T_mkN (CVecPeano n a -> CVecPeano n_tot a)
toContVec :: CVecPeano (Peano n) a -> ContVec n a
toContVec = coerce
newtype CVecPeano n a = CVecPeano (forall r. Fun n a r -> r)
consPeano :: a -> CVecPeano n a -> CVecPeano ('S n) a
consPeano a (CVecPeano cont) = CVecPeano $ \f -> cont $ curryFirst f a
{-# INLINE consPeano #-}
curryFirst :: Fun ('S n) a b -> a -> Fun n a b
curryFirst = coerce
{-# INLINE curryFirst #-}
apply :: Arity n
=> (forall k. t ('S k) -> (a, t k))
-> t (Peano n)
-> ContVec n a
{-# INLINE apply #-}
apply step' z = toContVec $ fst (applyFun step' z)
-----
-- Data.Vector.Fixed.Mutable
-----
type family Mutable (v :: Type -> Type) :: Type -> Type -> Type
type family DimM (v :: Type -> Type -> Type) :: Nat
class (Arity (DimM v)) => MVector v a where
new :: PrimMonad m => m (v (PrimState m) a)
unsafeWrite :: PrimMonad m => v (PrimState m) a -> Int -> a -> m ()
class (Dim v ~ DimM (Mutable v), MVector (Mutable v) a) => IVector v a where
unsafeFreeze :: PrimMonad m => Mutable v (PrimState m) a -> m (v a)
unsafeIndex :: v a -> Int -> a
inspectVec :: forall v a b. (Arity (Dim v), IVector v a) => v a -> Fun (Peano (Dim v)) a b -> b
{-# INLINE inspectVec #-}
inspectVec v
= inspect cv
where
cv :: ContVec (Dim v) a
cv = apply (\(Const i) -> (unsafeIndex v i, Const (i+1)))
(Const 0 :: Const Int (Peano (Dim v)))
constructVec :: forall v a. (Arity (Dim v), IVector v a) => Fun (Peano (Dim v)) a (v a)
{-# INLINE constructVec #-}
constructVec =
accum step
(\(T_new _ st) -> runST $ unsafeFreeze =<< st :: v a)
(T_new 0 new :: T_new v a (Peano (Dim v)))
data T_new v a n = T_new Int (forall s. ST s (Mutable v s a))
step :: (IVector v a) => T_new v a ('S n) -> a -> T_new v a n
step (T_new i st) x = T_new (i+1) $ do
mv <- st
unsafeWrite mv i x
return mv
-----
-- Control.Monad.Primitive
-----
class Monad m => PrimMonad m where
type PrimState m
instance PrimMonad (ST s) where
type PrimState (ST s) = s
```
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
module Unboxed (Vec, MVec, Unbox) where
import Data.Data (Data(..), Constr, DataType, Fixity(..), mkConstr, mkDataType)
import Data.Typeable (Typeable)
import GHC.TypeLits (Nat)
import UnboxedAux
data family Vec (n :: Nat) a
data family MVec (n :: Nat) s a
class (Arity n, IVector (Vec n) a, MVector (MVec n) a) => Unbox n a
type instance Mutable (Vec n) = MVec n
type instance Dim (Vec n) = n
type instance DimM (MVec n) = n
instance (Unbox n a) => Vector (Vec n) a where
construct = constructVec
inspect = inspectVec
{-# INLINE construct #-}
{-# INLINE inspect #-}
instance (Typeable n, Unbox n a, Data a) => Data (Vec n a) where
gfoldl = gfoldl'
gunfold = gunfold'
toConstr _ = con_Vec
dataTypeOf _ = ty_Vec
ty_Vec :: DataType
ty_Vec = mkDataType "Data.Vector.Fixed.Unboxed.Vec" [con_Vec]
con_Vec :: Constr
con_Vec = mkConstr ty_Vec "Vec" [] Prefix
```
</details>
To reproduce the error, compile `Unboxed.hs` with optimizations using HEAD:
```
$ ~/Software/ghc-9.5.20220602/bin/ghc -fforce-recomp -O Unboxed.hs
[1 of 2] Compiling UnboxedAux ( UnboxedAux.hs, UnboxedAux.o )
[2 of 2] Compiling Unboxed ( Unboxed.hs, Unboxed.o )
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.5.20220602:
lookupIdSubst
$d(%,,%)_s4JG
InScope {n_a2Be a_a2Bf $dTypeable_a2Bg $dUnbox_a2Bh $dData_a2Bi
$cgfoldl_a2Bo $cgunfold_a2BM c_a2BT $cgmapQl_a2DJ $cgmapQr_a2E3
$cgmapQ_a2Em $cgmapQi_a2EC $cgmapM_a2ES $cgmapMp_a2Fa $cgmapMo_a2Fv
$cp1Vector_a2FS $cconstruct_a2FU $cinspect_a2G9 co_a4bo $krep_a4bW
$krep_a4bX $krep_a4bY $krep_a4bZ $krep_a4c0 $krep_a4c1 eta_i4G9
eta1_i4Gc eta2_i4Ge $fDataVec $fVectorVeca $tcMVec $tcUnbox $tcVec
$trModule ty_Vec con_Vec ty_Vec_s4Jb ty_Vec_s4Jc ty_Vec_s4Jd
$trModule_s4Je $trModule_s4Jf $trModule_s4Jg $trModule_s4Jh
$tcVec_s4Ji $tcVec_s4Jj $cp1Data_s4Jk $tcMVec_s4Jq $tcMVec_s4Jr
$tcUnbox_s4Js $tcUnbox_s4Jt $cgmapT_s4Ju}
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:182:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Core/Subst.hs:260:17 in ghc:GHC.Core.Subst
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```9.6.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/21685CSE doesn't correctly handle shadowing.2022-08-02T12:26:32ZAndreas KlebingerCSE doesn't correctly handle shadowing.Here is the relevant core input:
```haskell
join {
exit_X2 :: Int# -> Array Int ()
exit_X2 (wild_X1 :: Int#)
= case $windexError
showSignedInt l_a12J u_a12K (I# wild_X1) ...Here is the relevant core input:
```haskell
join {
exit_X2 :: Int# -> Array Int ()
exit_X2 (wild_X1 :: Int#)
= case $windexError
showSignedInt l_a12J u_a12K (I# wild_X1) (unpackCString# "Int"#)
of wild_00 {
} } in
joinrec {
go3_a1fA :: Int# -> State# RealWorld -> Array Int ()
go3_a1fA (x_a1fB :: Int#) (eta_B0 :: State# RealWorld)
= case x_a1fB of wild_X1 {
__DEFAULT ->
join {
$j_X2 :: Array Int ()
$j_X2 = jump exit_X2 wild_X1 } in
case <=# 1# wild_X1 of { ... };
1# -> jump go3_a1fA 2# eta_B0
}; } in
```
The tricky part here is that the first X2 `exit_X2` and the second X2 `$j_X2` have the same unique! It gets even tricker as the first `exit_X2` is mentioned in the body of `$j_X2` however `X2` in this context refers to `exit_X2` not `$j_X2`.
While is this a very rare combination it's valid core.
CSE get's this wrong however.
After CSE we end up with this:
```
join {
exit_X2 :: Int# -> Array Int ()
exit_X2 (wild_X1 :: Int#)
= ... } in
joinrec {
go3_a1fA (x_a1fB :: Int#) (eta_B0 :: State# RealWorld)
= case x_a1fB of wild_X1 {
__DEFAULT ->
join {
$j_X6 :: Array Int ()
$j_X6 = jump $j_X6 x_a1fB }
in
....
```
However `$j_X6 = jump $j_X6 x_a1fB` is neither correct nor does it compile as `$j_X6` isn't in scope in `$j_X6`s rhs. (Thankfully!)
This is because CSE is subtly broken. We have:
```
cseBind :: TopLevelFlag -> CSEnv -> CoreBind -> (CSEnv, CoreBind)
cseBind toplevel env (NonRec b e)
= (env2, NonRec b2 e2)
where
(env1, b1) = addBinder env b
(env2, (b2, e2)) = cse_bind toplevel env1 (b,e) b1
```
`addBinder` is essentially `substBndr`, we rename `$j_X2` to `$j_X6` and then in `cse_bind` we process the rhs:
```
cse_bind :: TopLevelFlag -> CSEnv -> (InId, InExpr) -> OutId -> (CSEnv, (OutId, OutExpr))
cse_bind toplevel env (in_id, in_rhs) out_id
...
| Just arity <- isJoinId_maybe in_id
-- See Note [Look inside join-point binders]
= let (params, in_body) = collectNBinders arity in_rhs
(env', params') = addBinders env params
out_body = tryForCSE env' in_body
in (env, (out_id, mkLams params' out_body))
...
```
The problem is that we process the rhs with the substitution `X2 -> $j_X6` active.
So in the rhs of `$j_X2 = jump exit_X2 wild_X1` we end up replacing `exit_X2` with `$j_X6` because the code assumes it refers to `$j_X2`. And we end up with `$j_X6 = jump $j_X6 wild_X1`. In short it's a mess.
I think the solution is that we need to use `addBinder` *after* we processed the rhs instead of before. Unless it's a recursive binder. This shouldn't be hard to fix I will write a patch.https://gitlab.haskell.org/ghc/ghc/-/issues/21653GHC panic with duplicate exports due to record pattern synonym2022-05-25T22:47:05ZJason CarrGHC panic with duplicate exports due to record pattern synonym## Summary
GHC panics when a duplicate export is from a record pattern synonym and another module attempts to import it.
## Steps to reproduce
With these two files:
bad1.hs:
```haskell
{-# LANGUAGE PatternSynonyms #-}
module Bad1 (T...## Summary
GHC panics when a duplicate export is from a record pattern synonym and another module attempts to import it.
## Steps to reproduce
With these two files:
bad1.hs:
```haskell
{-# LANGUAGE PatternSynonyms #-}
module Bad1 (T(TSyn, getTSyn), getTSyn) where
data T = T Int
pattern TSyn :: Int -> T
pattern TSyn {getTSyn} <- T getTSyn where
TSyn i = T i
```
bad2.hs:
```haskell
module Bad2 where
import Bad1 (getTSyn)
```
Run `ghc ./bad1.hs ./bad2.hs`
should result in this output:
```
bad1.hs:3:32: warning: [-Wduplicate-exports]
‘getTSyn’ is exported by ‘getTSyn’ and ‘T(TSyn, getTSyn)’
|
3 | module Bad1 (T(TSyn, getTSyn), getTSyn) where
| ^^^^^^^
[2 of 2] Compiling Bad2 ( bad2.hs, bad2.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.8.4 for x86_64-unknown-linux):
filterImports/combine
(getTSyn, getTSyn, Nothing)
(getTSyn, T{T, TSyn, getTSyn;}, Nothing)
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in ghc:Outputable
pprPanic, called at compiler/rename/RnNames.hs:899:23 in ghc:RnNames
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```
## Expected behavior
This should be accepted, since the exporting module compiled
## Environment
* GHC version used: 8.8.4
Optional:
* Operating System: Linux (NixOS)
* System Architecture: AMD64https://gitlab.haskell.org/ghc/ghc/-/issues/21607Panic on bad newtype unpacking2022-05-24T17:05:10ZKrzysztof GogolewskiPanic on bad newtype unpackingThis silly declaration causes a panic in `isUnliftedType`:
```haskell
{-# LANGUAGE UnliftedNewtypes #-}
import GHC.Exts
newtype T (a :: TYPE r) = MkT {-# UNPACK #-} a
```This silly declaration causes a panic in `isUnliftedType`:
```haskell
{-# LANGUAGE UnliftedNewtypes #-}
import GHC.Exts
newtype T (a :: TYPE r) = MkT {-# UNPACK #-} a
```Krzysztof GogolewskiKrzysztof Gogolewskihttps://gitlab.haskell.org/ghc/ghc/-/issues/21561GHC does not terminate2022-05-17T14:35:25ZMarcin SzamotulskiGHC does not terminate## Summary
### Non termination bug
When compiling `typed-protocols` package in the following branch [coot/typed-protocols-rewrite-pointed-queue](https://github.com/input-output-hk/ouroboros-network/tree/coot/typed-protocols-rewrite-poin...## Summary
### Non termination bug
When compiling `typed-protocols` package in the following branch [coot/typed-protocols-rewrite-pointed-queue](https://github.com/input-output-hk/ouroboros-network/tree/coot/typed-protocols-rewrite-pointed-queue), `GHC` does not terminate to compile the [Data.Type.Queue](https://github.com/input-output-hk/ouroboros-network/blob/coot/typed-protocols-rewrite-pointed-queue/typed-protocols/src/Data/Type/Queue.hs) module if compiling with `optimisation: 1`;
GHC is stuck while doing simplification:
```
unflattenGivens []
Result size of Desugar (before optimization)
= {terms: 1,349, types: 3,919, coercions: 210, joins: 0/84}
Result size of Desugar (after optimization)
= {terms: 1,151, types: 3,226, coercions: 201, joins: 1/7}
!!! Desugar [Data.Type.Queue]: finished in 50.30 milliseconds, allocated 12.117 megabytes
*** Simplifier [Data.Type.Queue]:
Result size of Simplifier iteration=1
= {terms: 1,491, types: 3,243, coercions: 391, joins: 1/31}
Result size of Simplifier iteration=2
= {terms: 1,421, types: 3,030, coercions: 355, joins: 1/7}
```
### Typechecker bug
When compiling with `optimisation: 0`, the `Data.Type.Queue` module compiles, but chaning a type signature in [`Network.TypedProtocol.Peer`](https://github.com/input-output-hk/ouroboros-network/blob/coot/typed-protocols-rewrite-pointed-queue/typed-protocols/src/Network/TypedProtocol/Peer.hs#L177-L193=) module (see the link), I can trigger the following error:
```
<no location info>: error:
ghc: panic! (the 'impossible' happened)
(GHC version 8.10.7:
metaTyVarRef
st_a1Rj[sk:1]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1179:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcType.hs:1032:14 in ghc:TcType
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```
The bogus type signature:
```
YieldPipelined
:: forall ps pr (st :: ps) (st' :: ps) q st'' m stm a.
( SingI st
, SingI st'
, ActiveState st
)
=> (ReflRelativeAgency (StateAgency st)
WeHaveAgency
(Relative pr (StateAgency st)))
-- ^ agency singleton
-> Message ps st st'
-- ^ protocol message
-> Peer ps st'' pr 'Pipelined (q |> Tr st' st'') m stm a
-- ^ continuation
-> Peer ps st pr 'Pipelined q m stm a
```
The right one is the following (adding kind annotation for `q` is not needed to fix this error, but it's easier to understand the example, the important part is swapping the order of `q` and `st''` in the `forall` which binds them):
```
YieldPipelined
:: forall ps pr (st :: ps) (st' :: ps) (st'' :: ps) (q :: Queue ps st) m stm a.
( SingI st
, SingI st'
, ActiveState st
)
=> (ReflRelativeAgency (StateAgency st)
WeHaveAgency
(Relative pr (StateAgency st)))
-- ^ agency singleton
-> Message ps st st'
-- ^ protocol message
-> Peer ps st'' pr 'Pipelined (q |> Tr st' st'') m stm a
-- ^ continuation
-> Peer ps st pr 'Pipelined q m stm a
```
## Steps to reproduce
run `cabal build -O1 typed-protocols`; you can also copy the module and compile it with `ghc` directly, as it has no internal dependencies, it only depends on `base`.
## Expected behavior
### Non termination bug
I'd expect compilation to terminate.
### Typechecker bug
I'd expect to report that `st''` is not in scope, as when trying to compile something like this:
```
{-# LANGUAGE ScopedTypeVariables #-}
foo :: forall (x :: y). ... -- here GHC will complain about `y` not being in scope
```
## Environment
* GHC version used: ghc-8.10.7
Optional:
* Operating System: linux, Fedora, ghc installed with `ghcup`
* System Architecture: amd648.10.8https://gitlab.haskell.org/ghc/ghc/-/issues/21558Short file produces panic on ghc-9.2.22022-06-15T16:31:36ZDavid FoxShort file produces panic on ghc-9.2.2The file below produces a panic on ghc-9.2.2:
```
import Data.Map
type family IxValue (m :: *) :: *
type family Index (m :: *) :: *
data Op a where
Insert :: (a ~ Map (Index a) (IxValue a)) => (Int, Index a, IxValue a) -> Op a
inst...The file below produces a panic on ghc-9.2.2:
```
import Data.Map
type family IxValue (m :: *) :: *
type family Index (m :: *) :: *
data Op a where
Insert :: (a ~ Map (Index a) (IxValue a)) => (Int, Index a, IxValue a) -> Op a
instance Ord a => Ord (Op a) where
compare (Insert a1) (Insert b1) = compare a1 b1
```
Sorry I don't have access to head right now.9.2.3https://gitlab.haskell.org/ghc/ghc/-/issues/21547Panic from refineFromInScope when using Typeable with TH2022-06-14T18:47:19ZTom SmedingPanic from refineFromInScope when using Typeable with TH## Summary
Using `Typeable` in TemplateHaskell doesn't seem to work.
Using `Typeable` in TemplateHaskell (as shown below) is useful because as far as I'm aware, there is no other way to determine the `Type` of the instantiation of a po...## Summary
Using `Typeable` in TemplateHaskell doesn't seem to work.
Using `Typeable` in TemplateHaskell (as shown below) is useful because as far as I'm aware, there is no other way to determine the `Type` of the instantiation of a polymorphic function in the `Q` monad.
That is to say, in the below reproducer, `Typeable` is really an XY problem; what I really want is to use the `Type` corresponding to the monomorphic instantiation of `a` in the body of `foo`. This is allowed to fail in whatever way you like if `a` doesn't end up being instantiated to a monomorphic type. Hence `Typeable` seems to have the right semantics, but it doesn't work, as shown.
## Steps to reproduce
https://git.tomsmeding.com/ghc-refinefrominscope-panic-repro
Foo.hs:
```haskell
module Foo where
import Data.Typeable
import Language.Haskell.TH
foo :: Typeable a => Code Q a -> Code Q ()
foo = undefined
```
Main.hs:
```haskell
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Foo
data T a = T a deriving (Show)
main :: IO ()
main =
let x = $$(foo [|| T () ||])
in return ()
```
Compiling:
```
$ ghc-9.2.2 Main.hs Foo.hs
[1 of 2] Compiling Foo ( Foo.hs, Foo.o, Foo.dyn_o )
[2 of 2] Compiling Main ( Main.hs, Main.o, Main.dyn_o )
ghc: panic! (the 'impossible' happened)
(GHC version 9.2.2:
refineFromInScope
InScope {wild_00 $dQuote_a2Jf}
$tcT
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Core/Opt/Simplify/Env.hs:706:30 in ghc:GHC.Core.Opt.Simplify.Env
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```
## Expected behavior
Don't panic. :)
## Environment
* GHC version used: 9.2.2 from ghcup
Optional:
* Operating System: Arch Linux
* System Architecture: amd649.2.3Matthew PickeringMatthew Pickeringhttps://gitlab.haskell.org/ghc/ghc/-/issues/21544GHC 9.4 panic on a representation-polymorphic newtype instance2023-08-28T22:23:31Zsheafsam.derbyshire@gmail.comGHC 9.4 panic on a representation-polymorphic newtype instanceOn GHC 9.4 and HEAD, the following program causes a panic:
```haskell
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ...On GHC 9.4 and HEAD, the following program causes a panic:
```haskell
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UnliftedNewtypes #-}
module T21544 where
import Data.Kind
import GHC.Exts
type N :: forall (r :: RuntimeRep) -> TYPE r -> TYPE r
data family N r a
newtype instance N r a = MkN a
foo :: Int# -> N IntRep Int#
foo = MkN
```
```
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.5.20220503:
isUnliftedType
a_aXy :: TYPE r_aXx
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\GHC\Utils\Panic.hs:182:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler\GHC\Core\Type.hs:2484:7 in ghc:GHC.Core.Type
isUnliftedType, called at compiler\GHC\Core\Opt\Simplify.hs:2900:5 in ghc:GHC.Core.Opt.Simplify
```
The program seems to be OK on GHC 9.2 and below.9.4.1Matthew PickeringMatthew Pickeringhttps://gitlab.haskell.org/ghc/ghc/-/issues/21532"foreign import capi" causes panic with sqlite2022-07-28T10:10:59Zdanidiaz"foreign import capi" causes panic with sqlite## Summary
Trying to `foreign import capi` a sqlite function causes a panic.
## Steps to reproduce
Install the [sqlite](https://www.sqlite.org/index.html) library in your system. For example in Ubuntu, run `apt-get install libsqlite3-...## Summary
Trying to `foreign import capi` a sqlite function causes a panic.
## Steps to reproduce
Install the [sqlite](https://www.sqlite.org/index.html) library in your system. For example in Ubuntu, run `apt-get install libsqlite3-0 libsqlite3-dev`.
Then try to compile the following program:
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE CApiFFI #-}
module Main where
import Foreign
import Foreign.C
type CTraceCallback a
= Ptr a
-> CString -- ^ UTF-8 rendering of the SQL statement text as
-- the statement first begins executing.
-> IO ()
foreign import capi "wrapper"
mkCTraceCallback :: CTraceCallback a -> IO (FunPtr (CTraceCallback a))
main :: IO ()
main = pure ()
The compilation fails with:
[1 of 1] Compiling Main ( Main.hs, Main.o )
ghc: panic! (the 'impossible' happened)
(GHC version 9.2.2:
ccallConvToInt CApiConv
If the calling convention is changed to `ccall`, the program compiles.
## Expected behavior
The program should compile with the `capi` calling convention.
## Environment
* I tried with GHC versions 8.10.7 and 9.2.2
* Operating System: Ubuntu Linux (running inside WSL2 in Windows)9.4.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/21519Core Lint error on (# #) = (# #)2022-06-15T16:31:36ZKrzysztof GogolewskiCore Lint error on (# #) = (# #)The silly declaration `(# #) = (# #)` causes an assertion failure or a Core Lint error:
```
GHCi, version 9.5.20220429: https://www.haskell.org/ghc/ :? for help
ghci> :set -XUnboxedTuples -dcore-lint
ghci> let (# #) = (# #)
panic! (the...The silly declaration `(# #) = (# #)` causes an assertion failure or a Core Lint error:
```
GHCi, version 9.5.20220429: https://www.haskell.org/ghc/ :? for help
ghci> :set -XUnboxedTuples -dcore-lint
ghci> let (# #) = (# #)
panic! (the 'impossible' happened)
GHC version 9.5.20220429:
ASSERT failed!
NonRecursive
{(##) = (##)}
Call stack:
CallStack (from HasCallStack):
assertPpr, called at compiler/GHC/HsToCore/Expr.hs:163:11 in ghc:GHC.HsToCore.Expr
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
ghci> (# #) = (# #)
*** Core Lint errors : in result of Desugar (before optimization) ***
<no location info>: warning:
The type of this binder is unlifted: ds_dzK
Binder's type: (# #)
In the RHS of ds_dzK :: (# #)
Substitution: [TCvSubst
In scope: InScope {}
Type env: []
Co env: []]
```Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/21516Assertion failure on unlifted binding2022-06-14T16:14:08ZKrzysztof GogolewskiAssertion failure on unlifted bindingThis program causes an assertion failure in HEAD, or, if assertions are off, a panic in `lookupIdSubst`:
```haskell
{-# LANGUAGE DataKinds, KindSignatures, ExplicitForAll #-}
module T where
import GHC.Exts
a = let x :: forall (a :: TY...This program causes an assertion failure in HEAD, or, if assertions are off, a panic in `lookupIdSubst`:
```haskell
{-# LANGUAGE DataKinds, KindSignatures, ExplicitForAll #-}
module T where
import GHC.Exts
a = let x :: forall (a :: TYPE IntRep). a
x = error ""
in ()
```Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/21479GHC panic2022-06-14T16:14:08ZIcelandjackGHC panicghc-9.2.2, I don't know if this has been fixed
```haskell
{-# Language ConstraintKinds #-}
{-# Language PatternSynonyms #-}
{-# Language ViewPatterns #-}
{-# Language TypeOperators #-}
{-# Language GADTs #-}
{-# Language PolyKinds #-}
...ghc-9.2.2, I don't know if this has been fixed
```haskell
{-# Language ConstraintKinds #-}
{-# Language PatternSynonyms #-}
{-# Language ViewPatterns #-}
{-# Language TypeOperators #-}
{-# Language GADTs #-}
{-# Language PolyKinds #-}
{-# Language KindSignatures #-}
{-# Language ScopedTypeVariables #-}
{-# Language TypeApplications #-}
module GHC.Generics.Explicit where
import Data.Type.Equality
import Data.Kind
import Type.Reflection
import GHC.Generics
pattern IsV1 <- (isV1 -> Just HRefl)
isV1 :: TypeRep rep -> Maybe (V1 :~~: rep)
isV1 = eqTypeRep @(Type -> Type) @(Type -> Type) (typeRep @V1)
```
produces
```
ghci> :r
[1 of 1] Compiling GHC.Generics.Explicit ( src/GHC/Generics/Explicit.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 9.2.2:
NoFlexi
k_a46D[tau:1] :: *
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Tc/Utils/Zonk.hs:1932:18 in ghc:GHC.Tc.Utils.Zonk
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```9.2.3Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/21463GHC desugarer error with OPAQUE + TempateHaskell2022-07-21T02:43:40ZRyan ScottGHC desugarer error with OPAQUE + TempateHaskellThis program will crash when compiled with GHC 9.4 or HEAD:
```hs
{-# LANGUAGE TemplateHaskell #-}
module Main where
main :: IO ()
main = print
$([| let f :: Int -> Int
f x = x + 1
{-# OPAQUE f #-}
in f 4...This program will crash when compiled with GHC 9.4 or HEAD:
```hs
{-# LANGUAGE TemplateHaskell #-}
module Main where
main :: IO ()
main = print
$([| let f :: Int -> Int
f x = x + 1
{-# OPAQUE f #-}
in f 41
|])
```
```
$ ~/Software/ghc-9.3.20220413/bin/ghc Bug.hs -fforce-recomp
[1 of 2] Compiling Main ( Bug.hs, Bug.o, Bug.dyn_o )
GHC error in desugarer lookup in Main:
Can't find interface-file declaration for data constructor Opaque
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
```
This program works if the intervening Template Haskell splice is removed, however:
```hs
module Main where
main :: IO ()
main = print $
let f :: Int -> Int
f x = x + 1
{-# OPAQUE f #-}
in f 41
```
```
$ ~/Software/ghc-9.3.20220413/bin/ghc Bug.hs -fforce-recomp && ./Bug
[1 of 2] Compiling Main ( Bug.hs, Bug.o )
[2 of 2] Linking Bug
42
```9.4.1Matthew PickeringMatthew Pickeringhttps://gitlab.haskell.org/ghc/ghc/-/issues/21440exprIsDeadEnd is broken2022-08-05T14:49:07ZAndreas KlebingerexprIsDeadEnd is broken```
exprIsDeadEnd :: CoreExpr -> Bool
-- See Note [Bottoming expressions]
exprIsDeadEnd e
| isEmptyTy (exprType e)
= True
| otherwise
= go 0 e
where
go n (Var v) = isDeadEndId v && n >= idArity v
go n (...```
exprIsDeadEnd :: CoreExpr -> Bool
-- See Note [Bottoming expressions]
exprIsDeadEnd e
| isEmptyTy (exprType e)
= True
| otherwise
= go 0 e
where
go n (Var v) = isDeadEndId v && n >= idArity v
go n (App e a) | isTypeArg a = go n e
| otherwise = go (n+1) e
```
We have
```
failIO :: forall a. String -> IO a
[Arity = 0 -- unknown arity
, ...]
failIO = failIO1
```
We call
```
exprIsDead (App failIO msg)
=> AppCase
go 1 failIO
=> Var case
isDeadEndId failIO && 1 >= idArity failIO
=>
True && n >= 1 >= 0
=>
True
```
The problem is that we trust `idArity` to return a known arity. But it can also return zero if the arity is unknown.
That means for a potentially bottoming function we always get True for `exprIsDeadEnd` if it has unknown Arity.Andreas KlebingerAndreas Klebingerhttps://gitlab.haskell.org/ghc/ghc/-/issues/21398Prelude.chr: bad argument: 15267266592022-08-15T14:18:51ZChristos DemetriouPrelude.chr: bad argument: 1526726659## Summary
Was following the yesodweb tutorial, but I keep getting this exception:
![image](/uploads/8d41ed7b822b9ae3eec15e293efe4be9/image.png)
## Steps to reproduce
I ran the commands :
`stack new backend yesodweb/sqlite && cd bac...## Summary
Was following the yesodweb tutorial, but I keep getting this exception:
![image](/uploads/8d41ed7b822b9ae3eec15e293efe4be9/image.png)
## Steps to reproduce
I ran the commands :
`stack new backend yesodweb/sqlite && cd backend`
`stack install yesod-bin --install-ghc`
## Expected behavior
## Environment
* GHC version used: The Glorious Glasgow Haskell Compilation System, version 8.10.7
* Installed through `ghcup`
Optional:
* Operating System: Ubuntu VM
* System Architecture:https://gitlab.haskell.org/ghc/ghc/-/issues/21391Core Lint error when building reroute-0.6.0.0 on HEAD2023-08-21T02:06:18ZRyan ScottCore Lint error when building reroute-0.6.0.0 on HEAD_(Originally discovered in a `head.hackage` CI job [here](https://gitlab.haskell.org/ghc/head.hackage/-/jobs/1009813#L926).)_
The `reroute-0.6.0.0` Hackage library fails to build on HEAD when built with `-dcore-lint`. Here is a minimal ..._(Originally discovered in a `head.hackage` CI job [here](https://gitlab.haskell.org/ghc/head.hackage/-/jobs/1009813#L926).)_
The `reroute-0.6.0.0` Hackage library fails to build on HEAD when built with `-dcore-lint`. Here is a minimal example:
```hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
module Web.Routing.SafeRouting where
import Control.DeepSeq (NFData (..))
import Data.Kind (Constraint)
import Data.Typeable (Typeable)
class FromHttpApiData a where
data PolyMap (c :: * -> Constraint) (f :: * -> *) (a :: *) where
PMNil :: PolyMap c f a
PMCons :: (Typeable p, c p) => f (p -> a) -> PolyMap c f a -> PolyMap c f a
rnfHelper :: (forall p. c p => f (p -> a) -> ()) -> PolyMap c f a -> ()
rnfHelper _ PMNil = ()
rnfHelper h (PMCons v pm) = h v `seq` rnfHelper h pm
data PathMap x =
PathMap [x] (PolyMap FromHttpApiData PathMap x)
instance NFData x => NFData (PathMap x) where
rnf (PathMap a b) = rnf a `seq` rnfHelper rnf b
```
It will produce this Core Lint error on HEAD:
<details>
```
$ ~/Software/ghc/inplace/bin/ghc-stage2 -dcore-lint Bug1.hs -O -dno-typeable-binds -fforce-recomp
[1 of 1] Compiling Web.Routing.SafeRouting ( Bug1.hs, Bug1.o )
*** Core Lint errors : in result of Specialise ***
Bug1.hs:24:10: warning:
From-type of Cast differs from type of enclosed expression
From-type: NFData x_aT3
Type of enclosed expression: NFData (p_aTl -> x_aT3)
Actual enclosed expression: $dNFData_sUv
Coercion used in cast: N:NFData[0] <x_aT3>_N
In the RHS of $s$crnf_sUw :: forall {p} {x}. PathMap x -> ()
In the body of lambda with binder p_aTl :: *
In the body of lambda with binder x_aT3 :: *
In the body of lambda with binder eta_B0 :: PathMap x_aT3
In the body of letrec with binders $dNFData_sUv :: NFData
(p_aTl -> x_aT3)
In a case alternative: (PathMap a_aHg :: [x_aT3],
b_aHh :: PolyMap FromHttpApiData PathMap x_aT3)
Substitution: [TCvSubst
In scope: InScope {x_aT3 p_aTl}
Type env: [aT3 :-> x_aT3, aTl :-> p_aTl]
Co env: []]
*** Offending Program ***
Rec {
rnfHelper [Occ=LoopBreaker]
:: forall (c :: * -> Constraint) (f :: * -> *) a.
(forall p. c p => f (p -> a) -> ()) -> PolyMap c f a -> ()
[LclIdX,
Arity=2,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 30] 90 10}]
rnfHelper
= \ (@(c_aSx :: * -> Constraint))
(@(f_aSy :: * -> *))
(@a_aSz)
(ds_dTD :: forall p. c_aSx p => f_aSy (p -> a_aSz) -> ())
(ds_dTE :: PolyMap c_aSx f_aSy a_aSz) ->
case ds_dTE of {
PMNil -> ();
PMCons @p_aSD $dTypeable_aSE irred_aSF v_aHn pm_aHo ->
case ds_dTD @p_aSD irred_aSF v_aHn of { () ->
rnfHelper @c_aSx @f_aSy @a_aSz ds_dTD pm_aHo
}
}
end Rec }
Rec {
$s$crnf_sUw :: forall {p} {x}. PathMap x -> ()
[LclId, Arity=1]
$s$crnf_sUw
= \ (@p_aTl) (@x_aT3) (eta_B0 :: PathMap x_aT3) ->
let {
$dNFData_sUv :: NFData (p_aTl -> x_aT3)
[LclId,
Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 60}]
$dNFData_sUv
= (\ (v_aUr :: p_aTl -> x_aT3) ->
case v_aUr of { __DEFAULT -> () })
`cast` (Sym (N:NFData[0] <p_aTl -> x_aT3>_N)
:: ((p_aTl -> x_aT3) -> ()) ~R# NFData (p_aTl -> x_aT3)) } in
case eta_B0 of { PathMap a_aHg b_aHh ->
case $fNFData1List_$cliftRnf
@x_aT3
($dNFData_sUv
`cast` (N:NFData[0] <x_aT3>_N :: NFData x_aT3 ~R# (x_aT3 -> ())))
a_aHg
of
{ () ->
rnfHelper
@FromHttpApiData
@PathMap
@x_aT3
(\ (@p_X3) _ [Occ=Dead] (eta_X4 :: PathMap (p_X3 -> x_aT3)) ->
$crnf_aT6
@(p_X3 -> x_aT3)
((\ (v_aUr :: p_X3 -> x_aT3) -> case v_aUr of { __DEFAULT -> () })
`cast` (Sym (N:NFData[0] <p_X3 -> x_aT3>_N)
:: ((p_X3 -> x_aT3) -> ()) ~R# NFData (p_X3 -> x_aT3)))
eta_X4)
b_aHh
}
}
$crnf_aT6 [Occ=LoopBreaker]
:: forall x. NFData x => PathMap x -> ()
[LclId,
Arity=2,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [0 20] 150 0},
RULES: "SPEC $crnf @(p -> x)"
forall (@p_aTl) (@x_aT3) ($dNFData_sUv :: NFData (p_aTl -> x_aT3)).
$crnf_aT6 @(p_aTl -> x_aT3) $dNFData_sUv
= $s$crnf_sUw @p_aTl @x_aT3]
$crnf_aT6
= \ (@x_aT3)
($dNFData_aT4 :: NFData x_aT3)
(eta_B0 :: PathMap x_aT3) ->
case eta_B0 of { PathMap a_aHg b_aHh ->
case $fNFData1List_$cliftRnf
@x_aT3
($dNFData_aT4
`cast` (N:NFData[0] <x_aT3>_N :: NFData x_aT3 ~R# (x_aT3 -> ())))
a_aHg
of
{ () ->
rnfHelper
@FromHttpApiData
@PathMap
@x_aT3
(\ (@p_aTl) _ [Occ=Dead] (eta_X3 :: PathMap (p_aTl -> x_aT3)) ->
$crnf_aT6
@(p_aTl -> x_aT3)
((\ (v_aUr :: p_aTl -> x_aT3) -> case v_aUr of { __DEFAULT -> () })
`cast` (Sym (N:NFData[0] <p_aTl -> x_aT3>_N)
:: ((p_aTl -> x_aT3) -> ()) ~R# NFData (p_aTl -> x_aT3)))
eta_X3)
b_aHh
}
}
end Rec }
$fNFDataPathMap [InlPrag=INLINE (sat-args=0)]
:: forall x. NFData x => NFData (PathMap x)
[LclIdX[DFunId(nt)],
Arity=2,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=True)
Tmpl= $crnf_aT6
`cast` (forall (x :: <*>_N).
<NFData x>_R %<'Many>_N ->_R Sym (N:NFData[0] <PathMap x>_N)
:: (forall {x}. NFData x => PathMap x -> ())
~R# (forall {x}. NFData x => NFData (PathMap x)))}]
$fNFDataPathMap
= $crnf_aT6
`cast` (forall (x :: <*>_N).
<NFData x>_R %<'Many>_N ->_R Sym (N:NFData[0] <PathMap x>_N)
:: (forall {x}. NFData x => PathMap x -> ())
~R# (forall {x}. NFData x => NFData (PathMap x)))
*** End of Offense ***
<no location info>: error:
Compilation had errors
<no location info>: error: ExitFailure 1
```
</details>
This regression was introduced in commit 4d2ee313f23a4454d12c9f94ff132f078dd64d31 (`Specialising through specialised method calls`). cc @sgraf8129.6.1Simon Peyton JonesRyan ScottSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/21351GHC panics while installing2022-07-07T15:18:52ZfermaqGHC panics while installing## Summary
Just installed Stack and want to compile a program, so it tries to download and install GHC, etc. but fails in the process.
## Steps to reproduce
1. Install Stack if already not installed (I'm using v2.7.5 by the way)
2. Ma...## Summary
Just installed Stack and want to compile a program, so it tries to download and install GHC, etc. but fails in the process.
## Steps to reproduce
1. Install Stack if already not installed (I'm using v2.7.5 by the way)
2. Make a new project or use an existing one
3. Use a text editor to modify the 'resolver:' line in the 'stack.yaml' file to 'resolver: lts-15.3'
4. Use any terminal (PowerShell, Command Prompt, Bash, etc.) to 'stack build' or 'stack test' the project
5. You may now encounter the same result as I do have:
[output.txt](/uploads/68920297329975ad859755f08d727eb4/output.txt)
P.S.: I tried disabling the antivirus, the firewall, and running the terminals with administrator permissions, but always had the same result.
## Expected behavior
Download and install GHC, etc. correctly and then try to compile the program.
## Environment
* GHC version used: 8.2.2
Optional:
* Operating System: Windows 10
* System Architecture: x64