GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-08-03T11:16:56Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/15880GHC.Stats: Add info on amount of pinned memory2019-08-03T11:16:56ZNiklas Hambüchenmail@nh2.meGHC.Stats: Add info on amount of pinned memoryhttps://hackage.haskell.org/package/base-4.12.0.0/docs/GHC-Stats.html
`GHC.Stats`'s `GCDetails` tells us, separately, the amount of
- total heap data (including large objects and compact data)
- large ojects
- compact data
- "Total amo...https://hackage.haskell.org/package/base-4.12.0.0/docs/GHC-Stats.html
`GHC.Stats`'s `GCDetails` tells us, separately, the amount of
- total heap data (including large objects and compact data)
- large ojects
- compact data
- "Total amount of memory in use by the RTS" (`gcdetails_mem_in_use_bytes`)
There currently doesn't seem to be a way to get the amount of pinned memory in use.
So some questions:
- Is pinned memory accounted for in `gcdetails_mem_in_use_bytes`?
- If yes, is it pretty much that value minus `gcdetails_live_bytes`, or are there other memory uses that count to the latter?
- If I wanted to add the amount of pinned memory directly to `GHC.Stats`, where would I take that value from?
In general, my goal is to collect _all_ easily (cheaply) collectable memory info so that I can add it to `ekg`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.6.2 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Runtime System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | nh2 |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC.Stats: Add info on amount of pinned memory","status":"New","operating_system":"","component":"Runtime System","related":[],"milestone":"8.6.3","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["nh2"],"type":"Task","description":"https://hackage.haskell.org/package/base-4.12.0.0/docs/GHC-Stats.html\r\n\r\n`GHC.Stats`'s `GCDetails` tells us, separately, the amount of \r\n\r\n* total heap data (including large objects and compact data)\r\n* large ojects\r\n* compact data\r\n* \"Total amount of memory in use by the RTS\" (`gcdetails_mem_in_use_bytes`)\r\n\r\nThere currently doesn't seem to be a way to get the amount of pinned memory in use.\r\n\r\nSo some questions:\r\n\r\n* Is pinned memory accounted for in `gcdetails_mem_in_use_bytes`?\r\n* If yes, is it pretty much that value minus `gcdetails_live_bytes`, or are there other memory uses that count to the latter?\r\n* If I wanted to add the amount of pinned memory directly to `GHC.Stats`, where would I take that value from?\r\n\r\nIn general, my goal is to collect _all_ easily (cheaply) collectable memory info so that I can add it to `ekg`.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15879Make UniqDSet a newtype2019-07-07T18:02:36ZSebastian GrafMake UniqDSet a newtypeFor the same reasons as in #13114 and [D3146](https://phabricator.haskell.org/D3146) we should make `UniqDSet` a newtype of `UniqDFM`.
I wonder if we can also have a prettier `Outputable` instance this way.
<details><summary>Trac metad...For the same reasons as in #13114 and [D3146](https://phabricator.haskell.org/D3146) we should make `UniqDSet` a newtype of `UniqDFM`.
I wonder if we can also have a prettier `Outputable` instance this way.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.2 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Make UniqDSet a newtype","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.3","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"For the same reasons as in #13114 and Phab:D3146 we should make `UniqDSet` a newtype of `UniqDFM`.\r\n\r\nI wonder if we can also have a prettier `Outputable` instance this way.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15878Unused data type with a "deriving" clause is falsely considered used2021-06-17T16:32:40ZEyalLotemUnused data type with a "deriving" clause is falsely considered usedmodule M () where data Foo = Bar deriving (Eq)
If there are no explicit references to Foo and none to Bar, the data-type is necessarily unused, so I expect a warning about an unused data-type.
Even if it is referenced, but only from in...module M () where data Foo = Bar deriving (Eq)
If there are no explicit references to Foo and none to Bar, the data-type is necessarily unused, so I expect a warning about an unused data-type.
Even if it is referenced, but only from instance declarations, it is necessarily unused in the program.
One potential exception is functional dependencies, where the instance declaration itself has an effect. But even then, perhaps it is worth warning that the \*type\* is unused.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Unused data type with a \"deriving\" clause is falsely considered used","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.3","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"module M () where data Foo = Bar deriving (Eq)\r\n\r\nIf there are no explicit references to Foo and none to Bar, the data-type is necessarily unused, so I expect a warning about an unused data-type.\r\n\r\nEven if it is referenced, but only from instance declarations, it is necessarily unused in the program.\r\n\r\nOne potential exception is functional dependencies, where the instance declaration itself has an effect. But even then, perhaps it is worth warning that the *type* is unused.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15877--flavour=quick followed by --flavour=prof fails2020-03-13T16:31:15ZMatthew Pickering--flavour=quick followed by --flavour=prof failsStarting from a clean tree I first built successfully with `--flavour=quick`, I then changed to `--flavour=prof` and the build failed as follows:
```
/root/ghc/_build/stage1/rts/build/libCffi_p.a: copyFile: does not exist (No such file ...Starting from a clean tree I first built successfully with `--flavour=quick`, I then changed to `--flavour=prof` and the build failed as follows:
```
/root/ghc/_build/stage1/rts/build/libCffi_p.a: copyFile: does not exist (No such file or directory)
shakeArgsWith 0.010s 0%
Function shake 0.435s 0%
Database read 0.670s 0%
With database 0.035s 0%
Running rules 123.401s 99% =========================
Total 124.551s 100%
Error when running Shake build system:
at src/Rules.hs:(32,19)-(45,17):
at src/Rules.hs:45:5-17:
* Depends on: _build/stage1/lib/package.conf.d/rts-1.0.conf
* Raised the exception:
ExitFailure 1
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------------- |
| Version | 8.6.2 |
| 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":"--flavour=quick followed by --flavour=prof fails","status":"New","operating_system":"","component":"Build System (Hadrian)","related":[],"milestone":"8.6.3","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Starting from a clean tree I first built successfully with `--flavour=quick`, I then changed to `--flavour=prof` and the build failed as follows:\r\n\r\n{{{\r\n/root/ghc/_build/stage1/rts/build/libCffi_p.a: copyFile: does not exist (No such file or directory)\r\nshakeArgsWith 0.010s 0% \r\nFunction shake 0.435s 0% \r\nDatabase read 0.670s 0% \r\nWith database 0.035s 0% \r\nRunning rules 123.401s 99% =========================\r\nTotal 124.551s 100% \r\nError when running Shake build system:\r\n at src/Rules.hs:(32,19)-(45,17):\r\n at src/Rules.hs:45:5-17:\r\n* Depends on: _build/stage1/lib/package.conf.d/rts-1.0.conf\r\n* Raised the exception:\r\nExitFailure 1\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->Make removalhttps://gitlab.haskell.org/ghc/ghc/-/issues/15876Function versioning instead of compilation flags...2019-07-07T18:02:36ZMichalGajdaFunction versioning instead of compilation flags...Wanting to take advantage of SIMD, we need to compile a different implementation of certain core libraries functions (like `ByteString` c_memchr to make it 16x faster).
This would require recompiling most of the libraries for new flags....Wanting to take advantage of SIMD, we need to compile a different implementation of certain core libraries functions (like `ByteString` c_memchr to make it 16x faster).
This would require recompiling most of the libraries for new flags.
Instead, it would be much simpler to add function versioning a la GCC: https://lwn.net/Articles/691932/
This would allow us to write code like this:
{-\# target(avx512) \#-}
c_memchr = ...SIMD code...
{-\# !target(avx512) \#-}
c_memchr = ...current code...
We currently use special libraries for these kind of speedups, but it would be much better to use SIMD across few key functions in all libraries to get 16x speedups across the board (`c_memchr` for parsing.)
Ideally we could also use it to remove some of _flavoring_ in the future.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------------------- |
| Version | 8.6.2 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Linking) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | abhir00p, marlowsd@gmail.com |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Function versioning instead of compilation flags...","status":"New","operating_system":"","component":"Compiler (Linking)","related":[],"milestone":"8.6.3","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":["flavors,","simd,","speed"],"differentials":[],"test_case":"","architecture":"","cc":["abhir00p","marlowsd@gmail.com"],"type":"FeatureRequest","description":"Wanting to take advantage of SIMD, we need to compile a different implementation of certain core libraries functions (like `ByteString` c_memchr to make it 16x faster).\r\n\r\nThis would require recompiling most of the libraries for new flags.\r\n\r\nInstead, it would be much simpler to add function versioning a la GCC: https://lwn.net/Articles/691932/\r\n\r\nThis would allow us to write code like this:\r\n{-# target(avx512) #-}\r\nc_memchr = ...SIMD code...\r\n{-# !target(avx512) #-}\r\nc_memchr = ...current code...\r\n\r\nWe currently use special libraries for these kind of speedups, but it would be much better to use SIMD across few key functions in all libraries to get 16x speedups across the board (`c_memchr` for parsing.)\r\n\r\nIdeally we could also use it to remove some of _flavoring_ in the future.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15875Detection of ranlib by binary distribution is broken2019-07-07T18:02:37ZBen GamariDetection of ranlib by binary distribution is brokenThe `configure` shipped with binary distributions fails to set `RanlibCmd` which therefore means that we end up installing `settings` with an empty `ranlib command` configuration field.
<details><summary>Trac metadata</summary>
| Trac ...The `configure` shipped with binary distributions fails to set `RanlibCmd` which therefore means that we end up installing `settings` with an empty `ranlib command` configuration field.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Detection of ranlib by binary distribution is broken","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.3","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The `configure` shipped with binary distributions fails to set `RanlibCmd` which therefore means that we end up installing `settings` with an empty `ranlib command` configuration field.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15874Data families with higher-rank kinds2019-07-07T18:02:37ZIcelandjackData families with higher-rank kinds```hs
{-# Language RankNTypes #-}
{-# Language DataKinds #-}
{-# Language PolyKinds #-}
{-# Language GADTs #-}
{-# Language TypeFamilies #-}
import Data.Kind
data Var where
Op :: Var
Id :: Var
-- type family
-- Fl...```hs
{-# Language RankNTypes #-}
{-# Language DataKinds #-}
{-# Language PolyKinds #-}
{-# Language GADTs #-}
{-# Language TypeFamilies #-}
import Data.Kind
data Var where
Op :: Var
Id :: Var
-- type family
-- Flip (var :: Var) = (res :: Var) | res -> var where
-- Flip Op = Id
-- Flip Id = Op
type Varianced = (forall (var :: Var). Type)
-- data A :: Varianced where
-- MkA :: Int -> A @Id
-- data OpA :: Varianced where
-- MkOpA :: Int -> OpA @Op
-- data Exp :: Varianced -> Varianced where
-- X :: forall (ext::Varianced) (var :: Var). Exp ext @var
-- OpExp1 :: forall (var :: Varianced). var @op -> Exp var @(Flip op)
data family Parser :: Varianced
data instance Parser = P
```
```
$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci 656.hs
GHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 656.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181029 for x86_64-unknown-linux):
ASSERT failed!
kind axiom D:R:Parservar0 ::
Parser = R:Parservar -- Defined at 656.hs:31:15
forall (var :: Var). *
Var -> *
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/FamInst.hs:158:61 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.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":"Data families with higher-rank kinds","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!hs\r\n{-# Language RankNTypes #-}\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\ndata Var where\r\n Op :: Var\r\n Id :: Var\r\n\r\n-- type family\r\n-- Flip (var :: Var) = (res :: Var) | res -> var where\r\n-- Flip Op = Id\r\n-- Flip Id = Op\r\n\r\ntype Varianced = (forall (var :: Var). Type)\r\n\r\n-- data A :: Varianced where\r\n-- MkA :: Int -> A @Id\r\n\r\n-- data OpA :: Varianced where\r\n-- MkOpA :: Int -> OpA @Op\r\n\r\n-- data Exp :: Varianced -> Varianced where\r\n-- X :: forall (ext::Varianced) (var :: Var). Exp ext @var\r\n -- OpExp1 :: forall (var :: Varianced). var @op -> Exp var @(Flip op)\r\n\r\ndata family Parser :: Varianced\r\ndata instance Parser = P\r\n}}}\r\n\r\n{{{\r\n$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci 656.hs\r\nGHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 656.hs, interpreted )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181029 for x86_64-unknown-linux):\r\n ASSERT failed!\r\n kind axiom D:R:Parservar0 ::\r\n Parser = R:Parservar -- Defined at 656.hs:31:15\r\n forall (var :: Var). *\r\n Var -> *\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/FamInst.hs:158:61 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":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15873move to llvm 7 for 8.8.12019-07-07T18:02:37Zgeorge.colpittsmove to llvm 7 for 8.8.1<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.2 |
| Type | Task |
| TypeOfFailure |...<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.2 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"move to llvm 7 for 8.8.1","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15872Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>)2019-07-07T18:02:37ZIcelandjackOdd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>)Maybe indicative of deeper issues:
```hs
{-# Language RankNTypes #-}
{-# Language DataKinds #-}
{-# Language PolyKinds #-}
{-# Language GADTs #-}
import Data.Kind
data WHICH = OP | OPOP
data Fun :: forall (a :: WHICH). a ~ OP ...Maybe indicative of deeper issues:
```hs
{-# Language RankNTypes #-}
{-# Language DataKinds #-}
{-# Language PolyKinds #-}
{-# Language GADTs #-}
import Data.Kind
data WHICH = OP | OPOP
data Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where
MkFun :: (a -> b) -> Fun a b
```
There are some artifacts `Fun ('GHC.Type.Eq# <>)` in the type of `MkFun` that shouldn't be there
```
$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci ~/hs/655_bug.hs
GHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /home/baldur/hs/655_bug.hs, interpreted )
Ok, one module loaded.
*Main> :t MkFun
MkFun :: (a -> b) -> Fun ('GHC.Types.Eq# <>) a b
*Main> :k Fun
Fun :: (a ~ 'OP) => * -> * -> *
*Main>
```
----
Tangent: Omitting `{-# Language GADTs #-}` we get the term "equational constraint" which is not the term I have seen in the wild
```
$ latestbug 655_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 655_bug.hs, interpreted )
655_bug.hs:9:1: error:
Illegal equational constraint a ~ 'OP
(Use GADTs or TypeFamilies to permit this)
|
9 | data Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
Failed, no modules loaded.
Prelude>
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Maybe indicative of deeper issues:\r\n\r\n{{{#!hs\r\n{-# Language RankNTypes #-}\r\n{-# Language DataKinds #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language GADTs #-}\r\n\r\nimport Data.Kind\r\n\r\ndata WHICH = OP | OPOP\r\n\r\ndata Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where\r\n MkFun :: (a -> b) -> Fun a b\r\n}}}\r\n\r\nThere are some artifacts `Fun ('GHC.Type.Eq# <>)` in the type of `MkFun` that shouldn't be there\r\n\r\n{{{\r\n$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci ~/hs/655_bug.hs\r\nGHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( /home/baldur/hs/655_bug.hs, interpreted )\r\nOk, one module loaded.\r\n*Main> :t MkFun\r\nMkFun :: (a -> b) -> Fun ('GHC.Types.Eq# <>) a b\r\n*Main> :k Fun\r\nFun :: (a ~ 'OP) => * -> * -> *\r\n*Main>\r\n}}}\r\n\r\n----\r\n\r\nTangent: Omitting `{-# Language GADTs #-}` we get the term \"equational constraint\" which is not the term I have seen in the wild\r\n\r\n{{{\r\n$ latestbug 655_bug.hs\r\nGHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 655_bug.hs, interpreted )\r\n\r\n655_bug.hs:9:1: error:\r\n Illegal equational constraint a ~ 'OP\r\n (Use GADTs or TypeFamilies to permit this)\r\n |\r\n9 | data Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...\r\nFailed, no modules loaded.\r\nPrelude>\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/15871Revamp -fprint-explicit-kinds2019-07-07T18:02:38ZRichard Eisenbergrae@richarde.devRevamp -fprint-explicit-kindsWith the imminent #12045, we will have type application in kinds. This ticket tracks mirroring this new behavior in the pretty-printer.
To wit, when `-fprint-explicit-kinds` is enabled, we should
1. Print instantiations of specified va...With the imminent #12045, we will have type application in kinds. This ticket tracks mirroring this new behavior in the pretty-printer.
To wit, when `-fprint-explicit-kinds` is enabled, we should
1. Print instantiations of specified variables like `@...`.
1. Print instantiations of inferred variables like `@{...}`.
Examples:
```hs
data Proxy (a :: k) = Proxy
-- Then, `Proxy Int` would be printed as `Proxy @Type Int` with -fprint-explicit-kinds
data Proxy2 a = Proxy2
-- Then, `Proxy2 Int` would be printed as `Proxy2 @{Type} Int` with -fprint-explicit-kinds
```
In addition, sometimes error messages suggest enabling `-fprint-explicit-kinds`. Instead of doing this, we should just locally enable the flag. The existence of the `@` prefixes will alert the reader that these are not type arguments. (Without the `@` syntax, locally and silently enabling `-fprint-explicit-kinds` would be very confusing.)
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.2 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Revamp -fprint-explicit-kinds","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"With the imminent #12045, we will have type application in kinds. This ticket tracks mirroring this new behavior in the pretty-printer.\r\n\r\nTo wit, when `-fprint-explicit-kinds` is enabled, we should\r\n\r\n1. Print instantiations of specified variables like `@...`.\r\n\r\n2. Print instantiations of inferred variables like `@{...}`.\r\n\r\nExamples:\r\n\r\n{{{#!hs\r\ndata Proxy (a :: k) = Proxy\r\n -- Then, `Proxy Int` would be printed as `Proxy @Type Int` with -fprint-explicit-kinds\r\n\r\ndata Proxy2 a = Proxy2\r\n -- Then, `Proxy2 Int` would be printed as `Proxy2 @{Type} Int` with -fprint-explicit-kinds\r\n}}}\r\n\r\nIn addition, sometimes error messages suggest enabling `-fprint-explicit-kinds`. Instead of doing this, we should just locally enable the flag. The existence of the `@` prefixes will alert the reader that these are not type arguments. (Without the `@` syntax, locally and silently enabling `-fprint-explicit-kinds` would be very confusing.)","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15870No skolem info panic2019-07-07T18:02:38Zsheafsam.derbyshire@gmail.comNo skolem info panicI've been toying with some type-level lenses and running into some issues with kind unification, when I ran into a panic:
```
bug.hs:30:34: error:ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.6.2 for x86_64-unknown-mingw3...I've been toying with some type-level lenses and running into some issues with kind unification, when I ran into a panic:
```
bug.hs:30:34: error:ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.6.2 for x86_64-unknown-mingw32):
No skolem info:
[k_a1Hgj]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\utils\Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler\\typecheck\\TcErrors.hs:2891:5 in ghc:TcErrors
```
Here's a boiled down version (with a bit of extraneous code left in for context, as it's so short):
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
data Optic a where
--Index :: Nat -> Optic a
--Name :: Symbol -> Optic a
(:.:) :: Optic a -> Optic b -> Optic a -- composition
class Gettable a (optic :: Optic a) where
type Get a (optic :: Optic a)
{-
some basic instances, e.g.
instance Gettable (a,b) (Index 0) where
type Get (a,b) (Index 0) = a
...
-}
instance forall a b (g1 :: Optic a) (g2 :: Optic b).
( Gettable a g1
, b ~ Get a g1
, Gettable b g2
) => Gettable a (g1 :.: g2) where
type Get a (g1 :.: g2) = Get a g2
```
The program I am actually trying to write has the instance declaration changed to
```hs
instance forall a b (g1 :: Optic a) (g2 :: Optic (Get a g1)).
( Gettable a g1
, b ~ Get a g1
, Gettable b g2
) => Gettable a (g1 :.: g2) where
type Get a (g1 :.: g2) = Get (Get a g1) g2
```
but GHC complains that it can't match kinds:
```
• Expected kind ‘Optic b’, but ‘g2’ has kind ‘Optic (Get a g1)’
• In the second argument of ‘Gettable’, namely ‘g2’
In the instance declaration for ‘Gettable a (g1 :.: g2)’
|
20 | , Gettable b g2
|
```
I don't know if there is a way around that, and I'd be interested to hear any advice.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.6.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"No skolem info panic","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I've been toying with some type-level lenses and running into some issues with kind unification, when I ran into a panic:\r\n\r\n\r\n{{{\r\nbug.hs:30:34: error:ghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.6.2 for x86_64-unknown-mingw32):\r\n No skolem info:\r\n [k_a1Hgj]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler\\utils\\Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler\\\\typecheck\\\\TcErrors.hs:2891:5 in ghc:TcErrors\r\n}}}\r\n\r\nHere's a boiled down version (with a bit of extraneous code left in for context, as it's so short):\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE MultiParamTypeClasses #-}\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n\r\ndata Optic a where\r\n --Index :: Nat -> Optic a\r\n --Name :: Symbol -> Optic a\r\n (:.:) :: Optic a -> Optic b -> Optic a -- composition\r\n\r\nclass Gettable a (optic :: Optic a) where\r\n type Get a (optic :: Optic a)\r\n\r\n{-\r\nsome basic instances, e.g.\r\ninstance Gettable (a,b) (Index 0) where\r\n type Get (a,b) (Index 0) = a\r\n...\r\n-}\r\n\r\ninstance forall a b (g1 :: Optic a) (g2 :: Optic b).\r\n ( Gettable a g1\r\n , b ~ Get a g1\r\n , Gettable b g2\r\n ) => Gettable a (g1 :.: g2) where\r\n type Get a (g1 :.: g2) = Get a g2\r\n}}}\r\n\r\nThe program I am actually trying to write has the instance declaration changed to\r\n{{{#!hs\r\ninstance forall a b (g1 :: Optic a) (g2 :: Optic (Get a g1)).\r\n ( Gettable a g1\r\n , b ~ Get a g1\r\n , Gettable b g2\r\n ) => Gettable a (g1 :.: g2) where\r\n type Get a (g1 :.: g2) = Get (Get a g1) g2\r\n}}}\r\nbut GHC complains that it can't match kinds:\r\n\r\n{{{\r\n • Expected kind ‘Optic b’, but ‘g2’ has kind ‘Optic (Get a g1)’\r\n • In the second argument of ‘Gettable’, namely ‘g2’\r\n In the instance declaration for ‘Gettable a (g1 :.: g2)’\r\n |\r\n20 | , Gettable b g2\r\n |\r\n}}}\r\nI don't know if there is a way around that, and I'd be interested to hear any advice.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15869Discrepancy between seemingly equivalent type synonym and type family2019-07-07T18:02:38ZRyan ScottDiscrepancy between seemingly equivalent type synonym and type familyConsider the following code:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE LiberalTypeSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
module Bug wher...Consider the following code:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE LiberalTypeSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
module Bug where
import Data.Kind
type KindOf1 (a :: k) = k
type family KindOf2 (a :: k) :: Type where
KindOf2 (a :: k) = k
data A (a :: Type) :: a -> Type
type family Apply1 (f :: KindOf1 A) (a :: Type) (x :: a) :: Type where
Apply1 f a x = f a x
```
`Apply1` kind-checks, which is just peachy. Note that `Apply1` uses `KindOf1`, which is a type synonym. Suppose I wanted to swap out `KindOf1` for `KindOf2`, which is (seemingly) an equivalent type family. I can define this:
```hs
type family Apply2 (f :: KindOf2 A) -- (f :: forall a -> a -> Type)
(a :: Type)
(x :: a)
:: Type where
Apply2 f a x = f a x
```
However, GHC rejects this!
```
$ /opt/ghc/8.6.2/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:25:10: error:
• Expecting two more arguments to ‘f’
Expected kind ‘KindOf2 A’, but ‘f’ has kind ‘* -> a -> *’
• In the first argument of ‘Apply2’, namely ‘f’
In the type family declaration for ‘Apply2’
|
25 | Apply2 f a x = f a x
| ^
```
I find this quite surprising, since I would have expected `KindOf1` and `KindOf2` to be functionally equivalent. Even providing explicit `forall`s does not make it kind-check:
```hs
type family Apply2 (f :: KindOf2 A) -- (f :: forall a -> a -> Type)
(a :: Type)
(x :: a)
:: Type where
forall (f :: KindOf2 A) (a :: Type) (x :: a).
Apply2 f a x = f a x
```
Although the error message does change a bit:
```
$ ~/Software/ghc3/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:26:20: error:
• Expected kind ‘* -> a -> *’, but ‘f’ has kind ‘KindOf2 A’
• In the type ‘f a x’
In the type family declaration for ‘Apply2’
|
26 | Apply2 f a x = f a x
| ^^^^^
```https://gitlab.haskell.org/ghc/ghc/-/issues/15868Standard deriving should be less conservative when `UndecidableInstances` is ...2019-07-22T17:04:42Zedsko@edsko.netStandard deriving should be less conservative when `UndecidableInstances` is enabledThe following program
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Exp where
...The following program
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Exp where
type family F a
data T a = MkT (F a)
deriving instance Eq (F a) => Eq (T a)
data T2 a = T2 (T a)
deriving (Eq)
```
results in a type error
```
• No instance for (Eq (F a))
arising from the first field of ‘T2’ (type ‘T a’)
```
According the manual this is expected behaviour (https://downloads.haskell.org/\~ghc/latest/docs/html/users_guide/glasgow_exts.html\#inferred-context-for-deriving-clauses), but it is unfortunate; it seems to me that there is no deep reason that this instance should be rejected, other than an overly conservative check in the deriving machinery; I propose that this check is relaxed when the `UndecidableInstances` extension is enabled. Mind that I'm *not* proposing that it should also be able to infer the right constraints for `T` itself; but once I write such an explicit context myself once (for `T`), it seems to me that deriving the *same* constraints also for `T2` should be easy.
Note that right now we can work-around this problem using
```hs
class Eq (F a) => EqF a
deriving instance EqF a => Eq (T a)
data T2 a = T2 (T a)
deriving (Eq)
```
Normally however for such a class synonym we would then provide a single "authoritative" instance:
```hs
class Eq (F a) => EqF a
instance Eq (F a) => EqF a
```
but if we do that then we are back at the same error for `T2`, because ghc will go from the `EqF a` constraint to the `Eq (F a)` constraint, and then refuse to add that constraint.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.6.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Standard deriving should be less conservative when `UndecidableInstances` is enabled","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"The following program\r\n\r\n{{{#!hs\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE StandaloneDeriving #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE UndecidableInstances #-}\r\n\r\nmodule Exp where\r\n\r\ntype family F a\r\n\r\ndata T a = MkT (F a)\r\n\r\nderiving instance Eq (F a) => Eq (T a)\r\n\r\ndata T2 a = T2 (T a)\r\n deriving (Eq)\r\n}}}\r\n\r\nresults in a type error\r\n\r\n{{{\r\n • No instance for (Eq (F a))\r\n arising from the first field of ‘T2’ (type ‘T a’)\r\n}}}\r\n\r\nAccording the manual this is expected behaviour (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#inferred-context-for-deriving-clauses), but it is unfortunate; it seems to me that there is no deep reason that this instance should be rejected, other than an overly conservative check in the deriving machinery; I propose that this check is relaxed when the `UndecidableInstances` extension is enabled. Mind that I'm ''not'' proposing that it should also be able to infer the right constraints for `T` itself; but once I write such an explicit context myself once (for `T`), it seems to me that deriving the ''same'' constraints also for `T2` should be easy.\r\n\r\nNote that right now we can work-around this problem using\r\n\r\n{{{#!hs\r\nclass Eq (F a) => EqF a\r\n\r\nderiving instance EqF a => Eq (T a)\r\n\r\ndata T2 a = T2 (T a)\r\n deriving (Eq)\r\n}}}\r\n\r\nNormally however for such a class synonym we would then provide a single \"authoritative\" instance:\r\n\r\n{{{#!hs\r\nclass Eq (F a) => EqF a\r\ninstance Eq (F a) => EqF a\r\n}}}\r\n\r\nbut if we do that then we are back at the same error for `T2`, because ghc will go from the `EqF a` constraint to the `Eq (F a)` constraint, and then refuse to add that constraint. ","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15867STG scope error2019-07-07T18:02:39ZCsaba HruskaSTG scope errorStgRhsClosure can contain duplicated names in its free variable and argument list.
Example bug: libraries/integer-gmp/src/GHC/Integer/Type.hs
GHC HEAD and 8.2.2 has this issue.
I have not checked with other versions.
I've extended th...StgRhsClosure can contain duplicated names in its free variable and argument list.
Example bug: libraries/integer-gmp/src/GHC/Integer/Type.hs
GHC HEAD and 8.2.2 has this issue.
I have not checked with other versions.
I've extended the STG linter to do scope checking. See the patch attached.
To reproduce:
- patch GHC head: `git apply StgScopeCheck.patch`
- make sure every compiled stg is linted: add the following to `mk/build.mk`\\\\
```
GhcStage2HcOpts += -dstg-lint
GhcLibHcOpts += -dstg-lint
GhcRtsHcOpts += -dstg-lint
```
- compile GHC HEAD
Background info:
I've found this issue because I'm using GHC as a Haskell fronted for my whole program compiler project. I work on The GRIN Compiler (https://github.com/grin-tech) where GHC/GRIN compiles STG to GRIN. Sebastian GrafSebastian Grafhttps://gitlab.haskell.org/ghc/ghc/-/issues/15866libiserv's version number is hard-coded2020-09-28T07:11:37ZRyan Scottlibiserv's version number is hard-codedI recently discovered that GHC 8.6.2 was shipped with `libiserv-8.6.1`. Yes, you read that correctly—8.6.1, not 8.6.2. I was baffled at how this could possibly happen until I realized that we hard-code the version number for `libiserv` d...I recently discovered that GHC 8.6.2 was shipped with `libiserv-8.6.1`. Yes, you read that correctly—8.6.1, not 8.6.2. I was baffled at how this could possibly happen until I realized that we hard-code the version number for `libiserv` directly in its `.cabal` file.
Needless to say, this is quite easy to forget to update. Let's let `autoconf` do the hard work for us and use `@ProjectVersionMunged@` instead.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"libiserv's version number is hard-coded","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I recently discovered that GHC 8.6.2 was shipped with `libiserv-8.6.1`. Yes, you read that correctly—8.6.1, not 8.6.2. I was baffled at how this could possibly happen until I realized that we hard-code the version number for `libiserv` directly in its `.cabal` file.\r\n\r\nNeedless to say, this is quite easy to forget to update. Let's let `autoconf` do the hard work for us and use `@ProjectVersionMunged@` instead.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15865Typed template haskell and implicit parameters lead to incorrect results2020-10-30T19:29:43ZMatthew PickeringTyped template haskell and implicit parameters lead to incorrect resultsIn a similar vein to #15863 but this time with implicit parameters.
https://gist.github.com/b6919b13abe0954fdad844e16e0edb48
```
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE TemplateHaskell #-}
module A where
import Language.Haskell.T...In a similar vein to #15863 but this time with implicit parameters.
https://gist.github.com/b6919b13abe0954fdad844e16e0edb48
```
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE TemplateHaskell #-}
module A where
import Language.Haskell.TH
import Data.List (sortBy)
sort :: (?cmp :: a -> a -> Ordering) => [a] -> [a]
sort = sortBy ?cmp
me :: Q (TExp ([Int] -> [Int]))
me = let ?cmp = compare in [|| sort ||]
```
In module `A` we quote a value which has an implicit argument but in its context we bind the implicit so the type of the quote is the monomorphic type.
```
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE TemplateHaskell #-}
module B where
import A
foo :: [Int] -> [Int]
foo =
--let ?cmp = compare in
$$(me)
```
When we splice in `me`, we get an error about an unbound implicit parameter which is totally bogus as we already bound it in `A`. There is also dynamic binding if another implicit parameter with the same name is in scope but the type of `me` mentions nothing about implicit parameters so this shouldn't be allowed.
```
B.hs:8:10: error:
• Unbound implicit parameter (?cmp::Int -> Int -> Ordering)
arising from a use of ‘sort’
• In the expression: sort
In the result of the splice:
$me
To see what the splice expanded to, use -ddump-splices
In the Template Haskell splice $$(me)
|
8 | foo = $$(me)
| ^^
Failed, one module loaded.
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Typed template haskell and implicit parameters lead to incorrect results","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"In a similar vein to #15863 but this time with implicit parameters.\r\n\r\nhttps://gist.github.com/b6919b13abe0954fdad844e16e0edb48\r\n\r\n{{{\r\n{-# LANGUAGE ImplicitParams #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule A where\r\n\r\nimport Language.Haskell.TH\r\nimport Data.List (sortBy)\r\n\r\n\r\nsort :: (?cmp :: a -> a -> Ordering) => [a] -> [a]\r\nsort = sortBy ?cmp\r\n\r\nme :: Q (TExp ([Int] -> [Int]))\r\nme = let ?cmp = compare in [|| sort ||]\r\n}}}\r\n\r\nIn module `A` we quote a value which has an implicit argument but in its context we bind the implicit so the type of the quote is the monomorphic type.\r\n\r\n{{{\r\n{-# LANGUAGE ImplicitParams #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule B where\r\n\r\nimport A\r\n\r\nfoo :: [Int] -> [Int]\r\nfoo =\r\n --let ?cmp = compare in\r\n $$(me)\r\n}}}\r\n\r\nWhen we splice in `me`, we get an error about an unbound implicit parameter which is totally bogus as we already bound it in `A`. There is also dynamic binding if another implicit parameter with the same name is in scope but the type of `me` mentions nothing about implicit parameters so this shouldn't be allowed.\r\n\r\n{{{\r\nB.hs:8:10: error:\r\n • Unbound implicit parameter (?cmp::Int -> Int -> Ordering)\r\n arising from a use of ‘sort’\r\n • In the expression: sort\r\n In the result of the splice:\r\n $me\r\n To see what the splice expanded to, use -ddump-splices\r\n In the Template Haskell splice $$(me)\r\n |\r\n8 | foo = $$(me)\r\n | ^^\r\nFailed, one module loaded.\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15864Fix Int8#, Int16#, Word8#, Word16# tests under LLVM code generator2019-07-07T18:02:39ZBen GamariFix Int8#, Int16#, Word8#, Word16# tests under LLVM code generatorUnfortunately it looks like LLVM doesn't like that we use `bitcast` to narrow integers. E.g. `CmpWord8` currently fails with:
```
=====> CmpWord8(llvm) 18 of 23 [0, 6, 0]
cd "primops/should_run/CmpWord8.run" && "/mnt/work/ghc/ghc-compa...Unfortunately it looks like LLVM doesn't like that we use `bitcast` to narrow integers. E.g. `CmpWord8` currently fails with:
```
=====> CmpWord8(llvm) 18 of 23 [0, 6, 0]
cd "primops/should_run/CmpWord8.run" && "/mnt/work/ghc/ghc-compare-1/inplace/test spaces/ghc-stage2" -o CmpWord8 CmpWord8.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output -fllvm
Compile failed (exit code 1) errors were:
[1 of 1] Compiling Main ( CmpInt8.hs, CmpInt8.o )
opt: /run/user/1000/ghc32287_0/ghc_2.ll:14549:20: error: invalid cast opcode for cast from 'i64' to 'i8'
%ln6uE = bitcast i64 %ln6uD to i8
^
`opt' failed in phase `LLVM Optimiser'. (Exit code: 1)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | --------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (LLVM) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | michalt |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Fix Int8#, Int16#, Word8#, Word16# tests under LLVM code generator","status":"New","operating_system":"","component":"Compiler (LLVM)","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["michalt"],"type":"Bug","description":"Unfortunately it looks like LLVM doesn't like that we use `bitcast` to narrow integers. E.g. `CmpWord8` currently fails with:\r\n{{{\r\n=====> CmpWord8(llvm) 18 of 23 [0, 6, 0]\r\ncd \"primops/should_run/CmpWord8.run\" && \"/mnt/work/ghc/ghc-compare-1/inplace/test spaces/ghc-stage2\" -o CmpWord8 CmpWord8.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output -fllvm \r\nCompile failed (exit code 1) errors were:\r\n[1 of 1] Compiling Main ( CmpInt8.hs, CmpInt8.o )\r\nopt: /run/user/1000/ghc32287_0/ghc_2.ll:14549:20: error: invalid cast opcode for cast from 'i64' to 'i8'\r\n %ln6uE = bitcast i64 %ln6uD to i8\r\n ^\r\n`opt' failed in phase `LLVM Optimiser'. (Exit code: 1)\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15863Splicing a type class method selects the wrong instance2019-07-07T18:02:40ZMatthew PickeringSplicing a type class method selects the wrong instanceConsider these 4 modules as concocted by Csongor.
The wrong instance is selected when you splice in `B.me` into `D`.
https://gist.github.com/mpickering/959a95525647802414ab50e8e6ed490c
```
module A where
class C a where
foo :: a ->...Consider these 4 modules as concocted by Csongor.
The wrong instance is selected when you splice in `B.me` into `D`.
https://gist.github.com/mpickering/959a95525647802414ab50e8e6ed490c
```
module A where
class C a where
foo :: a -> String
instance C Int where
foo _ = "int"
```
```
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module B where
import A
import Language.Haskell.TH
instance C a => C [a] where
foo _ = "list"
me :: Q (TExp ([Int] -> String))
me = [|| foo ||]
```
```
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module C where
import A
import Language.Haskell.TH
instance {-# OVERLAPPING #-} C [Int] where
foo _ = "list2"
```
```
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module D where
import A
import B
import C
main2 = $$(me) [1 :: Int]
```
```
>>> main2
"list2"
```
In `B`, `B.me` is created by quoting `foo`. `B.me :: Q (TExp ([Int] -> String))` so in order to type check this quote we need to solve the instance `C [Int]` which we should do by using the instance defined in `B` (and `A`).
In module `C` we define a different overlapping instance (note that this could be in a completely different library not under our control).
When we then splice `B.me` into `D`, the instance from `C` is used and can be witnessed by printing `main2` which shows `"list2"` rather than `"list"` as expected.
This is a symptom of the fact that the renamed rather than the typechecked AST is serialised I think.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Splcing a type class method selects the wrong instance","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider these 4 modules as concocted by Csongor. \r\n\r\nThe wrong instance is selected when you splice in `B.me` into `D`.\r\n\r\nhttps://gist.github.com/mpickering/959a95525647802414ab50e8e6ed490c\r\n\r\n{{{\r\nmodule A where\r\n\r\nclass C a where\r\n foo :: a -> String\r\n\r\ninstance C Int where\r\nfoo _ = \"int\"\r\n}}}\r\n\r\n{{{\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# LANGUAGE NoMonomorphismRestriction #-}\r\nmodule B where\r\n\r\nimport A\r\n\r\nimport Language.Haskell.TH\r\n\r\ninstance C a => C [a] where\r\n foo _ = \"list\"\r\n\r\nme :: Q (TExp ([Int] -> String))\r\nme = [|| foo ||]\r\n}}}\r\n\r\n{{{\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# LANGUAGE NoMonomorphismRestriction #-}\r\nmodule C where\r\n\r\nimport A\r\n\r\nimport Language.Haskell.TH\r\n\r\ninstance {-# OVERLAPPING #-} C [Int] where\r\nfoo _ = \"list2\"\r\n}}}\r\n\r\n{{{\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# LANGUAGE NoMonomorphismRestriction #-}\r\nmodule D where\r\n\r\nimport A\r\nimport B\r\nimport C\r\n\r\nmain2 = $$(me) [1 :: Int]\r\n}}}\r\n\r\n{{{\r\n>>> main2\r\n\"list2\"\r\n}}}\r\n\r\n\r\nIn `B`, `B.me` is created by quoting `foo`. `B.me :: Q (TExp ([Int] -> String))` so in order to type check this quote we need to solve the instance `C [Int]` which we should do by using the instance defined in `B` (and `A`). \r\n\r\nIn module `C` we define a different overlapping instance (note that this could be in a completely different library not under our control).\r\n\r\nWhen we then splice `B.me` into `D`, the instance from `C` is used and can be witnessed by printing `main2` which shows `\"list2\"` rather than `\"list\"` as expected.\r\n\r\nThis is a symptom of the fact that the renamed rather than the typechecked AST is serialised I think.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15862Panic with promoted types that Typeable doesn't support2020-02-25T01:15:47ZRyan ScottPanic with promoted types that Typeable doesn't supportThe following program panics on GHC 8.2 and later:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
module Bug where
import Type.Reflection
newtype Foo ...The following program panics on GHC 8.2 and later:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
module Bug where
import Type.Reflection
newtype Foo = MkFoo (forall a. a)
foo :: TypeRep MkFoo
foo = typeRep @MkFoo
```
```
$ /opt/ghc/8.6.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
GHC error in desugarer lookup in Bug:
attempting to use module ‘main:Bug’ (Bug.hs) which is not loaded
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-unknown-linux):
initDs
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Typeable panic with promoted rank-2 kind (initDs)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["Typeable"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program panics on GHC 8.2 and later:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE ImpredicativeTypes #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE TypeApplications #-}\r\nmodule Bug where\r\n\r\nimport Type.Reflection\r\n\r\nnewtype Foo = MkFoo (forall a. a)\r\n\r\nfoo :: TypeRep MkFoo\r\nfoo = typeRep @MkFoo\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nGHC error in desugarer lookup in Bug:\r\n attempting to use module ‘main:Bug’ (Bug.hs) which is not loaded\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-unknown-linux):\r\n initDs\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Ryan ScottRyan Scotthttps://gitlab.haskell.org/ghc/ghc/-/issues/15861Cannot import (*) type operator2019-07-07T18:02:40ZPreetham GujjulaCannot import (*) type operatorThe (\*) type operator cannot be imported from GHC.TypeLits. The following code compiles in GHC 8.4.4 but fails in GHC 8.6.1 with "error: parse error on input ‘\*’"
```hs
{-# LANGUAGE TypeOperators #-}
import GHC.TypeLits (type (*))
```...The (\*) type operator cannot be imported from GHC.TypeLits. The following code compiles in GHC 8.4.4 but fails in GHC 8.6.1 with "error: parse error on input ‘\*’"
```hs
{-# LANGUAGE TypeOperators #-}
import GHC.TypeLits (type (*))
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Cannot import (*) type operator","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The (*) type operator cannot be imported from GHC.TypeLits. The following code compiles in GHC 8.4.4 but fails in GHC 8.6.1 with \"error: parse error on input ‘*’\"\r\n\r\n{{{#!hs\r\n{-# LANGUAGE TypeOperators #-}\r\nimport GHC.TypeLits (type (*))\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->