GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:56:00Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/5296Add explicit type applications2019-07-07T18:56:00ZdsfAdd explicit type applicationsThis example is derived from code in my application. It works, but I can't add a signature to it. In other places it is preventing some code from compiling at all.
```
{-# LANGUAGE KindSignatures, MultiParamTypeClasses, RankNTypes #-}
{...This example is derived from code in my application. It works, but I can't add a signature to it. In other places it is preventing some code from compiling at all.
```
{-# LANGUAGE KindSignatures, MultiParamTypeClasses, RankNTypes #-}
{-# OPTIONS -Wall #-}
module Test where
class C t1 t2 m where method :: Int -> m t2
f :: forall t1 t2 (m :: * -> *). C t1 t2 m => Int -> m t2
f x = method x
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 7.0.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Linux |
| Architecture | x86_64 (amd64) |
</details>
<!-- {"blocked_by":[],"summary":"Compile succeeds without signature, but fails with the signature suggested by GHC","status":"New","operating_system":"Linux","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.0.3","keywords":[],"differentials":[],"test_case":"","architecture":"x86_64 (amd64)","cc":[""],"type":"Bug","description":"This example is derived from code in my application. It works, but I can't add a signature to it. In other places it is preventing some code from compiling at all.\r\n\r\n{{{\r\n{-# LANGUAGE KindSignatures, MultiParamTypeClasses, RankNTypes #-}\r\n{-# OPTIONS -Wall #-}\r\nmodule Test where\r\n\r\nclass C t1 t2 m where method :: Int -> m t2\r\n\r\nf :: forall t1 t2 (m :: * -> *). C t1 t2 m => Int -> m t2\r\nf x = method x\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/7788Recursive type family causes <<loop>>2019-07-07T18:48:09ZshachafRecursive type family causes <<loop>>This file:
```
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
data Proxy a = Proxy
foo :: Proxy (F (Fix Id)) -> ()
foo = undefined
newtype Fix a = Fix (a (Fix a))
newtype Id a = Id a
type family F a
type instanc...This file:
```
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
data Proxy a = Proxy
foo :: Proxy (F (Fix Id)) -> ()
foo = undefined
newtype Fix a = Fix (a (Fix a))
newtype Id a = Id a
type family F a
type instance F (Fix a) = F (a (Fix a))
type instance F (Id a) = F a
main :: IO ()
main = print $ foo Proxy
```
Dies with `<<loop>>`. The type family is recursive, of course:
```
*Main> :kind! F (Fix Id)
F (Fix Id) :: *^CInterrupted.
```
But `<<loop>>` is still not the behavior I'd expect. The actual value is just `undefined`.
In the file that this example came up, the situation was even worse -- there was a situation where
```
moldMapOf l f = runAccessor . l (Accessor . f)
main = print $ (flip appEndo [] . moldMapOf (ix 3) (Endo . (:)) $ testVal :: [Int]) -- <<loop>>
main = print $ (flip appEndo [] . runAccessor . (ix 3) (Accessor . Endo . (:)) $ testVal :: [Int]) -- undefined
```
I.e. substitution can turn one program (which happens to be ⊥ here, admittedly, but that's not fundamental) into another (`<<loop>>`). This makes it very tricky to track down the recursive type family. If necessary I can hunt down a working test case and post it here -- it's a bit tricky to get working, though.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.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":"Recursive type family causes <<loop>>","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This file:\r\n\r\n{{{\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE UndecidableInstances #-}\r\n\r\ndata Proxy a = Proxy\r\n\r\nfoo :: Proxy (F (Fix Id)) -> ()\r\nfoo = undefined\r\n\r\nnewtype Fix a = Fix (a (Fix a))\r\nnewtype Id a = Id a\r\n\r\ntype family F a\r\ntype instance F (Fix a) = F (a (Fix a))\r\ntype instance F (Id a) = F a\r\n\r\nmain :: IO ()\r\nmain = print $ foo Proxy\r\n}}}\r\n\r\nDies with `<<loop>>`. The type family is recursive, of course:\r\n\r\n{{{\r\n*Main> :kind! F (Fix Id)\r\nF (Fix Id) :: *^CInterrupted.\r\n}}}\r\n\r\nBut `<<loop>>` is still not the behavior I'd expect. The actual value is just `undefined`.\r\n\r\nIn the file that this example came up, the situation was even worse -- there was a situation where\r\n\r\n{{{\r\nmoldMapOf l f = runAccessor . l (Accessor . f)\r\nmain = print $ (flip appEndo [] . moldMapOf (ix 3) (Endo . (:)) $ testVal :: [Int]) -- <<loop>>\r\nmain = print $ (flip appEndo [] . runAccessor . (ix 3) (Accessor . Endo . (:)) $ testVal :: [Int]) -- undefined\r\n}}}\r\n\r\nI.e. substitution can turn one program (which happens to be ⊥ here, admittedly, but that's not fundamental) into another (`<<loop>>`). This makes it very tricky to track down the recursive type family. If necessary I can hunt down a working test case and post it here -- it's a bit tricky to get working, though.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/9204Conflicting definition in hs-boot file2019-07-07T18:41:23ZFeuerbachConflicting definition in hs-boot fileFoo.hs:
```
module Foo where
import Bar
data Foo a
```
Foo.hs-boot:
```
module Foo where
data Foo a
```
Bar.hs:
```
module Bar where
import {-# SOURCE #-} Foo
```
With GHC 7.8.2 I'm getting the error
```
Foo.hs-boot:3:1:
Ty...Foo.hs:
```
module Foo where
import Bar
data Foo a
```
Foo.hs-boot:
```
module Foo where
data Foo a
```
Bar.hs:
```
module Bar where
import {-# SOURCE #-} Foo
```
With GHC 7.8.2 I'm getting the error
```
Foo.hs-boot:3:1:
Type constructor ‘Foo’ has conflicting definitions in the module
and its hs-boot file
Main module: type role Foo phantom
data Foo a
Boot file: data Foo a
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.8.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":"Conflicting definition in hs-boot file","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Foo.hs:\r\n\r\n{{{\r\nmodule Foo where\r\n\r\nimport Bar\r\n\r\ndata Foo a\r\n}}}\r\n\r\nFoo.hs-boot:\r\n{{{\r\nmodule Foo where\r\n\r\ndata Foo a\r\n}}}\r\n\r\nBar.hs:\r\n{{{\r\nmodule Bar where\r\nimport {-# SOURCE #-} Foo\r\n}}}\r\n\r\nWith GHC 7.8.2 I'm getting the error\r\n\r\n{{{\r\nFoo.hs-boot:3:1:\r\n Type constructor ‘Foo’ has conflicting definitions in the module\r\n and its hs-boot file\r\n Main module: type role Foo phantom\r\n data Foo a\r\n Boot file: data Foo a\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/9247Document -XDatatypeContexts in flag reference2019-07-07T18:41:11ZRichard Eisenbergrae@richarde.devDocument -XDatatypeContexts in flag referenceIt may be a deprecated feature, but it still exists and should be listed.
I can do this.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------- |
| Version ...It may be a deprecated feature, but it still exists and should be listed.
I can do this.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------- |
| Version | 7.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Documentation |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Document -XDatatypeContexts in flag reference","status":"New","operating_system":"","component":"Documentation","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"goldfire"},"version":"7.8.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"It may be a deprecated feature, but it still exists and should be listed.\r\n\r\nI can do this.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10079Coercible solver regression: Couldn't match rep of () with Const () b2019-07-07T18:37:38ZglguyCoercible solver regression: Couldn't match rep of () with Const () bHello, I ran into what appears to be a regression in the Coercible solver since 7.8.4. This is as small as I've managed to get my example case.
```
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGU...Hello, I ran into what appears to be a regression in the Coercible solver since 7.8.4. This is as small as I've managed to get my example case.
```
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FlexibleContexts #-}
module Bug where
import Control.Applicative
import Data.Coerce
broken :: Bizarre (->) w => w a b t -> ()
broken = getConst #. bazaar (Const #. const ())
class Profunctor p where
(#.) :: Coercible c b => (b -> c) -> p a b -> p a c
instance Profunctor (->) where
(#.) = (.)
class Bizarre p w | w -> p where
bazaar :: Applicative f => p a (f b) -> w a b t -> f t
```
```
Bug.hs:10:36:
Couldn't match representation of type ‘()’
with that of ‘Const () b’
Relevant role signatures: type role Const representational phantom
Relevant bindings include
broken :: w a b t -> () (bound at Bug.hs:10:1)
In the first argument of ‘bazaar’, namely ‘(Const #. const ())’
In the second argument of ‘(#.)’, namely
‘bazaar (Const #. const ())’
In the expression: getConst #. bazaar (Const #. const ())
```8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10121operational semantics is incomplete?2019-07-07T18:37:25ZJavran Chengoperational semantics is incomplete?I was trying to read `docs/core-spec/core-spec.pdf` to understand the operational semantics for core language. So I started off by playing with operational semantics rules manually.
But I found the following expression gets stuck:
```h...I was trying to read `docs/core-spec/core-spec.pdf` to understand the operational semantics for core language. So I started off by playing with operational semantics rules manually.
But I found the following expression gets stuck:
```hs
v1 = let fix = \f -> let x = f x in x
pf = \f x -> if x == 0
then x
else f (pred x)
in (fix pf) 2
-- S_LETNONREC
v2 = ((\f -> let x = f x in x)
(\f x -> if x == 0
then x
else f (pred x)))
2
-- S_APP
v3 = (let x = (\f x -> if x == 0
then x
else f (pred x)) x
in x) 2
-- S_APP; S_LETREC
v4 = (let x = (\f x -> if x == 0
then x
else f (pred x)) x
in (\f x -> if x == 0
then x
else f (pred x)) x) 2
-- S_APP
v5 = (let x = (\f x -> if x == 0
then x
else f (pred x)) x
in (\x1 -> if x1 == 0
then x1
else x (pred x1))) 2
```
at this point `x` is not a free variable so `S_LETRECRETURN` cannot be applied.
Did I make it wrong or some rules are missing for the operational semantics?
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------- |
| Version | 7.8.4 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Documentation |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"operational semantics is incomplete?","status":"New","operating_system":"","component":"Documentation","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I was trying to read `docs/core-spec/core-spec.pdf` to understand the operational semantics for core language. So I started off by playing with operational semantics rules manually.\r\n\r\nBut I found the following expression gets stuck:\r\n\r\n{{{#!hs\r\nv1 = let fix = \\f -> let x = f x in x\r\n pf = \\f x -> if x == 0\r\n then x\r\n else f (pred x)\r\n in (fix pf) 2\r\n-- S_LETNONREC\r\nv2 = ((\\f -> let x = f x in x)\r\n (\\f x -> if x == 0\r\n then x\r\n else f (pred x)))\r\n 2\r\n-- S_APP\r\nv3 = (let x = (\\f x -> if x == 0\r\n then x\r\n else f (pred x)) x\r\n in x) 2\r\n-- S_APP; S_LETREC\r\nv4 = (let x = (\\f x -> if x == 0\r\n then x\r\n else f (pred x)) x\r\n in (\\f x -> if x == 0\r\n then x\r\n else f (pred x)) x) 2\r\n-- S_APP\r\nv5 = (let x = (\\f x -> if x == 0\r\n then x\r\n else f (pred x)) x\r\n in (\\x1 -> if x1 == 0\r\n then x1\r\n else x (pred x1))) 2\r\n\r\n}}}\r\n\r\nat this point `x` is not a free variable so `S_LETRECRETURN` cannot be applied.\r\n\r\nDid I make it wrong or some rules are missing for the operational semantics? ","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10379Prefix syntax for promoted list kind isn't parsed properly2019-07-07T18:36:19ZGergő ÉrdiPrefix syntax for promoted list kind isn't parsed properly(Originally from https://stackoverflow.com/questions/27673578/)
Given the following input file:
```
{-# LANGUAGE KindSignatures, GADTs, DataKinds, TypeOperators #-}
data Foo1 :: [*] -> * where
data Foo2 :: ([] *) -> * where
```
it f...(Originally from https://stackoverflow.com/questions/27673578/)
Given the following input file:
```
{-# LANGUAGE KindSignatures, GADTs, DataKinds, TypeOperators #-}
data Foo1 :: [*] -> * where
data Foo2 :: ([] *) -> * where
```
it fails on the definition of `Foo2`:
```
list-promote2.hs:4:16: parse error on input `]'
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------- |
| Version | 7.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Compiler (Parser) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Prefix syntax for promoted list kind isn't parsed properly","status":"New","operating_system":"","component":"Compiler (Parser)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"(Originally from https://stackoverflow.com/questions/27673578/)\r\n\r\nGiven the following input file:\r\n\r\n\r\n{{{\r\n{-# LANGUAGE KindSignatures, GADTs, DataKinds, TypeOperators #-}\r\n\r\ndata Foo1 :: [*] -> * where\r\ndata Foo2 :: ([] *) -> * where\r\n\r\n}}}\r\n\r\nit fails on the definition of `Foo2`:\r\n\r\n{{{\r\nlist-promote2.hs:4:16: parse error on input `]'\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10428GHC cannot match representations using Coercible constraint2019-07-07T18:35:57ZEric CrockettGHC cannot match representations using Coercible constraintThe following code compiles in 7.8.4 but fails in 7.10.1:
```hs
import Data.Coerce
coerceNewtype :: (Coercible (o r) (n m' r)) => [o r] -> [n m' r]
coerceNewtype = coerce
```
with the error
```
Couldn't match representation of type ‘n...The following code compiles in 7.8.4 but fails in 7.10.1:
```hs
import Data.Coerce
coerceNewtype :: (Coercible (o r) (n m' r)) => [o r] -> [n m' r]
coerceNewtype = coerce
```
with the error
```
Couldn't match representation of type ‘n m' r’ with that of ‘o r’
arising from trying to show that the representations of
‘[o r]’ and
‘[n m' r]’ are the same
Relevant role signatures: type role [] representational
```
However, the following compiles:
```hs
{-# LANGUAGE TypeFamilies #-}
import Data.Coerce
coerceNewtype :: (Coercible a b, a ~ (o r), b ~ (n m' r)) => [o r] -> [n m' r]
coerceNewtype = coerce
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC cannot match representations using Coercible constraint","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following code compiles in 7.8.4 but fails in 7.10.1:\r\n\r\n\r\n{{{#!hs\r\nimport Data.Coerce\r\ncoerceNewtype :: (Coercible (o r) (n m' r)) => [o r] -> [n m' r]\r\ncoerceNewtype = coerce\r\n}}}\r\n\r\nwith the error\r\n\r\n{{{\r\n\r\nCouldn't match representation of type ‘n m' r’ with that of ‘o r’\r\narising from trying to show that the representations of\r\n ‘[o r]’ and\r\n ‘[n m' r]’ are the same\r\nRelevant role signatures: type role [] representational\r\n}}}\r\n\r\nHowever, the following compiles:\r\n\r\n\r\n{{{#!hs\r\n{-# LANGUAGE TypeFamilies #-}\r\n\r\nimport Data.Coerce\r\ncoerceNewtype :: (Coercible a b, a ~ (o r), b ~ (n m' r)) => [o r] -> [n m' r]\r\ncoerceNewtype = coerce\r\n}}}\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10493Inaccessible code might be accessible with newtypes and Coercible2019-07-07T18:35:40ZRichard Eisenbergrae@richarde.devInaccessible code might be accessible with newtypes and CoercibleIf I say
```
module A (Age, ageCo) where
import Data.Type.Coercion
newtype Age = MkAge Int
ageCo :: Coercion Age Int
ageCo = Coercion
```
```
{-# LANGUAGE FlexibleContexts #-}
module B where
import Data.Coerce
import A
foo :: Coe...If I say
```
module A (Age, ageCo) where
import Data.Type.Coercion
newtype Age = MkAge Int
ageCo :: Coercion Age Int
ageCo = Coercion
```
```
{-# LANGUAGE FlexibleContexts #-}
module B where
import Data.Coerce
import A
foo :: Coercible Age Int => ()
foo = ()
```
I get
```
B.hs:8:8: error:
Couldn't match representation of type ‘Age’ with that of ‘Int’
Inaccessible code in
the type signature for: foo :: Coercible Age Int => ()
In the ambiguity check for the type signature for ‘foo’:
foo :: Coercible Age Int => ()
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature for ‘foo’: foo :: Coercible Age Int => ()
```
I agree that module `B` can't directly prove `Coercible Age Int`. But `ageCo` is in scope which proves exactly this! So it is provable, albeit indirectly. GHC should not claim that the code is inaccessible.
Proposed fix: in `canDecomposableTyConApp`, only call `canEqHardFailure` for a representational equality when both tycons involved say `True` to `isDistinctTyCon`.
I'm happy to put the fix in, once someone seconds this idea. Getting this right has proved harder than I thought!8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10494Representational equalities over AppTys are not hard failures2019-07-07T18:35:40ZRichard Eisenbergrae@richarde.devRepresentational equalities over AppTys are not hard failuresIf I say
```
module App where
import Data.Coerce
foo :: Coercible (a b) (c d) => a b -> c d
foo = undefined
```
I get
```
App.hs:5:8: error:
Couldn't match representation of type ‘a b’ with that of ‘c d’
Inaccessible code in...If I say
```
module App where
import Data.Coerce
foo :: Coercible (a b) (c d) => a b -> c d
foo = undefined
```
I get
```
App.hs:5:8: error:
Couldn't match representation of type ‘a b’ with that of ‘c d’
Inaccessible code in
the type signature for: foo :: Coercible (a b) (c d) => a b -> c d
In the ambiguity check for the type signature for ‘foo’:
foo :: forall (a :: * -> *) b (c :: * -> *) d.
Coercible (a b) (c d) =>
a b -> c d
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature for ‘foo’:
foo :: Coercible (a b) (c d) => a b -> c d
```
This is very silly, indeed.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.11 |
| 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":"Representational equalities over AppTys are not hard failures","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"goldfire"},"version":"7.11","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"If I say\r\n\r\n{{{\r\nmodule App where\r\n\r\nimport Data.Coerce\r\n\r\nfoo :: Coercible (a b) (c d) => a b -> c d\r\nfoo = undefined\r\n}}}\r\n\r\nI get\r\n\r\n{{{\r\nApp.hs:5:8: error:\r\n Couldn't match representation of type ‘a b’ with that of ‘c d’\r\n Inaccessible code in\r\n the type signature for: foo :: Coercible (a b) (c d) => a b -> c d\r\n In the ambiguity check for the type signature for ‘foo’:\r\n foo :: forall (a :: * -> *) b (c :: * -> *) d.\r\n Coercible (a b) (c d) =>\r\n a b -> c d\r\n To defer the ambiguity check to use sites, enable AllowAmbiguousTypes\r\n In the type signature for ‘foo’:\r\n foo :: Coercible (a b) (c d) => a b -> c d\r\n}}}\r\n\r\nThis is very silly, indeed.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10589Core Lint error with LambdaCase2019-07-07T18:35:07ZRichard Eisenbergrae@richarde.devCore Lint error with LambdaCaseWhen I say
```
{-# LANGUAGE LambdaCase, TypeFamilies #-}
type family F a where
F a = Bool -> a
foo = (\case True -> 5
False -> 6) :: F Int
```
`-dcore-lint` tells me
```
*** Core Lint errors : in result of Desugar (af...When I say
```
{-# LANGUAGE LambdaCase, TypeFamilies #-}
type family F a where
F a = Bool -> a
foo = (\case True -> 5
False -> 6) :: F Int
```
`-dcore-lint` tells me
```
*** Core Lint errors : in result of Desugar (after optimization) ***
/Users/rae/temp/Bug.hs:6:1: Warning:
[RHS of foo :: Bool -> Int]
From-type of Cast differs from type of enclosed expression
...
```
The problem is a missing `mkTcSymCo` in the relevant bit of `tcExpr`.
Will fix in ongoing work.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 7.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Core Lint error with LambdaCase","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"goldfire"},"version":"7.10.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When I say\r\n\r\n{{{\r\n{-# LANGUAGE LambdaCase, TypeFamilies #-}\r\n\r\ntype family F a where\r\n F a = Bool -> a\r\n\r\nfoo = (\\case True -> 5\r\n False -> 6) :: F Int\r\n}}}\r\n\r\n`-dcore-lint` tells me\r\n\r\n{{{\r\n*** Core Lint errors : in result of Desugar (after optimization) ***\r\n/Users/rae/temp/Bug.hs:6:1: Warning:\r\n [RHS of foo :: Bool -> Int]\r\n From-type of Cast differs from type of enclosed expression\r\n...\r\n}}}\r\n\r\nThe problem is a missing `mkTcSymCo` in the relevant bit of `tcExpr`.\r\n\r\nWill fix in ongoing work.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10642Coercible regression from 7.10 to HEAD2019-07-07T18:34:54ZdarchonCoercible regression from 7.10 to HEADThis started out with code that compiled on 7.10, but fails on HEAD (20150711):
```
{-# LANGUAGE TypeFamilies, StandaloneDeriving, UndecidableInstances #-}
module StandaloneDeriving where
type family F a
newtype D a = D (F a)
-- | Th...This started out with code that compiled on 7.10, but fails on HEAD (20150711):
```
{-# LANGUAGE TypeFamilies, StandaloneDeriving, UndecidableInstances #-}
module StandaloneDeriving where
type family F a
newtype D a = D (F a)
-- | This works on 7.10.1 and HEAD (20150711)
deriving instance Eq (F a) => Eq (D a)
-- | This works on 7.10.1, but fails on HEAD (20150711)
deriving instance Bounded (F a) => Bounded (D a)
```
which fails on HEAD with:
```
GHCi, version 7.11.20150711: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling StandaloneDeriving ( StandaloneDeriving.hs, interpreted )
StandaloneDeriving.hs:12:1: error:
Couldn't match representation of type ‘a0’ with that of ‘F a’
arising from a use of ‘coerce’
Relevant bindings include
minBound :: D a (bound at StandaloneDeriving.hs:12:1)
In the expression: coerce (minBound :: F a) :: D a
In an equation for ‘minBound’:
minBound = coerce (minBound :: F a) :: D a
When typechecking the code for ‘minBound’
in a derived instance for ‘Bounded (D a)’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Bounded (D a)’
StandaloneDeriving.hs:12:1: error:
Couldn't match representation of type ‘a1’ with that of ‘F a’
arising from a use of ‘coerce’
Relevant bindings include
maxBound :: D a (bound at StandaloneDeriving.hs:12:1)
In the expression: coerce (maxBound :: F a) :: D a
In an equation for ‘maxBound’:
maxBound = coerce (maxBound :: F a) :: D a
When typechecking the code for ‘maxBound’
in a derived instance for ‘Bounded (D a)’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Bounded (D a)’
Failed, modules loaded: none.
```
Which I managed to reduce to:
```
{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
module CoerceFail where
import Data.Coerce
type family F a
newtype D a = D (F a)
-- | This works on 7.10.1, but fails on HEAD (20150711)
coerceD :: Coercible (F a) (D a) => F a -> D a
coerceD = coerce
```
Which also works on 7.10.1 but fails on HEAD with:
```
GHCi, version 7.11.20150711: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling CoerceFail ( CoerceFail.hs, interpreted )
CoerceFail.hs:12:11: error:
Couldn't match representation of type ‘a0’ with that of ‘F a’
arising from a use of ‘coerce’
Relevant bindings include
coerceD :: F a -> D a (bound at CoerceFail.hs:12:1)
In the expression: coerce
In an equation for ‘coerceD’: coerceD = coerce
```
I don't know if this was never supposed to work, and the behaviour on HEAD is correct, or, if this is truly a regression from 7.10 to HEAD.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.11 |
| 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":"Coercible regression from 7.10 to HEAD","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.11","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This started out with code that compiled on 7.10, but fails on HEAD (20150711):\r\n\r\n{{{\r\n{-# LANGUAGE TypeFamilies, StandaloneDeriving, UndecidableInstances #-}\r\nmodule StandaloneDeriving where\r\n\r\ntype family F a\r\n\r\nnewtype D a = D (F a)\r\n\r\n-- | This works on 7.10.1 and HEAD (20150711)\r\nderiving instance Eq (F a) => Eq (D a)\r\n\r\n-- | This works on 7.10.1, but fails on HEAD (20150711)\r\nderiving instance Bounded (F a) => Bounded (D a)\r\n}}}\r\n\r\nwhich fails on HEAD with:\r\n\r\n{{{\r\nGHCi, version 7.11.20150711: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling StandaloneDeriving ( StandaloneDeriving.hs, interpreted )\r\n\r\nStandaloneDeriving.hs:12:1: error:\r\n Couldn't match representation of type ‘a0’ with that of ‘F a’\r\n arising from a use of ‘coerce’\r\n Relevant bindings include\r\n minBound :: D a (bound at StandaloneDeriving.hs:12:1)\r\n In the expression: coerce (minBound :: F a) :: D a\r\n In an equation for ‘minBound’:\r\n minBound = coerce (minBound :: F a) :: D a\r\n When typechecking the code for ‘minBound’\r\n in a derived instance for ‘Bounded (D a)’:\r\n To see the code I am typechecking, use -ddump-deriv\r\n In the instance declaration for ‘Bounded (D a)’\r\n\r\nStandaloneDeriving.hs:12:1: error:\r\n Couldn't match representation of type ‘a1’ with that of ‘F a’\r\n arising from a use of ‘coerce’\r\n Relevant bindings include\r\n maxBound :: D a (bound at StandaloneDeriving.hs:12:1)\r\n In the expression: coerce (maxBound :: F a) :: D a\r\n In an equation for ‘maxBound’:\r\n maxBound = coerce (maxBound :: F a) :: D a\r\n When typechecking the code for ‘maxBound’\r\n in a derived instance for ‘Bounded (D a)’:\r\n To see the code I am typechecking, use -ddump-deriv\r\n In the instance declaration for ‘Bounded (D a)’\r\nFailed, modules loaded: none.\r\n}}}\r\n\r\nWhich I managed to reduce to:\r\n\r\n{{{\r\n{-# LANGUAGE TypeFamilies, FlexibleContexts #-}\r\nmodule CoerceFail where\r\n\r\nimport Data.Coerce\r\n\r\ntype family F a\r\n\r\nnewtype D a = D (F a)\r\n\r\n-- | This works on 7.10.1, but fails on HEAD (20150711)\r\ncoerceD :: Coercible (F a) (D a) => F a -> D a\r\ncoerceD = coerce\r\n}}}\r\n\r\nWhich also works on 7.10.1 but fails on HEAD with:\r\n\r\n{{{\r\nGHCi, version 7.11.20150711: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling CoerceFail ( CoerceFail.hs, interpreted )\r\n\r\nCoerceFail.hs:12:11: error:\r\n Couldn't match representation of type ‘a0’ with that of ‘F a’\r\n arising from a use of ‘coerce’\r\n Relevant bindings include\r\n coerceD :: F a -> D a (bound at CoerceFail.hs:12:1)\r\n In the expression: coerce\r\n In an equation for ‘coerceD’: coerceD = coerce\r\n}}}\r\n\r\nI don't know if this was never supposed to work, and the behaviour on HEAD is correct, or, if this is truly a regression from 7.10 to HEAD.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10811Template Haskell does associated types poorly (printing & quoting)2019-07-07T18:33:46ZRichard Eisenbergrae@richarde.devTemplate Haskell does associated types poorly (printing & quoting)When I say
```
{-# LANGUAGE TemplateHaskell, TypeFamilies #-}
{-# OPTIONS_GHC -ddump-splices -dsuppress-uniques #-}
module Bug where
$([d| class C a where
type F a
type F a = a |])
```
I get
```
[d| class C a whe...When I say
```
{-# LANGUAGE TemplateHaskell, TypeFamilies #-}
{-# OPTIONS_GHC -ddump-splices -dsuppress-uniques #-}
module Bug where
$([d| class C a where
type F a
type F a = a |])
```
I get
```
[d| class C a where
type family F a
F a = a |]
======>
Bug.hs:6:7: Warning:
Cannot desugar this Template Haskell declaration:
class C a where
type family F a
F a = a
```
There are two problems here:
1. This really should work.
1. The pretty-printer here omits the `type` on the default definition for `F`. (The word `family` is optional there, but isn't actually wrong.)
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 7.10.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Template Haskell does associated types poorly (printing & quoting)","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"7.12.1","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"goldfire"},"version":"7.10.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When I say\r\n\r\n{{{\r\n{-# LANGUAGE TemplateHaskell, TypeFamilies #-}\r\n{-# OPTIONS_GHC -ddump-splices -dsuppress-uniques #-}\r\n\r\nmodule Bug where\r\n\r\n$([d| class C a where\r\n type F a\r\n type F a = a |])\r\n}}}\r\n\r\nI get\r\n\r\n{{{\r\n [d| class C a where\r\n type family F a\r\n F a = a |]\r\n ======>\r\n\r\nBug.hs:6:7: Warning:\r\n Cannot desugar this Template Haskell declaration:\r\n class C a where\r\n type family F a\r\n F a = a\r\n}}}\r\n\r\nThere are two problems here:\r\n\r\n1. This really should work.\r\n\r\n2. The pretty-printer here omits the `type` on the default definition for `F`. (The word `family` is optional there, but isn't actually wrong.)","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10815Need more kind inference in associated type instances2019-07-07T18:33:45ZRichard Eisenbergrae@richarde.devNeed more kind inference in associated type instancesWhen I say
```
{-# LANGUAGE DataKinds, PolyKinds, TypeFamilies #-}
module Bug where
import Data.Proxy
class kproxy ~ 'KProxy => C (kproxy :: KProxy k) where
type F (a :: k)
instance C ('KProxy :: KProxy Bool) where
type F a = In...When I say
```
{-# LANGUAGE DataKinds, PolyKinds, TypeFamilies #-}
module Bug where
import Data.Proxy
class kproxy ~ 'KProxy => C (kproxy :: KProxy k) where
type F (a :: k)
instance C ('KProxy :: KProxy Bool) where
type F a = Int
```
I get
```
Type indexes must match class instance head
Found ‘k’ but expected ‘Bool’
In the type instance declaration for ‘F’
In the instance declaration for ‘C (KProxy :: KProxy Bool)’
```
But the kind of `a` should really be known to be `Bool`.
This ticket is broken out from [ticket:9063\#comment:82569](https://gitlab.haskell.org//ghc/ghc/issues/9063#note_82569), which was evidently not addressed when fixing that ticket.
Patch coming soon.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 7.10.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Need more kind inference in associated type instances","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"goldfire"},"version":"7.10.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When I say\r\n\r\n{{{\r\n{-# LANGUAGE DataKinds, PolyKinds, TypeFamilies #-}\r\n\r\nmodule Bug where\r\n\r\nimport Data.Proxy\r\n\r\nclass kproxy ~ 'KProxy => C (kproxy :: KProxy k) where\r\n type F (a :: k)\r\n\r\ninstance C ('KProxy :: KProxy Bool) where\r\n type F a = Int\r\n}}}\r\n\r\nI get\r\n\r\n{{{\r\n Type indexes must match class instance head\r\n Found ‘k’ but expected ‘Bool’\r\n In the type instance declaration for ‘F’\r\n In the instance declaration for ‘C (KProxy :: KProxy Bool)’\r\n}}}\r\n\r\nBut the kind of `a` should really be known to be `Bool`.\r\n\r\nThis ticket is broken out from comment:3:ticket:9063, which was evidently not addressed when fixing that ticket.\r\n\r\nPatch coming soon.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/10872More informative assertion for non-unique TH names2019-07-07T18:33:24ZJan Stolarekjan.stolarek@ed.ac.ukMore informative assertion for non-unique TH namesLet's say that by accident I have duplicated uniques of Template Haskell built-in identifiers defined in `THNames` module:
```hs
returnQIdKey = mkPreludeMiscIdUnique 200
bindQIdKey = mkPreludeMiscIdUnique 200
```
If I h...Let's say that by accident I have duplicated uniques of Template Haskell built-in identifiers defined in `THNames` module:
```hs
returnQIdKey = mkPreludeMiscIdUnique 200
bindQIdKey = mkPreludeMiscIdUnique 200
```
If I have a debugging build (`-DDEBUG`) and start a GHCi session it crashes immediately with a very uninformative error message:
```
GHCi, version 7.11.20150903: http://www.haskell.org/ghc/ :? for help
<interactive>:1:1: error:
Bad interface file: /dane/projekty/ghc/build/libraries/base/dist-install/build/Prelude.hi
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 7.11.20150903 for x86_64-unknown-linux):
ASSERT failed!
<<details unavailable>>
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
I have no idea where this assertion comes from as it gives absolutely no clue as to what caused the problem. During ICFP this costed me and Richard a total of around 6 man-hours. We should replace that assertion with something more meaningful. One thing we could do is add an assertion to the definition of `THNames.templateHaskellNames` that makes sure that `length templateHaskellNames == length (nub templateHaskellNames)`. That by itself is very simple but the problem is that the uninformative assertion given above still kicks in first.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.11 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"More informative assertion for non-unique TH names","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.11","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"Let's say that by accident I have duplicated uniques of Template Haskell built-in identifiers defined in `THNames` module:\r\n\r\n{{{#!hs\r\nreturnQIdKey = mkPreludeMiscIdUnique 200\r\nbindQIdKey = mkPreludeMiscIdUnique 200\r\n}}}\r\nIf I have a debugging build (`-DDEBUG`) and start a GHCi session it crashes immediately with a very uninformative error message:\r\n\r\n{{{\r\nGHCi, version 7.11.20150903: http://www.haskell.org/ghc/ :? for help\r\n\r\n<interactive>:1:1: error:\r\n Bad interface file: /dane/projekty/ghc/build/libraries/base/dist-install/build/Prelude.hi\r\n ghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 7.11.20150903 for x86_64-unknown-linux):\r\n ASSERT failed!\r\n<<details unavailable>>\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nI have no idea where this assertion comes from as it gives absolutely no clue as to what caused the problem. During ICFP this costed me and Richard a total of around 6 man-hours. We should replace that assertion with something more meaningful. One thing we could do is add an assertion to the definition of `THNames.templateHaskellNames` that makes sure that `length templateHaskellNames == length (nub templateHaskellNames)`. That by itself is very simple but the problem is that the uninformative assertion given above still kicks in first.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/11232Panic whilst compiling syb due to OptCoercion2019-07-07T18:31:21ZMatthew PickeringPanic whilst compiling syb due to OptCoercionHere is the minimised test case with most definitions inlined.
```
module Data.Generics.Aliases where
import Control.Monad
import Data.Data
mkMp :: ( MonadPlus m
, Typeable a
, Typeable b
)
=> (b -> m b)
...Here is the minimised test case with most definitions inlined.
```
module Data.Generics.Aliases where
import Control.Monad
import Data.Data
mkMp :: ( MonadPlus m
, Typeable a
, Typeable b
)
=> (b -> m b)
-> a
-> m a
mkMp ext = unM (maybe (M (const mzero)) id (gcast (M ext)))
newtype M m x = M { unM :: x -> m x }
```
Panics with `-O2` as follows,
```
~/Documents/haskell/syb-0.6:ghc-7.11.20151214 Aliases.hs -O2
[1 of 1] Compiling Data.Generics.Aliases ( Aliases.hs, Aliases.o )
ghc: panic! (the 'impossible' happened)
(GHC version 7.11.20151214 for x86_64-apple-darwin):
ASSERT failed! file compiler/types/OptCoercion.hs, line 234
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.10.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | goldfire |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Panic whilst compiling syb due to OptCoercion","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["goldfire"],"type":"Bug","description":"Here is the minimised test case with most definitions inlined. \r\n\r\n{{{\r\n\r\nmodule Data.Generics.Aliases where\r\n\r\nimport Control.Monad\r\nimport Data.Data\r\n\r\nmkMp :: ( MonadPlus m\r\n , Typeable a\r\n , Typeable b\r\n )\r\n => (b -> m b)\r\n -> a\r\n -> m a\r\nmkMp ext = unM (maybe (M (const mzero)) id (gcast (M ext)))\r\n\r\nnewtype M m x = M { unM :: x -> m x }\r\n}}}\r\n\r\nPanics with `-O2` as follows, \r\n\r\n{{{\r\n~/Documents/haskell/syb-0.6:ghc-7.11.20151214 Aliases.hs -O2\r\n[1 of 1] Compiling Data.Generics.Aliases ( Aliases.hs, Aliases.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 7.11.20151214 for x86_64-apple-darwin):\r\n\tASSERT failed! file compiler/types/OptCoercion.hs, line 234\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/11241Kind-level PartialTypeSignatures causes internal error2019-07-07T18:31:19ZAdam GundryKind-level PartialTypeSignatures causes internal errorConsider the following module:
```hs
{-# LANGUAGE ExplicitForAll, KindSignatures, PartialTypeSignatures #-}
foo :: forall (a :: _) . a -> a
foo = id
```
In HEAD, this fails with an internal errror:
```
• GHC internal error: ‘_’...Consider the following module:
```hs
{-# LANGUAGE ExplicitForAll, KindSignatures, PartialTypeSignatures #-}
foo :: forall (a :: _) . a -> a
foo = id
```
In HEAD, this fails with an internal errror:
```
• GHC internal error: ‘_’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: []
• In the kind ‘_’
In the type signature:
foo :: forall (a :: _). a -> a
```
I would expect it to succeed and figure out that the wildcard is `*`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 7.11 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | goldfire |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Kind-level PartialTypeSignatures causes internal error","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.11","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["goldfire"],"type":"Bug","description":"Consider the following module:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE ExplicitForAll, KindSignatures, PartialTypeSignatures #-}\r\n\r\nfoo :: forall (a :: _) . a -> a \r\nfoo = id \r\n}}}\r\n\r\nIn HEAD, this fails with an internal errror:\r\n\r\n{{{\r\n • GHC internal error: ‘_’ is not in scope during type checking, but it passed the renamer\r\n tcl_env of environment: []\r\n • In the kind ‘_’\r\n In the type signature:\r\n foo :: forall (a :: _). a -> a\r\n}}}\r\n\r\nI would expect it to succeed and figure out that the wildcard is `*`.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/11246Regression typechecking type synonym which includes `Any`.2019-07-07T18:31:17ZMatthew PickeringRegression typechecking type synonym which includes `Any`.```hs
module Foo where
import GHC.Exts
type Key a = Any
```
produces the error message on HEAD but compiles on 7.8.3 and 7.10.1 (thanks to Reid for testing).
```
unsafeany.hs:5:1: error:
• The type family ‘Any’ should have no arg...```hs
module Foo where
import GHC.Exts
type Key a = Any
```
produces the error message on HEAD but compiles on 7.8.3 and 7.10.1 (thanks to Reid for testing).
```
unsafeany.hs:5:1: error:
• The type family ‘Any’ should have no arguments, but has been given none
• In the type synonym declaration for ‘Key’
Failed, modules loaded: none.
```8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/11252:kind command hides the explicit kind2019-07-07T18:31:15ZIcelandjack:kind command hides the explicit kind```hs
-- /tmp/test.hs
{-# LANGUAGE TypeInType #-}
data Proxy1 k (a :: k) = P1
data Proxy2 (a :: k) = P2
```
if I load the following into ghci (head) the `:kind` command gives the same result
```haskell
% ghci -ignore-dot-ghci /tmp/t...```hs
-- /tmp/test.hs
{-# LANGUAGE TypeInType #-}
data Proxy1 k (a :: k) = P1
data Proxy2 (a :: k) = P2
```
if I load the following into ghci (head) the `:kind` command gives the same result
```haskell
% ghci -ignore-dot-ghci /tmp/test.hs
GHCi, version 7.11.20151216: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( test.hs, interpreted )
Ok, modules loaded: Main.
*Main> :kind Proxy1
Proxy1 :: k -> *
*Main> :kind Proxy2
Proxy2 :: k -> *
```
edit: I asked on \#ghc, was told this was undesirable8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/11254GHC panic2019-07-07T18:31:15ZIcelandjackGHC panicI like to mix features to make code fail, code inspired by [T10318](https://phabricator.haskell.org/diffusion/GHC/browse/master/testsuite/tests/indexed-types/should_compile/T10318.hs$1):
```hs
-- /tmp/panic.hs
{-# LANGUAGE FlexibleConte...I like to mix features to make code fail, code inspired by [T10318](https://phabricator.haskell.org/diffusion/GHC/browse/master/testsuite/tests/indexed-types/should_compile/T10318.hs$1):
```hs
-- /tmp/panic.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
class (Frac (Frac a) ~ Frac a, Fractional (Frac a), ID (Frac a)) => ID a where
type Frac a
embed :: a -> Frac a
instance ID Rational where
type Frac Rational = Int
embed :: Rational -> Rational
embed = undefined
```
When running it with `defer-type-errors` it causes GHC to panic:
```hs
% ghci -fdefer-type-errors -ignore-dot-ghci panic.hs &> panic.log
```
actual error included in panic.log.
GHC asks me to report this as a bug and I do as I'm told.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.11 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC panic","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.11","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I like to mix features to make code fail, code inspired by [https://phabricator.haskell.org/diffusion/GHC/browse/master/testsuite/tests/indexed-types/should_compile/T10318.hs$1 T10318]:\r\n\r\n{{{#!hs\r\n-- /tmp/panic.hs\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE InstanceSigs #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeSynonymInstances #-}\r\n{-# LANGUAGE UndecidableSuperClasses #-}\r\n\r\nclass (Frac (Frac a) ~ Frac a, Fractional (Frac a), ID (Frac a)) => ID a where\r\n type Frac a\r\n embed :: a -> Frac a\r\n\r\ninstance ID Rational where\r\n type Frac Rational = Int\r\n embed :: Rational -> Rational\r\n embed = undefined\r\n}}}\r\n\r\nWhen running it with `defer-type-errors` it causes GHC to panic:\r\n\r\n{{{#!hs\r\n% ghci -fdefer-type-errors -ignore-dot-ghci panic.hs &> panic.log\r\n}}}\r\n\r\nactual error included in panic.log. \r\nGHC asks me to report this as a bug and I do as I'm told.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.dev