GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2023-12-15T08:12:41Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/10185Coercible solver incomplete with non-variable transitivity2023-12-15T08:12:41ZRichard Eisenbergrae@richarde.devCoercible solver incomplete with non-variable transitivityIf I say
```
import Data.Coerce
import Data.Proxy
foo :: (Coercible (a b) (c d), Coercible (c d) (e f)) => Proxy (c d) -> a b -> e f
foo _ = coerce
```
I get an error, because GHC isn't smart enough to figure out transitivity in this ...If I say
```
import Data.Coerce
import Data.Proxy
foo :: (Coercible (a b) (c d), Coercible (c d) (e f)) => Proxy (c d) -> a b -> e f
foo _ = coerce
```
I get an error, because GHC isn't smart enough to figure out transitivity in this case. It *can* do it with bare variables, but not variable applications. It's possible there's a way to do this, but we'll wait for someone to shout before investing effort.
Do shout if this lack of functionality is ruining your day!
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.11 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Coercible solver incomplete with non-variable transitivity","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"⊥","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.11","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"If I say\r\n\r\n{{{\r\nimport Data.Coerce\r\nimport Data.Proxy\r\n\r\nfoo :: (Coercible (a b) (c d), Coercible (c d) (e f)) => Proxy (c d) -> a b -> e f\r\nfoo _ = coerce\r\n}}}\r\n\r\nI get an error, because GHC isn't smart enough to figure out transitivity in this case. It ''can'' do it with bare variables, but not variable applications. It's possible there's a way to do this, but we'll wait for someone to shout before investing effort.\r\n\r\nDo shout if this lack of functionality is ruining your day!","type_of_failure":"OtherFailure","blocking":[]} -->⊥https://gitlab.haskell.org/ghc/ghc/-/issues/10184Coercible solver incomplete with recursive newtypes2023-12-15T08:12:52ZRichard Eisenbergrae@richarde.devCoercible solver incomplete with recursive newtypesThe following module fails to compile due to infinite recursion:
```
import Data.Coerce
newtype Bar a = Bar (Either a (Bar a))
newtype Age = MkAge Int
x :: Bar Age
x = coerce (Bar (Left (5 :: Int)))
```
It tries to coerce `Bar Int` t...The following module fails to compile due to infinite recursion:
```
import Data.Coerce
newtype Bar a = Bar (Either a (Bar a))
newtype Age = MkAge Int
x :: Bar Age
x = coerce (Bar (Left (5 :: Int)))
```
It tries to coerce `Bar Int` to `Bar Age`. This is clearly doable, via tyconapp decomposition. But we don't find it. Before worrying too much about it, though, we'll wait for a real example.
Do speak up if this problem is ruining your day!
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.10.1-rc3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Coercible solver incomplete with recursive newtypes","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"⊥","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.1-rc3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following module fails to compile due to infinite recursion:\r\n\r\n{{{\r\nimport Data.Coerce\r\n\r\nnewtype Bar a = Bar (Either a (Bar a))\r\nnewtype Age = MkAge Int\r\n\r\nx :: Bar Age\r\nx = coerce (Bar (Left (5 :: Int)))\r\n}}}\r\n\r\nIt tries to coerce `Bar Int` to `Bar Age`. This is clearly doable, via tyconapp decomposition. But we don't find it. Before worrying too much about it, though, we'll wait for a real example.\r\n\r\nDo speak up if this problem is ruining your day!","type_of_failure":"OtherFailure","blocking":[]} -->⊥https://gitlab.haskell.org/ghc/ghc/-/issues/8316GHCi debugger panics when trying force a certain variable2019-07-07T18:45:35ZguestGHCi debugger panics when trying force a certain variableThe file Test.hs has following definition:
```
foo :: [Int]
foo = [1..]
```
Calling ghci as:
```
ghci Test.hs -ignore-dot-ghci
```
and bebugging foo like this:
```
*Main> :break foo
Breakpoint 0 activated at main.hs:2:7-11
*Main> fo...The file Test.hs has following definition:
```
foo :: [Int]
foo = [1..]
```
Calling ghci as:
```
ghci Test.hs -ignore-dot-ghci
```
and bebugging foo like this:
```
*Main> :break foo
Breakpoint 0 activated at main.hs:2:7-11
*Main> foo
Stopped in Main.foo, main.hs:2:7-11
_result :: [Int] = _
[main.hs:2:7-11] *Main> :print foo
foo = (_t1::[Int])
[main.hs:2:7-11] *Main> _t1
```
results in this panic:
```
<interactive>: internal error: TSO object entered!
(GHC version 8.5.20180302 for x86_64_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
[1] 5445 abort (core dumped) ghci Test.hs -ignore-dot-ghci
```⊥NolanNolan