GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:03:39Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/15637Ambiguous type variables in GeneralisedNewtypeDeriving2019-07-07T18:03:39Zi-am-tomAmbiguous type variables in GeneralisedNewtypeDerivingWhen deriving the `C` instance in the following code:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
module Test where
class C a where f :: String
instance C () where f = "foo"
newtype T = T ()...When deriving the `C` instance in the following code:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
module Test where
class C a where f :: String
instance C () where f = "foo"
newtype T = T () deriving C
```
The following error occurs:
```
Test.hs:10:27: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘f’
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 T -- Defined at Test.hs:10:27
instance C () -- Defined at Test.hs:8:10
• In the third argument of ‘GHC.Prim.coerce’, namely ‘f’
In the expression: GHC.Prim.coerce @String @String f :: String
In an equation for ‘f’:
f = GHC.Prim.coerce @String @String f :: String
When typechecking the code for ‘f’
in a derived instance for ‘C T’:
To see the code I am typechecking, use -ddump-deriv
|
10 | newtype T = T () deriving C
| ^
```
1. .. and the following core is produced:
```
==================== Derived instances ====================
Derived class instances:
instance Test.C Test.T where
Test.f
= GHC.Prim.coerce @GHC.Base.String @GHC.Base.String Test.f ::
GHC.Base.String
Derived type family instances:
```
The problem seems to be that the `a` should have been set to `()` within the coerced instance. I've been working round this with a `newtype X a = X String` as the result value so that the `a` is present in the signature, but I think this is a bug; should a more specialised instance be generated? I hope this is enough of an explanation!
Thanks,
Tom
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Ambiguous type variables in GeneralisedNewtypeDeriving","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":["GeneralisedNewtypeDeriving,","GeneralizedNewtypeDeriving"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When deriving the `C` instance in the following code:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE AllowAmbiguousTypes #-}\r\n{-# LANGUAGE GeneralisedNewtypeDeriving #-}\r\nmodule Test where\r\n\r\nclass C a where f :: String\r\n\r\ninstance C () where f = \"foo\"\r\n\r\nnewtype T = T () deriving C\r\n}}}\r\n\r\nThe following error occurs:\r\n\r\n{{{\r\nTest.hs:10:27: error:\r\n • Ambiguous type variable ‘a0’ arising from a use of ‘f’\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 T -- Defined at Test.hs:10:27\r\n instance C () -- Defined at Test.hs:8:10\r\n • In the third argument of ‘GHC.Prim.coerce’, namely ‘f’\r\n In the expression: GHC.Prim.coerce @String @String f :: String\r\n In an equation for ‘f’:\r\n f = GHC.Prim.coerce @String @String f :: String\r\n When typechecking the code for ‘f’\r\n in a derived instance for ‘C T’:\r\n To see the code I am typechecking, use -ddump-deriv\r\n |\r\n10 | newtype T = T () deriving C\r\n | ^\r\n}}}\r\n\r\n... and the following core is produced:\r\n\r\n{{{\r\n==================== Derived instances ====================\r\nDerived class instances:\r\n instance Test.C Test.T where\r\n Test.f\r\n = GHC.Prim.coerce @GHC.Base.String @GHC.Base.String Test.f ::\r\n GHC.Base.String\r\n\r\n\r\nDerived type family instances:\r\n}}}\r\n\r\nThe problem seems to be that the `a` should have been set to `()` within the coerced instance. I've been working round this with a `newtype X a = X String` as the result value so that the `a` is present in the signature, but I think this is a bug; should a more specialised instance be generated? I hope this is enough of an explanation!\r\n\r\nThanks,\r\nTom","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15638Make Ptr argument to hGetBuf and hGetBufSome strict2019-07-07T18:03:38ZAndrew MartinMake Ptr argument to hGetBuf and hGetBufSome strictCurrently, we have:
```
hGetBufSome :: Handle -> Ptr a -> Int -> IO Int
hGetBufSome h ptr count = ...
hGetBuf :: Handle -> Ptr a -> Int -> IO Int
hGetBuf h ptr count
```
I propose putting a bang pattern on the `ptr` argument to both o...Currently, we have:
```
hGetBufSome :: Handle -> Ptr a -> Int -> IO Int
hGetBufSome h ptr count = ...
hGetBuf :: Handle -> Ptr a -> Int -> IO Int
hGetBuf h ptr count
```
I propose putting a bang pattern on the `ptr` argument to both of these functions. Currently, the non-strictness of this argument causes it to be boxed by functions that call it.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| 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 Ptr argument to hGetBuf and hGetBufSome strict","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"Currently, we have:\r\n\r\n{{{\r\nhGetBufSome :: Handle -> Ptr a -> Int -> IO Int\r\nhGetBufSome h ptr count = ...\r\n\r\nhGetBuf :: Handle -> Ptr a -> Int -> IO Int\r\nhGetBuf h ptr count\r\n}}}\r\n\r\nI propose putting a bang pattern on the `ptr` argument to both of these functions. Currently, the non-strictness of this argument causes it to be boxed by functions that call it.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15641Git repositories have several problems2019-07-07T18:03:37ZPhilippeGit repositories have several problemsI have some problems with the repositories. When i try to clone from the official repo:
```
» git clone --single-branch --branch master --depth=1 --recursive git://git.haskell.org/ghc.git ghc-head
Cloning into 'ghc-head'...
fatal: The r...I have some problems with the repositories. When i try to clone from the official repo:
```
» git clone --single-branch --branch master --depth=1 --recursive git://git.haskell.org/ghc.git ghc-head
Cloning into 'ghc-head'...
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
```
Maybe it's because the git server version is old (1.9.1). Without `--depth=1` it works, but anyway it's an issue.
With the github mirror i have another problem:
```
Cloning into 'libraries/Cabal'...
fatal: remote error:
ghc/packages/Cabal is not a valid repository name
Email support@github.com for help
fatal: clone of 'git://github.com/ghc/packages/Cabal.git' into submodule path 'libraries/Cabal' failed
```
With the phabricator repo the following issue:
command:
```
git clone --depth=1 --single-branch --branch ghc-8.6 --recursive https://phabricator.haskell.org/diffusion/GHC/glasgow-haskell-compiler.git ghc-8.6-head
```
error:
```
Cloning into '.arc-linters/arcanist-external-json-linter'...
error: RPC failed; HTTP 503 curl 22 The requested URL returned error: 503 first byte timeout
fatal: The remote end hung up unexpectedly
fatal: clone of 'https://phabricator.haskell.org/diffusion/GHC/arcanist-external-json-linter.git' into submodule path '.arc-linters/arcanist-external-json-linter' failed
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Trac & Git |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Git repositories have several problems","status":"New","operating_system":"","component":"Trac & Git","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"hvr"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I have some problems with the repositories. When i try to clone from the official repo:\r\n\r\n{{{\r\n» git clone --single-branch --branch master --depth=1 --recursive git://git.haskell.org/ghc.git ghc-head\r\nCloning into 'ghc-head'...\r\nfatal: The remote end hung up unexpectedly\r\nfatal: early EOF\r\nfatal: index-pack failed\r\n}}}\r\n\r\nMaybe it's because the git server version is old (1.9.1). Without `--depth=1` it works, but anyway it's an issue.\r\n\r\nWith the github mirror i have another problem:\r\n\r\n{{{\r\nCloning into 'libraries/Cabal'...\r\nfatal: remote error: \r\n ghc/packages/Cabal is not a valid repository name\r\n Email support@github.com for help\r\nfatal: clone of 'git://github.com/ghc/packages/Cabal.git' into submodule path 'libraries/Cabal' failed\r\n}}}\r\n\r\nWith the phabricator repo the following issue:\r\n\r\ncommand:\r\n{{{\r\ngit clone --depth=1 --single-branch --branch ghc-8.6 --recursive https://phabricator.haskell.org/diffusion/GHC/glasgow-haskell-compiler.git ghc-8.6-head\r\n}}}\r\n\r\nerror:\r\n{{{\r\nCloning into '.arc-linters/arcanist-external-json-linter'...\r\nerror: RPC failed; HTTP 503 curl 22 The requested URL returned error: 503 first byte timeout\r\nfatal: The remote end hung up unexpectedly\r\nfatal: clone of 'https://phabricator.haskell.org/diffusion/GHC/arcanist-external-json-linter.git' into submodule path '.arc-linters/arcanist-external-json-linter' failed\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->Herbert Valerio Riedelhvr@gnu.orgHerbert Valerio Riedelhvr@gnu.orghttps://gitlab.haskell.org/ghc/ghc/-/issues/15643Test Suite Unexpected failure for ghci063(ghci)2021-01-23T06:58:41ZJulian LevistonTest Suite Unexpected failure for ghci063(ghci)Git sha is ce23451c2c771bfbbac27ce63c5fdccc7ed02b3b (version 8.7, I believe - the latest as at day before yesterday) ran tests on MacBook Pro (15-inch, 2017 - MacBookPro14,3) with 3.1Ghz Intel Core i7 16GB RAM, 4 Cores. OS X 10.13.6.
Fi...Git sha is ce23451c2c771bfbbac27ce63c5fdccc7ed02b3b (version 8.7, I believe - the latest as at day before yesterday) ran tests on MacBook Pro (15-inch, 2017 - MacBookPro14,3) with 3.1Ghz Intel Core i7 16GB RAM, 4 Cores. OS X 10.13.6.
First run through of tests ever for me. Did `cd ghc/testsuite/tests/ghci && make THREADS=8` and the following error ensued:
```shell
=====> T1914(ghci) 102 of 271 [0, 0, 0]
cd "scripts/T1914.run" && HC="/Users/julian/code/haskell/ghc/inplace/test spaces/ghc-stage2" HC_OPTS="-dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output " "/Users/julian/code/haskell/ghc/inplace/test spaces/ghc-stage2" --interactive -v0 -ignore-dot-ghci -fno-ghci-history +RTS -I0.1 -RTS -fghci-leak-check -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output < T1914.script
Actual stderr output differs from expected:
diff -uw "/dev/null" "scripts/ghci063.run/ghci063.run.stderr.normalised"
--- /dev/null 2018-09-12 23:42:18.000000000 +1000
+++ scripts/ghci063.run/ghci063.run.stderr.normalised 2018-09-12 23:42:20.000000000 +1000
@@ -0,0 +1,2 @@
+
+B.hs:1:1: parse error on input ‘***’
*** unexpected failure for ghci063(ghci)
```https://gitlab.haskell.org/ghc/ghc/-/issues/15644Test Suite Unexpected failure for ghci062(ghci-ext)2021-09-07T15:56:11ZJulian LevistonTest Suite Unexpected failure for ghci062(ghci-ext)Testing on MacOS X 10.13.6 MacBook (Retina, 12-inch, 2017) 1.4GHz i7 1 processor, 2 cores
git sha is d36b1ffac9960db70043aaab43c931ce217912ba
Ran `cd ghc/testsuite/tests/ghci` then `make test THREADS=2`
The erroring output is as follo...Testing on MacOS X 10.13.6 MacBook (Retina, 12-inch, 2017) 1.4GHz i7 1 processor, 2 cores
git sha is d36b1ffac9960db70043aaab43c931ce217912ba
Ran `cd ghc/testsuite/tests/ghci` then `make test THREADS=2`
The erroring output is as follows (snipped):
```shell
=====> ghci063(ghci) 99 of 271 [0, 1, 2]
cd "scripts/ghci063.run" && HC="/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2" HC_OPTS="-dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output " "/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2" --interactive -v0 -ignore-dot-ghci -fno-ghci-history +RTS -I0.1 -RTS -fghci-leak-check -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output < ghci063.script
=====> ghci062(ghci-ext) 99 of 271 [0, 1, 2]
cd "scripts/ghci062.run" && HC="/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2" HC_OPTS="-dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output " "/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2" --interactive -v0 -ignore-dot-ghci -fno-ghci-history -fexternal-interpreter +RTS -I0.1 -RTS -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output < ghci062.script
Actual stderr output differs from expected:
diff -uw "/dev/null" "scripts/ghci063.run/ghci063.run.stderr.normalised"
--- /dev/null 2018-09-12 23:13:35.000000000 +1000
+++ scripts/ghci063.run/ghci063.run.stderr.normalised 2018-09-12 23:13:39.000000000 +1000
@@ -0,0 +1,2 @@
+
+B.hs:1:1: parse error on input ‘***’
*** unexpected failure for ghci063(ghci)
=====> T2452(ghci) 100 of 271 [0, 2, 2]
cd "scripts/T2452.run" && HC="/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2" HC_OPTS="-dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output " "/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2" --interactive -v0 -ignore-dot-ghci -fno-ghci-history +RTS -I0.1 -RTS -fghci-leak-check -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output < T2452.script
Wrong exit code for ghci062(ghci-ext)(expected 0 , actual 1 )
Stderr ( ghci062 ):
ghc-iserv.bin:
lookupSymbol failed in relocateSection (RELOC_GOT)
/Users/julianleviston/code/haskell/ghc/libraries/integer-gmp/dist-install/build/HSinteger-gmp-1.0.2.0.o: unknown symbol `___gmp_rands'
ghc-stage2: unable to load package `integer-gmp-1.0.2.0'
*** unexpected failure for ghci062(ghci-ext)
```
Note, two errors occurred but I've created an error report for ghci063 in another ticket (#15643)
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Test Suite |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Test Suite Unexpected failure for ghci062(ghci-ext)","status":"New","operating_system":"","component":"Test Suite","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Testing on MacOS X 10.13.6 MacBook (Retina, 12-inch, 2017) 1.4GHz i7 1 processor, 2 cores\r\n\r\ngit sha is d36b1ffac9960db70043aaab43c931ce217912ba\r\n\r\nRan `cd ghc/testsuite/tests/ghci` then `make test THREADS=2`\r\n\r\nThe erroring output is as follows (snipped):\r\n\r\n{{{#!shell\r\n=====> ghci063(ghci) 99 of 271 [0, 1, 2]\r\ncd \"scripts/ghci063.run\" && HC=\"/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2\" HC_OPTS=\"-dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output \" \"/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2\" --interactive -v0 -ignore-dot-ghci -fno-ghci-history +RTS -I0.1 -RTS -fghci-leak-check -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output < ghci063.script\r\n=====> ghci062(ghci-ext) 99 of 271 [0, 1, 2]\r\ncd \"scripts/ghci062.run\" && HC=\"/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2\" HC_OPTS=\"-dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output \" \"/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2\" --interactive -v0 -ignore-dot-ghci -fno-ghci-history -fexternal-interpreter +RTS -I0.1 -RTS -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output < ghci062.script\r\nActual stderr output differs from expected:\r\ndiff -uw \"/dev/null\" \"scripts/ghci063.run/ghci063.run.stderr.normalised\"\r\n--- /dev/null\t2018-09-12 23:13:35.000000000 +1000\r\n+++ scripts/ghci063.run/ghci063.run.stderr.normalised\t2018-09-12 23:13:39.000000000 +1000\r\n@@ -0,0 +1,2 @@\r\n+\r\n+B.hs:1:1: parse error on input ‘***’\r\n*** unexpected failure for ghci063(ghci)\r\n=====> T2452(ghci) 100 of 271 [0, 2, 2]\r\ncd \"scripts/T2452.run\" && HC=\"/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2\" HC_OPTS=\"-dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output \" \"/Users/julianleviston/code/haskell/ghc/inplace/test spaces/ghc-stage2\" --interactive -v0 -ignore-dot-ghci -fno-ghci-history +RTS -I0.1 -RTS -fghci-leak-check -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output < T2452.script\r\nWrong exit code for ghci062(ghci-ext)(expected 0 , actual 1 )\r\nStderr ( ghci062 ):\r\nghc-iserv.bin: \r\nlookupSymbol failed in relocateSection (RELOC_GOT)\r\n/Users/julianleviston/code/haskell/ghc/libraries/integer-gmp/dist-install/build/HSinteger-gmp-1.0.2.0.o: unknown symbol `___gmp_rands'\r\nghc-stage2: unable to load package `integer-gmp-1.0.2.0'\r\n*** unexpected failure for ghci062(ghci-ext)\r\n}}}\r\n\r\nNote, two errors occurred but I've created an error report for ghci063 in another ticket (#15643)","type_of_failure":"OtherFailure","blocking":[]} -->9.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/15645TypeChecking of Monad patterns incorrect with RebindableSyntax and Overloaded...2019-07-07T18:03:36ZNeil MitchellTypeChecking of Monad patterns incorrect with RebindableSyntax and OverloadedStringsUsing GHC 8.4.3, I'd expect the following to work:
```hs
{-# LANGUAGE RebindableSyntax, OverloadedStrings #-}
module Fail where
import Prelude hiding (fail)
foo x = do
Just y <- x
return y
newtype Text = Text String
fail ::...Using GHC 8.4.3, I'd expect the following to work:
```hs
{-# LANGUAGE RebindableSyntax, OverloadedStrings #-}
module Fail where
import Prelude hiding (fail)
foo x = do
Just y <- x
return y
newtype Text = Text String
fail :: Text -> a
fail (Text x) = error x
fromString :: String -> Text
fromString = Text
```
But it fails with:
```
Fail.hs:8:5-15: error:
* Couldn't match expected type `[Char]' with actual type `Text'
* In a stmt of a 'do' block: Just y <- x
In the expression:
do Just y <- x
return y
In an equation for `foo':
foo x
= do Just y <- x
return y
|
8 | Just y <- x
| ^^^^^^^^^^^
```
Given the enabled extensions, I'd expect `foo` to desugar as:
```hs
foo x = x >>= \v -> case v of
Just y -> return y
_ -> fail (fromString "pattern match error")
```
But looking at TcMatches.tcMonadFailOp it checks the fail operation (which is literally `fail`) takes an argument of type tyString (e.g. `[Char]`). One way around that would be to make the "fail-op" being passed around be `fail . fromString` if the appropriate extensions are enabled.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------------- |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | ndmitchell@gmail.com |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"TypeChecking of Monad patterns incorrect with RebindableSyntax and OverloadedStrings","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["ndmitchell@gmail.com"],"type":"Bug","description":"Using GHC 8.4.3, I'd expect the following to work:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE RebindableSyntax, OverloadedStrings #-}\r\n\r\nmodule Fail where\r\n\r\nimport Prelude hiding (fail)\r\n\r\nfoo x = do\r\n Just y <- x\r\n return y\r\n\r\nnewtype Text = Text String\r\n\r\nfail :: Text -> a\r\nfail (Text x) = error x\r\n\r\nfromString :: String -> Text\r\nfromString = Text\r\n}}}\r\n\r\nBut it fails with:\r\n\r\n{{{\r\nFail.hs:8:5-15: error:\r\n * Couldn't match expected type `[Char]' with actual type `Text'\r\n * In a stmt of a 'do' block: Just y <- x\r\n In the expression:\r\n do Just y <- x\r\n return y\r\n In an equation for `foo':\r\n foo x\r\n = do Just y <- x\r\n return y\r\n |\r\n8 | Just y <- x\r\n | ^^^^^^^^^^^\r\n}}}\r\n\r\nGiven the enabled extensions, I'd expect {{{foo}}} to desugar as:\r\n\r\n{{{#!hs\r\nfoo x = x >>= \\v -> case v of\r\n Just y -> return y\r\n _ -> fail (fromString \"pattern match error\")\r\n}}}\r\n\r\nBut looking at TcMatches.tcMonadFailOp it checks the fail operation (which is literally {{{fail}}}) takes an argument of type tyString (e.g. {{{[Char]}}}). One way around that would be to make the \"fail-op\" being passed around be {{{fail . fromString}}} if the appropriate extensions are enabled.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Shayne Fletchershayne@shaynefletcher.orgShayne Fletchershayne@shaynefletcher.orghttps://gitlab.haskell.org/ghc/ghc/-/issues/15646ghci takes super long time to find the type of large fractional number2023-03-23T19:15:49ZJohannkokosghci takes super long time to find the type of large fractional number```
:t 1e123456789
```
takes more than 3 seconds to get the type info.
```
:t 1e1234111111111111111111111
```
shows a warning/error,
```
GNU MP: Cannot allocate memory (size=93978265)
```
<details><summary>Trac metadata</summary>
|...```
:t 1e123456789
```
takes more than 3 seconds to get the type info.
```
:t 1e1234111111111111111111111
```
shows a warning/error,
```
GNU MP: Cannot allocate memory (size=93978265)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | GHCi |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ghci takes super long time to find the type of large fractional number","status":"New","operating_system":"","component":"GHCi","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":["type"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"\r\n{{{\r\n:t 1e123456789\r\n}}}\r\n\r\n\r\ntakes more than 3 seconds to get the type info.\r\n\r\n{{{\r\n\r\n:t 1e1234111111111111111111111\r\n}}}\r\n\r\nshows a warning/error,\r\n\r\n\r\n{{{\r\nGNU MP: Cannot allocate memory (size=93978265)\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->9.2.1Andreas KlebingerAndreas Klebingerhttps://gitlab.haskell.org/ghc/ghc/-/issues/15647ghc: panic! (the 'impossible' happened)2019-07-07T18:03:36Zmonomonghc: panic! (the 'impossible' happened)```
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
initTc: unsolved constraints
WC {wc_insol =
[W] ask_an9K :: t_an9J[tau:1] (CHoleCan: ask)
[W] put_an9Q :: t_an9P[tau:1] (CHole...```
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
initTc: unsolved constraints
WC {wc_insol =
[W] ask_an9K :: t_an9J[tau:1] (CHoleCan: ask)
[W] put_an9Q :: t_an9P[tau:1] (CHoleCan: put)}
```
So this code derives an instance of the Decimal type incorrectly, but not sure if this is causing the error.
I have some nested records, which contain a few Decimals. I am trying to make them acidic.
```hs
instance SafeCopy (DecimalRaw a) where
putCopy (Decimal d) = contain $ safePut d
getCopy = contain $ Decimal <$> safeGet
deriveSafeCopy 0 'base ''Client
deriveSafeCopy 0 'base ''Article
deriveSafeCopy 0 'base ''ServerData
makeLenses ''ServerData
writeState :: String -> Update ServerData ()
writeState newValue
= put (ServerData newValue)
queryState :: Update ServerData String
queryState = do ServerData string <- ask
return string
makeAcidic ''ServerData ['writeState 'queryState]
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.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":"ghc: panic! (the 'impossible' happened)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.0.2 for x86_64-unknown-linux):\r\n\tinitTc: unsolved constraints\r\n WC {wc_insol =\r\n [W] ask_an9K :: t_an9J[tau:1] (CHoleCan: ask)\r\n [W] put_an9Q :: t_an9P[tau:1] (CHoleCan: put)}\r\n}}}\r\n\r\nSo this code derives an instance of the Decimal type incorrectly, but not sure if this is causing the error.\r\n\r\nI have some nested records, which contain a few Decimals. I am trying to make them acidic.\r\n\r\n{{{#!hs\r\ninstance SafeCopy (DecimalRaw a) where\r\n putCopy (Decimal d) = contain $ safePut d\r\n getCopy = contain $ Decimal <$> safeGet\r\n\r\nderiveSafeCopy 0 'base ''Client\r\nderiveSafeCopy 0 'base ''Article\r\n\r\n\r\nderiveSafeCopy 0 'base ''ServerData\r\nmakeLenses ''ServerData\r\n\r\nwriteState :: String -> Update ServerData ()\r\nwriteState newValue\r\n = put (ServerData newValue)\r\nqueryState :: Update ServerData String\r\nqueryState = do ServerData string <- ask\r\n return string\r\n\r\nmakeAcidic ''ServerData ['writeState 'queryState]\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15648Core Lint error with source-level unboxed equality2019-07-07T18:03:36ZRyan ScottCore Lint error with source-level unboxed equalityI thought that we had killed `(~#)` from the source language in #15209. I could not have been more wrong. Source-level `(~#)` is alive and well, and it can cause Core Lint errors. Be afraid. Be very, very afraid.
The trick is to grab `(...I thought that we had killed `(~#)` from the source language in #15209. I could not have been more wrong. Source-level `(~#)` is alive and well, and it can cause Core Lint errors. Be afraid. Be very, very afraid.
The trick is to grab `(~#)` using Template Haskell:
```hs
module Foo where
import Language.Haskell.TH.Lib
import Language.Haskell.TH.Syntax
ueqT :: Q Type
ueqT = conT $ mkNameG_tc "ghc-prim" "GHC.Prim" "~#"
```
Once this is done, you can plop unboxed equality wherever you want into the source language. Here is a particularly mischievous example:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind (Type)
import Data.Type.Equality (type (~~))
import Foo (ueqT)
data LegitEquality :: Type -> Type -> Type where
Legit :: LegitEquality a a
data JankyEquality :: Type -> Type -> Type where
Jank :: $ueqT a b -> JankyEquality a b
unJank :: JankyEquality a b -> $ueqT a b
unJank (Jank x) = x
legitToJank :: LegitEquality a b -> JankyEquality a b
legitToJank Legit = Jank
mkLegit :: a ~~ b => LegitEquality a b
mkLegit = Legit
ueqSym :: forall (a :: Type) (b :: Type).
$ueqT a b -> $ueqT b a
ueqSym = unJank $ legitToJank $ mkLegit @b @a
```
If you compile this with optimizations, then GHC's inner demons are unleashed, which brings utter chaos when `-dcore-lint` is enabled:
```
$ /opt/ghc/8.6.1/bin/ghc -O2 -fforce-recomp Bug.hs -dcore-lint
[1 of 2] Compiling Foo ( Foo.hs, Foo.o )
[2 of 2] Compiling Bug ( Bug.hs, Bug.o )
*** Core Lint errors : in result of Simplifier ***
<no location info>: warning:
[in body of lambda with binder co_a5RY :: a_a5RV ~# b_a5RW]
x_a5OX :: b_a5RW ~# a_a5RV
[LclId] is out of scope
*** Offending Program ***
<elided>
ueqSym :: forall a b. (a ~# b) => b ~# a
[LclIdX,
Arity=1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)}]
ueqSym
= \ (@ a_a5RV) (@ b_a5RW) (co_a5RY :: a_a5RV ~# b_a5RW) -> x_a5OX
```
-----
Obviously, this ticket is a little tongue-in-cheek, since I'm probably inviting disaster upon myself by deliberately digging around in `ghc-prim` for `(~#)`. But this does raise the question: should we allow users to do this? I used to think that there was no harm in leaving `(~#)` lying at the bottom of the catacombs that is `ghc-prim`, but this example shows that perhaps `(~#)` should be locked away for good.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Core Lint error with source-level unboxed equality","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I thought that we had killed `(~#)` from the source language in #15209. I could not have been more wrong. Source-level `(~#)` is alive and well, and it can cause Core Lint errors. Be afraid. Be very, very afraid.\r\n\r\nThe trick is to grab `(~#)` using Template Haskell:\r\n\r\n{{{#!hs\r\nmodule Foo where\r\n\r\nimport Language.Haskell.TH.Lib\r\nimport Language.Haskell.TH.Syntax\r\n\r\nueqT :: Q Type\r\nueqT = conT $ mkNameG_tc \"ghc-prim\" \"GHC.Prim\" \"~#\"\r\n}}}\r\n\r\nOnce this is done, you can plop unboxed equality wherever you want into the source language. Here is a particularly mischievous example:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE KindSignatures #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind (Type)\r\nimport Data.Type.Equality (type (~~))\r\nimport Foo (ueqT)\r\n\r\ndata LegitEquality :: Type -> Type -> Type where\r\n Legit :: LegitEquality a a\r\n\r\ndata JankyEquality :: Type -> Type -> Type where\r\n Jank :: $ueqT a b -> JankyEquality a b\r\n\r\nunJank :: JankyEquality a b -> $ueqT a b\r\nunJank (Jank x) = x\r\n\r\nlegitToJank :: LegitEquality a b -> JankyEquality a b\r\nlegitToJank Legit = Jank\r\n\r\nmkLegit :: a ~~ b => LegitEquality a b\r\nmkLegit = Legit\r\n\r\nueqSym :: forall (a :: Type) (b :: Type).\r\n $ueqT a b -> $ueqT b a\r\nueqSym = unJank $ legitToJank $ mkLegit @b @a\r\n}}}\r\n\r\nIf you compile this with optimizations, then GHC's inner demons are unleashed, which brings utter chaos when `-dcore-lint` is enabled:\r\n\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc -O2 -fforce-recomp Bug.hs -dcore-lint \r\n[1 of 2] Compiling Foo ( Foo.hs, Foo.o )\r\n[2 of 2] Compiling Bug ( Bug.hs, Bug.o )\r\n*** Core Lint errors : in result of Simplifier ***\r\n<no location info>: warning:\r\n [in body of lambda with binder co_a5RY :: a_a5RV ~# b_a5RW]\r\n x_a5OX :: b_a5RW ~# a_a5RV\r\n [LclId] is out of scope\r\n*** Offending Program ***\r\n\r\n<elided>\r\n\r\nueqSym :: forall a b. (a ~# b) => b ~# a\r\n[LclIdX,\r\n Arity=1,\r\n Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,\r\n WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)}]\r\nueqSym\r\n = \\ (@ a_a5RV) (@ b_a5RW) (co_a5RY :: a_a5RV ~# b_a5RW) -> x_a5OX\r\n}}}\r\n\r\n-----\r\n\r\nObviously, this ticket is a little tongue-in-cheek, since I'm probably inviting disaster upon myself by deliberately digging around in `ghc-prim` for `(~#)`. But this does raise the question: should we allow users to do this? I used to think that there was no harm in leaving `(~#)` lying at the bottom of the catacombs that is `ghc-prim`, but this example shows that perhaps `(~#)` should be locked away for good.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15649Errors about ambiguous untouchable variable when using constraint variable in...2019-07-07T18:03:36Zinfinity0Errors about ambiguous untouchable variable when using constraint variable in RankN typeThe following code compiles and works:
```haskell
{-# LANGUAGE
ConstraintKinds
, FlexibleInstances
, MultiParamTypeClasses
, GADTs
, RankNTypes
, ScopedTypeVariables
, UndecidableSuperClasses
#-}
import GHC.Types (Con...The following code compiles and works:
```haskell
{-# LANGUAGE
ConstraintKinds
, FlexibleInstances
, MultiParamTypeClasses
, GADTs
, RankNTypes
, ScopedTypeVariables
, UndecidableSuperClasses
#-}
import GHC.Types (Constraint)
main :: IO ()
main = do return ()
class (r a) => DynPS r a where
data PSAny r = forall a. DynPS r a => PSAny a
class Unconstrained a
instance Unconstrained a
instance DynPS Unconstrained ()
newtype DynLoad' r = DynLoad' {
unDynLoad' :: forall ref. r ref => ref -> PSAny r
}
loadAll
:: forall a r . (DynPS r a)
=> DynLoad' r
-> a -> Maybe a
loadAll loader r = undefined
testCallable :: IO (Maybe ())
testCallable = return $ loadAll (undefined :: DynLoad' Unconstrained) ()
```
However it's ugly having to expose `DynLoad'` in the API. Ideally we'd like to have:
```haskell
loadAll2
:: forall a r . (DynPS r a)
=> (forall ref. r ref => ref -> PSAny r)
-> a -> Maybe a
loadAll2 loader r = loadAll (DynLoad' loader :: DynLoad' r) r
```
But this fails with:
```
Test3.hs:37:6: error:
• Couldn't match type ‘r0’ with ‘r’
‘r0’ is untouchable
inside the constraints: r0 ref
bound by the type signature for:
loadAll2 :: forall ref. r0 ref => ref -> PSAny r0
at Test3.hs:(37,6)-(39,17)
‘r’ is a rigid type variable bound by
the type signature for:
loadAll2 :: forall a (r :: * -> Constraint).
DynPS r a =>
(forall ref. r ref => ref -> PSAny r) -> a -> Maybe a
at Test3.hs:(37,6)-(39,17)
Expected type: ref -> PSAny r0
Actual type: ref -> PSAny r
• In the ambiguity check for ‘loadAll2’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature:
loadAll2 :: forall a r.
(DynPS r a) =>
(forall ref. r ref => ref -> PSAny r) -> a -> Maybe a
|
37 | :: forall a r . (DynPS r a)
| ^^^^^^^^^^^^^^^^^^^^^^^^...
```
It compiles if we enable `AllowAmbiguousTypes`, but are then forced to use `TypeApplications` as well to actually call it. :(
```haskell
-- as above, but add:
{-# LANGUAGE AllowAmbiguousTypes, TypeApplications #-}
-- and then:
testCallable2 :: IO (Maybe ())
--testCallable2 = return $ loadAll2 (undefined :: forall ref. Unconstrained ref => ref -> PSAny Unconstrained) ()
-- ^ doesn't work either
testCallable2 = return $ loadAll2 @() @Unconstrained undefined ()
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Errors about ambiguous untouchable variable when using constraint variable in RankN type","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following code compiles and works:\r\n\r\n{{{#!haskell\r\n{-# LANGUAGE\r\n ConstraintKinds\r\n , FlexibleInstances\r\n , MultiParamTypeClasses\r\n , GADTs\r\n , RankNTypes\r\n , ScopedTypeVariables\r\n , UndecidableSuperClasses\r\n #-}\r\n\r\nimport GHC.Types (Constraint)\r\n\r\nmain :: IO ()\r\nmain = do return ()\r\n\r\nclass (r a) => DynPS r a where\r\ndata PSAny r = forall a. DynPS r a => PSAny a\r\n\r\nclass Unconstrained a\r\ninstance Unconstrained a\r\ninstance DynPS Unconstrained ()\r\n\r\nnewtype DynLoad' r = DynLoad' {\r\n unDynLoad' :: forall ref. r ref => ref -> PSAny r\r\n }\r\n\r\nloadAll\r\n :: forall a r . (DynPS r a)\r\n => DynLoad' r\r\n -> a -> Maybe a\r\nloadAll loader r = undefined\r\n\r\ntestCallable :: IO (Maybe ())\r\ntestCallable = return $ loadAll (undefined :: DynLoad' Unconstrained) ()\r\n\r\n}}}\r\n\r\nHowever it's ugly having to expose `DynLoad'` in the API. Ideally we'd like to have:\r\n\r\n{{{#!haskell\r\nloadAll2\r\n :: forall a r . (DynPS r a)\r\n => (forall ref. r ref => ref -> PSAny r)\r\n -> a -> Maybe a\r\nloadAll2 loader r = loadAll (DynLoad' loader :: DynLoad' r) r\r\n}}}\r\n\r\nBut this fails with:\r\n\r\n{{{\r\nTest3.hs:37:6: error:\r\n • Couldn't match type ‘r0’ with ‘r’\r\n ‘r0’ is untouchable\r\n inside the constraints: r0 ref\r\n bound by the type signature for:\r\n loadAll2 :: forall ref. r0 ref => ref -> PSAny r0\r\n at Test3.hs:(37,6)-(39,17)\r\n ‘r’ is a rigid type variable bound by\r\n the type signature for:\r\n loadAll2 :: forall a (r :: * -> Constraint).\r\n DynPS r a =>\r\n (forall ref. r ref => ref -> PSAny r) -> a -> Maybe a\r\n at Test3.hs:(37,6)-(39,17)\r\n Expected type: ref -> PSAny r0\r\n Actual type: ref -> PSAny r\r\n • In the ambiguity check for ‘loadAll2’\r\n To defer the ambiguity check to use sites, enable AllowAmbiguousTypes\r\n In the type signature:\r\n loadAll2 :: forall a r.\r\n (DynPS r a) =>\r\n (forall ref. r ref => ref -> PSAny r) -> a -> Maybe a\r\n |\r\n37 | :: forall a r . (DynPS r a)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^...\r\n}}}\r\n\r\nIt compiles if we enable `AllowAmbiguousTypes`, but are then forced to use `TypeApplications` as well to actually call it. :(\r\n\r\n{{{#!haskell\r\n-- as above, but add:\r\n{-# LANGUAGE AllowAmbiguousTypes, TypeApplications #-}\r\n\r\n-- and then:\r\n\r\ntestCallable2 :: IO (Maybe ())\r\n--testCallable2 = return $ loadAll2 (undefined :: forall ref. Unconstrained ref => ref -> PSAny Unconstrained) ()\r\n-- ^ doesn't work either\r\ntestCallable2 = return $ loadAll2 @() @Unconstrained undefined ()\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15653Both `Ptr a` in SerializedCompact are inaccurate because of the `a`2020-07-23T09:32:54ZchessaiBoth `Ptr a` in SerializedCompact are inaccurate because of the `a``SerializedCompactPtr` is defined as:
```hs
data SerializedCompact a = SerializedCompact
{ serializedCompactBlockList :: [(Ptr a, Word)]
, serializedCompactRoot :: Ptr a
}
```
But, these `Ptr a` values are a lie, because they don...`SerializedCompactPtr` is defined as:
```hs
data SerializedCompact a = SerializedCompact
{ serializedCompactBlockList :: [(Ptr a, Word)]
, serializedCompactRoot :: Ptr a
}
```
But, these `Ptr a` values are a lie, because they don't point to something of type 'a', which makes the documentation for `ghc-compact` sort of confusing to look at. A more accurate type would just be `Addr`.
The consequences of this being changes to `Addr` are
1: breaking API changes (though not many people use compact regions)
2: A dependency on primitive would be necessary, though I'm again unsure how big of a deal this is, given that ghc-compact already depends on bytestring. (`Addr` should probably be moved to base, and re-exported from primitive, which would avoid this issue.)
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/compact |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | andrewthad, ezyang |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Both `Ptr a` in SerializedCompact are inaccurate because of the `a`","status":"New","operating_system":"","component":"libraries/compact","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"ezyang"},"version":"8.4.3","keywords":["compact","ghc-compact,","regions"],"differentials":[],"test_case":"","architecture":"","cc":["andrewthad","ezyang"],"type":"Bug","description":"{{{SerializedCompactPtr}}} is defined as:\r\n\r\n{{{#!hs\r\ndata SerializedCompact a = SerializedCompact\r\n { serializedCompactBlockList :: [(Ptr a, Word)]\r\n , serializedCompactRoot :: Ptr a\r\n }\r\n}}}\r\n\r\nBut, these {{{Ptr a}}} values are a lie, because they don't point to something of type 'a', which makes the documentation for {{{ghc-compact}}} sort of confusing to look at. A more accurate type would just be {{{Addr}}}.\r\n\r\nThe consequences of this being changes to {{{Addr}}} are\r\n1: breaking API changes (though not many people use compact regions)\r\n2: A dependency on primitive would be necessary, though I'm again unsure how big of a deal this is, given that ghc-compact already depends on bytestring. ({{{Addr}}} should probably be moved to base, and re-exported from primitive, which would avoid this issue.)","type_of_failure":"OtherFailure","blocking":[]} -->9.0.1Edward Z. YangEdward Z. Yanghttps://gitlab.haskell.org/ghc/ghc/-/issues/15654Use deriving Functor in the codebase2019-07-07T18:03:34ZKrzysztof GogolewskiUse deriving Functor in the codebaseIn many places in compiler/ we manually define a Functor instance (`git grep "instance Functor"` shows 60). I think we could switch to `deriving` in most (or all?) cases.
<details><summary>Trac metadata</summary>
| Trac field ...In many places in compiler/ we manually define a Functor instance (`git grep "instance Functor"` shows 60). I think we could switch to `deriving` in most (or all?) cases.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| 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":"Use deriving Functor in the codebase","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"In many places in compiler/ we manually define a Functor instance (`git grep \"instance Functor\"` shows 60). I think we could switch to `deriving` in most (or all?) cases.","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1Krzysztof GogolewskiKrzysztof Gogolewskihttps://gitlab.haskell.org/ghc/ghc/-/issues/15656Extend -Wall with incomplete-uni-patterns and incomplete-record-updates2023-01-29T12:42:06ZChaitanya Koparkarckoparkar@gmail.comExtend -Wall with incomplete-uni-patterns and incomplete-record-updatesThe [proposal](https://github.com/ghc-proposals/ghc-proposals/pull/71) has been accepted, and could be implemented.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------...The [proposal](https://github.com/ghc-proposals/ghc-proposals/pull/71) has been accepted, and could be implemented.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.4.3 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | tomjaguarpaw |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Extend -Wall with incomplete-uni-patterns and incomplete-record-updates","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":["GHCProposal"],"differentials":[],"test_case":"","architecture":"","cc":["tomjaguarpaw"],"type":"FeatureRequest","description":"The [https://github.com/ghc-proposals/ghc-proposals/pull/71 proposal] has been accepted, and could be implemented.","type_of_failure":"OtherFailure","blocking":[]} -->9.2.1Chaitanya Koparkarckoparkar@gmail.comChaitanya Koparkarckoparkar@gmail.comhttps://gitlab.haskell.org/ghc/ghc/-/issues/15658strange inferred kind with TypeInType2019-07-07T18:03:34Zdmwitstrange inferred kind with TypeInTypeThis type family has a strange kind to begin with:
```
{-# Language TypeFamilies , TypeInType #-}
type family F f a :: a
```
But it gets even stranger when you ask ghci what it thinks about F:
```
> :k F
F :: * -> forall a -> a
```
T...This type family has a strange kind to begin with:
```
{-# Language TypeFamilies , TypeInType #-}
type family F f a :: a
```
But it gets even stranger when you ask ghci what it thinks about F:
```
> :k F
F :: * -> forall a -> a
```
There is a forall which doesn't seem to bind any variables and hasn't got the customary delimiting dot.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"strange inferred kind with TypeInType","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This type family has a strange kind to begin with:\r\n\r\n{{{\r\n{-# Language TypeFamilies , TypeInType #-}\r\ntype family F f a :: a\r\n}}}\r\n\r\nBut it gets even stranger when you ask ghci what it thinks about F:\r\n\r\n{{{\r\n> :k F\r\nF :: * -> forall a -> a\r\n}}}\r\n\r\nThere is a forall which doesn't seem to bind any variables and hasn't got the customary delimiting dot.","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/15659Wacky error message when RULE mentions out-of-scope variable2019-07-07T18:03:33ZRyan ScottWacky error message when RULE mentions out-of-scope variableIf I compile the following program with GHC 8.4 or later:
```hs
module Foo where
{-# RULES "test" forall x. f x = x #-}
```
The error message I get is somewhat eyebrow-raising:
```
$ /opt/ghc/8.4.3/bin/ghc Foo.hs
[1 of 1] Compiling F...If I compile the following program with GHC 8.4 or later:
```hs
module Foo where
{-# RULES "test" forall x. f x = x #-}
```
The error message I get is somewhat eyebrow-raising:
```
$ /opt/ghc/8.4.3/bin/ghc Foo.hs
[1 of 1] Compiling Foo ( Foo.hs, Foo.o )
Foo.hs:3:11: error:
Rule "test":
Not in scope: OutOfScope(f)
in left-hand side: f x
LHS must be of form (f e1 .. en) where f is not forall'd
|
3 | {-# RULES "test" forall x. f x = x #-}
| ^^^^^^^^^^^^^^^^^^^^^^^^
```
I'm not sure what this `OutOfScope` business is, but I doubt we want to be referring to it in error messages. The error in GHC 8.2 and earlier was much less confusing:
```
$ /opt/ghc/8.2.2/bin/ghc Foo.hs
[1 of 1] Compiling Foo ( Foo.hs, Foo.o )
Foo.hs:3:11: error:
Rule "test":
Not in scope: f
in left-hand side: f x
LHS must be of form (f e1 .. en) where f is not forall'd
|
3 | {-# RULES "test" forall x. f x = x #-}
| ^^^^^^^^^^^^^^^^^^^^^^^^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Wacky error message when RULE mentions out-of-scope variable","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":["newcomer"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"If I compile the following program with GHC 8.4 or later:\r\n\r\n{{{#!hs\r\nmodule Foo where\r\n\r\n{-# RULES \"test\" forall x. f x = x #-}\r\n}}}\r\n\r\nThe error message I get is somewhat eyebrow-raising:\r\n\r\n{{{\r\n$ /opt/ghc/8.4.3/bin/ghc Foo.hs\r\n[1 of 1] Compiling Foo ( Foo.hs, Foo.o )\r\n\r\nFoo.hs:3:11: error:\r\n Rule \"test\":\r\n Not in scope: OutOfScope(f)\r\n in left-hand side: f x\r\n LHS must be of form (f e1 .. en) where f is not forall'd\r\n |\r\n3 | {-# RULES \"test\" forall x. f x = x #-}\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^\r\n}}}\r\n\r\nI'm not sure what this `OutOfScope` business is, but I doubt we want to be referring to it in error messages. The error in GHC 8.2 and earlier was much less confusing:\r\n\r\n{{{\r\n$ /opt/ghc/8.2.2/bin/ghc Foo.hs\r\n[1 of 1] Compiling Foo ( Foo.hs, Foo.o )\r\n\r\nFoo.hs:3:11: error:\r\n Rule \"test\":\r\n Not in scope: f\r\n in left-hand side: f x\r\n LHS must be of form (f e1 .. en) where f is not forall'd\r\n |\r\n3 | {-# RULES \"test\" forall x. f x = x #-}\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15662Line pragmas appear to be slightly broken with Clang's CPP2020-05-06T20:19:39ZBen GamariLine pragmas appear to be slightly broken with Clang's CPPTwo tests fail on OS X due to CPP irregularities,
```
7 --- /var/folders/3y/qjvrbynj45j_z4jt_l1k1qg00000gv/T/ghctest-jb4vg3rr/test spaces/parser/should_fail/readFail032.run/readFail032.stderr.normalised 2018-09-18 09:07:49.000000000 +...Two tests fail on OS X due to CPP irregularities,
```
7 --- /var/folders/3y/qjvrbynj45j_z4jt_l1k1qg00000gv/T/ghctest-jb4vg3rr/test spaces/parser/should_fail/readFail032.run/readFail032.stderr.normalised 2018-09-18 09:07:49.000000000 +0300
8 +++ /var/folders/3y/qjvrbynj45j_z4jt_l1k1qg00000gv/T/ghctest-jb4vg3rr/test spaces/parser/should_fail/readFail032.run/readFail032.comp.stderr.normalised 2018-09-18 09:07:49.000000000 +0300
9 @@ -1,5 +1,5 @@
10
11 -readFail032.hs:25:38:
12 +readFail032.hs:26:38:
13 Couldn't match type ‘Char’ with ‘[Char]’
14 Expected type: [[Char]]
15 Actual type: [Char]
16 --- /var/folders/3y/qjvrbynj45j_z4jt_l1k1qg00000gv/T/ghctest-jb4vg3rr/test spaces/parser/should_fail/readFail048.run/readFail048.stderr.normalised 2018-09-18 09:07:50.000000000 +0300
17 +++ /var/folders/3y/qjvrbynj45j_z4jt_l1k1qg00000gv/T/ghctest-jb4vg3rr/test spaces/parser/should_fail/readFail048.run/readFail048.comp.stderr.normalised 2018-09-18 09:07:50.000000000 +0300
18 @@ -1,5 +1,5 @@
19
20 -readFail048.hs:25:38:
21 +readFail048.hs:26:38:
22 Couldn't match type ‘Char’ with ‘[Char]’
23 Expected type: [[Char]]
24 Actual type: [Char]
```
This appears to be a CPP bug.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Line pragmas appear to be slightly broken with Clang's CPP","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Two tests fail on OS X due to CPP irregularities,\r\n{{{\r\n7\t--- /var/folders/3y/qjvrbynj45j_z4jt_l1k1qg00000gv/T/ghctest-jb4vg3rr/test spaces/parser/should_fail/readFail032.run/readFail032.stderr.normalised\t2018-09-18 09:07:49.000000000 +0300\r\n8\t+++ /var/folders/3y/qjvrbynj45j_z4jt_l1k1qg00000gv/T/ghctest-jb4vg3rr/test spaces/parser/should_fail/readFail032.run/readFail032.comp.stderr.normalised\t2018-09-18 09:07:49.000000000 +0300\r\n9\t@@ -1,5 +1,5 @@\r\n10\t \r\n11\t-readFail032.hs:25:38:\r\n12\t+readFail032.hs:26:38:\r\n13\t Couldn't match type ‘Char’ with ‘[Char]’\r\n14\t Expected type: [[Char]]\r\n15\t Actual type: [Char]\r\n16\t--- /var/folders/3y/qjvrbynj45j_z4jt_l1k1qg00000gv/T/ghctest-jb4vg3rr/test spaces/parser/should_fail/readFail048.run/readFail048.stderr.normalised\t2018-09-18 09:07:50.000000000 +0300\r\n17\t+++ /var/folders/3y/qjvrbynj45j_z4jt_l1k1qg00000gv/T/ghctest-jb4vg3rr/test spaces/parser/should_fail/readFail048.run/readFail048.comp.stderr.normalised\t2018-09-18 09:07:50.000000000 +0300\r\n18\t@@ -1,5 +1,5 @@\r\n19\t \r\n20\t-readFail048.hs:25:38:\r\n21\t+readFail048.hs:26:38:\r\n22\t Couldn't match type ‘Char’ with ‘[Char]’\r\n23\t Expected type: [[Char]]\r\n24\t Actual type: [Char]\r\n}}}\r\n\r\nThis appears to be a CPP bug.","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/15664Core Lint error2019-07-07T18:03:32ZIcelandjackCore Lint errorFrom [Generic Programming of All Kinds](https://dl.acm.org/citation.cfm?id=3242745),
```hs
{-# Language RankNTypes, TypeOperators, DataKinds, PolyKinds, GADTs, TypeInType, TypeFamilies #-}
{-# Options_GHC -dcore-lint #-}
import Data.K...From [Generic Programming of All Kinds](https://dl.acm.org/citation.cfm?id=3242745),
```hs
{-# Language RankNTypes, TypeOperators, DataKinds, PolyKinds, GADTs, TypeInType, TypeFamilies #-}
{-# Options_GHC -dcore-lint #-}
import Data.Kind
import GHC.Exts
import Data.Function
data Ctx :: Type -> Type where
E :: Ctx(Type)
(:&:) :: a -> Ctx(as) -> Ctx(a -> as)
type family
Apply(kind) (f :: kind) (ctx :: Ctx kind) :: Type where
Apply(Type) a E = a
Apply(k -> ks) f (a:&:as) = Apply(ks) (f a) as
data ApplyT kind :: kind -> Ctx(kind) -> Type where
A0 :: a
-> ApplyT(Type) a E
AS :: ApplyT(ks) (f a) as
-> ApplyT(k -> ks) f (a:&:as)
type f ~> g = (forall xx. f xx -> g xx)
unravel :: ApplyT(k) f ~> Apply(k) f
unravel (A0 a) = a
unravel (AS fa) = unravel fa
```
gives a core lint error
```
$ ghci -ignore-dot-ghci hs/443.hs > /tmp/bug.log
```8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15666Dependent type synonym in recursive type family causes GHC to panic2019-07-07T18:03:32ZtydeuDependent type synonym in recursive type family causes GHC to panic# Background
I had written the following code in Haskell (GHC):
```hs
{-# LANGUAGE
NoImplicitPrelude,
TypeInType, PolyKinds, DataKinds,
ScopedTypeVariables,
TypeFamilies,
UndecidableInstances
#-}
import Data.Kind(Type)
dat...# Background
I had written the following code in Haskell (GHC):
```hs
{-# LANGUAGE
NoImplicitPrelude,
TypeInType, PolyKinds, DataKinds,
ScopedTypeVariables,
TypeFamilies,
UndecidableInstances
#-}
import Data.Kind(Type)
data PolyType k (t :: k)
type Wrap (t :: k) = PolyType k t
type Unwrap pt = (GetType pt :: GetKind pt)
type family GetKind (pt :: Type) :: Type where
GetKind (PolyType k t) = k
type family GetType (pt :: Type) :: k where
GetType (PolyType k t) = t
```
The intention of this code is to allow me to wrap a type of an arbitrary kind
into a type (namely `PolyType`) of a single kind (namely `Type`) and then
reverse the process (i.e. unwrap it) later.
# Problem
I wanted to define a function that would recursively operate on a composite type like so:
```hs
data Composite :: a -> b -> Type
type family RecursiveWrap expr where
RecursiveWrap (Composite a b) =
Wrap (Composite (Unwrap (RecursiveWrap a)) (Unwrap (RecursiveWrap b)))
RecursiveWrap x = Wrap x
```
However, the above definition causes GHC to panic:
```
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-mingw32):
cyclic evaluation in fixIO
```
# Ideas
If we inline the the `Unwrap` synoynm into the defintion of the type family
above like so:
```hs
type family RecursiveWrap expr where
RecursiveWrap (Composite a b) =
Wrap (Composite
(GetType (RecursiveWrap a) :: GetKind (RecursiveWrap a))
(GetType (RecursiveWrap a) :: GetKind (RecursiveWrap a))
)
RecursiveWrap x = Wrap x
```
GHC instead simply produces an error:
```
* Type constructor `RecursiveWrap' cannot be used here
(it is defined and used in the same recursive group)
* In the first argument of `GetKind', namely `(RecursiveWrap a)'
In the kind `GetKind (RecursiveWrap a)'
In the first argument of `Composite', namely
`(GetType (RecursiveWrap a) :: GetKind (RecursiveWrap a))'
```
As such, I suspect this has to do with the recursive type family appearing in
the kind signature when the `Unwrap` type synonym is expanded.
However, it strikes me as odd that even the above code errors. Since with the
`UndecidableInstances` extension turned on, I think that I should be able to
write recursive type families like the above. Especially given that the above
family would not loop indefinitely and thus be reducible.8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15667Readonly permissions bits are wrong2019-07-07T18:03:31ZTamar ChristinaReadonly permissions bits are wrongUnfortunately it seems the mapping for the permission bits for GHC 8.6.1 seem to have gotten screwed up.
When installed to a read-only location GHC is no longer working due to it attempting to get write access as well.
<details><summar...Unfortunately it seems the mapping for the permission bits for GHC 8.6.1 seem to have gotten screwed up.
When installed to a read-only location GHC is no longer working due to it attempting to get write access as well.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Readonly permissions bits are wrong","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Unfortunately it seems the mapping for the permission bits for GHC 8.6.1 seem to have gotten screwed up.\r\n\r\nWhen installed to a read-only location GHC is no longer working due to it attempting to get write access as well.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15669T7040_ghci has a suspicious testcase failure2019-07-07T18:03:30ZTamar ChristinaT7040_ghci has a suspicious testcase failureT7040_ghci has a weird failure. This looks like BSS initialization issue in the linker maybe?
```
+++ rts/T7040_ghci.run/T7040_ghci.run.stdout.normalised 2018-09-23 17:26:01.197146900 +0100
@@ -1,2 +1,2 @@
-x: 0
+x: 493156
x: 1
```
Lu...T7040_ghci has a weird failure. This looks like BSS initialization issue in the linker maybe?
```
+++ rts/T7040_ghci.run/T7040_ghci.run.stdout.normalised 2018-09-23 17:26:01.197146900 +0100
@@ -1,2 +1,2 @@
-x: 0
+x: 493156
x: 1
```
Luckily the value seems to mutate correctly. So it may just be a simple missing `memset`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"T7040_ghci has a suspicious testcase failure","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"T7040_ghci has a weird failure. This looks like BSS initialization issue in the linker maybe?\r\n\r\n{{{\r\n+++ rts/T7040_ghci.run/T7040_ghci.run.stdout.normalised 2018-09-23 17:26:01.197146900 +0100\r\n@@ -1,2 +1,2 @@\r\n-x: 0\r\n+x: 493156\r\n x: 1\r\n}}}\r\n\r\nLuckily the value seems to mutate correctly. So it may just be a simple missing `memset`.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15670FloatFnInverses seems to show some weird rounding/precision issues.2022-04-08T14:00:08ZTamar ChristinaFloatFnInverses seems to show some weird rounding/precision issues.There seems to be a rounding issue with math functions on Windows. We likely need a crt update to fix this. Or maybe check the round mode if it's being set correctly.
```
--- numeric/should_run/FloatFnInverses.run/FloatFnInverses.stdout...There seems to be a rounding issue with math functions on Windows. We likely need a crt update to fix this. Or maybe check the round mode if it's being set correctly.
```
--- numeric/should_run/FloatFnInverses.run/FloatFnInverses.stdout.normalised 2018-09-23 17:26:01.581150200 +0100
+++ numeric/should_run/FloatFnInverses.run/FloatFnInverses.run.stdout.normalised 2018-09-23 17:26:01.583146400 +0100
@@ -8,8 +8,8 @@
[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
-[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
-[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
+[Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity]
+[7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-7.788445287802241e33,-7.788445287802241e33,-7.788445287802241e33,-7.788445287802241e33,-7.788445287802241e33]
[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
[0.0,0.0,0.0,0.0,0.0,0.0]
[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"FloatFnInverses seems to show some weird rounding/precision issues.","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"\r\nThere seems to be a rounding issue with math functions on Windows. We likely need a crt update to fix this. Or maybe check the round mode if it's being set correctly.\r\n\r\n{{{\r\n--- numeric/should_run/FloatFnInverses.run/FloatFnInverses.stdout.normalised 2018-09-23 17:26:01.581150200 +0100\r\n+++ numeric/should_run/FloatFnInverses.run/FloatFnInverses.run.stdout.normalised 2018-09-23 17:26:01.583146400 +0100\r\n@@ -8,8 +8,8 @@\r\n [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]\r\n [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]\r\n [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]\r\n-[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]\r\n-[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]\r\n+[Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity,-Infinity]\r\n+[7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-7.788445287802241e33,-7.788445287802241e33,-7.788445287802241e33,-7.788445287802241e33,-7.788445287802241e33]\r\n [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]\r\n [0.0,0.0,0.0,0.0,0.0,0.0]\r\n [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15671Link errors due to forcibly exporting findPtr2019-07-07T18:03:30ZTamar ChristinaLink errors due to forcibly exporting findPtrThe change in https://phabricator.haskell.org/rGHC900c47f88784b91517c00be3e1087322e62f698e is causing link errors due to the combination of `-Wl,-u` and `-Wl,--export-all-symbols`
```
Wrong exit code for T10955dyn()(expected 0 , actual ...The change in https://phabricator.haskell.org/rGHC900c47f88784b91517c00be3e1087322e62f698e is causing link errors due to the combination of `-Wl,-u` and `-Wl,--export-all-symbols`
```
Wrong exit code for T10955dyn()(expected 0 , actual 2 )
Stderr ( T10955dyn ):
E:/ghc-dev/msys64/home/Tamar/ghc/rts/dist/build/libHSrts_thr.a(Printer.thr_o): In function `findPtr':
E:\ghc-dev\msys64\home\Tamar\ghc/rts/Printer.c:880: multiple definition of `findPtr'
./bin_dyn/libA.dll.a(d020776.o):(.text+0x0): first defined here
```
I believe the correct solution is to just use a cabal flag to emulate the setup we had with make, instead of forcing this symbol always.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------------------------------------- |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | [D5138](https://phabricator.haskell.org/D5138) |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Link errors due to forcibly exporting findPtr","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[5138],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The change in https://phabricator.haskell.org/rGHC900c47f88784b91517c00be3e1087322e62f698e is causing link errors due to the combination of `-Wl,-u` and `-Wl,--export-all-symbols`\r\n\r\n{{{\r\nWrong exit code for T10955dyn()(expected 0 , actual 2 )\r\nStderr ( T10955dyn ):\r\nE:/ghc-dev/msys64/home/Tamar/ghc/rts/dist/build/libHSrts_thr.a(Printer.thr_o): In function `findPtr':\r\nE:\\ghc-dev\\msys64\\home\\Tamar\\ghc/rts/Printer.c:880: multiple definition of `findPtr'\r\n./bin_dyn/libA.dll.a(d020776.o):(.text+0x0): first defined here\r\n}}}\r\n\r\nI believe the correct solution is to just use a cabal flag to emulate the setup we had with make, instead of forcing this symbol always.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Alp MestanogullariAlp Mestanogullarihttps://gitlab.haskell.org/ghc/ghc/-/issues/15673heap overflow with Bits.shift and Integer2019-07-07T18:03:29Zmcmayerheap overflow with Bits.shift and IntegerThe following few lines produce a GHC panic:
```hs
module Main where
import Data.Bits (shift)
badOne :: [Int] -> Integer -- replace Integer by Int and all is good!
badOne is = sum $ zipWith (\n _->shift 1 n) [0..] is
main = retur...The following few lines produce a GHC panic:
```hs
module Main where
import Data.Bits (shift)
badOne :: [Int] -> Integer -- replace Integer by Int and all is good!
badOne is = sum $ zipWith (\n _->shift 1 n) [0..] is
main = return () :: IO ()
```
The function is stripped down as much as possible, it doesn't perform anything all to meaningful anymore.
The error message is:
```bash
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-apple-darwin):
heap overflow
```
All else is off-the-shelf stack lts-12.10 via
```bash
stack new bad-one simple
```
Tested on Mac OS X and Debian.
This has some resemblance with [\#14959](https://ghc.haskell.org/trac/ghc/ticket/14959), which was fixed in 8.4.2.8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15675Type operators in existential context cannot be parsed2019-07-07T18:03:29ZVladislav ZavialovType operators in existential context cannot be parsed```haskell
{-# LANGUAGE TypeOperators, MultiParamTypeClasses, ExistentialQuantification #-}
class a + b
data D1 = forall a b. (a + b) => D1 a b
data D2 = forall a b. a + b => D2 a b
```
The declaration `D1` is accepted, while `D2` i...```haskell
{-# LANGUAGE TypeOperators, MultiParamTypeClasses, ExistentialQuantification #-}
class a + b
data D1 = forall a b. (a + b) => D1 a b
data D2 = forall a b. a + b => D2 a b
```
The declaration `D1` is accepted, while `D2` is rejected. There is no reason to reject `D2` except for shortcomings of the current grammar.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------- |
| Version | 8.4.3 |
| 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":"Type operators in existential context cannot be parsed","status":"New","operating_system":"","component":"Compiler (Parser)","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!haskell\r\n{-# LANGUAGE TypeOperators, MultiParamTypeClasses, ExistentialQuantification #-}\r\n\r\nclass a + b\r\n\r\ndata D1 = forall a b. (a + b) => D1 a b\r\ndata D2 = forall a b. a + b => D2 a b\r\n}}}\r\n\r\nThe declaration `D1` is accepted, while `D2` is rejected. There is no reason to reject `D2` except for shortcomings of the current grammar.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Vladislav ZavialovVladislav Zavialovhttps://gitlab.haskell.org/ghc/ghc/-/issues/15679Use String rather than [Char] where possible2020-06-05T13:28:30ZSimon Peyton JonesUse String rather than [Char] where possibleTry this in GHCi
```
Prelude> :t "foo"
"foo" :: [Char]
```
It would be better to say
```
"foo" :: String
```
Why don't we? Because of this in `TysWiredIn`
```
stringTy :: Type
stringTy = mkListTy charTy -- convenience only
```
That...Try this in GHCi
```
Prelude> :t "foo"
"foo" :: [Char]
```
It would be better to say
```
"foo" :: String
```
Why don't we? Because of this in `TysWiredIn`
```
stringTy :: Type
stringTy = mkListTy charTy -- convenience only
```
That is, where GHC needs `String` is uses `stringTy` which is just `[Char]`.
How to fix? Two ways:
1. Make `String` into a "wired-in type". That's not hard, but it increases the number of wired-in types, which is generally undesirable.
1. Make `String` into a "knonw-key name", and look it up in the type environment on the (few) occasions where we need `stringTy`. That's a little harder -- notably `hsLitType` would become monadic -- but not difficult.
<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":"Use String rather than [Char] where possible","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Try this in GHCi\r\n{{{\r\nPrelude> :t \"foo\"\r\n\"foo\" :: [Char]\r\n}}}\r\nIt would be better to say \r\n{{{\r\n\"foo\" :: String\r\n}}}\r\nWhy don't we? Because of this in `TysWiredIn`\r\n{{{\r\nstringTy :: Type\r\nstringTy = mkListTy charTy -- convenience only\r\n}}}\r\nThat is, where GHC needs `String` is uses `stringTy` which is just `[Char]`. \r\n\r\nHow to fix? Two ways:\r\n\r\n1. Make `String` into a \"wired-in type\". That's not hard, but it increases the number of wired-in types, which is generally undesirable.\r\n\r\n2. Make `String` into a \"knonw-key name\", and look it up in the type environment on the (few) occasions where we need `stringTy`. That's a little harder -- notably `hsLitType` would become monadic -- but not difficult.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15685Pattern signature not inferred2019-07-07T18:03:27ZIcelandjackPattern signature not inferredShould this pattern synonym declaration fail,
```hs
{-# Language DataKinds, TypeOperators, PolyKinds, GADTs, PatternSynonyms #-}
import Data.Kind
data NS f as where
Here :: f a -> NS f (a:as)
data NP :: (k -> Type) -> ([k] -> Type) ...Should this pattern synonym declaration fail,
```hs
{-# Language DataKinds, TypeOperators, PolyKinds, GADTs, PatternSynonyms #-}
import Data.Kind
data NS f as where
Here :: f a -> NS f (a:as)
data NP :: (k -> Type) -> ([k] -> Type) where
Nil :: NP f '[]
pattern HereNil = Here Nil
```
```
$ ghci -ignore-dot-ghci hs/457.hs
GHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( hs/457.hs, interpreted ) [flags changed]
hs/457.hs:11:19: error:
• Could not deduce: f ~~ NP f0
from the context: (as ~ (a1 : as1), GHC.Types.Any ~ '[])
bound by the signature for pattern synonym ‘HereNil’
at hs/457.hs:11:1-26
‘f’ is a rigid type variable bound by
the signature for pattern synonym ‘HereNil’
at hs/457.hs:11:1-26
Expected type: NS f as
Actual type: NS (NP f0) ('[] : as0)
• In the expression: Here Nil
In an equation for ‘HereNil’: HereNil = Here Nil
• Relevant bindings include
$bHereNil :: NS f as (bound at hs/457.hs:11:9)
|
11 | pattern HereNil = Here Nil
| ^^^^^^^^
hs/457.hs:11:24: error:
• Kind mismatch: cannot unify (f :: a -> *) with:
NP a0 :: [GHC.Types.Any] -> *
Their kinds differ.
Expected type: f a1
Actual type: NP a0 GHC.Types.Any
• In the pattern: Nil
In the pattern: Here Nil
In the declaration for pattern synonym ‘HereNil’
|
11 | pattern HereNil = Here Nil
| ^^^
Failed, no modules loaded.
Prelude>
```
It can be given a pattern signature, my question is can this not be inferred
```hs
-- pattern HereNil :: NS (NP f) ('[]:as)
pattern HereNil :: () => (nil_as ~ ('[]:as)) => NS (NP f) nil_as
pattern HereNil = Here Nil
```
<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":"Pattern signature not inferred","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["PatternSynonyms"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Should this pattern synonym declaration fail, \r\n\r\n{{{#!hs\r\n{-# Language DataKinds, TypeOperators, PolyKinds, GADTs, PatternSynonyms #-}\r\n\r\nimport Data.Kind\r\n\r\ndata NS f as where\r\n Here :: f a -> NS f (a:as)\r\n\r\ndata NP :: (k -> Type) -> ([k] -> Type) where\r\n Nil :: NP f '[]\r\n\r\npattern HereNil = Here Nil\r\n}}}\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci hs/457.hs\r\nGHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( hs/457.hs, interpreted ) [flags changed]\r\n\r\nhs/457.hs:11:19: error:\r\n • Could not deduce: f ~~ NP f0\r\n from the context: (as ~ (a1 : as1), GHC.Types.Any ~ '[])\r\n bound by the signature for pattern synonym ‘HereNil’\r\n at hs/457.hs:11:1-26\r\n ‘f’ is a rigid type variable bound by\r\n the signature for pattern synonym ‘HereNil’\r\n at hs/457.hs:11:1-26\r\n Expected type: NS f as\r\n Actual type: NS (NP f0) ('[] : as0)\r\n • In the expression: Here Nil\r\n In an equation for ‘HereNil’: HereNil = Here Nil\r\n • Relevant bindings include\r\n $bHereNil :: NS f as (bound at hs/457.hs:11:9)\r\n |\r\n11 | pattern HereNil = Here Nil\r\n | ^^^^^^^^\r\n\r\nhs/457.hs:11:24: error:\r\n • Kind mismatch: cannot unify (f :: a -> *) with:\r\n NP a0 :: [GHC.Types.Any] -> *\r\n Their kinds differ.\r\n Expected type: f a1\r\n Actual type: NP a0 GHC.Types.Any\r\n • In the pattern: Nil\r\n In the pattern: Here Nil\r\n In the declaration for pattern synonym ‘HereNil’\r\n |\r\n11 | pattern HereNil = Here Nil\r\n | ^^^\r\nFailed, no modules loaded.\r\nPrelude> \r\n}}}\r\n\r\nIt can be given a pattern signature, my question is can this not be inferred\r\n\r\n{{{#!hs\r\n-- pattern HereNil :: NS (NP f) ('[]:as)\r\npattern HereNil :: () => (nil_as ~ ('[]:as)) => NS (NP f) nil_as\r\npattern HereNil = Here Nil\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15686Different results depending on if the code was compiled with or without optim...2019-07-07T18:03:27ZDarwin226Different results depending on if the code was compiled with or without optimizationsThe test case consists of three files:
Main.hs
```hs
{-# LANGUAGE OverloadedLists, BangPatterns #-}
{-# OPTIONS_GHC -ddump-simpl -dsuppress-all -ddump-to-file #-}
module Main where
import Mesh
import Vec
import Control.Exception
main...The test case consists of three files:
Main.hs
```hs
{-# LANGUAGE OverloadedLists, BangPatterns #-}
{-# OPTIONS_GHC -ddump-simpl -dsuppress-all -ddump-to-file #-}
module Main where
import Mesh
import Vec
import Control.Exception
main :: IO ()
main = do
!_ <- evaluate $ toBondForce (Particle {_position = Vec {_vecX = 0.0, _vecY = -20.0}, _mass = 10.0, _velocity = Vec {_vecX = 0.0, _vecY = 3.0}}) (Particle {_position = Vec {_vecX = 20.0, _vecY = -20.0}, _mass = 10.0, _velocity = Vec {_vecX = 0.0, _vecY = 0.0}}) (FixedDistanceBond {_distance = 20.0, _strength = 0.5})
return ()
```
Vec.hs
```hs
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, FunctionalDependencies #-}
module Vec where
data Vec = Vec { _vecX :: {-# UNPACK #-}!Double, _vecY :: {-# UNPACK #-}!Double }
deriving (Eq, Ord, Read, Show)
liftVec :: (Double -> Double -> Double) -> Vec -> Vec -> Vec
liftVec f (Vec x y) (Vec z w) = Vec (f x z) (f y w)
{-# INLINE liftVec #-}
instance Num Vec where
fromInteger i = Vec (fromInteger i) (fromInteger i)
(+) a b = liftVec (+) a b
{-# INLINE (+) #-}
(*) a b = liftVec (*) a b
{-# INLINE (*) #-}
(-) a b = liftVec (-) a b
{-# INLINE (-) #-}
signum (Vec x y) = Vec (signum x) (signum y)
abs (Vec x y) = Vec (abs x) (abs y)
instance Fractional Vec where
fromRational r = Vec (fromRational r) (fromRational r)
(/) = liftVec (/)
{-# INLINE (/) #-}
fromDouble :: Double -> Vec
fromDouble x = Vec x x
{-# INLINE fromDouble #-}
class Vector2D v where
norm :: v -> Double
normalize :: v -> v
distance :: v -> v -> Double
dot :: v -> v -> Double
project :: v -> v -> v
instance Vector2D Vec where
norm (Vec x y) = sqrt (x ** 2 + y ** 2)
{-# INLINE norm #-}
normalize v@(Vec x y) = Vec (x / n) (y / n)
where
n = norm v
{-# INLINE normalize #-}
distance v1 v2 = norm (v2 - v1)
{-# INLINE distance #-}
dot (Vec x y) (Vec z w) = x * z + y * w
{-# INLINE dot #-}
project tgt v = normTgt * realToFrac (dot normTgt v)
where normTgt = normalize tgt
{-# INLINE project #-}
```
Mesh.hs
```hs
{-# LANGUAGE Strict, RecordWildCards, TemplateHaskell, BangPatterns #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, FunctionalDependencies #-}
{-# OPTIONS_GHC -ddump-simpl -dsuppress-all -ddump-to-file #-}
module Mesh where
import Vec
import Debug.Trace
data Particle = Particle
{ _position :: {-# UNPACK #-}!Vec
, _mass :: {-# UNPACK #-}!Double
, _velocity :: {-# UNPACK #-}!Vec }
deriving (Eq, Ord, Read, Show)
data Bond = FixedDistanceBond
{ _distance :: {-# UNPACK #-}!Double
, _strength :: {-# UNPACK #-}!Double }
deriving (Eq, Ord, Read, Show)
toBondForce :: Particle -> Particle -> Bond -> Vec
toBondForce Particle{..} !p2 FixedDistanceBond{..} =
traceShow (show (Mesh._position p2, dir)) $ dir * fromDouble (actualDist - _distance) * fromDouble _strength - project dir velDiff * 0.1
where
posDiff = Mesh._position p2 - _position
dir = normalize posDiff
actualDist = norm posDiff
velDiff = _velocity - Mesh._velocity p2
```
Compiling Main.hs with optimizations (-O2) and running the program produces the output "(Vec {_vecX = 20.0, _vecY = 0.0},Vec {_vecX = 1.0, _vecY = 0.0})" while compiling without optimizations produces "(Vec {_vecX = 20.0, _vecY = -20.0},Vec {_vecX = 1.0, _vecY = 0.0})" which is correct.
Further observations:
Changing `traceShow (show (Mesh._position p2, dir))` to `traceShow (show (Mesh._position p2))` makes the code perform correctly even with optimizations.
The core output looks correct to me even with optimizations.
I can't test with other GHC versions on Windows, but I know I can't reproduce this with GHC 8.4 on Linux and I think it also doesn't reproduce with 8.2 on Linux.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Different results depending on if the code was compiled with or without optimizations","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The test case consists of three files:\r\n\r\nMain.hs\r\n{{{#!hs\r\n{-# LANGUAGE OverloadedLists, BangPatterns #-}\r\n{-# OPTIONS_GHC -ddump-simpl -dsuppress-all -ddump-to-file #-}\r\nmodule Main where\r\n\r\nimport Mesh\r\nimport Vec\r\nimport Control.Exception\r\n\r\nmain :: IO ()\r\nmain = do\r\n !_ <- evaluate $ toBondForce (Particle {_position = Vec {_vecX = 0.0, _vecY = -20.0}, _mass = 10.0, _velocity = Vec {_vecX = 0.0, _vecY = 3.0}}) (Particle {_position = Vec {_vecX = 20.0, _vecY = -20.0}, _mass = 10.0, _velocity = Vec {_vecX = 0.0, _vecY = 0.0}}) (FixedDistanceBond {_distance = 20.0, _strength = 0.5})\r\n return ()\r\n}}}\r\n\r\nVec.hs\r\n{{{#!hs\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, FunctionalDependencies #-}\r\nmodule Vec where\r\n\r\ndata Vec = Vec { _vecX :: {-# UNPACK #-}!Double, _vecY :: {-# UNPACK #-}!Double }\r\n deriving (Eq, Ord, Read, Show)\r\n\r\nliftVec :: (Double -> Double -> Double) -> Vec -> Vec -> Vec\r\nliftVec f (Vec x y) (Vec z w) = Vec (f x z) (f y w)\r\n{-# INLINE liftVec #-}\r\n\r\ninstance Num Vec where\r\n fromInteger i = Vec (fromInteger i) (fromInteger i)\r\n (+) a b = liftVec (+) a b\r\n {-# INLINE (+) #-}\r\n (*) a b = liftVec (*) a b\r\n {-# INLINE (*) #-}\r\n (-) a b = liftVec (-) a b\r\n {-# INLINE (-) #-}\r\n signum (Vec x y) = Vec (signum x) (signum y)\r\n abs (Vec x y) = Vec (abs x) (abs y)\r\ninstance Fractional Vec where\r\n fromRational r = Vec (fromRational r) (fromRational r)\r\n (/) = liftVec (/)\r\n {-# INLINE (/) #-}\r\n\r\nfromDouble :: Double -> Vec\r\nfromDouble x = Vec x x\r\n{-# INLINE fromDouble #-}\r\n\r\nclass Vector2D v where\r\n norm :: v -> Double\r\n normalize :: v -> v\r\n distance :: v -> v -> Double\r\n dot :: v -> v -> Double\r\n project :: v -> v -> v\r\n\r\ninstance Vector2D Vec where\r\n norm (Vec x y) = sqrt (x ** 2 + y ** 2)\r\n {-# INLINE norm #-}\r\n\r\n normalize v@(Vec x y) = Vec (x / n) (y / n)\r\n where\r\n n = norm v\r\n {-# INLINE normalize #-}\r\n\r\n distance v1 v2 = norm (v2 - v1)\r\n {-# INLINE distance #-}\r\n\r\n dot (Vec x y) (Vec z w) = x * z + y * w\r\n {-# INLINE dot #-}\r\n\r\n project tgt v = normTgt * realToFrac (dot normTgt v)\r\n where normTgt = normalize tgt\r\n {-# INLINE project #-}\r\n\r\n}}}\r\n\r\nMesh.hs\r\n{{{#!hs\r\n{-# LANGUAGE Strict, RecordWildCards, TemplateHaskell, BangPatterns #-}\r\n{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, FunctionalDependencies #-}\r\n{-# OPTIONS_GHC -ddump-simpl -dsuppress-all -ddump-to-file #-}\r\nmodule Mesh where\r\n\r\nimport Vec\r\nimport Debug.Trace\r\n\r\ndata Particle = Particle\r\n { _position :: {-# UNPACK #-}!Vec\r\n , _mass :: {-# UNPACK #-}!Double\r\n , _velocity :: {-# UNPACK #-}!Vec }\r\n deriving (Eq, Ord, Read, Show)\r\n\r\ndata Bond = FixedDistanceBond\r\n { _distance :: {-# UNPACK #-}!Double\r\n , _strength :: {-# UNPACK #-}!Double }\r\n deriving (Eq, Ord, Read, Show)\r\n\r\ntoBondForce :: Particle -> Particle -> Bond -> Vec\r\ntoBondForce Particle{..} !p2 FixedDistanceBond{..} =\r\n traceShow (show (Mesh._position p2, dir)) $ dir * fromDouble (actualDist - _distance) * fromDouble _strength - project dir velDiff * 0.1\r\n where\r\n posDiff = Mesh._position p2 - _position\r\n dir = normalize posDiff\r\n actualDist = norm posDiff\r\n velDiff = _velocity - Mesh._velocity p2\r\n\r\n}}}\r\n\r\nCompiling Main.hs with optimizations (-O2) and running the program produces the output \"(Vec {_vecX = 20.0, _vecY = 0.0},Vec {_vecX = 1.0, _vecY = 0.0})\" while compiling without optimizations produces \"(Vec {_vecX = 20.0, _vecY = -20.0},Vec {_vecX = 1.0, _vecY = 0.0})\" which is correct.\r\n\r\nFurther observations:\r\nChanging `traceShow (show (Mesh._position p2, dir))` to `traceShow (show (Mesh._position p2))` makes the code perform correctly even with optimizations.\r\nThe core output looks correct to me even with optimizations.\r\n\r\nI can't test with other GHC versions on Windows, but I know I can't reproduce this with GHC 8.4 on Linux and I think it also doesn't reproduce with 8.2 on Linux.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/15688HAVE_LIBNUMA is defined as non-zero even when libnuma does not exist2022-12-28T20:17:11ZÖmer Sinan AğacanHAVE_LIBNUMA is defined as non-zero even when libnuma does not existI think this is a regression introduced in the last few weeks.
The libnuma dependency is checked correctly by the configure script, but somehow when I don't have libnuma installed I still have `HAVE_LIBNUMA` defined as non-zero so I end...I think this is a regression introduced in the last few weeks.
The libnuma dependency is checked correctly by the configure script, but somehow when I don't have libnuma installed I still have `HAVE_LIBNUMA` defined as non-zero so I end up with this error:
```
/usr/bin/x86_64-linux-gnu-ld.gold: error: cannot find -lnuma
rts/posix/OSMem.c:368:0: error:
error: undefined reference to 'mbind'
|
368 | if (RtsFlags.GcFlags.numa) {
| ^
rts/posix/OSMem.c:670:0: error:
error: undefined reference to 'numa_num_configured_nodes'
|
670 | }
| ^
rts/posix/OSMem.c:680:0: error:
error: undefined reference to 'numa_get_mems_allowed'
|
680 |
| ^
rts/posix/OSMem.c:670:0: error:
error: undefined reference to 'numa_num_configured_nodes'
|
670 | }
| ^
rts/posix/OSMem.c:685:0: error:
error: undefined reference to 'numa_bitmask_free'
|
685 | mask = numa_get_mems_allowed();
| ^
rts/posix/OSMem.c:670:0: error:
error: undefined reference to 'numa_num_configured_nodes'
|
670 | }
| ^
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
utils/ghc-cabal/ghc.mk:56: recipe for target 'utils/ghc-cabal/dist/build/tmp/ghc-cabal' failed
```
Installing libnuma-dev fixes this.
Relevant lines in config.log:
```
CabalHaveLibNuma='False'
#define HAVE_LIBNUMA 0
```
I have no idea why `HAVE_LIBNUMA` is not 0 when compiling the file.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Build System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"HAVE_LIBNUMA is defined as non-zero even when libnuma does not exist","status":"New","operating_system":"","component":"Build System","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I think this is a regression introduced in the last few weeks.\r\n\r\nThe libnuma dependency is checked correctly by the configure script, but somehow when I don't have libnuma installed I still have `HAVE_LIBNUMA` defined as non-zero so I end up with this error:\r\n\r\n{{{\r\n/usr/bin/x86_64-linux-gnu-ld.gold: error: cannot find -lnuma\r\n\r\nrts/posix/OSMem.c:368:0: error:\r\n error: undefined reference to 'mbind'\r\n |\r\n368 | if (RtsFlags.GcFlags.numa) {\r\n | ^\r\n\r\nrts/posix/OSMem.c:670:0: error:\r\n error: undefined reference to 'numa_num_configured_nodes'\r\n |\r\n670 | }\r\n | ^\r\n\r\nrts/posix/OSMem.c:680:0: error:\r\n error: undefined reference to 'numa_get_mems_allowed'\r\n |\r\n680 |\r\n | ^\r\n\r\nrts/posix/OSMem.c:670:0: error:\r\n error: undefined reference to 'numa_num_configured_nodes'\r\n |\r\n670 | }\r\n | ^\r\n\r\nrts/posix/OSMem.c:685:0: error:\r\n error: undefined reference to 'numa_bitmask_free'\r\n |\r\n685 | mask = numa_get_mems_allowed();\r\n | ^\r\n\r\nrts/posix/OSMem.c:670:0: error:\r\n error: undefined reference to 'numa_num_configured_nodes'\r\n |\r\n670 | }\r\n | ^\r\ncollect2: error: ld returned 1 exit status\r\n`gcc' failed in phase `Linker'. (Exit code: 1)\r\nutils/ghc-cabal/ghc.mk:56: recipe for target 'utils/ghc-cabal/dist/build/tmp/ghc-cabal' failed\r\n}}}\r\n\r\nInstalling libnuma-dev fixes this.\r\n\r\nRelevant lines in config.log:\r\n\r\n{{{\r\nCabalHaveLibNuma='False'\r\n#define HAVE_LIBNUMA 0\r\n}}}\r\n\r\nI have no idea why `HAVE_LIBNUMA` is not 0 when compiling the file.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15690Add Eq1/Ord1/Read1/Show1 instances to newtypes in Data.Semigroup2023-04-01T17:19:02ZBodigrimAdd Eq1/Ord1/Read1/Show1 instances to newtypes in Data.SemigroupI'd like to have `Eq1`/`Ord1`/`Read1`/`Show1` instances for newtypes in `Data.Semigroup`, at least for `Min`, `Max` and `Option`. Is there a specific reason for their absence? If no, I'll be happy to prepare a PR.
<details><summary>Trac...I'd like to have `Eq1`/`Ord1`/`Read1`/`Show1` instances for newtypes in `Data.Semigroup`, at least for `Min`, `Max` and `Option`. Is there a specific reason for their absence? If no, I'll be happy to prepare a PR.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.6.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Add Eq1/Ord1/Read1/Show1 instances to newtypes in Data.Semigroup","status":"New","operating_system":"","component":"libraries/base","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"I'd like to have `Eq1`/`Ord1`/`Read1`/`Show1` instances for newtypes in `Data.Semigroup`, at least for `Min`, `Max` and `Option`. Is there a specific reason for their absence? If no, I'll be happy to prepare a PR.","type_of_failure":"OtherFailure","blocking":[]} -->⊥https://gitlab.haskell.org/ghc/ghc/-/issues/15691Marking Pred(S n) = n as injective2019-07-07T18:03:26ZIcelandjackMarking Pred(S n) = n as injectiveShould `Pred` be injective? Please close the ticket if this is a known limitation
```hs
{-# Language DataKinds, TypeFamilyDependencies #-}
data N = O | S N
type family
Pred n = res | res -> n where
Pred(S n) = n
```
fails with
```...Should `Pred` be injective? Please close the ticket if this is a known limitation
```hs
{-# Language DataKinds, TypeFamilyDependencies #-}
data N = O | S N
type family
Pred n = res | res -> n where
Pred(S n) = n
```
fails with
```
• Type family equation violates injectivity annotation.
RHS of injective type family equation is a bare type variable
but these LHS type and kind patterns are not bare variables: ‘'S n’
Pred ('S n) = n -- Defined at 462.hs:7:2
• In the equations for closed type family ‘Pred’
In the type family declaration for ‘Pred’
|
7 | Pred(S n) = n
| ^^^^^^^^^^^^^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.6.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":"Marking Pred(S n) = n as injective","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["InjectiveFamilies","TypeFamilies,"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Should `Pred` be injective? Please close the ticket if this is a known limitation \r\n\r\n{{{#!hs\r\n{-# Language DataKinds, TypeFamilyDependencies #-}\r\n\r\ndata N = O | S N\r\n\r\ntype family\r\n Pred n = res | res -> n where\r\n Pred(S n) = n\r\n}}}\r\n\r\nfails with\r\n\r\n{{{\r\n • Type family equation violates injectivity annotation.\r\n RHS of injective type family equation is a bare type variable\r\n but these LHS type and kind patterns are not bare variables: ‘'S n’\r\n Pred ('S n) = n -- Defined at 462.hs:7:2\r\n • In the equations for closed type family ‘Pred’\r\n In the type family declaration for ‘Pred’\r\n |\r\n7 | Pred(S n) = n\r\n | ^^^^^^^^^^^^^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15692GHC panic from pattern synonyms + deferred type errors2019-07-07T18:03:25ZIcelandjackGHC panic from pattern synonyms + deferred type errors```hs
{-# Language DataKinds, TypeOperators, PolyKinds, PatternSynonyms, GADTs #-}
{-# Options_GHC -dcore-lint -fdefer-type-errors #-}
import Data.Kind
data Ctx :: Type -> Type where
E :: Ctx(Type)
(:&:) :: a -> Ctx(as) -> Ctx(a...```hs
{-# Language DataKinds, TypeOperators, PolyKinds, PatternSynonyms, GADTs #-}
{-# Options_GHC -dcore-lint -fdefer-type-errors #-}
import Data.Kind
data Ctx :: Type -> Type where
E :: Ctx(Type)
(:&:) :: a -> Ctx(as) -> Ctx(a -> as)
data ApplyT (k::Type) :: k -> Ctx(k) -> Type where
AO :: a -> ApplyT(Type) a E
AS :: ApplyT(ks) (f a) ctx
-> ApplyT(k -> ks) f (a:&:ctx)
pattern ASSO = AS (AS (AO False))
```
```
$ ghci -ignore-dot-ghci 463.hs
hs/463.hs:16:27: warning: [-Wdeferred-type-errors]
• Couldn't match type ‘a a1 a2’ with ‘Bool’
Expected type: a3
Actual type: Bool
• In the pattern: False
In the pattern: AO False
In the pattern: AS (AO False)
|
16 | pattern ASSO = AS (AS (AO False))
| ^^^^^
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20180828 for x86_64-unknown-linux):
urk! lookup local fingerprint
$mASSO
[iESflb :-> ($trModule, 1ca40dc83a9c879effdb760462cc9a2d),
iESgKD :-> ($tc'E, 79f67a27a14dc1bb6eecb39e4b061e2c),
iESgKF :-> ($tc':&:, 24793c0c1652ffcf92e04f47d38fa075),
iESgKH :-> ($tcCtx, a3f9358cbfe161bf59e75500d70ce0ae),
iESgKI :-> ($tc'AO, 72111d1891cb082e989c20a2191a8b4b),
iESgKK :-> ($tc'AS, ff019c04c400d5fbdd46ff8a816d4913),
iESgKM :-> ($tcApplyT, cbfe28374b4115925c7213e6330ab115)]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/iface/MkIface.hs:524:37 in ghc:MkIface
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 pattern synonyms + deferred type errors","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["PatternSynonyms,","TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!hs\r\n{-# Language DataKinds, TypeOperators, PolyKinds, PatternSynonyms, GADTs #-}\r\n\r\n{-# Options_GHC -dcore-lint -fdefer-type-errors #-}\r\n\r\nimport Data.Kind\r\n\r\ndata Ctx :: Type -> Type where\r\n E :: Ctx(Type)\r\n (:&:) :: a -> Ctx(as) -> Ctx(a -> as)\r\n\r\ndata ApplyT (k::Type) :: k -> Ctx(k) -> Type where\r\n AO :: a -> ApplyT(Type) a E\r\n AS :: ApplyT(ks) (f a) ctx\r\n -> ApplyT(k -> ks) f (a:&:ctx)\r\n\r\npattern ASSO = AS (AS (AO False))\r\n}}}\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci 463.hs\r\nhs/463.hs:16:27: warning: [-Wdeferred-type-errors]\r\n • Couldn't match type ‘a a1 a2’ with ‘Bool’\r\n Expected type: a3\r\n Actual type: Bool\r\n • In the pattern: False\r\n In the pattern: AO False\r\n In the pattern: AS (AO False)\r\n |\r\n16 | pattern ASSO = AS (AS (AO False))\r\n | ^^^^^\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20180828 for x86_64-unknown-linux):\r\n\turk! lookup local fingerprint\r\n $mASSO\r\n [iESflb :-> ($trModule, 1ca40dc83a9c879effdb760462cc9a2d),\r\n iESgKD :-> ($tc'E, 79f67a27a14dc1bb6eecb39e4b061e2c),\r\n iESgKF :-> ($tc':&:, 24793c0c1652ffcf92e04f47d38fa075),\r\n iESgKH :-> ($tcCtx, a3f9358cbfe161bf59e75500d70ce0ae),\r\n iESgKI :-> ($tc'AO, 72111d1891cb082e989c20a2191a8b4b),\r\n iESgKK :-> ($tc'AS, ff019c04c400d5fbdd46ff8a816d4913),\r\n iESgKM :-> ($tcApplyT, cbfe28374b4115925c7213e6330ab115)]\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/iface/MkIface.hs:524:37 in ghc:MkIface\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/15694GHC panic from pattern synonym, "Type-correct unfilled coercion hole"2019-07-07T18:03:25ZIcelandjackGHC panic from pattern synonym, "Type-correct unfilled coercion hole"```hs
{-# Language RankNTypes, PatternSynonyms, TypeOperators, DataKinds, PolyKinds, KindSignatures, GADTs #-}
import Data.Kind
import Data.Type.Equality
data Ctx :: Type -> Type where
E :: Ctx(Type)
(:&:) :: a -> Ctx(as) -> Ctx(...```hs
{-# Language RankNTypes, PatternSynonyms, TypeOperators, DataKinds, PolyKinds, KindSignatures, GADTs #-}
import Data.Kind
import Data.Type.Equality
data Ctx :: Type -> Type where
E :: Ctx(Type)
(:&:) :: a -> Ctx(as) -> Ctx(a -> as)
data ApplyT(kind::Type) :: kind -> Ctx(kind) -> Type where
AO :: a -> ApplyT(Type) a E
AS :: ApplyT(ks) (f a) ctx
-> ApplyT(k -> ks) f (a:&:ctx)
pattern ASSO :: () => forall ks k (f :: k -> ks) (a1 :: k) (ctx :: Ctx ks) (ks1 :: Type) k1 (a2 :: k1) (ctx1 :: Ctx ks1) a3. (kind ~ (k -> ks), a ~~ f, b ~~ (a1 :&: ctx), ks ~ (k1 -> ks1), ctx ~~ (a2 :&: E), ks1 ~ Type, f a1 a2 ~~ a3) => a3 -> ApplyT kind a b
pattern ASSO a = AS (AS (AO a))
```
```
$ ghci -ignore-dot-ghci 465.hs
GHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 465.hs, interpreted )
WARNING: file compiler/types/TyCoRep.hs, line 2378
in_scope InScope {kind_a1Cw a_a1Cx b_a1Cy ks_a1Cz k_a1CA f_a1CB
a1_a1CC ctx_a1CD ks1_a1CE k1_a1CF a2_a1CG ctx1_a1CH a3_a1CI
k0_a1F8}
tenv [a1Cw :-> kind_a1Cw[sk:0], a1Cx :-> a_a1Cx[sk:0],
a1Cy :-> b_a1Cy[sk:0], a1Cz :-> ks_a1Cz[sk:0],
a1CA :-> k_a1CA[sk:0], a1CB :-> f_a1CB[sk:0],
a1CC :-> a1_a1CC[sk:0], a1CD :-> ctx_a1CD[sk:0],
a1CE :-> ks1_a1CE[sk:0], a1CF :-> k1_a1CF[sk:0],
a1CG :-> a2_a1CG[sk:0], a1CH :-> ctx1_a1CH[sk:0],
a1CI :-> a3_a1CI[sk:0]]
cenv []
tys [kind_a1Cw[sk:1] ~ (k_a1CA[sk:2] -> ks_a1Cz[sk:2]),
a_a1Cx[sk:1] ~~ f_a1CB[sk:2],
b_a1Cy[sk:1] ~~ (a1_a1CC[sk:2] ':&: ctx_a1CD[sk:2]),
ks_a1Cz[sk:2] ~ (k1_a1CF[sk:2] -> ks1_a1CE[sk:2]),
ctx_a1CD[sk:2] ~~ (a2_a1CG[sk:2] ':&: 'E), ks1_a1CE[sk:2] ~ *,
(f_a1CB[sk:2] a1_a1CC[sk:2] |> {co_a1Fc}) a2_a1CG[sk:2]
~~ a3_a1CI[sk:2]]
cos []
needInScope [a1F8 :-> k0_a1F8[sk:2], a1Fc :-> co_a1Fc]
WARNING: file compiler/types/TyCoRep.hs, line 2378
in_scope InScope {kind_a1Cw a_a1Cx b_a1Cy k0_a1HA ks_a1HB k_a1HC
f_a1HD a1_a1HE ctx_a1HF ks1_a1HG k1_a1HH a2_a1HI ctx1_a1HJ a3_a1HK}
tenv [a1Cz :-> ks_a1HB[tau:4], a1CA :-> k_a1HC[tau:4],
a1CB :-> f_a1HD[tau:4], a1CC :-> a1_a1HE[tau:4],
a1CD :-> ctx_a1HF[tau:4], a1CE :-> ks1_a1HG[tau:4],
a1CF :-> k1_a1HH[tau:4], a1CG :-> a2_a1HI[tau:4],
a1CH :-> ctx1_a1HJ[tau:4], a1CI :-> a3_a1HK[tau:4],
a1F8 :-> k0_a1HA[tau:4]]
cenv []
tys [kind_a1Cw[sk:0] ~ (k_a1CA[sk:0] -> ks_a1Cz[sk:0]),
a_a1Cx[sk:0] ~~ f_a1CB[sk:0],
b_a1Cy[sk:0] ~~ (a1_a1CC[sk:0] ':&: ctx_a1CD[sk:0]),
ks_a1Cz[sk:0] ~ (k1_a1CF[sk:0] -> ks1_a1CE[sk:0]),
ctx_a1CD[sk:0] ~~ (a2_a1CG[sk:0] ':&: 'E), ks1_a1CE[sk:0] ~ *,
(f_a1CB[sk:0] a1_a1CC[sk:0] |> {co_a1Fc}) a2_a1CG[sk:0]
~~ a3_a1CI[sk:0]]
cos []
needInScope [a1Cw :-> kind_a1Cw[sk:0], a1Cx :-> a_a1Cx[sk:0],
a1Cy :-> b_a1Cy[sk:0], a1Fc :-> co_a1Fc]
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20180828 for x86_64-unknown-linux):
ASSERT failed!
Type-correct unfilled coercion hole {co_a1Fc}
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:1716:99 in ghc:TcHsSyn
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
```8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15695Core Lint error, from -fobject-code + defer type errors + pattern synonyms + ...2019-07-07T18:03:25ZIcelandjackCore Lint error, from -fobject-code + defer type errors + pattern synonyms + other stuffTry running this (`-fobject-code` is required) with **and** without `-dcore-lint`. I tried to minimize it but it is still hefty. This is showing it without `-dcore-lint`:
```hs
{-# Language RankNTypes, PatternSynonyms, DataKinds, PolyKi...Try running this (`-fobject-code` is required) with **and** without `-dcore-lint`. I tried to minimize it but it is still hefty. This is showing it without `-dcore-lint`:
```hs
{-# Language RankNTypes, PatternSynonyms, DataKinds, PolyKinds, GADTs, TypeOperators, MultiParamTypeClasses, TypeFamilies, TypeSynonymInstances, FlexibleInstances, InstanceSigs, FlexibleContexts #-}
{-# Options_GHC -fdefer-type-errors #-}
import Data.Kind
import Data.Type.Equality
data TyVar :: Type -> Type -> Type where
VO :: TyVar (a -> as) a
VS :: TyVar as a -> TyVar (b -> as) a
data NP :: (k -> Type) -> ([k] -> Type) where
Nil :: NP f '[]
(:*) :: f a -> NP f as -> NP f (a:as)
data NS :: (k -> Type) -> ([k] -> Type) where
Here :: f a -> NS f (a:as)
There :: NS f as -> NS f (a:as)
infixr 6 :&:
data Ctx :: Type -> Type where
E :: Ctx(Type)
(:&:) :: a -> Ctx(as) -> Ctx(a -> as)
data NA a
type SOP(kind::Type) code = NS (NP NA) code
data ApplyT(kind::Type) :: kind -> Ctx(kind) -> Type where
AO :: a -> ApplyT(Type) a E
AS :: ApplyT(ks) (f a) ctx
-> ApplyT(k -> ks) f (a:&:ctx)
from' :: ApplyT(Type -> Type -> Type) Either ctx -> NS (NP NA) '[ '[VO] ]
from' (ASSO (Left a)) = Here (a :* Nil)
from' (ASSO (Right b)) = There (Here undefined)
pattern ASSO
:: () =>
forall (ks :: Type) k (f :: k -> ks) (a1 :: k) (ks1 :: Type) k1 (f1 :: k1 -> ks1) (a2 :: k1) a3.
(kind ~ (k -> k1 -> Type), a ~~ f, b ~~ (a1 :&: a2 :&: E),
f a1 ~~ f1, f1 a2 ~~ a3) =>
a3 -> ApplyT kind a b
pattern ASSO a = AS (AS (AO a))
```
```
$ ghci -ignore-dot-ghci -fobject-code 466.hs
GHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 466.hs, 466.o )
466.hs:35:14: warning: [-Wdeferred-type-errors]
• Could not deduce: a2 ~ NA 'VO
from the context: ((* -> * -> *) ~ (k1 -> k2 -> *), Either ~~ f,
ctx ~~ (a2 ':&: (a3 ':&: 'E)), f a2 ~~ f1, f1 a3 ~~ a4)
bound by a pattern with pattern synonym:
ASSO :: forall kind (a :: kind) (b :: Ctx kind).
() =>
forall ks k (f :: k -> ks) (a1 :: k) ks1 k1 (f1 :: k1
-> ks1) (a2 :: k1) a3.
(kind ~ (k -> k1 -> *), a ~~ f, b ~~ (a1 ':&: (a2 ':&: 'E)),
f a1 ~~ f1, f1 a2 ~~ a3) =>
a3 -> ApplyT kind a b,
in an equation for ‘from'’
at 466.hs:35:8-21
‘a2’ is a rigid type variable bound by
a pattern with pattern synonym:
ASSO :: forall kind (a :: kind) (b :: Ctx kind).
() =>
forall ks k (f :: k -> ks) (a1 :: k) ks1 k1 (f1 :: k1
-> ks1) (a2 :: k1) a3.
(kind ~ (k -> k1 -> *), a ~~ f, b ~~ (a1 ':&: (a2 ':&: 'E)),
f a1 ~~ f1, f1 a2 ~~ a3) =>
a3 -> ApplyT kind a b,
in an equation for ‘from'’
at 466.hs:35:8-21
Expected type: a4
Actual type: Either (NA 'VO) a3
• In the pattern: Left a
In the pattern: ASSO (Left a)
In an equation for ‘from'’: from' (ASSO (Left a)) = Here (a :* Nil)
• Relevant bindings include
from' :: ApplyT (* -> * -> *) Either ctx -> NS (NP NA) '[ '[ 'VO]]
(bound at 466.hs:35:1)
|
35 | from' (ASSO (Left a)) = Here (a :* Nil)
| ^^^^^^^
466.hs:36:26: warning: [-Wdeferred-type-errors]
• Couldn't match type ‘a0 : as0’ with ‘'[]’
Expected type: NS (NP NA) '[ '[ 'VO]]
Actual type: NS (NP NA) ('[ 'VO] : a0 : as0)
• In the expression: There (Here undefined)
In an equation for ‘from'’:
from' (ASSO (Right b)) = There (Here undefined)
• Relevant bindings include
from' :: ApplyT (* -> * -> *) Either ctx -> NS (NP NA) '[ '[ 'VO]]
(bound at 466.hs:35:1)
|
36 | from' (ASSO (Right b)) = There (Here undefined)
| ^^^^^^^^^^^^^^^^^^^^^^
WARNING: file compiler/types/TyCoRep.hs, line 2378
in_scope InScope {wild_00 wild_Xl wild_Xv wild_X1m a_a1Gv ks_a1Ou
k_a1Ov f_a1Ow a_a1Ox ctx_a1Oy co_a1Oz co_a1OA co_a1OB ks_a1OC
k_a1OD f_a1OE a_a1OF ctx_a1OG co_a1OH co_a1OI co_a1OJ a_a1OK
co_a1OL co_a1OM co_a1ON as_a1Q3 a_a1Q4 ctx_a1Q5 $krep_a2XW
$krep_a2XX $krep_a2XY $krep_a2XZ $krep_a2Y0 $krep_a2Y1 $krep_a2Y2
$krep_a2Y3 $krep_a2Y4 $krep_a2Y5 $krep_a2Y6 $krep_a2Y7 $krep_a2Y8
$krep_a2Y9 $krep_a2Ya $krep_a2Yb $krep_a2Yc $krep_a2Yd $krep_a2Ye
$krep_a2Yf $krep_a2Yg $krep_a2Yh $krep_a2Yi $krep_a2Yj $krep_a2Yk
$krep_a2Yl $krep_a2Ym $krep_a2Yn $krep_a2Yo $krep_a2Yp $krep_a2Yq
$krep_a2Yr $krep_a2Ys $krep_a2Yt $krep_a2Yu $krep_a2Yv $krep_a2Yw
$krep_a2Yx $krep_a2Yy $krep_a2Yz $krep_a2YA $krep_a2YB $krep_a2YC
$krep_a2YD $krep_a2YE $krep_a2YF $krep_a2YG $krep_a2YH $krep_a2YI
$krep_a2YJ $krep_a2YK $krep_a2YL ds_d2YO ds_d2YP ds_d2YV fail_d2Z2
from' $bASSO $mASSO $tc':&: $tc':* $tc'AO $tc'AS $tc'E $tc'Here
$tc'Nil $tc'There $tc'VO $tc'VS $tcApplyT $tcCtx $tcNA $tcNP $tcNS
$tcTyVar $trModule $trModule_s2ZM $trModule_s2ZN $trModule_s2ZO
$trModule_s2ZP $krep_s2ZQ $krep_s2ZR $krep_s2ZS $krep_s2ZT
$krep_s2ZU $krep_s2ZV $krep_s2ZW $krep_s2ZX $tcTyVar_s2ZY
$tcTyVar_s2ZZ $krep_s300 $krep_s301 $krep_s302 $krep_s303
$tc'VO_s304 $tc'VO_s305 $krep_s306 $krep_s307 $tc'VS_s308
$tc'VS_s309 $tcNP_s30a $tcNP_s30b $krep_s30c $krep_s30d $krep_s30e
$krep_s30f $krep_s30g $krep_s30h $tc':*_s30i $tc':*_s30j $krep_s30k
$krep_s30l $krep_s30m $tc'Nil_s30n $tc'Nil_s30o $tcNS_s30p
$tcNS_s30q $krep_s30r $krep_s30s $krep_s30t $krep_s30u $krep_s30v
$krep_s30w $tc'Here_s30x $tc'Here_s30y $krep_s30z $krep_s30A
$krep_s30B $tc'There_s30C $tc'There_s30D $tcCtx_s30E $tcCtx_s30F
$krep_s30G $krep_s30H $krep_s30I $tc':&:_s30J $tc':&:_s30K
$krep_s30L $krep_s30M $krep_s30N $krep_s30O $krep_s30P $tc'E_s30Q
$tc'E_s30R $tcNA_s30S $tcNA_s30T $tcApplyT_s30U $tcApplyT_s30V
$krep_s30W $krep_s30X $krep_s30Y $krep_s30Z $krep_s310 $krep_s311
$tc'AS_s312 $tc'AS_s313 $krep_s314 $krep_s315 $krep_s316
$tc'AO_s317 $tc'AO_s318}
tenv [a1Ow :-> f_a1Ow, a1Ox :-> a_a1Ox, a1Oy :-> ctx_a1Oy,
a1OE :-> f_a1OE, a1OF :-> a_a1OF, a1OG :-> ctx_a1OG]
cenv [a1Oz :-> co_a1Oz, a1OA :-> co_a1OA, a1OB :-> co_a1OB,
a1OH :-> co_a1OH, a1OI :-> co_a1OI, a1OJ :-> co_a1OJ,
a1OL :-> co_a1OL, a1OM :-> co_a1OM, a1ON :-> co_a1ON]
tys [a_a1Ox ~# (NA 'VO |> Sym (Nth:2 (Sym co_a2U0)))]
cos []
needInScope [a1Ov :-> k_a1Ov, a1OD :-> k_a1OD, a1Q3 :-> as_a1Q3,
a1Q4 :-> a_a1Q4, a2U0 :-> co_a2U0]
WARNING: file compiler/types/TyCoRep.hs, line 2378
in_scope InScope {wild_00 wild_Xl wild_Xv wild_X1m a_a1Gv ks_a1Ou
k_a1Ov f_a1Ow a_a1Ox ctx_a1Oy co_a1Oz co_a1OA co_a1OB ks_a1OC
k_a1OD f_a1OE a_a1OF ctx_a1OG co_a1OH co_a1OI co_a1OJ a_a1OK
co_a1OL co_a1OM co_a1ON as_a1Q3 a_a1Q4 ctx_a1Q5 $krep_a2XW
$krep_a2XX $krep_a2XY $krep_a2XZ $krep_a2Y0 $krep_a2Y1 $krep_a2Y2
$krep_a2Y3 $krep_a2Y4 $krep_a2Y5 $krep_a2Y6 $krep_a2Y7 $krep_a2Y8
$krep_a2Y9 $krep_a2Ya $krep_a2Yb $krep_a2Yc $krep_a2Yd $krep_a2Ye
$krep_a2Yf $krep_a2Yg $krep_a2Yh $krep_a2Yi $krep_a2Yj $krep_a2Yk
$krep_a2Yl $krep_a2Ym $krep_a2Yn $krep_a2Yo $krep_a2Yp $krep_a2Yq
$krep_a2Yr $krep_a2Ys $krep_a2Yt $krep_a2Yu $krep_a2Yv $krep_a2Yw
$krep_a2Yx $krep_a2Yy $krep_a2Yz $krep_a2YA $krep_a2YB $krep_a2YC
$krep_a2YD $krep_a2YE $krep_a2YF $krep_a2YG $krep_a2YH $krep_a2YI
$krep_a2YJ $krep_a2YK $krep_a2YL ds_d2YO ds_d2YP ds_d2YV fail_d2Z2
from' $bASSO $mASSO $tc':&: $tc':* $tc'AO $tc'AS $tc'E $tc'Here
$tc'Nil $tc'There $tc'VO $tc'VS $tcApplyT $tcCtx $tcNA $tcNP $tcNS
$tcTyVar $trModule $trModule_s2ZM $trModule_s2ZN $trModule_s2ZO
$trModule_s2ZP $krep_s2ZQ $krep_s2ZR $krep_s2ZS $krep_s2ZT
$krep_s2ZU $krep_s2ZV $krep_s2ZW $krep_s2ZX $tcTyVar_s2ZY
$tcTyVar_s2ZZ $krep_s300 $krep_s301 $krep_s302 $krep_s303
$tc'VO_s304 $tc'VO_s305 $krep_s306 $krep_s307 $tc'VS_s308
$tc'VS_s309 $tcNP_s30a $tcNP_s30b $krep_s30c $krep_s30d $krep_s30e
$krep_s30f $krep_s30g $krep_s30h $tc':*_s30i $tc':*_s30j $krep_s30k
$krep_s30l $krep_s30m $tc'Nil_s30n $tc'Nil_s30o $tcNS_s30p
$tcNS_s30q $krep_s30r $krep_s30s $krep_s30t $krep_s30u $krep_s30v
$krep_s30w $tc'Here_s30x $tc'Here_s30y $krep_s30z $krep_s30A
$krep_s30B $tc'There_s30C $tc'There_s30D $tcCtx_s30E $tcCtx_s30F
$krep_s30G $krep_s30H $krep_s30I $tc':&:_s30J $tc':&:_s30K
$krep_s30L $krep_s30M $krep_s30N $krep_s30O $krep_s30P $tc'E_s30Q
$tc'E_s30R $tcNA_s30S $tcNA_s30T $tcApplyT_s30U $tcApplyT_s30V
$krep_s30W $krep_s30X $krep_s30Y $krep_s30Z $krep_s310 $krep_s311
$tc'AS_s312 $tc'AS_s313 $krep_s314 $krep_s315 $krep_s316
$tc'AO_s317 $tc'AO_s318}
tenv [a1Ow :-> f_a1Ow, a1Ox :-> a_a1Ox, a1Oy :-> ctx_a1Oy,
a1OE :-> f_a1OE, a1OF :-> a_a1OF, a1OG :-> ctx_a1OG]
cenv [a1Oz :-> co_a1Oz, a1OA :-> co_a1OA, a1OB :-> co_a1OB,
a1OH :-> co_a1OH, a1OI :-> co_a1OI, a1OJ :-> co_a1OJ,
a1OL :-> co_a1OL, a1OM :-> co_a1OM, a1ON :-> co_a1ON]
tys [a_a1Ox ~# (NA 'VO |> Sym (Nth:2 (Sym co_a2U0)))]
cos []
needInScope [a1Ov :-> k_a1Ov, a1OD :-> k_a1OD, a1Q3 :-> as_a1Q3,
a1Q4 :-> a_a1Q4, a2U0 :-> co_a2U0]
Ok, one module loaded.
Prelude Main>
```8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15696Derived Ord instance for enumerations with more than 8 elements seems to be i...2023-08-25T14:19:49ZmrkkrpDerived Ord instance for enumerations with more than 8 elements seems to be incorrectSometimes.
Here is the thread that explains the bug:
https://github.com/haskell/containers/issues/568
I originally reported this as a bug on `containers` issue tracker, but we seem to have concluded that this is probably a bug in the ...Sometimes.
Here is the thread that explains the bug:
https://github.com/haskell/containers/issues/568
I originally reported this as a bug on `containers` issue tracker, but we seem to have concluded that this is probably a bug in the GHC optimizer itself.
I think the shortest repro so far is this:
```hs
import qualified Data.Set as S
main = print $
let {-# noinline f #-}
f () = T2
in S.fromList [f (), f ()]
data T = T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9
deriving (Show, Read, Eq, Ord, Bounded, Enum)
```
which prints
```hs
fromList [T2,T2]
```
The person who derived this from my original repro says:
> And as I said earlier, comment out the T9 constructor =\> prints fromList \[T2\] as it should.
Another interesting quote:
> Can confirm. Tested with ghc-8.6.1, containers-0.6.0.1 and leancheck-0.7.5 (so it does not seem to depend on the testing framework). Error occurs:
>
> - with ghc -O1 and -O2 (but not with -O0)
> - and if data type has at least 9 elements
>
> So, likely a bug in ghc's optimizer.
>
> in some cases, input has duplicates, but not always.
This is a bad one, makes GHC 8.6.1 totally unusable for me.
<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":"Derived Ord instance for enumerations with more than 8 elements seems to be incorrect","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Sometimes.\r\n\r\nHere is the thread that explains the bug:\r\n\r\nhttps://github.com/haskell/containers/issues/568\r\n\r\nI originally reported this as a bug on `containers` issue tracker, but we seem to have concluded that this is probably a bug in the GHC optimizer itself.\r\n\r\nI think the shortest repro so far is this:\r\n\r\n{{{#!hs\r\nimport qualified Data.Set as S\r\n\r\nmain = print $\r\n let {-# noinline f #-}\r\n f () = T2\r\n in S.fromList [f (), f ()]\r\n \r\ndata T = T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9\r\n deriving (Show, Read, Eq, Ord, Bounded, Enum)\r\n}}}\r\n\r\nwhich prints\r\n\r\n{{{#!hs\r\nfromList [T2,T2]\r\n}}}\r\n\r\nThe person who derived this from my original repro says:\r\n\r\n> And as I said earlier, comment out the T9 constructor => prints fromList [T2] as it should.\r\n\r\nAnother interesting quote:\r\n\r\n> Can confirm. Tested with ghc-8.6.1, containers-0.6.0.1 and leancheck-0.7.5 (so it does not seem to depend on the testing framework). Error occurs:\r\n>\r\n> * with ghc -O1 and -O2 (but not with -O0)\r\n> * and if data type has at least 9 elements\r\n>\r\n> So, likely a bug in ghc's optimizer.\r\n>\r\n> in some cases, input has duplicates, but not always.\r\n\r\nThis is a bad one, makes GHC 8.6.1 totally unusable for me.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2Ömer Sinan AğacanÖmer Sinan Ağacanhttps://gitlab.haskell.org/ghc/ghc/-/issues/15700Plugins cause GHC to panic: cannot find dynamic libraries2019-07-07T18:03:23Zsheafsam.derbyshire@gmail.comPlugins cause GHC to panic: cannot find dynamic librariesWith GHC 8.6.1 on Windows 7 x64, I seem to be getting a similar problem as in ticket #15492.
Trying to use any type-checking plugin at all causes an error. Here with the natnormalise plugin:
```
ghc.EXE: panic! (the 'impossible' happene...With GHC 8.6.1 on Windows 7 x64, I seem to be getting a similar problem as in ticket #15492.
Trying to use any type-checking plugin at all causes an error. Here with the natnormalise plugin:
```
ghc.EXE: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-unknown-mingw32):
mkPluginUsage: no dylibs, tried:
C:\Code\Haskell\dylibs_bug\.stack-work\install\df4dd97d\lib\x86_64-windows-ghc-8.6.1\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll
C:\Users\Sam\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\bin\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll
C:\Users\Sam\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\lib\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll
GHC.TypeLits.Normalise
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\utils\Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler\\deSugar\\DsUsage.hs:179:15 in ghc:DsUsage
```
That's with stack. I also checked with Cabal 2.4.0.1 to make sure, and indeed I get:
```
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-unknown-mingw32):
mkPluginUsage: no dylibs, tried:
C:\Users\Sam\AppData\Roaming\cabal\store\ghc-8.6.1\ghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0\lib\libHSghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll
C:\Program Files\ghc\mingw\lib\libHSghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll
GHC.TypeLits.Normalise
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\utils\Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler\\deSugar\\DsUsage.hs:179:15 in ghc:DsUsage
```
No problems with GHC 8.4.3.
<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":"Plugins cause GHC to panic: cannot find dynamic libraries","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"With GHC 8.6.1 on Windows 7 x64, I seem to be getting a similar problem as in ticket #15492.\r\nTrying to use any type-checking plugin at all causes an error. Here with the natnormalise plugin:\r\n\r\n{{{\r\nghc.EXE: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-unknown-mingw32):\r\n mkPluginUsage: no dylibs, tried:\r\nC:\\Code\\Haskell\\dylibs_bug\\.stack-work\\install\\df4dd97d\\lib\\x86_64-windows-ghc-8.6.1\\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll\r\nC:\\Users\\Sam\\AppData\\Local\\Programs\\stack\\x86_64-windows\\msys2-20180531\\mingw64\\bin\\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll\r\nC:\\Users\\Sam\\AppData\\Local\\Programs\\stack\\x86_64-windows\\msys2-20180531\\mingw64\\lib\\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll\r\n\r\n GHC.TypeLits.Normalise\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\\\\deSugar\\\\DsUsage.hs:179:15 in ghc:DsUsage\r\n}}}\r\n\r\n\r\nThat's with stack. I also checked with Cabal 2.4.0.1 to make sure, and indeed I get:\r\n\r\n{{{\r\nghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-unknown-mingw32):\r\n mkPluginUsage: no dylibs, tried:\r\nC:\\Users\\Sam\\AppData\\Roaming\\cabal\\store\\ghc-8.6.1\\ghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0\\lib\\libHSghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll\r\nC:\\Program Files\\ghc\\mingw\\lib\\libHSghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll\r\n\r\n GHC.TypeLits.Normalise\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\\\\deSugar\\\\DsUsage.hs:179:15 in ghc:DsUsage\r\n}}}\r\n\r\nNo problems with GHC 8.4.3.\r\n\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15701HEAD: Build failure in ghc-prim2019-07-07T18:03:23ZPeter Trommlerptrommler@acm.orgHEAD: Build failure in ghc-primBuilding GHC at changeset:21efbc7599e39ec93b8b I see the following message:
```
checking whether GCC supports __atomic_ builtins... no
configure: creating ./config.status
config.status: error: cannot find input file: `ghc-prim.buildinfo...Building GHC at changeset:21efbc7599e39ec93b8b I see the following message:
```
checking whether GCC supports __atomic_ builtins... no
configure: creating ./config.status
config.status: error: cannot find input file: `ghc-prim.buildinfo.in'
libraries/ghc-prim/ghc.mk:4: recipe for target 'libraries/ghc-prim/dist-install/package-data.mk' failed
```
And indeed there is no file `ghc-prim.buildinfo.in` in libraries/ghc-prim.
There is no 8.7 for version so I am leaving it empty.
<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":"HEAD: Build failure in ghc-prim","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Building GHC at changeset:21efbc7599e39ec93b8b I see the following message:\r\n\r\n{{{\r\nchecking whether GCC supports __atomic_ builtins... no\r\nconfigure: creating ./config.status\r\nconfig.status: error: cannot find input file: `ghc-prim.buildinfo.in'\r\nlibraries/ghc-prim/ghc.mk:4: recipe for target 'libraries/ghc-prim/dist-install/package-data.mk' failed\r\n}}}\r\n\r\nAnd indeed there is no file `ghc-prim.buildinfo.in` in libraries/ghc-prim.\r\nThere is no 8.7 for version so I am leaving it empty.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15702"-main-is" flag is broken for recent ghc-head2019-07-07T18:03:22ZCheng Shao"-main-is" flag is broken for recent ghc-headHere is a minimal reproduction:
Main.hs:
```
main :: IO ()
main = putStrLn "Main"
```
Main2.hs:
```
module Main2 where
import Main
main2 :: IO ()
main2 = do
putStrLn "Main2"
main
```
Run ghc with something like `/home/terrorja...Here is a minimal reproduction:
Main.hs:
```
main :: IO ()
main = putStrLn "Main"
```
Main2.hs:
```
module Main2 where
import Main
main2 :: IO ()
main2 = do
putStrLn "Main2"
main
```
Run ghc with something like `/home/terrorjack/.stack/programs/x86_64-linux/ghc-8.7.20181003/bin/ghc -main-is Main2.main2 Main.hs Main2.hs`, and it reports the following error:
```
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:1:1: error:
Not in scope: ‘main2’
Perhaps you meant ‘main’ (line 2)
|
1 | main :: IO ()
| ^
```
Meanwhile, the exact same flags work for ghc-8.6.1, and also a previous ghc-head build on d90946cea1357d3e99805c27dab1e811785a4088, so some accidental breakage might be in a recent commit.
<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":"\"-main-is\" flag is broken for recent ghc-head","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Here is a minimal reproduction:\r\n\r\nMain.hs:\r\n\r\n{{{\r\nmain :: IO ()\r\nmain = putStrLn \"Main\"\r\n}}}\r\n\r\nMain2.hs:\r\n\r\n{{{\r\nmodule Main2 where\r\n\r\nimport Main\r\n\r\nmain2 :: IO ()\r\nmain2 = do\r\n putStrLn \"Main2\"\r\n main\r\n}}}\r\n\r\nRun ghc with something like `/home/terrorjack/.stack/programs/x86_64-linux/ghc-8.7.20181003/bin/ghc -main-is Main2.main2 Main.hs Main2.hs`, and it reports the following error:\r\n\r\n{{{\r\n[1 of 2] Compiling Main ( Main.hs, Main.o )\r\n\r\nMain.hs:1:1: error:\r\n Not in scope: ‘main2’\r\n Perhaps you meant ‘main’ (line 2)\r\n |\r\n1 | main :: IO ()\r\n | ^\r\n}}}\r\n\r\nMeanwhile, the exact same flags work for ghc-8.6.1, and also a previous ghc-head build on d90946cea1357d3e99805c27dab1e811785a4088, so some accidental breakage might be in a recent commit.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15704Different saturations of the same polymorphic-kinded type constructor aren't ...2019-07-07T18:03:22ZmniipDifferent saturations of the same polymorphic-kinded type constructor aren't seen as apart types```hs
{-# LANGUAGE TypeFamilies, PolyKinds #-}
module A where
data family D :: k
type family F (a :: k) :: *
type instance F (D Int) = Int
type instance F (f a b) = Char
type instance F (D Int Bool) = Char
```
The last equation, eve...```hs
{-# LANGUAGE TypeFamilies, PolyKinds #-}
module A where
data family D :: k
type family F (a :: k) :: *
type instance F (D Int) = Int
type instance F (f a b) = Char
type instance F (D Int Bool) = Char
```
The last equation, even though a specialization of the middle one, trips up the equality consistency check:
```hs
a.hs:9:15: error:
Conflicting family instance declarations:
F (D Int) = Int -- Defined at a.hs:9:15
F (D Int Bool) = Char -- Defined at a.hs:10:15
|
9 | type instance F (D Int) = Int
| ^
```
So GHC is able to infer that `D Int ~/~ f a b` because `D ~/~ f a`, but for some reason the same reasoning doesn't work for `D ~/~ D a`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.6.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":"Different saturations of the same polymorphic-kinded type constructor aren't seen as apart types","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["TypeFamilies"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!hs\r\n{-# LANGUAGE TypeFamilies, PolyKinds #-}\r\n\r\nmodule A where\r\n\r\ndata family D :: k\r\n\r\ntype family F (a :: k) :: *\r\n\r\ntype instance F (D Int) = Int\r\ntype instance F (f a b) = Char\r\ntype instance F (D Int Bool) = Char\r\n}}}\r\n\r\nThe last equation, even though a specialization of the middle one, trips up the equality consistency check:\r\n{{{#!hs\r\na.hs:9:15: error:\r\n Conflicting family instance declarations:\r\n F (D Int) = Int -- Defined at a.hs:9:15\r\n F (D Int Bool) = Char -- Defined at a.hs:10:15\r\n |\r\n9 | type instance F (D Int) = Int\r\n | ^\r\n}}}\r\n\r\nSo GHC is able to infer that `D Int ~/~ f a b` because `D ~/~ f a`, but for some reason the same reasoning doesn't work for `D ~/~ D a`.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1mniipmniiphttps://gitlab.haskell.org/ghc/ghc/-/issues/15706Refactor NewHsTypeX to DerivedCoreTy2020-12-19T00:34:03ZVladislav ZavialovRefactor NewHsTypeX to DerivedCoreTy`NewHsTypeX` is not a good name for this construct:
```
data NewHsTypeX
= NHsCoreTy Type -- An escape hatch for tunnelling a *closed*
-- Core Type through HsSyn.
```
- the `New` prefix refers to the fact that it is...`NewHsTypeX` is not a good name for this construct:
```
data NewHsTypeX
= NHsCoreTy Type -- An escape hatch for tunnelling a *closed*
-- Core Type through HsSyn.
```
- the `New` prefix refers to the fact that it is a new approach, rather than to a property of the entity
- it is not suggestive of the way `NewHsTypeX` is used in the code and why it exists
A better name would be `DerivedCoreTy`. The reason for `NHsCoreTy` existence and its invariant of being closed is the `deriving` mechanism.
Doing this renaming also exposes incorrect uses of `NHsCoreTy` in a couple of places that violate the invariant (in some calls to `unifyKind`).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| 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":"Refactor NewHsTypeX to DerivedCoreTy","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"`NewHsTypeX` is not a good name for this construct:\r\n\r\n{{{\r\ndata NewHsTypeX\r\n = NHsCoreTy Type -- An escape hatch for tunnelling a *closed*\r\n -- Core Type through HsSyn.\r\n}}}\r\n\r\n* the `New` prefix refers to the fact that it is a new approach, rather than to a property of the entity\r\n* it is not suggestive of the way `NewHsTypeX` is used in the code and why it exists\r\n\r\nA better name would be `DerivedCoreTy`. The reason for `NHsCoreTy` existence and its invariant of being closed is the `deriving` mechanism.\r\n\r\nDoing this renaming also exposes incorrect uses of `NHsCoreTy` in a couple of places that violate the invariant (in some calls to `unifyKind`).","type_of_failure":"OtherFailure","blocking":[]} -->9.0.1https://gitlab.haskell.org/ghc/ghc/-/issues/15709GHC panic using TypeInType with minimal source code2019-07-07T18:03:20ZjnapeGHC panic using TypeInType with minimal source codeThe following source code causes GHC 8.4.3 on 64bit Linux to panic:
```haskell
{-# LANGUAGE TypeInType #-}
module Lib where
import Data.Kind
class Contravariant f where
contramap :: (a -> b) -> f b -> f a
dimap :: (Contravariant...The following source code causes GHC 8.4.3 on 64bit Linux to panic:
```haskell
{-# LANGUAGE TypeInType #-}
module Lib where
import Data.Kind
class Contravariant f where
contramap :: (a -> b) -> f b -> f a
dimap :: (Contravariant (p :: * -> b -> p * b), Functor (p a)) => (z -> a) -> (b -> c) -> p a b -> p z c
dimap f g = contramap f . fmap g
```
I have no idea if it should compile or not, but it shouldn't do this:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
piResultTy
k_a34u[tau:1]
*
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:947:35 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.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC panic using TypeInType with minimal source code","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following source code causes GHC 8.4.3 on 64bit Linux to panic:\r\n\r\n{{{#!haskell\r\n{-# LANGUAGE TypeInType #-}\r\n\r\nmodule Lib where\r\n\r\nimport Data.Kind\r\n\r\nclass Contravariant f where\r\n contramap :: (a -> b) -> f b -> f a\r\n\r\ndimap :: (Contravariant (p :: * -> b -> p * b), Functor (p a)) => (z -> a) -> (b -> c) -> p a b -> p z c\r\ndimap f g = contramap f . fmap g\r\n}}}\r\n\r\nI have no idea if it should compile or not, but it shouldn't do this:\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-unknown-linux):\r\n\tpiResultTy\r\n k_a34u[tau:1]\r\n *\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:947:35 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15711Kind inference of class variables does not examine associated types2019-07-07T18:03:20ZRichard Eisenbergrae@richarde.devKind inference of class variables does not examine associated typesIf I say this
```
{-# LANGUAGE TypeFamilies, PolyKinds, DataKinds #-}
module Bug where
class C a where
type F (x :: Maybe a)
```
then GHCi says this
```
*Bug> :k C
C :: k -> Constraint
```
That's silly. `C` should have kind `Type...If I say this
```
{-# LANGUAGE TypeFamilies, PolyKinds, DataKinds #-}
module Bug where
class C a where
type F (x :: Maybe a)
```
then GHCi says this
```
*Bug> :k C
C :: k -> Constraint
```
That's silly. `C` should have kind `Type -> Constraint`, because the usage of `a` in the kind of the associated type constraints `a`'s kind.
Will fix.
<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":"Kind inference of class variables does not examine associated types","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"If I say this\r\n\r\n{{{\r\n{-# LANGUAGE TypeFamilies, PolyKinds, DataKinds #-}\r\n\r\nmodule Bug where\r\n\r\nclass C a where\r\n type F (x :: Maybe a)\r\n}}}\r\n\r\nthen GHCi says this\r\n\r\n{{{\r\n*Bug> :k C\r\nC :: k -> Constraint\r\n}}}\r\n\r\nThat's silly. `C` should have kind `Type -> Constraint`, because the usage of `a` in the kind of the associated type constraints `a`'s kind.\r\n\r\nWill fix.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15712GHC panic with -XDerivingVia2020-02-09T12:01:36ZIcelandjackGHC panic with -XDerivingViaI slipped up and typed `Codensity GEndo` instead of `Codensity (GEndo m)`, resulting in a GHC panic
```hs
{-# Language RankNTypes #-}
{-# Language DerivingVia #-}
import Control.Monad.Codensity
import Data.Kind
newtype GEndo m a = GE...I slipped up and typed `Codensity GEndo` instead of `Codensity (GEndo m)`, resulting in a GHC panic
```hs
{-# Language RankNTypes #-}
{-# Language DerivingVia #-}
import Control.Monad.Codensity
import Data.Kind
newtype GEndo m a = GEndo (m a -> m a)
newtype LogicT m a = LogicT { runLogicT :: forall xx. (a -> (m xx -> m xx)) -> (m xx -> m xx) }
deriving
(Functor, Applicative, Monad)
via
(Codensity GEndo)
```
```
$ ghci -ignore-dot-ghci 476.hs
GHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 476.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20180828 for x86_64-unknown-linux):
ASSERT failed!
Type-correct unfilled coercion hole {co_a2aG}
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:1716:99 in ghc:TcHsSyn
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
```
Deriving via `Codensity (GEndo m)` works as expected.https://gitlab.haskell.org/ghc/ghc/-/issues/15713Bogus -Woverlapping-patterns warning with OverloadedStrings2019-07-07T18:03:19ZquasicomputationalBogus -Woverlapping-patterns warning with OverloadedStrings```
$ cat Test.hs
{-# LANGUAGE OverloadedStrings, LambdaCase #-}
import Data.String
data Expr = App Expr Expr | Var String
deriving (Eq)
instance IsString Expr where
fromString = Var . fromString
go = \case
App ( App ( App "refW...```
$ cat Test.hs
{-# LANGUAGE OverloadedStrings, LambdaCase #-}
import Data.String
data Expr = App Expr Expr | Var String
deriving (Eq)
instance IsString Expr where
fromString = Var . fromString
go = \case
App ( App ( App "refWithFile" identM ) filenameM) exceptionMayM -> Just 2
App ( App "and" a ) b -> Just 3
App ( App "or" a ) b -> Just 4
_ -> Nothing
go' = \case
App ( App ( App "refWithFile" identM ) filenameM) exceptionMayM -> Just 2
App ( App "and" a ) b -> Just 3
_ -> Nothing
go'' = \case
App ( App ( App (Var "refWithFile") identM ) filenameM) exceptionMayM -> Just 2
App ( App (Var "and") a ) b -> Just 3
App ( App (Var "or") a ) b -> Just 4
_ -> Nothing
main = do
let expr = App (App "or" "a") "b"
print (go expr)
print (go' expr)
$ runghc-8.4.3 Test.hs
Test.hs:13:3: warning: [-Woverlapping-patterns]
Pattern match is redundant
In a case alternative: App (App "or" a) b -> ...
|
13 | App ( App "or" a ) b -> Just 4
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Just 4
Nothing
$ runghc-8.6.1 Test.hs
Test.hs:13:3: warning: [-Woverlapping-patterns]
Pattern match is redundant
In a case alternative: App (App "or" a) b -> ...
|
13 | App ( App "or" a ) b -> Just 4
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Just 4
Nothing
```
The pattern match checker complains about the `"or"` case of `go` being redundant, but, when it is removed (as it is in `go'`) the output is different. `go''` demonstrates that `OverloadedStrings` is relevant, as that is \*not\* generating a warning. Removing either of the other two cases of `go` also suppresses the warning: all three are necessary.
As seen in the transcript, this is happening on both 8.4.3 and 8.6.1.
<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":"Bogus -Woverlapping-patterns warning with OverloadedStrings","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$ cat Test.hs\r\n{-# LANGUAGE OverloadedStrings, LambdaCase #-}\r\nimport Data.String\r\n\r\ndata Expr = App Expr Expr | Var String\r\n deriving (Eq)\r\n\r\ninstance IsString Expr where\r\n fromString = Var . fromString\r\n\r\ngo = \\case\r\n App ( App ( App \"refWithFile\" identM ) filenameM) exceptionMayM -> Just 2\r\n App ( App \"and\" a ) b -> Just 3\r\n App ( App \"or\" a ) b -> Just 4\r\n _ -> Nothing\r\n\r\ngo' = \\case\r\n App ( App ( App \"refWithFile\" identM ) filenameM) exceptionMayM -> Just 2\r\n App ( App \"and\" a ) b -> Just 3\r\n _ -> Nothing\r\n\r\ngo'' = \\case\r\n App ( App ( App (Var \"refWithFile\") identM ) filenameM) exceptionMayM -> Just 2\r\n App ( App (Var \"and\") a ) b -> Just 3\r\n App ( App (Var \"or\") a ) b -> Just 4\r\n _ -> Nothing\r\n\r\nmain = do\r\n let expr = App (App \"or\" \"a\") \"b\"\r\n print (go expr)\r\n print (go' expr)\r\n\r\n$ runghc-8.4.3 Test.hs\r\n\r\nTest.hs:13:3: warning: [-Woverlapping-patterns]\r\n Pattern match is redundant\r\n In a case alternative: App (App \"or\" a) b -> ...\r\n |\r\n13 | App ( App \"or\" a ) b -> Just 4\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nJust 4\r\nNothing\r\n$ runghc-8.6.1 Test.hs\r\n\r\nTest.hs:13:3: warning: [-Woverlapping-patterns]\r\n Pattern match is redundant\r\n In a case alternative: App (App \"or\" a) b -> ...\r\n |\r\n13 | App ( App \"or\" a ) b -> Just 4\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nJust 4\r\nNothing\r\n}}}\r\n\r\nThe pattern match checker complains about the `\"or\"` case of `go` being redundant, but, when it is removed (as it is in `go'`) the output is different. `go''` demonstrates that `OverloadedStrings` is relevant, as that is *not* generating a warning. Removing either of the other two cases of `go` also suppresses the warning: all three are necessary.\r\n\r\nAs seen in the transcript, this is happening on both 8.4.3 and 8.6.1.","type_of_failure":"OtherFailure","blocking":[]} -->Sebastian GrafSebastian Grafhttps://gitlab.haskell.org/ghc/ghc/-/issues/15714Compacting StaticPtr of a function doesn't work2019-07-07T18:03:19ZÖmer Sinan AğacanCompacting StaticPtr of a function doesn't workI think we should be able to compact a StaticPtr of a function, but it currently doesn't work. Reproducer:
```haskell
{-# LANGUAGE StaticPointers #-}
import GHC.StaticPtr
import Data.Compact
foo :: Int -> Int
foo x = x^2
main = do
...I think we should be able to compact a StaticPtr of a function, but it currently doesn't work. Reproducer:
```haskell
{-# LANGUAGE StaticPointers #-}
import GHC.StaticPtr
import Data.Compact
foo :: Int -> Int
foo x = x^2
main = do
c <- compact (static foo :: StaticPtr (Int -> Int))
return ()
```
Output:
```
./compact_test
compact_test: compaction failed: cannot compact functions
```
Tried with 8.4.3 (compact on hackage doesn't build with 8.6).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------- |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | bgamari, simonmar |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Compacting StaticPtr of a function doesn't work","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["bgamari","simonmar"],"type":"Bug","description":"I think we should be able to compact a StaticPtr of a function, but it currently doesn't work. Reproducer:\r\n\r\n{{{#!haskell\r\n{-# LANGUAGE StaticPointers #-}\r\n\r\nimport GHC.StaticPtr\r\nimport Data.Compact\r\n\r\nfoo :: Int -> Int\r\nfoo x = x^2\r\n\r\nmain = do\r\n c <- compact (static foo :: StaticPtr (Int -> Int))\r\n return ()\r\n}}}\r\n\r\nOutput:\r\n\r\n{{{\r\n./compact_test\r\ncompact_test: compaction failed: cannot compact functions\r\n}}}\r\n\r\nTried with 8.4.3 (compact on hackage doesn't build with 8.6).","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15715problematic openFile with named pipes2019-07-07T18:03:19Zadpproblematic openFile with named pipes- while `openFile`'ng named pipes for `ReadMode` works fine, on `WriteMode` or `AppendMode` it throws `openFile: does not exist (No such device or address)`; and on `WriteReadMode`, it opens it, but seem not able to write to it (the proc...- while `openFile`'ng named pipes for `ReadMode` works fine, on `WriteMode` or `AppendMode` it throws `openFile: does not exist (No such device or address)`; and on `WriteReadMode`, it opens it, but seem not able to write to it (the process hearing on the other side didn't hear anything).
- `writeFile` and `appendFile` works though.
- using stack `resolver: lts-12.4`, on ubuntu 16.04 LTS
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | IncorrectResultAtRuntime |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"problematic openFile with named pipes","status":"New","operating_system":"","component":"libraries/base","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"- while `openFile`'ng named pipes for `ReadMode` works fine, on `WriteMode` or `AppendMode` it throws `openFile: does not exist (No such device or address)`; and on `WriteReadMode`, it opens it, but seem not able to write to it (the process hearing on the other side didn't hear anything).\r\n\r\n- `writeFile` and `appendFile` works though.\r\n\r\n- using stack `resolver: lts-12.4`, on ubuntu 16.04 LTS\r\n","type_of_failure":"IncorrectResultAtRuntime","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15716GHC hangs on default implementation of type family2019-07-07T18:03:19ZHeimdellGHC hangs on default implementation of type familyI have this code:
```
{-# language TypeFamilies #-}
{-# language MultiParamTypeClasses #-}
{-# language FlexibleInstances #-}
import Control.Monad.Except
class Component comp where
data Error comp :: *
type ComponentT comp :: ...I have this code:
```
{-# language TypeFamilies #-}
{-# language MultiParamTypeClasses #-}
{-# language FlexibleInstances #-}
import Control.Monad.Except
class Component comp where
data Error comp :: *
type ComponentT comp :: * -> *
type ComponentT comp = ExceptT (Error comp)
```
I expect it to either compile or fail with error.
Instead, GHC\[i\] hangs every time.
It prints
```
<interactive>:10:28: error:
```
and then hangs.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC hangs on default implementation of type family","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I have this code:\r\n\r\n{{{\r\n{-# language TypeFamilies #-}\r\n{-# language MultiParamTypeClasses #-}\r\n{-# language FlexibleInstances #-}\r\n\r\nimport Control.Monad.Except\r\n\r\nclass Component comp where\r\n data Error comp :: *\r\n type ComponentT comp :: * -> *\r\n type ComponentT comp = ExceptT (Error comp)\r\n\r\n}}}\r\n\r\nI expect it to either compile or fail with error.\r\n\r\nInstead, GHC[i] hangs every time.\r\n\r\nIt prints\r\n{{{\r\n<interactive>:10:28: error:\r\n}}}\r\n\r\nand then hangs.","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/15718Build panic on ghc-8.6.1 under FreeBSD when using -fllvm2022-07-11T05:56:05Zgwright@antiope.comBuild panic on ghc-8.6.1 under FreeBSD when using -fllvmThis looks like a straightforward oversight. I am building my pure haskell LU solver under FreeBSD. I use the -fllvm compiler option because I need extra numerical performance.
When I build, I get (this is the output from GitLab CI, whi...This looks like a straightforward oversight. I am building my pure haskell LU solver under FreeBSD. I use the -fllvm compiler option because I need extra numerical performance.
When I build, I get (this is the output from GitLab CI, which is in turn running 'stack build')
```
Running with gitlab-runner 11.2.0 (35e8515d)
on stacker.18clay.com a2111f63
Using Shell executor...
Running on stacker.18clay.com...
Fetching changes...
Removing .stack-work/
HEAD is now at f8fe3b4 Use llvm60 on FreeBSD.
From https://gitlab.18clay.com/software/luSolve
f8fe3b4..c993a26 streamlined -> origin/streamlined
Checking out c993a262 as streamlined...
Skipping Git submodules setup
$ stack build --pedantic
luSolve-0.5: configure (lib)
Configuring luSolve-0.5...
luSolve-0.5: build (lib)
Preprocessing library for luSolve-0.5..
Building library for luSolve-0.5..
[1 of 1] Compiling Numeric.LinearAlgebra.LUSolve ( src/Numeric/LinearAlgebra/LUSolve.hs, .stack-work/dist/x86_64-freebsd/Cabal-2.4.0.1/build/Numeric/LinearAlgebra/LUSolve.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-portbld-freebsd):
Failed to lookup the datalayout for x86_64-unknown-freebsd; available targets: ["i386-unknown-windows","i686-unknown-windows","x86_64-unknown-windows","arm-unknown-linux-gnueabihf","armv6-unknown-linux-gnueabihf","armv6l-unknown-linux-gnueabihf","armv7-unknown-linux-gnueabihf","armv7a-unknown-linux-gnueabi","armv7l-unknown-linux-gnueabihf","aarch64-unknown-linux-gnu","aarch64-unknown-linux","i386-unknown-linux-gnu","i386-unknown-linux","x86_64-unknown-linux-gnu","x86_64-unknown-linux","armv7-unknown-linux-androideabi","aarch64-unknown-linux-android","powerpc64le-unknown-linux","amd64-portbld-freebsd","arm-unknown-nto-qnx-eabi","i386-apple-darwin","x86_64-apple-darwin","armv7-apple-ios","aarch64-apple-ios","i386-apple-ios","x86_64-apple-ios","aarch64-unknown-freebsd","armv6-unknown-freebsd-gnueabihf","armv7-unknown-freebsd-gnueabihf"]
CallStack (from HasCallStack):
error, called at compiler/llvmGen/LlvmCodeGen.hs:96:24 in ghc:LlvmCodeGen
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
-- While building custom Setup.hs for package luSolve-0.5 using:
/home/gitlab-runner/.stack/setup-exe-cache/x86_64-freebsd/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.1 --builddir=.stack-work/dist/x86_64-freebsd/Cabal-2.4.0.1 build lib:luSolve --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
ERROR: Job failed: exit status 1
```
The bug seems simple. The compiler is looking for the datalayout for x86_64-unknown-freebsd; but what is available is amd64-portbld-freebsd. Is this just a simple naming error? The stack resolver was the cutting-edge nightly-2018-10-6; if it is a problem in their packaging rather than ghc itself I will file a report with them (though ghc did panic here, and as the breath ebbed from its ASTs and light faded from the code generator, it pleaded that a bug report be filed).
I've attached the .cabal file in case it helps.
<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":"Build panic on ghc-8.6.1 under FreeBSD when using -fllvm","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":"This looks like a straightforward oversight. I am building my pure haskell LU solver under FreeBSD. I use the -fllvm compiler option because I need extra numerical performance.\r\n\r\nWhen I build, I get (this is the output from GitLab CI, which is in turn running 'stack build')\r\n\r\n{{{\r\nRunning with gitlab-runner 11.2.0 (35e8515d)\r\n on stacker.18clay.com a2111f63\r\nUsing Shell executor...\r\nRunning on stacker.18clay.com...\r\nFetching changes...\r\nRemoving .stack-work/\r\nHEAD is now at f8fe3b4 Use llvm60 on FreeBSD.\r\nFrom https://gitlab.18clay.com/software/luSolve\r\n f8fe3b4..c993a26 streamlined -> origin/streamlined\r\nChecking out c993a262 as streamlined...\r\nSkipping Git submodules setup\r\n$ stack build --pedantic\r\nluSolve-0.5: configure (lib)\r\nConfiguring luSolve-0.5...\r\nluSolve-0.5: build (lib)\r\nPreprocessing library for luSolve-0.5..\r\nBuilding library for luSolve-0.5..\r\n[1 of 1] Compiling Numeric.LinearAlgebra.LUSolve ( src/Numeric/LinearAlgebra/LUSolve.hs, .stack-work/dist/x86_64-freebsd/Cabal-2.4.0.1/build/Numeric/LinearAlgebra/LUSolve.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-portbld-freebsd):\r\n\tFailed to lookup the datalayout for x86_64-unknown-freebsd; available targets: [\"i386-unknown-windows\",\"i686-unknown-windows\",\"x86_64-unknown-windows\",\"arm-unknown-linux-gnueabihf\",\"armv6-unknown-linux-gnueabihf\",\"armv6l-unknown-linux-gnueabihf\",\"armv7-unknown-linux-gnueabihf\",\"armv7a-unknown-linux-gnueabi\",\"armv7l-unknown-linux-gnueabihf\",\"aarch64-unknown-linux-gnu\",\"aarch64-unknown-linux\",\"i386-unknown-linux-gnu\",\"i386-unknown-linux\",\"x86_64-unknown-linux-gnu\",\"x86_64-unknown-linux\",\"armv7-unknown-linux-androideabi\",\"aarch64-unknown-linux-android\",\"powerpc64le-unknown-linux\",\"amd64-portbld-freebsd\",\"arm-unknown-nto-qnx-eabi\",\"i386-apple-darwin\",\"x86_64-apple-darwin\",\"armv7-apple-ios\",\"aarch64-apple-ios\",\"i386-apple-ios\",\"x86_64-apple-ios\",\"aarch64-unknown-freebsd\",\"armv6-unknown-freebsd-gnueabihf\",\"armv7-unknown-freebsd-gnueabihf\"]\r\nCallStack (from HasCallStack):\r\n error, called at compiler/llvmGen/LlvmCodeGen.hs:96:24 in ghc:LlvmCodeGen\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n\r\n-- While building custom Setup.hs for package luSolve-0.5 using:\r\n /home/gitlab-runner/.stack/setup-exe-cache/x86_64-freebsd/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.1 --builddir=.stack-work/dist/x86_64-freebsd/Cabal-2.4.0.1 build lib:luSolve --ghc-options \" -ddump-hi -ddump-to-file\"\r\n Process exited with code: ExitFailure 1\r\nERROR: Job failed: exit status 1\r\n}}}\r\n\r\nThe bug seems simple. The compiler is looking for the datalayout for x86_64-unknown-freebsd; but what is available is amd64-portbld-freebsd. Is this just a simple naming error? The stack resolver was the cutting-edge nightly-2018-10-6; if it is a problem in their packaging rather than ghc itself I will file a report with them (though ghc did panic here, and as the breath ebbed from its ASTs and light faded from the code generator, it pleaded that a bug report be filed).\r\n\r\nI've attached the .cabal file in case it helps.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15721Command `:show bindings` throws exception for bindings without `let`2019-07-07T18:03:18ZTao Hesighingnow@gmail.comCommand `:show bindings` throws exception for bindings without `let`The command `:show bindings` works for `let a = 1`:
```hs
Prelude> let a = 1
Prelude> :show bindings
a :: Num p => p = _
```
But not for `a = 1`:
```hs
Prelude> a = 1
Prelude> :show bindings
ghc-stage2.exe: ^^ Could not load 'interact...The command `:show bindings` works for `let a = 1`:
```hs
Prelude> let a = 1
Prelude> :show bindings
a :: Num p => p = _
```
But not for `a = 1`:
```hs
Prelude> a = 1
Prelude> :show bindings
ghc-stage2.exe: ^^ Could not load 'interactive_Ghci1_zdtrModule2_closure', dependency unresolved. See top entry above.
ghc-stage2.exe: ^^ Could not load 'interactive_Ghci1_zdtrModule4_closure', dependency unresolved. See top entry above.
$trModule :: GHC.Types.Module = _
$trModule1 :: GHC.Types.TrName = _
$trModule2 ::
GHC.Prim.Addr# = *** Exception:
ByteCodeLink.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
interactive_Ghci1_zdtrModule2_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session. Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
glasgow-haskell-bugs@haskell.org
$trModule3 :: GHC.Types.TrName = _
$trModule4 ::
GHC.Prim.Addr# = *** Exception:
ByteCodeLink.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
interactive_Ghci1_zdtrModule4_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session. Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
glasgow-haskell-bugs@haskell.org
a :: Num p => p = _
a1 :: Integer = _
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | GHCi |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Command `:show bindings` throws exception for bindings without `let`","status":"New","operating_system":"","component":"GHCi","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The command `:show bindings` works for `let a = 1`:\r\n\r\n{{{#!hs\r\nPrelude> let a = 1\r\nPrelude> :show bindings\r\na :: Num p => p = _\r\n}}}\r\n\r\nBut not for `a = 1`:\r\n\r\n{{{#!hs\r\nPrelude> a = 1\r\nPrelude> :show bindings\r\nghc-stage2.exe: ^^ Could not load 'interactive_Ghci1_zdtrModule2_closure', dependency unresolved. See top entry above.\r\n\r\nghc-stage2.exe: ^^ Could not load 'interactive_Ghci1_zdtrModule4_closure', dependency unresolved. See top entry above.\r\n\r\n$trModule :: GHC.Types.Module = _\r\n$trModule1 :: GHC.Types.TrName = _\r\n$trModule2 ::\r\n GHC.Prim.Addr# = *** Exception:\r\nByteCodeLink.lookupCE\r\nDuring interactive linking, GHCi couldn't find the following symbol:\r\n interactive_Ghci1_zdtrModule2_closure\r\nThis may be due to you not asking GHCi to load extra object files,\r\narchives or DLLs needed by your current session. Restart GHCi, specifying\r\nthe missing library using the -L/path/to/object/dir and -lmissinglibname\r\nflags, or simply by naming the relevant files on the GHCi command line.\r\nAlternatively, this link failure might indicate a bug in GHCi.\r\nIf you suspect the latter, please send a bug report to:\r\n glasgow-haskell-bugs@haskell.org\r\n\r\n$trModule3 :: GHC.Types.TrName = _\r\n$trModule4 ::\r\n GHC.Prim.Addr# = *** Exception:\r\nByteCodeLink.lookupCE\r\nDuring interactive linking, GHCi couldn't find the following symbol:\r\n interactive_Ghci1_zdtrModule4_closure\r\nThis may be due to you not asking GHCi to load extra object files,\r\narchives or DLLs needed by your current session. Restart GHCi, specifying\r\nthe missing library using the -L/path/to/object/dir and -lmissinglibname\r\nflags, or simply by naming the relevant files on the GHCi command line.\r\nAlternatively, this link failure might indicate a bug in GHCi.\r\nIf you suspect the latter, please send a bug report to:\r\n glasgow-haskell-bugs@haskell.org\r\n\r\na :: Num p => p = _\r\na1 :: Integer = _\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15722Add -Wstar-is-type to the User's Guide2019-07-07T18:03:16ZVladislav ZavialovAdd -Wstar-is-type to the User's GuideDocumentation for `-Wstar-is-type` is missing in the 8.6.1 release.
Creating this ticket with a milestone as a reminder to cherry-pick the patch to 8.6.2 (right now it's merged to `master`).
<details><summary>Trac metadata</summary>
|...Documentation for `-Wstar-is-type` is missing in the 8.6.1 release.
Creating this ticket with a milestone as a reminder to cherry-pick the patch to 8.6.2 (right now it's merged to `master`).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------- |
| Version | 8.6.1 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Documentation |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | bgamari |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Add -Wstar-is-type to the User's Guide","status":"New","operating_system":"","component":"Documentation","related":[],"milestone":"8.6.2","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["bgamari"],"type":"Task","description":"Documentation for `-Wstar-is-type` is missing in the 8.6.1 release.\r\n\r\nCreating this ticket with a milestone as a reminder to cherry-pick the patch to 8.6.2 (right now it's merged to `master`).","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15723-prof -fPIC -fexternal-dynamic-refs generates non-PIC relocations for externa...2019-07-07T18:03:15ZZejun Wu-prof -fPIC -fexternal-dynamic-refs generates non-PIC relocations for external symbolWhen compiling code with `-prof -fPIC -fexternal-dynamic-refs`, the generated object file may contains R_X86_64_PC32 relocation to symbols defined in another object file.
```
$ cat T15723A.hs T15723B.hs
module T15723A where
{-# INLINE ...When compiling code with `-prof -fPIC -fexternal-dynamic-refs`, the generated object file may contains R_X86_64_PC32 relocation to symbols defined in another object file.
```
$ cat T15723A.hs T15723B.hs
module T15723A where
{-# INLINE foo #-}
foo :: Int -> Int
foo x = {-# SCC foo1 #-} bar x
{-# NOINLINE bar #-}
bar :: Int -> Int
bar x = x
module T15723B where
import T15723A
test :: Int -> Int
test x = {-# SCC test1 #-} foo $ foo x
$ $HC -prof -prof -fPIC -fexternal-dynamic-refs -O2 -c T15723A.hs
$ $HC -prof -prof -fPIC -fexternal-dynamic-refs -O2 -c T15723B.hs
$ objdump -rdS T15723B.o | less
0000000000000028 <T15723B_test_info>:
28: 48 8d 45 f0 lea -0x10(%rbp),%rax
2c: 4c 39 f8 cmp %r15,%rax
2f: 72 70 jb a1 <T15723B_test_info+0x79>
31: 48 83 ec 08 sub $0x8,%rsp
35: 48 8d 35 00 00 00 00 lea 0x0(%rip),%rsi # 3c <T15723B_test_info+0x14>
38: R_X86_64_PC32 T15723B_test1_EXPR_cc-0x4
3c: 49 8b bd 60 03 00 00 mov 0x360(%r13),%rdi
43: 31 c0 xor %eax,%eax
45: e8 00 00 00 00 callq 4a <T15723B_test_info+0x22>
46: R_X86_64_PLT32 pushCostCentre-0x4
4a: 48 83 c4 08 add $0x8,%rsp
4e: 48 ff 40 30 incq 0x30(%rax)
52: 49 89 85 60 03 00 00 mov %rax,0x360(%r13)
59: 48 83 ec 08 sub $0x8,%rsp
5d: 48 8d 35 00 00 00 00 lea 0x0(%rip),%rsi # 64 <T15723B_test_info+0x3c>
60: R_X86_64_PC32 T15723A_foo1_EXPR_cc-0x4
```
When attempt to link both `T15723A.o` and `T15723B.o` in ghci using `+RTS -xp`, the address of `T15723A_foo1_EXPR_cc` can be more than 2G away from `T15723B_test_info` and cause link error or segfault.8.10.1Zejun WuZejun Wuhttps://gitlab.haskell.org/ghc/ghc/-/issues/15724GHC panic with malformed pragma2019-07-07T18:03:15ZetorreborreGHC panic with malformed pragmaThis comment crashes GHC (the comment is not properly closed)
```hs
{-# OPTIONS_GHC -f-no-warn-orphans #}
```
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-apple-darwin):
getOptions'.parseToks: C...This comment crashes GHC (the comment is not properly closed)
```hs
{-# OPTIONS_GHC -f-no-warn-orphans #}
```
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-apple-darwin):
getOptions'.parseToks: Couldn't read " \"|\")) <> rand_bytes\n pure $ (==) hashed rehashed\n final = either (FailedToParse . show) (bool InValid Valid) result\n\n{-# ANN StateNamePrefix (Just (\"Test\" :: Text)) " as String
```https://gitlab.haskell.org/ghc/ghc/-/issues/15725Core Lint error: Trans coercion mis-match2019-07-07T18:03:14ZRyan ScottCore Lint error: Trans coercion mis-matchI discovered this when debugging #15703. The following code fails to compile with `-dcore-lint`:
```hs
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ...I discovered this when debugging #15703. The following code fails to compile with `-dcore-lint`:
```hs
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug where
import Data.Functor.Identity (Identity(..))
import Data.Kind (Type)
import GHC.Exts (Any)
-----
-- The important bits
-----
type instance Meth (x :: Identity a) = GenericMeth x
instance SC Identity
-------------------------------------------------------------------------------
data family Sing :: forall k. k -> Type
data instance Sing :: forall a. Identity a -> Type where
SIdentity :: Sing x -> Sing ('Identity x)
newtype Par1 p = Par1 p
data instance Sing :: forall p. Par1 p -> Type where
SPar1 :: Sing x -> Sing ('Par1 x)
type family Rep1 (f :: Type -> Type) :: Type -> Type
class PGeneric1 (f :: Type -> Type) where
type From1 (z :: f a) :: Rep1 f a
type To1 (z :: Rep1 f a) :: f a
class SGeneric1 (f :: Type -> Type) where
sFrom1 :: forall (a :: Type) (z :: f a). Sing z -> Sing (From1 z)
sTo1 :: forall (a :: Type) (r :: Rep1 f a). Sing r -> Sing (To1 r :: f a)
type instance Rep1 Identity = Par1
instance PGeneric1 Identity where
type From1 ('Identity x) = 'Par1 x
type To1 ('Par1 x) = 'Identity x
instance SGeneric1 Identity where
sFrom1 (SIdentity x) = SPar1 x
sTo1 (SPar1 x) = SIdentity x
type family GenericMeth (x :: f a) :: f a where
GenericMeth x = To1 (Meth (From1 x))
type family Meth (x :: f a) :: f a
class SC f where
sMeth :: forall a (x :: f a).
Sing x -> Sing (Meth x)
default sMeth :: forall a (x :: f a).
( SGeneric1 f, SC (Rep1 f)
, Meth x ~ GenericMeth x
)
=> Sing x -> Sing (Meth x)
sMeth sx = sTo1 (sMeth (sFrom1 sx))
dummy :: f a -> ()
dummy _ = ()
type instance Meth (x :: Par1 p) = x
instance SC Par1 where
sMeth x = x
```
```
$ /opt/ghc/8.6.1/bin/ghc -fforce-recomp Bug.hs -dcore-lint
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
*** Core Lint errors : in result of Simplifier ***
<no location info>: warning:
[in body of letrec with binders x_s1Nw :: Sing (From1 x_a1Jc)]
Trans coercion mis-match: D:R:Rep1Identity[0] <a_a1Jb>_N ; Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)
Rep1 Identity a_a1Jb
Par1 a_a1Jb
Rep1 Identity a_a1Jb
Par1 a_a1Jb
*** Offending Program ***
<elided>
$csMeth_a1J9 [Occ=LoopBreaker]
:: forall a (x :: Identity a). Sing x -> Sing (Meth x)
[LclId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 100 60}]
$csMeth_a1J9
= \ (@ a_a1Jb) (@ (x_a1Jc :: Identity a_a1Jb)) ->
case heq_sel
@ (Identity a_a1Jb)
@ (Identity a_a1Jb)
@ (Meth x_a1Jc)
@ (GenericMeth x_a1Jc)
(($d~_s1Nz @ a_a1Jb @ x_a1Jc)
`cast` (((~)
<Identity a_a1Jb>_N
((To1
<Identity>_N
<a_a1Jb>_N
(Coh (Sym (D:R:MethTYPEPar1px[0]
<a_a1Jb>_N
(Coh (Sym (Coh <From1 x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))
(D:R:Rep1Identity[0] <a_a1Jb>_N))))
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Meth
<*>_N
(Sym (D:R:Rep1Identity[0]))
<a_a1Jb>_N
(Coh <From1 x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))_N))_N ; (Sym (D:R:GenericMeth[0]
<Identity>_N
<a_a1Jb>_N
<x_a1Jc>_N) ; Sym (D:R:MethTYPEIdentityax[0]
<a_a1Jb>_N
<x_a1Jc>_N)))
((To1
<Identity>_N
<a_a1Jb>_N
(Coh (Sym (Coh (Sym (Coh <From1 x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))
(D:R:Rep1Identity[0] <a_a1Jb>_N)))
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Sym (D:R:MethTYPEPar1px[0]
<a_a1Jb>_N
(Coh (Sym (Coh <From1
x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))
(D:R:Rep1Identity[0] <a_a1Jb>_N))) ; (Meth
<*>_N
(Sym (D:R:Rep1Identity[0]))
<a_a1Jb>_N
(Coh <From1
x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))_N)))_N ; Sym (D:R:GenericMeth[0]
<Identity>_N
<a_a1Jb>_N
<x_a1Jc>_N)))_R ; N:~[0]
<Identity
a_a1Jb>_N <Meth
x_a1Jc>_N <GenericMeth
x_a1Jc>_N
:: (To1 (From1 x_a1Jc) ~ To1 (From1 x_a1Jc))
~R# (Meth x_a1Jc ~~ GenericMeth x_a1Jc)))
of co_a1Kd
{ __DEFAULT ->
(\ (sx_aEZ :: Sing x_a1Jc) ->
let {
x_s1Nw :: Sing (From1 x_a1Jc)
[LclId]
x_s1Nw = $csFrom1_a1Jz @ a_a1Jb @ x_a1Jc sx_aEZ } in
case x_s1Nw
`cast` ((Sing
(D:R:Rep1Identity[0] <a_a1Jb>_N)
(Coh (Sym (Coh <From1 x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N ; Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))_R ; (Nth:3
(Inst (forall (x :: Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N).
(Sing
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)
(Sym (Coh <x>_N
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))_R
->_R (Sing
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)
(Sym (D:R:MethTYPEPar1px[0]
<a_a1Jb>_N
<x>_N) ; (Meth
<*>_N
(Sym (D:R:Rep1Identity[0]))
<a_a1Jb>_N
(Sym (Coh <x>_N
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))_N))_R) (Coh <From1
x_a1Jc>_N
(Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))) ; ((Sing
(D:R:Rep1Identity[0] <a_a1Jb>_N))_R ; D:R:SingPar10[0]
<a_a1Jb>_N) (Sym (Coh <Meth
(From1
x_a1Jc)>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N))))
:: Sing (From1 x_a1Jc |> Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)
~R# R:SingPar1
a_a1Jb (Meth (From1 x_a1Jc) |> D:R:Rep1Identity[0] <a_a1Jb>_N))
of
{ SPar1 @ x_a1JZ co_a1K0 x_a195 ->
($WSIdentity @ a_a1Jb @ x_a1JZ x_a195)
`cast` ((Sing
<Identity a_a1Jb>_N
(Sym (D:R:To1IdentityaPar1[0] <a_a1Jb>_N <x_a1JZ>_N) ; (To1
<Identity>_N
<a_a1Jb>_N
(Sym (Coh (Sym (Coh <'Par1
x_a1JZ>_N
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)) ; (Coh <'Par1
x_a1JZ>_N
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Sym co_a1K0 ; Coh <Meth
(From1
x_a1Jc)>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))))_N))_R
:: Sing ('Identity x_a1JZ) ~R# Sing (To1 (Meth (From1 x_a1Jc))))
})
`cast` (<Sing x_a1Jc>_R
->_R (Sing
<Identity a_a1Jb>_N
(Sym (D:R:GenericMeth[0]
<Identity>_N <a_a1Jb>_N <x_a1Jc>_N) ; Sym co_a1Kd))_R
:: (Sing x_a1Jc -> Sing (To1 (Meth (From1 x_a1Jc))))
~R# (Sing x_a1Jc -> Sing (Meth x_a1Jc)))
}
end Rec }
```
<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":"Core Lint error: Trans coercion mis-match","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I discovered this when debugging #15703. The following code fails to compile with `-dcore-lint`:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DefaultSignatures #-}\r\n{-# LANGUAGE FlexibleContexts #-}\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\n{-# LANGUAGE UndecidableInstances #-}\r\nmodule Bug where\r\n\r\nimport Data.Functor.Identity (Identity(..))\r\nimport Data.Kind (Type)\r\nimport GHC.Exts (Any)\r\n\r\n-----\r\n-- The important bits\r\n-----\r\n\r\ntype instance Meth (x :: Identity a) = GenericMeth x\r\ninstance SC Identity\r\n\r\n-------------------------------------------------------------------------------\r\n\r\ndata family Sing :: forall k. k -> Type\r\ndata instance Sing :: forall a. Identity a -> Type where\r\n SIdentity :: Sing x -> Sing ('Identity x)\r\n\r\nnewtype Par1 p = Par1 p\r\ndata instance Sing :: forall p. Par1 p -> Type where\r\n SPar1 :: Sing x -> Sing ('Par1 x)\r\n\r\ntype family Rep1 (f :: Type -> Type) :: Type -> Type\r\n\r\nclass PGeneric1 (f :: Type -> Type) where\r\n type From1 (z :: f a) :: Rep1 f a\r\n type To1 (z :: Rep1 f a) :: f a\r\n\r\nclass SGeneric1 (f :: Type -> Type) where\r\n sFrom1 :: forall (a :: Type) (z :: f a). Sing z -> Sing (From1 z)\r\n sTo1 :: forall (a :: Type) (r :: Rep1 f a). Sing r -> Sing (To1 r :: f a)\r\n\r\ntype instance Rep1 Identity = Par1\r\n\r\ninstance PGeneric1 Identity where\r\n type From1 ('Identity x) = 'Par1 x\r\n type To1 ('Par1 x) = 'Identity x\r\n\r\ninstance SGeneric1 Identity where\r\n sFrom1 (SIdentity x) = SPar1 x\r\n sTo1 (SPar1 x) = SIdentity x\r\n\r\ntype family GenericMeth (x :: f a) :: f a where\r\n GenericMeth x = To1 (Meth (From1 x))\r\n\r\ntype family Meth (x :: f a) :: f a\r\n\r\nclass SC f where\r\n sMeth :: forall a (x :: f a).\r\n Sing x -> Sing (Meth x)\r\n default sMeth :: forall a (x :: f a).\r\n ( SGeneric1 f, SC (Rep1 f)\r\n , Meth x ~ GenericMeth x\r\n )\r\n => Sing x -> Sing (Meth x)\r\n sMeth sx = sTo1 (sMeth (sFrom1 sx))\r\n\r\n dummy :: f a -> ()\r\n dummy _ = ()\r\n\r\ntype instance Meth (x :: Par1 p) = x\r\ninstance SC Par1 where\r\n sMeth x = x\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc -fforce-recomp Bug.hs -dcore-lint\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n*** Core Lint errors : in result of Simplifier ***\r\n<no location info>: warning:\r\n [in body of letrec with binders x_s1Nw :: Sing (From1 x_a1Jc)]\r\n Trans coercion mis-match: D:R:Rep1Identity[0] <a_a1Jb>_N ; Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)\r\n Rep1 Identity a_a1Jb\r\n Par1 a_a1Jb\r\n Rep1 Identity a_a1Jb\r\n Par1 a_a1Jb\r\n*** Offending Program ***\r\n\r\n<elided>\r\n\r\n$csMeth_a1J9 [Occ=LoopBreaker]\r\n :: forall a (x :: Identity a). Sing x -> Sing (Meth x)\r\n[LclId,\r\n Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,\r\n WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 100 60}]\r\n$csMeth_a1J9\r\n = \\ (@ a_a1Jb) (@ (x_a1Jc :: Identity a_a1Jb)) ->\r\n case heq_sel\r\n @ (Identity a_a1Jb)\r\n @ (Identity a_a1Jb)\r\n @ (Meth x_a1Jc)\r\n @ (GenericMeth x_a1Jc)\r\n (($d~_s1Nz @ a_a1Jb @ x_a1Jc)\r\n `cast` (((~)\r\n <Identity a_a1Jb>_N\r\n ((To1\r\n <Identity>_N\r\n <a_a1Jb>_N\r\n (Coh (Sym (D:R:MethTYPEPar1px[0]\r\n <a_a1Jb>_N\r\n (Coh (Sym (Coh <From1 x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N))))\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Meth\r\n <*>_N\r\n (Sym (D:R:Rep1Identity[0]))\r\n <a_a1Jb>_N\r\n (Coh <From1 x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))_N))_N ; (Sym (D:R:GenericMeth[0]\r\n <Identity>_N\r\n <a_a1Jb>_N\r\n <x_a1Jc>_N) ; Sym (D:R:MethTYPEIdentityax[0]\r\n <a_a1Jb>_N\r\n <x_a1Jc>_N)))\r\n ((To1\r\n <Identity>_N\r\n <a_a1Jb>_N\r\n (Coh (Sym (Coh (Sym (Coh <From1 x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Sym (D:R:MethTYPEPar1px[0]\r\n <a_a1Jb>_N\r\n (Coh (Sym (Coh <From1\r\n x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N))) ; (Meth\r\n <*>_N\r\n (Sym (D:R:Rep1Identity[0]))\r\n <a_a1Jb>_N\r\n (Coh <From1\r\n x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))_N)))_N ; Sym (D:R:GenericMeth[0]\r\n <Identity>_N\r\n <a_a1Jb>_N\r\n <x_a1Jc>_N)))_R ; N:~[0]\r\n <Identity\r\n a_a1Jb>_N <Meth\r\n x_a1Jc>_N <GenericMeth\r\n x_a1Jc>_N\r\n :: (To1 (From1 x_a1Jc) ~ To1 (From1 x_a1Jc))\r\n ~R# (Meth x_a1Jc ~~ GenericMeth x_a1Jc)))\r\n of co_a1Kd\r\n { __DEFAULT ->\r\n (\\ (sx_aEZ :: Sing x_a1Jc) ->\r\n let {\r\n x_s1Nw :: Sing (From1 x_a1Jc)\r\n [LclId]\r\n x_s1Nw = $csFrom1_a1Jz @ a_a1Jb @ x_a1Jc sx_aEZ } in\r\n case x_s1Nw\r\n `cast` ((Sing\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)\r\n (Coh (Sym (Coh <From1 x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N ; Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))_R ; (Nth:3\r\n (Inst (forall (x :: Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N).\r\n (Sing\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)\r\n (Sym (Coh <x>_N\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))_R\r\n ->_R (Sing\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)\r\n (Sym (D:R:MethTYPEPar1px[0]\r\n <a_a1Jb>_N\r\n <x>_N) ; (Meth\r\n <*>_N\r\n (Sym (D:R:Rep1Identity[0]))\r\n <a_a1Jb>_N\r\n (Sym (Coh <x>_N\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))_N))_R) (Coh <From1\r\n x_a1Jc>_N\r\n (Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))) ; ((Sing\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N))_R ; D:R:SingPar10[0]\r\n <a_a1Jb>_N) (Sym (Coh <Meth\r\n (From1\r\n x_a1Jc)>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N))))\r\n :: Sing (From1 x_a1Jc |> Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)\r\n ~R# R:SingPar1\r\n a_a1Jb (Meth (From1 x_a1Jc) |> D:R:Rep1Identity[0] <a_a1Jb>_N))\r\n of\r\n { SPar1 @ x_a1JZ co_a1K0 x_a195 ->\r\n ($WSIdentity @ a_a1Jb @ x_a1JZ x_a195)\r\n `cast` ((Sing\r\n <Identity a_a1Jb>_N\r\n (Sym (D:R:To1IdentityaPar1[0] <a_a1Jb>_N <x_a1JZ>_N) ; (To1\r\n <Identity>_N\r\n <a_a1Jb>_N\r\n (Sym (Coh (Sym (Coh <'Par1\r\n x_a1JZ>_N\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)) ; (Coh <'Par1\r\n x_a1JZ>_N\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Sym co_a1K0 ; Coh <Meth\r\n (From1\r\n x_a1Jc)>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))))_N))_R\r\n :: Sing ('Identity x_a1JZ) ~R# Sing (To1 (Meth (From1 x_a1Jc))))\r\n })\r\n `cast` (<Sing x_a1Jc>_R\r\n ->_R (Sing\r\n <Identity a_a1Jb>_N\r\n (Sym (D:R:GenericMeth[0]\r\n <Identity>_N <a_a1Jb>_N <x_a1Jc>_N) ; Sym co_a1Kd))_R\r\n :: (Sing x_a1Jc -> Sing (To1 (Meth (From1 x_a1Jc))))\r\n ~R# (Sing x_a1Jc -> Sing (Meth x_a1Jc)))\r\n }\r\nend Rec }\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15728Program with safe array operations triggers debug runtime assertion2019-07-07T18:03:13ZÖmer Sinan AğacanProgram with safe array operations triggers debug runtime assertionI'll try to minimize later.
Main.hs:
```
{-# LANGUAGE ForeignFunctionInterface #-}
import Control.Monad
import Control.Monad.ST
import Data.Primitive.Array
import Data.Primitive.ByteArray
import Data.Primitive.SmallArray
import System....I'll try to minimize later.
Main.hs:
```
{-# LANGUAGE ForeignFunctionInterface #-}
import Control.Monad
import Control.Monad.ST
import Data.Primitive.Array
import Data.Primitive.ByteArray
import Data.Primitive.SmallArray
import System.Environment
import System.Mem
import Foreign.C
data A arr = A !Int arr
enumSmallArray :: Int -> A (SmallArray Int)
enumSmallArray n = runST $ do
arr <- newSmallArray n 0
forM_ [1..n] $ \i ->
writeSmallArray arr i i
iarr <- freezeSmallArray arr 0 n
return (A n iarr)
consumeSmallArray :: A (SmallArray a) -> a
consumeSmallArray (A n arr) = indexSmallArray arr (n - 1)
enumArray :: Int -> A (Array Int)
enumArray n = runST $ do
arr <- newArray n 0
forM_ [1..n] $ \i ->
writeArray arr i i
iarr <- freezeArray arr 0 n
return (A n iarr)
consumeArray :: A (Array a) -> a
consumeArray (A n arr) = indexArray arr (n - 1)
foreign import ccall "printInt"
printInt :: CInt -> IO ()
main :: IO ()
main = do
n <- (\[s] -> read s) <$> getArgs
ints <- forM [1..n] $ \i -> do
let x = consumeSmallArray (enumSmallArray 12)
y = consumeArray (enumArray i)
case x+y of
r -> when (i `mod` 5000 == 0) performMajorGC
>> return r
printInt (fromIntegral (sum ints))
```
print.c:
```
#include <stdio.h>
void printInt(int i) { printf("Result: %d\n", i); }
```
Compile:
```
$ ghc Main.hs print.c -debug
Linking Main ...
```
Run:
```
array_bug $ ./Main 1000 +RTS -DS
Main: internal error: ASSERTION FAILED: file rts/sm/Storage.c, line 960
(GHC version 8.6.1 for x86_64_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
zsh: abort (core dumped) ./Main 1000 +RTS -DS
```
Tried with: 8.4.3, 8.6.1.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Runtime System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | bgamari |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Program with safe array operations triggers debug runtime assertion","status":"New","operating_system":"","component":"Runtime System","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["bgamari"],"type":"Bug","description":"I'll try to minimize later.\r\n\r\nMain.hs:\r\n\r\n{{{\r\n{-# LANGUAGE ForeignFunctionInterface #-}\r\nimport Control.Monad\r\nimport Control.Monad.ST\r\nimport Data.Primitive.Array\r\nimport Data.Primitive.ByteArray\r\nimport Data.Primitive.SmallArray\r\nimport System.Environment\r\nimport System.Mem\r\nimport Foreign.C\r\n\r\ndata A arr = A !Int arr\r\n\r\nenumSmallArray :: Int -> A (SmallArray Int)\r\nenumSmallArray n = runST $ do\r\n arr <- newSmallArray n 0\r\n forM_ [1..n] $ \\i ->\r\n writeSmallArray arr i i\r\n iarr <- freezeSmallArray arr 0 n\r\n return (A n iarr)\r\n\r\nconsumeSmallArray :: A (SmallArray a) -> a\r\nconsumeSmallArray (A n arr) = indexSmallArray arr (n - 1)\r\n\r\nenumArray :: Int -> A (Array Int)\r\nenumArray n = runST $ do\r\n arr <- newArray n 0\r\n forM_ [1..n] $ \\i ->\r\n writeArray arr i i\r\n iarr <- freezeArray arr 0 n\r\n return (A n iarr)\r\n\r\nconsumeArray :: A (Array a) -> a\r\nconsumeArray (A n arr) = indexArray arr (n - 1)\r\n\r\nforeign import ccall \"printInt\"\r\n printInt :: CInt -> IO ()\r\n\r\nmain :: IO ()\r\nmain = do\r\n n <- (\\[s] -> read s) <$> getArgs\r\n ints <- forM [1..n] $ \\i -> do\r\n let x = consumeSmallArray (enumSmallArray 12)\r\n y = consumeArray (enumArray i)\r\n case x+y of\r\n r -> when (i `mod` 5000 == 0) performMajorGC\r\n >> return r\r\n printInt (fromIntegral (sum ints))\r\n}}}\r\n\r\nprint.c:\r\n\r\n{{{\r\n#include <stdio.h>\r\n\r\nvoid printInt(int i) { printf(\"Result: %d\\n\", i); }\r\n}}}\r\n\r\nCompile:\r\n\r\n{{{\r\n$ ghc Main.hs print.c -debug\r\nLinking Main ...\r\n}}}\r\n\r\nRun:\r\n\r\n{{{\r\narray_bug $ ./Main 1000 +RTS -DS\r\nMain: internal error: ASSERTION FAILED: file rts/sm/Storage.c, line 960\r\n\r\n (GHC version 8.6.1 for x86_64_unknown_linux)\r\n Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\nzsh: abort (core dumped) ./Main 1000 +RTS -DS\r\n}}}\r\n\r\nTried with: 8.4.3, 8.6.1.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15729Static GHCi can segfault when accessing .bss section in C2019-07-07T18:03:13ZZejun WuStatic GHCi can segfault when accessing .bss section in CWhen an object file is statically linked, GHCi can return junk or segfault when trying to access data defined in .bss section via foreign call.
```
watashi % ~/gao/ghc/inplace/bin/ghc-stage2 --info | grep Dynamic
,("Dynamic by default"...When an object file is statically linked, GHCi can return junk or segfault when trying to access data defined in .bss section via foreign call.
```
watashi % ~/gao/ghc/inplace/bin/ghc-stage2 --info | grep Dynamic
,("Dynamic by default","NO")
,("GHC Dynamic","NO")
watashi % cat bss.c
int read_bss(int i) {
static int bss[1 << 20];
return bss[i];
}
watashi % ~/gao/ghc/inplace/bin/ghc-stage2 --interactive test.o
GHCi, version 8.7.20180920: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/watashi/.ghci
Prelude> :m + Foreign Foreign.C
Prelude Foreign Foreign.C> foreign import ccall unsafe "read_bss" read_bss :: Int -> IO Int
Prelude Foreign Foreign.C> read_bss 0
4294059519
Prelude Foreign Foreign.C> read_bss 1
65535
Prelude Foreign Foreign.C> mapM (read_bss . bit) [0 .. 19]
zsh: segmentation fault (core dumped) ~/gao/ghc/inplace/bin/ghc-stage2 --interactive test.o
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | GHCi |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | simonmar, watashi |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Static GHCi can segfault when accessing .bss section in C","status":"New","operating_system":"","component":"GHCi","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["simonmar","watashi"],"type":"Bug","description":"When an object file is statically linked, GHCi can return junk or segfault when trying to access data defined in .bss section via foreign call.\r\n\r\n{{{\r\nwatashi % ~/gao/ghc/inplace/bin/ghc-stage2 --info | grep Dynamic\r\n ,(\"Dynamic by default\",\"NO\")\r\n ,(\"GHC Dynamic\",\"NO\")\r\nwatashi % cat bss.c\r\nint read_bss(int i) {\r\n static int bss[1 << 20];\r\n return bss[i];\r\n}\r\nwatashi % ~/gao/ghc/inplace/bin/ghc-stage2 --interactive test.o\r\nGHCi, version 8.7.20180920: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/watashi/.ghci\r\nPrelude> :m + Foreign Foreign.C\r\nPrelude Foreign Foreign.C> foreign import ccall unsafe \"read_bss\" read_bss :: Int -> IO Int\r\nPrelude Foreign Foreign.C> read_bss 0\r\n4294059519\r\nPrelude Foreign Foreign.C> read_bss 1\r\n65535\r\nPrelude Foreign Foreign.C> mapM (read_bss . bit) [0 .. 19]\r\nzsh: segmentation fault (core dumped) ~/gao/ghc/inplace/bin/ghc-stage2 --interactive test.o\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1Zejun WuZejun Wuhttps://gitlab.haskell.org/ghc/ghc/-/issues/15730SCC/HPC/CORE annotation can change the meaning of an expression2020-01-02T20:44:54ZVladislav ZavialovSCC/HPC/CORE annotation can change the meaning of an expressionConsider this GHCi session:
```
Prelude> 1 / 2 / 2
0.25
Prelude> 1 / {-# SCC ann #-} 2 / 2
1.0
```
Adding an SCC annotation changed the meaning of the expression.
<details><summary>Trac metadata</summary>
| Trac field | V...Consider this GHCi session:
```
Prelude> 1 / 2 / 2
0.25
Prelude> 1 / {-# SCC ann #-} 2 / 2
1.0
```
Adding an SCC annotation changed the meaning of the expression.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler (Parser) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"SCC/HPC/CORE annotation can change the meaning of an expression","status":"New","operating_system":"","component":"Compiler (Parser)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider this GHCi session:\r\n\r\n{{{\r\nPrelude> 1 / 2 / 2\r\n0.25\r\nPrelude> 1 / {-# SCC ann #-} 2 / 2\r\n1.0\r\n}}}\r\n\r\nAdding an SCC annotation changed the meaning of the expression.","type_of_failure":"OtherFailure","blocking":[]} -->Vladislav ZavialovVladislav Zavialovhttps://gitlab.haskell.org/ghc/ghc/-/issues/15733Several links in GHC.Exts.Heap documentation are broken2019-07-07T18:03:12ZMatthew PickeringSeveral links in GHC.Exts.Heap documentation are brokenThere are some broken links in the GHC.Exts.Heap documentation.
https://downloads.haskell.org/\~ghc/latest/docs/html/libraries/ghc-heap-8.6.1/GHC-Exts-Heap.html
For example, in `GenClosure`, the first link is wrong and redirects.
http...There are some broken links in the GHC.Exts.Heap documentation.
https://downloads.haskell.org/\~ghc/latest/docs/html/libraries/ghc-heap-8.6.1/GHC-Exts-Heap.html
For example, in `GenClosure`, the first link is wrong and redirects.
http://hackage.haskell.org/trac/ghc/browser/includes/rts/storage/Closures.h
Similarly in the definition of `StgInfoTable`. Those are the two I found.
<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":"Several links in GHC.Exts.Heap documentation are broken","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["newcomer"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"There are some broken links in the GHC.Exts.Heap documentation.\r\n\r\nhttps://downloads.haskell.org/~ghc/latest/docs/html/libraries/ghc-heap-8.6.1/GHC-Exts-Heap.html\r\n\r\nFor example, in `GenClosure`, the first link is wrong and redirects.\r\n\r\nhttp://hackage.haskell.org/trac/ghc/browser/includes/rts/storage/Closures.h\r\n\r\nSimilarly in the definition of `StgInfoTable`. Those are the two I found.\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15734ghc-heap package is not on hackage2023-04-01T11:51:50ZMatthew Pickeringghc-heap package is not on hackageThe documentation for ghc-heap is quite hidden away here:
https://downloads.haskell.org/\~ghc/latest/docs/html/libraries/ghc-heap-8.6.1/GHC-Exts-Heap.html
It would be useful if it was on hackage so that it had better discoverability an...The documentation for ghc-heap is quite hidden away here:
https://downloads.haskell.org/\~ghc/latest/docs/html/libraries/ghc-heap-8.6.1/GHC-Exts-Heap.html
It would be useful if it was on hackage so that it had better discoverability and was easier to browse the documentation like the normal `ghc` package.
<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-heap package is not on hackage","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 documentation for ghc-heap is quite hidden away here:\r\n\r\nhttps://downloads.haskell.org/~ghc/latest/docs/html/libraries/ghc-heap-8.6.1/GHC-Exts-Heap.html\r\n\r\nIt would be useful if it was on hackage so that it had better discoverability and was easier to browse the documentation like the normal `ghc` package. ","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15736Testsuite failures from validate --slow2020-05-31T16:39:47Zjrp2014Testsuite failures from validate --slowIn case it helps, I ran a `./validate --slow` on HEAD on Ubuntu Bionic with 8.6.1. I don't attach much weight to the performance / stat failures as the tests seem to run in parallel. I'll pull out more specific diagnostics, if necessary....In case it helps, I ran a `./validate --slow` on HEAD on Ubuntu Bionic with 8.6.1. I don't attach much weight to the performance / stat failures as the tests seem to run in parallel. I'll pull out more specific diagnostics, if necessary.
```
==== STAGE 1 TESTS ====
SUMMARY for test run started at Wed Oct 10 20:29:33 2018 BST
0:00:04 spent to go through
2 total tests, which gave rise to
10 test cases, of which
0 were skipped
0 had missing libraries
10 expected passes
0 expected failures
0 caused framework failures
0 caused framework warnings
0 unexpected passes
0 unexpected failures
0 unexpected stat failures
==== STAGE 2 TESTS ====
Unexpected results from:
TEST="EtaExpandLevPoly T14936 T15349 T2783 T4334 T7919 haddock.Cabal haddock.base haddock.compiler hpc_fork plugin-recomp-change plugin-recomp-change-prof recomp007 space_leak_001"
SUMMARY for test run started at Wed Oct 10 19:31:20 2018 BST
0:58:10 spent to go through
6596 total tests, which gave rise to
29689 test cases, of which
5881 were skipped
256 had missing libraries
23273 expected passes
257 expected failures
0 caused framework failures
0 caused framework warnings
3 unexpected passes
6 unexpected failures
13 unexpected stat failures
Unexpected passes:
/tmp/ghctest-kyex1v3_/test spaces/rts/T2783.run T2783 [unexpected] (threaded1)
/tmp/ghctest-kyex1v3_/test spaces/typecheck/should_run/EtaExpandLevPoly.run EtaExpandLevPoly [unexpected] (profasm)
/tmp/ghctest-kyex1v3_/test spaces/typecheck/should_run/EtaExpandLevPoly.run EtaExpandLevPoly [unexpected] (profthreaded)
Unexpected failures:
/tmp/ghctest-kyex1v3_/test spaces/driver/recomp007/recomp007.run recomp007 [bad stderr] (normal)
/tmp/ghctest-kyex1v3_/test spaces/plugins/plugin-recomp-change.run plugin-recomp-change [bad stderr] (normal)
/tmp/ghctest-kyex1v3_/test spaces/plugins/plugin-recomp-change-prof.run plugin-recomp-change-prof [bad stderr] (normal)
/tmp/ghctest-kyex1v3_/test spaces/rts/T7919.run T7919 [bad exit code] (ghci)
/tmp/ghctest-kyex1v3_/test spaces/libraries/hpc/tests/fork/hpc_fork.run hpc_fork [bad heap profile] (profasm)
/tmp/ghctest-kyex1v3_/test spaces/libraries/base/tests/T15349.run T15349 [bad exit code] (ghci)
Unexpected stat failures:
/tmp/ghctest-kyex1v3_/test spaces/perf/haddock/haddock.base.run haddock.base [stat not good enough] (normal)
/tmp/ghctest-kyex1v3_/test spaces/perf/haddock/haddock.Cabal.run haddock.Cabal [stat not good enough] (normal)
/tmp/ghctest-kyex1v3_/test spaces/perf/haddock/haddock.compiler.run haddock.compiler [stat not good enough] (normal)
/tmp/ghctest-kyex1v3_/test spaces/perf/should_run/T14936.run T14936 [stat not good enough] (hpc)
/tmp/ghctest-kyex1v3_/test spaces/perf/should_run/T14936.run T14936 [stat not good enough] (profasm)
/tmp/ghctest-kyex1v3_/test spaces/perf/space_leaks/space_leak_001.run space_leak_001 [stat too good] (hpc)
/tmp/ghctest-kyex1v3_/test spaces/perf/space_leaks/space_leak_001.run space_leak_001 [stat too good] (optasm)
/tmp/ghctest-kyex1v3_/test spaces/perf/space_leaks/T4334.run T4334 [stat not good enough] (threaded2)
/tmp/ghctest-kyex1v3_/test spaces/perf/space_leaks/space_leak_001.run space_leak_001 [stat too good] (dyn)
/tmp/ghctest-kyex1v3_/test spaces/perf/space_leaks/space_leak_001.run space_leak_001 [stat too good] (optllvm)
/tmp/ghctest-kyex1v3_/test spaces/perf/should_run/T14936.run T14936 [stat not good enough] (threaded1)
/tmp/ghctest-kyex1v3_/test spaces/perf/should_run/T14936.run T14936 [stat not good enough] (threaded2)
/tmp/ghctest-kyex1v3_/test spaces/perf/should_run/T14936.run T14936 [stat not good enough] (profthreaded)
== Start post-testsuite package check
GHC package manager version 8.7.20181010
Timestamp 2018-10-10 18:31:15.21573855 UTC for /home/jrp/Projects/ghc/bindisttest/install dir/lib/ghc-8.7.20181010/package.conf.d/package.cache
using cache: /home/jrp/Projects/ghc/bindisttest/install dir/lib/ghc-8.7.20181010/package.conf.d/package.cache
db stack: ["/home/jrp/.ghc/x86_64-linux-8.7.20181010/package.conf.d","/home/jrp/Projects/ghc/bindisttest/install dir/lib/ghc-8.7.20181010/package.conf.d"]
flag db stack: ["/home/jrp/.ghc/x86_64-linux-8.7.20181010/package.conf.d","/home/jrp/Projects/ghc/bindisttest/install dir/lib/ghc-8.7.20181010/package.conf.d"]
== End post-testsuite package check
-------------------------------------------------------------------
Oops! Looks like you have some unexpected test results or framework failures.
Please fix them before pushing/sending patches.
-------------------------------------------------------------------
```https://gitlab.haskell.org/ghc/ghc/-/issues/15738-ddump-splices omits required parentheses around quantified constraints2019-07-07T18:03:11ZRyan Scott-ddump-splices omits required parentheses around quantified constraintsIf you compile this program with `-ddump-splices`:
```hs
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -ddump-splices #-}
module Bug where
import Language.Haskell.TH
data Foo x = MkFoo x
$([d...If you compile this program with `-ddump-splices`:
```hs
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -ddump-splices #-}
module Bug where
import Language.Haskell.TH
data Foo x = MkFoo x
$([d| f :: (forall a. Eq (Foo a)) => Foo x -> Foo x -> Bool
f = (==)
|])
```
You'll notice something fishy:
```
$ /opt/ghc/8.6.1/bin/ghci Bug.hs
GHCi, version 8.6.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:(10,3)-(12,6): Splicing declarations
[d| f_a1Ia ::
(forall a_a1Ic. Eq (Foo a_a1Ic)) =>
Foo x_a1Ib -> Foo x_a1Ib -> Bool
f_a1Ia = (==) |]
======>
f_a5tj ::
forall a_a5tk. Eq (Foo a_a5tk) => Foo x_a5ti -> Foo x_a5ti -> Bool
f_a5tj = (==)
Ok, one module loaded.
```
The signature for `f` gets pretty-printed as:
```hs
f_a5tj :: forall a_a5tk. Eq (Foo a_a5tk) => Foo x_a5ti -> Foo x_a5ti -> Bool
```
Which is just plain wrong—there is a missing set of parentheses around the quantified constraint `forall a_a5tk. Eq (Foo a_a5tk)`.
Patch incoming.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 8.6.1 |
| 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":"-ddump-splices omits required parentheses around quantified constraints","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"If you compile this program with `-ddump-splices`:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE QuantifiedConstraints #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# OPTIONS_GHC -ddump-splices #-}\r\nmodule Bug where\r\n\r\nimport Language.Haskell.TH\r\n\r\ndata Foo x = MkFoo x\r\n\r\n$([d| f :: (forall a. Eq (Foo a)) => Foo x -> Foo x -> Bool\r\n f = (==)\r\n |])\r\n}}}\r\n\r\nYou'll notice something fishy:\r\n\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghci Bug.hs\r\nGHCi, version 8.6.1: 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\nBug.hs:(10,3)-(12,6): Splicing declarations\r\n [d| f_a1Ia ::\r\n (forall a_a1Ic. Eq (Foo a_a1Ic)) =>\r\n Foo x_a1Ib -> Foo x_a1Ib -> Bool\r\n f_a1Ia = (==) |]\r\n ======>\r\n f_a5tj ::\r\n forall a_a5tk. Eq (Foo a_a5tk) => Foo x_a5ti -> Foo x_a5ti -> Bool\r\n f_a5tj = (==)\r\nOk, one module loaded.\r\n}}}\r\n\r\nThe signature for `f` gets pretty-printed as:\r\n\r\n{{{#!hs\r\nf_a5tj :: forall a_a5tk. Eq (Foo a_a5tk) => Foo x_a5ti -> Foo x_a5ti -> Bool\r\n}}}\r\n\r\nWhich is just plain wrong—there is a missing set of parentheses around the quantified constraint `forall a_a5tk. Eq (Foo a_a5tk)`.\r\n\r\nPatch incoming.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15740Type family with higher-rank result is too accepting2019-07-07T18:03:10ZRichard Eisenbergrae@richarde.devType family with higher-rank result is too acceptingGHC accepts this garbage:
```
type family F2 :: forall k. k -> Type
data SBool :: Bool -> Type
data Nat
data SNat :: Nat -> Type
type instance F2 = SBool
type instance F2 = SNat
```
The family `F2` should have an arity of 0, meaning th...GHC accepts this garbage:
```
type family F2 :: forall k. k -> Type
data SBool :: Bool -> Type
data Nat
data SNat :: Nat -> Type
type instance F2 = SBool
type instance F2 = SNat
```
The family `F2` should have an arity of 0, meaning that only one instance is possible -- and the RHS of that instance must have kind `forall k. k -> Type`. In other words, even accepting only one of the instances above is hogwash.
This is from [ticket:11719\#comment:161416](https://gitlab.haskell.org//ghc/ghc/issues/11719#note_161416), but you don't have to read that to understand this.
<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":"Type family with higher-rank result is too accepting","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["TypeFamilies,","TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"GHC accepts this garbage:\r\n\r\n{{{\r\ntype family F2 :: forall k. k -> Type\r\ndata SBool :: Bool -> Type\r\ndata Nat\r\ndata SNat :: Nat -> Type\r\ntype instance F2 = SBool\r\ntype instance F2 = SNat\r\n}}}\r\n\r\nThe family `F2` should have an arity of 0, meaning that only one instance is possible -- and the RHS of that instance must have kind `forall k. k -> Type`. In other words, even accepting only one of the instances above is hogwash.\r\n\r\nThis is from comment:15:ticket:11719, but you don't have to read that to understand this.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15742GHC configure step can fail when CC=clang2020-01-07T18:46:10ZjudahGHC configure step can fail when CC=clangIn our internal build of GHC from source, we are building it on Linux with Clang. Unfortunately, this results in an error on ghc-8.4.3:
```
$ ./configure CC=clang CC_STAGE0=clang --prefix=... --with-ghc=...
...
checking version of gcc.....In our internal build of GHC from source, we are building it on Linux with Clang. Unfortunately, this results in an error on ghc-8.4.3:
```
$ ./configure CC=clang CC_STAGE0=clang --prefix=... --with-ghc=...
...
checking version of gcc... configure: error: Need at least gcc version 4.4 (4.7+ recommended)
```
Looking in the code, it seems that the logic is wrong: it calls `$CC -v` and parses the output unconditionally, whether or not the compiler is actually GCC:
https://github.com/ghc/ghc/blob/ce7a1c4ae4c93f2d0d3d7a0b573ddd876fc855c2/aclocal.m4\#L1245
In our case, the test fails since the compiler is a build of Clang that doesn't produce a useful version number.
I also realized that on macOS (where gcc \*is\* clang), this test succeeds accidentally, since the output of `gcc -v` is:
```
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
judahjacobson-macbookpro:~ judahjacobson$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Build System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC configure step can fail when CC=clang","status":"New","operating_system":"","component":"Build System","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"In our internal build of GHC from source, we are building it on Linux with Clang. Unfortunately, this results in an error on ghc-8.4.3:\r\n{{{\r\n$ ./configure CC=clang CC_STAGE0=clang --prefix=... --with-ghc=...\r\n...\r\nchecking version of gcc... configure: error: Need at least gcc version 4.4 (4.7+ recommended)\r\n}}}\r\nLooking in the code, it seems that the logic is wrong: it calls `$CC -v` and parses the output unconditionally, whether or not the compiler is actually GCC:\r\nhttps://github.com/ghc/ghc/blob/ce7a1c4ae4c93f2d0d3d7a0b573ddd876fc855c2/aclocal.m4#L1245\r\nIn our case, the test fails since the compiler is a build of Clang that doesn't produce a useful version number.\r\n\r\nI also realized that on macOS (where gcc *is* clang), this test succeeds accidentally, since the output of {{{gcc -v}}} is:\r\n{{{\r\nConfigured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1\r\nApple LLVM version 10.0.0 (clang-1000.10.44.2)\r\nTarget: x86_64-apple-darwin17.7.0\r\nThread model: posix\r\nInstalledDir: /Library/Developer/CommandLineTools/usr/bin\r\njudahjacobson-macbookpro:~ judahjacobson$ gcc -v\r\nConfigured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1\r\nApple LLVM version 10.0.0 (clang-1000.10.44.2)\r\nTarget: x86_64-apple-darwin17.7.0\r\nThread model: posix\r\nInstalledDir: /Library/Developer/CommandLineTools/usr/bin\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.2https://gitlab.haskell.org/ghc/ghc/-/issues/15743Nail down the Required/Inferred/Specified story2019-07-07T18:03:10ZSimon Peyton JonesNail down the Required/Inferred/Specified storyIn a class/data/type declaration we need to say precisely which
type variables are Inferred/Specified/Required and, for the specified
ones, which order they occur in.
See `Note [VarBndrs, TyCoVarBinders, TyConBinders, and visibility]`
i...In a class/data/type declaration we need to say precisely which
type variables are Inferred/Specified/Required and, for the specified
ones, which order they occur in.
See `Note [VarBndrs, TyCoVarBinders, TyConBinders, and visibility]`
in `TyCoRep`. Reminder:
- Required: explicitly-specified arguments to the type constructor, always
appear in any user-written type.
- Specified: variables mentioned lexically in the declaration,
but not positionally. Available for visible kind application.
- Inferred: completely invisible in the declaration; always
implicit and not available for visible kind application.
The rules for top-level (non-associated) declarations. Running
example:
```
data T (b :: (k2 :: k)) c (a :: k)
```
\* Categorisation
\* Required: the positional arguments in the header (`a`, `b`, `c`)
\* Specified: all the variables mentioned in the declaration header,
that are not Required (`k`, `k2`)
> \* Inferred: all the others (the kind of `c`)
\* Order. We need to specify the order in which the Specfied variables
are quantified. Here is the spec:
- Specified variables are always quantified before Required ones.
(We could revisit this.)
- List the specified variables in the textual order in which
they appear \[`k2`, `k`\]
- Sort them into dependency order using *ScopedSort* (see below),
giving \[`k`, `k2`\]
- Finally quantify Inferred, then Specified, then Required. In the
example we get
```
T :: forall {k1}. forall k k2. k2 -> k1 -> k -> Type
```
The *ScopedSort* algorithm works as follows
- Do dependency analysis, so for each variable we know what other
variables it depends on, transitively. By "depends on" we mean
after full kind inference, not just what is written in the
source program.
- Work left-to-right through the list, with a cursor.
- If variable `v` at the cursor is depended on by any earlier
variable `w`, move `v` immediately before the leftmost such `w`.
The invariant is that the variables to the left of the cursor
form a valid telescope.
For associated types, use this running example:
```
class C (a :: k) where
type T a (b :: k2)
```
The rules are elaborated a bit for an associated type like `T`
- Required: the explicit positional arguments (here `a`, `b`)
- Specified: any non-Required variable that is
\* mentioned (lexically) in the class header and transitively depended on by the Required
variables (here `k`), listed left-to-right; followed by
\* any other variables mentioned in the type header (here `k2`), again listed left-right.
- Inferred: all the others, as before.
The Specified variables are sorted exactly as before.
Relevant tickets
- #14887 esp #15743 (order of Inferred type variables)
- #15592
- #15591 #15743ff
(All following discussion with RAE Friday 12 Oct.)
<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":"Nail down the Required/Inferred/Specified story","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"In a class/data/type declaration we need to say precisely which\r\ntype variables are Inferred/Specified/Required and, for the specified\r\nones, which order they occur in.\r\n\r\nSee `Note [VarBndrs, TyCoVarBinders, TyConBinders, and visibility]`\r\nin `TyCoRep`. Reminder:\r\n* Required: explicitly-specified arguments to the type constructor, always\r\n appear in any user-written type.\r\n\r\n* Specified: variables mentioned lexically in the declaration,\r\n but not positionally. Available for visible kind application.\r\n\r\n* Inferred: completely invisible in the declaration; always\r\n implicit and not available for visible kind application.\r\n\r\nThe rules for top-level (non-associated) declarations. Running\r\nexample:\r\n{{{\r\n data T (b :: (k2 :: k)) c (a :: k)\r\n}}}\r\n\r\n* Categorisation\r\n * Required: the positional arguments in the header (`a`, `b`, `c`)\r\n * Specified: all the variables mentioned in the declaration header,\r\n that are not Required (`k`, `k2`)\r\n * Inferred: all the others (the kind of `c`)\r\n\r\n* Order. We need to specify the order in which the Specfied variables\r\n are quantified. Here is the spec:\r\n * Specified variables are always quantified before Required ones.\r\n (We could revisit this.)\r\n * List the specified variables in the textual order in which\r\n they appear [`k2`, `k`]\r\n * Sort them into dependency order using ''ScopedSort'' (see below),\r\n giving [`k`, `k2`]\r\n * Finally quantify Inferred, then Specified, then Required. In the\r\n example we get\r\n{{{\r\nT :: forall {k1}. forall k k2. k2 -> k1 -> k -> Type\r\n}}}\r\n\r\nThe ''ScopedSort'' algorithm works as follows\r\n* Do dependency analysis, so for each variable we know what other\r\n variables it depends on, transitively. By \"depends on\" we mean\r\n after full kind inference, not just what is written in the\r\n source program.\r\n* Work left-to-right through the list, with a cursor.\r\n* If variable `v` at the cursor is depended on by any earlier\r\n variable `w`, move `v` immediately before the leftmost such `w`.\r\nThe invariant is that the variables to the left of the cursor\r\nform a valid telescope.\r\n\r\nFor associated types, use this running example:\r\n{{{\r\n class C (a :: k) where\r\n type T a (b :: k2)\r\n}}}\r\nThe rules are elaborated a bit for an associated type like `T`\r\n* Required: the explicit positional arguments (here `a`, `b`)\r\n* Specified: any non-Required variable that is \r\n * mentioned (lexically) in the class header and transitively depended on by the Required\r\n variables (here `k`), listed left-to-right; followed by \r\n * any other variables mentioned in the type header (here `k2`), again listed left-right.\r\n* Inferred: all the others, as before.\r\n\r\nThe Specified variables are sorted exactly as before.\r\n\r\n\r\nRelevant tickets\r\n* #14887 esp comment:10 (order of Inferred type variables)\r\n* #15592\r\n* #15591 comment:4ff\r\n\r\n(All following discussion with RAE Friday 12 Oct.)\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15747GHC panics when builds for arm as: ghc-stage1: panic! (the 'impossible' happe...2019-07-07T18:03:09ZSergei TrofimovichGHC panics when builds for arm as: ghc-stage1: panic! (the 'impossible' happened): padLiveArgs -- i > regNum ??ghc-HEAD fails build as:
```
$ LANG=C make
===--- building phase 0
make --no-print-directory -f ghc.mk phase=0 phase_0_builds
make[1]: Nothing to be done for 'phase_0_builds'.
===--- building phase 1
make --no-print-directory -f ghc.mk ...ghc-HEAD fails build as:
```
$ LANG=C make
===--- building phase 0
make --no-print-directory -f ghc.mk phase=0 phase_0_builds
make[1]: Nothing to be done for 'phase_0_builds'.
===--- building phase 1
make --no-print-directory -f ghc.mk phase=1 phase_1_builds
make[1]: Nothing to be done for 'phase_1_builds'.
===--- building final phase
make --no-print-directory -f ghc.mk phase=final all
"inplace/bin/ghc-stage1" -static -H32m -O -O0 -Wall -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS -DFS_NAMESPACE=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
You are using an unsupported version of LLVM!
Currently only 6.0 is supported.
We will try though...
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 8.7.20181014 for arm-unknown-linux):
padLiveArgs -- i > regNum ??(2,1)
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:318: rts/dist/build/HeapStackCheck.o] Error 1
make: *** [Makefile:127: all] Error 2
```
The suspect is: https://phabricator.haskell.org/D5190
GHC is built for **armv7a-unknown-linux-gnueabihf** target.
```
inplace/bin/ghc-stage1 --info
[("Project name","The Glorious Glasgow Haskell Compilation System")
,("GCC extra via C opts"," -fwrapv -fno-builtin")
,("C compiler command","armv7a-unknown-linux-gnueabihf-gcc")
,("C compiler flags"," -marm -fno-stack-protector")
,("C compiler link flags"," -Wl,-z,noexecstack")
,("C compiler supports -no-pie","YES")
,("Haskell CPP command","armv7a-unknown-linux-gnueabihf-gcc")
,("Haskell CPP flags","-E -undef -traditional")
,("ld command","armv7a-unknown-linux-gnueabihf-ld.gold")
,("ld flags"," -z noexecstack")
,("ld supports compact unwind","YES")
,("ld supports build-id","YES")
,("ld supports filelist","NO")
,("ld is GNU ld","YES")
,("ar command","armv7a-unknown-linux-gnueabihf-ar")
,("ar flags","q")
,("ar supports at file","YES")
,("ranlib command","armv7a-unknown-linux-gnueabihf-ranlib")
,("touch command","touch")
,("dllwrap command","armv7a-unknown-linux-gnueabihf-dllwrap")
,("windres command","armv7a-unknown-linux-gnueabihf-windres")
,("libtool command","libtool")
,("perl command","/usr/bin/perl")
,("cross compiling","YES")
,("target os","OSLinux")
,("target arch","ArchARM {armISA = ARMv7, armISAExt = [VFPv3,NEON], armABI = HARD}")
,("target word size","4")
,("target has GNU nonexec stack","True")
,("target has .ident directive","True")
,("target has subsections via symbols","False")
,("target has RTS linker","YES")
,("Unregisterised","NO")
,("LLVM llc command","llc")
,("LLVM opt command","opt")
,("LLVM clang command","clang")
,("Project version","8.7.20181014")
,("Project Git commit id","4a79ae580698ec635a6edd2b56958af2682511dd")
,("Booter version","8.4.2")
,("Stage","1")
,("Build platform","x86_64-unknown-linux")
,("Host platform","x86_64-unknown-linux")
,("Target platform","arm-unknown-linux")
,("Have interpreter","YES")
,("Object splitting supported","NO")
,("Have native code generator","NO")
,("Support SMP","YES")
,("Tables next to code","YES")
,("RTS ways","l debug thr thr_debug thr_l dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn ")
,("RTS expects libdw","NO")
,("Support dynamic-too","YES")
,("Support parallel --make","YES")
,("Support reexported-modules","YES")
,("Support thinning and renaming package flags","YES")
,("Support Backpack","YES")
,("Requires unified installed package IDs","YES")
,("Uses package keys","YES")
,("Uses unit IDs","YES")
,("Dynamic by default","NO")
,("GHC Dynamic","NO")
,("GHC Profiled","NO")
,("Leading underscore","NO")
,("Debug on","False")
,("LibDir","/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/ghc-9999/work/ghc-9999/inplace/lib")
,("Global Package DB","/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/ghc-9999/work/ghc-9999/inplace/lib/package.conf.d")
]
```
<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 | bgamari, kavon |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC panics when builds for arm as: ghc-stage1: panic! (the 'impossible' happened): padLiveArgs -- i > regNum ??","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["bgamari","kavon"],"type":"Bug","description":"ghc-HEAD fails build as:\r\n{{{\r\n$ LANG=C make\r\n===--- building phase 0\r\nmake --no-print-directory -f ghc.mk phase=0 phase_0_builds\r\nmake[1]: Nothing to be done for 'phase_0_builds'.\r\n===--- building phase 1\r\nmake --no-print-directory -f ghc.mk phase=1 phase_1_builds\r\nmake[1]: Nothing to be done for 'phase_1_builds'.\r\n===--- building final phase\r\nmake --no-print-directory -f ghc.mk phase=final all\r\n\"inplace/bin/ghc-stage1\" -static -H32m -O -O0 -Wall -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS -DFS_NAMESPACE=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\nYou are using an unsupported version of LLVM!\r\nCurrently only 6.0 is supported.\r\nWe will try though...\r\nghc-stage1: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181014 for arm-unknown-linux):\r\n padLiveArgs -- i > regNum ??(2,1)\r\nCallStack (from HasCallStack):\r\n error, called at compiler/llvmGen/LlvmCodeGen/Base.hs:194:27 in ghc:LlvmCodeGen.Base\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\nmake[1]: *** [rts/ghc.mk:318: rts/dist/build/HeapStackCheck.o] Error 1\r\nmake: *** [Makefile:127: all] Error 2\r\n}}}\r\n\r\nThe suspect is: https://phabricator.haskell.org/D5190\r\n\r\nGHC is built for '''armv7a-unknown-linux-gnueabihf''' target.\r\n\r\n{{{\r\ninplace/bin/ghc-stage1 --info\r\n [(\"Project name\",\"The Glorious Glasgow Haskell Compilation System\")\r\n ,(\"GCC extra via C opts\",\" -fwrapv -fno-builtin\")\r\n ,(\"C compiler command\",\"armv7a-unknown-linux-gnueabihf-gcc\")\r\n ,(\"C compiler flags\",\" -marm -fno-stack-protector\")\r\n ,(\"C compiler link flags\",\" -Wl,-z,noexecstack\")\r\n ,(\"C compiler supports -no-pie\",\"YES\")\r\n ,(\"Haskell CPP command\",\"armv7a-unknown-linux-gnueabihf-gcc\")\r\n ,(\"Haskell CPP flags\",\"-E -undef -traditional\")\r\n ,(\"ld command\",\"armv7a-unknown-linux-gnueabihf-ld.gold\")\r\n ,(\"ld flags\",\" -z noexecstack\")\r\n ,(\"ld supports compact unwind\",\"YES\")\r\n ,(\"ld supports build-id\",\"YES\")\r\n ,(\"ld supports filelist\",\"NO\")\r\n ,(\"ld is GNU ld\",\"YES\")\r\n ,(\"ar command\",\"armv7a-unknown-linux-gnueabihf-ar\")\r\n ,(\"ar flags\",\"q\")\r\n ,(\"ar supports at file\",\"YES\")\r\n ,(\"ranlib command\",\"armv7a-unknown-linux-gnueabihf-ranlib\")\r\n ,(\"touch command\",\"touch\")\r\n ,(\"dllwrap command\",\"armv7a-unknown-linux-gnueabihf-dllwrap\")\r\n ,(\"windres command\",\"armv7a-unknown-linux-gnueabihf-windres\")\r\n ,(\"libtool command\",\"libtool\")\r\n ,(\"perl command\",\"/usr/bin/perl\")\r\n ,(\"cross compiling\",\"YES\")\r\n ,(\"target os\",\"OSLinux\")\r\n ,(\"target arch\",\"ArchARM {armISA = ARMv7, armISAExt = [VFPv3,NEON], armABI = HARD}\")\r\n ,(\"target word size\",\"4\")\r\n ,(\"target has GNU nonexec stack\",\"True\")\r\n ,(\"target has .ident directive\",\"True\")\r\n ,(\"target has subsections via symbols\",\"False\")\r\n ,(\"target has RTS linker\",\"YES\")\r\n ,(\"Unregisterised\",\"NO\")\r\n ,(\"LLVM llc command\",\"llc\")\r\n ,(\"LLVM opt command\",\"opt\")\r\n ,(\"LLVM clang command\",\"clang\")\r\n ,(\"Project version\",\"8.7.20181014\")\r\n ,(\"Project Git commit id\",\"4a79ae580698ec635a6edd2b56958af2682511dd\")\r\n ,(\"Booter version\",\"8.4.2\")\r\n ,(\"Stage\",\"1\")\r\n ,(\"Build platform\",\"x86_64-unknown-linux\")\r\n ,(\"Host platform\",\"x86_64-unknown-linux\")\r\n ,(\"Target platform\",\"arm-unknown-linux\")\r\n ,(\"Have interpreter\",\"YES\")\r\n ,(\"Object splitting supported\",\"NO\")\r\n ,(\"Have native code generator\",\"NO\")\r\n ,(\"Support SMP\",\"YES\")\r\n ,(\"Tables next to code\",\"YES\")\r\n ,(\"RTS ways\",\"l debug thr thr_debug thr_l dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn \")\r\n ,(\"RTS expects libdw\",\"NO\")\r\n ,(\"Support dynamic-too\",\"YES\")\r\n ,(\"Support parallel --make\",\"YES\")\r\n ,(\"Support reexported-modules\",\"YES\")\r\n ,(\"Support thinning and renaming package flags\",\"YES\")\r\n ,(\"Support Backpack\",\"YES\")\r\n ,(\"Requires unified installed package IDs\",\"YES\")\r\n ,(\"Uses package keys\",\"YES\")\r\n ,(\"Uses unit IDs\",\"YES\")\r\n ,(\"Dynamic by default\",\"NO\")\r\n ,(\"GHC Dynamic\",\"NO\")\r\n ,(\"GHC Profiled\",\"NO\")\r\n ,(\"Leading underscore\",\"NO\")\r\n ,(\"Debug on\",\"False\")\r\n ,(\"LibDir\",\"/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/ghc-9999/work/ghc-9999/inplace/lib\")\r\n ,(\"Global Package DB\",\"/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/ghc-9999/work/ghc-9999/inplace/lib/package.conf.d\")\r\n ]\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://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/15753Inconsistent pattern-match warnings when using guards versus case expressions2019-09-18T14:14:54ZRyan ScottInconsistent pattern-match warnings when using guards versus case expressionsConsider the following code (apologies for the rather non-minimal example):
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTyp...Consider the following code (apologies for the rather non-minimal example):
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wall -Wno-unticked-promoted-constructors #-}
module Bug where
import Data.Kind
import Data.Type.Bool
import Data.Type.Equality ((:~:)(..))
import Data.Void
data family Sing :: forall k. k -> Type
data instance Sing :: Bool -> Type where
SFalse :: Sing False
STrue :: Sing True
data instance Sing :: forall a. [a] -> Type where
SNil :: Sing '[]
SCons :: Sing x -> Sing xs -> Sing (x:xs)
data instance Sing :: forall a b. (a, b) -> Type where
STuple2 :: Sing x -> Sing y -> Sing '(x, y)
newtype instance Sing (f :: k1 ~> k2) =
SLambda { (@@) :: forall t. Sing t -> Sing (f @@ t) }
data TyFun :: Type -> Type -> Type
type a ~> b = TyFun a b -> Type
infixr 0 ~>
type family (f :: k1 ~> k2) @@ (x :: k1) :: k2
infixl 9 @@
newtype Map k v = MkMap [(k, v)]
data instance Sing :: forall k v. Map k v -> Type where
SMkMap :: Sing x -> Sing (MkMap x)
type family MapEmpty :: Map k v where
MapEmpty = MkMap '[]
type family MapInsertWith (f :: v ~> v ~> v) (new_k :: k) (new_v :: v) (m :: Map k v) :: Map k v where
MapInsertWith _ new_k new_v (MkMap '[]) = MkMap '[ '(new_k, new_v)]
MapInsertWith f new_k new_v (MkMap ('(old_k,old_v):old_kvs)) =
If (old_k == new_k)
(MkMap ('(new_k,f @@ new_v @@ old_v):old_kvs))
(Case (MapInsertWith f new_k new_v (MkMap old_kvs)) old_k old_v)
type family Case (m :: Map k v) (old_k :: k) (old_v :: v) :: Map k v where
Case (MkMap kvs) old_k old_v = MkMap ('(old_k,old_v) : kvs)
sMapInsertWith :: forall k v (f :: v ~> v ~> v) (new_k :: k) (new_v :: v) (m :: Map k v).
SEq k
=> Sing f -> Sing new_k -> Sing new_v -> Sing m
-> Sing (MapInsertWith f new_k new_v m)
sMapInsertWith _ snew_k snew_v (SMkMap SNil) = SMkMap (STuple2 snew_k snew_v `SCons` SNil)
sMapInsertWith sf snew_k snew_v (SMkMap (STuple2 sold_k sold_v `SCons` sold_kvs)) =
case sold_k %== snew_k of
STrue -> SMkMap (STuple2 snew_k (sf @@ snew_v @@ sold_v) `SCons` sold_kvs)
SFalse ->
case sMapInsertWith sf snew_k snew_v (SMkMap sold_kvs) of
SMkMap skvs -> SMkMap (STuple2 sold_k sold_v `SCons` skvs)
class PEq a where
type (x :: a) == (y :: a) :: Bool
class SEq a where
(%==) :: forall (x :: a) (y :: a).
Sing x -> Sing y -> Sing (x == y)
mapInsertWithNonEmpty1 :: forall k v (f :: v ~> v ~> v) (old_k :: k) (old_v :: v) (old_kvs :: [(k,v)])
(new_k :: k) (new_v :: v) (m :: Map k v).
SEq k
=> Sing f -> Sing new_k -> Sing new_v -> Sing m
-> m :~: MkMap ('(old_k,old_v) : old_kvs)
-> MapInsertWith f new_k new_v m :~: MapEmpty
-> Void
mapInsertWithNonEmpty1 sf snew_k snew_v (SMkMap sm) Refl Refl
| STuple2 sold_k _ `SCons` sold_kvs <- sm
, SFalse <- sold_k %== snew_k
= case sMapInsertWith sf snew_k snew_v (SMkMap sold_kvs) of {}
mapInsertWithNonEmpty2 :: forall k v (f :: v ~> v ~> v) (old_k :: k) (old_v :: v) (old_kvs :: [(k,v)])
(new_k :: k) (new_v :: v) (m :: Map k v).
SEq k
=> Sing f -> Sing new_k -> Sing new_v -> Sing m
-> m :~: MkMap ('(old_k,old_v) : old_kvs)
-> MapInsertWith f new_k new_v m :~: MapEmpty
-> Void
mapInsertWithNonEmpty2 sf snew_k snew_v (SMkMap sm) Refl Refl
| STuple2 sold_k _ `SCons` sold_kvs <- sm
= case sold_k %== snew_k of
SFalse ->
case sMapInsertWith sf snew_k snew_v (SMkMap sold_kvs) of {}
```
If you compile this with GHC 8.6.1 or later, you'll notice something interesting happening with the pattern-match coverage checker warnings:
```
$ /opt/ghc/8.6.1/bin/ghci Bug.hs
GHCi, version 8.6.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:78:1: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In an equation for ‘mapInsertWithNonEmpty1’:
Patterns not matched: _ _ _ (SMkMap _) Refl Refl
|
78 | mapInsertWithNonEmpty1 sf snew_k snew_v (SMkMap sm) Refl Refl
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
Ok, one module loaded.
```
`mapInsertWithNonEmpty1` is deemed non-exhaustive, but `mapInsertWithNonEmpty2` is deemed exhaustive. However, the code for the two functions are functionally identical—the only difference is that `mapInsertWithNonEmpty1` uses one more pattern guard than `mapInsertWithNonEmpty2` does.
<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":"Inconsistent pattern-match warnings when using guards versus case expressions","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["PatternMatchWarnings"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider the following code (apologies for the rather non-minimal example):\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE EmptyCase #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n{-# LANGUAGE UndecidableInstances #-}\r\n{-# OPTIONS_GHC -Wall -Wno-unticked-promoted-constructors #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Data.Type.Bool\r\nimport Data.Type.Equality ((:~:)(..))\r\nimport Data.Void\r\n\r\ndata family Sing :: forall k. k -> Type\r\ndata instance Sing :: Bool -> Type where\r\n SFalse :: Sing False\r\n STrue :: Sing True\r\ndata instance Sing :: forall a. [a] -> Type where\r\n SNil :: Sing '[]\r\n SCons :: Sing x -> Sing xs -> Sing (x:xs)\r\ndata instance Sing :: forall a b. (a, b) -> Type where\r\n STuple2 :: Sing x -> Sing y -> Sing '(x, y)\r\nnewtype instance Sing (f :: k1 ~> k2) =\r\n SLambda { (@@) :: forall t. Sing t -> Sing (f @@ t) }\r\n\r\ndata TyFun :: Type -> Type -> Type\r\ntype a ~> b = TyFun a b -> Type\r\ninfixr 0 ~>\r\ntype family (f :: k1 ~> k2) @@ (x :: k1) :: k2\r\ninfixl 9 @@\r\n\r\nnewtype Map k v = MkMap [(k, v)]\r\ndata instance Sing :: forall k v. Map k v -> Type where\r\n SMkMap :: Sing x -> Sing (MkMap x)\r\n\r\ntype family MapEmpty :: Map k v where\r\n MapEmpty = MkMap '[]\r\n\r\ntype family MapInsertWith (f :: v ~> v ~> v) (new_k :: k) (new_v :: v) (m :: Map k v) :: Map k v where\r\n MapInsertWith _ new_k new_v (MkMap '[]) = MkMap '[ '(new_k, new_v)]\r\n MapInsertWith f new_k new_v (MkMap ('(old_k,old_v):old_kvs)) =\r\n If (old_k == new_k)\r\n (MkMap ('(new_k,f @@ new_v @@ old_v):old_kvs))\r\n (Case (MapInsertWith f new_k new_v (MkMap old_kvs)) old_k old_v)\r\n\r\ntype family Case (m :: Map k v) (old_k :: k) (old_v :: v) :: Map k v where\r\n Case (MkMap kvs) old_k old_v = MkMap ('(old_k,old_v) : kvs)\r\n\r\nsMapInsertWith :: forall k v (f :: v ~> v ~> v) (new_k :: k) (new_v :: v) (m :: Map k v).\r\n SEq k\r\n => Sing f -> Sing new_k -> Sing new_v -> Sing m\r\n -> Sing (MapInsertWith f new_k new_v m)\r\nsMapInsertWith _ snew_k snew_v (SMkMap SNil) = SMkMap (STuple2 snew_k snew_v `SCons` SNil)\r\nsMapInsertWith sf snew_k snew_v (SMkMap (STuple2 sold_k sold_v `SCons` sold_kvs)) =\r\n case sold_k %== snew_k of\r\n STrue -> SMkMap (STuple2 snew_k (sf @@ snew_v @@ sold_v) `SCons` sold_kvs)\r\n SFalse ->\r\n case sMapInsertWith sf snew_k snew_v (SMkMap sold_kvs) of\r\n SMkMap skvs -> SMkMap (STuple2 sold_k sold_v `SCons` skvs)\r\n\r\nclass PEq a where\r\n type (x :: a) == (y :: a) :: Bool\r\nclass SEq a where\r\n (%==) :: forall (x :: a) (y :: a).\r\n Sing x -> Sing y -> Sing (x == y)\r\n\r\nmapInsertWithNonEmpty1 :: forall k v (f :: v ~> v ~> v) (old_k :: k) (old_v :: v) (old_kvs :: [(k,v)])\r\n (new_k :: k) (new_v :: v) (m :: Map k v).\r\n SEq k\r\n => Sing f -> Sing new_k -> Sing new_v -> Sing m\r\n -> m :~: MkMap ('(old_k,old_v) : old_kvs)\r\n -> MapInsertWith f new_k new_v m :~: MapEmpty\r\n -> Void\r\nmapInsertWithNonEmpty1 sf snew_k snew_v (SMkMap sm) Refl Refl\r\n | STuple2 sold_k _ `SCons` sold_kvs <- sm\r\n , SFalse <- sold_k %== snew_k\r\n = case sMapInsertWith sf snew_k snew_v (SMkMap sold_kvs) of {}\r\n\r\nmapInsertWithNonEmpty2 :: forall k v (f :: v ~> v ~> v) (old_k :: k) (old_v :: v) (old_kvs :: [(k,v)])\r\n (new_k :: k) (new_v :: v) (m :: Map k v).\r\n SEq k\r\n => Sing f -> Sing new_k -> Sing new_v -> Sing m\r\n -> m :~: MkMap ('(old_k,old_v) : old_kvs)\r\n -> MapInsertWith f new_k new_v m :~: MapEmpty\r\n -> Void\r\nmapInsertWithNonEmpty2 sf snew_k snew_v (SMkMap sm) Refl Refl\r\n | STuple2 sold_k _ `SCons` sold_kvs <- sm\r\n = case sold_k %== snew_k of\r\n SFalse ->\r\n case sMapInsertWith sf snew_k snew_v (SMkMap sold_kvs) of {}\r\n}}}\r\n\r\nIf you compile this with GHC 8.6.1 or later, you'll notice something interesting happening with the pattern-match coverage checker warnings:\r\n\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghci Bug.hs\r\nGHCi, version 8.6.1: 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:78:1: warning: [-Wincomplete-patterns]\r\n Pattern match(es) are non-exhaustive\r\n In an equation for ‘mapInsertWithNonEmpty1’:\r\n Patterns not matched: _ _ _ (SMkMap _) Refl Refl\r\n |\r\n78 | mapInsertWithNonEmpty1 sf snew_k snew_v (SMkMap sm) Refl Refl\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...\r\nOk, one module loaded.\r\n}}}\r\n\r\n`mapInsertWithNonEmpty1` is deemed non-exhaustive, but `mapInsertWithNonEmpty2` is deemed exhaustive. However, the code for the two functions are functionally identical—the only difference is that `mapInsertWithNonEmpty1` uses one more pattern guard than `mapInsertWithNonEmpty2` does.","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1Sebastian GrafSebastian Grafhttps://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/15768Using oneshot kqueue() on macOS2022-02-11T15:58:15Zkazu-yamamotoUsing oneshot kqueue() on macOSOneshot kqueue() is disabled on macOS due to #7651
Recall that the paper "Mio: A High-Performance Multicore IO Manager for GHC" says:
"Mio also uses
kqueue
on OS X, since Darwin, the foundation
for Apple’s OS X, is a variant of BSD. Ho...Oneshot kqueue() is disabled on macOS due to #7651
Recall that the paper "Mio: A High-Performance Multicore IO Manager for GHC" says:
"Mio also uses
kqueue
on OS X, since Darwin, the foundation
for Apple’s OS X, is a variant of BSD. However, we encountered
problems running parallel builds of the GHC compiler using Mio
as described above. We have been unable to uncover the underlying
source of the problem to our satisfaction. However, several Internet
discussions suggest that the implementation of
kqueue
and
pipe
on OS X are unstable. We were able to resolve the observed prob-
lems on OS X by avoiding the use of one-shot mode on OS X,
instead unregistering events after they are delivered, and by send-
ing wakeup writes to a pipe monitored by the dispatcher threads’
kqueue instances on every event registration. With these changes,
the behavior on OS X, including parallel builds of GHC, has been
stable."
Now the serious bug on KQueue has been fixed:
- #13903
- https://phabricator.haskell.org/D3692
So, I guess it's time to use oneshot on macOS. A patch is attached.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Core Libraries |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Using oneshot kqueue() on macOS","status":"New","operating_system":"","component":"Core Libraries","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["KQueue,","build","oneshot,","parallel"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Oneshot kqueue() is disabled on macOS due to https://ghc.haskell.org/trac/ghc/ticket/7651\r\n\r\nRecall that the paper \"Mio: A High-Performance Multicore IO Manager for GHC\" says: \r\n\r\n\"Mio also uses\r\nkqueue\r\non OS X, since Darwin, the foundation\r\nfor Apple’s OS X, is a variant of BSD. However, we encountered\r\nproblems running parallel builds of the GHC compiler using Mio\r\nas described above. We have been unable to uncover the underlying\r\nsource of the problem to our satisfaction. However, several Internet\r\ndiscussions suggest that the implementation of\r\nkqueue\r\nand\r\npipe\r\non OS X are unstable. We were able to resolve the observed prob-\r\nlems on OS X by avoiding the use of one-shot mode on OS X,\r\ninstead unregistering events after they are delivered, and by send-\r\ning wakeup writes to a pipe monitored by the dispatcher threads’\r\nkqueue instances on every event registration. With these changes,\r\nthe behavior on OS X, including parallel builds of GHC, has been\r\nstable.\"\r\n\r\nNow the serious bug on KQueue has been fixed:\r\n- https://ghc.haskell.org/trac/ghc/ticket/13903\r\n- https://phabricator.haskell.org/D3692\r\n\r\nSo, I guess it's time to use oneshot on macOS. A patch is attached.","type_of_failure":"OtherFailure","blocking":[]} -->9.0.1https://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/15771Could there be further refactoring to the `seq` typing rule2019-11-23T15:44:57ZArnaud SpiwackCould there be further refactoring to the `seq` typing ruleSeq has a special cased typing rule. It's been greatly simplified in aab3c6d18416b3bc8e1378dfc4d485a9307ca5c7 . But there is still duplication, with a different rule applying when `seq` is used in infix position (unchanged in that commit...Seq has a special cased typing rule. It's been greatly simplified in aab3c6d18416b3bc8e1378dfc4d485a9307ca5c7 . But there is still duplication, with a different rule applying when `seq` is used in infix position (unchanged in that commit), and when used in prefix position.
Could there be a way to reduce code duplication here? I find it really hard to convince myself that both cases do the same thing.
Though, really, given levity polymorphism, does `seq` need a special typing rule at all anymore?
<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":"Could there be further refactoring to the `seq` typing rule","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":"Seq has a special cased typing rule. It's been greatly simplified in aab3c6d18416b3bc8e1378dfc4d485a9307ca5c7 . But there is still duplication, with a different rule applying when `seq` is used in infix position (unchanged in that commit), and when used in prefix position.\r\n\r\nCould there be a way to reduce code duplication here? I find it really hard to convince myself that both cases do the same thing.\r\n\r\nThough, really, given levity polymorphism, does `seq` need a special typing rule at all anymore?","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15772Strange constraint error that disappears when adding another top-level declar...2020-12-26T13:06:22ZAndres LöhStrange constraint error that disappears when adding another top-level declarationConsider this program:
```hs
{-# LANGUAGE DataKinds, TypeFamilies, TypeOperators, UndecidableInstances #-}
module CURepro where
import Data.Kind
data NP (f :: Type -> Type) (xs :: [Type])
type family Curry (f :: Type -> Type) (xs :: ...Consider this program:
```hs
{-# LANGUAGE DataKinds, TypeFamilies, TypeOperators, UndecidableInstances #-}
module CURepro where
import Data.Kind
data NP (f :: Type -> Type) (xs :: [Type])
type family Curry (f :: Type -> Type) (xs :: [Type]) (r :: Type) (a :: Type) :: Constraint where
Curry f xs r (f x -> a) = (xs ~ (x : Tail xs), Curry f (Tail xs) r a)
Curry f xs r a = (xs ~ '[], r ~ a)
type family Tail (a :: [Type]) :: [Type] where
Tail (_ : xs) = xs
uncurry_NP :: (Curry f xs r a) => (NP f xs -> r) -> a
uncurry_NP = undefined
fun_NP :: NP Id xs -> ()
fun_NP = undefined
newtype Id a = MkId a
-- test1 :: ()
-- test1 = uncurry_NP fun_NP (MkId 5)
test2 :: ()
test2 = uncurry_NP fun_NP (MkId True) (MkId 5) (MkId True)
```
With GHC 8.6.1 (and also 8.4.3), this produces the following error message:
```
CURepro.hs:27:9: error:
• Couldn't match type ‘Tail t0’ with ‘Bool : Tail (Tail t0)’
arising from a use of ‘uncurry_NP’
The type variable ‘t0’ is ambiguous
• In the expression:
uncurry_NP fun_NP (MkId True) (MkId 5) (MkId True)
In an equation for ‘test2’:
test2 = uncurry_NP fun_NP (MkId True) (MkId 5) (MkId True)
|
27 | test2 = uncurry_NP fun_NP (MkId True) (MkId 5) (MkId True)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
However, uncommenting the definition of `test1` makes the whole program check without error!
I think both versions of the program should be accepted.
I've tried to extract this from a much larger failing example, but did not manage to make it any smaller than this. In particular, the fact that `NP` is parameterised over a type constructor `f` seems to be somehow essential to trigger this.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.6.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":"Strange constraint error that disappears when adding another top-level declaration","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider this program:\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds, TypeFamilies, TypeOperators, UndecidableInstances #-}\r\nmodule CURepro where\r\n\r\nimport Data.Kind\r\n\r\ndata NP (f :: Type -> Type) (xs :: [Type])\r\n\r\ntype family Curry (f :: Type -> Type) (xs :: [Type]) (r :: Type) (a :: Type) :: Constraint where\r\n Curry f xs r (f x -> a) = (xs ~ (x : Tail xs), Curry f (Tail xs) r a)\r\n Curry f xs r a = (xs ~ '[], r ~ a)\r\n\r\ntype family Tail (a :: [Type]) :: [Type] where\r\n Tail (_ : xs) = xs\r\n\r\nuncurry_NP :: (Curry f xs r a) => (NP f xs -> r) -> a\r\nuncurry_NP = undefined\r\n\r\nfun_NP :: NP Id xs -> ()\r\nfun_NP = undefined\r\n\r\nnewtype Id a = MkId a\r\n\r\n-- test1 :: ()\r\n-- test1 = uncurry_NP fun_NP (MkId 5)\r\n\r\ntest2 :: ()\r\ntest2 = uncurry_NP fun_NP (MkId True) (MkId 5) (MkId True)\r\n}}}\r\n\r\nWith GHC 8.6.1 (and also 8.4.3), this produces the following error message:\r\n{{{\r\nCURepro.hs:27:9: error:\r\n • Couldn't match type ‘Tail t0’ with ‘Bool : Tail (Tail t0)’\r\n arising from a use of ‘uncurry_NP’\r\n The type variable ‘t0’ is ambiguous\r\n • In the expression:\r\n uncurry_NP fun_NP (MkId True) (MkId 5) (MkId True)\r\n In an equation for ‘test2’:\r\n test2 = uncurry_NP fun_NP (MkId True) (MkId 5) (MkId True)\r\n |\r\n27 | test2 = uncurry_NP fun_NP (MkId True) (MkId 5) (MkId True)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n}}}\r\n\r\nHowever, uncommenting the definition of `test1` makes the whole program check without error!\r\n\r\nI think both versions of the program should be accepted.\r\n\r\nI've tried to extract this from a much larger failing example, but did not manage to make it any smaller than this. In particular, the fact that `NP` is parameterised over a type constructor `f` seems to be somehow essential to trigger this.","type_of_failure":"OtherFailure","blocking":[]} -->https://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/15783Quoting an internal variable causes an error when splicing2021-04-07T00:23:38ZMatthew PickeringQuoting an internal variable causes an error when splicing```
{-# LANGUAGE TemplateHaskell #-}
module A where
import B
main = $$f
```
```
{-# LANGUAGE TemplateHaskell #-}
module B(f) where
d = 0
f = [|| d ||]
```
Note that `d` is not exported from `B`.
```
[1 of 2] Compiling B ...```
{-# LANGUAGE TemplateHaskell #-}
module A where
import B
main = $$f
```
```
{-# LANGUAGE TemplateHaskell #-}
module B(f) where
d = 0
f = [|| d ||]
```
Note that `d` is not exported from `B`.
```
[1 of 2] Compiling B ( B.hs, B.o )
[2 of 2] Compiling A ( A.hs, A.o )
A.hs:6:8: error:
• Can't find interface-file declaration for variable B.d
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
• In the expression: B.d
In the result of the splice:
$f
To see what the splice expanded to, use -ddump-splices
In the Template Haskell splice $$f
|
6 | main = $$f
| ^^^
```
This doesn't seem to happen for untyped quotes/splices.
<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":"Quoting an internal variable causes an error when splicing","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{-# LANGUAGE TemplateHaskell #-}\r\nmodule A where\r\n\r\nimport B\r\n\r\nmain = $$f\r\n}}}\r\n\r\n{{{\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule B(f) where\r\n\r\nd = 0\r\n\r\nf = [|| d ||]\r\n}}}\r\n\r\nNote that `d` is not exported from `B`.\r\n\r\n{{{\r\n[1 of 2] Compiling B ( B.hs, B.o )\r\n[2 of 2] Compiling A ( A.hs, A.o )\r\n\r\nA.hs:6:8: error:\r\n • Can't find interface-file declaration for variable B.d\r\n Probable cause: bug in .hi-boot file, or inconsistent .hi file\r\n Use -ddump-if-trace to get an idea of which file caused the error\r\n • In the expression: B.d\r\n In the result of the splice:\r\n $f\r\n To see what the splice expanded to, use -ddump-splices\r\n In the Template Haskell splice $$f\r\n |\r\n6 | main = $$f\r\n| ^^^\r\n}}}\r\n\r\nThis doesn't seem to happen for untyped quotes/splices.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15786Hi Haddock: Enable haddock to generate docs from .hi-files2022-03-23T17:56:29ZSimon JakobiHi Haddock: Enable haddock to generate docs from .hi-files<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | --------------------------- |
| Version | 8.6.1 |
| Type ...<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | --------------------------- |
| Version | 8.6.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | alexbiehl, harpocrates, hvr |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Hi Haddock: Enable haddock to generate docs from .hi-files","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["alexbiehl","harpocrates","hvr"],"type":"FeatureRequest","description":"","type_of_failure":"OtherFailure","blocking":[]} -->9.4.1ZubinZubinhttps://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
>
```https://gitlab.haskell.org/ghc/ghc/-/issues/15791typeKind confuses Type and Constraint2019-07-07T18:02:58ZRichard Eisenbergrae@richarde.devtypeKind confuses Type and ConstraintThe `typeKind` function takes a type and reports its kind. It gets this wrong, sometimes: if you ask for `typeKind` of the quantified constraint `Eq a => C a` (where `C` is a class), you get `Type`. This is wrong, though I don't have a c...The `typeKind` function takes a type and reports its kind. It gets this wrong, sometimes: if you ask for `typeKind` of the quantified constraint `Eq a => C a` (where `C` is a class), you get `Type`. This is wrong, though I don't have a concrete case where GHC misfires.
We *could* fix `typeKind` to get this right, but doing so would require making the `FunTy` case recursive (right now, it always returns `Type`). This is wasteful, because most clients of `typeKind` do not care about the distinction between `Type` and `Constraint`.
Instead, I propose making a new `tcTypeKind` which behaves correctly in this case.
We could also muse about making `tcTypeKind` monadic so that it can look through unification variables. This might also simplify the story around `Note [The tcType invariant]`.
Regardless of the "make monadic" idea, I claim that, when this is done, we should have `isPredTy` be functionally equivalent to `(== Constraint) . tcTypeKind`.
<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":"typeKind confuses Type and Constraint","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 `typeKind` function takes a type and reports its kind. It gets this wrong, sometimes: if you ask for `typeKind` of the quantified constraint `Eq a => C a` (where `C` is a class), you get `Type`. This is wrong, though I don't have a concrete case where GHC misfires.\r\n\r\nWe ''could'' fix `typeKind` to get this right, but doing so would require making the `FunTy` case recursive (right now, it always returns `Type`). This is wasteful, because most clients of `typeKind` do not care about the distinction between `Type` and `Constraint`.\r\n\r\nInstead, I propose making a new `tcTypeKind` which behaves correctly in this case.\r\n\r\nWe could also muse about making `tcTypeKind` monadic so that it can look through unification variables. This might also simplify the story around `Note [The tcType invariant]`.\r\n\r\nRegardless of the \"make monadic\" idea, I claim that, when this is done, we should have `isPredTy` be functionally equivalent to `(== Constraint) . tcTypeKind`.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15792TH reification prints invisible arguments to rank-2-kinded type as visible2019-07-07T18:02:57ZRyan ScottTH reification prints invisible arguments to rank-2-kinded type as visibleIf you run the following program:
```hs
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where
import Data.Kind
import Language.Haskell.TH hiding (Type)
newtype T (f :: forall a. a -> ...If you run the following program:
```hs
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where
import Data.Kind
import Language.Haskell.TH hiding (Type)
newtype T (f :: forall a. a -> Type) = MkT (f Bool)
$(pure [])
main :: IO ()
main = do
putStrLn $(reify ''T >>= stringE . pprint)
putStrLn $(reify ''T >>= stringE . show)
```
You'll get:
```
$ /opt/ghc/8.6.1/bin/runghc Bug.hs
newtype Bug.T (f_0 :: forall (a_1 :: *) . a_1 -> *)
= Bug.MkT (f_0 * GHC.Types.Bool)
TyConI (NewtypeD [] Bug.T [KindedTV f_6989586621679016168 (ForallT [KindedTV a_6989586621679016167 StarT] [] (AppT (AppT ArrowT (VarT a_6989586621679016167)) StarT))] Nothing (NormalC Bug.MkT [(Bang NoSourceUnpackedness NoSourceStrictness,AppT (AppT (VarT f_6989586621679016168) StarT) (ConT GHC.Types.Bool))]) [])
```
These are the parts that are suspect:
- `f_0 * GHC.Types.Bool`
- `AppT (AppT (VarT f_6989586621679016168) StarT) (ConT GHC.Types.Bool)`
Notice how `f`/`VarT f` accepts `*`/`StarT` as a visible argument, despite the fact that its kind `forall a. a -> Type` indicates that this should be invisible.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 8.6.1 |
| 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":"TH reification prints invisible arguments to rank-2-kinded type as visible","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"If you run the following program:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Language.Haskell.TH hiding (Type)\r\n\r\nnewtype T (f :: forall a. a -> Type) = MkT (f Bool)\r\n\r\n$(pure [])\r\n\r\nmain :: IO ()\r\nmain = do\r\n putStrLn $(reify ''T >>= stringE . pprint)\r\n putStrLn $(reify ''T >>= stringE . show)\r\n}}}\r\n\r\nYou'll get:\r\n\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/runghc Bug.hs\r\nnewtype Bug.T (f_0 :: forall (a_1 :: *) . a_1 -> *)\r\n = Bug.MkT (f_0 * GHC.Types.Bool)\r\nTyConI (NewtypeD [] Bug.T [KindedTV f_6989586621679016168 (ForallT [KindedTV a_6989586621679016167 StarT] [] (AppT (AppT ArrowT (VarT a_6989586621679016167)) StarT))] Nothing (NormalC Bug.MkT [(Bang NoSourceUnpackedness NoSourceStrictness,AppT (AppT (VarT f_6989586621679016168) StarT) (ConT GHC.Types.Bool))]) [])\r\n}}}\r\n\r\nThese are the parts that are suspect:\r\n\r\n* `f_0 * GHC.Types.Bool`\r\n* `AppT (AppT (VarT f_6989586621679016168) StarT) (ConT GHC.Types.Bool)`\r\n\r\nNotice how `f`/`VarT f` accepts `*`/`StarT` as a visible argument, despite the fact that its kind `forall a. a -> Type` indicates that this should be invisible.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15793Type family doesn't reduce with visible kind application2019-07-07T18:02:57ZIcelandjackType family doesn't reduce with visible kind applicationIf we un-comment `f2`
```hs
{-# Language RankNTypes #-}
{-# Language TypeFamilies #-}
{-# Language TypeApplications #-}
{-# Language PolyKinds #-}
import Data.Kind
type family
F1 (a :: Type) :: Type where
F1 a = M...If we un-comment `f2`
```hs
{-# Language RankNTypes #-}
{-# Language TypeFamilies #-}
{-# Language TypeApplications #-}
{-# Language PolyKinds #-}
import Data.Kind
type family
F1 (a :: Type) :: Type where
F1 a = Maybe a
f1 :: F1 a
f1 = Nothing
type family
F2 :: forall (a :: Type). Type where
F2 @a = Maybe a
-- f2 :: F2 @a
-- f2 = Nothing
```
this program fails with
```
• Couldn't match kind ‘forall a1. *’ with ‘* -> *’
When matching types
F2 :: forall a. *
Maybe :: * -> *
Expected type: F2
Actual type: Maybe a
• In the expression: Nothing
In an equation for ‘f2’: f2 = Nothing
|
20 | f2 = Nothing
| ^^^^^^^
Failed, no modules loaded.
```
It also succeeds replacing `Nothing` with `undefined`
```hs
f2 :: F2 @a
f2 = undefined
```
<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 | mnguyen |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Type family doesn't reduce with visible 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":["mnguyen"],"type":"Bug","description":"If we un-comment `f2`\r\n\r\n{{{#!hs\r\n{-# Language RankNTypes #-}\r\n{-# Language TypeFamilies #-}\r\n{-# Language TypeApplications #-}\r\n{-# Language PolyKinds #-}\r\n\r\nimport Data.Kind\r\n\r\ntype family\r\n F1 (a :: Type) :: Type where\r\n F1 a = Maybe a\r\n\r\nf1 :: F1 a\r\nf1 = Nothing\r\n\r\ntype family\r\n F2 :: forall (a :: Type). Type where\r\n F2 @a = Maybe a\r\n\r\n-- f2 :: F2 @a\r\n-- f2 = Nothing\r\n}}}\r\n\r\nthis program fails with\r\n\r\n{{{\r\n • Couldn't match kind ‘forall a1. *’ with ‘* -> *’\r\n When matching types\r\n F2 :: forall a. *\r\n Maybe :: * -> *\r\n Expected type: F2\r\n Actual type: Maybe a\r\n • In the expression: Nothing\r\n In an equation for ‘f2’: f2 = Nothing\r\n |\r\n 20 | f2 = Nothing\r\n | ^^^^^^^\r\n Failed, no modules loaded.\r\n}}}\r\n\r\nIt also succeeds replacing `Nothing` with `undefined`\r\n\r\n{{{#!hs\r\nf2 :: F2 @a\r\nf2 = undefined\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15794shell.nix depends on build artifacts2019-07-31T22:57:52ZVladislav Zavialovshell.nix depends on build artifactsFiled Mar 19, 2018, as https://github.com/snowleopard/hadrian/issues/532
- \*Steps to reproduce:\*\*
1. `git clone --recursive git://git.haskell.org/ghc.git`
1. `cd ghc/hadrian`
1. `nix-shell --pure`
- \*Expected result:\*\* Successfu...Filed Mar 19, 2018, as https://github.com/snowleopard/hadrian/issues/532
- \*Steps to reproduce:\*\*
1. `git clone --recursive git://git.haskell.org/ghc.git`
1. `cd ghc/hadrian`
1. `nix-shell --pure`
- \*Expected result:\*\* Successful build.
- \*Actual result:\*\*
```
hadrian(master)$ nix-shell --pure
these derivations will be built:
/nix/store/lmpgkvswlkcgpcjdilbyh202vm8a5i5r-directory-1.3.1.5.drv
/nix/store/rcg0mmq0bincjfjnzbabc8fq7307bylq-process-1.6.3.0.drv
/nix/store/15alkpni823gkfp63c79962v032wxvjs-extra-1.6.4.drv
/nix/store/1b54g6nv8rw0kq3i5xjpcbhy88jvdnbr-xml-1.3.14.drv
/nix/store/89salv051l8yr2y2k52pzkqraw9lfib9-test-framework-0.8.1.1.drv
/nix/store/iqq0xsvgf3hf551b3jj0x3lg661c5y4f-test-framework-hunit-0.3.0.2.drv
/nix/store/cy7ynm7r9jb41kxb1gxbwdprhvl03ivk-parsec-3.1.13.0.drv
/nix/store/rgnsvxfvmbhrkniy0c86v65jgvx8nsan-test-framework-quickcheck2-0.3.0.4.drv
/nix/store/fyrj002axd2skdz370hi13fq6prjh5cz-network-uri-2.6.1.0.drv
/nix/store/7qcfy5gy9sjcz7cijqghgj3cilm2pzps-HTTP-4000.3.8.drv
/nix/store/gk0w3grh2hz008sp6ksy669zvl6pyznb-js-flot-0.8.3.drv
/nix/store/h39chz7m8zvawlrzfjsz496vl2rbp921-hashable-1.2.6.1.drv
/nix/store/zpv0xi25jq6p5kkpvbc11sq73dxi2g0a-unordered-containers-0.2.8.0.drv
/nix/store/i7p5c3mv9p20z7kb2mrdlpx0fwmyz3f5-shake-0.16.2.drv
/nix/store/pzfcvib6sbsaascsc7djzcfqzlw847gc-Cabal-2.3.0.0.drv
/nix/store/j5w4i42pgfy03s7fjsj4dfkis26c3nnp-happy-1.19.8.drv
/nix/store/pl2dxjvbqs36rh80q5i09zdhbh6hjl2r-alex-3.2.3.drv
/nix/store/dck8p81zlij9qksglaw8hkp11msrm426-hadrian-0.1.0.0.drv
building '/nix/store/lmpgkvswlkcgpcjdilbyh202vm8a5i5r-directory-1.3.1.5.drv'...
building '/nix/store/1b54g6nv8rw0kq3i5xjpcbhy88jvdnbr-xml-1.3.14.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2.
setupCompilerEnvironmentPhase
Build with /nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2.
unpacking sources
unpacking source archive /nix/store/khjm3agcb1y91925r78h3chaq56w9fi7-6wsbrbb60dzbfqf62c6sskwcijc3arjj-directory
unpacking sources
unpacking source archive /nix/store/dnx7hpl7wz81r3av4l09pqqhdqi4qpg6-xml-1.3.14.tar.gz
source root is xml-1.3.14
source root is 6wsbrbb60dzbfqf62c6sskwcijc3arjj-directory
setting SOURCE_DATE_EPOCH to timestamp 1424727750 of file xml-1.3.14/xml.cabal
patching sources
patching sources
compileBuildDriverPhase
compileBuildDriverPhase
setupCompileFlags: -package-db=/tmp/nix-build-xml-1.3.14.drv-0/package.conf.d -j1 -threaded
setupCompileFlags: -package-db=/tmp/nix-build-directory-1.3.1.5.drv-0/package.conf.d -j1 -threaded
[1 of 1] Compiling Main ( Setup.hs, /tmp/nix-build-directory-1.3.1.5.drv-0/Main.o )
[1 of 1] Compiling Main ( Setup.hs, /tmp/nix-build-xml-1.3.14.drv-0/Main.o )
Linking Setup ...
Linking Setup ...
configuring
configureFlags: --verbose --prefix=/nix/store/v3yazy78gy6kkpvrcn3schm8lc8y5dgl-xml-1.3.14 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --docdir=/nix/store/zdzgar7mwysym9dbai87fann20pbw75n-xml-1.3.14-doc/share/doc --with-gcc=gcc --package-db=/tmp/nix-build-xml-1.3.14.drv-0/package.conf.d --ghc-option=-optl=-Wl,-rpath=/nix/store/v3yazy78gy6kkpvrcn3schm8lc8y5dgl-xml-1.3.14/lib/ghc-8.2.2/xml-1.3.14 --ghc-option=-j1 --disable-split-objs --disable-library-profiling --disable-profiling --enable-shared --disable-coverage --enable-library-vanilla --enable-executable-dynamic --enable-tests --ghc-option=-split-sections
configuring
configureFlags: --verbose --prefix=/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --docdir=/nix/store/w0gkzrf5q6ng40vzyvdl5m8pvw9v9dxy-directory-1.3.1.5-doc/share/doc --with-gcc=gcc --package-db=/tmp/nix-build-directory-1.3.1.5.drv-0/package.conf.d --ghc-option=-optl=-Wl,-rpath=/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/lib/ghc-8.2.2/directory-1.3.1.5 --ghc-option=-j1 --disable-split-objs --disable-library-profiling --disable-profiling --enable-shared --disable-coverage --enable-library-vanilla --enable-executable-dynamic --enable-tests --ghc-option=-split-sections
Configuring directory-1.3.1.5...
Warning: The 'build-type' is 'Configure' but there is no 'configure' script.
You probably need to run 'autoreconf -i' to generate it.
Configuring xml-1.3.14...
Dependency base >=3 && <5: using base-4.10.1.0
Dependency bytestring -any: using bytestring-0.10.8.2
Dependency text -any: using text-1.2.3.0
Dependency base >=4.5 && <4.12: using base-4.10.1.0
Dependency directory -any: using directory-1.3.1.5
Dependency filepath >=1.3 && <1.5: using filepath-1.4.2
Dependency time >=1.4 && <1.9: using time-1.8.0.2
Dependency unix >=2.5.1 && <2.8: using unix-2.7.2.2
Source component graph:
component lib
component test:test dependency lib
Configured component graph:
component directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK
include base-4.10.1.0
include time-1.8.0.2
include filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx
include unix-2.7.2.2
component directory-1.3.1.5-8aJ3UecsjNUIxs4bq1vU8T-test
include base-4.10.1.0
include directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK
include filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx
include time-1.8.0.2
include unix-2.7.2.2
Linked component graph:
unit directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK
include base-4.10.1.0
include time-1.8.0.2
include filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx
include unix-2.7.2.2
System.Directory=directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK:System.Directory,System.Directory.Internal=directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK:System.Directory.Internal,System.Directory.Internal.Prelude=directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK:System.Directory.Internal.Prelude
unit directory-1.3.1.5-8aJ3UecsjNUIxs4bq1vU8T-test
include base-4.10.1.0
include directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK
include filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx
include time-1.8.0.2
include unix-2.7.2.2
Ready component graph:
definite directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK
depends base-4.10.1.0
depends time-1.8.0.2
depends filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx
depends unix-2.7.2.2
definite directory-1.3.1.5-8aJ3UecsjNUIxs4bq1vU8T-test
depends base-4.10.1.0
depends directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK
depends filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx
depends time-1.8.0.2
depends unix-2.7.2.2
Using Cabal-2.0.1.0 compiled by ghc-8.2
Using compiler: ghc-8.2.2
Using install prefix:
/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5
Executables installed in:
/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/bin
Libraries installed in:
/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/lib/ghc-8.2.2/directory-1.3.1.5
Dynamic Libraries installed in:
/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/lib/ghc-8.2.2/x86_64-linux-ghc-8.2.2
Private executables installed in:
/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/libexec/x86_64-linux-ghc-8.2.2/directory-1.3.1.5
Data files installed in:
/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/share/x86_64-linux-ghc-8.2.2/directory-1.3.1.5
Documentation installed in:
/nix/store/w0gkzrf5q6ng40vzyvdl5m8pvw9v9dxy-directory-1.3.1.5-doc/share/doc
Configuration files installed in:
/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/etc
No alex found
Using ar found on system at:
/nix/store/aplvnhqdm6s9wj9r0jh46r46wvh65j86-binutils-2.28.1/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 6.4.0 given by user at:
/nix/store/wriy1xis74fybcg3m1jnq5bd5myxvhm6-gcc-wrapper-6.4.0/bin/gcc
Using ghc version 8.2.2 found on system at:
/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/ghc
Using ghc-pkg version 8.2.2 found on system at:
/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.18.1 found on system at:
/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/haddock
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.67 found on system at:
/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/hpc
Using hsc2hs version 0.68.2 found on system at:
/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/hsc2hs
Using hscolour version 1.24 found on system at:
/nix/store/yf0bs1q9ph388jms8xlgcd5vh99amjm4-hscolour-1.24.2/bin/HsColour
No jhc found
Using ld found on system at:
/nix/store/wriy1xis74fybcg3m1jnq5bd5myxvhm6-gcc-wrapper-6.4.0/bin/ld
No lhc found
No lhc-pkg found
No pkg-config found
Using runghc version 8.2.2 found on system at:
/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/runghc
Using strip version 2.28 found on system at:
/nix/store/aplvnhqdm6s9wj9r0jh46r46wvh65j86-binutils-2.28.1/bin/strip
Using tar found on system at:
/nix/store/vvq16kzwgx9yhkf0fwwms5xzgg0rwdpl-gnutar-1.29/bin/tar
No uhc found
Setup: configure script not found.
builder for '/nix/store/lmpgkvswlkcgpcjdilbyh202vm8a5i5r-directory-1.3.1.5.drv' failed with exit code 1
cannot build derivation '/nix/store/dck8p81zlij9qksglaw8hkp11msrm426-hadrian-0.1.0.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/dck8p81zlij9qksglaw8hkp11msrm426-hadrian-0.1.0.0.drv' failed
```
Notice that the build fails for a library shipped with GHC. In `shell.nix` it's included as `localPackage`.
- \*Workaround\*\*
First, we need to run `configurePhase` of the default Nix derivation for GHC HEAD:
1. `cd ghc`
1. `nix-shell '<nixpkgs>' -A haskell.compiler.ghcHEAD`
1. `configurePhase`
1. `exit`
Now we can `cd` into `ghc/hadrian` and proceed normally, the build won't fail.
The issue is that this step shouldn't be required, we must have a self-contained `shell.nix`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Build System (Hadrian) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"shell.nix depends on build artifacts","status":"New","operating_system":"","component":"Build System (Hadrian)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Filed Mar 19, 2018, as https://github.com/snowleopard/hadrian/issues/532\r\n\r\n**Steps to reproduce:**\r\n\r\n1. `git clone --recursive git://git.haskell.org/ghc.git`\r\n2. `cd ghc/hadrian`\r\n3. `nix-shell --pure`\r\n\r\n**Expected result:** Successful build.\r\n\r\n**Actual result:**\r\n\r\n{{{\r\nhadrian(master)$ nix-shell --pure\r\nthese derivations will be built:\r\n /nix/store/lmpgkvswlkcgpcjdilbyh202vm8a5i5r-directory-1.3.1.5.drv\r\n /nix/store/rcg0mmq0bincjfjnzbabc8fq7307bylq-process-1.6.3.0.drv\r\n /nix/store/15alkpni823gkfp63c79962v032wxvjs-extra-1.6.4.drv\r\n /nix/store/1b54g6nv8rw0kq3i5xjpcbhy88jvdnbr-xml-1.3.14.drv\r\n /nix/store/89salv051l8yr2y2k52pzkqraw9lfib9-test-framework-0.8.1.1.drv\r\n /nix/store/iqq0xsvgf3hf551b3jj0x3lg661c5y4f-test-framework-hunit-0.3.0.2.drv\r\n /nix/store/cy7ynm7r9jb41kxb1gxbwdprhvl03ivk-parsec-3.1.13.0.drv\r\n /nix/store/rgnsvxfvmbhrkniy0c86v65jgvx8nsan-test-framework-quickcheck2-0.3.0.4.drv\r\n /nix/store/fyrj002axd2skdz370hi13fq6prjh5cz-network-uri-2.6.1.0.drv\r\n /nix/store/7qcfy5gy9sjcz7cijqghgj3cilm2pzps-HTTP-4000.3.8.drv\r\n /nix/store/gk0w3grh2hz008sp6ksy669zvl6pyznb-js-flot-0.8.3.drv\r\n /nix/store/h39chz7m8zvawlrzfjsz496vl2rbp921-hashable-1.2.6.1.drv\r\n /nix/store/zpv0xi25jq6p5kkpvbc11sq73dxi2g0a-unordered-containers-0.2.8.0.drv\r\n /nix/store/i7p5c3mv9p20z7kb2mrdlpx0fwmyz3f5-shake-0.16.2.drv\r\n /nix/store/pzfcvib6sbsaascsc7djzcfqzlw847gc-Cabal-2.3.0.0.drv\r\n /nix/store/j5w4i42pgfy03s7fjsj4dfkis26c3nnp-happy-1.19.8.drv\r\n /nix/store/pl2dxjvbqs36rh80q5i09zdhbh6hjl2r-alex-3.2.3.drv\r\n /nix/store/dck8p81zlij9qksglaw8hkp11msrm426-hadrian-0.1.0.0.drv\r\nbuilding '/nix/store/lmpgkvswlkcgpcjdilbyh202vm8a5i5r-directory-1.3.1.5.drv'...\r\nbuilding '/nix/store/1b54g6nv8rw0kq3i5xjpcbhy88jvdnbr-xml-1.3.14.drv'...\r\nsetupCompilerEnvironmentPhase\r\nBuild with /nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2.\r\nsetupCompilerEnvironmentPhase\r\nBuild with /nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2.\r\nunpacking sources\r\nunpacking source archive /nix/store/khjm3agcb1y91925r78h3chaq56w9fi7-6wsbrbb60dzbfqf62c6sskwcijc3arjj-directory\r\nunpacking sources\r\nunpacking source archive /nix/store/dnx7hpl7wz81r3av4l09pqqhdqi4qpg6-xml-1.3.14.tar.gz\r\nsource root is xml-1.3.14\r\nsource root is 6wsbrbb60dzbfqf62c6sskwcijc3arjj-directory\r\nsetting SOURCE_DATE_EPOCH to timestamp 1424727750 of file xml-1.3.14/xml.cabal\r\npatching sources\r\npatching sources\r\ncompileBuildDriverPhase\r\ncompileBuildDriverPhase\r\nsetupCompileFlags: -package-db=/tmp/nix-build-xml-1.3.14.drv-0/package.conf.d -j1 -threaded\r\nsetupCompileFlags: -package-db=/tmp/nix-build-directory-1.3.1.5.drv-0/package.conf.d -j1 -threaded\r\n[1 of 1] Compiling Main ( Setup.hs, /tmp/nix-build-directory-1.3.1.5.drv-0/Main.o )\r\n[1 of 1] Compiling Main ( Setup.hs, /tmp/nix-build-xml-1.3.14.drv-0/Main.o )\r\nLinking Setup ...\r\nLinking Setup ...\r\nconfiguring\r\nconfigureFlags: --verbose --prefix=/nix/store/v3yazy78gy6kkpvrcn3schm8lc8y5dgl-xml-1.3.14 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --docdir=/nix/store/zdzgar7mwysym9dbai87fann20pbw75n-xml-1.3.14-doc/share/doc --with-gcc=gcc --package-db=/tmp/nix-build-xml-1.3.14.drv-0/package.conf.d --ghc-option=-optl=-Wl,-rpath=/nix/store/v3yazy78gy6kkpvrcn3schm8lc8y5dgl-xml-1.3.14/lib/ghc-8.2.2/xml-1.3.14 --ghc-option=-j1 --disable-split-objs --disable-library-profiling --disable-profiling --enable-shared --disable-coverage --enable-library-vanilla --enable-executable-dynamic --enable-tests --ghc-option=-split-sections\r\nconfiguring\r\nconfigureFlags: --verbose --prefix=/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --docdir=/nix/store/w0gkzrf5q6ng40vzyvdl5m8pvw9v9dxy-directory-1.3.1.5-doc/share/doc --with-gcc=gcc --package-db=/tmp/nix-build-directory-1.3.1.5.drv-0/package.conf.d --ghc-option=-optl=-Wl,-rpath=/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/lib/ghc-8.2.2/directory-1.3.1.5 --ghc-option=-j1 --disable-split-objs --disable-library-profiling --disable-profiling --enable-shared --disable-coverage --enable-library-vanilla --enable-executable-dynamic --enable-tests --ghc-option=-split-sections\r\nConfiguring directory-1.3.1.5...\r\nWarning: The 'build-type' is 'Configure' but there is no 'configure' script.\r\nYou probably need to run 'autoreconf -i' to generate it.\r\nConfiguring xml-1.3.14...\r\nDependency base >=3 && <5: using base-4.10.1.0\r\nDependency bytestring -any: using bytestring-0.10.8.2\r\nDependency text -any: using text-1.2.3.0\r\nDependency base >=4.5 && <4.12: using base-4.10.1.0\r\nDependency directory -any: using directory-1.3.1.5\r\nDependency filepath >=1.3 && <1.5: using filepath-1.4.2\r\nDependency time >=1.4 && <1.9: using time-1.8.0.2\r\nDependency unix >=2.5.1 && <2.8: using unix-2.7.2.2\r\nSource component graph:\r\n component lib\r\n component test:test dependency lib\r\nConfigured component graph:\r\n component directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK\r\n include base-4.10.1.0\r\n include time-1.8.0.2\r\n include filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx\r\n include unix-2.7.2.2\r\n component directory-1.3.1.5-8aJ3UecsjNUIxs4bq1vU8T-test\r\n include base-4.10.1.0\r\n include directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK\r\n include filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx\r\n include time-1.8.0.2\r\n include unix-2.7.2.2\r\nLinked component graph:\r\n unit directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK\r\n include base-4.10.1.0\r\n include time-1.8.0.2\r\n include filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx\r\n include unix-2.7.2.2\r\n System.Directory=directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK:System.Directory,System.Directory.Internal=directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK:System.Directory.Internal,System.Directory.Internal.Prelude=directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK:System.Directory.Internal.Prelude\r\n unit directory-1.3.1.5-8aJ3UecsjNUIxs4bq1vU8T-test\r\n include base-4.10.1.0\r\n include directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK\r\n include filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx\r\n include time-1.8.0.2\r\n include unix-2.7.2.2\r\nReady component graph:\r\n definite directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK\r\n depends base-4.10.1.0\r\n depends time-1.8.0.2\r\n depends filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx\r\n depends unix-2.7.2.2\r\n definite directory-1.3.1.5-8aJ3UecsjNUIxs4bq1vU8T-test\r\n depends base-4.10.1.0\r\n depends directory-1.3.1.5-EFdDcGoPsV2JQnFPz1QOGK\r\n depends filepath-1.4.2-DyDAQ5oOwBVDvLxMoNLDxx\r\n depends time-1.8.0.2\r\n depends unix-2.7.2.2\r\nUsing Cabal-2.0.1.0 compiled by ghc-8.2\r\nUsing compiler: ghc-8.2.2\r\nUsing install prefix:\r\n/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5\r\nExecutables installed in:\r\n/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/bin\r\nLibraries installed in:\r\n/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/lib/ghc-8.2.2/directory-1.3.1.5\r\nDynamic Libraries installed in:\r\n/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/lib/ghc-8.2.2/x86_64-linux-ghc-8.2.2\r\nPrivate executables installed in:\r\n/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/libexec/x86_64-linux-ghc-8.2.2/directory-1.3.1.5\r\nData files installed in:\r\n/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/share/x86_64-linux-ghc-8.2.2/directory-1.3.1.5\r\nDocumentation installed in:\r\n/nix/store/w0gkzrf5q6ng40vzyvdl5m8pvw9v9dxy-directory-1.3.1.5-doc/share/doc\r\nConfiguration files installed in:\r\n/nix/store/59r1c7sfgph9j2xxsc1k3j6dwkm32ybk-directory-1.3.1.5/etc\r\nNo alex found\r\nUsing ar found on system at:\r\n/nix/store/aplvnhqdm6s9wj9r0jh46r46wvh65j86-binutils-2.28.1/bin/ar\r\nNo c2hs found\r\nNo cpphs found\r\nNo doctest found\r\nUsing gcc version 6.4.0 given by user at:\r\n/nix/store/wriy1xis74fybcg3m1jnq5bd5myxvhm6-gcc-wrapper-6.4.0/bin/gcc\r\nUsing ghc version 8.2.2 found on system at:\r\n/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/ghc\r\nUsing ghc-pkg version 8.2.2 found on system at:\r\n/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/ghc-pkg\r\nNo ghcjs found\r\nNo ghcjs-pkg found\r\nNo greencard found\r\nUsing haddock version 2.18.1 found on system at:\r\n/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/haddock\r\nNo happy found\r\nUsing haskell-suite found on system at: haskell-suite-dummy-location\r\nUsing haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location\r\nNo hmake found\r\nUsing hpc version 0.67 found on system at:\r\n/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/hpc\r\nUsing hsc2hs version 0.68.2 found on system at:\r\n/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/hsc2hs\r\nUsing hscolour version 1.24 found on system at:\r\n/nix/store/yf0bs1q9ph388jms8xlgcd5vh99amjm4-hscolour-1.24.2/bin/HsColour\r\nNo jhc found\r\nUsing ld found on system at:\r\n/nix/store/wriy1xis74fybcg3m1jnq5bd5myxvhm6-gcc-wrapper-6.4.0/bin/ld\r\nNo lhc found\r\nNo lhc-pkg found\r\nNo pkg-config found\r\nUsing runghc version 8.2.2 found on system at:\r\n/nix/store/d57p5gzyld7b3y4irzv70bfa3d8xxwgx-ghc-8.2.2/bin/runghc\r\nUsing strip version 2.28 found on system at:\r\n/nix/store/aplvnhqdm6s9wj9r0jh46r46wvh65j86-binutils-2.28.1/bin/strip\r\nUsing tar found on system at:\r\n/nix/store/vvq16kzwgx9yhkf0fwwms5xzgg0rwdpl-gnutar-1.29/bin/tar\r\nNo uhc found\r\nSetup: configure script not found.\r\nbuilder for '/nix/store/lmpgkvswlkcgpcjdilbyh202vm8a5i5r-directory-1.3.1.5.drv' failed with exit code 1\r\ncannot build derivation '/nix/store/dck8p81zlij9qksglaw8hkp11msrm426-hadrian-0.1.0.0.drv': 1 dependencies couldn't be built\r\nerror: build of '/nix/store/dck8p81zlij9qksglaw8hkp11msrm426-hadrian-0.1.0.0.drv' failed\r\n}}}\r\n\r\nNotice that the build fails for a library shipped with GHC. In `shell.nix` it's included as `localPackage`.\r\n\r\n**Workaround**\r\n\r\nFirst, we need to run `configurePhase` of the default Nix derivation for GHC HEAD:\r\n\r\n1. `cd ghc`\r\n2. `nix-shell '<nixpkgs>' -A haskell.compiler.ghcHEAD`\r\n3. `configurePhase`\r\n4. `exit`\r\n\r\nNow we can `cd` into `ghc/hadrian` and proceed normally, the build won't fail.\r\n\r\nThe issue is that this step shouldn't be required, we must have a self-contained `shell.nix`.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15795Core lint error with unused kind variable in data type return kind2019-07-07T18:02:57ZIcelandjackCore lint error with unused kind variable in data type return kindFinally managed to trigger a core lint error with #12045
```hs
{-# Language RankNTypes #-}
{-# Language TypeApplications #-}
{-# Language DataKinds #-}
{-# Language PolyKinds #-}
{-# Language TypeOpera...Finally managed to trigger a core lint error with #12045
```hs
{-# Language RankNTypes #-}
{-# Language TypeApplications #-}
{-# Language DataKinds #-}
{-# Language PolyKinds #-}
{-# Language TypeOperators #-}
{-# Language GADTs #-}
{-# Options_GHC -dcore-lint #-}
import Data.Kind
type Cat ob = ob -> ob -> Type
data (×) :: forall (cat1 :: Cat ob1) (cat2 :: Cat ob2). Cat (ob1, ob2) where
Prod
:: forall
ob1 ob2
cat1 cat2
a1 b1
a2 b2 u.
cat1 a1 b1
-> cat2 a2 b2
-> (×) @u '(a1, a2) '(b1, b2)
```
log attached from running `ghci -ignore-dot-ghci <file>.hs`
<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 | mnguyen |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Core lint error with visible kind patterns","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["TypeApplications"],"differentials":[],"test_case":"","architecture":"","cc":["mnguyen"],"type":"Bug","description":"Finally managed to trigger a core lint error with #12045\r\n\r\n{{{#!hs\r\n{-# Language RankNTypes #-}\r\n{-# Language TypeApplications #-}\r\n{-# Language DataKinds #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language TypeOperators #-}\r\n{-# Language GADTs #-}\r\n{-# Options_GHC -dcore-lint #-}\r\n\r\nimport Data.Kind\r\n\r\ntype Cat ob = ob -> ob -> Type\r\n\r\ndata (×) :: forall (cat1 :: Cat ob1) (cat2 :: Cat ob2). Cat (ob1, ob2) where\r\n Prod\r\n :: forall\r\n ob1 ob2\r\n cat1 cat2\r\n a1 b1\r\n a2 b2 u.\r\n cat1 a1 b1\r\n -> cat2 a2 b2\r\n -> (×) @u '(a1, a2) '(b1, b2)\r\n}}}\r\n\r\nlog attached from running `ghci -ignore-dot-ghci <file>.hs`","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15796Core Lint error with invalid newtype declaration2019-07-07T18:02:56ZIcelandjackCore Lint error with invalid newtype declarationThis gives a Core Lint error
```hs
{-# Language QuantifiedConstraints #-}
{-# Language TypeApplications #-}
{-# Language TypeOperators #-}
{-# Language PolyKinds #-}
{-# Language FlexibleInstances #-}
{-# La...This gives a Core Lint error
```hs
{-# Language QuantifiedConstraints #-}
{-# Language TypeApplications #-}
{-# Language TypeOperators #-}
{-# Language PolyKinds #-}
{-# Language FlexibleInstances #-}
{-# Language DataKinds #-}
{-# Language TypeFamilies #-}
{-# Language MultiParamTypeClasses #-}
{-# Language ConstraintKinds #-}
{-# Language UndecidableInstances #-}
{-# Language GADTs #-}
{-# Options_GHC -dcore-lint #-}
import Data.Kind
type Cat ob = ob -> ob -> Type
class Ríki (obj :: Type) where
type (-->) :: Cat obj
class Varpi (f :: dom -> cod)
newtype
(··>) :: Cat (a -> b) where
Natu :: Varpi f
=> (forall xx. f xx --> f' xx)
-> (f ··> f')
instance
Ríki cod
=> -------------
Ríki (dom -> cod)
where
type (-->) = (··>) @dom @cod
```
```
$ ghci -ignore-dot-ghci 568_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 568_bug.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181017 for x86_64-unknown-linux):
Core Lint error
<no location info>: warning:
In the type ‘(··>)’
Found TcTyCon: ··>[tc]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/FamInst.hs:171:31 in ghc:FamInst
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
> :q
Leaving GHCi.
```
<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":"Core Lint error","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":"This gives a Core Lint error\r\n\r\n{{{#!hs\r\n{-# Language QuantifiedConstraints #-}\r\n{-# Language TypeApplications #-}\r\n{-# Language TypeOperators #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language FlexibleInstances #-}\r\n{-# Language DataKinds #-}\r\n{-# Language TypeFamilies #-}\r\n{-# Language MultiParamTypeClasses #-}\r\n{-# Language ConstraintKinds #-}\r\n{-# Language UndecidableInstances #-}\r\n{-# Language GADTs #-}\r\n\r\n{-# Options_GHC -dcore-lint #-}\r\n\r\nimport Data.Kind\r\n\r\ntype Cat ob = ob -> ob -> Type\r\n\r\nclass Ríki (obj :: Type) where\r\n type (-->) :: Cat obj\r\n\r\nclass Varpi (f :: dom -> cod)\r\n\r\nnewtype\r\n (··>) :: Cat (a -> b) where\r\n Natu :: Varpi f\r\n => (forall xx. f xx --> f' xx)\r\n -> (f ··> f')\r\n\r\ninstance\r\n Ríki cod\r\n => -------------\r\n Ríki (dom -> cod)\r\n where\r\n\r\n type (-->) = (··>) @dom @cod\r\n}}}\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci 568_bug.hs\r\nGHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 568_bug.hs, interpreted )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181017 for x86_64-unknown-linux):\r\n Core Lint error\r\n <no location info>: warning:\r\n In the type ‘(··>)’\r\n Found TcTyCon: ··>[tc]\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/FamInst.hs:171:31 in ghc:FamInst\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n> :q\r\nLeaving GHCi.\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15797GHC panic using visible kind application2019-07-07T18:02:56ZIcelandjackGHC panic using visible kind application```hs
{-# Language RankNTypes #-}
{-# Language TypeFamilies #-}
{-# Language ScopedTypeVariables #-}
{-# Language TypeApplications #-}
{-# Language DataKinds #-}
{-# Language PolyKinds ...```hs
{-# Language RankNTypes #-}
{-# Language TypeFamilies #-}
{-# Language ScopedTypeVariables #-}
{-# Language TypeApplications #-}
{-# Language DataKinds #-}
{-# Language PolyKinds #-}
{-# Language TypeOperators #-}
{-# Language GADTs #-}
{-# Options_GHC -dcore-lint #-}
import Data.Kind
class Ríki (obj :: Type) where
type Obj :: obj -> Constraint
type Obj = Bæ @obj
class Bæ (a :: k)
instance Bæ @k (a :: k)
data
EQ :: forall ob. ob -> ob -> Type where
EQ :: EQ a a
instance
Ríki (EQ @ob)
```
```
$ ghci -dcore-lint 568_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 568_bug.hs, interpreted )
WARNING: file compiler/types/TyCoRep.hs, line 2567
in_scope InScope {ob_a1zs co_a1zt}
tenv []
cenv [a1zt :-> co_a1zt]
tys [Bæ]
cos []
needInScope [a1zn :-> co_a1zn, a1zs :-> ob_a1zs]
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181017 for x86_64-unknown-linux):
Core Lint error
<no location info>: warning:
In the type ‘Bæ’
Unfilled coercion hole: {co_a1zn}
<no location info>: warning:
In the type ‘Bæ’
co_a1zn :: (ob_a1zs -> ob_a1zs -> *) ~# *
[LclId[CoVarId]] is out of scope
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/FamInst.hs:171:31 in ghc:FamInst
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 | mnguyen |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC panic using visible 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":["mnguyen"],"type":"Bug","description":"{{{#!hs\r\n{-# Language RankNTypes #-}\r\n{-# Language TypeFamilies #-}\r\n{-# Language ScopedTypeVariables #-}\r\n{-# Language TypeApplications #-}\r\n{-# Language DataKinds #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language TypeOperators #-}\r\n{-# Language GADTs #-}\r\n\r\n{-# Options_GHC -dcore-lint #-}\r\n\r\nimport Data.Kind\r\n\r\nclass Ríki (obj :: Type) where\r\n type Obj :: obj -> Constraint\r\n type Obj = Bæ @obj\r\n\r\nclass Bæ (a :: k)\r\ninstance Bæ @k (a :: k)\r\n\r\ndata\r\n EQ :: forall ob. ob -> ob -> Type where\r\n EQ :: EQ a a\r\n\r\ninstance\r\n Ríki (EQ @ob)\r\n}}}\r\n\r\n{{{\r\n$ ghci -dcore-lint 568_bug.hs\r\nGHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 568_bug.hs, interpreted )\r\nWARNING: file compiler/types/TyCoRep.hs, line 2567\r\n in_scope InScope {ob_a1zs co_a1zt}\r\n tenv []\r\n cenv [a1zt :-> co_a1zt]\r\n tys [Bæ]\r\n cos []\r\n needInScope [a1zn :-> co_a1zn, a1zs :-> ob_a1zs]\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181017 for x86_64-unknown-linux):\r\n Core Lint error\r\n <no location info>: warning:\r\n In the type ‘Bæ’\r\n Unfilled coercion hole: {co_a1zn}\r\n <no location info>: warning:\r\n In the type ‘Bæ’\r\n co_a1zn :: (ob_a1zs -> ob_a1zs -> *) ~# *\r\n [LclId[CoVarId]] is out of scope\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/FamInst.hs:171:31 in ghc:FamInst\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.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15798Flag to warn when deriving strategy is not explicitly specified2019-10-06T15:28:31ZAndrew MartinFlag to warn when deriving strategy is not explicitly specifiedIn my code, I aim to always specify deriving strategies. I would like to add a flag `-fwarn-unspecified-deriving` that would cause a warning to be emitted when someone wrote this:
```
newtype Foo = Foo Int
deriving (Show)
```
The use...In my code, I aim to always specify deriving strategies. I would like to add a flag `-fwarn-unspecified-deriving` that would cause a warning to be emitted when someone wrote this:
```
newtype Foo = Foo Int
deriving (Show)
```
The user would be required to instead write:
```
newtype Foo = Foo Int
deriving newtype (Show)
```
Or they could use `stock` if that was the behavior they wanted. This flag would be off by default.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.6.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Flag to warn when deriving strategy is not explicitly specified","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"In my code, I aim to always specify deriving strategies. I would like to add a flag `-fwarn-unspecified-deriving` that would cause a warning to be emitted when someone wrote this:\r\n\r\n{{{\r\nnewtype Foo = Foo Int\r\n deriving (Show)\r\n}}}\r\n\r\nThe user would be required to instead write:\r\n\r\n{{{\r\nnewtype Foo = Foo Int\r\n deriving newtype (Show)\r\n}}}\r\n\r\nOr they could use `stock` if that was the behavior they wanted. This flag would be off by default.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15799GHC panic (and warnings)2019-07-07T18:02:56ZIcelandjackGHC panic (and warnings)On the [visible kind application](https://phabricator.haskell.org/D5229) differential,
```hs
{-# Language CPP #-}
{-# Language DataKinds #-}
{-# Language RankNTypes #-}
{-# Language PatternSynonyms #-}
{-#...On the [visible kind application](https://phabricator.haskell.org/D5229) differential,
```hs
{-# Language CPP #-}
{-# Language DataKinds #-}
{-# Language RankNTypes #-}
{-# Language PatternSynonyms #-}
{-# Language TypeOperators #-}
{-# Language PolyKinds #-}
{-# Language GADTs #-}
{-# Language TypeFamilies #-}
{-# Language TypeApplications #-}
{-# Language FlexibleContexts #-}
{-# Language FlexibleInstances #-}
{-# Language InstanceSigs #-}
import qualified GHC.TypeLits as TypeLits
import GHC.TypeLits (Nat, KnownNat)
import Data.Kind
data Op obj = Op obj
type family
UnOp (op_a :: Op obj) :: obj where
UnOp ('Op obj) = obj
class
Ríki (obj :: Type) where
type (-->) :: Op obj -> obj -> Type
type (<--) :: obj -> Op obj -> Type
unop :: forall (a :: obj) (b :: obj). (a <-- 'Op b) -> ('Op b --> a)
data (<=) :: Op Nat -> Nat -> Type where
LessThan :: (KnownNat (UnOp op_a), KnownNat b, UnOp op_a TypeLits.<= b)
=> (op_a <= b)
newtype (>=) :: Nat -> Op Nat -> Type where
Y :: (a <= b) -> (b >= a)
instance Ríki Nat where
type (-->) = (<=)
type (<--) = (>=)
unop :: (a >= b) -> (b <= a)
unop GreaterThan = LessThan
pattern GreaterThan :: () => (KnownNat (UnOp b), KnownNat a, UnOp b <= a) => a >= b
pattern GreaterThan = Y LessThan
```
```
$ ghci -ignore-dot-ghci 573_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 573_bug.hs, interpreted )
WARNING: file compiler/types/TyCoRep.hs, line 2567
in_scope InScope {b_a1Em a_a1En}
tenv [a1Em :-> b_a1Em[sk:0], a1En :-> a_a1En[sk:0]]
cenv []
tys [KnownNat (UnOp b_a1Em[sk:1]), KnownNat a_a1En[sk:1],
(UnOp b_a1Em[sk:1] |> {co_a1HN}) <= a_a1En[sk:1]]
cos []
needInScope [a1HN :-> co_a1HN]
WARNING: file compiler/types/TyCoRep.hs, line 2567
in_scope InScope {b_a1Jo a_a1Jp}
tenv [a1Em :-> b_a1Jo[tau:3], a1En :-> a_a1Jp[tau:3]]
cenv []
tys [KnownNat (UnOp b_a1Em), KnownNat a_a1En,
(UnOp b_a1Em |> {co_a1HN}) <= a_a1En]
cos []
needInScope [a1HN :-> co_a1HN]
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181017 for x86_64-unknown-linux):
tcEvVarPred
irred_a1Js (UnOp b_a1Jo[tau:3] |> {co_a1HN}) <= a_a1Jp[tau:3]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcType.hs:1998:20 in ghc:TcType
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 (and warnings)","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":"On the [https://phabricator.haskell.org/D5229 visible kind application] differential, \r\n\r\n{{{#!hs\r\n{-# Language CPP #-}\r\n{-# Language DataKinds #-}\r\n{-# Language RankNTypes #-}\r\n{-# Language PatternSynonyms #-}\r\n{-# Language TypeOperators #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language GADTs #-}\r\n{-# Language TypeFamilies #-}\r\n{-# Language TypeApplications #-}\r\n{-# Language FlexibleContexts #-}\r\n{-# Language FlexibleInstances #-}\r\n{-# Language InstanceSigs #-}\r\n\r\nimport qualified GHC.TypeLits as TypeLits\r\nimport GHC.TypeLits (Nat, KnownNat)\r\nimport Data.Kind\r\n\r\ndata Op obj = Op obj\r\n\r\ntype family\r\n UnOp (op_a :: Op obj) :: obj where\r\n UnOp ('Op obj) = obj\r\n\r\nclass\r\n Ríki (obj :: Type) where\r\n type (-->) :: Op obj -> obj -> Type\r\n type (<--) :: obj -> Op obj -> Type\r\n\r\n unop :: forall (a :: obj) (b :: obj). (a <-- 'Op b) -> ('Op b --> a)\r\n\r\ndata (<=) :: Op Nat -> Nat -> Type where\r\n LessThan :: (KnownNat (UnOp op_a), KnownNat b, UnOp op_a TypeLits.<= b)\r\n => (op_a <= b)\r\n\r\nnewtype (>=) :: Nat -> Op Nat -> Type where\r\n Y :: (a <= b) -> (b >= a)\r\n\r\ninstance Ríki Nat where\r\n type (-->) = (<=)\r\n type (<--) = (>=)\r\n\r\n unop :: (a >= b) -> (b <= a)\r\n unop GreaterThan = LessThan\r\n\r\npattern GreaterThan :: () => (KnownNat (UnOp b), KnownNat a, UnOp b <= a) => a >= b\r\npattern GreaterThan = Y LessThan\r\n}}}\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci 573_bug.hs\r\nGHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 573_bug.hs, interpreted )\r\nWARNING: file compiler/types/TyCoRep.hs, line 2567\r\n in_scope InScope {b_a1Em a_a1En}\r\n tenv [a1Em :-> b_a1Em[sk:0], a1En :-> a_a1En[sk:0]]\r\n cenv []\r\n tys [KnownNat (UnOp b_a1Em[sk:1]), KnownNat a_a1En[sk:1],\r\n (UnOp b_a1Em[sk:1] |> {co_a1HN}) <= a_a1En[sk:1]]\r\n cos []\r\n needInScope [a1HN :-> co_a1HN]\r\nWARNING: file compiler/types/TyCoRep.hs, line 2567\r\n in_scope InScope {b_a1Jo a_a1Jp}\r\n tenv [a1Em :-> b_a1Jo[tau:3], a1En :-> a_a1Jp[tau:3]]\r\n cenv []\r\n tys [KnownNat (UnOp b_a1Em), KnownNat a_a1En,\r\n (UnOp b_a1Em |> {co_a1HN}) <= a_a1En]\r\n cos []\r\n needInScope [a1HN :-> co_a1HN]\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181017 for x86_64-unknown-linux):\r\n tcEvVarPred\r\n irred_a1Js (UnOp b_a1Jo[tau:3] |> {co_a1HN}) <= a_a1Jp[tau:3]\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/TcType.hs:1998:20 in ghc:TcType\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.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/15800Overlapping instances error with single instance2019-07-07T18:02:56ZrolandOverlapping instances error with single instance```
{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances #-}
module Bug where
class C a b
instance C a Int
x :: ()
x = undefined :: C a Int => ()
```
```
ghc -c Bug.hs
Bug.hs:10:18: error:
• Overlapping insta...```
{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances #-}
module Bug where
class C a b
instance C a Int
x :: ()
x = undefined :: C a Int => ()
```
```
ghc -c Bug.hs
Bug.hs:10:18: error:
• Overlapping instances for C a0 Int
Matching givens (or their superclasses):
C a Int
bound by an expression type signature:
forall a. C a Int => ()
at Bug.hs:10:18-30
Matching instances: instance C a Int -- Defined at Bug.hs:7:10
(The choice depends on the instantiation of ‘a0’)
• In the ambiguity check for an expression type signature
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In an expression type signature: C a Int => ()
In the expression: undefined :: C a Int => ()
|
10 | x = undefined :: C a Int => ()
| ^^^^^^^^^^^^^
```
The "matching instances" bit of the error messages only lists a single instance. Doesn't it take at least two instances for something to overlap?
Also, following the algorithm laid out in the user guide (section "Overlapping Instances"), it appears this program should be accepted.
<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":"Overlapping instances error with single instance","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\r\n{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances #-}\r\n\r\nmodule Bug where\r\n\r\nclass C a b\r\n\r\ninstance C a Int\r\n\r\nx :: ()\r\nx = undefined :: C a Int => ()\r\n}}}\r\n\r\n{{{\r\nghc -c Bug.hs\r\n\r\nBug.hs:10:18: error:\r\n • Overlapping instances for C a0 Int\r\n Matching givens (or their superclasses):\r\n C a Int\r\n bound by an expression type signature:\r\n forall a. C a Int => ()\r\n at Bug.hs:10:18-30\r\n Matching instances: instance C a Int -- Defined at Bug.hs:7:10\r\n (The choice depends on the instantiation of ‘a0’)\r\n • In the ambiguity check for an expression type signature\r\n To defer the ambiguity check to use sites, enable AllowAmbiguousTypes\r\n In an expression type signature: C a Int => ()\r\n In the expression: undefined :: C a Int => ()\r\n |\r\n10 | x = undefined :: C a Int => ()\r\n | ^^^^^^^^^^^^^\r\n}}}\r\n\r\nThe \"matching instances\" bit of the error messages only lists a single instance. Doesn't it take at least two instances for something to overlap?\r\n\r\nAlso, following the algorithm laid out in the user guide (section \"Overlapping Instances\"), it appears this program should be accepted.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15801"ASSERT failed!" with visible kind applications2019-07-07T18:02:55ZIcelandjack"ASSERT failed!" with visible kind applicationsSorry for the workload mnguyen. This gives a very short error (using diff for visible kind application: https://phabricator.haskell.org/D5229)
```hs
{-# Language CPP #-}
{-# Language QuantifiedConstraints #-}
{-# Langu...Sorry for the workload mnguyen. This gives a very short error (using diff for visible kind application: https://phabricator.haskell.org/D5229)
```hs
{-# Language CPP #-}
{-# Language QuantifiedConstraints #-}
{-# Language TypeApplications #-}
{-# Language PolyKinds #-}
{-# Language TypeOperators #-}
{-# Language DataKinds #-}
{-# Language TypeFamilies #-}
{-# Language TypeSynonymInstances #-}
{-# Language FlexibleInstances #-}
{-# Language GADTs #-}
{-# Language UndecidableInstances #-}
{-# Language MultiParamTypeClasses #-}
{-# Language FlexibleContexts #-}
import Data.Coerce
import Data.Kind
type Cat ob = ob -> ob -> Type
type Obj = Type
class Coercible (op_a --> b) (b <-- op_a) => (op_a -#- b)
instance Coercible (op_a --> b) (b <-- op_a) => (op_a -#- b)
class (forall (op_a :: obj) (b :: obj). op_a -#- b) => OpOpNoOp obj
instance (forall (op_a :: obj) (b :: obj). op_a -#- b) => OpOpNoOp obj
class
Ríki (obj :: Obj) where
type (-->) :: obj -> obj -> Type
ið :: a --> (a::obj)
class
OpOpNoOp obj
=>
OpRíki (obj :: Obj) where
type (<--) :: obj -> obj -> Type
data Op a = Op a
type family UnOp op where UnOp ('Op obj) = obj
newtype Y :: Cat (Op a) where
Y :: (UnOp b --> UnOp a) -> Y a b
instance Ríki Type where
type (-->) = (->)
ið x = x
instance OpRíki (Op Type) where
type (<--) @(Op Type) = Y @Type
```
```
$ ghci -ignore-dot-ghci 577.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 577.hs, interpreted )
*** Exception: ASSERT failed! file compiler/typecheck/TcFlatten.hs, line 1285
>
```
<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 | mnguyen |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"\"ASSERT failed!\" with visible kind applications","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["TypeApplications"],"differentials":[],"test_case":"","architecture":"","cc":["mnguyen"],"type":"Bug","description":"Sorry for the workload mnguyen. This gives a very short error (using diff for visible kind application: https://phabricator.haskell.org/D5229)\r\n\r\n{{{#!hs\r\n{-# Language CPP #-}\r\n{-# Language QuantifiedConstraints #-}\r\n{-# Language TypeApplications #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language TypeOperators #-}\r\n{-# Language DataKinds #-}\r\n{-# Language TypeFamilies #-}\r\n{-# Language TypeSynonymInstances #-}\r\n{-# Language FlexibleInstances #-}\r\n{-# Language GADTs #-}\r\n{-# Language UndecidableInstances #-}\r\n{-# Language MultiParamTypeClasses #-}\r\n{-# Language FlexibleContexts #-}\r\n\r\nimport Data.Coerce\r\nimport Data.Kind\r\n\r\ntype Cat ob = ob -> ob -> Type\r\n\r\ntype Obj = Type\r\n\r\nclass Coercible (op_a --> b) (b <-- op_a) => (op_a -#- b)\r\ninstance Coercible (op_a --> b) (b <-- op_a) => (op_a -#- b)\r\n\r\nclass (forall (op_a :: obj) (b :: obj). op_a -#- b) => OpOpNoOp obj\r\ninstance (forall (op_a :: obj) (b :: obj). op_a -#- b) => OpOpNoOp obj\r\n\r\nclass\r\n Ríki (obj :: Obj) where\r\n type (-->) :: obj -> obj -> Type\r\n\r\n ið :: a --> (a::obj)\r\n\r\nclass\r\n OpOpNoOp obj\r\n =>\r\n OpRíki (obj :: Obj) where\r\n type (<--) :: obj -> obj -> Type\r\n\r\ndata Op a = Op a\r\n\r\ntype family UnOp op where UnOp ('Op obj) = obj\r\n\r\nnewtype Y :: Cat (Op a) where\r\n Y :: (UnOp b --> UnOp a) -> Y a b\r\n\r\ninstance Ríki Type where\r\n type (-->) = (->)\r\n ið x = x\r\n\r\ninstance OpRíki (Op Type) where\r\n type (<--) @(Op Type) = Y @Type\r\n}}}\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci 577.hs\r\nGHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 577.hs, interpreted )\r\n*** Exception: ASSERT failed! file compiler/typecheck/TcFlatten.hs, line 1285\r\n>\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1