GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:03:40Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/15629"No skolem info" panic (GHC 8.6 only)2019-07-07T18:03:40ZRyan Scott"No skolem info" panic (GHC 8.6 only)The following program:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug wher...The following program:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug where
import Data.Kind
import Data.Proxy
import GHC.Generics
data TyFun :: Type -> Type -> Type
type a ~> b = TyFun a b -> Type
infixr 0 ~>
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
data family Sing :: forall k. k -> Type
newtype instance Sing (f :: k1 ~> k2) =
SLambda { applySing :: forall t. Sing t -> Sing (Apply f t) }
singFun1 :: forall f. (forall t. Sing t -> Sing (Apply f t)) -> Sing f
singFun1 f = SLambda f
data From1Sym0 :: forall k (f :: k -> Type) (a :: k). f a ~> Rep1 f a
data To1Sym0 :: forall k (f :: k -> Type) (a :: k). Rep1 f a ~> f a
type family ((f :: b ~> c) :. (g :: a ~> b)) (x :: a) :: c where
(f :. g) x = Apply f (Apply g x)
data (.@#@$$$) :: forall b c a. (b ~> c) -> (a ~> b) -> (a ~> c)
type instance Apply (f .@#@$$$ g) x = (f :. g) x
(%.) :: forall a b c (f :: b ~> c) (g :: a ~> b) (x :: a).
Sing f -> Sing g -> Sing x -> Sing ((f :. g) x)
(sf %. sg) sx = applySing sf (applySing sg sx)
(%.$$$) :: forall a b c (f :: b ~> c) (g :: a ~> b) (x :: a).
Sing f -> Sing g -> Sing (f .@#@$$$ g)
sf %.$$$ sg = singFun1 (sf %. sg)
f :: forall (m :: Type -> Type) x. Proxy (m x) -> ()
f _ = ()
where
sFrom1Fun :: forall ab. Sing (From1Sym0 :: m ab ~> Rep1 m ab)
sFrom1Fun = undefined
sTo1Fun :: forall ab. Sing (To1Sym0 :: Rep1 m ab ~> m ab)
sTo1Fun = undefined
sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)
sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun
```
Panics on GHC 8.6:
```
$ /opt/ghc/8.6.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:50:39: error:
• Expected kind ‘m z ~> Rep1 m ab1’,
but ‘(From1Sym0 :: m z ~> Rep1 m z)’ has kind ‘m z ~> Rep1 m z’
• In the first argument of ‘(.@#@$$$)’, namely
‘(From1Sym0 :: m z ~> Rep1 m z)’
In the first argument of ‘Sing’, namely
‘(((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab
~> Rep1 m ab)’
In the type signature:
sFrom1To1Fun :: forall ab.
Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab
~> Rep1 m ab)
|
50 | sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug.hs:51:20: error:ghc: panic! (the 'impossible' happened)
(GHC version 8.6.0.20180823 for x86_64-unknown-linux):
No skolem info:
[ab_a1UW[sk:1]]
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
```
But merely errors on GHC 8.4.3:
```
$ /opt/ghc/8.4.3/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:50:39: error:
• Expected kind ‘m z ~> Rep1 m ab2’,
but ‘(From1Sym0 :: m z ~> Rep1 m z)’ has kind ‘m z ~> Rep1 m z’
• In the first argument of ‘(.@#@$$$)’, namely
‘(From1Sym0 :: m z ~> Rep1 m z)’
In the first argument of ‘Sing’, namely
‘(((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab
~> Rep1 m ab)’
In the type signature:
sFrom1To1Fun :: forall ab.
Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab
~> Rep1 m ab)
|
50 | sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug.hs:51:20: error:
• Couldn't match type ‘ab1’ with ‘z1’
because type variable ‘z1’ would escape its scope
This (rigid, skolem) type variable is bound by
the type signature for:
sFrom1To1Fun :: forall z1 ab3. Sing (From1Sym0 .@#@$$$ To1Sym0)
at Bug.hs:50:5-112
Expected type: Sing From1Sym0
Actual type: Sing From1Sym0
• In the first argument of ‘(%.$$$)’, namely ‘sFrom1Fun’
In the expression: sFrom1Fun %.$$$ sTo1Fun
In an equation for ‘sFrom1To1Fun’:
sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun
• Relevant bindings include
sFrom1To1Fun :: Sing (From1Sym0 .@#@$$$ To1Sym0)
(bound at Bug.hs:51:5)
|
51 | sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun
| ^^^^^^^^^
Bug.hs:51:36: error:
• Couldn't match type ‘ab’ with ‘z1’
because type variable ‘z1’ would escape its scope
This (rigid, skolem) type variable is bound by
the type signature for:
sFrom1To1Fun :: forall z1 ab3. Sing (From1Sym0 .@#@$$$ To1Sym0)
at Bug.hs:50:5-112
Expected type: Sing To1Sym0
Actual type: Sing To1Sym0
• In the second argument of ‘(%.$$$)’, namely ‘sTo1Fun’
In the expression: sFrom1Fun %.$$$ sTo1Fun
In an equation for ‘sFrom1To1Fun’:
sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun
• Relevant bindings include
sFrom1To1Fun :: Sing (From1Sym0 .@#@$$$ To1Sym0)
(bound at Bug.hs:51:5)
|
51 | sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun
| ^^^^^^^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.6.1-beta1 |
| 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 (GHC 8.6 only)","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1-beta1","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n{-# LANGUAGE UndecidableInstances #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Data.Proxy\r\nimport GHC.Generics\r\n\r\ndata TyFun :: Type -> Type -> Type\r\ntype a ~> b = TyFun a b -> Type\r\ninfixr 0 ~>\r\ntype family Apply (f :: k1 ~> k2) (x :: k1) :: k2\r\n\r\ndata family Sing :: forall k. k -> Type\r\nnewtype instance Sing (f :: k1 ~> k2) =\r\n SLambda { applySing :: forall t. Sing t -> Sing (Apply f t) }\r\nsingFun1 :: forall f. (forall t. Sing t -> Sing (Apply f t)) -> Sing f\r\nsingFun1 f = SLambda f\r\n\r\ndata From1Sym0 :: forall k (f :: k -> Type) (a :: k). f a ~> Rep1 f a\r\ndata To1Sym0 :: forall k (f :: k -> Type) (a :: k). Rep1 f a ~> f a\r\n\r\ntype family ((f :: b ~> c) :. (g :: a ~> b)) (x :: a) :: c where\r\n (f :. g) x = Apply f (Apply g x)\r\n\r\ndata (.@#@$$$) :: forall b c a. (b ~> c) -> (a ~> b) -> (a ~> c)\r\ntype instance Apply (f .@#@$$$ g) x = (f :. g) x\r\n\r\n(%.) :: forall a b c (f :: b ~> c) (g :: a ~> b) (x :: a).\r\n Sing f -> Sing g -> Sing x -> Sing ((f :. g) x)\r\n(sf %. sg) sx = applySing sf (applySing sg sx)\r\n\r\n(%.$$$) :: forall a b c (f :: b ~> c) (g :: a ~> b) (x :: a).\r\n Sing f -> Sing g -> Sing (f .@#@$$$ g)\r\nsf %.$$$ sg = singFun1 (sf %. sg)\r\n\r\nf :: forall (m :: Type -> Type) x. Proxy (m x) -> ()\r\nf _ = ()\r\n where\r\n sFrom1Fun :: forall ab. Sing (From1Sym0 :: m ab ~> Rep1 m ab)\r\n sFrom1Fun = undefined\r\n\r\n sTo1Fun :: forall ab. Sing (To1Sym0 :: Rep1 m ab ~> m ab)\r\n sTo1Fun = undefined\r\n\r\n sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)\r\n sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun\r\n}}}\r\n\r\nPanics on GHC 8.6:\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\n\r\nBug.hs:50:39: error:\r\n • Expected kind ‘m z ~> Rep1 m ab1’,\r\n but ‘(From1Sym0 :: m z ~> Rep1 m z)’ has kind ‘m z ~> Rep1 m z’\r\n • In the first argument of ‘(.@#@$$$)’, namely\r\n ‘(From1Sym0 :: m z ~> Rep1 m z)’\r\n In the first argument of ‘Sing’, namely\r\n ‘(((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab\r\n ~> Rep1 m ab)’\r\n In the type signature:\r\n sFrom1To1Fun :: forall ab.\r\n Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab\r\n ~> Rep1 m ab)\r\n |\r\n50 | sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\nBug.hs:51:20: error:ghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.0.20180823 for x86_64-unknown-linux):\r\n No skolem info:\r\n [ab_a1UW[sk:1]]\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\nBut merely errors on GHC 8.4.3:\r\n\r\n{{{\r\n$ /opt/ghc/8.4.3/bin/ghc Bug.hs \r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:50:39: error:\r\n • Expected kind ‘m z ~> Rep1 m ab2’,\r\n but ‘(From1Sym0 :: m z ~> Rep1 m z)’ has kind ‘m z ~> Rep1 m z’\r\n • In the first argument of ‘(.@#@$$$)’, namely\r\n ‘(From1Sym0 :: m z ~> Rep1 m z)’\r\n In the first argument of ‘Sing’, namely\r\n ‘(((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab\r\n ~> Rep1 m ab)’\r\n In the type signature:\r\n sFrom1To1Fun :: forall ab.\r\n Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab\r\n ~> Rep1 m ab)\r\n |\r\n50 | sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\nBug.hs:51:20: error:\r\n • Couldn't match type ‘ab1’ with ‘z1’\r\n because type variable ‘z1’ would escape its scope\r\n This (rigid, skolem) type variable is bound by\r\n the type signature for:\r\n sFrom1To1Fun :: forall z1 ab3. Sing (From1Sym0 .@#@$$$ To1Sym0)\r\n at Bug.hs:50:5-112\r\n Expected type: Sing From1Sym0\r\n Actual type: Sing From1Sym0\r\n • In the first argument of ‘(%.$$$)’, namely ‘sFrom1Fun’\r\n In the expression: sFrom1Fun %.$$$ sTo1Fun\r\n In an equation for ‘sFrom1To1Fun’:\r\n sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun\r\n • Relevant bindings include\r\n sFrom1To1Fun :: Sing (From1Sym0 .@#@$$$ To1Sym0)\r\n (bound at Bug.hs:51:5)\r\n |\r\n51 | sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun\r\n | ^^^^^^^^^\r\n\r\nBug.hs:51:36: error:\r\n • Couldn't match type ‘ab’ with ‘z1’\r\n because type variable ‘z1’ would escape its scope\r\n This (rigid, skolem) type variable is bound by\r\n the type signature for:\r\n sFrom1To1Fun :: forall z1 ab3. Sing (From1Sym0 .@#@$$$ To1Sym0)\r\n at Bug.hs:50:5-112\r\n Expected type: Sing To1Sym0\r\n Actual type: Sing To1Sym0\r\n • In the second argument of ‘(%.$$$)’, namely ‘sTo1Fun’\r\n In the expression: sFrom1Fun %.$$$ sTo1Fun\r\n In an equation for ‘sFrom1To1Fun’:\r\n sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun\r\n • Relevant bindings include\r\n sFrom1To1Fun :: Sing (From1Sym0 .@#@$$$ To1Sym0)\r\n (bound at Bug.hs:51:5)\r\n |\r\n51 | sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun\r\n | ^^^^^^^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15628Higher-rank kinds2019-07-07T18:03:41ZIcelandjackHigher-rank kindsTaken from [Data.Eq.Type.Hetero](https://github.com/ekmett/eq/blob/master/src/Data/Eq/Type/Hetero.hs#L73).
`(:==)` (called `HEq` to avoid unnecessary extensions) fails if you add a `Proxy x ->` argument.
```hs
{-# Language RankNTypes, ...Taken from [Data.Eq.Type.Hetero](https://github.com/ekmett/eq/blob/master/src/Data/Eq/Type/Hetero.hs#L73).
`(:==)` (called `HEq` to avoid unnecessary extensions) fails if you add a `Proxy x ->` argument.
```hs
{-# Language RankNTypes, KindSignatures, PolyKinds, GADTs, DataKinds #-}
import Data.Kind
import Data.Proxy
newtype HEq :: forall j. j -> forall k. k -> Type where
HEq
:: (forall (x::forall xx. xx -> Type). Proxy x -> x a -> x b)
-> HEq a b
```
```
$ ~/code/latestghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci 398.hs
GHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 398.hs, interpreted )
398.hs:7:2: error:
• A newtype constructor cannot have existential type variables
HEq :: forall j k xx (a :: j) (b :: k).
(forall (x :: forall xx1. xx1 -> *). Proxy x -> x a -> x b)
-> HEq a b
• In the definition of data constructor ‘HEq’
In the newtype declaration for ‘HEq’
|
7 | HEq
| ^^^...
Failed, no modules loaded.
Prelude>
```
It compiles fine without `Proxy x ->`. Now my question is what existential type variable does `HEq` have, `-fprint-explicit-kinds` shows that `Proxy` is actually being instantiated at `(xx -> Type)` and not `(forall xx. xx -> Type)`
```
398.hs:10:2: error:
• A newtype constructor cannot have existential type variables
HEq :: forall j k xx (a :: j) (b :: k).
(forall (x :: forall xx1. xx1 -> *).
Proxy (xx -> *) (x xx) -> x j a -> x k b)
-> HEq j a k b
• In the definition of data constructor ‘HEq’
In the newtype declaration for ‘HEq’
|
10 | HEq
| ^^^...
```
so I suppose my question is, can we instantiate `Proxy` at a higher-rank kind? (#12045: `Proxy @FOO`)
```
>> type FOO = (forall xx. xx -> Type)
>> :kind (Proxy :: FOO -> Type)
<interactive>:1:2: error:
• Expected kind ‘FOO -> *’, but ‘Proxy’ has kind ‘k0 -> *’
• In the type ‘(Proxy :: FOO -> Type)’
```
It is possible to create a bespoke `Proxy`
```hs
type FOO = (forall x. x -> Type)
data BespokeProxy :: FOO -> Type where
BespokeProxy :: forall (c :: FOO). BespokeProxy c
newtype HEq :: forall j. j -> forall k. k -> Type where
HEq
:: (forall (x::forall xx. xx -> Type). BespokeProxy x -> x a -> x b)
-> HEq a b
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1-beta1 |
| 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":"Higher-rank kinds","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1-beta1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Taken from [https://github.com/ekmett/eq/blob/master/src/Data/Eq/Type/Hetero.hs#L73 Data.Eq.Type.Hetero].\r\n\r\n`(:==)` (called `HEq` to avoid unnecessary extensions) fails if you add a `Proxy x ->` argument.\r\n\r\n{{{#!hs\r\n{-# Language RankNTypes, KindSignatures, PolyKinds, GADTs, DataKinds #-}\r\n\r\nimport Data.Kind\r\nimport Data.Proxy\r\n\r\nnewtype HEq :: forall j. j -> forall k. k -> Type where\r\n HEq\r\n :: (forall (x::forall xx. xx -> Type). Proxy x -> x a -> x b)\r\n -> HEq a b\r\n}}}\r\n{{{\r\n$ ~/code/latestghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci 398.hs\r\nGHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 398.hs, interpreted )\r\n\r\n398.hs:7:2: error:\r\n • A newtype constructor cannot have existential type variables\r\n HEq :: forall j k xx (a :: j) (b :: k).\r\n (forall (x :: forall xx1. xx1 -> *). Proxy x -> x a -> x b)\r\n -> HEq a b\r\n • In the definition of data constructor ‘HEq’\r\n In the newtype declaration for ‘HEq’\r\n |\r\n7 | HEq\r\n | ^^^...\r\nFailed, no modules loaded.\r\nPrelude> \r\n}}}\r\n\r\nIt compiles fine without `Proxy x ->`. Now my question is what existential type variable does `HEq` have, `-fprint-explicit-kinds` shows that `Proxy` is actually being instantiated at `(xx -> Type)` and not `(forall xx. xx -> Type)`\r\n\r\n{{{\r\n398.hs:10:2: error:\r\n • A newtype constructor cannot have existential type variables\r\n HEq :: forall j k xx (a :: j) (b :: k).\r\n (forall (x :: forall xx1. xx1 -> *).\r\n Proxy (xx -> *) (x xx) -> x j a -> x k b)\r\n -> HEq j a k b\r\n • In the definition of data constructor ‘HEq’\r\n In the newtype declaration for ‘HEq’\r\n |\r\n10 | HEq\r\n | ^^^...\r\n}}}\r\n\r\nso I suppose my question is, can we instantiate `Proxy` at a higher-rank kind? (#12045: `Proxy @FOO`)\r\n\r\n{{{\r\n>> type FOO = (forall xx. xx -> Type)\r\n>> :kind (Proxy :: FOO -> Type)\r\n\r\n<interactive>:1:2: error:\r\n • Expected kind ‘FOO -> *’, but ‘Proxy’ has kind ‘k0 -> *’\r\n • In the type ‘(Proxy :: FOO -> Type)’\r\n}}}\r\n\r\nIt is possible to create a bespoke `Proxy`\r\n\r\n{{{#!hs\r\ntype FOO = (forall x. x -> Type)\r\n\r\ndata BespokeProxy :: FOO -> Type where\r\n BespokeProxy :: forall (c :: FOO). BespokeProxy c\r\n\r\nnewtype HEq :: forall j. j -> forall k. k -> Type where\r\n HEq\r\n :: (forall (x::forall xx. xx -> Type). BespokeProxy x -> x a -> x b)\r\n -> HEq a b\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15627Absent unlifted bindings2020-11-30T19:40:57ZSebastian GrafAbsent unlifted bindingsTransferred from [ticket:9279\#comment:159974](https://gitlab.haskell.org//ghc/ghc/issues/9279#note_159974):
For a long time, the worker/wrapper splitter has given up on absent
arguments of certain unlifted types: see `Literal.absentLit...Transferred from [ticket:9279\#comment:159974](https://gitlab.haskell.org//ghc/ghc/issues/9279#note_159974):
For a long time, the worker/wrapper splitter has given up on absent
arguments of certain unlifted types: see `Literal.absentLiteralOf` and
`Note [Absent errors]` in `WwLib`. This is very annoying because it means
that we get left with functions that take a bunch of arguments they do not
use, as in this ticket (#9279).
For lifted types T we build an absent value as a thunk of form
```
aBSENT_ERROR_ID @T "Used absent value"
```
This does two things
A. It gives us something, of the right type, to use in place of the value
> we aren't passing any more.
B. It gives an extra sanity check: if that value is ever used (a compiler
> bug) we'll get a runtime error message.
For unlifted types we don't have thunks, so we can't do this. As you can
see in `absentLiteralOf`, for some types we just make up a silly value:
e.g. for `Char#` we use `'x#'`; for `Int#` we use `0#`.
Note, however that
- Substituting a particular value serves purpose (A) but not purpose
(B). A compiler bug would go undetected. This is sad: e.g. #11126
is a real bug that was detected by (B). But I see no way out.
- It doesn't work for `Array#`, `MutVar#`, `TVar#` etc because we have
no available literal values of those types.
So Sebastian is suggesting that we add a new literal value -- call it
a **rubbish value** -- which can work for any (unlifted type),
extending `Literal` something like this
```
data Literal = ...
| RubbishLit Type
```
We need to store the type so we can still do `literalType`.
Now
- Maybe we could get rid of `MachNullAddr` in favour of this new literal.
- I think -- but I am not sure -- that this literal should never occur
in code generation. For example, we should never pass a rubbish value
to a function. Before then dead-code elimination should have got rid
of it I'm not 100% certain, but if this was true, it'd be a great
sanity check.
- Yes, `Literal` has `Eq` and `Ord` -- but I'm not sure why. Try removing
them and seeing what happens! (Generally I think it'd be better to
define `eqLit` and `cmpLit` and cal them, rather than use `==` and `>`;
so much easier to grep for!
And in fact, we do have `eqType` and `cmpType`.
- Do we need to spit out a `RubbishLit` in the `Binary` instance.
This seems more likely, because perhaps these rubbish values can occur
in unfoldings, which are serialised as their parse tree. But
the we can just serialise the `Type`. It won't happen much.⊥https://gitlab.haskell.org/ghc/ghc/-/issues/15625GHC panic, with QuantifiedConstraints2019-07-07T18:03:41ZIcelandjackGHC panic, with QuantifiedConstraintsI got a GHC Panic (I made some minor changes to GHC so it may have been added by me) but I think it's caused by the equality constraint
```
$ ~/code/latestghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci ~/hs/390.hs
GHCi, versi...I got a GHC Panic (I made some minor changes to GHC so it may have been added by me) but I think it's caused by the equality constraint
```
$ ~/code/latestghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci ~/hs/390.hs
GHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /home/baldur/hs/390.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20180828 for x86_64-unknown-linux):
ASSERT failed!
co_a2DG
df_a2DS @ Any
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/coreSyn/CoreSubst.hs:189:49 in ghc:CoreSubst
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
```
given this code
```hs
{-# Language RankNTypes, TypeInType, DataKinds, PolyKinds, TypeOperators, GADTs, FlexibleInstances, MultiParamTypeClasses, ConstraintKinds, CPP, UndecidableSuperClasses, QuantifiedConstraints, FlexibleContexts #-}
import Data.Kind
type Cat ob = ob -> ob -> Type
data KLEISLI (m :: Type -> Type) :: Cat (KL_kind m) where
MkKLEISLI :: (a -> m b) -> KLEISLI(m) (KL a) (KL b)
data KL_kind (m :: Type -> Type) = KL Type
class (a ~ KL xx) => AsKL a xx
instance (a ~ KL xx) => AsKL a xx
ekki__ :: Monad m => (forall xx. AsKL a xx) => KLEISLI m a a
ekki__ = MkKLEISLI undefined
```https://gitlab.haskell.org/ghc/ghc/-/issues/15624defer-type-errors and equality constraints2019-07-07T18:03:42ZKrzysztof Gogolewskidefer-type-errors and equality constraintsConsider
```
{-# OPTIONS_GHC -fdefer-type-errors #-}
x = const True ('a' + 'a')
y = const True (not 'a')
```
Currently `x` is True, but `y` is undefined. I think it would make sense for both to be True.
<details><summary>Trac metadata...Consider
```
{-# OPTIONS_GHC -fdefer-type-errors #-}
x = const True ('a' + 'a')
y = const True (not 'a')
```
Currently `x` is True, but `y` is undefined. I think it would make sense for both to be True.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"defer-type-errors and equality constraints","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider\r\n\r\n{{{\r\n{-# OPTIONS_GHC -fdefer-type-errors #-}\r\nx = const True ('a' + 'a')\r\ny = const True (not 'a')\r\n}}}\r\n\r\nCurrently `x` is True, but `y` is undefined. I think it would make sense for both to be True.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15623Wrong Endian, ghc-pwd and ghc-cabal on ghc 8.0.1 for powerpc64le (IBM Power)2019-07-07T18:03:42ZfrancescantoncastroWrong Endian, ghc-pwd and ghc-cabal on ghc 8.0.1 for powerpc64le (IBM Power)I tried to compile ghc-8.0.1 from source using the powerpc64/unknown linux .tar.xz file (since the other file was for AIX).
The ghc-pwd and ghc-cabal files won't execute even after stripping them with strip.
The libraries included are ...I tried to compile ghc-8.0.1 from source using the powerpc64/unknown linux .tar.xz file (since the other file was for AIX).
The ghc-pwd and ghc-cabal files won't execute even after stripping them with strip.
The libraries included are Big Endian instead of Little Endian.
I replaced the libffi library by the local one on my system (IBM Power8 with redhatenterpriseserver).
ghc complains there is no cabal file after naming a symlink to cabal (on /bin) ghc-cabal (instead of the faulty ghc-cabal file).
See attached file.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | highest |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Wrong Endian, ghc-pwd and ghc-cabal on ghc 8.0.1 for powerpc64le (IBM Power)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I tried to compile ghc-8.0.1 from source using the powerpc64/unknown linux .tar.xz file (since the other file was for AIX).\r\n\r\nThe ghc-pwd and ghc-cabal files won't execute even after stripping them with strip.\r\n\r\nThe libraries included are Big Endian instead of Little Endian.\r\n\r\nI replaced the libffi library by the local one on my system (IBM Power8 with redhatenterpriseserver).\r\n\r\nghc complains there is no cabal file after naming a symlink to cabal (on /bin) ghc-cabal (instead of the faulty ghc-cabal file). \r\n\r\nSee attached file.\r\n\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15622Generalize `E{0,1,2,3,6,9,12}` from `Data.Fixed`2019-07-13T21:33:42ZAlexandre R. BaldéGeneralize `E{0,1,2,3,6,9,12}` from `Data.Fixed`Hello;
I'm creating this email to propose a change to `Data.Fixed`. Full credit for this idea goes to Bhavik Mehta (\@b-mehta on GitHub), who implemented it in this [PR](https://github.com/dmcclean/exact-pi/pull/8) for `exact-pi`.
In `...Hello;
I'm creating this email to propose a change to `Data.Fixed`. Full credit for this idea goes to Bhavik Mehta (\@b-mehta on GitHub), who implemented it in this [PR](https://github.com/dmcclean/exact-pi/pull/8) for `exact-pi`.
In `Data.Fixed` there are several `E`-prefixed datatypes used to represent a certain number of digits of precision in fixed-precision arithmetic. For example, `E1` has 1 decimal place, `E12` has 12. Each of them, `E{0,1,2,3,6,9,12}` is hardcoded. If more precision types are to be provided, they have to be hardcoded as well, and all of these types resemble each other. I think there is room for improvement here.
Instead of having
```hs
data E0
instance HasResolution E0 where
resolution _ = 1
```
and repeating it as many times as there are `E` datatypes, I propose to add the following type:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
import GHC.TypeLits (Nat, KnownNat, natVal)
data E (n :: Nat)
```
and then do
```hs
instance KnownNat n => HasResolution (E n) where
resolution _ = 10^natVal (undefined :: E n)
```
just once, replacing `data E0` with `type E0 = E 0` (and the same for the rest of them) to continue reexporting these types. `E` should also be exported.
I've sent an email to the Core Libraries Committee regarding this issue. This is my first contribution to GHC, if I'm doing something incorrectly please tell me.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.4.3 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Core Libraries |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | Bodigrim |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Generalize `E{0,1,2,3,6,9,12}` from `Data.Fixed`","status":"New","operating_system":"","component":"Core Libraries","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":["Data.Fixed","base,"],"differentials":[],"test_case":"","architecture":"","cc":["Bodigrim"],"type":"FeatureRequest","description":"Hello;\r\n\r\nI'm creating this email to propose a change to `Data.Fixed`. Full credit for this idea goes to Bhavik Mehta (@b-mehta on GitHub), who implemented it in this [https://github.com/dmcclean/exact-pi/pull/8 PR] for `exact-pi`.\r\n\r\nIn `Data.Fixed` there are several `E`-prefixed datatypes used to represent a certain number of digits of precision in fixed-precision arithmetic. For example, `E1` has 1 decimal place, `E12` has 12. Each of them, `E{0,1,2,3,6,9,12}` is hardcoded. If more precision types are to be provided, they have to be hardcoded as well, and all of these types resemble each other. I think there is room for improvement here.\r\n\r\nInstead of having\r\n\r\n{{{#!hs\r\ndata E0\r\n\r\ninstance HasResolution E0 where\r\n resolution _ = 1\r\n}}}\r\n\r\nand repeating it as many times as there are `E` datatypes, I propose to add the following type:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE KindSignatures #-}\r\n\r\nimport GHC.TypeLits (Nat, KnownNat, natVal)\r\n\r\ndata E (n :: Nat)\r\n}}}\r\n\r\nand then do\r\n\r\n{{{#!hs\r\ninstance KnownNat n => HasResolution (E n) where\r\n resolution _ = 10^natVal (undefined :: E n)\r\n}}}\r\n\r\njust once, replacing `data E0` with `type E0 = E 0` (and the same for the rest of them) to continue reexporting these types. `E` should also be exported.\r\n\r\nI've sent an email to the Core Libraries Committee regarding this issue. This is my first contribution to GHC, if I'm doing something incorrectly please tell me.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1Alexandre R. BaldéAlexandre R. Baldéhttps://gitlab.haskell.org/ghc/ghc/-/issues/15618Unused binding warning should not apply to newtype constructors2019-07-07T18:03:43ZDavid FeuerUnused binding warning should not apply to newtype constructors```hs
module Foo (A, foo) where
import Data.Type.Coercion
newtype A = A Int
foo :: Coercion A Int
foo = Coercion
```
produces a warning:
```
NTCon.hs:4:13: warning: [-Wunused-top-binds]
Defined but not used: data constructor ‘A’
...```hs
module Foo (A, foo) where
import Data.Type.Coercion
newtype A = A Int
foo :: Coercion A Int
foo = Coercion
```
produces a warning:
```
NTCon.hs:4:13: warning: [-Wunused-top-binds]
Defined but not used: data constructor ‘A’
|
4 | newtype A = A Int
| ^^^^^
```
This is rather silly!
1. It's *impossible* to define a newtype without giving it a data constructor.
1. It's *possible* to use a newtype without using its data constructor.
Therefore, I believe the only reasonable thing to do is suppress the unused binding warning for newtype data constructors. If the newtype itself isn't used, that will be caught anyway.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1-beta1 |
| 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":"Unused binding warning should not apply to newtype constructors","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1-beta1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!hs\r\nmodule Foo (A, foo) where\r\nimport Data.Type.Coercion\r\n\r\nnewtype A = A Int\r\n\r\nfoo :: Coercion A Int\r\nfoo = Coercion\r\n}}}\r\n\r\nproduces a warning:\r\n\r\n{{{\r\nNTCon.hs:4:13: warning: [-Wunused-top-binds]\r\n Defined but not used: data constructor ‘A’\r\n |\r\n4 | newtype A = A Int\r\n | ^^^^^\r\n}}}\r\n\r\nThis is rather silly!\r\n\r\n1. It's ''impossible'' to define a newtype without giving it a data constructor.\r\n\r\n2. It's ''possible'' to use a newtype without using its data constructor.\r\n\r\nTherefore, I believe the only reasonable thing to do is suppress the unused binding warning for newtype data constructors. If the newtype itself isn't used, that will be caught anyway.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15617Unboxed tuples/sum error message on `a = show 5` in expression evaluation and...2020-09-01T07:48:09ZChaiTRexUnboxed tuples/sum error message on `a = show 5` in expression evaluation and interactive modesWith GHC 8.4.3 (on both Ubuntu 16.04.5 and Ubuntu 18.04.1) and recent GHC (not `HEAD` but close at `ff29fc84c03c800cfa04c2a00eb8edf6fa5f4183` on Ubuntu 16.04.5), I get errors for `a = show 5`.
I run the following commands, showing that ...With GHC 8.4.3 (on both Ubuntu 16.04.5 and Ubuntu 18.04.1) and recent GHC (not `HEAD` but close at `ff29fc84c03c800cfa04c2a00eb8edf6fa5f4183` on Ubuntu 16.04.5), I get errors for `a = show 5`.
I run the following commands, showing that `show 5` is usually fine:
```
$ ghc -fobject-code -O2 -e 'show 5'
"5"
$ ghc -fobject-code -O2 -e 'let a = show 5 in a'
"5"
```
But not with `a = show 5`:
```
$ ghc -fobject-code -O2 -e 'a = show 5'
<interactive>: Error: bytecode compiler can't handle unboxed tuples and sums.
Possibly due to foreign import/export decls in source.
Workaround: use -fobject-code, or compile this module to .o separately.
```
Running with `ghci` gives the same error:
```
$ ghci -fobject-code -O2
GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help
Prelude> a = show 5
Error: bytecode compiler can't handle unboxed tuples and sums.
Possibly due to foreign import/export decls in source.
Workaround: use -fobject-code, or compile this module to .o separately.
Prelude>
Leaving GHCi.
```
Both errors stop when optimization is turned off:
```
$ ghc -fobject-code -O0 -e 'a = show 5'
$ ghci -fobject-code -O0
GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help
Prelude> a = show 5
Prelude>
Leaving GHCi.
```8.6.1Roland SennRoland Sennhttps://gitlab.haskell.org/ghc/ghc/-/issues/15616Bug when using TimerManager/GHC.Event ?2020-09-01T07:38:17ZddellacostaBug when using TimerManager/GHC.Event ?It was suggested on \#haskell that this is a bug and that I should report it here. Hopefully this is the simplest possible example that shows the issue. The code sample I got from a StackOverflow answer (https://stackoverflow.com/a/25488...It was suggested on \#haskell that this is a bug and that I should report it here. Hopefully this is the simplest possible example that shows the issue. The code sample I got from a StackOverflow answer (https://stackoverflow.com/a/25488677) which I found just trying to learn how to use GHC.Event properly so presumably, and it seemed to work there, so I assume it is still valid code (but let me know if not!).
Minimal example repo is here: https://github.com/ddellacosta/timermanager-bug, please see Main.hs
I'm on on OS X 10.13.6, and hopefully the shell dump below combined with the repo above gives you everything else you need:
```bash
$ cabal new-configure
Resolving dependencies...
Build profile: -w ghc-8.4.3 -O1
In order, the following would be built (use -v for more details):
- timermanager-bug-0.1.0.0 (exe:timermanager-bug) (first run)
$ cabal new-build
Build profile: -w ghc-8.4.3 -O1
In order, the following will be built (use -v for more details):
- timermanager-bug-0.1.0.0 (exe:timermanager-bug) (first run)
Configuring executable 'timermanager-bug' for timermanager-bug-0.1.0.0..
clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
Preprocessing executable 'timermanager-bug' for timermanager-bug-0.1.0.0..
Building executable 'timermanager-bug' for timermanager-bug-0.1.0.0..
[1 of 1] Compiling Main ( Main.hs, /Users/ddellacosta/code/timermanager-bug/dist-newstyle/build/x86_64-osx/ghc-8.4.3/timermanager-bug-0.1.0.0/x/timermanager-bug/build/timermanager-bug/timermanager-bug-tmp/Main.o )
Linking /Users/ddellacosta/code/timermanager-bug/dist-newstyle/build/x86_64-osx/ghc-8.4.3/timermanager-bug-0.1.0.0/x/timermanager-bug/build/timermanager-bug/timermanager-bug ...
clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
$ cabal new-exec timermanager-bug
timermanager-bug: user error (Pattern match failure in do expression at libraries/base/GHC/Event/Thread.hs:216:3-10)
$
```
Let me know if there's any more information I can supply! Apologies if this is not actually a bug but something I'm doing wrong! Thanks!
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Unknown/Multiple |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Bug when using TimerManager/GHC.Event ?","status":"New","operating_system":"Unknown/Multiple","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"It was suggested on #haskell that this is a bug and that I should report it here. Hopefully this is the simplest possible example that shows the issue. The code sample I got from a StackOverflow answer (https://stackoverflow.com/a/25488677) which I found just trying to learn how to use GHC.Event properly so presumably, and it seemed to work there, so I assume it is still valid code (but let me know if not!).\r\n\r\nMinimal example repo is here: https://github.com/ddellacosta/timermanager-bug, please see Main.hs\r\n\r\nI'm on on OS X 10.13.6, and hopefully the shell dump below combined with the repo above gives you everything else you need:\r\n\r\n{{{#!bash\r\n$ cabal new-configure\r\nResolving dependencies...\r\nBuild profile: -w ghc-8.4.3 -O1\r\nIn order, the following would be built (use -v for more details):\r\n - timermanager-bug-0.1.0.0 (exe:timermanager-bug) (first run)\r\n$ cabal new-build\r\nBuild profile: -w ghc-8.4.3 -O1\r\nIn order, the following will be built (use -v for more details):\r\n - timermanager-bug-0.1.0.0 (exe:timermanager-bug) (first run)\r\nConfiguring executable 'timermanager-bug' for timermanager-bug-0.1.0.0..\r\nclang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]\r\nPreprocessing executable 'timermanager-bug' for timermanager-bug-0.1.0.0..\r\nBuilding executable 'timermanager-bug' for timermanager-bug-0.1.0.0..\r\n[1 of 1] Compiling Main ( Main.hs, /Users/ddellacosta/code/timermanager-bug/dist-newstyle/build/x86_64-osx/ghc-8.4.3/timermanager-bug-0.1.0.0/x/timermanager-bug/build/timermanager-bug/timermanager-bug-tmp/Main.o )\r\nLinking /Users/ddellacosta/code/timermanager-bug/dist-newstyle/build/x86_64-osx/ghc-8.4.3/timermanager-bug-0.1.0.0/x/timermanager-bug/build/timermanager-bug/timermanager-bug ...\r\nclang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]\r\nclang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]\r\n$ cabal new-exec timermanager-bug\r\ntimermanager-bug: user error (Pattern match failure in do expression at libraries/base/GHC/Event/Thread.hs:216:3-10)\r\n$\r\n}}}\r\n\r\nLet me know if there's any more information I can supply! Apologies if this is not actually a bug but something I'm doing wrong! Thanks!","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15615Rename some mutable closure types for consistency2019-07-07T18:03:44ZAndreas KlebingerRename some mutable closure types for consistencyDescription taken from the diff:
```
SMALL_MUT_ARR_PTRS_FROZEN0 -> SMALL_MUT_ARR_PTRS_FROZEN_DIRTY
SMALL_MUT_ARR_PTRS_FROZEN -> SMALL_MUT_ARR_PTRS_FROZEN_CLEAN
MUT_ARR_PTRS_FROZEN0 -> MUT_ARR_PTRS_FROZEN_DIRTY
MUT_ARR_PTRS_FROZEN -> MUT...Description taken from the diff:
```
SMALL_MUT_ARR_PTRS_FROZEN0 -> SMALL_MUT_ARR_PTRS_FROZEN_DIRTY
SMALL_MUT_ARR_PTRS_FROZEN -> SMALL_MUT_ARR_PTRS_FROZEN_CLEAN
MUT_ARR_PTRS_FROZEN0 -> MUT_ARR_PTRS_FROZEN_DIRTY
MUT_ARR_PTRS_FROZEN -> MUT_ARR_PTRS_FROZEN_CLEAN
```
Naming is now consistent with other CLEAR/DIRTY objects (MVAR, MUT_VAR,
MUT_ARR_PTRS).
(alternatively we could rename MVAR_DIRTY/MVAR_CLEAN etc. to MVAR0/MVAR)
Removed a few comments in Scav.c about FROZEN0 being on the mut_list
because it's now clear from the closure type.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.4.3 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Runtime System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Rename some mutable closure types for consistency","status":"New","operating_system":"","component":"Runtime System","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"Description taken from the diff:\r\n\r\n{{{\r\nSMALL_MUT_ARR_PTRS_FROZEN0 -> SMALL_MUT_ARR_PTRS_FROZEN_DIRTY\r\nSMALL_MUT_ARR_PTRS_FROZEN -> SMALL_MUT_ARR_PTRS_FROZEN_CLEAN\r\nMUT_ARR_PTRS_FROZEN0 -> MUT_ARR_PTRS_FROZEN_DIRTY\r\nMUT_ARR_PTRS_FROZEN -> MUT_ARR_PTRS_FROZEN_CLEAN\r\n}}}\r\n\r\nNaming is now consistent with other CLEAR/DIRTY objects (MVAR, MUT_VAR,\r\nMUT_ARR_PTRS).\r\n\r\n(alternatively we could rename MVAR_DIRTY/MVAR_CLEAN etc. to MVAR0/MVAR)\r\n\r\nRemoved a few comments in Scav.c about FROZEN0 being on the mut_list\r\nbecause it's now clear from the closure type.\r\n\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15612Got Unable to commit 16777216 bytes of memory error on Ubuntu2019-08-08T06:42:52ZfigelwumpGot Unable to commit 16777216 bytes of memory error on UbuntuWhen running stack build on Ubuntu 18.04 on an AWS t2-micro instance (1 GB RAM), I got the following error:
```
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc...When running stack build on Ubuntu 18.04 on an AWS t2-micro instance (1 GB RAM), I got the following error:
```
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-8.0.2.
Installed GHC.
Populated index cache.
stack: internal error: Unable to commit 16777216 bytes of memory
(GHC version 8.2.2 for x86_64_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
1. .. After which there's no more output and stack build seems to hang. Any guidance here would be appreciated, thanks!
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.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":"Got Unable to commit 16777216 bytes of memory error on Ubuntu","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When running stack build on Ubuntu 18.04 on an AWS t2-micro instance (1 GB RAM), I got the following error:\r\n\r\n\r\n{{{\r\nPreparing to install GHC to an isolated location.\r\nThis will not interfere with any system-level installation.\r\nDownloaded ghc-8.0.2. \r\nInstalled GHC. \r\nPopulated index cache. \r\nstack: internal error: Unable to commit 16777216 bytes of memory\r\n (GHC version 8.2.2 for x86_64_unknown_linux)\r\n Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n}}}\r\n\r\n... After which there's no more output and stack build seems to hang. Any guidance here would be appreciated, thanks!","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15611scope errors lie about what modules are imported2021-05-18T21:55:32Zdmwitscope errors lie about what modules are importedHere's Test.hs:
```
module Test where
```
And here's a ghci session:
```
% ghci Test.hs
GHCi, version 8.4.2: http://www.haskell.org/ghc/ :? for help
*Test> Test.foo
<interactive>:1:1: error:
Not in scope: ‘Test.foo’
No modul...Here's Test.hs:
```
module Test where
```
And here's a ghci session:
```
% ghci Test.hs
GHCi, version 8.4.2: http://www.haskell.org/ghc/ :? for help
*Test> Test.foo
<interactive>:1:1: error:
Not in scope: ‘Test.foo’
No module named ‘Test’ is imported.
```
That "No module named ‘Test’ is imported." part seems blatantly wrong (and persists even if I explicitly `import Test` rather than using the implicit loading of the module).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"scope errors lie about what modules are imported","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Here's Test.hs:\r\n\r\n{{{\r\nmodule Test where\r\n}}}\r\n\r\nAnd here's a ghci session:\r\n\r\n{{{\r\n% ghci Test.hs\r\nGHCi, version 8.4.2: http://www.haskell.org/ghc/ :? for help\r\n*Test> Test.foo\r\n\r\n<interactive>:1:1: error:\r\n Not in scope: ‘Test.foo’\r\n No module named ‘Test’ is imported.\r\n}}}\r\n\r\nThat \"No module named ‘Test’ is imported.\" part seems blatantly wrong (and persists even if I explicitly `import Test` rather than using the implicit loading of the module).","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Roland SennRoland Sennhttps://gitlab.haskell.org/ghc/ghc/-/issues/15610GHCi command to list instances a (possibly compound) type belongs to2019-07-07T18:03:45ZIcelandjackGHCi command to list instances a (possibly compound) type belongs toThis command (`:instances`) would be very useful to me (for deriving in particular). People on Twitter were digging it, I believe some are interested in implementing it
```
>> import Data.Functor.Sum (Sum)
>>
>> :instances Sum [] []
Eq...This command (`:instances`) would be very useful to me (for deriving in particular). People on Twitter were digging it, I believe some are interested in implementing it
```
>> import Data.Functor.Sum (Sum)
>>
>> :instances Sum [] []
Eq a => Eq (Sum [] [] a)
Ord a => Ord (Sum [] [] a)
Show a => Show (Sum [] [] a)
Read a => Read (Sum [] [] a)
Functor (Sum [] [])
Foldable (Sum [] [])
Eq1 (Sum [] [])
Ord1 (Sum [] [])
Show1 (Sum [] [])
Read1 (Sum [] [])
FunctorWithIndex (Either Int Int) (Sum [] [])
FoldableWithIndex (Either Int Int) (Sum [] [])
TraversableWithIndex (Either Int Int) (Sum [] [])
```
Not a precise algorithm, but the command `:instances <ty>` lists what classes `<ty>` is an instance of. This is something I usually do by hand and is useful for finding what instances I can expect to derive with `-XDerivingVia`:
```hs
data ...
deriving (???)
via (F A B)
-- >> :instances F A B
-- Cls1 (F A B)
-- Cls2 (F A B) ..
data ...
deriving (Cls1, Cls2, ..)
via (F A B)
```
I expect something like `:instances Sum Endo` to return no instances, but I currently rely on my own mind to derive a contradiction for each type. I would cross-reference `:info Sum`, `:info Endo` which blows up when the types are complex and deeply nested.
<table><tr><th>partial type signature (`_`)</th>
<td>the command `:instances Either _ Int` should match `Eq a => Eq (Either a Int)`</td></tr>
<tr><th>trace info</th>
<td>I find it noisy but we can </td></tr></table>
> `
> >> :instances Sum [] []
> ..
> Functor (Sum [] []) -- (Functor f, Functor g) => Functor (Sum f g) -- Defined in ‘Data.Functor.Sum’
> ..
> `
> This would be more natural in a interactive environment where we can toggle/expand and collapse it (see #15613 for what might appear as we expand instances).
<table><tr><th>negative results</th>
<td>There is a `.. => Comonad (Sum f g)` instance but we don't have `Comonad (Sum [] [])` because there is no `Comonad []`. It may be valuable to query negative results</td></tr></table>
> `
> >> :noinstance Sum [] []
> NO (instance Comonad (Sum [] [])) because
> NO (instance Comonad [])
> `
<table><tr><th>multi-parameter type class</th>
<td>I cheekily listed `FunctorWithIndex` example of, I am fine dropping MPTCs, we can also consider special constraints like `Coercible` </td></tr></table>
> `
> >> newtype List_or_List a = L_or_L (Sum [] [] a)
> >>
> >> :instance Sum [] []
> ..
> Coercible (Sum [] [] a) (List_or_List a)
> `8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/15609No skolem info panic: Static pointers and holes2019-07-07T18:03:45ZMatthew PickeringNo skolem info panic: Static pointers and holesThe following program panics:
```
{-# LANGUAGE StaticPointers #-}
{-# LANGUAGE GADTs #-}
module Panic where
data Closure a where
foo :: (Closure a -> Closure b) -> Closure (a -> b)
foo f = static _
```
```
src/Panic.hs:8:16: error:gh...The following program panics:
```
{-# LANGUAGE StaticPointers #-}
{-# LANGUAGE GADTs #-}
module Panic where
data Closure a where
foo :: (Closure a -> Closure b) -> Closure (a -> b)
foo f = static _
```
```
src/Panic.hs:8:16: error:ghc: panic! (the 'impossible' happened)
(GHC version 8.6.0.20180810 for x86_64-unknown-linux):
No skolem info:
[a_a5rt[sk:1], b_a5ru[sk:1]]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcErrors.hs:2851:5 in ghc:TcErrors
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| 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":"No skolem info panic: Static pointers and holes","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program panics:\r\n\r\n{{{\r\n{-# LANGUAGE StaticPointers #-}\r\n{-# LANGUAGE GADTs #-}\r\nmodule Panic where\r\n\r\ndata Closure a where\r\n\r\nfoo :: (Closure a -> Closure b) -> Closure (a -> b)\r\nfoo f = static _\r\n}}}\r\n\r\n{{{\r\nsrc/Panic.hs:8:16: error:ghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.0.20180810 for x86_64-unknown-linux):\r\n\tNo skolem info:\r\n [a_a5rt[sk:1], b_a5ru[sk:1]]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable\r\n pprPanic, called at compiler/typecheck/TcErrors.hs:2851:5 in ghc:TcErrors\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15608Segfault in retainer profiling2019-07-07T18:03:45ZÖmer Sinan AğacanSegfault in retainer profilingTo reproduce, build ghc using "prof" flavor, then
```
$ ghc-stage2 --interactive +RTS -hr
GHCi, version 8.7.20180905: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/omer/rcbackup/.ghci
λ:1> sequence_ (repl...To reproduce, build ghc using "prof" flavor, then
```
$ ghc-stage2 --interactive +RTS -hr
GHCi, version 8.7.20180905: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/omer/rcbackup/.ghci
λ:1> sequence_ (replicate 100000000 (return ()))
zsh: segmentation fault (core dumped) ghc-stage2 --interactive +RTS -hr
```
If I use debug runtime in stage2 compiler I can't even run the repl:
```
haskell $ ghc-stage2 --interactive +RTS -hr
rr: Saving execution to trace directory `/home/omer/.local/share/rr/ghc-stage2-13'.
GHCi, version 8.7.20180906: http://www.haskell.org/ghc/ :? for help
zsh: segmentation fault ghc-stage2 --interactive +RTS -hr
```8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15607RebindableSyntax warns `return` is not in scope when trying to call `pure`, b...2019-07-07T18:03:45ZisovectorRebindableSyntax warns `return` is not in scope when trying to call `pure`, but does not desugar between the twoThe following (incorrect) program fails to compile:
```hs
{-# LANGUAGE RebindableSyntax #-}
import Prelude hiding (pure, return)
t = do
pure 5
```
```
Not in scope: ‘return’
Perhaps you want to remove ‘return’ from the expl...The following (incorrect) program fails to compile:
```hs
{-# LANGUAGE RebindableSyntax #-}
import Prelude hiding (pure, return)
t = do
pure 5
```
```
Not in scope: ‘return’
Perhaps you want to remove ‘return’ from the explicit hiding list
in the import of ‘Prelude’ (/home/sandy/Bug.hs:3:1-40).
|
6 | pure 5
|
```
Notice that this error mentions `return` not being in scope, despite trying to call `pure`. This suggests to the user that there is some desugaring going on to transform pure into return (but there isn't!).
Changing the import of Prelude to no longer hide `return` now gives the correct error:
```hs
import Prelude hiding (pure)
```
```
• Variable not in scope: pure :: Integer -> t
• Perhaps you want to remove ‘pure’ from the explicit hiding list
in the import of ‘Prelude’ (/home/sandy/Bug.hs:3:1-28).
|
6 | pure 5
| ^^^^
```
This is particularly confusing when `pure` is in scope and would typecheck but `return` is not. The error suggests that there is desugaring going on behind the scenes to turn `pure` into `return` via rebindable syntax.8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15604Profiling RTS flag `-po` does not work2019-07-07T18:03:46ZÖmer Sinan AğacanProfiling RTS flag `-po` does not workThe RTS flag documentation says this about `-po`:
```
empty: -p Time/allocation profile in tree format
empty: (output file <output prefix>.prof)
empty: -po<file> Override profiling output file name prefix (prog...The RTS flag documentation says this about `-po`:
```
empty: -p Time/allocation profile in tree format
empty: (output file <output prefix>.prof)
empty: -po<file> Override profiling output file name prefix (program name by default)
```
However it current doesn't work as advertised in 8.4 and HEAD. When I use `-po<file>` no file is generated. Reproducer:
```
$ cat empty.hs
main = return ()
$ ghc-stage2 empty.hs -fforce-recomp -rtsopts -prof
[1 of 1] Compiling Main ( empty.hs, empty.o )
Linking empty ...
$ ./empty +RTS -poprof
$ ls | grep prof
$
```
Just `-p` works:
```
$ ./empty +RTS -p
$ ls | grep prof
empty.prof
$
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.5 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Profiling |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Profiling RTS flag `-po` does not work","status":"New","operating_system":"","component":"Profiling","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The RTS flag documentation says this about `-po`:\r\n\r\n{{{\r\nempty: -p Time/allocation profile in tree format\r\nempty: (output file <output prefix>.prof)\r\nempty: -po<file> Override profiling output file name prefix (program name by default)\r\n}}}\r\n\r\nHowever it current doesn't work as advertised in 8.4 and HEAD. When I use `-po<file>` no file is generated. Reproducer:\r\n\r\n{{{\r\n$ cat empty.hs\r\nmain = return ()\r\n$ ghc-stage2 empty.hs -fforce-recomp -rtsopts -prof\r\n[1 of 1] Compiling Main ( empty.hs, empty.o )\r\nLinking empty ...\r\n$ ./empty +RTS -poprof\r\n$ ls | grep prof\r\n$\r\n}}}\r\n\r\nJust `-p` works:\r\n\r\n{{{\r\n$ ./empty +RTS -p\r\n$ ls | grep prof\r\nempty.prof\r\n$\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15603ref6 example from StaticPointers documentation doesn't type check2021-11-25T17:04:14ZMatthew Pickeringref6 example from StaticPointers documentation doesn't type checkThe [documentation](https://downloads.haskell.org/~ghc/8.4.3/docs/html/users_guide/glasgow_exts.html?highlight=static%20pointers#extension-StaticPointers) for `StaticPointers` contains the following example.
```
ref6 y = let x = 1 in st...The [documentation](https://downloads.haskell.org/~ghc/8.4.3/docs/html/users_guide/glasgow_exts.html?highlight=static%20pointers#extension-StaticPointers) for `StaticPointers` contains the following example.
```
ref6 y = let x = 1 in static x
```
but this doesn't get accepted by the type checker.
```
sp.hs:27:23: error:
• ‘x’ is used in a static form but it is not closed because it
has a non-closed type because it contains the
type variables: ‘p_a7KP’
• In the expression: static x
In the expression: let x = 1 in static x
In an equation for ‘ref6’: ref6 y = let x = 1 in static x
|
27 | ref6 y = let x = 1 in static x
| ^^^^^^^
```
I tested on 8.6.1, 8.4.3, 8.2.2, 8.02, 7.10.3 and all fail.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| 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":"ref6 example from StaticPointers documentation doesn't type check","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The [https://downloads.haskell.org/~ghc/8.4.3/docs/html/users_guide/glasgow_exts.html?highlight=static%20pointers#extension-StaticPointers documentation] for `StaticPointers` contains the following example.\r\n\r\n{{{\r\nref6 y = let x = 1 in static x\r\n}}}\r\n\r\nbut this doesn't get accepted by the type checker.\r\n\r\n{{{\r\nsp.hs:27:23: error:\r\n • ‘x’ is used in a static form but it is not closed because it\r\n has a non-closed type because it contains the\r\n type variables: ‘p_a7KP’\r\n • In the expression: static x\r\n In the expression: let x = 1 in static x\r\n In an equation for ‘ref6’: ref6 y = let x = 1 in static x\r\n |\r\n27 | ref6 y = let x = 1 in static x\r\n | ^^^^^^^\r\n}}}\r\n\r\nI tested on 8.6.1, 8.4.3, 8.2.2, 8.02, 7.10.3 and all fail. ","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15601Unexpected compile error on type level lists with a single element2019-07-07T18:03:47ZerikdUnexpected compile error on type level lists with a single elementTried this with ghc 8.0.2, 8.2.2 and 8.4.3 and all give an almost identical error on the following piece of code:
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOpe...Tried this with ghc 8.0.2, 8.2.2 and 8.4.3 and all give an almost identical error on the following piece of code:
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wall #-}
import Data.Singletons.Prelude.List
#if MIN_VERSION_singletons(2,4,0)
type (a :++ b) = a ++ b
#endif
data MyType = A | B | C | D | E | F
type TypeList1 = ['A, 'B]
type TypeList2 = TypeList1 :++ ['C, 'D]
-- Everything above is fine, but this line:
type TypeList3 = TypeList2 :++ ['F]
-- Gives the error:
--
-- type-level-list.hs:21:32: error:
-- • Expected kind ‘[MyType]’, but ‘[ 'F]’ has kind ‘*’
-- • In the second argument of ‘(:++)’, namely ‘[ 'F]’
-- In the type ‘TypeList2 :++ [ 'F]’
-- In the type declaration for ‘TypeList3’
-- |
-- 22 | type TypeList3 = TypeList2 :++ ['F]
-- If instead I write it like:
type TypeList4 = TypeList2 :++ '[F]
-- I get the warning:
--
-- type-level-list.hs:33:34: warning: [-Wunticked-promoted-constructors]
-- Unticked promoted constructor: ‘F’.
-- Use ‘'F’ instead of ‘F’.
-- The following actually seems to work, but I don't understand why type level
-- lists containing only one element are different.
type TypeList5 = TypeList2 :++ '[ 'F]
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| 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":"Unexpected compile error on type level lists with a single element","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Tried this with ghc 8.0.2, 8.2.2 and 8.4.3 and all give an almost identical error on the following piece of code:\r\n{{{#!hs\r\n\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# LANGUAGE CPP #-}\r\n\r\n{-# OPTIONS_GHC -Wall #-}\r\n\r\nimport Data.Singletons.Prelude.List\r\n\r\n#if MIN_VERSION_singletons(2,4,0)\r\ntype (a :++ b) = a ++ b\r\n#endif\r\n\r\ndata MyType = A | B | C | D | E | F\r\n\r\ntype TypeList1 = ['A, 'B]\r\n\r\ntype TypeList2 = TypeList1 :++ ['C, 'D]\r\n\r\n-- Everything above is fine, but this line:\r\ntype TypeList3 = TypeList2 :++ ['F]\r\n-- Gives the error:\r\n--\r\n-- type-level-list.hs:21:32: error:\r\n-- • Expected kind ‘[MyType]’, but ‘[ 'F]’ has kind ‘*’\r\n-- • In the second argument of ‘(:++)’, namely ‘[ 'F]’\r\n-- In the type ‘TypeList2 :++ [ 'F]’\r\n-- In the type declaration for ‘TypeList3’\r\n-- |\r\n-- 22 | type TypeList3 = TypeList2 :++ ['F]\r\n\r\n-- If instead I write it like:\r\ntype TypeList4 = TypeList2 :++ '[F]\r\n-- I get the warning:\r\n--\r\n-- type-level-list.hs:33:34: warning: [-Wunticked-promoted-constructors]\r\n-- Unticked promoted constructor: ‘F’.\r\n-- Use ‘'F’ instead of ‘F’.\r\n\r\n-- The following actually seems to work, but I don't understand why type level \r\n-- lists containing only one element are different.\r\ntype TypeList5 = TypeList2 :++ '[ 'F]\r\n\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1