GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:03:09Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/15748panic2019-07-07T18:03:09Zawfpanic```
GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help
Prelude> :print getChar >>= return
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-mingw32):
isUnliftedType
t1_a1tM[rt] :: TY...```
GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help
Prelude> :print getChar >>= return
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-mingw32):
isUnliftedType
t1_a1tM[rt] :: TYPE t_a1tL[rt]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\utils\Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler\\types\\Type.hs:1939:10 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"panic","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\r\nGHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help\r\nPrelude> :print getChar >>= return\r\nghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-unknown-mingw32):\r\n isUnliftedType\r\n t1_a1tM[rt] :: TYPE t_a1tL[rt]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler\\utils\\Outputable.hs:1150:37 in ghc:Outputable\r\n pprPanic, called at compiler\\\\types\\\\Type.hs:1939:10 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15749Long Harbormaster builds2019-07-07T18:03:09ZKrzysztof GogolewskiLong Harbormaster buildsHarbormaster builds sometimes take too long and are not terminated. For example, the following builds have been running for over 2 days:
https://phabricator.haskell.org/harbormaster/build/54452/
https://phabricator.haskell.org/harborma...Harbormaster builds sometimes take too long and are not terminated. For example, the following builds have been running for over 2 days:
https://phabricator.haskell.org/harbormaster/build/54452/
https://phabricator.haskell.org/harbormaster/build/54477/
https://phabricator.haskell.org/harbormaster/build/54485/
We should have some timeout (or lower the threshold if it's already present).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Continuous Integration |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Long Harbormaster builds","status":"New","operating_system":"","component":"Continuous Integration","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"bgamari"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Harbormaster builds sometimes take too long and are not terminated. For example, the following builds have been running for over 2 days:\r\n\r\nhttps://phabricator.haskell.org/harbormaster/build/54452/\r\n\r\nhttps://phabricator.haskell.org/harbormaster/build/54477/\r\n\r\nhttps://phabricator.haskell.org/harbormaster/build/54485/\r\n\r\nWe should have some timeout (or lower the threshold if it's already present).","type_of_failure":"OtherFailure","blocking":[]} -->Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/15750Investigate haddock.base perf test2019-07-07T18:03:08ZRichard Eisenbergrae@richarde.devInvestigate haddock.base perf testI've seen failures in the `haddock.base` perf test when making changes that really should have no effect on performance. My guess is that this perf test is sitting right on the line of the acceptable range. We should confirm this hunch a...I've seen failures in the `haddock.base` perf test when making changes that really should have no effect on performance. My guess is that this perf test is sitting right on the line of the acceptable range. We should confirm this hunch and then update the values to recenter the range.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Test Suite |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Investigate haddock.base perf test","status":"New","operating_system":"","component":"Test Suite","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"I've seen failures in the `haddock.base` perf test when making changes that really should have no effect on performance. My guess is that this perf test is sitting right on the line of the acceptable range. We should confirm this hunch and then update the values to recenter the range.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15754Move free variable computation to after STG passes2019-07-07T18:03:07ZBen GamariMove free variable computation to after STG passesCurrently (we believe) `CoreToStg` is responsible for computing free variables. However, later STG transformations may invalidate this information.
It would make more sense to defer FV computation until the end of the STG pipeline.Currently (we believe) `CoreToStg` is responsible for computing free variables. However, later STG transformations may invalidate this information.
It would make more sense to defer FV computation until the end of the STG pipeline.8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15755randomRIO panic on (GHC version 8.4.3 for x86_64-apple-darwin)2019-07-07T18:03:07ZcmalrandomRIO panic on (GHC version 8.4.3 for x86_64-apple-darwin) randomRIO (1,100)
ghc: panic! (the 'impossible' happened)
> (GHC version 8.4.3 for x86_64-apple-darwin):
nameModule
system $dShow_a78p
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputab... randomRIO (1,100)
ghc: panic! (the 'impossible' happened)
> (GHC version 8.4.3 for x86_64-apple-darwin):
nameModule
system $dShow_a78p
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
> pprPanic, called at compiler/basicTypes/Name.hs:241:3 in ghc:Name
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabughttps://gitlab.haskell.org/ghc/ghc/-/issues/15757Coercion Variable Almost Devoid Checking in ForAllCo2019-07-07T18:03:07ZNingning XieCoercion Variable Almost Devoid Checking in ForAllCoIn [Richard's thesis](https://repository.brynmawr.edu/cgi/viewcontent.cgi?article=1074&context=compsci_pubs/) Section 5.8.5.2, there is a restriction on where a coercion variable can appear in `ForAllCo` for the sake of consistency: the ...In [Richard's thesis](https://repository.brynmawr.edu/cgi/viewcontent.cgi?article=1074&context=compsci_pubs/) Section 5.8.5.2, there is a restriction on where a coercion variable can appear in `ForAllCo` for the sake of consistency: the coercion variable can appear nowhere except in coherence coercions.
Currently this restriction is missing in coercion quantification (see #15497). The goal of this ticket is to add the missing restriction.
After discussion with Richard, we restate the restriction a little bit: the coercion variable can appear nowhere except in `GRefl` and `Refl`. Allowing it to appear in `Refl` should not break consistency.
Notice that this also means `liftCoSubst` might fail when it lifts a `ForAllTy` over a coercion variable to a `ForAllCo`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Coercion Variable Almost Devoid Checking in ForAllCo","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"In [https://repository.brynmawr.edu/cgi/viewcontent.cgi?article=1074&context=compsci_pubs/ Richard's thesis] Section 5.8.5.2, there is a restriction on where a coercion variable can appear in `ForAllCo` for the sake of consistency: the coercion variable can appear nowhere except in coherence coercions.\r\n\r\nCurrently this restriction is missing in coercion quantification (see #15497). The goal of this ticket is to add the missing restriction.\r\n\r\nAfter discussion with Richard, we restate the restriction a little bit: the coercion variable can appear nowhere except in `GRefl` and `Refl`. Allowing it to appear in `Refl` should not break consistency.\r\n\r\nNotice that this also means `liftCoSubst` might fail when it lifts a `ForAllTy` over a coercion variable to a `ForAllCo`.","type_of_failure":"OtherFailure","blocking":[]} -->Ningning XieNingning Xiehttps://gitlab.haskell.org/ghc/ghc/-/issues/15758hsc2hs broken due to incorrect argument passing to the hsc2hs executable2019-07-07T18:03:07ZÖmer Sinan Ağacanhsc2hs broken due to incorrect argument passing to the hsc2hs executableCurrently packages with .hsc files can't be built with GHC HEAD on some systems
becuase of a problem in hsc2hs wrapper script. I don't understand the problem
good enough, but we did some debugging with hvr today and he asked me to file a...Currently packages with .hsc files can't be built with GHC HEAD on some systems
becuase of a problem in hsc2hs wrapper script. I don't understand the problem
good enough, but we did some debugging with hvr today and he asked me to file a
ticket. Here's how to reproduce:
```
regex-posix-0.95.2 $ cabal new-build --with-ghc=/home/omer/haskell/ghc/inplace/bin/ghc-stage2
Warning: Unknown/unsupported 'ghc' version detected (Cabal 2.4.0.1 supports
'ghc' version < 8.7): /home/omer/haskell/ghc/inplace/bin/ghc-stage2 is version
8.7.20181017
Warning: The package list for 'hackage.haskell.org' is 22 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Build profile: -w ghc-8.7.20181017 -O1
In order, the following will be built (use -v for more details):
- regex-posix-0.95.2 (lib:regex-posix) (first run)
Warning: regex-posix.cabal:6:1: The field "build-type" is specified more than
once at positions 6:1, 19:1
Configuring regex-posix-0.95.2...
Preprocessing library for regex-posix-0.95.2..
hsc2hs: @/home/omer/haskell/regex-posix-0.95.2/dist-newstyle/build/x86_64-linux/ghc-8.7.20181017/regex-posix-0.95.2/build/Text/Regex/Posix/hsc2hs-response17101-2.txt: openBinaryFile: does not exist (No such file or directory)
```
As far as I understand, the problem is that the script runs `hsc2hs -- @foo` instead of `hsc2hs @foo`. Hopefully hvr will correct if I misunderstood.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"hsc2hs broken due to incorrect argument passing to the hsc2hs executable","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Currently packages with .hsc files can't be built with GHC HEAD on some systems\r\nbecuase of a problem in hsc2hs wrapper script. I don't understand the problem\r\ngood enough, but we did some debugging with hvr today and he asked me to file a\r\nticket. Here's how to reproduce:\r\n\r\n{{{\r\nregex-posix-0.95.2 $ cabal new-build --with-ghc=/home/omer/haskell/ghc/inplace/bin/ghc-stage2\r\nWarning: Unknown/unsupported 'ghc' version detected (Cabal 2.4.0.1 supports\r\n'ghc' version < 8.7): /home/omer/haskell/ghc/inplace/bin/ghc-stage2 is version\r\n8.7.20181017\r\nWarning: The package list for 'hackage.haskell.org' is 22 days old.\r\nRun 'cabal update' to get the latest list of available packages.\r\nResolving dependencies...\r\nBuild profile: -w ghc-8.7.20181017 -O1\r\nIn order, the following will be built (use -v for more details):\r\n - regex-posix-0.95.2 (lib:regex-posix) (first run)\r\nWarning: regex-posix.cabal:6:1: The field \"build-type\" is specified more than\r\nonce at positions 6:1, 19:1\r\nConfiguring regex-posix-0.95.2...\r\nPreprocessing library for regex-posix-0.95.2..\r\nhsc2hs: @/home/omer/haskell/regex-posix-0.95.2/dist-newstyle/build/x86_64-linux/ghc-8.7.20181017/regex-posix-0.95.2/build/Text/Regex/Posix/hsc2hs-response17101-2.txt: openBinaryFile: does not exist (No such file or directory)\r\n}}}\r\n\r\nAs far as I understand, the problem is that the script runs `hsc2hs -- @foo` instead of `hsc2hs @foo`. Hopefully hvr will correct if I misunderstood.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15761pprFamInstLHS drops parentheses2019-07-07T18:03:06ZRichard Eisenbergrae@richarde.devpprFamInstLHS drops parenthesesIf I say
```hs
data family (a + b) c d
data instance (Int + Bool) Double = Float
```
GHC says
```
• Expecting one more argument to ‘Int + Bool Double’
Expected a type, but ‘Int + Bool Double’ has kind ‘* -> *’
• In the ...If I say
```hs
data family (a + b) c d
data instance (Int + Bool) Double = Float
```
GHC says
```
• Expecting one more argument to ‘Int + Bool Double’
Expected a type, but ‘Int + Bool Double’ has kind ‘* -> *’
• In the data instance declaration for ‘+’
```
Note the missing parens in the first line of the error.
Will fix shortly.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"pprFamInstLHS drops parentheses","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"If I say\r\n\r\n{{{#!hs\r\ndata family (a + b) c d\r\n\r\ndata instance (Int + Bool) Double = Float\r\n}}}\r\n\r\nGHC says\r\n\r\n{{{\r\n • Expecting one more argument to ‘Int + Bool Double’\r\n Expected a type, but ‘Int + Bool Double’ has kind ‘* -> *’\r\n • In the data instance declaration for ‘+’\r\n}}}\r\n\r\nNote the missing parens in the first line of the error.\r\n\r\nWill fix shortly.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15764GHC panic from PolyKinds + DataKinds2019-07-07T18:03:05ZIcelandjackGHC panic from PolyKinds + DataKindsPlaying around with GhcKinds/KindInference/Examples gives me a GHC panic
```hs
-- https://ghc.haskell.org/trac/ghc/wiki/GhcKinds/KindInference/Examples?version=4
{-# Language PolyKinds #-}
{-# Language KindSignatures #-}
{-# Language D...Playing around with GhcKinds/KindInference/Examples gives me a GHC panic
```hs
-- https://ghc.haskell.org/trac/ghc/wiki/GhcKinds/KindInference/Examples?version=4
{-# Language PolyKinds #-}
{-# Language KindSignatures #-}
{-# Language DataKinds #-}
import Data.Kind
import Data.Proxy
import GHC.TypeLits
class C6 (k :: Type) (a :: k) (b :: Proxy (a :: k)) where
type T6 (proxy :: Proxy '(k, b))
```
on an out of date version of HEAD I get
```
$ ghci -ignore-dot-ghci 519.hs
GHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 519.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20180828 for x86_64-unknown-linux):
ASSERT failed!
1
0
k_a1FD[tau:0]
Proxy a_a1EN[sk:1]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/utils/Outputable.hs:1219:5 in ghc:Outputable
assertPprPanic, called at compiler/typecheck/TcMType.hs:768:54 in ghc:TcMType
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC panic from PolyKinds + DataKinds","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Playing around with GhcKinds/KindInference/Examples gives me a GHC panic\r\n\r\n{{{#!hs\r\n-- https://ghc.haskell.org/trac/ghc/wiki/GhcKinds/KindInference/Examples?version=4\r\n\r\n{-# Language PolyKinds #-}\r\n{-# Language KindSignatures #-}\r\n{-# Language DataKinds #-}\r\n\r\nimport Data.Kind\r\nimport Data.Proxy\r\nimport GHC.TypeLits\r\n\r\nclass C6 (k :: Type) (a :: k) (b :: Proxy (a :: k)) where\r\n type T6 (proxy :: Proxy '(k, b))\r\n}}}\r\n\r\non an out of date version of HEAD I get\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci 519.hs\r\nGHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 519.hs, interpreted )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20180828 for x86_64-unknown-linux):\r\n ASSERT failed!\r\n 1\r\n 0\r\n k_a1FD[tau:0]\r\n Proxy a_a1EN[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/utils/Outputable.hs:1219:5 in ghc:Outputable\r\n assertPprPanic, called at compiler/typecheck/TcMType.hs:768:54 in ghc:TcMType\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n>\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15765Make the "extract" functions in RnTypes pure2019-07-07T18:03:05ZRichard Eisenbergrae@richarde.devMake the "extract" functions in RnTypes pureOnce upon a time, the `extract` functions at the bottom of RnTypes were pure. Then, along came `-XTypeInType`, which needed to do a check in these functions for users mixing type variables with kind variables. Now, however, with `-XTypeI...Once upon a time, the `extract` functions at the bottom of RnTypes were pure. Then, along came `-XTypeInType`, which needed to do a check in these functions for users mixing type variables with kind variables. Now, however, with `-XTypeInType` gone again, we no longer do this check. Thus, there is no reason to keep these functions monadic.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Make the \"extract\" functions in RnTypes pure","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"Once upon a time, the `extract` functions at the bottom of RnTypes were pure. Then, along came `-XTypeInType`, which needed to do a check in these functions for users mixing type variables with kind variables. Now, however, with `-XTypeInType` gone again, we no longer do this check. Thus, there is no reason to keep these functions monadic.","type_of_failure":"OtherFailure","blocking":[]} -->Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/15766GeneralizedNewtypeDeriving should support classes with ambiguous types2019-07-07T18:03:05ZreinerpGeneralizedNewtypeDeriving should support classes with ambiguous typesThe following module has a class with an ambiguous type:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Ambig where
class C a where
c :: Int
data A = A
instance C A where c = 5
newtyp...The following module has a class with an ambiguous type:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Ambig where
class C a where
c :: Int
data A = A
instance C A where c = 5
newtype B = B A deriving C
```
Thanks to TypeApplications, this typeclass is still usable. However, GeneralizedNewtypeDeriving fails on it:
```
Ambig.hs:12:26: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘c’
prevents the constraint ‘(C a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
These potential instances exist:
instance C A -- Defined at Ambig.hs:10:10
instance C B -- Defined at Ambig.hs:12:26
• In the third argument of ‘GHC.Prim.coerce’, namely ‘c’
In the expression: GHC.Prim.coerce @(Int) @(Int) c
In an equation for ‘c’: c = GHC.Prim.coerce @(Int) @(Int) c
When typechecking the code for ‘c’
in a derived instance for ‘C B’:
To see the code I am typechecking, use -ddump-deriv
|
12 | newtype B = B A deriving C
|
```
It shouldn't.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GeneralizedNewtypeDeriving should support classes with ambiguous types","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following module has a class with an ambiguous type:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE AllowAmbiguousTypes #-}\r\n{-# LANGUAGE GeneralizedNewtypeDeriving #-}\r\nmodule Ambig where\r\n\r\nclass C a where\r\n c :: Int\r\n\r\ndata A = A\r\n\r\ninstance C A where c = 5\r\n\r\nnewtype B = B A deriving C\r\n}}}\r\n\r\nThanks to TypeApplications, this typeclass is still usable. However, GeneralizedNewtypeDeriving fails on it:\r\n\r\n{{{\r\nAmbig.hs:12:26: error:\r\n • Ambiguous type variable ‘a0’ arising from a use of ‘c’\r\n prevents the constraint ‘(C a0)’ from being solved.\r\n Probable fix: use a type annotation to specify what ‘a0’ should be.\r\n These potential instances exist:\r\n instance C A -- Defined at Ambig.hs:10:10\r\n instance C B -- Defined at Ambig.hs:12:26\r\n • In the third argument of ‘GHC.Prim.coerce’, namely ‘c’\r\n In the expression: GHC.Prim.coerce @(Int) @(Int) c\r\n In an equation for ‘c’: c = GHC.Prim.coerce @(Int) @(Int) c\r\n When typechecking the code for ‘c’\r\n in a derived instance for ‘C B’:\r\n To see the code I am typechecking, use -ddump-deriv\r\n |\r\n12 | newtype B = B A deriving C\r\n | \r\n}}}\r\n\r\nIt shouldn't.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15767"StgCmmEnv: variable not found" with FunctionalDependencies and FlexibleContexts2019-07-07T18:03:05Zroland"StgCmmEnv: variable not found" with FunctionalDependencies and FlexibleContexts```
{-# LANGUAGE FunctionalDependencies, FlexibleContexts #-}
module Bug where
class C a b | b -> a where f :: a -> b
y = x where
x :: (C () b, C Bool b) => b
x = f ()
```
```
$ ghc -c Bug.hs
ghc: panic! (the 'impossible' happen...```
{-# LANGUAGE FunctionalDependencies, FlexibleContexts #-}
module Bug where
class C a b | b -> a where f :: a -> b
y = x where
x :: (C () b, C Bool b) => b
x = f ()
```
```
$ ghc -c Bug.hs
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-unknown-openbsd):
StgCmmEnv: variable not found
$dC_a1lC
local binds for:
f
$tc'C:C
$tcC
$trModule
$tc'C:C1_r1mz
$tc'C:C2_r1n0
$krep_r1n1
$krep1_r1n2
$krep2_r1n3
$krep3_r1n4
$krep4_r1n5
$tcC1_r1n6
$tcC2_r1n7
$krep5_r1n8
$krep6_r1n9
$krep7_r1na
$trModule1_r1nb
$trModule2_r1nc
$trModule3_r1nd
$trModule4_r1ne
$krep8_r1nf
$krep9_r1ng
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/codeGen/StgCmmEnv.hs:149:9 in ghc:StgCmmEnv
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"\"StgCmmEnv: variable not found\" with FunctionalDependencies and FlexibleContexts","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"\r\n{{{\r\n{-# LANGUAGE FunctionalDependencies, FlexibleContexts #-}\r\n\r\nmodule Bug where\r\n\r\nclass C a b | b -> a where f :: a -> b\r\n\r\ny = x where\r\n x :: (C () b, C Bool b) => b\r\n x = f ()\r\n}}}\r\n\r\n\r\n\r\n{{{\r\n$ ghc -c Bug.hs\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-unknown-openbsd):\r\n StgCmmEnv: variable not found\r\n $dC_a1lC\r\n local binds for:\r\n f\r\n $tc'C:C\r\n $tcC\r\n $trModule\r\n $tc'C:C1_r1mz\r\n $tc'C:C2_r1n0\r\n $krep_r1n1\r\n $krep1_r1n2\r\n $krep2_r1n3\r\n $krep3_r1n4\r\n $krep4_r1n5\r\n $tcC1_r1n6\r\n $tcC2_r1n7\r\n $krep5_r1n8\r\n $krep6_r1n9\r\n $krep7_r1na\r\n $trModule1_r1nb\r\n $trModule2_r1nc\r\n $trModule3_r1nd\r\n $trModule4_r1ne\r\n $krep8_r1nf\r\n $krep9_r1ng\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/codeGen/StgCmmEnv.hs:149:9 in ghc:StgCmmEnv\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15769GHC 8.6 for macOS depends on homebrew2019-07-07T18:03:04Zkazu-yamamotoGHC 8.6 for macOS depends on homebrewI guess the ghc-8.6.1-x86_64-apple-darwin.tar.xz is build with homebrew. So, it depends on homebrew's "libgmp".
Since I'm using MacPorts, the following error occurs on installation:
```
% sudo make install
"utils/ghc-cabal/dist-instal...I guess the ghc-8.6.1-x86_64-apple-darwin.tar.xz is build with homebrew. So, it depends on homebrew's "libgmp".
Since I'm using MacPorts, the following error occurs on installation:
```
% sudo make install
"utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" copy libraries/ghc-prim dist-install "strip" '' '/usr/local/ghc-8.6.1' '/usr/local/ghc-8.6.1/lib/ghc-8.6.1' '/usr/local/ghc-8.6.1/share/doc/ghc-8.6.1/html/libraries' 'v p dyn'
dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
Referenced from: /Users/kazu/Downloads/ghc-8.6.1/libraries/base/dist-install/build/libHSbase-4.12.0.0-ghc8.6.1.dylib
Reason: image not found
make[1]: *** [install_packages] Abort trap: 6
make: *** [install] Error 2
```
After make a link from "/usr/local/opt/gmp/lib/libgmp.10.dylib" to "/opt/local/lib/libgmp.10.dylib" installed by MacPorts, the installation succeeds.
But when using GHC 8.6.1, the following error occurs:
```
[15 of 15] Compiling Network.DNS ( Network/DNS.hs, dist/build/Network/DNS.o )
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)
cab: callCommand: cabal build (exit 1): failed
```
To fix this, the following is necessary:
```
% export LIBRARY_PATH=/usr/lib:/opt/local/lib
```
- "/usr/lib" is for "libiconv" and should come first to hide "/opt/local/lib/libiconv"
- "/opt/local/lib" is for "libgmp"
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"GHC 8.6 for macOS depends on homebrew","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.2","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I guess the ghc-8.6.1-x86_64-apple-darwin.tar.xz is build with homebrew. So, it depends on homebrew's \"libgmp\". \r\n\r\nSince I'm using MacPorts, the following error occurs on installation:\r\n\r\n{{{\r\n% sudo make install\r\n\r\n\"utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist\" copy libraries/ghc-prim dist-install \"strip\" '' '/usr/local/ghc-8.6.1' '/usr/local/ghc-8.6.1/lib/ghc-8.6.1' '/usr/local/ghc-8.6.1/share/doc/ghc-8.6.1/html/libraries' 'v p dyn' \r\ndyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib\r\n Referenced from: /Users/kazu/Downloads/ghc-8.6.1/libraries/base/dist-install/build/libHSbase-4.12.0.0-ghc8.6.1.dylib\r\n Reason: image not found\r\nmake[1]: *** [install_packages] Abort trap: 6\r\nmake: *** [install] Error 2\r\n}}}\r\n\r\nAfter make a link from \"/usr/local/opt/gmp/lib/libgmp.10.dylib\" to \"/opt/local/lib/libgmp.10.dylib\" installed by MacPorts, the installation succeeds.\r\n\r\nBut when using GHC 8.6.1, the following error occurs:\r\n\r\n{{{\r\n[15 of 15] Compiling Network.DNS ( Network/DNS.hs, dist/build/Network/DNS.o )\r\nld: library not found for -lgmp\r\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\r\n`gcc' failed in phase `Linker'. (Exit code: 1)\r\ncab: callCommand: cabal build (exit 1): failed\r\n}}}\r\n\r\nTo fix this, the following is necessary:\r\n\r\n{{{\r\n% export LIBRARY_PATH=/usr/lib:/opt/local/lib\r\n}}}\r\n\r\n- \"/usr/lib\" is for \"libiconv\" and should come first to hide \"/opt/local/lib/libiconv\"\r\n- \"/opt/local/lib\" is for \"libgmp\"\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15777Ordering of code in file affects compilation2019-07-07T18:03:03ZchessaiOrdering of code in file affects compilationconsider the following module:
```hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
-- | Conversion between unlifted and lifted datatypes
module Packed.Levity
( -- ...consider the following module:
```hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
-- | Conversion between unlifted and lifted datatypes
module Packed.Levity
( -- * Types
Rep
, Levity(..)
) where
import Data.Kind (Type)
import GHC.Types (TYPE, RuntimeRep(..), Int(..), Word(..))
import GHC.Exts (Int#, Word#, ByteArray#)
type family Rep (a :: Type) :: RuntimeRep
type instance Rep Int = IntRep
type instance Rep Word = WordRep
type Stuff# = (# Int#, Int# #)
data Stuff = Stuff Int# Int#
type instance Rep Stuff = TupleRep '[ 'IntRep, 'IntRep ]
stuff# :: (# Int#, Int# #) -> Stuff
stuff# (# x, y #) = Stuff x y
unStuff# :: Stuff -> (# Int#, Int# #)
unStuff# (Stuff x y) = (# x, y #)
class Levity (a :: Type) where
type Unlifted a :: TYPE (Rep a)
box :: Unlifted a -> a
unbox :: a -> Unlifted a
instance Levity Int where
type Unlifted Int = Int#
box = I#
unbox (I# i) = i
instance Levity Word where
type Unlifted Word = Word#
box = W#
unbox (W# w) = w
instance Levity Stuff where
type Unlifted Stuff = Stuff#
box = stuff#
unbox = unStuff#
```
This succeeds to compile.
Now, if we move everything from `type family Rep` to `unStuff# (` to the bottom of the module, it fails to compile.
```hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
-- | Conversion between unlifted and lifted datatypes
module Packed.Levity
( -- * Types
Rep
, Levity(..)
) where
import Data.Kind (Type)
import GHC.Types (TYPE, RuntimeRep(..), Int(..), Word(..))
import GHC.Exts (Int#, Word#, ByteArray#)
class Levity (a :: Type) where
type Unlifted a :: TYPE (Rep a)
box :: Unlifted a -> a
unbox :: a -> Unlifted a
instance Levity Int where
type Unlifted Int = Int#
box = I#
unbox (I# i) = i
instance Levity Word where
type Unlifted Word = Word#
box = W#
unbox (W# w) = w
instance Levity Stuff where
type Unlifted Stuff = Stuff#
box = stuff#
unbox = unStuff#
type family Rep (a :: Type) :: RuntimeRep
type instance Rep Int = IntRep
type instance Rep Word = WordRep
type Stuff# = (# Int#, Int# #)
data Stuff = Stuff Int# Int#
type instance Rep Stuff = TupleRep '[ 'IntRep, 'IntRep ]
stuff# :: (# Int#, Int# #) -> Stuff
stuff# (# x, y #) = Stuff x y
unStuff# :: Stuff -> (# Int#, Int# #)
unStuff# (Stuff x y) = (# x, y #)
```
```
ts.hs:33:25-30: error:
• Expected kind ‘TYPE (Rep Stuff)’,
but ‘Stuff#’ has kind ‘TYPE ('TupleRep '['IntRep, 'IntRep])’
• In the type ‘Stuff#’
In the type instance declaration for ‘Unlifted’
In the instance declaration for ‘Levity Stuff’
|
33 | type Unlifted Stuff = Stuff#
| ^^^^^^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Ordering of code in file affects compilation","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.2","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"consider the following module:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE MagicHash #-}\r\n{-# LANGUAGE UnboxedTuples #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n\r\n-- | Conversion between unlifted and lifted datatypes\r\nmodule Packed.Levity\r\n ( -- * Types\r\n Rep\r\n , Levity(..)\r\n ) where\r\n\r\nimport Data.Kind (Type)\r\nimport GHC.Types (TYPE, RuntimeRep(..), Int(..), Word(..))\r\nimport GHC.Exts (Int#, Word#, ByteArray#)\r\n\r\ntype family Rep (a :: Type) :: RuntimeRep\r\n\r\ntype instance Rep Int = IntRep\r\ntype instance Rep Word = WordRep\r\n\r\ntype Stuff# = (# Int#, Int# #)\r\n\r\ndata Stuff = Stuff Int# Int#\r\n\r\ntype instance Rep Stuff = TupleRep '[ 'IntRep, 'IntRep ]\r\n\r\nstuff# :: (# Int#, Int# #) -> Stuff\r\nstuff# (# x, y #) = Stuff x y\r\n\r\nunStuff# :: Stuff -> (# Int#, Int# #)\r\nunStuff# (Stuff x y) = (# x, y #)\r\n\r\nclass Levity (a :: Type) where\r\n type Unlifted a :: TYPE (Rep a)\r\n box :: Unlifted a -> a\r\n unbox :: a -> Unlifted a\r\n\r\ninstance Levity Int where\r\n type Unlifted Int = Int#\r\n box = I#\r\n unbox (I# i) = i\r\n\r\ninstance Levity Word where\r\n type Unlifted Word = Word#\r\n box = W#\r\n unbox (W# w) = w\r\n\r\ninstance Levity Stuff where\r\n type Unlifted Stuff = Stuff#\r\n box = stuff#\r\n unbox = unStuff#\r\n}}}\r\n\r\nThis succeeds to compile.\r\n\r\nNow, if we move everything from `type family Rep` to `unStuff# (` to the bottom of the module, it fails to compile.\r\n\r\n{{{#!hs\r\n{-# LANGUAGE MagicHash #-}\r\n{-# LANGUAGE UnboxedTuples #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n\r\n-- | Conversion between unlifted and lifted datatypes\r\nmodule Packed.Levity\r\n ( -- * Types\r\n Rep\r\n , Levity(..)\r\n ) where\r\n\r\nimport Data.Kind (Type)\r\nimport GHC.Types (TYPE, RuntimeRep(..), Int(..), Word(..))\r\nimport GHC.Exts (Int#, Word#, ByteArray#)\r\n\r\nclass Levity (a :: Type) where\r\n type Unlifted a :: TYPE (Rep a)\r\n box :: Unlifted a -> a\r\n unbox :: a -> Unlifted a\r\n\r\ninstance Levity Int where\r\n type Unlifted Int = Int#\r\n box = I#\r\n unbox (I# i) = i\r\n\r\ninstance Levity Word where\r\n type Unlifted Word = Word#\r\n box = W#\r\n unbox (W# w) = w\r\n\r\ninstance Levity Stuff where\r\n type Unlifted Stuff = Stuff#\r\n box = stuff#\r\n unbox = unStuff#\r\n\r\ntype family Rep (a :: Type) :: RuntimeRep\r\n\r\ntype instance Rep Int = IntRep\r\ntype instance Rep Word = WordRep\r\n\r\ntype Stuff# = (# Int#, Int# #)\r\n\r\ndata Stuff = Stuff Int# Int#\r\n\r\ntype instance Rep Stuff = TupleRep '[ 'IntRep, 'IntRep ]\r\n\r\nstuff# :: (# Int#, Int# #) -> Stuff\r\nstuff# (# x, y #) = Stuff x y\r\n\r\nunStuff# :: Stuff -> (# Int#, Int# #)\r\nunStuff# (Stuff x y) = (# x, y #)\r\n}}}\r\n\r\n{{{\r\nts.hs:33:25-30: error:\r\n • Expected kind ‘TYPE (Rep Stuff)’,\r\n but ‘Stuff#’ has kind ‘TYPE ('TupleRep '['IntRep, 'IntRep])’\r\n • In the type ‘Stuff#’\r\n In the type instance declaration for ‘Unlifted’\r\n In the instance declaration for ‘Levity Stuff’\r\n |\r\n33 | type Unlifted Stuff = Stuff#\r\n | ^^^^^^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15778GHC HEAD-only panic (zonkTcTyVarToTyVar)2019-07-07T18:03:02ZRyan ScottGHC HEAD-only panic (zonkTcTyVarToTyVar)The following program typechecks on GHC 8.0.1 through 8.6.1:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUA...The following program typechecks on GHC 8.0.1 through 8.6.1:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind
type a ~> b = a -> b -> Type
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
data family Sing (a :: k)
data Flarble (a :: Type) where
MkFlarble :: Flarble Bool
data instance Sing (z :: Flarble a) where
SMkFlarble :: Sing MkFlarble
elimFlarble :: forall a
(p :: forall x. Flarble x ~> Type)
(f :: Flarble a).
Sing f
-> Apply p MkFlarble
-> Apply p f
elimFlarble s@SMkFlarble pMkFlarble =
case s of
(_ :: Sing (MkFlarble :: Flarble probablyABadIdea)) ->
pMkFlarble
```
However, it panics on GHC HEAD:
```
$ ~/Software/ghc/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181015 for x86_64-unknown-linux):
zonkTcTyVarToTyVar
probablyABadIdea_aWn[tau:2]
Bool
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcMType.hs:1627:34 in ghc:TcMType
```
If I replace `probablyABadIdea` with `Bool`, then it typechecks again.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.5 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | highest |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC HEAD-only panic (zonkTcTyVarToTyVar)","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program typechecks on GHC 8.0.1 through 8.6.1:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE AllowAmbiguousTypes #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\ntype a ~> b = a -> b -> Type\r\ntype family Apply (f :: k1 ~> k2) (x :: k1) :: k2\r\ndata family Sing (a :: k)\r\n\r\ndata Flarble (a :: Type) where\r\n MkFlarble :: Flarble Bool\r\ndata instance Sing (z :: Flarble a) where\r\n SMkFlarble :: Sing MkFlarble\r\n\r\nelimFlarble :: forall a\r\n (p :: forall x. Flarble x ~> Type)\r\n (f :: Flarble a).\r\n Sing f\r\n -> Apply p MkFlarble\r\n -> Apply p f\r\nelimFlarble s@SMkFlarble pMkFlarble =\r\n case s of\r\n (_ :: Sing (MkFlarble :: Flarble probablyABadIdea)) ->\r\n pMkFlarble\r\n}}}\r\n\r\nHowever, it panics on GHC HEAD:\r\n\r\n{{{\r\n$ ~/Software/ghc/inplace/bin/ghc-stage2 Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181015 for x86_64-unknown-linux):\r\n zonkTcTyVarToTyVar\r\n probablyABadIdea_aWn[tau:2]\r\n Bool\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/TcMType.hs:1627:34 in ghc:TcMType\r\n}}}\r\n\r\nIf I replace `probablyABadIdea` with `Bool`, then it typechecks again.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15780ghc-8.4.4 failed to build on armv7 and aarch642019-07-07T18:03:02ZJens Petersenghc-8.4.4 failed to build on armv7 and aarch64ghc-8.4.4 is failing to build for me on Fedora ARM archs (both 32bit and 64bit).
https://koji.fedoraproject.org/koji/taskinfo?taskID=30284522
They both fail in the same way:
```
"inplace/bin/ghc-stage1" -static -H32m -O -Wall -Iinc...ghc-8.4.4 is failing to build for me on Fedora ARM archs (both 32bit and 64bit).
https://koji.fedoraproject.org/koji/taskinfo?taskID=30284522
They both fail in the same way:
```
"inplace/bin/ghc-stage1" -static -H32m -O -Wall -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS -this-unit-id rts -dcmm-lint -i -irts -irts/dist/build -Irts/dist/build -irts/dist/build/./autogen -Irts/dist/build/./autogen -O2 -Wcpp-undef -Wnoncanonical-monad-instances -c rts/HeapStackCheck.cmm -o rts/dist/build/HeapStackCheck.o
"inplace/bin/ghc-stage1" -static -H32m -O -Wall -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS -this-unit-id rts -dcmm-lint -i -irts -irts/dist/build -Irts/dist/build -irts/dist/build/./autogen -Irts/dist/build/./autogen -O2 -Wcpp-undef -Wnoncanonical-monad-instances -c rts/StgMiscClosures.cmm -o rts/dist/build/StgMiscClosures.o
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 8.4.4 for aarch64-unknown-linux):
padLiveArgs -- i > regNum ??
CallStack (from HasCallStack):
error, called at compiler/llvmGen/LlvmCodeGen/Base.hs:194:27 in ghc:LlvmCodeGen.Base
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
make[1]: *** [rts/ghc.mk:295: rts/dist/build/HeapStackCheck.o] Error 1
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.4 |
| 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-8.4.4 failed to build on armv7 and aarch64","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"ghc-8.4.4 is failing to build for me on Fedora ARM archs (both 32bit and 64bit).\r\n\r\nhttps://koji.fedoraproject.org/koji/taskinfo?taskID=30284522\r\n\r\nThey both fail in the same way:\r\n{{{\r\n\"inplace/bin/ghc-stage1\" -static -H32m -O -Wall -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS -this-unit-id rts -dcmm-lint -i -irts -irts/dist/build -Irts/dist/build -irts/dist/build/./autogen -Irts/dist/build/./autogen -O2 -Wcpp-undef -Wnoncanonical-monad-instances -c rts/HeapStackCheck.cmm -o rts/dist/build/HeapStackCheck.o\r\n\"inplace/bin/ghc-stage1\" -static -H32m -O -Wall -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS -this-unit-id rts -dcmm-lint -i -irts -irts/dist/build -Irts/dist/build -irts/dist/build/./autogen -Irts/dist/build/./autogen -O2 -Wcpp-undef -Wnoncanonical-monad-instances -c rts/StgMiscClosures.cmm -o rts/dist/build/StgMiscClosures.o\r\nghc-stage1: panic! (the 'impossible' happened)\r\n (GHC version 8.4.4 for aarch64-unknown-linux):\r\n\tpadLiveArgs -- i > regNum ??\r\nCallStack (from HasCallStack):\r\n error, called at compiler/llvmGen/LlvmCodeGen/Base.hs:194:27 in ghc:LlvmCodeGen.Base\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\nmake[1]: *** [rts/ghc.mk:295: rts/dist/build/HeapStackCheck.o] Error 1\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15781Extraneous parentheses required to parse kind signature on the RHS of a type ...2019-07-07T18:03:02ZRyan ScottExtraneous parentheses required to parse kind signature on the RHS of a type synonymAfter [D5173](https://phabricator.haskell.org/D5173), the restrictions about where kind signatures can appear in the source were significantly relaxed so that things like:
```hs
type family F where
F = Int :: Type
```
Are now allowed...After [D5173](https://phabricator.haskell.org/D5173), the restrictions about where kind signatures can appear in the source were significantly relaxed so that things like:
```hs
type family F where
F = Int :: Type
```
Are now allowed. However, there appears to be one case that was missed in that patch: the right-hand sides of type synonyms. For instance, I would expect the following to parse:
```hs
{-# LANGUAGE KindSignatures #-}
module Bug where
import Data.Kind
type F = Int :: Type
```
However, even GHC HEAD still refuses to parse this:
```
$ /opt/ghc/head/bin/ghci Bug.hs
GHCi, version 8.7.20181015: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:6:14: error: parse error on input ‘::’
|
6 | type F = Int :: Type
| ^^
```
Luckily, I don't think this will be too difficult to fix, since all that needs to be done is to update the parser production for type synonyms to use something like `ktype` instead of `ctype`. Patch incoming.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------- |
| Version | 8.7 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Parser) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Extraneous parentheses required to parse kind signature on the RHS of a type synonym","status":"New","operating_system":"","component":"Compiler (Parser)","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"After Phab:D5173, the restrictions about where kind signatures can appear in the source were significantly relaxed so that things like:\r\n\r\n{{{#!hs\r\ntype family F where\r\n F = Int :: Type\r\n}}}\r\n\r\nAre now allowed. However, there appears to be one case that was missed in that patch: the right-hand sides of type synonyms. For instance, I would expect the following to parse:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE KindSignatures #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\ntype F = Int :: Type\r\n}}}\r\n\r\nHowever, even GHC HEAD still refuses to parse this:\r\n\r\n{{{\r\n$ /opt/ghc/head/bin/ghci Bug.hs\r\nGHCi, version 8.7.20181015: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 1] Compiling Bug ( Bug.hs, interpreted )\r\n\r\nBug.hs:6:14: error: parse error on input ‘::’\r\n |\r\n6 | type F = Int :: Type\r\n | ^^\r\n}}}\r\n\r\nLuckily, I don't think this will be too difficult to fix, since all that needs to be done is to update the parser production for type synonyms to use something like `ktype` instead of `ctype`. Patch incoming.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15787GHC panic using kind application2019-07-07T18:02:59ZIcelandjackGHC panic using kind applicationUsing GHC head at diff [Visible kind application D5229](https://phabricator.haskell.org/D5229) (#12045),
bug goes away if you remove `@ob`.
```hs
{-# Language RankNTypes #-}
{-# Language TypeApplications #-}
{-# Language DataKinds ...Using GHC head at diff [Visible kind application D5229](https://phabricator.haskell.org/D5229) (#12045),
bug goes away if you remove `@ob`.
```hs
{-# Language RankNTypes #-}
{-# Language TypeApplications #-}
{-# Language DataKinds #-}
{-# Language PolyKinds #-}
{-# Language GADTs #-}
{-# Language TypeFamilies #-}
import Data.Kind
class Ríki (ob :: Type) where
type Hom :: ob -> ob -> Type
data
Kl_kind :: forall ob . (ob -> ob) -> ob -> Type where
Kl :: k -> Kl_kind @ob (m) k
type family
UnKl (kl :: Kl_kind m k) = (res :: k) where
UnKl (Kl a) = a
```
```
$ ghci -ignore-dot-ghci 543_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 543_bug.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181017 for x86_64-unknown-linux):
ASSERT failed!
Type-correct unfilled coercion hole {co_a1yH}
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/utils/Outputable.hs:1219:5 in ghc:Outputable
assertPprPanic, called at compiler/typecheck/TcHsSyn.hs:1805:99 in ghc:TcHsSyn
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC panic using kind application","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["TypeApplications"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Using GHC head at diff [https://phabricator.haskell.org/D5229 Visible kind application D5229] (#12045), \r\n\r\nbug goes away if you remove `@ob`.\r\n\r\n{{{#!hs\r\n{-# Language RankNTypes #-}\r\n{-# Language TypeApplications #-}\r\n{-# Language DataKinds #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language GADTs #-}\r\n{-# Language TypeFamilies #-}\r\n\r\nimport Data.Kind\r\n\r\nclass Ríki (ob :: Type) where\r\n type Hom :: ob -> ob -> Type\r\n\r\ndata\r\n Kl_kind :: forall ob . (ob -> ob) -> ob -> Type where\r\n Kl :: k -> Kl_kind @ob (m) k\r\n\r\ntype family\r\n UnKl (kl :: Kl_kind m k) = (res :: k) where\r\n UnKl (Kl a) = a\r\n}}}\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci 543_bug.hs\r\nGHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 543_bug.hs, interpreted )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181017 for x86_64-unknown-linux):\r\n ASSERT failed!\r\n Type-correct unfilled coercion hole {co_a1yH}\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler/utils/Outputable.hs:1219:5 in ghc:Outputable\r\n assertPprPanic, called at compiler/typecheck/TcHsSyn.hs:1805:99 in ghc:TcHsSyn\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n>\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15788Core Lint error, from visible kind applications2019-07-07T18:02:59ZIcelandjackCore Lint error, from visible kind applications```hs
{-# Language RankNTypes #-}
{-# Language GADTs #-}
{-# Language TypeApplications #-}
{-# Language PolyKinds #-}
{-# Options_GHC -dcore-lint #-}
import Data.Kind
data A :: forall k. Type where
MkA :: A @k...```hs
{-# Language RankNTypes #-}
{-# Language GADTs #-}
{-# Language TypeApplications #-}
{-# Language PolyKinds #-}
{-# Options_GHC -dcore-lint #-}
import Data.Kind
data A :: forall k. Type where
MkA :: A @k
```
this cute bug crashes under the [visible kind application](https://phabricator.haskell.org/D5229) diff, produces:
```
$ ghci -ignore-dot-ghci 545_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 545_bug.hs, interpreted )
*** Core Lint errors : in result of Tidy Core ***
<no location info>: warning:
In the type ‘forall (k :: k_a1xN[sk:1]) k. A’
@ k_a1xN[sk:1] is out of scope
*** Offending Program ***
$WMkA [InlPrag=INLINE[2]] :: forall (k :: k_a1xN[sk:1]) k. A
[GblId[DataConWrapper],
Caf=NoCafRefs,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)
Tmpl= \ (@ (k_a1y5 :: k_a1xN[sk:1])) (@ k_X1xP) ->
MkA @ k_X1xP @ k_a1y5}]
$WMkA
= \ (@ (k_a1y5 :: k_a1xN[sk:1])) (@ k_X1xP) ->
MkA @ k_X1xP @ k_a1y5
$trModule1_r1zb :: Addr#
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$trModule1_r1zb = "main"#
$trModule2_r1zu :: TrName
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$trModule2_r1zu = TrNameS $trModule1_r1zb
$trModule3_r1zv :: Addr#
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$trModule3_r1zv = "Main"#
$trModule4_r1zw :: TrName
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$trModule4_r1zw = TrNameS $trModule3_r1zv
$trModule :: Module
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$trModule = Module $trModule2_r1zu $trModule4_r1zw
$krep_r1zx :: KindRep
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$krep_r1zx = KindRepVar 1#
$krep1_r1zy :: KindRep
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$krep1_r1zy = KindRepVar 0#
$tcA1_r1zz :: Addr#
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$tcA1_r1zz = "A"#
$tcA2_r1zA :: TrName
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$tcA2_r1zA = TrNameS $tcA1_r1zz
$tcA :: TyCon
[GblId, Unf=OtherCon []]
$tcA
= TyCon
16201120719427956884##
13080046616073797921##
$trModule
$tcA2_r1zA
2#
krep$*
$krep2_r1zB :: [KindRep]
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$krep2_r1zB = : @ KindRep $krep1_r1zy ([] @ KindRep)
$krep3_r1zC :: [KindRep]
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$krep3_r1zC = : @ KindRep $krep_r1zx $krep2_r1zB
$krep4_r1zD :: KindRep
[GblId, Unf=OtherCon []]
$krep4_r1zD = KindRepTyConApp $tcA $krep3_r1zC
$tc'MkA1_r1zE :: Addr#
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$tc'MkA1_r1zE = "'MkA"#
$tc'MkA2_r1zF :: TrName
[GblId, Caf=NoCafRefs, Unf=OtherCon []]
$tc'MkA2_r1zF = TrNameS $tc'MkA1_r1zE
$tc'MkA :: TyCon
[GblId, Unf=OtherCon []]
$tc'MkA
= TyCon
1695572187443655535##
16213897990811765752##
$trModule
$tc'MkA2_r1zF
2#
$krep4_r1zD
*** End of Offense ***
<no location info>: error:
Compilation had errors
*** Exception: ExitFailure 1
```
Another example that fails
```hs
data
Kl_kind :: forall (m :: k -> Type). Type where
Kl :: k -> Kl_kind @(m :: k -> Type)
```8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15789GHC panic using visible kind applications and a higher-rank kind2019-07-07T18:02:59ZIcelandjackGHC panic using visible kind applications and a higher-rank kindUsing visible kind applications (#12045):
```hs
{-# Language LiberalTypeSynonyms #-}
{-# Language PolyKinds #-}
{-# Language RankNTypes #-}
{-# Language DataKinds #-}
import Data.Kind
type Cat ob = ob -> o...Using visible kind applications (#12045):
```hs
{-# Language LiberalTypeSynonyms #-}
{-# Language PolyKinds #-}
{-# Language RankNTypes #-}
{-# Language DataKinds #-}
import Data.Kind
type Cat ob = ob -> ob -> Type
data Zero :: forall (cat :: forall xx. xx -> Type) a. forall b. Cat (forall b. cat b u)
```
```
$ ghci -ignore-dot-ghci 546_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 546_bug.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181017 for x86_64-unknown-linux):
ASSERT failed!
Type-correct unfilled coercion hole {co_a1yl}
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/utils/Outputable.hs:1219:5 in ghc:Outputable
assertPprPanic, called at compiler/typecheck/TcHsSyn.hs:1805:99 in ghc:TcHsSyn
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
```