GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2023-10-20T10:15:57Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/15832fprintCCS_stderr (+RTS -xc) should be able to traverse into stacks that evalu...2023-10-20T10:15:57Zinfinity0fprintCCS_stderr (+RTS -xc) should be able to traverse into stacks that evaluated a given stack even if the latter does not come from a CAFTested in GHC 8.2.2, 8.4.3 and 8.6.1:
Test-good.hs
```hs
import GHC.Base
data X = X Int deriving (Eq, Show)
main :: IO ()
main = (returnIO undefined) `bindIO` (const (print $ X (error "XXX")))
```
Test-bad.hs
```hs
import GHC.Base
...Tested in GHC 8.2.2, 8.4.3 and 8.6.1:
Test-good.hs
```hs
import GHC.Base
data X = X Int deriving (Eq, Show)
main :: IO ()
main = (returnIO undefined) `bindIO` (const (print $ X (error "XXX")))
```
Test-bad.hs
```hs
import GHC.Base
data X = X Int deriving (Eq, Show)
main :: IO ()
main = (returnIO undefined) `bindIO` (\_ -> (print $ X (error "XXX")))
```
build.sh
```shell
#!/bin/sh
set -e
p="${1:-stg}"
for i in good bad; do
rm -rf ghc*_* Test-$i Test-$i.dump-* Test-$i.hi Test-$i.o
ghc "-ddump-$p" -dsuppress-module-prefixes -dsuppress-uniques \
-keep-tmp-files -dumpdir . -ddump-to-file \
-fno-cse -prof -fprof-auto -fprof-auto-calls -fprof-cafs \
-dinitial-unique=0 -dunique-increment=1 \
Test-$i.hs
./Test-$i +RTS -xc || true
done
colordiff -ruw Test-*.dump-"$p" | less -R
```
Running `sh build.sh` gives the following output:
```
[1 of 1] Compiling Main ( Test-good.hs, Test-good.o )
Linking Test-good ...
*** Exception (reporting due to +RTS -xc): (THUNK_2_0), stack trace:
Main.main,
called from Main.main,
called from Main.main,
called from Main.main,
called from Main.main,
called from Main.CAF:main
--> evaluated by: Main.main,
called from Main.main,
called from Main.main,
called from Main.CAF:main
--> evaluated by: Main.main,
called from Main.main,
called from Main.main
Test-good: XXX
CallStack (from HasCallStack):
error, called at Test-good.hs:6:57 in main:Main
CallStack (from -prof):
Main.main (Test-good.hs:6:57-67)
Main.main (Test-good.hs:6:54-68)
Main.main (Test-good.hs:6:46-68)
Main.main (Test-good.hs:6:39-69)
Main.main (Test-good.hs:6:8-70)
Main.CAF:main (Test-good.hs:6:1-4)
[1 of 1] Compiling Main ( Test-bad.hs, Test-bad.o )
Linking Test-bad ...
*** Exception (reporting due to +RTS -xc): (THUNK_2_0), stack trace:
Main.main,
called from Main.main,
called from Main.main,
called from Main.main
Test-bad: XXX
CallStack (from HasCallStack):
error, called at Test-bad.hs:6:57 in main:Main
CallStack (from -prof):
Main.main (Test-bad.hs:6:57-67)
Main.main (Test-bad.hs:6:54-68)
Main.main (Test-bad.hs:6:46-68)
Main.main (Test-bad.hs:6:8-70)
```
As you can see, in Test-bad.hs all the entries below "evaluated by" are missing.
I am not familiar with STG output, but running the script also shows you a diff of the STG dump. It seems innocent enough. Running `sh build.sh cmm` shows many more differences.
<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":"returnIO/bindIO destroys runtime explicit stack information in some cases","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":"Tested in GHC 8.2.2, 8.4.3 and 8.6.1:\r\n\r\nTest-good.hs\r\n{{{#!hs\r\nimport GHC.Base\r\n\r\ndata X = X Int deriving (Eq, Show)\r\n\r\nmain :: IO ()\r\nmain = (returnIO undefined) `bindIO` (const (print $ X (error \"XXX\")))\r\n}}}\r\n\r\nTest-bad.hs\r\n{{{#!hs\r\nimport GHC.Base\r\n\r\ndata X = X Int deriving (Eq, Show)\r\n\r\nmain :: IO ()\r\nmain = (returnIO undefined) `bindIO` (\\_ -> (print $ X (error \"XXX\")))\r\n}}}\r\n\r\nbuild.sh\r\n{{{#!shell\r\n#!/bin/sh\r\nset -e\r\np=\"${1:-stg}\"\r\nfor i in good bad; do\r\n rm -rf ghc*_* Test-$i Test-$i.dump-* Test-$i.hi Test-$i.o\r\n ghc \"-ddump-$p\" -dsuppress-module-prefixes -dsuppress-uniques \\\r\n -keep-tmp-files -dumpdir . -ddump-to-file \\\r\n -fno-cse -prof -fprof-auto -fprof-auto-calls -fprof-cafs \\\r\n -dinitial-unique=0 -dunique-increment=1 \\\r\n Test-$i.hs\r\n ./Test-$i +RTS -xc || true\r\ndone\r\ncolordiff -ruw Test-*.dump-\"$p\" | less -R\r\n}}}\r\n\r\nRunning `sh build.sh` gives the following output:\r\n{{{\r\n[1 of 1] Compiling Main ( Test-good.hs, Test-good.o )\r\nLinking Test-good ...\r\n*** Exception (reporting due to +RTS -xc): (THUNK_2_0), stack trace: \r\n Main.main,\r\n called from Main.main,\r\n called from Main.main,\r\n called from Main.main,\r\n called from Main.main,\r\n called from Main.CAF:main\r\n --> evaluated by: Main.main,\r\n called from Main.main,\r\n called from Main.main,\r\n called from Main.CAF:main\r\n --> evaluated by: Main.main,\r\n called from Main.main,\r\n called from Main.main\r\nTest-good: XXX\r\nCallStack (from HasCallStack):\r\n error, called at Test-good.hs:6:57 in main:Main\r\nCallStack (from -prof):\r\n Main.main (Test-good.hs:6:57-67)\r\n Main.main (Test-good.hs:6:54-68)\r\n Main.main (Test-good.hs:6:46-68)\r\n Main.main (Test-good.hs:6:39-69)\r\n Main.main (Test-good.hs:6:8-70)\r\n Main.CAF:main (Test-good.hs:6:1-4)\r\n[1 of 1] Compiling Main ( Test-bad.hs, Test-bad.o )\r\nLinking Test-bad ...\r\n*** Exception (reporting due to +RTS -xc): (THUNK_2_0), stack trace: \r\n Main.main,\r\n called from Main.main,\r\n called from Main.main,\r\n called from Main.main\r\nTest-bad: XXX\r\nCallStack (from HasCallStack):\r\n error, called at Test-bad.hs:6:57 in main:Main\r\nCallStack (from -prof):\r\n Main.main (Test-bad.hs:6:57-67)\r\n Main.main (Test-bad.hs:6:54-68)\r\n Main.main (Test-bad.hs:6:46-68)\r\n Main.main (Test-bad.hs:6:8-70)\r\n}}}\r\n\r\nAs you can see, in Test-bad.hs all the entries below \"evaluated by\" are missing.\r\n\r\nI am not familiar with STG output, but running the script also shows you a diff of the STG dump. It seems innocent enough. Running `sh build.sh cmm` shows many more differences.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15831DerivingVia allows bogus implicit quantification in `via` type2019-07-26T10:41:30ZRyan ScottDerivingVia allows bogus implicit quantification in `via` typeConsider the following code:
```hs
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE PolyKinds #-}
module Bug where
import Data.Functor.Const (Const(..))
import GHC.Exts (Any)
newtype Age = MkAge Int
deriving Eq
via Const Int Any
```
T...Consider the following code:
```hs
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE PolyKinds #-}
module Bug where
import Data.Functor.Const (Const(..))
import GHC.Exts (Any)
newtype Age = MkAge Int
deriving Eq
via Const Int Any
```
This fails to compile with a spectacularly unhelpful error message:
```
$ /opt/ghc/8.6.1/bin/ghc -ddump-deriv Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
==================== Derived instances ====================
Derived class instances:
instance GHC.Classes.Eq Bug.Age where
(GHC.Classes.==)
= GHC.Prim.coerce
@((Data.Functor.Const.Const GHC.Types.Int (GHC.Types.Any :: k_a24l) :: TYPE GHC.Types.LiftedRep)
-> (Data.Functor.Const.Const GHC.Types.Int (GHC.Types.Any :: k_a24l) :: TYPE GHC.Types.LiftedRep)
-> GHC.Types.Bool)
@(Bug.Age -> Bug.Age -> GHC.Types.Bool)
(GHC.Classes.==) ::
Bug.Age -> Bug.Age -> GHC.Types.Bool
(GHC.Classes./=)
= GHC.Prim.coerce
@((Data.Functor.Const.Const GHC.Types.Int (GHC.Types.Any :: k_a24l) :: TYPE GHC.Types.LiftedRep)
-> (Data.Functor.Const.Const GHC.Types.Int (GHC.Types.Any :: k_a24l) :: TYPE GHC.Types.LiftedRep)
-> GHC.Types.Bool)
@(Bug.Age -> Bug.Age -> GHC.Types.Bool)
(GHC.Classes./=) ::
Bug.Age -> Bug.Age -> GHC.Types.Bool
Derived type family instances:
Bug.hs:9:12: error:
The exact Name ‘k’ is not in scope
Probable cause: you used a unique Template Haskell name (NameU),
perhaps via newName, but did not bind it
If that's it, then -ddump-splices might be useful
|
9 | deriving Eq
| ^^
Bug.hs:9:12: error:
The exact Name ‘k’ is not in scope
Probable cause: you used a unique Template Haskell name (NameU),
perhaps via newName, but did not bind it
If that's it, then -ddump-splices might be useful
|
9 | deriving Eq
| ^^
Bug.hs:9:12: error:
The exact Name ‘k’ is not in scope
Probable cause: you used a unique Template Haskell name (NameU),
perhaps via newName, but did not bind it
If that's it, then -ddump-splices might be useful
|
9 | deriving Eq
| ^^
Bug.hs:9:12: error:
The exact Name ‘k’ is not in scope
Probable cause: you used a unique Template Haskell name (NameU),
perhaps via newName, but did not bind it
If that's it, then -ddump-splices might be useful
|
9 | deriving Eq
| ^^
```
There are two things that are strange here:
- Notice that in the derived `Eq` instance, there are references to `(GHC.Types.Any :: k_a24l)`, where `k_a24l` is completely free! This should never happen, and is almost surely the cause of the resulting volley of errors.
- It's quite odd that we didn't reject this `deriving` clause outright //before// generating the derived code. In fact, if we explicitly mention the kind `k`:
```hs
newtype Age = MkAge Int
deriving Eq
via Const Int (Any :: k)
```
> //Then// it's rejected properly:
```
$ /opt/ghc/8.6.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:9:12: error:
Type variable ‘k’ is bound in the ‘via’ type ‘Const Int (Any :: k)’
but is not mentioned in the derived class ‘Eq’, which is illegal
|
9 | deriving Eq
| ^^
```
> Something about implicit quantification must be sneaking by this validity check.
<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":"DerivingVia allows bogus implicit quantification in `via` type","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["deriving"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider the following code:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DerivingVia #-}\r\n{-# LANGUAGE PolyKinds #-}\r\nmodule Bug where\r\n\r\nimport Data.Functor.Const (Const(..))\r\nimport GHC.Exts (Any)\r\n\r\nnewtype Age = MkAge Int\r\n deriving Eq\r\n via Const Int Any\r\n}}}\r\n\r\nThis fails to compile with a spectacularly unhelpful error message:\r\n\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc -ddump-deriv Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\n==================== Derived instances ====================\r\nDerived class instances:\r\n instance GHC.Classes.Eq Bug.Age where\r\n (GHC.Classes.==)\r\n = GHC.Prim.coerce\r\n @((Data.Functor.Const.Const GHC.Types.Int (GHC.Types.Any :: k_a24l) :: TYPE GHC.Types.LiftedRep)\r\n -> (Data.Functor.Const.Const GHC.Types.Int (GHC.Types.Any :: k_a24l) :: TYPE GHC.Types.LiftedRep)\r\n -> GHC.Types.Bool)\r\n @(Bug.Age -> Bug.Age -> GHC.Types.Bool)\r\n (GHC.Classes.==) ::\r\n Bug.Age -> Bug.Age -> GHC.Types.Bool\r\n (GHC.Classes./=)\r\n = GHC.Prim.coerce\r\n @((Data.Functor.Const.Const GHC.Types.Int (GHC.Types.Any :: k_a24l) :: TYPE GHC.Types.LiftedRep)\r\n -> (Data.Functor.Const.Const GHC.Types.Int (GHC.Types.Any :: k_a24l) :: TYPE GHC.Types.LiftedRep)\r\n -> GHC.Types.Bool)\r\n @(Bug.Age -> Bug.Age -> GHC.Types.Bool)\r\n (GHC.Classes./=) ::\r\n Bug.Age -> Bug.Age -> GHC.Types.Bool\r\n \r\n\r\nDerived type family instances:\r\n\r\n\r\n\r\nBug.hs:9:12: error:\r\n The exact Name ‘k’ is not in scope\r\n Probable cause: you used a unique Template Haskell name (NameU), \r\n perhaps via newName, but did not bind it\r\n If that's it, then -ddump-splices might be useful\r\n |\r\n9 | deriving Eq\r\n | ^^\r\n\r\nBug.hs:9:12: error:\r\n The exact Name ‘k’ is not in scope\r\n Probable cause: you used a unique Template Haskell name (NameU), \r\n perhaps via newName, but did not bind it\r\n If that's it, then -ddump-splices might be useful\r\n |\r\n9 | deriving Eq\r\n | ^^\r\n\r\nBug.hs:9:12: error:\r\n The exact Name ‘k’ is not in scope\r\n Probable cause: you used a unique Template Haskell name (NameU), \r\n perhaps via newName, but did not bind it\r\n If that's it, then -ddump-splices might be useful\r\n |\r\n9 | deriving Eq\r\n | ^^\r\n\r\nBug.hs:9:12: error:\r\n The exact Name ‘k’ is not in scope\r\n Probable cause: you used a unique Template Haskell name (NameU), \r\n perhaps via newName, but did not bind it\r\n If that's it, then -ddump-splices might be useful\r\n |\r\n9 | deriving Eq\r\n | ^^\r\n}}}\r\n\r\nThere are two things that are strange here:\r\n\r\n* Notice that in the derived `Eq` instance, there are references to `(GHC.Types.Any :: k_a24l)`, where `k_a24l` is completely free! This should never happen, and is almost surely the cause of the resulting volley of errors.\r\n* It's quite odd that we didn't reject this `deriving` clause outright //before// generating the derived code. In fact, if we explicitly mention the kind `k`:\r\n\r\n{{{#!hs\r\nnewtype Age = MkAge Int\r\n deriving Eq\r\n via Const Int (Any :: k)\r\n}}}\r\n\r\n //Then// it's rejected properly:\r\n\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc Bug.hs \r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o ) \r\n \r\nBug.hs:9:12: error: \r\n Type variable ‘k’ is bound in the ‘via’ type ‘Const Int (Any :: k)’ \r\n but is not mentioned in the derived class ‘Eq’, which is illegal \r\n | \r\n9 | deriving Eq \r\n | ^^\r\n}}}\r\n\r\n Something about implicit quantification must be sneaking by this validity check.","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/15830Plugins Tests are Skipped2021-05-11T10:01:02ZdavidePlugins Tests are SkippedThe test driver skips the plugins01 test after building the default flavour with hadrian. testsuite/tests/plugins/all.T specifies `only_ways([config.ghc_plugin_way]`. Some how this condition is not met. Open questions:
- Are all plugin\...The test driver skips the plugins01 test after building the default flavour with hadrian. testsuite/tests/plugins/all.T specifies `only_ways([config.ghc_plugin_way]`. Some how this condition is not met. Open questions:
- Are all plugin\* tests skipped?
- Are these tests also skipped when built/run via make?
<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 | alpmestan |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Plugins Tests are Skipped","status":"New","operating_system":"","component":"Build System (Hadrian)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["plugins","test"],"differentials":[],"test_case":"","architecture":"","cc":["alpmestan"],"type":"Bug","description":"The test driver skips the plugins01 test after building the default flavour with hadrian. testsuite/tests/plugins/all.T specifies `only_ways([config.ghc_plugin_way]`. Some how this condition is not met. Open questions:\r\n\r\n* Are all plugin* tests skipped?\r\n* Are these tests also skipped when built/run via make?","type_of_failure":"OtherFailure","blocking":[]} -->Make removaldavidedavidehttps://gitlab.haskell.org/ghc/ghc/-/issues/15829Add a test case for tricky type synonyms involving visible dependent kinds2019-07-07T18:02:49ZRyan ScottAdd a test case for tricky type synonyms involving visible dependent kindsThis code does not typecheck on GHC 8.6.1:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
module Bug where
import Data.Kind
data A :: Type -> Type
data B a :: A a -> Type
type C a = B a
```
However, it //does// typecheck...This code does not typecheck on GHC 8.6.1:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
module Bug where
import Data.Kind
data A :: Type -> Type
data B a :: A a -> Type
type C a = B a
```
However, it //does// typecheck on GHC HEAD, after commit 5e45ad10ffca1ad175b10f6ef3327e1ed8ba25f3 (Finish fix for #14880.). This is very cool, although it does alarm me that there is no test case which checks for this at the moment. Let's add one to ensure that this stays fixed.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.7 |
| 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":"Add a test case for tricky type synonyms involving visible dependent kinds","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This code does not typecheck on GHC 8.6.1:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE PolyKinds #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\ndata A :: Type -> Type\r\ndata B a :: A a -> Type\r\ntype C a = B a\r\n}}}\r\n\r\nHowever, it //does// typecheck on GHC HEAD, after commit 5e45ad10ffca1ad175b10f6ef3327e1ed8ba25f3 (Finish fix for #14880.). This is very cool, although it does alarm me that there is no test case which checks for this at the moment. Let's add one to ensure that this stays fixed.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15828Type family equation foralls allow strange re-quantification of class-bound t...2019-07-07T18:02:49ZRyan ScottType family equation foralls allow strange re-quantification of class-bound type variablesThe following code typechecks on GHC HEAD (8.7+):
```hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
import Data.Kind
class C1 a where
type T1 a b
class C2 a where
type T2 a b
instance C1 (M...The following code typechecks on GHC HEAD (8.7+):
```hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
import Data.Kind
class C1 a where
type T1 a b
class C2 a where
type T2 a b
instance C1 (Maybe a) where
type forall a b. T1 (Maybe a) b = b
instance C2 (Maybe a) where
type forall b. T2 (Maybe a) b = b
```
But ought it to? There is something funny happening in the `C1` instance: it's explicitly quantifying `a`, despite the fact that it had previously been quantified by the class head! Moreover, it appears that you can safely drop the `a` in the explicit `forall`, as the `C2 (Maybe a)` instance witnesses.
What does the documentation have to say on this topic? This is all I could find:
> When an explicit `forall` is present, all //type// variables mentioned must be bound by the `forall`.
I couldn't find anything on the interaction between this feature and associated type families. We should:
1. Decide which of the two programs above should be accepted, and
1. Update the documentation to reflect this.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.7 |
| 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 equation foralls allow strange re-quantification of class-bound type variables","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":["TypeFamilies"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following code typechecks on GHC HEAD (8.7+):\r\n\r\n{{{#!hs\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\nclass C1 a where\r\n type T1 a b\r\nclass C2 a where\r\n type T2 a b\r\n\r\ninstance C1 (Maybe a) where\r\n type forall a b. T1 (Maybe a) b = b\r\ninstance C2 (Maybe a) where\r\n type forall b. T2 (Maybe a) b = b\r\n}}}\r\n\r\nBut ought it to? There is something funny happening in the `C1` instance: it's explicitly quantifying `a`, despite the fact that it had previously been quantified by the class head! Moreover, it appears that you can safely drop the `a` in the explicit `forall`, as the `C2 (Maybe a)` instance witnesses.\r\n\r\nWhat does the documentation have to say on this topic? This is all I could find:\r\n\r\n> When an explicit `forall` is present, all //type// variables mentioned must be bound by the `forall`.\r\n\r\nI couldn't find anything on the interaction between this feature and associated type families. We should:\r\n\r\n1. Decide which of the two programs above should be accepted, and\r\n2. Update the documentation to reflect this.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15827Explicit foralls in type family equations are pretty-printed inconsistently (...2019-07-07T18:02:49ZRyan ScottExplicit foralls in type family equations are pretty-printed inconsistently (and strangely, at times)Load the following code into GHCi HEAD (8.7+):
```hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
import Data.Kind
type family F1 a
type instance forall a. F1 a = Maybe a
type family F2 a where
...Load the following code into GHCi HEAD (8.7+):
```hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
import Data.Kind
type family F1 a
type instance forall a. F1 a = Maybe a
type family F2 a where
forall a. F2 a = Maybe a
data family D a
data instance forall a. D a = MkD (Maybe a)
```
And make sure you have the `-fprint-explicit-foralls` flag enabled. Now let's see what happens when we look up the `:info` for each of these type families:
```
$ ~/Software/ghc2/inplace/bin/ghc-stage2 --interactive Bug.hs -fprint-explicit-foralls
GHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Ok, one module loaded.
λ> :i F1
type family F1 a :: * -- Defined at Bug.hs:7:1
type instance F1 a = Maybe a -- Defined at Bug.hs:8:25
λ> :i F2
type family F2 a :: *
where [a] F2 a = Maybe a
-- Defined at Bug.hs:10:1
λ> :i D
data family D a -- Defined at Bug.hs:13:1
data instance D a = MkD (Maybe a) -- Defined at Bug.hs:14:25
```
There are two strange things of note here:
- The equations for `F1` and `D` do not have any explicit `forall`s displayed at all, despite the fact that `-fprint-explicit-foralls` is enabled.
- The equation for `F2` //does// have an explicit `forall` displayed, but in a rather bizarre fashion:
```
λ> :i F2
type family F2 a :: *
where [a] F2 a = Maybe a
-- Defined at Bug.hs:10:1
```
> I certainly wasn't expecting to see the type variables in square brackets. I would have hoped to see something like this instead:
```
λ> :i F2
type family F2 a :: *
where forall a. F2 a = Maybe a
-- Defined at Bug.hs:10:1
```
Now that the "more explicit `forall`s" proposal is implemented, my hope is that it will be somewhat simple to change the way that this is pretty-printed (we already store the explicit `forall` information within the AST, after all).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.7 |
| 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":"Explicit foralls in type family equations are pretty-printed inconsistently (and strangely, at times)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":["TypeFamilies"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Load the following code into GHCi HEAD (8.7+):\r\n\r\n{{{#!hs\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\ntype family F1 a\r\ntype instance forall a. F1 a = Maybe a\r\n\r\ntype family F2 a where\r\n forall a. F2 a = Maybe a\r\n\r\ndata family D a\r\ndata instance forall a. D a = MkD (Maybe a)\r\n}}}\r\n\r\nAnd make sure you have the `-fprint-explicit-foralls` flag enabled. Now let's see what happens when we look up the `:info` for each of these type families:\r\n\r\n{{{\r\n$ ~/Software/ghc2/inplace/bin/ghc-stage2 --interactive Bug.hs -fprint-explicit-foralls\r\nGHCi, version 8.7.20181029: 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\nOk, one module loaded.\r\nλ> :i F1\r\ntype family F1 a :: * -- Defined at Bug.hs:7:1\r\ntype instance F1 a = Maybe a -- Defined at Bug.hs:8:25\r\nλ> :i F2\r\ntype family F2 a :: *\r\n where [a] F2 a = Maybe a\r\n -- Defined at Bug.hs:10:1\r\nλ> :i D\r\ndata family D a -- Defined at Bug.hs:13:1\r\ndata instance D a = MkD (Maybe a) -- Defined at Bug.hs:14:25\r\n}}}\r\n\r\nThere are two strange things of note here:\r\n\r\n* The equations for `F1` and `D` do not have any explicit `forall`s displayed at all, despite the fact that `-fprint-explicit-foralls` is enabled.\r\n* The equation for `F2` //does// have an explicit `forall` displayed, but in a rather bizarre fashion:\r\n\r\n{{{\r\nλ> :i F2\r\ntype family F2 a :: *\r\n where [a] F2 a = Maybe a\r\n -- Defined at Bug.hs:10:1\r\n}}}\r\n\r\n I certainly wasn't expecting to see the type variables in square brackets. I would have hoped to see something like this instead:\r\n\r\n{{{\r\nλ> :i F2\r\ntype family F2 a :: *\r\n where forall a. F2 a = Maybe a\r\n -- Defined at Bug.hs:10:1\r\n}}}\r\n\r\nNow that the \"more explicit `forall`s\" proposal is implemented, my hope is that it will be somewhat simple to change the way that this is pretty-printed (we already store the explicit `forall` information within the AST, after all).","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15826Allow registering (Source)Plugins through the GHC API2019-07-07T18:02:49ZDanielGAllow registering (Source)Plugins through the GHC APIOne might expect to be able to load plugins through the GHC API by doing something like:
```
runGHC $ do
dflags <- getSessionDynFlags
setSessionDynFlags dflags { plugins = [LoadedPlugin some_plugin _conjure_up_modiface []] }
```
bu...One might expect to be able to load plugins through the GHC API by doing something like:
```
runGHC $ do
dflags <- getSessionDynFlags
setSessionDynFlags dflags { plugins = [LoadedPlugin some_plugin _conjure_up_modiface []] }
```
but this doesn't actually work because the `plugins` field in `DynFlags` is used as a cache and overwritten by `initializePlugins` whenever plugins loaded through the command-line need reloading. Not to mention that there isn't a meaningful way to fill the `_conjure_up_modiface` hole AFAIK.
While in principle it might be possible to use source plugins via the API right now by messing with the exposed cmdline flags the right way it feels much cleaner to just have a new type of plugin that can be added to GHC right through the API.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.7 |
| 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":"Allow using (Source)Plugins through the GHC API","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"One might expect to be able to load plugins through the GHC API by doing something like:\r\n\r\n{{{\r\nrunGHC $ do\r\n dflags <- getSessionDynFlags\r\n setSessionDynFlags dflags { plugins = [LoadedPlugin some_plugin _conjure_up_modiface []] }\r\n}}}\r\n\r\nbut this doesn't actually work because the `plugins` field in `DynFlags` is used as a cache and overwritten by `initializePlugins` whenever plugins loaded through the command-line need reloading. Not to mention that there isn't a meaningful way to fill the `_conjure_up_modiface` hole AFAIK.\r\n\r\nWhile in principle it might be possible to use source plugins via the API right now by messing with the exposed cmdline flags the right way it feels much cleaner to just have a new type of plugin that can be added to GHC right through the API.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1DanielGDanielGhttps://gitlab.haskell.org/ghc/ghc/-/issues/15825Core Lint error from Explicit Foralls Proposal2019-07-07T18:02:50ZIcelandjackCore Lint error from Explicit Foralls ProposalThis is using the recent Explicit Foralls Proposal #14268
```hs
{-# Language RankNTypes #-}
{-# Language PolyKinds #-}
{-# Language KindSignatures #-}
{-# Language DataKinds #-}
{-# Language FlexibleInstances #...This is using the recent Explicit Foralls Proposal #14268
```hs
{-# Language RankNTypes #-}
{-# Language PolyKinds #-}
{-# Language KindSignatures #-}
{-# Language DataKinds #-}
{-# Language FlexibleInstances #-}
{-# Options_GHC -dcore-lint #-}
type C k = (forall (x::k). *)
class X (a :: *)
instance forall (a :: C k). X (a :: *)
```
```
$ ./inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci /tmp/599_bug.hs
GHCi, version 8.7.20181025: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 599_bug.hs, interpreted )
*** Core Lint errors : in result of Desugar (before optimization) ***
<no location info>: warning:
In the expression: C:X @ a_a1yJ
Kind application error in type ‘a_a1yJ’
Function kind = C k_a1yI
Arg kinds = [(x_a1yH, k_a1yG)]
Forall: x_a1xE
k_a1yI
(x_a1yH, k_a1yG)
<no location info>: warning:
In the expression: C:X @ a_a1xG
Kind application error in type ‘a_a1xG’
Function kind = C k_X1xQ
Arg kinds = [(x_a1yv, k_a1xF)]
Forall: x_a1xE
k_X1xQ
(x_a1yv, k_a1xF)
*** Offending Program ***
Rec {
$tcX :: TyCon
[LclIdX]
$tcX
= TyCon
6136962148358085538##
2047526523769221729##
$trModule
(TrNameS "X"#)
0#
$krep_a1zH
$tc'C:X :: TyCon
[LclIdX]
$tc'C:X
= TyCon
12994509767826319747##
2028070155085790741##
$trModule
(TrNameS "'C:X"#)
1#
$krep_a1zJ
$krep_a1zK [InlPrag=NOUSERINLINE[~]] :: KindRep
[LclId]
$krep_a1zK = $WKindRepVar (I# 0#)
$krep_a1zH [InlPrag=NOUSERINLINE[~]] :: KindRep
[LclId]
$krep_a1zH = KindRepFun krep$* $krep_a1zI
$krep_a1zI [InlPrag=NOUSERINLINE[~]] :: KindRep
[LclId]
$krep_a1zI = KindRepTyConApp $tcConstraint ([] @ KindRep)
$krep_a1zJ [InlPrag=NOUSERINLINE[~]] :: KindRep
[LclId]
$krep_a1zJ
= KindRepTyConApp $tcX (: @ KindRep $krep_a1zK ([] @ KindRep))
$trModule :: Module
[LclIdX]
$trModule = Module (TrNameS "main"#) (TrNameS "Main"#)
$fXa [InlPrag=NOUSERINLINE CONLIKE]
:: forall k (x :: k) k (a :: C k). X a
[LclIdX[DFunId],
Unf=DFun: \ (@ k_a1xF)
(@ (x_a1yv :: k_a1xF))
(@ k_a1xF)
(@ (a_a1xG :: C k_a1xF)) ->
C:X TYPE: a_a1xG]
$fXa
= \ (@ k_a1yG)
(@ (x_a1yH :: k_a1yG))
(@ k_a1yI)
(@ (a_a1yJ :: C k_a1yI)) ->
C:X @ a_a1yJ
end Rec }
*** End of Offense ***
<no location info>: error:
Compilation had errors
*** Exception: ExitFailure 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":"Core Lint error from Explicit Foralls Proposal","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 is using the recent Explicit Foralls Proposal #14268\r\n\r\n{{{#!hs\r\n{-# Language RankNTypes #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language KindSignatures #-}\r\n{-# Language DataKinds #-}\r\n{-# Language FlexibleInstances #-}\r\n\r\n{-# Options_GHC -dcore-lint #-}\r\n\r\ntype C k = (forall (x::k). *)\r\n\r\nclass X (a :: *)\r\ninstance forall (a :: C k). X (a :: *)\r\n}}}\r\n\r\n{{{\r\n$ ./inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci /tmp/599_bug.hs\r\nGHCi, version 8.7.20181025: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 599_bug.hs, interpreted )\r\n*** Core Lint errors : in result of Desugar (before optimization) ***\r\n<no location info>: warning:\r\n In the expression: C:X @ a_a1yJ\r\n Kind application error in type ‘a_a1yJ’\r\n Function kind = C k_a1yI\r\n Arg kinds = [(x_a1yH, k_a1yG)]\r\n Forall: x_a1xE\r\n k_a1yI\r\n (x_a1yH, k_a1yG)\r\n<no location info>: warning:\r\n In the expression: C:X @ a_a1xG\r\n Kind application error in type ‘a_a1xG’\r\n Function kind = C k_X1xQ\r\n Arg kinds = [(x_a1yv, k_a1xF)]\r\n Forall: x_a1xE\r\n k_X1xQ\r\n (x_a1yv, k_a1xF)\r\n*** Offending Program ***\r\nRec {\r\n$tcX :: TyCon\r\n[LclIdX]\r\n$tcX\r\n = TyCon\r\n 6136962148358085538##\r\n 2047526523769221729##\r\n $trModule\r\n (TrNameS \"X\"#)\r\n 0#\r\n $krep_a1zH\r\n\r\n$tc'C:X :: TyCon\r\n[LclIdX]\r\n$tc'C:X\r\n = TyCon\r\n 12994509767826319747##\r\n 2028070155085790741##\r\n $trModule\r\n (TrNameS \"'C:X\"#)\r\n 1#\r\n $krep_a1zJ\r\n\r\n$krep_a1zK [InlPrag=NOUSERINLINE[~]] :: KindRep\r\n[LclId]\r\n$krep_a1zK = $WKindRepVar (I# 0#)\r\n\r\n$krep_a1zH [InlPrag=NOUSERINLINE[~]] :: KindRep\r\n[LclId]\r\n$krep_a1zH = KindRepFun krep$* $krep_a1zI\r\n\r\n$krep_a1zI [InlPrag=NOUSERINLINE[~]] :: KindRep\r\n[LclId]\r\n$krep_a1zI = KindRepTyConApp $tcConstraint ([] @ KindRep)\r\n\r\n$krep_a1zJ [InlPrag=NOUSERINLINE[~]] :: KindRep\r\n[LclId]\r\n$krep_a1zJ\r\n = KindRepTyConApp $tcX (: @ KindRep $krep_a1zK ([] @ KindRep))\r\n\r\n$trModule :: Module\r\n[LclIdX]\r\n$trModule = Module (TrNameS \"main\"#) (TrNameS \"Main\"#)\r\n\r\n$fXa [InlPrag=NOUSERINLINE CONLIKE]\r\n :: forall k (x :: k) k (a :: C k). X a\r\n[LclIdX[DFunId],\r\n Unf=DFun: \\ (@ k_a1xF)\r\n (@ (x_a1yv :: k_a1xF))\r\n (@ k_a1xF)\r\n (@ (a_a1xG :: C k_a1xF)) ->\r\n C:X TYPE: a_a1xG]\r\n$fXa\r\n = \\ (@ k_a1yG)\r\n (@ (x_a1yH :: k_a1yG))\r\n (@ k_a1yI)\r\n (@ (a_a1yJ :: C k_a1yI)) ->\r\n C:X @ a_a1yJ\r\nend Rec }\r\n\r\n*** End of Offense ***\r\n\r\n\r\n<no location info>: error:\r\nCompilation had errors\r\n\r\n\r\n*** Exception: ExitFailure 1\r\n>\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15824Prefix/infix distinction in TemplateHaskell types is lost2021-12-10T12:37:05ZVladislav ZavialovPrefix/infix distinction in TemplateHaskell types is lostConsider `data T a b = a :. b`.
In the declaration, `:.` is mapped to `InfixC`:
```
ghci> putStrLn $(reify ''T >>= stringE . show)
TyConI (DataD [] T [KindedTV a StarT,KindedTV b StarT] Nothing [InfixC (Bang NoSourceUnpackedness NoSour...Consider `data T a b = a :. b`.
In the declaration, `:.` is mapped to `InfixC`:
```
ghci> putStrLn $(reify ''T >>= stringE . show)
TyConI (DataD [] T [KindedTV a StarT,KindedTV b StarT] Nothing [InfixC (Bang NoSourceUnpackedness NoSourceStrictness,VarT a) :. (Bang NoSourceUnpackedness NoSourceStrictness,VarT b)] [])
```
In expressions, `a :. b` is mapped to `InfixE`:
```
ghci> runQ [e| 1 :+ 2 |] >>= print
InfixE (Just (LitE (IntegerL 1))) (ConE :+) (Just (LitE (IntegerL 2)))
```
In patterns, `a :. b` is mapped to `InfixP`:
```
ghci> runQ [p| 1 :. 2 |] >>= print
InfixP (LitP (IntegerL 1)) :. (LitP (IntegerL 2))
```
In types, `a :. b` is mapped to `InfixT`:
```
ghci> runQ [t| 1 :. 2 |] >>= print
InfixT (LitT (NumTyLit 1)) (PromotedT :.) (LitT (NumTyLit 2))
```
That last one was a lie. In reality, in types `a :. b` is mapped to nested `AppT`, as if it was written as `(:.) a b`:
```
ghci> runQ [t| 1 :. 2 |] >>= print
AppT (AppT (PromotedT :.) (LitT (NumTyLit 1))) (LitT (NumTyLit 2))
```
This is despite the existence of `InfixT`.
The same issue can be observed when reifying types:
```
ghci> type A = 1 :. 2
ghci> putStrLn $(reify ''A >>= stringE . show)
TyConI (TySynD A [] (AppT (AppT (PromotedT :.) (LitT (NumTyLit 1))) (LitT (NumTyLit 2))))
```
This is not specific to infix constructors and can be observed with any infix (type) operators.
It's best to change this in the same release as we fix #15760, as there is code in the wild that is prepared to face neither `InfixT` nor `ParensT`, and it would break silently. RyanGlScott gives an example of such code: [decomposeType from th-desugar](https://github.com/glguy/th-abstraction/blob/5123c6d054d0949cb444590269f13e5d44699ab2/src/Language/Haskell/TH/Datatype.hs#L1156-L1160).
This issue is in part responsible for #15815, see [ticket:15815\#comment:162853](https://gitlab.haskell.org//ghc/ghc/issues/15815#note_162853).Vladislav ZavialovVladislav Zavialovhttps://gitlab.haskell.org/ghc/ghc/-/issues/15823Incorrect link in the doc (TH API)2020-02-17T19:45:54ZSylvain HenryIncorrect link in the doc (TH API)The "Haddock reference documentation" link for TH in the doc is incorrectly generated at
`https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#template-haskell`
Link:
```
https://downloads.haskell.org/~ghc/l...The "Haddock reference documentation" link for TH in the doc is incorrectly generated at
`https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#template-haskell`
Link:
```
https://downloads.haskell.org/~ghc/latest/docs/html/libraries/template-haskell-@LIBRARY_template_haskell_VERSION@/Haddock%20reference%20documentation%20%3CLanguage-Haskell-TH.html#v:%3E
```https://gitlab.haskell.org/ghc/ghc/-/issues/15822template-haskell package lacks any real documentation2021-09-30T23:47:02ZBen Gamaritemplate-haskell package lacks any real documentationJust as it says on the tin.
Your mission, if you choose to accept it: Look at the Haddocks for [Language.Haskell.TH.Syntax](http://hackage.haskell.org/package/template-haskell-2.17.0.0/docs/Language-Haskell-TH-Syntax.html), choose an un...Just as it says on the tin.
Your mission, if you choose to accept it: Look at the Haddocks for [Language.Haskell.TH.Syntax](http://hackage.haskell.org/package/template-haskell-2.17.0.0/docs/Language-Haskell-TH-Syntax.html), choose an undocumented declaration, and start writing.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Documentation |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | newcomer |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"template-haskell package lacks any real documentation","status":"New","operating_system":"","component":"Documentation","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["newcomer"],"type":"Bug","description":"Just as it says on the tin.\r\n\r\nYour mission, if you choose to accept it: Look at the Haddocks for [Language.Haskell.TH.Syntax](http://hackage.haskell.org/package/template-haskell-2.14.0.0/docs/Language-Haskell-TH-Syntax.html), choose an undocumented declaration, and start writing.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15821Implement more constant folding for Naturals2021-02-10T03:12:28ZBen GamariImplement more constant folding for Naturals#14465 has already gone a long way in improving the runtime performance of `Natural` numbers. However, we still lack constant folding for these numbers so there is money left on the table.
To fix this you will want to implement rules si...#14465 has already gone a long way in improving the runtime performance of `Natural` numbers. However, we still lack constant folding for these numbers so there is money left on the table.
To fix this you will want to implement rules similar to those for `Integer` in the `PrelRules` module. Additionally, you will need to comment back in the `CONSTANT_FOLDED` pragmas in `GHC.Natural` (see [D5267](https://phabricator.haskell.org/D5267))
<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":"Implement constant folding for Naturals","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["newcomer"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"#14465 has already gone a long way in improving the runtime performance of `Natural` numbers. However, we still lack constant folding for these numbers so there is money left on the table.\r\n\r\nTo fix this you will want to implement rules similar to those for `Integer` in the `PrelRules` module. Additionally, you will need to comment back in the `CONSTANT_FOLDED` pragmas in `GHC.Natural` (see Phab:D5267)","type_of_failure":"OtherFailure","blocking":[]} -->9.0.1Sylvain HenrySylvain Henryhttps://gitlab.haskell.org/ghc/ghc/-/issues/15820Document the proposals process in the GHC manual2019-07-07T18:02:51ZRichard Eisenbergrae@richarde.devDocument the proposals process in the GHC manualThe ghc-proposals process has proved robust, in my opinion. We should explicitly state that such a process exists and point users to it from the manual.
This came up as I was documenting the solution to #15743 in the manual. The end res...The ghc-proposals process has proved robust, in my opinion. We should explicitly state that such a process exists and point users to it from the manual.
This came up as I was documenting the solution to #15743 in the manual. The end result there is very much a free design decision, and I wanted to invite readers to propose changes if they disagree with the design. But there's no good way to do so, currently.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Documentation |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Document the proposals process in the GHC manual","status":"New","operating_system":"","component":"Documentation","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The ghc-proposals process has proved robust, in my opinion. We should explicitly state that such a process exists and point users to it from the manual.\r\n\r\nThis came up as I was documenting the solution to #15743 in the manual. The end result there is very much a free design decision, and I wanted to invite readers to propose changes if they disagree with the design. But there's no good way to do so, currently.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15819COMPLETE pragma not listed in GHC manual index2019-07-07T18:02:51ZRichard Eisenbergrae@richarde.devCOMPLETE pragma not listed in GHC manual indexI wanted information on the `COMPLETE` pragma. So I went to GHC's manual's index. And it isn't there!
We should likely have some RST gubbins to support pragmas, in much the same way that we do for flags, as I'm sure this isn't only `COM...I wanted information on the `COMPLETE` pragma. So I went to GHC's manual's index. And it isn't there!
We should likely have some RST gubbins to support pragmas, in much the same way that we do for flags, as I'm sure this isn't only `COMPLETE`'s problem.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------- |
| Version | 8.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Documentation |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"COMPLETE pragma not listed in GHC manual index","status":"New","operating_system":"","component":"Documentation","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I wanted information on the `COMPLETE` pragma. So I went to GHC's manual's index. And it isn't there!\r\n\r\nWe should likely have some RST gubbins to support pragmas, in much the same way that we do for flags, as I'm sure this isn't only `COMPLETE`'s problem.","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/15818Bump template-haskell version to 2.15.0.02019-07-07T18:02:51ZRyan ScottBump template-haskell version to 2.15.0.0Commit 512eeb9bb9a81e915bfab25ca16bc87c62252064 (`More explicit foralls (GHC Proposal 0007)`) introduced breaking changes to the Template Haskell AST. As a consequence of this, there are libraries in the wild that now fail to build on GH...Commit 512eeb9bb9a81e915bfab25ca16bc87c62252064 (`More explicit foralls (GHC Proposal 0007)`) introduced breaking changes to the Template Haskell AST. As a consequence of this, there are libraries in the wild that now fail to build on GHC HEAD (for instance, [th-abstraction](https://github.com/glguy/th-abstraction/issues/55)). We should properly bump the `template-haskell` library's version number to `2.15.0.0` so that these libraries can guard against these changes using `MIN_VERSION_template_haskell`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 8.7 |
| 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":"Bump template-haskell version to 2.15.0.0","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Commit 512eeb9bb9a81e915bfab25ca16bc87c62252064 (`More explicit foralls (GHC Proposal 0007)`) introduced breaking changes to the Template Haskell AST. As a consequence of this, there are libraries in the wild that now fail to build on GHC HEAD (for instance, [https://github.com/glguy/th-abstraction/issues/55 th-abstraction]). We should properly bump the `template-haskell` library's version number to `2.15.0.0` so that these libraries can guard against these changes using `MIN_VERSION_template_haskell`.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15817Data family quantification = GHC panic, ‘impossible’ happened2019-07-07T18:02:52ZIcelandjackData family quantification = GHC panic, ‘impossible’ happened```hs
{-# Language RankNTypes #-}
{-# Language TypeApplications #-}
{-# Language PolyKinds #-}
{-# Language KindSignatures #-}
{-# Language TypeFamilies #-}
data family Pair :: forall a. forall b. *
data instance Pa...```hs
{-# Language RankNTypes #-}
{-# Language TypeApplications #-}
{-# Language PolyKinds #-}
{-# Language KindSignatures #-}
{-# Language TypeFamilies #-}
data family Pair :: forall a. forall b. *
data instance Pair @a @b = MkPair a b
```
```
$ ghci -ignore-dot-ghci 593_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 593_bug.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181017 for x86_64-unknown-linux):
ASSERT failed!
kind axiom D:R:Pairabab0 ::
forall a b (a :: a) (b :: b).
Pair = R:Pairabab -- Defined at 593_bug.hs:8:15
forall k k (a :: k) (b :: k). *
forall a b -> a -> b -> *
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.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":"Visible kind application + data family = GHC panic, ‘impossible’ happened","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 TypeApplications #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language KindSignatures #-}\r\n{-# Language TypeFamilies #-}\r\n\r\ndata family Pair :: forall a. forall b. *\r\ndata instance Pair @a @b = MkPair a b\r\n}}}\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci 593_bug.hs\r\nGHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 593_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 kind axiom D:R:Pairabab0 ::\r\n forall a b (a :: a) (b :: b).\r\n Pair = R:Pairabab -- Defined at 593_bug.hs:8:15\r\n forall k k (a :: k) (b :: k). *\r\n forall a b -> a -> b -> *\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/15816Visible kind applications + data family: `U :: Type' said to be of kind `k0 -...2019-07-07T18:02:52ZIcelandjackVisible kind applications + data family: `U :: Type' said to be of kind `k0 -> k1` in error messageUsing the [visible kind applications (D5229)](https://phabricator.haskell.org/D5229) (#12045) patch.
GHC erroneously calls `U :: Type` a "function" of kind `k0 -> k1` if I understand this right,
```
$ ghci
GHCi, version 8.7.20181017: ...Using the [visible kind applications (D5229)](https://phabricator.haskell.org/D5229) (#12045) patch.
GHC erroneously calls `U :: Type` a "function" of kind `k0 -> k1` if I understand this right,
```
$ ghci
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
Prelude> :set prompt "> "
> import Data.Kind (Type)
>
> :set -XTypeFamilies
> :set -XTypeApplications
>
> data family U :: Type
> data instance U @Int
<interactive>:7:1: error:
• Cannot apply function of kind ‘k0 -> k1’
to visible kind argument ‘Int’
• In the data instance declaration for ‘U’
>
```
I expect something like "Cannot apply type `U` to visible kind argument `Int`" or
```
> data instance U Int = MkU
<interactive>:7:1: error:
• Expected kind ‘* -> *’, but ‘U’ has kind ‘*’
• In the data instance declaration for ‘U’
>
```
<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":"Visible kind applications + data family: `U :: Type' said to be of kind `k0 -> k1` in error message","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 the [https://phabricator.haskell.org/D5229 visible kind applications (D5229)] (#12045) patch.\r\n\r\nGHC erroneously calls `U :: Type` a \"function\" of kind `k0 -> k1` if I understand this right,\r\n\r\n{{{\r\n$ ghci \r\nGHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help\r\nPrelude> :set prompt \"> \"\r\n> import Data.Kind (Type)\r\n>\r\n> :set -XTypeFamilies \r\n> :set -XTypeApplications\r\n>\r\n> data family U :: Type\r\n> data instance U @Int\r\n\r\n<interactive>:7:1: error:\r\n • Cannot apply function of kind ‘k0 -> k1’\r\n to visible kind argument ‘Int’\r\n • In the data instance declaration for ‘U’\r\n> \r\n}}}\r\n\r\nI expect something like \"Cannot apply type `U` to visible kind argument `Int`\" or\r\n\r\n{{{\r\n> data instance U Int = MkU\r\n\r\n<interactive>:7:1: error:\r\n • Expected kind ‘* -> *’, but ‘U’ has kind ‘*’\r\n • In the data instance declaration for ‘U’\r\n> \r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15815problem with splicing type into constraint2019-07-07T18:02:52ZBertram Felgenhauerproblem with splicing type into constraintConsider the following two-module example. (as gist: https://gist.github.com/int-e/a666991423c10150bd99dd0e874d6150)
```hs
{-# LANGUAGE TemplateHaskell #-}
module A where
mkFoo tyQ = [d|
foo :: a ~ $(tyQ) => a
foo = undefined
|...Consider the following two-module example. (as gist: https://gist.github.com/int-e/a666991423c10150bd99dd0e874d6150)
```hs
{-# LANGUAGE TemplateHaskell #-}
module A where
mkFoo tyQ = [d|
foo :: a ~ $(tyQ) => a
foo = undefined
|]
```
```hs
{-# LANGUAGE TemplateHaskell, GADTs #-}
module B where
import A
mkFoo [t| Int -> Int |]
```
This loads fine in ghc-8.4.2, but with ghc-8.6.1 and current head (commit 23956b2ada690c78a134fe6d149940c777c7efcc), the splice goes wrong:
```
$ ghci B.hs
GHCi, version 8.6.1: http://www.haskell.org/ghc/ :? for help
[1 of 2] Compiling A ( A.hs, interpreted )
[2 of 2] Compiling B ( B.hs, interpreted )
B.hs:7:1: error:
• Expected a type, but ‘a_a4uD ~ Int’ has kind ‘Constraint’
• In the type signature: foo :: a_a4uD ~ Int -> Int => a_a4uD
|
7 | mkFoo [t| Int -> Int |]
| ^^^^^^^^^^^^^^^^^^^^^^^
Failed, one module loaded.
*A>
```
As a workaround one can define a type alias for the `Int -> Int` type.8.6.2Ryan ScottRyan Scotthttps://gitlab.haskell.org/ghc/ghc/-/issues/15814Orphan Instance Overlap Error Message2019-07-07T18:02:52ZparsonsmattOrphan Instance Overlap Error MessageI'm working on moving some code around which unfortunately relies on orphan instances. This is the error I get:
```
/home/matt/Projects/cardano-sl/wallet-new/src/Cardano/Wallet/API/V1/Types.hs:1794:27: error:
• Overlapping i...I'm working on moving some code around which unfortunately relies on orphan instances. This is the error I get:
```
/home/matt/Projects/cardano-sl/wallet-new/src/Cardano/Wallet/API/V1/Types.hs:1794:27: error:
• Overlapping instances for Arbitrary
(NonEmpty PaymentDistribution)
arising from a use of ‘arbitrary’
Matching instances:
instance Arbitrary a => Arbitrary (NonEmpty a)
-- Defined in ‘Pos.Util.Example’
instance [safe] Arbitrary a => Arbitrary (NonEmpty a)
-- Defined in ‘quickcheck-instances-0.3.18:Test.QuickCheck.Instances.Semigroup’
• In the second argument of ‘(<*>)’, namely ‘arbitrary’
In the first argument of ‘(<*>)’, namely
‘Payment <$> arbitrary <*> arbitrary’
In the first argument of ‘(<*>)’, namely
‘Payment <$> arbitrary <*> arbitrary <*> arbitrary’
|
1794 | <*> arbitrary
| ^^^^^^^^^
```
The first instance is the one that I have defined. The second is defined in library code upstream -- great! I want to use that one instead. However, I don't have a clue which module import is providing that instance.
It would be \*fantastic\* if there was an additional line that says which module imported the instance, or brought it into scope. Multiple modules might do this; in this case, reporting any of them would be fine. Eg:
```
/home/matt/Projects/cardano-sl/wallet-new/src/Cardano/Wallet/API/V1/Types.hs:1794:27: error:
• Overlapping instances for Arbitrary
(NonEmpty PaymentDistribution)
arising from a use of ‘arbitrary’
Matching instances:
instance Arbitrary a => Arbitrary (NonEmpty a)
-- Defined in ‘Pos.Util.Example’
-- and imported via
|
186 | import Cardano.Wallet.API.V1.Swagger.Example
|
instance [safe] Arbitrary a => Arbitrary (NonEmpty a)
-- Defined in ‘quickcheck-instances-0.3.18:Test.QuickCheck.Instances.Semigroup’
-- and imported via
|
??? | this information would literally make my day
|
• In the second argument of ‘(<*>)’, namely ‘arbitrary’
In the first argument of ‘(<*>)’, namely
‘Payment <$> arbitrary <*> arbitrary’
In the first argument of ‘(<*>)’, namely
‘Payment <$> arbitrary <*> arbitrary <*> arbitrary’
|
1794 | <*> arbitrary
| ^^^^^^^^^
```
I'll have to binary search the import list to try and figure out which module is bringing the instance into scope otherwise.
<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 | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Orphan Instance Overlap Error Message","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"I'm working on moving some code around which unfortunately relies on orphan instances. This is the error I get:\r\n\r\n{{{\r\n /home/matt/Projects/cardano-sl/wallet-new/src/Cardano/Wallet/API/V1/Types.hs:1794:27: error:\r\n • Overlapping instances for Arbitrary\r\n (NonEmpty PaymentDistribution)\r\n arising from a use of ‘arbitrary’\r\n Matching instances:\r\n instance Arbitrary a => Arbitrary (NonEmpty a)\r\n -- Defined in ‘Pos.Util.Example’\r\n instance [safe] Arbitrary a => Arbitrary (NonEmpty a)\r\n -- Defined in ‘quickcheck-instances-0.3.18:Test.QuickCheck.Instances.Semigroup’\r\n • In the second argument of ‘(<*>)’, namely ‘arbitrary’\r\n In the first argument of ‘(<*>)’, namely\r\n ‘Payment <$> arbitrary <*> arbitrary’\r\n In the first argument of ‘(<*>)’, namely\r\n ‘Payment <$> arbitrary <*> arbitrary <*> arbitrary’\r\n |\r\n 1794 | <*> arbitrary\r\n | ^^^^^^^^^\r\n\r\n}}}\r\n\r\nThe first instance is the one that I have defined. The second is defined in library code upstream -- great! I want to use that one instead. However, I don't have a clue which module import is providing that instance.\r\n\r\nIt would be *fantastic* if there was an additional line that says which module imported the instance, or brought it into scope. Multiple modules might do this; in this case, reporting any of them would be fine. Eg:\r\n\r\n{{{\r\n /home/matt/Projects/cardano-sl/wallet-new/src/Cardano/Wallet/API/V1/Types.hs:1794:27: error:\r\n • Overlapping instances for Arbitrary\r\n (NonEmpty PaymentDistribution)\r\n arising from a use of ‘arbitrary’\r\n Matching instances:\r\n instance Arbitrary a => Arbitrary (NonEmpty a)\r\n -- Defined in ‘Pos.Util.Example’\r\n -- and imported via\r\n |\r\n 186 | import Cardano.Wallet.API.V1.Swagger.Example\r\n |\r\n instance [safe] Arbitrary a => Arbitrary (NonEmpty a)\r\n -- Defined in ‘quickcheck-instances-0.3.18:Test.QuickCheck.Instances.Semigroup’\r\n -- and imported via\r\n |\r\n ??? | this information would literally make my day\r\n |\r\n • In the second argument of ‘(<*>)’, namely ‘arbitrary’\r\n In the first argument of ‘(<*>)’, namely\r\n ‘Payment <$> arbitrary <*> arbitrary’\r\n In the first argument of ‘(<*>)’, namely\r\n ‘Payment <$> arbitrary <*> arbitrary <*> arbitrary’\r\n |\r\n 1794 | <*> arbitrary\r\n | ^^^^^^^^^\r\n}}}\r\n\r\nI'll have to binary search the import list to try and figure out which module is bringing the instance into scope otherwise.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15813-Wredundant-constraints emits warning even if constraint is narrowing type2019-07-07T18:02:53ZJan van Brügge-Wredundant-constraints emits warning even if constraint is narrowing typeI am not sure if this is the same as #12700 , but when having a constraint that uses type equality to narrow down a type, -Wredundant-constraints still emits the warning. My particular example is:
```hs
class RowCons (label :: Symbol) (...I am not sure if this is the same as #12700 , but when having a constraint that uses type equality to narrow down a type, -Wredundant-constraints still emits the warning. My particular example is:
```hs
class RowCons (label :: Symbol) (ty :: k) (tail :: Row k) (row :: Row k)
| label row -> ty tail, label ty tail -> row
instance (RowDelete s r ~ tail, RowPrepend s ty tail ~ r) => RowCons s ty tail r
get :: forall s ty t r. RowCons s ty t r => Record r -> Proxy s -> ty
get _ _ = undefined
test_rec = get (Proxy :: Record ('Cons "foo" '[String])) (Proxy :: Proxy "foo")
```
With the RowCons constraint, the inferred type of test_rec is String (or \[Char\]), but without it it is an ambiguous `ty`.
If the implementation of the type families is needed, they can be found here: https://github.com/jvanbruegge/Megarecord/blob/f65fa5f29dc393e32d42fc87872416ec02405784/src/Megarecord.hs
I tested this with 8.6.1 and 8.4.3