GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:02:37Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/15872Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>)2019-07-07T18:02:37ZIcelandjackOdd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>)Maybe indicative of deeper issues:
```hs
{-# Language RankNTypes #-}
{-# Language DataKinds #-}
{-# Language PolyKinds #-}
{-# Language GADTs #-}
import Data.Kind
data WHICH = OP | OPOP
data Fun :: forall (a :: WHICH). a ~ OP ...Maybe indicative of deeper issues:
```hs
{-# Language RankNTypes #-}
{-# Language DataKinds #-}
{-# Language PolyKinds #-}
{-# Language GADTs #-}
import Data.Kind
data WHICH = OP | OPOP
data Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where
MkFun :: (a -> b) -> Fun a b
```
There are some artifacts `Fun ('GHC.Type.Eq# <>)` in the type of `MkFun` that shouldn't be there
```
$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci ~/hs/655_bug.hs
GHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /home/baldur/hs/655_bug.hs, interpreted )
Ok, one module loaded.
*Main> :t MkFun
MkFun :: (a -> b) -> Fun ('GHC.Types.Eq# <>) a b
*Main> :k Fun
Fun :: (a ~ 'OP) => * -> * -> *
*Main>
```
----
Tangent: Omitting `{-# Language GADTs #-}` we get the term "equational constraint" which is not the term I have seen in the wild
```
$ latestbug 655_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 655_bug.hs, interpreted )
655_bug.hs:9:1: error:
Illegal equational constraint a ~ 'OP
(Use GADTs or TypeFamilies to permit this)
|
9 | data Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
Failed, no modules loaded.
Prelude>
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.2 |
| 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":"Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Maybe indicative of deeper issues:\r\n\r\n{{{#!hs\r\n{-# Language RankNTypes #-}\r\n{-# Language DataKinds #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language GADTs #-}\r\n\r\nimport Data.Kind\r\n\r\ndata WHICH = OP | OPOP\r\n\r\ndata Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where\r\n MkFun :: (a -> b) -> Fun a b\r\n}}}\r\n\r\nThere are some artifacts `Fun ('GHC.Type.Eq# <>)` in the type of `MkFun` that shouldn't be there\r\n\r\n{{{\r\n$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci ~/hs/655_bug.hs\r\nGHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( /home/baldur/hs/655_bug.hs, interpreted )\r\nOk, one module loaded.\r\n*Main> :t MkFun\r\nMkFun :: (a -> b) -> Fun ('GHC.Types.Eq# <>) a b\r\n*Main> :k Fun\r\nFun :: (a ~ 'OP) => * -> * -> *\r\n*Main>\r\n}}}\r\n\r\n----\r\n\r\nTangent: Omitting `{-# Language GADTs #-}` we get the term \"equational constraint\" which is not the term I have seen in the wild\r\n\r\n{{{\r\n$ latestbug 655_bug.hs\r\nGHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 655_bug.hs, interpreted )\r\n\r\n655_bug.hs:9:1: error:\r\n Illegal equational constraint a ~ 'OP\r\n (Use GADTs or TypeFamilies to permit this)\r\n |\r\n9 | data Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...\r\nFailed, no modules loaded.\r\nPrelude>\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/15871Revamp -fprint-explicit-kinds2019-07-07T18:02:38ZRichard Eisenbergrae@richarde.devRevamp -fprint-explicit-kindsWith the imminent #12045, we will have type application in kinds. This ticket tracks mirroring this new behavior in the pretty-printer.
To wit, when `-fprint-explicit-kinds` is enabled, we should
1. Print instantiations of specified va...With the imminent #12045, we will have type application in kinds. This ticket tracks mirroring this new behavior in the pretty-printer.
To wit, when `-fprint-explicit-kinds` is enabled, we should
1. Print instantiations of specified variables like `@...`.
1. Print instantiations of inferred variables like `@{...}`.
Examples:
```hs
data Proxy (a :: k) = Proxy
-- Then, `Proxy Int` would be printed as `Proxy @Type Int` with -fprint-explicit-kinds
data Proxy2 a = Proxy2
-- Then, `Proxy2 Int` would be printed as `Proxy2 @{Type} Int` with -fprint-explicit-kinds
```
In addition, sometimes error messages suggest enabling `-fprint-explicit-kinds`. Instead of doing this, we should just locally enable the flag. The existence of the `@` prefixes will alert the reader that these are not type arguments. (Without the `@` syntax, locally and silently enabling `-fprint-explicit-kinds` would be very confusing.)
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.2 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Revamp -fprint-explicit-kinds","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"With the imminent #12045, we will have type application in kinds. This ticket tracks mirroring this new behavior in the pretty-printer.\r\n\r\nTo wit, when `-fprint-explicit-kinds` is enabled, we should\r\n\r\n1. Print instantiations of specified variables like `@...`.\r\n\r\n2. Print instantiations of inferred variables like `@{...}`.\r\n\r\nExamples:\r\n\r\n{{{#!hs\r\ndata Proxy (a :: k) = Proxy\r\n -- Then, `Proxy Int` would be printed as `Proxy @Type Int` with -fprint-explicit-kinds\r\n\r\ndata Proxy2 a = Proxy2\r\n -- Then, `Proxy2 Int` would be printed as `Proxy2 @{Type} Int` with -fprint-explicit-kinds\r\n}}}\r\n\r\nIn addition, sometimes error messages suggest enabling `-fprint-explicit-kinds`. Instead of doing this, we should just locally enable the flag. The existence of the `@` prefixes will alert the reader that these are not type arguments. (Without the `@` syntax, locally and silently enabling `-fprint-explicit-kinds` would be very confusing.)","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15870No skolem info panic2019-07-07T18:02:38Zsheafsam.derbyshire@gmail.comNo skolem info panicI've been toying with some type-level lenses and running into some issues with kind unification, when I ran into a panic:
```
bug.hs:30:34: error:ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.6.2 for x86_64-unknown-mingw3...I've been toying with some type-level lenses and running into some issues with kind unification, when I ran into a panic:
```
bug.hs:30:34: error:ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.6.2 for x86_64-unknown-mingw32):
No skolem info:
[k_a1Hgj]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\utils\Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler\\typecheck\\TcErrors.hs:2891:5 in ghc:TcErrors
```
Here's a boiled down version (with a bit of extraneous code left in for context, as it's so short):
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
data Optic a where
--Index :: Nat -> Optic a
--Name :: Symbol -> Optic a
(:.:) :: Optic a -> Optic b -> Optic a -- composition
class Gettable a (optic :: Optic a) where
type Get a (optic :: Optic a)
{-
some basic instances, e.g.
instance Gettable (a,b) (Index 0) where
type Get (a,b) (Index 0) = a
...
-}
instance forall a b (g1 :: Optic a) (g2 :: Optic b).
( Gettable a g1
, b ~ Get a g1
, Gettable b g2
) => Gettable a (g1 :.: g2) where
type Get a (g1 :.: g2) = Get a g2
```
The program I am actually trying to write has the instance declaration changed to
```hs
instance forall a b (g1 :: Optic a) (g2 :: Optic (Get a g1)).
( Gettable a g1
, b ~ Get a g1
, Gettable b g2
) => Gettable a (g1 :.: g2) where
type Get a (g1 :.: g2) = Get (Get a g1) g2
```
but GHC complains that it can't match kinds:
```
• Expected kind ‘Optic b’, but ‘g2’ has kind ‘Optic (Get a g1)’
• In the second argument of ‘Gettable’, namely ‘g2’
In the instance declaration for ‘Gettable a (g1 :.: g2)’
|
20 | , Gettable b g2
|
```
I don't know if there is a way around that, and I'd be interested to hear any advice.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.6.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"No skolem info panic","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I've been toying with some type-level lenses and running into some issues with kind unification, when I ran into a panic:\r\n\r\n\r\n{{{\r\nbug.hs:30:34: error:ghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.6.2 for x86_64-unknown-mingw32):\r\n No skolem info:\r\n [k_a1Hgj]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler\\utils\\Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler\\\\typecheck\\\\TcErrors.hs:2891:5 in ghc:TcErrors\r\n}}}\r\n\r\nHere's a boiled down version (with a bit of extraneous code left in for context, as it's so short):\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE MultiParamTypeClasses #-}\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n\r\ndata Optic a where\r\n --Index :: Nat -> Optic a\r\n --Name :: Symbol -> Optic a\r\n (:.:) :: Optic a -> Optic b -> Optic a -- composition\r\n\r\nclass Gettable a (optic :: Optic a) where\r\n type Get a (optic :: Optic a)\r\n\r\n{-\r\nsome basic instances, e.g.\r\ninstance Gettable (a,b) (Index 0) where\r\n type Get (a,b) (Index 0) = a\r\n...\r\n-}\r\n\r\ninstance forall a b (g1 :: Optic a) (g2 :: Optic b).\r\n ( Gettable a g1\r\n , b ~ Get a g1\r\n , Gettable b g2\r\n ) => Gettable a (g1 :.: g2) where\r\n type Get a (g1 :.: g2) = Get a g2\r\n}}}\r\n\r\nThe program I am actually trying to write has the instance declaration changed to\r\n{{{#!hs\r\ninstance forall a b (g1 :: Optic a) (g2 :: Optic (Get a g1)).\r\n ( Gettable a g1\r\n , b ~ Get a g1\r\n , Gettable b g2\r\n ) => Gettable a (g1 :.: g2) where\r\n type Get a (g1 :.: g2) = Get (Get a g1) g2\r\n}}}\r\nbut GHC complains that it can't match kinds:\r\n\r\n{{{\r\n • Expected kind ‘Optic b’, but ‘g2’ has kind ‘Optic (Get a g1)’\r\n • In the second argument of ‘Gettable’, namely ‘g2’\r\n In the instance declaration for ‘Gettable a (g1 :.: g2)’\r\n |\r\n20 | , Gettable b g2\r\n |\r\n}}}\r\nI don't know if there is a way around that, and I'd be interested to hear any advice.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15869Discrepancy between seemingly equivalent type synonym and type family2019-07-07T18:02:38ZRyan ScottDiscrepancy between seemingly equivalent type synonym and type familyConsider the following code:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE LiberalTypeSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
module Bug wher...Consider the following code:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE LiberalTypeSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
module Bug where
import Data.Kind
type KindOf1 (a :: k) = k
type family KindOf2 (a :: k) :: Type where
KindOf2 (a :: k) = k
data A (a :: Type) :: a -> Type
type family Apply1 (f :: KindOf1 A) (a :: Type) (x :: a) :: Type where
Apply1 f a x = f a x
```
`Apply1` kind-checks, which is just peachy. Note that `Apply1` uses `KindOf1`, which is a type synonym. Suppose I wanted to swap out `KindOf1` for `KindOf2`, which is (seemingly) an equivalent type family. I can define this:
```hs
type family Apply2 (f :: KindOf2 A) -- (f :: forall a -> a -> Type)
(a :: Type)
(x :: a)
:: Type where
Apply2 f a x = f a x
```
However, GHC rejects this!
```
$ /opt/ghc/8.6.2/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:25:10: error:
• Expecting two more arguments to ‘f’
Expected kind ‘KindOf2 A’, but ‘f’ has kind ‘* -> a -> *’
• In the first argument of ‘Apply2’, namely ‘f’
In the type family declaration for ‘Apply2’
|
25 | Apply2 f a x = f a x
| ^
```
I find this quite surprising, since I would have expected `KindOf1` and `KindOf2` to be functionally equivalent. Even providing explicit `forall`s does not make it kind-check:
```hs
type family Apply2 (f :: KindOf2 A) -- (f :: forall a -> a -> Type)
(a :: Type)
(x :: a)
:: Type where
forall (f :: KindOf2 A) (a :: Type) (x :: a).
Apply2 f a x = f a x
```
Although the error message does change a bit:
```
$ ~/Software/ghc3/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:26:20: error:
• Expected kind ‘* -> a -> *’, but ‘f’ has kind ‘KindOf2 A’
• In the type ‘f a x’
In the type family declaration for ‘Apply2’
|
26 | Apply2 f a x = f a x
| ^^^^^
```https://gitlab.haskell.org/ghc/ghc/-/issues/15868Standard deriving should be less conservative when `UndecidableInstances` is ...2019-07-22T17:04:42Zedsko@edsko.netStandard deriving should be less conservative when `UndecidableInstances` is enabledThe following program
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Exp where
...The following program
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Exp where
type family F a
data T a = MkT (F a)
deriving instance Eq (F a) => Eq (T a)
data T2 a = T2 (T a)
deriving (Eq)
```
results in a type error
```
• No instance for (Eq (F a))
arising from the first field of ‘T2’ (type ‘T a’)
```
According the manual this is expected behaviour (https://downloads.haskell.org/\~ghc/latest/docs/html/users_guide/glasgow_exts.html\#inferred-context-for-deriving-clauses), but it is unfortunate; it seems to me that there is no deep reason that this instance should be rejected, other than an overly conservative check in the deriving machinery; I propose that this check is relaxed when the `UndecidableInstances` extension is enabled. Mind that I'm *not* proposing that it should also be able to infer the right constraints for `T` itself; but once I write such an explicit context myself once (for `T`), it seems to me that deriving the *same* constraints also for `T2` should be easy.
Note that right now we can work-around this problem using
```hs
class Eq (F a) => EqF a
deriving instance EqF a => Eq (T a)
data T2 a = T2 (T a)
deriving (Eq)
```
Normally however for such a class synonym we would then provide a single "authoritative" instance:
```hs
class Eq (F a) => EqF a
instance Eq (F a) => EqF a
```
but if we do that then we are back at the same error for `T2`, because ghc will go from the `EqF a` constraint to the `Eq (F a)` constraint, and then refuse to add that constraint.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.6.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Standard deriving should be less conservative when `UndecidableInstances` is enabled","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"The following program\r\n\r\n{{{#!hs\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE StandaloneDeriving #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE UndecidableInstances #-}\r\n\r\nmodule Exp where\r\n\r\ntype family F a\r\n\r\ndata T a = MkT (F a)\r\n\r\nderiving instance Eq (F a) => Eq (T a)\r\n\r\ndata T2 a = T2 (T a)\r\n deriving (Eq)\r\n}}}\r\n\r\nresults in a type error\r\n\r\n{{{\r\n • No instance for (Eq (F a))\r\n arising from the first field of ‘T2’ (type ‘T a’)\r\n}}}\r\n\r\nAccording the manual this is expected behaviour (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#inferred-context-for-deriving-clauses), but it is unfortunate; it seems to me that there is no deep reason that this instance should be rejected, other than an overly conservative check in the deriving machinery; I propose that this check is relaxed when the `UndecidableInstances` extension is enabled. Mind that I'm ''not'' proposing that it should also be able to infer the right constraints for `T` itself; but once I write such an explicit context myself once (for `T`), it seems to me that deriving the ''same'' constraints also for `T2` should be easy.\r\n\r\nNote that right now we can work-around this problem using\r\n\r\n{{{#!hs\r\nclass Eq (F a) => EqF a\r\n\r\nderiving instance EqF a => Eq (T a)\r\n\r\ndata T2 a = T2 (T a)\r\n deriving (Eq)\r\n}}}\r\n\r\nNormally however for such a class synonym we would then provide a single \"authoritative\" instance:\r\n\r\n{{{#!hs\r\nclass Eq (F a) => EqF a\r\ninstance Eq (F a) => EqF a\r\n}}}\r\n\r\nbut if we do that then we are back at the same error for `T2`, because ghc will go from the `EqF a` constraint to the `Eq (F a)` constraint, and then refuse to add that constraint. ","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15867STG scope error2019-07-07T18:02:39ZCsaba HruskaSTG scope errorStgRhsClosure can contain duplicated names in its free variable and argument list.
Example bug: libraries/integer-gmp/src/GHC/Integer/Type.hs
GHC HEAD and 8.2.2 has this issue.
I have not checked with other versions.
I've extended th...StgRhsClosure can contain duplicated names in its free variable and argument list.
Example bug: libraries/integer-gmp/src/GHC/Integer/Type.hs
GHC HEAD and 8.2.2 has this issue.
I have not checked with other versions.
I've extended the STG linter to do scope checking. See the patch attached.
To reproduce:
- patch GHC head: `git apply StgScopeCheck.patch`
- make sure every compiled stg is linted: add the following to `mk/build.mk`\\\\
```
GhcStage2HcOpts += -dstg-lint
GhcLibHcOpts += -dstg-lint
GhcRtsHcOpts += -dstg-lint
```
- compile GHC HEAD
Background info:
I've found this issue because I'm using GHC as a Haskell fronted for my whole program compiler project. I work on The GRIN Compiler (https://github.com/grin-tech) where GHC/GRIN compiles STG to GRIN. Sebastian GrafSebastian Grafhttps://gitlab.haskell.org/ghc/ghc/-/issues/15866libiserv's version number is hard-coded2020-09-28T07:11:37ZRyan Scottlibiserv's version number is hard-codedI recently discovered that GHC 8.6.2 was shipped with `libiserv-8.6.1`. Yes, you read that correctly—8.6.1, not 8.6.2. I was baffled at how this could possibly happen until I realized that we hard-code the version number for `libiserv` d...I recently discovered that GHC 8.6.2 was shipped with `libiserv-8.6.1`. Yes, you read that correctly—8.6.1, not 8.6.2. I was baffled at how this could possibly happen until I realized that we hard-code the version number for `libiserv` directly in its `.cabal` file.
Needless to say, this is quite easy to forget to update. Let's let `autoconf` do the hard work for us and use `@ProjectVersionMunged@` instead.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"libiserv's version number is hard-coded","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I recently discovered that GHC 8.6.2 was shipped with `libiserv-8.6.1`. Yes, you read that correctly—8.6.1, not 8.6.2. I was baffled at how this could possibly happen until I realized that we hard-code the version number for `libiserv` directly in its `.cabal` file.\r\n\r\nNeedless to say, this is quite easy to forget to update. Let's let `autoconf` do the hard work for us and use `@ProjectVersionMunged@` instead.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15865Typed template haskell and implicit parameters lead to incorrect results2020-10-30T19:29:43ZMatthew PickeringTyped template haskell and implicit parameters lead to incorrect resultsIn a similar vein to #15863 but this time with implicit parameters.
https://gist.github.com/b6919b13abe0954fdad844e16e0edb48
```
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE TemplateHaskell #-}
module A where
import Language.Haskell.T...In a similar vein to #15863 but this time with implicit parameters.
https://gist.github.com/b6919b13abe0954fdad844e16e0edb48
```
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE TemplateHaskell #-}
module A where
import Language.Haskell.TH
import Data.List (sortBy)
sort :: (?cmp :: a -> a -> Ordering) => [a] -> [a]
sort = sortBy ?cmp
me :: Q (TExp ([Int] -> [Int]))
me = let ?cmp = compare in [|| sort ||]
```
In module `A` we quote a value which has an implicit argument but in its context we bind the implicit so the type of the quote is the monomorphic type.
```
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE TemplateHaskell #-}
module B where
import A
foo :: [Int] -> [Int]
foo =
--let ?cmp = compare in
$$(me)
```
When we splice in `me`, we get an error about an unbound implicit parameter which is totally bogus as we already bound it in `A`. There is also dynamic binding if another implicit parameter with the same name is in scope but the type of `me` mentions nothing about implicit parameters so this shouldn't be allowed.
```
B.hs:8:10: error:
• Unbound implicit parameter (?cmp::Int -> Int -> Ordering)
arising from a use of ‘sort’
• In the expression: sort
In the result of the splice:
$me
To see what the splice expanded to, use -ddump-splices
In the Template Haskell splice $$(me)
|
8 | foo = $$(me)
| ^^
Failed, one module loaded.
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"Typed template haskell and implicit parameters lead to incorrect results","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"In a similar vein to #15863 but this time with implicit parameters.\r\n\r\nhttps://gist.github.com/b6919b13abe0954fdad844e16e0edb48\r\n\r\n{{{\r\n{-# LANGUAGE ImplicitParams #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule A where\r\n\r\nimport Language.Haskell.TH\r\nimport Data.List (sortBy)\r\n\r\n\r\nsort :: (?cmp :: a -> a -> Ordering) => [a] -> [a]\r\nsort = sortBy ?cmp\r\n\r\nme :: Q (TExp ([Int] -> [Int]))\r\nme = let ?cmp = compare in [|| sort ||]\r\n}}}\r\n\r\nIn module `A` we quote a value which has an implicit argument but in its context we bind the implicit so the type of the quote is the monomorphic type.\r\n\r\n{{{\r\n{-# LANGUAGE ImplicitParams #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule B where\r\n\r\nimport A\r\n\r\nfoo :: [Int] -> [Int]\r\nfoo =\r\n --let ?cmp = compare in\r\n $$(me)\r\n}}}\r\n\r\nWhen we splice in `me`, we get an error about an unbound implicit parameter which is totally bogus as we already bound it in `A`. There is also dynamic binding if another implicit parameter with the same name is in scope but the type of `me` mentions nothing about implicit parameters so this shouldn't be allowed.\r\n\r\n{{{\r\nB.hs:8:10: error:\r\n • Unbound implicit parameter (?cmp::Int -> Int -> Ordering)\r\n arising from a use of ‘sort’\r\n • In the expression: sort\r\n In the result of the splice:\r\n $me\r\n To see what the splice expanded to, use -ddump-splices\r\n In the Template Haskell splice $$(me)\r\n |\r\n8 | foo = $$(me)\r\n | ^^\r\nFailed, one module loaded.\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15864Fix Int8#, Int16#, Word8#, Word16# tests under LLVM code generator2019-07-07T18:02:39ZBen GamariFix Int8#, Int16#, Word8#, Word16# tests under LLVM code generatorUnfortunately it looks like LLVM doesn't like that we use `bitcast` to narrow integers. E.g. `CmpWord8` currently fails with:
```
=====> CmpWord8(llvm) 18 of 23 [0, 6, 0]
cd "primops/should_run/CmpWord8.run" && "/mnt/work/ghc/ghc-compa...Unfortunately it looks like LLVM doesn't like that we use `bitcast` to narrow integers. E.g. `CmpWord8` currently fails with:
```
=====> CmpWord8(llvm) 18 of 23 [0, 6, 0]
cd "primops/should_run/CmpWord8.run" && "/mnt/work/ghc/ghc-compare-1/inplace/test spaces/ghc-stage2" -o CmpWord8 CmpWord8.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output -fllvm
Compile failed (exit code 1) errors were:
[1 of 1] Compiling Main ( CmpInt8.hs, CmpInt8.o )
opt: /run/user/1000/ghc32287_0/ghc_2.ll:14549:20: error: invalid cast opcode for cast from 'i64' to 'i8'
%ln6uE = bitcast i64 %ln6uD to i8
^
`opt' failed in phase `LLVM Optimiser'. (Exit code: 1)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | --------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (LLVM) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | michalt |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Fix Int8#, Int16#, Word8#, Word16# tests under LLVM code generator","status":"New","operating_system":"","component":"Compiler (LLVM)","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["michalt"],"type":"Bug","description":"Unfortunately it looks like LLVM doesn't like that we use `bitcast` to narrow integers. E.g. `CmpWord8` currently fails with:\r\n{{{\r\n=====> CmpWord8(llvm) 18 of 23 [0, 6, 0]\r\ncd \"primops/should_run/CmpWord8.run\" && \"/mnt/work/ghc/ghc-compare-1/inplace/test spaces/ghc-stage2\" -o CmpWord8 CmpWord8.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output -fllvm \r\nCompile failed (exit code 1) errors were:\r\n[1 of 1] Compiling Main ( CmpInt8.hs, CmpInt8.o )\r\nopt: /run/user/1000/ghc32287_0/ghc_2.ll:14549:20: error: invalid cast opcode for cast from 'i64' to 'i8'\r\n %ln6uE = bitcast i64 %ln6uD to i8\r\n ^\r\n`opt' failed in phase `LLVM Optimiser'. (Exit code: 1)\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15863Splicing a type class method selects the wrong instance2019-07-07T18:02:40ZMatthew PickeringSplicing a type class method selects the wrong instanceConsider these 4 modules as concocted by Csongor.
The wrong instance is selected when you splice in `B.me` into `D`.
https://gist.github.com/mpickering/959a95525647802414ab50e8e6ed490c
```
module A where
class C a where
foo :: a ->...Consider these 4 modules as concocted by Csongor.
The wrong instance is selected when you splice in `B.me` into `D`.
https://gist.github.com/mpickering/959a95525647802414ab50e8e6ed490c
```
module A where
class C a where
foo :: a -> String
instance C Int where
foo _ = "int"
```
```
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module B where
import A
import Language.Haskell.TH
instance C a => C [a] where
foo _ = "list"
me :: Q (TExp ([Int] -> String))
me = [|| foo ||]
```
```
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module C where
import A
import Language.Haskell.TH
instance {-# OVERLAPPING #-} C [Int] where
foo _ = "list2"
```
```
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module D where
import A
import B
import C
main2 = $$(me) [1 :: Int]
```
```
>>> main2
"list2"
```
In `B`, `B.me` is created by quoting `foo`. `B.me :: Q (TExp ([Int] -> String))` so in order to type check this quote we need to solve the instance `C [Int]` which we should do by using the instance defined in `B` (and `A`).
In module `C` we define a different overlapping instance (note that this could be in a completely different library not under our control).
When we then splice `B.me` into `D`, the instance from `C` is used and can be witnessed by printing `main2` which shows `"list2"` rather than `"list"` as expected.
This is a symptom of the fact that the renamed rather than the typechecked AST is serialised I think.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"Splcing a type class method selects the wrong instance","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider these 4 modules as concocted by Csongor. \r\n\r\nThe wrong instance is selected when you splice in `B.me` into `D`.\r\n\r\nhttps://gist.github.com/mpickering/959a95525647802414ab50e8e6ed490c\r\n\r\n{{{\r\nmodule A where\r\n\r\nclass C a where\r\n foo :: a -> String\r\n\r\ninstance C Int where\r\nfoo _ = \"int\"\r\n}}}\r\n\r\n{{{\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# LANGUAGE NoMonomorphismRestriction #-}\r\nmodule B where\r\n\r\nimport A\r\n\r\nimport Language.Haskell.TH\r\n\r\ninstance C a => C [a] where\r\n foo _ = \"list\"\r\n\r\nme :: Q (TExp ([Int] -> String))\r\nme = [|| foo ||]\r\n}}}\r\n\r\n{{{\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# LANGUAGE NoMonomorphismRestriction #-}\r\nmodule C where\r\n\r\nimport A\r\n\r\nimport Language.Haskell.TH\r\n\r\ninstance {-# OVERLAPPING #-} C [Int] where\r\nfoo _ = \"list2\"\r\n}}}\r\n\r\n{{{\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# LANGUAGE NoMonomorphismRestriction #-}\r\nmodule D where\r\n\r\nimport A\r\nimport B\r\nimport C\r\n\r\nmain2 = $$(me) [1 :: Int]\r\n}}}\r\n\r\n{{{\r\n>>> main2\r\n\"list2\"\r\n}}}\r\n\r\n\r\nIn `B`, `B.me` is created by quoting `foo`. `B.me :: Q (TExp ([Int] -> String))` so in order to type check this quote we need to solve the instance `C [Int]` which we should do by using the instance defined in `B` (and `A`). \r\n\r\nIn module `C` we define a different overlapping instance (note that this could be in a completely different library not under our control).\r\n\r\nWhen we then splice `B.me` into `D`, the instance from `C` is used and can be witnessed by printing `main2` which shows `\"list2\"` rather than `\"list\"` as expected.\r\n\r\nThis is a symptom of the fact that the renamed rather than the typechecked AST is serialised I think.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15862Panic with promoted types that Typeable doesn't support2020-02-25T01:15:47ZRyan ScottPanic with promoted types that Typeable doesn't supportThe following program panics on GHC 8.2 and later:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
module Bug where
import Type.Reflection
newtype Foo ...The following program panics on GHC 8.2 and later:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
module Bug where
import Type.Reflection
newtype Foo = MkFoo (forall a. a)
foo :: TypeRep MkFoo
foo = typeRep @MkFoo
```
```
$ /opt/ghc/8.6.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
GHC error in desugarer lookup in Bug:
attempting to use module ‘main:Bug’ (Bug.hs) which is not loaded
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-unknown-linux):
initDs
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"Typeable panic with promoted rank-2 kind (initDs)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["Typeable"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program panics on GHC 8.2 and later:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE ImpredicativeTypes #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE TypeApplications #-}\r\nmodule Bug where\r\n\r\nimport Type.Reflection\r\n\r\nnewtype Foo = MkFoo (forall a. a)\r\n\r\nfoo :: TypeRep MkFoo\r\nfoo = typeRep @MkFoo\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nGHC error in desugarer lookup in Bug:\r\n attempting to use module ‘main:Bug’ (Bug.hs) which is not loaded\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-unknown-linux):\r\n initDs\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Ryan ScottRyan Scotthttps://gitlab.haskell.org/ghc/ghc/-/issues/15861Cannot import (*) type operator2019-07-07T18:02:40ZPreetham GujjulaCannot import (*) type operatorThe (\*) type operator cannot be imported from GHC.TypeLits. The following code compiles in GHC 8.4.4 but fails in GHC 8.6.1 with "error: parse error on input ‘\*’"
```hs
{-# LANGUAGE TypeOperators #-}
import GHC.TypeLits (type (*))
```...The (\*) type operator cannot be imported from GHC.TypeLits. The following code compiles in GHC 8.4.4 but fails in GHC 8.6.1 with "error: parse error on input ‘\*’"
```hs
{-# LANGUAGE TypeOperators #-}
import GHC.TypeLits (type (*))
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"Cannot import (*) type operator","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The (*) type operator cannot be imported from GHC.TypeLits. The following code compiles in GHC 8.4.4 but fails in GHC 8.6.1 with \"error: parse error on input ‘*’\"\r\n\r\n{{{#!hs\r\n{-# LANGUAGE TypeOperators #-}\r\nimport GHC.TypeLits (type (*))\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15860Hadrian build fails on FreeBSD2020-03-13T15:12:50ZraichooHadrian build fails on FreeBSDHi,
I've tried a `hadrian/build.sh -j` on my FreeBSD machine and got greeted by a rather nasty looking error.
```
Up to date
shakeArgsWith 0.000s 0%
Function shake 0.275s 80% =========================
Database read 0.000s ...Hi,
I've tried a `hadrian/build.sh -j` on my FreeBSD machine and got greeted by a rather nasty looking error.
```
Up to date
shakeArgsWith 0.000s 0%
Function shake 0.275s 80% =========================
Database read 0.000s 0%
With database 0.000s 0%
Running rules 0.065s 19% =====
Total 0.340s 100%
Error when running Shake build system:
* OracleQ (KeyValue ("hadrian/cfg/system.config","host-os"))
* hadrian/cfg/system.config
* hadrian/cfg/system.config settings mk/config.h compiler/ghc.cabal rts/rts.cabal
Configuration file hadrian/cfg/system.config is missing.
Run the configure script manually or let Hadrian run it automatically by passing the flag --configure.
CallStack (from HasCallStack):
error, called at src/Rules/Configure.hs:25:13 in main:Rules.Configure
```
I've tried this with commit `1a3b9bd0b674ad16a41b942c738b8f34564bcd8d` and my current system is `FreeBSD lain 12.0-BETA3 FreeBSD 12.0-BETA3 r340097 GENERIC amd64`.
Building GHC with the old build system worked perfectly fine though.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------------- |
| Version | 8.7 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Build System (Hadrian) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Hadrian build fails on FreeBSD","status":"New","operating_system":"","component":"Build System (Hadrian)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Hi,\r\n\r\nI've tried a `hadrian/build.sh -j` on my FreeBSD machine and got greeted by a rather nasty looking error.\r\n\r\n{{{\r\nUp to date\r\nshakeArgsWith 0.000s 0%\r\nFunction shake 0.275s 80% =========================\r\nDatabase read 0.000s 0%\r\nWith database 0.000s 0%\r\nRunning rules 0.065s 19% =====\r\nTotal 0.340s 100%\r\nError when running Shake build system:\r\n* OracleQ (KeyValue (\"hadrian/cfg/system.config\",\"host-os\"))\r\n* hadrian/cfg/system.config\r\n* hadrian/cfg/system.config settings mk/config.h compiler/ghc.cabal rts/rts.cabal\r\nConfiguration file hadrian/cfg/system.config is missing.\r\nRun the configure script manually or let Hadrian run it automatically by passing the flag --configure.\r\nCallStack (from HasCallStack):\r\n error, called at src/Rules/Configure.hs:25:13 in main:Rules.Configure\r\n}}}\r\n\r\nI've tried this with commit `1a3b9bd0b674ad16a41b942c738b8f34564bcd8d` and my current system is `FreeBSD lain 12.0-BETA3 FreeBSD 12.0-BETA3 r340097 GENERIC amd64`.\r\n\r\nBuilding GHC with the old build system worked perfectly fine though.","type_of_failure":"OtherFailure","blocking":[]} -->Make removalhttps://gitlab.haskell.org/ghc/ghc/-/issues/15859Dependent quantification, GHC panic2019-07-07T18:02:41ZIcelandjackDependent quantification, GHC panicWhile exploring [Ryan's gist for term-level](https://gist.github.com/RyanGlScott/ded669b5ae3db1ce38c4b6021f144776) `f :: forall a -> a -> Type`.
```hs
{-# Language PolyKinds #-}
{-# Language TypeApplications #-}
{-# Language ...While exploring [Ryan's gist for term-level](https://gist.github.com/RyanGlScott/ded669b5ae3db1ce38c4b6021f144776) `f :: forall a -> a -> Type`.
```hs
{-# Language PolyKinds #-}
{-# Language TypeApplications #-}
{-# Language ImpredicativeTypes #-}
import Data.Kind
data A k :: k -> Type
f :: KindOf A
f a = undefined
type KindOf (a :: k) = k
a = f @Int
```
gives
```
$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci 630_bug.hs
GHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 630_bug.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181029 for x86_64-unknown-linux):
ASSERT failed!
KindOf A
forall k -> k -> *
k_a1xQ[sk:0]
k_a1xQ[sk:0] -> *
k_a1xQ[sk:0]
[req]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/utils/Outputable.hs:1219:5 in ghc:Outputable
assertPprPanic, called at compiler/typecheck/TcExpr.hs:1336:94 in ghc:TcExpr
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"Dependent quantification, GHC panic","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"While exploring [https://gist.github.com/RyanGlScott/ded669b5ae3db1ce38c4b6021f144776 Ryan's gist for term-level] `f :: forall a -> a -> Type`.\r\n\r\n{{{#!hs\r\n{-# Language PolyKinds #-}\r\n{-# Language TypeApplications #-}\r\n{-# Language ImpredicativeTypes #-}\r\n\r\nimport Data.Kind\r\n\r\ndata A k :: k -> Type\r\n\r\nf :: KindOf A\r\nf a = undefined\r\n\r\ntype KindOf (a :: k) = k\r\n\r\na = f @Int\r\n}}}\r\n\r\ngives \r\n\r\n{{{\r\n$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci 630_bug.hs\r\nGHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 630_bug.hs, interpreted )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181029 for x86_64-unknown-linux):\r\n ASSERT failed!\r\n KindOf A\r\n forall k -> k -> *\r\n k_a1xQ[sk:0]\r\n k_a1xQ[sk:0] -> *\r\n k_a1xQ[sk:0]\r\n [req]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler/utils/Outputable.hs:1219:5 in ghc:Outputable\r\n assertPprPanic, called at compiler/typecheck/TcExpr.hs:1336:94 in ghc:TcExpr\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n>\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15858Enabling a pure Plugin with existing build output never triggers recompilation2019-07-07T18:02:41ZDanielGEnabling a pure Plugin with existing build output never triggers recompilationConsider the following compilation session:
```
$ ghc -fplugin ImpurePlugin Foo.hs
<Compiles Foo.hs>
$ ghc Foo.hs
```
where ImpurePlugin is a `Plugin` which returns `ForceRecompile` in `pluginRecompile`.
The second invocation of GHC d...Consider the following compilation session:
```
$ ghc -fplugin ImpurePlugin Foo.hs
<Compiles Foo.hs>
$ ghc Foo.hs
```
where ImpurePlugin is a `Plugin` which returns `ForceRecompile` in `pluginRecompile`.
The second invocation of GHC doesn't recompile even though `ImpurePlugin` could have changed the generated build output which would now be out of date.
The same thing happens when switching from an impure/fingerprinted plugin to a pure plugin.
The problem is that `pluginRecompileToRecompileRequired` just assumes no compilation is required when the current plugin stack is pure, that is either only pure plugins or no plugins at all are registered:
```
pluginRecompileToRecompileRequired :: Fingerprint -> PluginRecompile -> RecompileRequired
pluginRecompileToRecompileRequired old_fp pr =
case pr of
NoForceRecompile -> UpToDate
ForceRecompile -> RecompBecause "Plugin forced recompilation"
MaybeRecompile fp -> if fp == old_fp then UpToDate
```
note the `UpToDate` in the `NoForceRecompile` case.
Furthermore I would argue that even switching from having no plugin at all active to having a pure plugin active should trigger recompilation, even though the plugin might be pure it could still choose to affect the build output after all.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.7 |
| 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":"Enabling a pure Plugin with existing build output never triggers recompilation","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider the following compilation session:\r\n\r\n\r\n{{{\r\n$ ghc -fplugin ImpurePlugin Foo.hs\r\n<Compiles Foo.hs>\r\n$ ghc Foo.hs\r\n}}}\r\n\r\nwhere ImpurePlugin is a `Plugin` which returns `ForceRecompile` in `pluginRecompile`.\r\n\r\nThe second invocation of GHC doesn't recompile even though `ImpurePlugin` could have changed the generated build output which would now be out of date.\r\n\r\nThe same thing happens when switching from an impure/fingerprinted plugin to a pure plugin.\r\n\r\nThe problem is that `pluginRecompileToRecompileRequired` just assumes no compilation is required when the current plugin stack is pure, that is either only pure plugins or no plugins at all are registered:\r\n\r\n{{{\r\npluginRecompileToRecompileRequired :: Fingerprint -> PluginRecompile -> RecompileRequired\r\npluginRecompileToRecompileRequired old_fp pr =\r\n case pr of\r\n NoForceRecompile -> UpToDate\r\n ForceRecompile -> RecompBecause \"Plugin forced recompilation\"\r\n MaybeRecompile fp -> if fp == old_fp then UpToDate\r\n\r\n}}}\r\n\r\nnote the `UpToDate` in the `NoForceRecompile` case.\r\n\r\n\r\nFurthermore I would argue that even switching from having no plugin at all active to having a pure plugin active should trigger recompilation, even though the plugin might be pure it could still choose to affect the build output after all.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15857Need for better warnings arising from StarIsType extension2019-07-07T18:02:41Zjrp2014Need for better warnings arising from StarIsType extensionIf I redefine `type (*) = (,)` I am given not given a warning that it doesn't do what I expect, when building with cabal new-repl or cabal new-build, because the `StarIsType` extension is now enabled by default. Instead of a warning, I g...If I redefine `type (*) = (,)` I am given not given a warning that it doesn't do what I expect, when building with cabal new-repl or cabal new-build, because the `StarIsType` extension is now enabled by default. Instead of a warning, I get (correct but confusing) error messages.https://gitlab.haskell.org/ghc/ghc/-/issues/15856GhostScript not available for hp2ps tests2019-07-07T18:02:42Zjrp2014GhostScript not available for hp2ps testsWhen I run `validate --slow` a number of tests fail, apparently erroneously, because `GhostScript not available for hp2ps tests`.
I don't know why this is the case (Ghostscript is installed on my ubuntu; perhaps there are some developer...When I run `validate --slow` a number of tests fail, apparently erroneously, because `GhostScript not available for hp2ps tests`.
I don't know why this is the case (Ghostscript is installed on my ubuntu; perhaps there are some developer libraries / headers that also need to be installed, but I don't recall seeing anything in the documentation about that).
The message "GhostScript not available for hp2ps tests" seems to come from a Python script that Simon Marlow produced in 2002. Unfortunately, there are two places where the message could have been generated.
There are probably 2 ways forward:
- a temporary bodge: taking the running of those tests that depend on hp2ps out of validation, in the same way that certain tests are not run when a dependent library is unavailable
- figuring out why the python script fails to understand that a ghostscript is actually present and fixing that
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Test Suite |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | Simonmar |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GhostScript not available for hp2ps tests","status":"New","operating_system":"","component":"Test Suite","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["ghostscript","gs","hp2ps","testsuite"],"differentials":[],"test_case":"","architecture":"","cc":["Simonmar"],"type":"Bug","description":"When I run `validate --slow` a number of tests fail, apparently erroneously, because `GhostScript not available for hp2ps tests`.\r\n\r\nI don't know why this is the case (Ghostscript is installed on my ubuntu; perhaps there are some developer libraries / headers that also need to be installed, but I don't recall seeing anything in the documentation about that).\r\n\r\nThe message \"GhostScript not available for hp2ps tests\" seems to come from a Python script that Simon Marlow produced in 2002. Unfortunately, there are two places where the message could have been generated.\r\n\r\nThere are probably 2 ways forward:\r\n\r\n - a temporary bodge: taking the running of those tests that depend on hp2ps out of validation, in the same way that certain tests are not run when a dependent library is unavailable\r\n\r\n- figuring out why the python script fails to understand that a ghostscript is actually present and fixing that","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Krzysztof GogolewskiKrzysztof Gogolewskihttps://gitlab.haskell.org/ghc/ghc/-/issues/15855Warn about incomplete NamedFieldPuns patterns2019-07-07T18:02:42ZArtyom.KazakWarn about incomplete NamedFieldPuns patternsIn certain situations it's nice to be able to ensure that record pattern matches are exhaustive:
```haskell
data R = R {a, b :: Int}
-- should warn
f R{a} = a
-- should not warn
g R{a, b} = a + b
-- should not warn
h R{a, ..} = a + b...In certain situations it's nice to be able to ensure that record pattern matches are exhaustive:
```haskell
data R = R {a, b :: Int}
-- should warn
f R{a} = a
-- should not warn
g R{a, b} = a + b
-- should not warn
h R{a, ..} = a + b
-- should not warn
i R{a, b = _} = a
```
It's useful when there are several functions that inspect a record (e.g. handlers that update a subset of fields in a database) and we want to make certain that when a new field is added to the record, the programmer won't forget to update functions working with that record (either by handling the field or explicitly discarding it). Currently the only non-hacky way to do it is writing `f (R a _) = ...`, which is obviously not ideal.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.6.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Warn about incomplete NamedFieldPuns patterns","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"In certain situations it's nice to be able to ensure that record pattern matches are exhaustive:\r\n\r\n{{{#!haskell\r\ndata R = R {a, b :: Int}\r\n\r\n-- should warn\r\nf R{a} = a\r\n\r\n-- should not warn\r\ng R{a, b} = a + b\r\n\r\n-- should not warn\r\nh R{a, ..} = a + b\r\n\r\n-- should not warn\r\ni R{a, b = _} = a\r\n}}}\r\n\r\nIt's useful when there are several functions that inspect a record (e.g. handlers that update a subset of fields in a database) and we want to make certain that when a new field is added to the record, the programmer won't forget to update functions working with that record (either by handling the field or explicitly discarding it). Currently the only non-hacky way to do it is writing `f (R a _) = ...`, which is obviously not ideal.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15854PPC: Panic in native code generator2019-07-07T18:02:42ZPeter Trommlerptrommler@acm.orgPPC: Panic in native code generatorHead fails on powerpc64le:
```
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 8.7.20181103 for powerpc64le-unknown-linux):
PPC.CodeGen.getRegister: no match
Please report this as a GHC bug: http://www.haskell.or...Head fails on powerpc64le:
```
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 8.7.20181103 for powerpc64le-unknown-linux):
PPC.CodeGen.getRegister: no match
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
libraries/ghc-prim/ghc.mk:4: recipe for target 'libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.o' failed
```
I think I know what is going on and will work on a fix.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.7 |
| 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":"PPC: Panic in native code generator","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Head fails on powerpc64le:\r\n{{{\r\nghc-stage1: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181103 for powerpc64le-unknown-linux):\r\n PPC.CodeGen.getRegister: no match\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\nlibraries/ghc-prim/ghc.mk:4: recipe for target 'libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.o' failed\r\n}}}\r\n\r\nI think I know what is going on and will work on a fix.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Peter Trommlerptrommler@acm.orgPeter Trommlerptrommler@acm.orghttps://gitlab.haskell.org/ghc/ghc/-/issues/15853Unregisterised GHC panics when building test cgrun0182019-07-07T18:02:43ZIlias TsitsimpisUnregisterised GHC panics when building test cgrun018An unregisterised ghc-8.4 on amd64 panics when building test cgrun018.
```
Compile failed (exit code 1) errors were:
[1 of 1] Compiling Main ( cgrun018.hs, cgrun018.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC v...An unregisterised ghc-8.4 on amd64 panics when building test cgrun018.
```
Compile failed (exit code 1) errors were:
[1 of 1] Compiling Main ( cgrun018.hs, cgrun018.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.4.4 for x86_64-unknown-linux):
pprStatics: float
F32
F32
F32
F32
F32
F32
F32
F32
F32
F32
F32
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/cmm/PprC.hs:525:5 in ghc:PprC
```
We have seen this error while building packages for Debian on 64-bit architectures where GHC is unregisterised (e.g., mips64el, s390x):
[gloss on mips64el](https://buildd.debian.org/status/fetch.php?pkg=haskell-gloss&arch=mips64el&ver=1.13.0.1-1&stamp=1540810998&raw=0),
[juicypixels on s390x](https://buildd.debian.org/status/fetch.php?pkg=haskell-juicypixels&arch=s390x&ver=3.2.9.5-3&stamp=1540808360&raw=0)
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler (CodeGen) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Unregisterised GHC panics when building test cgrun018","status":"New","operating_system":"","component":"Compiler (CodeGen)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"An unregisterised ghc-8.4 on amd64 panics when building test cgrun018.\r\n\r\n{{{\r\nCompile failed (exit code 1) errors were:\r\n[1 of 1] Compiling Main ( cgrun018.hs, cgrun018.o )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.4.4 for x86_64-unknown-linux):\r\n pprStatics: float\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable\r\n pprPanic, called at compiler/cmm/PprC.hs:525:5 in ghc:PprC\r\n}}}\r\n\r\nWe have seen this error while building packages for Debian on 64-bit architectures where GHC is unregisterised (e.g., mips64el, s390x):\r\n[https://buildd.debian.org/status/fetch.php?pkg=haskell-gloss&arch=mips64el&ver=1.13.0.1-1&stamp=1540810998&raw=0 gloss on mips64el],\r\n[https://buildd.debian.org/status/fetch.php?pkg=haskell-juicypixels&arch=s390x&ver=3.2.9.5-3&stamp=1540808360&raw=0 juicypixels on s390x]","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1