GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2021-03-28T00:32:33Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/18592"stack build yesod-bin" fails on MacOS 11.02021-03-28T00:32:33Zenaluz"stack build yesod-bin" fails on MacOS 11.0## Summary
More information can be found on [this issue](https://github.com/yesodweb/yesod/issues/1693) that I filed for the `yesod` Github repo.
When running `stack build yesod-bin`, I get an error. This is the output:
```
~/D/c/l/h/...## Summary
More information can be found on [this issue](https://github.com/yesodweb/yesod/issues/1693) that I filed for the `yesod` Github repo.
When running `stack build yesod-bin`, I get an error. This is the output:
```
~/D/c/l/h/y/g ❯❯❯ stack build yesod-bin
yesod-bin> configure
yesod-bin> Configuring yesod-bin-1.6.0.6...
yesod-bin> build
yesod-bin> Preprocessing executable 'yesod' for yesod-bin-1.6.0.6..
yesod-bin> Building executable 'yesod' for yesod-bin-1.6.0.6..
yesod-bin> [1 of 7] Compiling AddHandler
yesod-bin> [2 of 7] Compiling Devel
yesod-bin> <command line>: can't load framework: Cocoa (not found)
-- While building package yesod-bin-1.6.0.6 using:
/Users/enaluz/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.3 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0 build --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
~/D/c/l/h/y/test-app ❯❯❯ stack --version
Version 2.3.3, Git revision cb44d51bed48b723a5deb08c3348c0b3ccfc437e x86_64 hpack-0.33.0
```
## Steps to reproduce
`stack new test-app yesodweb/simple && cd test-app && stack build . yesod-bin`
## Expected behavior
I expected `yesod-bin` to build successfully.
## Environment
* GHC version used:
`The Glorious Glasgow Haskell Compilation System, version 8.8.4`
Other helpful information about my machine/environment: https://gist.github.com/enaluz/0e19aefa37ca1b787674ae438db312d7https://gitlab.haskell.org/ghc/ghc/-/issues/18507Ghc crashes on start2020-07-27T16:31:29Zk0inworkGhc crashes on start## Summary
GHC crashes on start
Message:
localhost:~$ ghci
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
ghc: internal error: createAdjustor: failed to allocate memory
(GHC version 8.0.2 for arm_...## Summary
GHC crashes on start
Message:
localhost:~$ ghci
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
ghc: internal error: createAdjustor: failed to allocate memory
(GHC version 8.0.2 for arm_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Aborted
## Steps to reproduce
Install on android userland application
Install ubuntu
Install haskell-platform
Run ghci
Please provide a set of concrete steps to reproduce the issue.
## Expected behavior
What do you expect the reproducer described above to do?
## Environment
* GHC version used:
Optional:
* Operating System:
* System Architecture:https://gitlab.haskell.org/ghc/ghc/-/issues/18456"equirecursive" type family leads to stack overflow in ghci2020-07-17T13:59:54ZXia Li-yao"equirecursive" type family leads to stack overflow in ghci## Summary
Trying to typecheck a term using a (silly) type family such that `T ~ Maybe T` leads to a stack overflow (instead of a proper type error from reaching the max reduction depth, if this is to be an error at all).
## Steps to r...## Summary
Trying to typecheck a term using a (silly) type family such that `T ~ Maybe T` leads to a stack overflow (instead of a proper type error from reaching the max reduction depth, if this is to be an error at all).
## Steps to reproduce
```
> :set -XTypeFamilies -XUndecidableInstances
> type family T where T = Maybe T
> :t Nothing @T
Nothing @T*** Exception: stack overflow
```
(where the exception takes a few seconds to appear)
Compare that output to this variant that immediately produces a proper type error:
```
> :t Nothing @T :: T
<interactive>:5:1 error:
...
```
## Expected behavior
Either a success (`Nothing @T` has type `Maybe T` without requiring any type conversion), or a type error instead of an internal exception.
## Environment
* GHC version used: 8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/18293Dynamic linker not initialised2020-11-05T08:26:52ZreallymemorableDynamic linker not initialised## Summary
Got this error in VSCode:
""panic! (the 'impossible' happened)\n (GHC version 8.6.5 for x86_64-unknown-linux):\n\tDynamic linker not initialised\n\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\n""...## Summary
Got this error in VSCode:
""panic! (the 'impossible' happened)\n (GHC version 8.6.5 for x86_64-unknown-linux):\n\tDynamic linker not initialised\n\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\n""
There are other bug reports in here with people who encountered the same bug and replies saying it is fixed. Not sure why I would still encounter it.
## Steps to reproduce
Attempting to use HIE with ghc865.
## Expected behavior
Not sure how to answer this.
## Environment
* GHC version used:
Optional:
* Operating System:
* System Architecture:https://gitlab.haskell.org/ghc/ghc/-/issues/17942Backpack fails with: Can't find interface-file declaration2020-03-22T17:51:26ZAndrew MartinBackpack fails with: Can't find interface-file declaration## Summary
When using an indefinite module to fill in a signature, backpack succeeds. However, it fails later during instantiation with:
```
typecheckIfaceForInstantiate
Declaration for write#:
Can't find interface-file declaration f...## Summary
When using an indefinite module to fill in a signature, backpack succeeds. However, it fails later during instantiation with:
```
typecheckIfaceForInstantiate
Declaration for write#:
Can't find interface-file declaration for type constructor or class M
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
```
At https://github.com/andrewthad/vex-minimal-reproducer, there is a somewhat minimal reproducer. The repo also includes a readme with more detail about the motivation and some investigation of the error itself.
## Steps to reproduce
```
git clone https://github.com/andrewthad/vex-minimal-reproducer
cd vex-minimal-reproducer
cabal v2-build
```
## Expected behavior
The build should succeed.
## Environment
* GHC version used: 8.8.3, 8.10.1rc, HEAD
cc @ezyangEdward Z. YangEdward Z. Yanghttps://gitlab.haskell.org/ghc/ghc/-/issues/17644Loop in the constraint solver around variables free in kinds2020-01-20T18:20:09ZRichard Eisenbergrae@richarde.devLoop in the constraint solver around variables free in kindsSpun off from the bowels of #17323 (https://gitlab.haskell.org/ghc/ghc/issues/17323#note_243178, https://gitlab.haskell.org/ghc/ghc/issues/17323#note_243577, https://gitlab.haskell.org/ghc/ghc/issues/17323#note_244748), but I think ortho...Spun off from the bowels of #17323 (https://gitlab.haskell.org/ghc/ghc/issues/17323#note_243178, https://gitlab.haskell.org/ghc/ghc/issues/17323#note_243577, https://gitlab.haskell.org/ghc/ghc/issues/17323#note_244748), but I think orthogonal to that ticket. No need to read that ticket to understand this one.
Here is a simple form of the potential problem (due to @simonpj):
```
Inert set:
[G] b ~ a
Work item:
[G] (a :: *) ~ (c :: b -> *) (d :: b)
```
I think GHC will add that work item to the inert set, despite the fact that it seems loopy.
And in this example, I think we'll actually get a loop:
```
a :: e
b :: d -> e
c :: d
d :: Type
e :: Type
f :: e -> Type
g :: d -> Type
inert set:
[D] a ~ b c
[D] e ~ g c
[G] g1 :: d ~ f a -- just having `a` here would violate K3a of Note [Extending the inert equalities]
work item: [D] e ~ f a
```
Let's see what happens.
1. `can_eq_nc'` will get to its flattening clause, so both sides get flattened, yielding `[D] g c ~ f (b c)`.
2. `can_eq_nc'` then decomposes to `[D] g ~ f` and `[D] c ~ b c`. We'll continue here with the latter.
3. On the new work item `[D] c ~ b c`, `can_eq_nc'` will get to its flattening clause, so both sides get flattened, causing no change.
4. Then, we go to `canEqTyVar`. We have `c :: d` but `b c :: e`, so we flatten both kinds. We thus get `[D] (c |> g1) ~ b c`, where `g1 :: d ~ f a` comes from flattening. We then emit `[D] f a ~ e`. The first is irreducible, but the second brings us right back where we started. (Note that `e` isn't rewritten by flattening because the equality for `e` is a Derived, which cannot be used to rewrite a kind.)
[This comment](https://gitlab.haskell.org/ghc/ghc/issues/17644#note_245566) below shows `f8` which shows an actual loop from this case. Plus: the other examples there show cases where simply re-ordering the constraints in a type changes the accept/reject behaviour; this is Bad.https://gitlab.haskell.org/ghc/ghc/-/issues/17306:kind! should adhere to -freduction-depth2019-10-09T09:52:21ZJakob Brünker:kind! should adhere to -freduction-depth## Summary
`:kind!` consumes gigabytes of memory for a while and then fails with `*** Exception: stack overflow` (GHCi itself does **not** crash, as long as enough memory is available) if given a non-terminating type-level expression, w...## Summary
`:kind!` consumes gigabytes of memory for a while and then fails with `*** Exception: stack overflow` (GHCi itself does **not** crash, as long as enough memory is available) if given a non-terminating type-level expression, while using such a type elsewhere will immediately result in ghc announcing that it has reached the limit of it's reduction stack (with size 200 by default, specified by `-freduction-depth`). I can't be sure if this is intended, since `-freduction-depth` doesn't appear to be documented in the user guide, but it's not something I would have expected.
## Steps to reproduce
Type the following in GHCi:
```haskell
:set -XTypeFamilies -XUndecidableInstances
type family F where F = F
:kind! F
```
Typing something like `undefined :: F` works as expected, with an error message about having reached a reduction stack size of 201.
## Expected behavior
I would expect to get the current error message from `undefined :: F` for both `undefined :: F` **and** `:kind! F`.
## Environment
* GHC version used:
8.6.5, 8.8.1, HEAD (8.9.0.20191001)
* Operating System:
Windows, nixos
* System Architecture:
x86_64https://gitlab.haskell.org/ghc/ghc/-/issues/16383ghc: internal error: getMBlock: mmap: Invalid argument (gi-gtk on armv7)2019-07-07T18:00:18ZJens Petersenghc: internal error: getMBlock: mmap: Invalid argument (gi-gtk on armv7)When trying to build gi-gtk-3.0.26 with ghc-8.4.4 on Fedora 30 armv7hl, ghc crashes like this:
```
[484 of 498] Compiling GI.Gtk.Functions ( GI/Gtk/Functions.hs, dist/build/GI/Gtk/Functions.o )
BUILDSTDERR: ghc: internal error: getMBloc...When trying to build gi-gtk-3.0.26 with ghc-8.4.4 on Fedora 30 armv7hl, ghc crashes like this:
```
[484 of 498] Compiling GI.Gtk.Functions ( GI/Gtk/Functions.hs, dist/build/GI/Gtk/Functions.o )
BUILDSTDERR: ghc: internal error: getMBlock: mmap: Invalid argument
BUILDSTDERR: (GHC version 8.4.4 for arm_unknown_linux)
BUILDSTDERR: Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
BUILDSTDERR: /var/tmp/rpm-tmp.McmHQu: line 52: 5271 Aborted (core dumped) ./Setup build
```
https://koji.fedoraproject.org/koji/taskinfo?taskID=33138502
gi-gtk built fine before on ghc-8.2.2 armv7.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.4 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ghc: internal error: getMBlock: mmap: Invalid argument (gi-gtk on armv7)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When trying to build gi-gtk-3.0.26 with ghc-8.4.4 on Fedora 30 armv7hl, ghc crashes like this:\r\n\r\n{{{\r\n[484 of 498] Compiling GI.Gtk.Functions ( GI/Gtk/Functions.hs, dist/build/GI/Gtk/Functions.o )\r\nBUILDSTDERR: ghc: internal error: getMBlock: mmap: Invalid argument\r\nBUILDSTDERR: (GHC version 8.4.4 for arm_unknown_linux)\r\nBUILDSTDERR: Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\nBUILDSTDERR: /var/tmp/rpm-tmp.McmHQu: line 52: 5271 Aborted (core dumped) ./Setup build\r\n}}}\r\n\r\nhttps://koji.fedoraproject.org/koji/taskinfo?taskID=33138502\r\n\r\ngi-gtk built fine before on ghc-8.2.2 armv7.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/16246GHC HEAD-only Core Lint error with unboxed equality (Non-CoVar has coercion t...2020-01-23T19:39:43ZRyan ScottGHC HEAD-only Core Lint error with unboxed equality (Non-CoVar has coercion type)```hs
module Foo where
import Language.Haskell.TH.Lib
import Language.Haskell.TH.Syntax
ueqT :: Q Type
ueqT = conT $ mkNameG_tc "ghc-prim" "GHC.Prim" "~#"
```
```hs
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE T...```hs
module Foo where
import Language.Haskell.TH.Lib
import Language.Haskell.TH.Syntax
ueqT :: Q Type
ueqT = conT $ mkNameG_tc "ghc-prim" "GHC.Prim" "~#"
```
```hs
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where
import Data.Kind
import Foo (ueqT)
data JankyEquality :: Type -> Type -> Type where
Jank :: $ueqT a b -> JankyEquality a b
unJank :: JankyEquality a b -> $ueqT a b
unJank (Jank x) = x
```
```
$ ~/Software/ghc5/inplace/bin/ghc-stage2 --interactive Bug.hs -dcore-lint
GHCi, version 8.7.20190115: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 2] Compiling Foo ( Foo.hs, interpreted )
[2 of 2] Compiling Bug ( Bug.hs, interpreted )
*** Core Lint errors : in result of Desugar (before optimization) ***
<no location info>: warning:
In a case alternative: (Jank x_a4vR :: a_a4wC ~# b_a4wD)
Non-CoVar has coercion type x_a4vR :: a_a4wC ~# b_a4wD
*** Offending Program ***
<elided>
unJank :: forall a b. JankyEquality a b -> a ~# b
[LclIdX]
unJank
= \ (@ a_a4wC)
(@ b_a4wD)
(ds_d4wN :: JankyEquality a_a4wC b_a4wD) ->
case ds_d4wN of wild_00 { Jank x_a4vR -> break<0>() x_a4vR }
```
Note that this passes `-dcore-lint` on GHC 8.0.2 through 8.6.3.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC HEAD-only Core Lint error with unboxed equality (Non-CoVar has coercion type)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.10.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!hs\r\nmodule Foo where\r\n\r\nimport Language.Haskell.TH.Lib\r\nimport Language.Haskell.TH.Syntax\r\n\r\nueqT :: Q Type\r\nueqT = conT $ mkNameG_tc \"ghc-prim\" \"GHC.Prim\" \"~#\"\r\n}}}\r\n{{{#!hs\r\n{-# LANGUAGE KindSignatures #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Foo (ueqT)\r\n\r\ndata JankyEquality :: Type -> Type -> Type where\r\n Jank :: $ueqT a b -> JankyEquality a b\r\n\r\nunJank :: JankyEquality a b -> $ueqT a b\r\nunJank (Jank x) = x\r\n}}}\r\n{{{\r\n$ ~/Software/ghc5/inplace/bin/ghc-stage2 --interactive Bug.hs -dcore-lint\r\nGHCi, version 8.7.20190115: https://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 2] Compiling Foo ( Foo.hs, interpreted )\r\n[2 of 2] Compiling Bug ( Bug.hs, interpreted )\r\n*** Core Lint errors : in result of Desugar (before optimization) ***\r\n<no location info>: warning:\r\n In a case alternative: (Jank x_a4vR :: a_a4wC ~# b_a4wD)\r\n Non-CoVar has coercion type x_a4vR :: a_a4wC ~# b_a4wD\r\n*** Offending Program ***\r\n\r\n<elided>\r\n\r\nunJank :: forall a b. JankyEquality a b -> a ~# b\r\n[LclIdX]\r\nunJank\r\n = \\ (@ a_a4wC)\r\n (@ b_a4wD)\r\n (ds_d4wN :: JankyEquality a_a4wC b_a4wD) ->\r\n case ds_d4wN of wild_00 { Jank x_a4vR -> break<0>() x_a4vR }\r\n}}}\r\n\r\nNote that this passes `-dcore-lint` on GHC 8.0.2 through 8.6.3.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/16135Assertion failure with ExistentialQuantification and ApplicativeDo2024-03-28T05:02:38ZAshley YakeleyAssertion failure with ExistentialQuantification and ApplicativeDo```hs
{-# LANGUAGE ExistentialQuantification, ApplicativeDo #-}
module Bug where
data T f = forall a. MkT (f a)
runf :: forall f. Functor f => IO (T f)
runf = do
return ()
MkT fa <- runf
return $ MkT fa
```
```
Bug.hs:11:...```hs
{-# LANGUAGE ExistentialQuantification, ApplicativeDo #-}
module Bug where
data T f = forall a. MkT (f a)
runf :: forall f. Functor f => IO (T f)
runf = do
return ()
MkT fa <- runf
return $ MkT fa
```
```
Bug.hs:11:18: error:ghc: panic! (the 'impossible' happened)
(GHC version 8.6.3 for x86_64-unknown-linux):
No skolem info:
[a_a1nb[ssk:2]]
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
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```https://gitlab.haskell.org/ghc/ghc/-/issues/16063ghc-8.6.3 + Mac OSX + FFI dependency causes 'impossible happened' compiler f...2023-03-19T03:34:56Zbenselfridgeghc-8.6.3 + Mac OSX + FFI dependency causes 'impossible happened' compiler failureI am trying to build this library: https://github.com/GaloisInc/grift
The build works perfectly on my Mac OS X system under ghc-8.4.4 via the README instructions. However, if I update to ghc-8.6.3, I get the following error:
```
Buildi...I am trying to build this library: https://github.com/GaloisInc/grift
The build works perfectly on my Mac OS X system under ghc-8.4.4 via the README instructions. However, if I update to ghc-8.6.3, I get the following error:
```
Building library for bv-sized-float-0.1.0..
[1 of 2] Compiling Data.BitVector.Sized.Float ( src/Data/BitVector/Sized/Float.hs, /Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/bv-sized-float-0.1.0/build/Data/BitVector/Sized/Float.o )
[2 of 2] Compiling Data.BitVector.Sized.Float.App ( src/Data/BitVector/Sized/Float/App.hs, /Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/bv-sized-float-0.1.0/build/Data/BitVector/Sized/Float/App.o )
ghc: loadArchive: Failed reading header from `/Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/softfloat-hs-0.1.0/build/SoftFloat'
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.3 for x86_64-apple-darwin):
loadArchive "/Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/softfloat-hs-0.1.0/build/SoftFloat": failed
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
The library "softfloat-hs" is a Haskell library that calls C functions that are dynamically linked. If I try to run it within this project via "cabal new-repl softfloat-hs", the dependency works fine. It's only when I try to build "bv-sized-float", which depends on softfloat-hs, that I get the above error.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ghc-8.6.3 + Mac OSX + FFI dependency causes 'impossible happened' compiler failure","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I am trying to build this library: https://github.com/GaloisInc/grift\r\n\r\nThe build works perfectly on my Mac OS X system under ghc-8.4.4 via the README instructions. However, if I update to ghc-8.6.3, I get the following error:\r\n\r\n{{{\r\nBuilding library for bv-sized-float-0.1.0..\r\n[1 of 2] Compiling Data.BitVector.Sized.Float ( src/Data/BitVector/Sized/Float.hs, /Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/bv-sized-float-0.1.0/build/Data/BitVector/Sized/Float.o )\r\n[2 of 2] Compiling Data.BitVector.Sized.Float.App ( src/Data/BitVector/Sized/Float/App.hs, /Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/bv-sized-float-0.1.0/build/Data/BitVector/Sized/Float/App.o )\r\nghc: loadArchive: Failed reading header from `/Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/softfloat-hs-0.1.0/build/SoftFloat'\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.3 for x86_64-apple-darwin):\r\n\tloadArchive \"/Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/softfloat-hs-0.1.0/build/SoftFloat\": failed\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nThe library \"softfloat-hs\" is a Haskell library that calls C functions that are dynamically linked. If I try to run it within this project via \"cabal new-repl softfloat-hs\", the dependency works fine. It's only when I try to build \"bv-sized-float\", which depends on softfloat-hs, that I get the above error.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15984Backpack accepts ill-kinded instantiations. Can cause GHC panic2019-07-07T18:02:09ZaaronvargoBackpack accepts ill-kinded instantiations. Can cause GHC panicGiven the following:
```hs
{-# language KindSignatures #-}
signature A where
data A :: *
```
```hs
module Foo where
import A
foo :: A -> A
foo = id
```
```hs
module IllKindedA where
type A = Maybe
```
GHC allows the signature `A`...Given the following:
```hs
{-# language KindSignatures #-}
signature A where
data A :: *
```
```hs
module Foo where
import A
foo :: A -> A
foo = id
```
```hs
module IllKindedA where
type A = Maybe
```
GHC allows the signature `A` to be instantiated with `IllKindedA`:
```
mixins: foo (Foo as Bug) requires (A as IllKindedA)
```
Using the resulting module can cause odd errors or a panic. E.g. the following causes a panic:
```hs
module Bar where
import Bug
bar = foo
```
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.2 for x86_64-unknown-linux):
getRuntimeRep
A :: * -> *
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:2049:18 in ghc:Type
```8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15979Core Lint error with LiberalTypeSynonyms2022-12-08T17:36:30ZRyan ScottCore Lint error with LiberalTypeSynonymsSee main ticket #22063
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LiberalTypeSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# OPTIONS_GHC -dcore-lint #-}
module Bug where
import Data.Kind
type KindOf (a :: k) = k
wat :: KindOf (forall...See main ticket #22063
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LiberalTypeSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# OPTIONS_GHC -dcore-lint #-}
module Bug where
import Data.Kind
type KindOf (a :: k) = k
wat :: KindOf (forall (a :: ()). a)
wat = ()
```
```
$ /opt/ghc/8.6.2/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
*** Core Lint errors : in result of Desugar (before optimization) ***
<no location info>: warning:
In the type ‘KindOf (forall (a :: ()). a)’
Non-*-like kind when *-like expected: ()
when checking the body of forall: forall (a :: ()). a
*** Offending Program ***
Rec {
$trModule :: Module
[LclIdX]
$trModule = Module (TrNameS "main"#) (TrNameS "Bug"#)
wat :: KindOf (forall (a :: ()). a)
[LclIdX]
wat = ()
end Rec }
*** End of Offense ***
<no location info>: error:
Compilation had errors
```
<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":"Core Lint error with LiberalTypeSynonyms","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":"Bug","description":"{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE LiberalTypeSynonyms #-}\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# OPTIONS_GHC -dcore-lint #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\ntype KindOf (a :: k) = k\r\n\r\nwat :: KindOf (forall (a :: ()). a)\r\nwat = ()\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.6.2/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n*** Core Lint errors : in result of Desugar (before optimization) ***\r\n<no location info>: warning:\r\n In the type ‘KindOf (forall (a :: ()). a)’\r\n Non-*-like kind when *-like expected: ()\r\n when checking the body of forall: forall (a :: ()). a\r\n*** Offending Program ***\r\nRec {\r\n$trModule :: Module\r\n[LclIdX]\r\n$trModule = Module (TrNameS \"main\"#) (TrNameS \"Bug\"#)\r\n\r\nwat :: KindOf (forall (a :: ()). a)\r\n[LclIdX]\r\nwat = ()\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}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15928Improve error message: Reduction stack overflow when using "coerce"2024-01-21T16:25:19ZharendraImprove error message: Reduction stack overflow when using "coerce"EDIT: Executive summary: The error messages below are confusing and not perspicuous to users. We should fix. [ticket:15928\#comment:163956](https://gitlab.haskell.org//ghc/ghc/issues/15928#note_163956) has a concrete suggestion to use as...EDIT: Executive summary: The error messages below are confusing and not perspicuous to users. We should fix. [ticket:15928\#comment:163956](https://gitlab.haskell.org//ghc/ghc/issues/15928#note_163956) has a concrete suggestion to use as a starting point, and [ticket:15928\#comment:163991](https://gitlab.haskell.org//ghc/ghc/issues/15928#note_163991) suggests we print out the role signature of any tycons involved.
Compiling the following snippet results in a "Reduction stack overflow" error message:
```hs
{-# Language ScopedTypeVariables #-}
{-# Language RankNTypes #-}
import Data.Functor.Identity
import Data.Coerce
newtype Stream m a =
Stream {
unStream :: forall r. (Stream m a -> m r) -> m r
}
newtype SerialT m a = SerialT (Stream m a)
g :: SerialT Identity a -> Identity Bool
g m = undefined
idSerial :: SerialT Identity a -> SerialT Identity a
idSerial = id
f :: SerialT Identity a -> Identity Bool
f = g . idSerial . coerce
main = undefined
```
The following error message is produced on compiling this with ghc-8.6.2:
```
xy.hs:26:20: error:
• Reduction stack overflow; size = 201
When simplifying the following type:
Coercible
((Stream Identity a -> Identity r) -> Identity r)
((Stream Identity a0 -> Identity r) -> Identity r)
Use -freduction-depth=0 to disable this check
(any upper bound you could choose might fail unpredictably with
minor updates to GHC, so disabling the check is recommended if
you're sure that type checking should terminate)
• In the second argument of ‘(.)’, namely ‘coerce’
In the second argument of ‘(.)’, namely ‘idSerial . coerce’
In the expression: g . idSerial . coerce
|
26 | f = g . idSerial . coerce
| ^^^^^^
```
When I use an inline signature like this:
```hs
f :: SerialT Identity a -> Identity Bool
f = g . (id :: SerialT Identity a -> SerialT Identity a) . coerce
main = undefined
```
It again results in the same error:
```
xy.hs:18:60: error:
• Reduction stack overflow; size = 201
When simplifying the following type:
Coercible
((Stream Identity a -> Identity r) -> Identity r)
((Stream Identity a0 -> Identity r) -> Identity r)
Use -freduction-depth=0 to disable this check
(any upper bound you could choose might fail unpredictably with
minor updates to GHC, so disabling the check is recommended if
you're sure that type checking should terminate)
• In the second argument of ‘(.)’, namely ‘coerce’
In the second argument of ‘(.)’, namely
‘(id :: SerialT Identity a -> SerialT Identity a) . coerce’
In the expression:
g . (id :: SerialT Identity a -> SerialT Identity a) . coerce
|
18 | f = g . (id :: SerialT Identity a -> SerialT Identity a) . coerce
| ^^^^^^
```
Everything works fine is I use an inline signature with a `forall` keyword like this:
```hs
f :: forall a. SerialT Identity a -> Identity Bool
f = g . (id :: SerialT Identity a -> SerialT Identity a) . coerce
```
I have following questions:
1) Why the first version results in a panic? Is that a bug?
2) The second version might possibly be incorrect code because the types do not unify, but still it should not result in a panic, because of the panic I could not figure out what the problem is. It took a long time to isolate the code and then do some trial and error on it.8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15745Panicking typechecker plugins2019-07-07T18:03:09ZPhil de JouxPanicking typechecker pluginsIf I use a typechecker plugin that fails then ghc panics and I'm asked to report a bug with GHC;
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-apple-darwin):
Prelude.undefined
CallStack (from H...If I use a typechecker plugin that fails then ghc panics and I'm asked to report a bug with GHC;
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-apple-darwin):
Prelude.undefined
CallStack (from HasCallStack):
error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
undefined, called at plugin/Undefined/Solve/Plugin.hs:14:39 in
undefined-solve-plugin-1.0.0.0-56evBabJYBHHTUlrE3HO5m:Undefined.Solve.Plugin
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
Could we please say that it is the typechecker plugin that is panicking and ask for a bug report for the faulty typechecker, giving the issues URL for the plugin if we know it?
The following [undefined plugins](https://github.com/BlockScope/undefined-plugin) fail for init, solve and stop functions.
```haskell
module Undefined.Init.Plugin (plugin) where
import Plugins (Plugin(..), tcPlugin, defaultPlugin)
import TcRnTypes (TcPluginM, TcPluginResult(..), Ct, TcPlugin(..))
import GHC.TcPluginM.Extra (tracePlugin)
plugin :: Plugin
plugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }
undefinedPlugin :: TcPlugin
undefinedPlugin = tracePlugin "undefined-init-plugin" $
TcPlugin
{ tcPluginInit = undefined
, tcPluginSolve = \_ _ _ _ -> return $ TcPluginOk [] []
, tcPluginStop = const $ return ()
}
```
```haskell
module Undefined.Solve.Plugin (plugin) where
import Plugins (Plugin(..), tcPlugin, defaultPlugin)
import TcRnTypes (TcPluginM, TcPluginResult, Ct, TcPlugin(..))
import GHC.TcPluginM.Extra (tracePlugin)
plugin :: Plugin
plugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }
undefinedPlugin :: TcPlugin
undefinedPlugin = tracePlugin "undefined-solve-plugin" $
TcPlugin
{ tcPluginInit = return ()
, tcPluginSolve = \_ _ _ _ -> undefined
, tcPluginStop = const $ return ()
}
```
```haskell
module Undefined.Stop.Plugin (plugin) where
import Plugins (Plugin(..), tcPlugin, defaultPlugin)
import TcRnTypes (TcPluginM, TcPluginResult(..), Ct, TcPlugin(..))
import GHC.TcPluginM.Extra (tracePlugin)
plugin :: Plugin
plugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }
undefinedPlugin :: TcPlugin
undefinedPlugin = tracePlugin "undefined-stop-plugin" $
TcPlugin
{ tcPluginInit = return ()
, tcPluginSolve = \_ _ _ _ -> return $ TcPluginOk [] []
, tcPluginStop = const $ undefined
}
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.2.2 |
| Type | FeatureRequest |
| 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":"Panicking typechecker plugins","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"If I use a typechecker plugin that fails then ghc panics and I'm asked to report a bug with GHC;\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-apple-darwin):\r\n \tPrelude.undefined\r\n CallStack (from HasCallStack):\r\n error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err\r\n undefined, called at plugin/Undefined/Solve/Plugin.hs:14:39 in\r\n undefined-solve-plugin-1.0.0.0-56evBabJYBHHTUlrE3HO5m:Undefined.Solve.Plugin\r\n\r\n Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nCould we please say that it is the typechecker plugin that is panicking and ask for a bug report for the faulty typechecker, giving the issues URL for the plugin if we know it?\r\n\r\nThe following [https://github.com/BlockScope/undefined-plugin undefined plugins] fail for init, solve and stop functions.\r\n\r\n{{{\r\n#!haskell\r\nmodule Undefined.Init.Plugin (plugin) where\r\n\r\nimport Plugins (Plugin(..), tcPlugin, defaultPlugin)\r\nimport TcRnTypes (TcPluginM, TcPluginResult(..), Ct, TcPlugin(..))\r\nimport GHC.TcPluginM.Extra (tracePlugin)\r\n\r\nplugin :: Plugin\r\nplugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }\r\n\r\nundefinedPlugin :: TcPlugin\r\nundefinedPlugin = tracePlugin \"undefined-init-plugin\" $\r\n TcPlugin\r\n { tcPluginInit = undefined\r\n , tcPluginSolve = \\_ _ _ _ -> return $ TcPluginOk [] []\r\n , tcPluginStop = const $ return ()\r\n }\r\n}}}\r\n\r\n\r\n{{{\r\n#!haskell\r\nmodule Undefined.Solve.Plugin (plugin) where\r\n\r\nimport Plugins (Plugin(..), tcPlugin, defaultPlugin)\r\nimport TcRnTypes (TcPluginM, TcPluginResult, Ct, TcPlugin(..))\r\nimport GHC.TcPluginM.Extra (tracePlugin)\r\n\r\nplugin :: Plugin\r\nplugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }\r\n\r\nundefinedPlugin :: TcPlugin\r\nundefinedPlugin = tracePlugin \"undefined-solve-plugin\" $\r\n TcPlugin\r\n { tcPluginInit = return ()\r\n , tcPluginSolve = \\_ _ _ _ -> undefined\r\n , tcPluginStop = const $ return ()\r\n }\r\n}}}\r\n\r\n{{{\r\n#!haskell\r\nmodule Undefined.Stop.Plugin (plugin) where\r\n\r\nimport Plugins (Plugin(..), tcPlugin, defaultPlugin)\r\nimport TcRnTypes (TcPluginM, TcPluginResult(..), Ct, TcPlugin(..))\r\nimport GHC.TcPluginM.Extra (tracePlugin)\r\n\r\nplugin :: Plugin\r\nplugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }\r\n\r\nundefinedPlugin :: TcPlugin\r\nundefinedPlugin = tracePlugin \"undefined-stop-plugin\" $\r\n TcPlugin\r\n { tcPluginInit = return ()\r\n , tcPluginSolve = \\_ _ _ _ -> return $ TcPluginOk [] []\r\n , tcPluginStop = const $ undefined\r\n }\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14987Memory usage exploding for complex pattern matching2020-05-02T22:45:07ZvmiraldoMemory usage exploding for complex pattern matchingIt seems like complex pattern matching is consuming a prohibitive amount of memory. From a discussion in ghc-devs, [https://mail.haskell.org/pipermail/ghc-devs/2018-March/015538.html](https://mail.haskell.org/pipermail/ghc-devs/2018-Marc...It seems like complex pattern matching is consuming a prohibitive amount of memory. From a discussion in ghc-devs, [https://mail.haskell.org/pipermail/ghc-devs/2018-March/015538.html](https://mail.haskell.org/pipermail/ghc-devs/2018-March/015538.html), the exhaustiveness checker could be the culprit.
We have tried with 7.10.3, 8.0.2, 8.4.1 and ghc-HEAD. They show similar results.
The "-fmax-pmchecker-iterations=0" option seems to help slightly. Bigger cases
will run out of memory even with the option enabled.
I'm attaching a "minimal" example to help diagnosing. The majority of the
code has been generated by Template Haskell.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"Memory usage exploding for complex pattern matching","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"It seems like complex pattern matching is consuming a prohibitive amount of memory. From a discussion in ghc-devs, [https://mail.haskell.org/pipermail/ghc-devs/2018-March/015538.html], the exhaustiveness checker could be the culprit. \r\n\r\nWe have tried with 7.10.3, 8.0.2, 8.4.1 and ghc-HEAD. They show similar results.\r\n\r\nThe \"-fmax-pmchecker-iterations=0\" option seems to help slightly. Bigger cases\r\nwill run out of memory even with the option enabled.\r\n\r\nI'm attaching a \"minimal\" example to help diagnosing. The majority of the\r\ncode has been generated by Template Haskell.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14908Compiling using O1 works but panic using O2 or O32019-07-07T18:15:05ZjosejuanCompiling using O1 works but panic using O2 or O3<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.2 |
| Type | Bug |
| TypeOfFailure |...<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Compiling using O1 works but panic using O2 or O3","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14679The interpreter showed panic! (the 'impossible' happened)2019-07-07T18:16:02Zcrick_The interpreter showed panic! (the 'impossible' happened)My code -
```hs
{-
Example run:
Enter initial state:
12356 784
Enter final state:
123586 74
1 2 3
5 8 6
7 4
1 2 3
5 8 6
7 4
1 2 3
5 6
7 8 4
1 2 3
5 6
7 8 4
Minimum path length: 3
-}
import Data.List
import Data.List.Split
...My code -
```hs
{-
Example run:
Enter initial state:
12356 784
Enter final state:
123586 74
1 2 3
5 8 6
7 4
1 2 3
5 8 6
7 4
1 2 3
5 6
7 8 4
1 2 3
5 6
7 8 4
Minimum path length: 3
-}
import Data.List
import Data.List.Split
import Data.Map as Map hiding (map, filter)
swap :: Int -> Int -> State -> State
swap i j (State xs depth) = let (i', j') = if i > j then (j ,i) else (i, j)
left = take i' xs
middle = drop (i'+1) $ take j' xs
i_elem = xs !! i'
right = drop (j'+1) xs
j_elem = xs !! j'
xs' = left ++ [j_elem] ++ middle ++ [i_elem] ++ right
in (State xs' depth)
printGrid :: State -> IO()
printGrid (State xs depth) = let [x,y,z] = chunksOf 6 $ intersperse ' ' xs
in do putStrLn x
putStrLn y
putStrLn z
putStrLn ""
data State = State {
state :: [Char],
depth :: Int
} deriving (Eq, Show, Ord)
getMoves :: State -> [Char]
getMoves (State xs depth) = case ' ' `elemIndex` xs of
Nothing -> error "Empty block not found"
Just n -> let l = n `elem` [1,4,7,2,5,8]
r = n `elem` [0,3,6,1,4,7]
d = n `elem` [0..5]
u = n `elem` [3..8]
pairs = zip [l,r,d,u] ['L','R','D','U']
filtered = filter (\x -> fst x) pairs
in map snd filtered
next :: State -> [Char] -> [State]
next (State state depth) cs = case ' ' `elemIndex` state of
Nothing -> error "Empty block not found"
Just n -> do c <- cs
return $ case c of
'L' -> swap n (n-1) (State state (depth + 1))
'R' -> swap n (n+1) (State state (depth + 1))
'U' -> swap n (n-3) (State state (depth + 1))
'D' -> swap n (n+3) (State state (depth + 1))
test :: State -> State -> Bool
test state1 state2 = (state state1) == (state state2)
-- loop :: finalState -> open -> closed -> accmulated parentMap -> parentMap
loop :: State -> [State] -> [State] -> Map State State -> Maybe (State, Map State State)
loop final [] _ _ = Nothing
loop final open@(x:xs) closed parentMap = if test final x
then Just (x, parentMap)
else let moves = getMoves x
nextStates = next x moves
filter_fn = \x -> not (x `elem` open || x `elem` closed)
filtered = filter filter_fn nextStates
newMap = insertIntoMap filtered x parentMap
in loop final (xs ++ filtered) (x:closed) newMap
insertIntoMap :: [State] -> State -> Map State State -> Map State State
insertIntoMap [] _ parentMap = parentMap
insertIntoMap (x:xs) parent parentMap =
insertIntoMap xs parent (Map.insert x parent parentMap)
printAns :: State -> Map State State -> Int -> IO ()
printAns state parentMap count =
case Map.lookup state parentMap of
Just parent -> do printGrid parent
printAns parent parentMap (count + 1)
Nothing -> do putStrLn $ "Minimum path length: " ++ show count
return ()
ans :: Maybe (State, Map State State) -> IO ()
ans (Just (final, parentMap)) = do
printGrid final
printAns final parentMap 0
ans _ = putStrLn "No answer found."
main :: IO ()
main = do putStrLn "Enter initial state: "
start <- getLine
putStrLn "Enter final state: "
final <- getLine
ans $ loop (State final 0) [(State start 0)] [] Map.empty
```
Test Cases I entered in the order:
- Main\> main
Enter initial state:
123456 784
Enter final state:
1234567 8mianrrupted.
- Main\>
- Main\> main
Enter initial state:
12356 784
Enter final state:
123586 74
1 2 3
5 8 6
> 7 4
1 2 3
5 8 6
7 4
1 2 3
5 6
7 8 4
1 2 3
5 6
7 8 4
Minimum path length: 3
- Main\>
\<interactive\>: panic! (the 'impossible' happened)
(GHC version 8.0.1 for x86_64-unknown-mingw32):
> thread blocked indefinitely in an MVar operation
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Windows |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"The interpreter showed panic! (the 'impossible' happened)","status":"New","operating_system":"Windows","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":["panic"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"My code - \r\n\r\n{{{#!hs\r\n{-\r\nExample run:\r\n\r\nEnter initial state:\r\n12356 784\r\nEnter final state:\r\n\r\n123586 74\r\n1 2 3\r\n5 8 6\r\n 7 4\r\n\r\n1 2 3\r\n5 8 6\r\n7 4\r\n\r\n1 2 3\r\n5 6\r\n7 8 4\r\n\r\n1 2 3\r\n5 6\r\n7 8 4\r\n\r\nMinimum path length: 3\r\n\r\n-}\r\n\r\nimport Data.List\r\nimport Data.List.Split\r\nimport Data.Map as Map hiding (map, filter)\r\n\r\nswap :: Int -> Int -> State -> State\r\nswap i j (State xs depth) = let (i', j') = if i > j then (j ,i) else (i, j)\r\n left = take i' xs\r\n middle = drop (i'+1) $ take j' xs\r\n i_elem = xs !! i'\r\n right = drop (j'+1) xs\r\n j_elem = xs !! j'\r\n xs' = left ++ [j_elem] ++ middle ++ [i_elem] ++ right\r\n in (State xs' depth)\r\n\r\nprintGrid :: State -> IO()\r\nprintGrid (State xs depth) = let [x,y,z] = chunksOf 6 $ intersperse ' ' xs\r\n in do putStrLn x\r\n putStrLn y\r\n putStrLn z\r\n putStrLn \"\"\r\n\r\ndata State = State {\r\n state :: [Char],\r\n depth :: Int\r\n} deriving (Eq, Show, Ord)\r\n\r\ngetMoves :: State -> [Char]\r\ngetMoves (State xs depth) = case ' ' `elemIndex` xs of\r\n Nothing -> error \"Empty block not found\"\r\n Just n -> let l = n `elem` [1,4,7,2,5,8]\r\n r = n `elem` [0,3,6,1,4,7]\r\n d = n `elem` [0..5]\r\n u = n `elem` [3..8]\r\n pairs = zip [l,r,d,u] ['L','R','D','U']\r\n filtered = filter (\\x -> fst x) pairs\r\n in map snd filtered\r\n\r\nnext :: State -> [Char] -> [State]\r\nnext (State state depth) cs = case ' ' `elemIndex` state of\r\n Nothing -> error \"Empty block not found\"\r\n Just n -> do c <- cs\r\n return $ case c of\r\n 'L' -> swap n (n-1) (State state (depth + 1))\r\n 'R' -> swap n (n+1) (State state (depth + 1))\r\n 'U' -> swap n (n-3) (State state (depth + 1))\r\n 'D' -> swap n (n+3) (State state (depth + 1))\r\n\r\ntest :: State -> State -> Bool\r\ntest state1 state2 = (state state1) == (state state2)\r\n\r\n-- loop :: finalState -> open -> closed -> accmulated parentMap -> parentMap\r\nloop :: State -> [State] -> [State] -> Map State State -> Maybe (State, Map State State)\r\nloop final [] _ _ = Nothing\r\nloop final open@(x:xs) closed parentMap = if test final x\r\n then Just (x, parentMap)\r\n else let moves = getMoves x\r\n nextStates = next x moves\r\n filter_fn = \\x -> not (x `elem` open || x `elem` closed)\r\n filtered = filter filter_fn nextStates\r\n newMap = insertIntoMap filtered x parentMap\r\n in loop final (xs ++ filtered) (x:closed) newMap\r\n\r\ninsertIntoMap :: [State] -> State -> Map State State -> Map State State\r\ninsertIntoMap [] _ parentMap = parentMap\r\ninsertIntoMap (x:xs) parent parentMap =\r\n insertIntoMap xs parent (Map.insert x parent parentMap)\r\n\r\nprintAns :: State -> Map State State -> Int -> IO ()\r\nprintAns state parentMap count =\r\n case Map.lookup state parentMap of\r\n Just parent -> do printGrid parent\r\n printAns parent parentMap (count + 1)\r\n Nothing -> do putStrLn $ \"Minimum path length: \" ++ show count\r\n return ()\r\n\r\nans :: Maybe (State, Map State State) -> IO ()\r\nans (Just (final, parentMap)) = do\r\n printGrid final\r\n printAns final parentMap 0\r\nans _ = putStrLn \"No answer found.\"\r\n\r\nmain :: IO ()\r\nmain = do putStrLn \"Enter initial state: \"\r\n start <- getLine\r\n putStrLn \"Enter final state: \"\r\n final <- getLine\r\n ans $ loop (State final 0) [(State start 0)] [] Map.empty\r\n\r\n}}}\r\n\r\nTest Cases I entered in the order:\r\n\r\n*Main> main\r\n\r\nEnter initial state:\r\n123456 784\r\n\r\nEnter final state:\r\n1234567 8mianrrupted.\r\n\r\n*Main>\r\n\r\n*Main> main\r\n\r\nEnter initial state:\r\n12356 784\r\n\r\nEnter final state:\r\n123586 74\r\n\r\n1 2 3\r\n5 8 6\r\n 7 4\r\n\r\n1 2 3\r\n5 8 6\r\n7 4\r\n\r\n\r\n1 2 3\r\n5 6\r\n7 8 4\r\n\r\n1 2 3\r\n5 6\r\n7 8 4\r\n\r\n\r\nMinimum path length: 3\r\n*Main>\r\n<interactive>: panic! (the 'impossible' happened)\r\n (GHC version 8.0.1 for x86_64-unknown-mingw32):\r\n thread blocked indefinitely in an MVar operation\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14649ghc panic: mergeSATInfo2021-03-26T18:16:22Ztianxiaogughc panic: mergeSATInfoghc panic with option `-O` and `-fstatic-argument-transformation`.
Affected versions include 8.2.2 and HEAD (8.5.20180108)
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE PolyKinds ...ghc panic with option `-O` and `-fstatic-argument-transformation`.
Affected versions include 8.2.2 and HEAD (8.5.20180108)
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module T12844 where
barWraper :: ('(r,r') ~ Head rngs, Foo rngs) => FooData rngs
barWraper = bar
bar :: (_) => FooData rngs
bar = barWraper
data FooData rngs
class Foo xs where foo :: (Head xs ~ '(r,r')) => FooData xs
type family Head (xs :: [k]) where Head (x ': xs) = x
```
Log:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.5.20180108 for x86_64-unknown-linux):
mergeSATInfo
Left:STSTSTSTSTSVSV, Right:STSTSTSTSTSVSC
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/simplCore/SAT.hs:152:20 in ghc:SAT
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ghc panic: mergeSATInfo","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"ghc panic with option `-O` and `-fstatic-argument-transformation`.\r\nAffected versions include 8.2.2 and HEAD (8.5.20180108)\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE PartialTypeSignatures #-}\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n\r\nmodule T12844 where\r\n\r\nbarWraper :: ('(r,r') ~ Head rngs, Foo rngs) => FooData rngs\r\nbarWraper = bar\r\n\r\nbar :: (_) => FooData rngs\r\nbar = barWraper\r\n\r\ndata FooData rngs\r\n\r\nclass Foo xs where foo :: (Head xs ~ '(r,r')) => FooData xs\r\n\r\ntype family Head (xs :: [k]) where Head (x ': xs) = x\r\n}}}\r\n\r\nLog:\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.5.20180108 for x86_64-unknown-linux):\r\n\tmergeSATInfo\r\n Left:STSTSTSTSTSVSV, Right:STSTSTSTSTSVSC\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable\r\n pprPanic, called at compiler/simplCore/SAT.hs:152:20 in ghc:SAT\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14637Simplifier Ticks Exhausted when compiling with profiling2022-03-08T21:02:41ZcfhammillSimplifier Ticks Exhausted when compiling with profilingHi GHC devs,
I've run into a problem with the Frames library, I can compile a simple example using stack without executable profiling enabled, but when I enable profiling I get the simplifier ticks exhausted error. I've tried using -fsi...Hi GHC devs,
I've run into a problem with the Frames library, I can compile a simple example using stack without executable profiling enabled, but when I enable profiling I get the simplifier ticks exhausted error. I've tried using -fsimpl-tick-factor=1000 to no avail. I've attached the stack config, cabal file, haskell code, two csv files, and the simplifier dump. Any help would be appreciated.
Chris
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Simplifier Ticks Exhausted when compiling with profiling","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Hi GHC devs,\r\n\r\nI've run into a problem with the Frames library, I can compile a simple example using stack without executable profiling enabled, but when I enable profiling I get the simplifier ticks exhausted error. I've tried using -fsimpl-tick-factor=1000 to no avail. I've attached the stack config, cabal file, haskell code, two csv files, and the simplifier dump. Any help would be appreciated.\r\n\r\nChris","type_of_failure":"OtherFailure","blocking":[]} -->