GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:20:59Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/13612ghc.exe: panic! (the 'impossible' happened)2019-07-07T18:20:59Zhmemcpyghc.exe: panic! (the 'impossible' happened)Full output:
```
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-mingw32):
initTc: unsolved constraints
WC {wc_insol = [W] n_a1qA :: t_a1qz[tau:1] (CHoleCan: n)}
Please report this as a GHC...Full output:
```
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-mingw32):
initTc: unsolved constraints
WC {wc_insol = [W] n_a1qA :: t_a1qz[tau:1] (CHoleCan: n)}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
This failed on a trivial (albeit incorrect) "Hello world" code, while trying to execute it with stack: \*\*stack Main.hs\*\*
The code file is attached.
Note that this error happens when it incorrectly specifies the non-existing value \*\*n\*\* (instead of \*\*name\*\*) in the last expression.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ghc.exe: panic! (the 'impossible' happened)","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":"Full output:\r\n{{{\r\nghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.0.2 for x86_64-unknown-mingw32):\r\n initTc: unsolved constraints\r\n WC {wc_insol = [W] n_a1qA :: t_a1qz[tau:1] (CHoleCan: n)}\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nThis failed on a trivial (albeit incorrect) \"Hello world\" code, while trying to execute it with stack: **stack Main.hs**\r\n\r\nThe code file is attached.\r\n\r\nNote that this error happens when it incorrectly specifies the non-existing value **n** (instead of **name**) in the last expression.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/13611Segfault due to levity polymorphism of mkWeak#2019-07-07T18:20:59ZJoachim Breitnermail@joachim-breitner.deSegfault due to levity polymorphism of mkWeak#This code segfaults:
```
{-# LANGUAGE MagicHash, UnboxedTuples #-}
import GHC.Prim
import GHC.Types
main = do
let local = ()
let null = 0## :: Word#
let triple = (# local, null, null #)
IO (\s -> case mkWeakNoFinalizer#...This code segfaults:
```
{-# LANGUAGE MagicHash, UnboxedTuples #-}
import GHC.Prim
import GHC.Types
main = do
let local = ()
let null = 0## :: Word#
let triple = (# local, null, null #)
IO (\s -> case mkWeakNoFinalizer# triple () s of (# s, r #) -> (# s, () #))
```
The problem is that `mkWeakNoFinalizer#` has a levity polymorphic type for its first argument, but the implementation really requires the first argument to be a pointer.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | goldfire |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Segfault due to levity polymorphism of mkWeak#","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["goldfire"],"type":"Bug","description":"This code segfaults:\r\n\r\n{{{\r\n{-# LANGUAGE MagicHash, UnboxedTuples #-}\r\nimport GHC.Prim\r\nimport GHC.Types\r\n\r\nmain = do\r\n let local = ()\r\n let null = 0## :: Word#\r\n let triple = (# local, null, null #)\r\n IO (\\s -> case mkWeakNoFinalizer# triple () s of (# s, r #) -> (# s, () #))\r\n}}}\r\n\r\n\r\nThe problem is that `mkWeakNoFinalizer#` has a levity polymorphic type for its first argument, but the implementation really requires the first argument to be a pointer.","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/13610Unhelpful error messages about lifted and unlifted types2019-07-07T18:21:00ZJoachim Breitnermail@joachim-breitner.deUnhelpful error messages about lifted and unlifted typesI wrote this code:
```
{-# LANGUAGE MagicHash #-}
import GHC.Prim
import GHC.Types
main = do
let primDouble = 0.42## :: Double#
let double = 0.42 :: Double
IO (\s -> mkWeakNoFinalizer# double () s)
```
and I get this error...I wrote this code:
```
{-# LANGUAGE MagicHash #-}
import GHC.Prim
import GHC.Types
main = do
let primDouble = 0.42## :: Double#
let double = 0.42 :: Double
IO (\s -> mkWeakNoFinalizer# double () s)
```
and I get this error message:
```
WeakDouble.hs:8:15: error:
• Couldn't match a lifted type with an unlifted type
Expected type: (# State# RealWorld, Weak# () #)
Actual type: (# State# RealWorld, Weak# () #)
• In the expression: mkWeakNoFinalizer# double () s
In the first argument of ‘IO’, namely
‘(\ s -> mkWeakNoFinalizer# double () s)’
In a stmt of a 'do' block:
IO (\ s -> mkWeakNoFinalizer# double () s)
```
with `-fprint-explicit-kinds`. (Without the flag, it looks the same, but tells me to use this flag…).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | goldfire |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Unhelpful error messages about lifted and unlifted types","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["goldfire"],"type":"Bug","description":"I wrote this code:\r\n{{{\r\n{-# LANGUAGE MagicHash #-}\r\nimport GHC.Prim\r\nimport GHC.Types\r\n\r\nmain = do\r\n let primDouble = 0.42## :: Double#\r\n let double = 0.42 :: Double\r\n IO (\\s -> mkWeakNoFinalizer# double () s)\r\n}}}\r\nand I get this error message:\r\n{{{\r\nWeakDouble.hs:8:15: error:\r\n • Couldn't match a lifted type with an unlifted type\r\n Expected type: (# State# RealWorld, Weak# () #)\r\n Actual type: (# State# RealWorld, Weak# () #)\r\n • In the expression: mkWeakNoFinalizer# double () s\r\n In the first argument of ‘IO’, namely\r\n ‘(\\ s -> mkWeakNoFinalizer# double () s)’\r\n In a stmt of a 'do' block:\r\n IO (\\ s -> mkWeakNoFinalizer# double () s)\r\n}}}\r\nwith `-fprint-explicit-kinds`. (Without the flag, it looks the same, but tells me to use this flag…).","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/13609regression: `ANN` pragmas no longer ignored in TH-less GHC 8.2.12019-07-07T18:21:00ZHerbert Valerio Riedelhvr@gnu.orgregression: `ANN` pragmas no longer ignored in TH-less GHC 8.2.1Consider
```hs
module M where
{-# ANN myId "HLint: ignore" #-}
myId :: a -> a
myId x = x
```
GHC 8.0.2 would simply ignore them:
```
$ ghc-8.0.2 -c M.hs
M.hs:3:1: warning:
Ignoring ANN annotation, because this is a stage-1 com...Consider
```hs
module M where
{-# ANN myId "HLint: ignore" #-}
myId :: a -> a
myId x = x
```
GHC 8.0.2 would simply ignore them:
```
$ ghc-8.0.2 -c M.hs
M.hs:3:1: warning:
Ignoring ANN annotation, because this is a stage-1 compiler or doesn't support GHCi
```
however, with a recent GHC 8.2 snapshot this just fails with
```
$ ghc-8.2 -c M.hs
ghc: this operation requires -fexternal-interpreter
```
This is a serious problem because `hlint` annotations are quite popular, and this would require us to retrofit `other-extensions: TemplateHaskell` into the meta-data of quite a few packages on Hackage to declare that a package no longer works with a TH-less GHC (which would basically mean that ports of GHC such as the one for AIX that don't support TH will become very inconvenient to use and require to pester package authors to explicitly guard `ANN` pragmas with CPP... which I'm not looking forward to ;-) ).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.1-rc1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"regression: `ANN` pragmas for TH-less GHCs no longer ignored in GHC 8.2.1","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.2.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.1-rc1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider\r\n\r\n{{{#!hs\r\nmodule M where\r\n\r\n{-# ANN myId \"HLint: ignore\" #-} \r\nmyId :: a -> a\r\nmyId x = x\r\n}}}\r\n\r\nGHC 8.0.2 would simply ignore them:\r\n\r\n{{{\r\n$ ghc-8.0.2 -c M.hs \r\n\r\nM.hs:3:1: warning:\r\n Ignoring ANN annotation, because this is a stage-1 compiler or doesn't support GHCi\r\n}}}\r\n\r\nhowever, with a recent GHC 8.2 snapshot this just fails with\r\n\r\n{{{\r\n$ ghc-8.2 -c M.hs \r\n\r\nghc: this operation requires -fexternal-interpreter\r\n}}}\r\n\r\nThis is a serious problem because `hlint` annotations are quite popular, and this would require us to retrofit `other-extensions: TemplateHaskell` into the meta-data of quite a few packages on Hackage to declare that a package no longer works with a TH-less GHC (which would basically mean that ports of GHC such as the one for AIX that don't support TH will become very inconvenient to use and require to pester package authors to explicitly guard `ANN` pragmas with CPP... which I'm not looking forward to ;-) ). ","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/13608Expose the type of quasiquotes2019-07-07T18:21:01ZFacundo DomínguezExpose the type of quasiquotesIt happens with inline-java that
```
[java| 0.0 |]
```
produces a static method in java
```
Object fresh_name() { return 0.0; }
```
where
```
double fresh_name() { return 0.0; }
```
would be preferred. This is better because the us...It happens with inline-java that
```
[java| 0.0 |]
```
produces a static method in java
```
Object fresh_name() { return 0.0; }
```
where
```
double fresh_name() { return 0.0; }
```
would be preferred. This is better because the user would get an error if the expression does not match the expected result type.
Examining the type that GHC expects of the quasiquote would allow to build the later variant. However, GHC provides no access to it.
The quasiquote desugars as follows:
```
[java| 0.0 |]
====>
$(quoteExp java " 0.0 ")
```
We have experimented with a patch that desugars instead like
```
[java| 0.0 |]
====>
let __ghc_qq_<loc_hash> = $(quoteExp java " 0.0 ")
in __ghc_qq_<loc_hash>
```
The quasiquoter can learn then of the expected type by doing:
```
do qqName <- getCurrentQuasiQuoteName
addModFinalizer $ reify qqName >>= ...
where
getCurrentQuasiQuoteName :: Q Name
getCurrentQuasiQuoteName = do
loc <- TH.location
return $ mkName $ "__ghc_qq_" ++ hash loc
```
Where `getCurrentQuasiQuoteName` can be provided in `Language.Haskell.TH.Quote`.
This addresses the same concern that I initially intended to solve with the more complex proposal in #12778.
I hope to submit a patch this week, but it would be useful if people want to provide some feedback meanwhile.8.4.1Facundo DomínguezFacundo Domínguezhttps://gitlab.haskell.org/ghc/ghc/-/issues/13607Panic when shared object file is missing: Dynamic linker not initialised2020-09-28T07:11:38ZRyan ScottPanic when shared object file is missing: Dynamic linker not initialisedThere are several Trac tickets floating around which mention this panic, including:
- #9868 (ghc: panic! Dynamic linker not initialised)
- #10355 (Dynamic linker not initialised)
- #10919 (ghc: panic! (the 'impossible' happened) ... Dyn...There are several Trac tickets floating around which mention this panic, including:
- #9868 (ghc: panic! Dynamic linker not initialised)
- #10355 (Dynamic linker not initialised)
- #10919 (ghc: panic! (the 'impossible' happened) ... Dynamic linker not initialised)
- #13137 (Dynamic linker not initialised.)
- #13531 (GHC fails with "Dynamic linker not initialised" when -j is on and trying to load nonexistent .so file)
However, none seem particularly simple to reproduce. I have a (marginally) easier way to trigger this panic. You'll need the following:
- A copy of GHC HEAD built with the `prof` flavor. For reference, I am using GHC HEAD built against 1f4fd37efac4795493677d5df81c83d22eac5f74.
- A single package built with `cabal-install`. For simplicity, I used `random`:
```
$ cabal install random-1.1 -w ~/Software/ghc3/inplace/bin/ghc-stage2
```
Once it's installed, you'll need to learn `random`'s package ID, which can be done with `ghc-pkg`. For instance:
```
3$ ~/Software/ghc3/inplace/bin/ghc-pkg describe random
name: random
version: 1.1
id: random-1.1-Gnn89iTXDuaz90MEyLmyr
...
```
- You'll need these three Haskell files:
```hs
-- Foo.hs
{-# LANGUAGE TemplateHaskell #-}
module Foo where
import Language.Haskell.TH
foo :: Bool
foo = $(conE 'True)
```
```hs
-- Foo2.hs
{-# LANGUAGE TemplateHaskell #-}
module Foo2 where
import Language.Haskell.TH
foo2 = $(conE 'False)
```
```hs
-- Bar.hs
module Bar where
import Foo
import Foo2
bar :: ()
bar = foo `seq` foo2 `seq` ()
```
Once you have all of these, you can trigger the bug by invoking GHC like so:
```
$ ~/Software/ghc3/inplace/bin/ghc-stage2 -fforce-recomp Bar.hs -j2 -package-id random-1.1-Gnn89iTXDuaz90MEyLmyr
[1 of 3] Compiling Foo ( Foo.hs, Foo.o )
<no location info>: error:
<command line>: can't load .so/.DLL for: libHSrandom-1.1-Gnn89iTXDuaz90MEyLmyr.so (libHSrandom-1.1-Gnn89iTXDuaz90MEyLmyr.so: cannot open shared object file: No such file or directory)
[2 of 3] Compiling Foo2 ( Foo2.hs, Foo2.o )
<no location info>: error:
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.3.20170423 for x86_64-unknown-linux):
Dynamic linker not initialised
CallStack (from -prof):
Linker.CAF (<entire-module>)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
In case it's important, this is using 64-bit Linux.
cc'ing angerman, who requested an easier way to reproduce this panic in #13137\##13607.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | angerman |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Panic with profiled compiler: Dynamic linker not initialised","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["angerman"],"type":"Bug","description":"There are several Trac tickets floating around which mention this panic, including:\r\n\r\n* #9868 (ghc: panic! Dynamic linker not initialised)\r\n* #10355 (Dynamic linker not initialised)\r\n* #10919 (ghc: panic! (the 'impossible' happened) ... Dynamic linker not initialised)\r\n* #13137 (Dynamic linker not initialised.)\r\n* #13531 (GHC fails with \"Dynamic linker not initialised\" when -j is on and trying to load nonexistent .so file)\r\n\r\nHowever, none seem particularly simple to reproduce. I have a (marginally) easier way to trigger this panic. You'll need the following:\r\n\r\n* A copy of GHC HEAD built with the `prof` flavor. For reference, I am using GHC HEAD built against 1f4fd37efac4795493677d5df81c83d22eac5f74.\r\n* A single package built with `cabal-install`. For simplicity, I used `random`:\r\n\r\n{{{\r\n$ cabal install random-1.1 -w ~/Software/ghc3/inplace/bin/ghc-stage2 \r\n}}}\r\n\r\nOnce it's installed, you'll need to learn `random`'s package ID, which can be done with `ghc-pkg`. For instance:\r\n\r\n{{{\r\n3$ ~/Software/ghc3/inplace/bin/ghc-pkg describe random\r\nname: random\r\nversion: 1.1\r\nid: random-1.1-Gnn89iTXDuaz90MEyLmyr\r\n...\r\n}}}\r\n\r\n* You'll need these three Haskell files:\r\n\r\n{{{#!hs\r\n-- Foo.hs\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule Foo where\r\n\r\nimport Language.Haskell.TH\r\n\r\nfoo :: Bool\r\nfoo = $(conE 'True)\r\n}}}\r\n\r\n{{{#!hs\r\n-- Foo2.hs\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule Foo2 where\r\n\r\nimport Language.Haskell.TH\r\n\r\nfoo2 = $(conE 'False)\r\n}}}\r\n\r\n{{{#!hs\r\n-- Bar.hs\r\nmodule Bar where\r\n\r\nimport Foo\r\nimport Foo2\r\n\r\nbar :: ()\r\nbar = foo `seq` foo2 `seq` ()\r\n}}}\r\n\r\nOnce you have all of these, you can trigger the bug by invoking GHC like so:\r\n\r\n{{{\r\n$ ~/Software/ghc3/inplace/bin/ghc-stage2 -fforce-recomp Bar.hs -j2 -package-id random-1.1-Gnn89iTXDuaz90MEyLmyr\r\n[1 of 3] Compiling Foo ( Foo.hs, Foo.o )\r\n\r\n<no location info>: error:\r\n <command line>: can't load .so/.DLL for: libHSrandom-1.1-Gnn89iTXDuaz90MEyLmyr.so (libHSrandom-1.1-Gnn89iTXDuaz90MEyLmyr.so: cannot open shared object file: No such file or directory)\r\n[2 of 3] Compiling Foo2 ( Foo2.hs, Foo2.o )\r\n\r\n<no location info>: error:\r\n ghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.3.20170423 for x86_64-unknown-linux):\r\n Dynamic linker not initialised\r\nCallStack (from -prof):\r\n Linker.CAF (<entire-module>)\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nIn case it's important, this is using 64-bit Linux.\r\n\r\ncc'ing angerman, who requested an easier way to reproduce this panic in https://ghc.haskell.org/trac/ghc/ticket/13137#comment:6.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/13606GHCi segfaults on Windows with D3D code2019-07-07T18:21:02ZRyan ScottGHCi segfaults on Windows with D3D codeWarning: this is about as Windows-specific of a bug as it possibly gets, since it requires the use of D3D. I noticed this when trying to run [examples](https://github.com/jwvg0425/d3d11binding) from the `d3d11binding` library in GHCi, as...Warning: this is about as Windows-specific of a bug as it possibly gets, since it requires the use of D3D. I noticed this when trying to run [examples](https://github.com/jwvg0425/d3d11binding) from the `d3d11binding` library in GHCi, as they all failed.
First, to conjure up the code needed for this:
- `Main.hs`:
```hs
{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main (main) where
import Data.Bits (Bits(..))
import Data.Int (Int32)
import Data.Word (Word32)
import Foreign.C.String (CString, peekCString, withCString, withCStringLen)
import Foreign.Marshal.Alloc (alloca)
import Foreign.Ptr (Ptr, castPtr, nullPtr)
import Foreign.Storable (Storable(..))
import System.IO (IOMode(..), hGetContents, withFile)
#if defined(i386_HOST_ARCH)
# define WINDOWS_CCONV stdcall
#elif defined(x86_64_HOST_ARCH)
# define WINDOWS_CCONV ccall
#else
# error Unknown mingw32 arch
#endif
foreign import WINDOWS_CCONV "D3DCompile" c_d3dCompile
:: Ptr () -> Word32 -> CString ->
Ptr D3DShaderMacro -> Ptr ID3DInclude ->
CString -> CString -> D3DCompileFlag -> D3DCompileEffectFlag ->
Ptr (Ptr ID3DBlob) -> Ptr (Ptr ID3DBlob) -> IO HRESULT
maybePoke :: (Storable a) => Maybe a -> (Ptr a -> IO b) -> IO b
maybePoke Nothing proc = proc nullPtr
maybePoke (Just m) proc = alloca $ \ptr -> do
poke ptr m
proc ptr
maybeWithCString :: Maybe String -> (CString -> IO a) -> IO a
maybeWithCString Nothing proc = proc nullPtr
maybeWithCString (Just m) proc = withCString m proc
type HRESULT = LONG
data ID3DBlob = ID3DBlob
data ID3DInclude = ID3DInclue
type LONG = Int32
data D3DShaderMacro = D3DShaderMacro
{ _name :: String
, _definition :: String }
instance Storable D3DShaderMacro where
sizeOf _ = 8
alignment _ = 8
peek ptr = do
n <- peekByteOff ptr 0
d <- peekByteOff ptr 4
n' <- peekCString n
d' <- peekCString d
return $ D3DShaderMacro n' d'
poke ptr (D3DShaderMacro n d) = do
withCString n $ \n' -> withCString d $ \d' -> do
pokeByteOff ptr 0 n'
pokeByteOff ptr 4 d'
type D3DCompileFlag = Word32
type D3DCompileEffectFlag = Word32
d3dCompileEnableStrictness :: D3DCompileFlag
d3dCompileEnableStrictness = shift 1 11
d3dCompile
:: String -> Maybe String ->
Maybe D3DShaderMacro -> Ptr ID3DInclude ->
Maybe String -> String ->
[D3DCompileFlag] -> [D3DCompileEffectFlag] ->
IO (Either (HRESULT, Ptr ID3DBlob) (Ptr ID3DBlob))
d3dCompile source sourceName defines pInclude entryPoint target compileFlags effectFlags = do
withCStringLen source $ \(csource, len) -> withCString target $ \pTarget ->
maybeWithCString sourceName $ \pSourceName -> maybePoke defines $ \pDefines ->
maybeWithCString entryPoint $ \pEntryPoint -> alloca $ \ppCode -> alloca $ \ppErrorMsgs -> do
let sFlag = foldl (.|.) 0 compileFlags
let eFlag = foldl (.|.) 0 effectFlags
putStrLn "Before d3dCompile"
hr <- c_d3dCompile
(castPtr csource)
(fromIntegral len)
pSourceName
pDefines
pInclude
pEntryPoint
pTarget
sFlag
eFlag
ppCode
ppErrorMsgs
putStrLn "After d3dCompile"
if hr < 0
then do
pErrorMsgs <- peek ppErrorMsgs
return $ Left (hr, pErrorMsgs)
else do
pCode <- peek ppCode
return $ Right pCode
d3dCompileFromFile
:: String -> Maybe String ->
Maybe D3DShaderMacro -> Ptr ID3DInclude ->
Maybe String -> String ->
[D3DCompileFlag] -> [D3DCompileEffectFlag] ->
IO (Either (HRESULT, Ptr ID3DBlob) (Ptr ID3DBlob))
d3dCompileFromFile fileName sourceName defines pInclude entryPoint target compileFlags effectFlags =
withFile fileName ReadMode $ \handle -> do
contents <- hGetContents handle
d3dCompile contents sourceName defines pInclude entryPoint target compileFlags effectFlags
main :: IO ()
main = do
_vb <- compileShaderFromFile "Triangle.fx" "VS" "vs_4_0"
return ()
compileShaderFromFile :: String -> String -> String -> IO (Ptr ID3DBlob)
compileShaderFromFile fileName entryPoint shaderModel = do
Right res <- d3dCompileFromFile
fileName
Nothing
Nothing
nullPtr
(Just entryPoint)
shaderModel
[d3dCompileEnableStrictness]
[]
return res
```
- `Triangle.fx`
```
float4 VS( float4 Pos : POSITION ) : SV_POSITION
{
return Pos;
}
float4 PS( float4 Pos : SV_POSITION ) : SV_Target
{
return float4( 1.0f, 1.0f, 0.0f, 1.0f ); // Yellow, with Alpha = 1
}
```
> Make sure that `Triangle.fx` is in the same directory as `Main.hs` when running this program.
When compiled, this program works OK:
```
$ C:\Users\RyanGlScott\Software\ghc-8.2.0.20170404\bin\ghc -lD3DCompiler Main.hs -fforce-recomp
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main.exe ...
$ .\Main.exe
Before d3dCompile
After d3dCompile
```
But with GHCi, it crashes:
```
$ C:\Users\RyanGlScott\Software\ghc-8.2.0.20170404\bin\runghc -lD3DCompiler Main.hs
Before d3dCompile
Access violation in generated code when writing 0000000000000000
```
I ran these tests on GHC 8.2.1, but I've also reproduced this bug in the past on GHC 8.0.2, so I don't think this is a new bug by any means.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.1-rc2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | GHCi |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | Phyx- |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHCi segfaults on Windows with D3D code","status":"New","operating_system":"","component":"GHCi","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.1-rc2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["Phyx-"],"type":"Bug","description":"Warning: this is about as Windows-specific of a bug as it possibly gets, since it requires the use of D3D. I noticed this when trying to run [https://github.com/jwvg0425/d3d11binding examples] from the `d3d11binding` library in GHCi, as they all failed.\r\n\r\nFirst, to conjure up the code needed for this:\r\n\r\n* `Main.hs`:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE CPP #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\nmodule Main (main) where\r\n\r\nimport Data.Bits (Bits(..))\r\nimport Data.Int (Int32)\r\nimport Data.Word (Word32)\r\nimport Foreign.C.String (CString, peekCString, withCString, withCStringLen)\r\nimport Foreign.Marshal.Alloc (alloca)\r\nimport Foreign.Ptr (Ptr, castPtr, nullPtr)\r\nimport Foreign.Storable (Storable(..))\r\nimport System.IO (IOMode(..), hGetContents, withFile)\r\n\r\n#if defined(i386_HOST_ARCH)\r\n# define WINDOWS_CCONV stdcall\r\n#elif defined(x86_64_HOST_ARCH)\r\n# define WINDOWS_CCONV ccall\r\n#else\r\n# error Unknown mingw32 arch\r\n#endif\r\n\r\nforeign import WINDOWS_CCONV \"D3DCompile\" c_d3dCompile\r\n :: Ptr () -> Word32 -> CString ->\r\n Ptr D3DShaderMacro -> Ptr ID3DInclude ->\r\n CString -> CString -> D3DCompileFlag -> D3DCompileEffectFlag ->\r\n Ptr (Ptr ID3DBlob) -> Ptr (Ptr ID3DBlob) -> IO HRESULT\r\n\r\nmaybePoke :: (Storable a) => Maybe a -> (Ptr a -> IO b) -> IO b\r\nmaybePoke Nothing proc = proc nullPtr\r\nmaybePoke (Just m) proc = alloca $ \\ptr -> do\r\n poke ptr m\r\n proc ptr\r\n\r\nmaybeWithCString :: Maybe String -> (CString -> IO a) -> IO a\r\nmaybeWithCString Nothing proc = proc nullPtr\r\nmaybeWithCString (Just m) proc = withCString m proc\r\n\r\ntype HRESULT = LONG\r\ndata ID3DBlob = ID3DBlob\r\ndata ID3DInclude = ID3DInclue\r\ntype LONG = Int32\r\n\r\ndata D3DShaderMacro = D3DShaderMacro\r\n { _name :: String\r\n , _definition :: String }\r\n\r\ninstance Storable D3DShaderMacro where\r\n sizeOf _ = 8\r\n alignment _ = 8\r\n peek ptr = do\r\n n <- peekByteOff ptr 0\r\n d <- peekByteOff ptr 4\r\n n' <- peekCString n\r\n d' <- peekCString d\r\n return $ D3DShaderMacro n' d'\r\n poke ptr (D3DShaderMacro n d) = do\r\n withCString n $ \\n' -> withCString d $ \\d' -> do\r\n pokeByteOff ptr 0 n'\r\n pokeByteOff ptr 4 d'\r\n\r\ntype D3DCompileFlag = Word32\r\ntype D3DCompileEffectFlag = Word32\r\n\r\nd3dCompileEnableStrictness :: D3DCompileFlag\r\nd3dCompileEnableStrictness = shift 1 11\r\n\r\nd3dCompile\r\n :: String -> Maybe String ->\r\n Maybe D3DShaderMacro -> Ptr ID3DInclude ->\r\n Maybe String -> String ->\r\n [D3DCompileFlag] -> [D3DCompileEffectFlag] ->\r\n IO (Either (HRESULT, Ptr ID3DBlob) (Ptr ID3DBlob))\r\nd3dCompile source sourceName defines pInclude entryPoint target compileFlags effectFlags = do\r\n withCStringLen source $ \\(csource, len) -> withCString target $ \\pTarget ->\r\n maybeWithCString sourceName $ \\pSourceName -> maybePoke defines $ \\pDefines ->\r\n maybeWithCString entryPoint $ \\pEntryPoint -> alloca $ \\ppCode -> alloca $ \\ppErrorMsgs -> do\r\n let sFlag = foldl (.|.) 0 compileFlags\r\n let eFlag = foldl (.|.) 0 effectFlags\r\n putStrLn \"Before d3dCompile\"\r\n hr <- c_d3dCompile\r\n (castPtr csource)\r\n (fromIntegral len)\r\n pSourceName\r\n pDefines\r\n pInclude\r\n pEntryPoint\r\n pTarget\r\n sFlag\r\n eFlag\r\n ppCode\r\n ppErrorMsgs\r\n putStrLn \"After d3dCompile\"\r\n if hr < 0\r\n then do\r\n pErrorMsgs <- peek ppErrorMsgs\r\n return $ Left (hr, pErrorMsgs)\r\n else do\r\n pCode <- peek ppCode\r\n return $ Right pCode\r\n\r\nd3dCompileFromFile\r\n :: String -> Maybe String ->\r\n Maybe D3DShaderMacro -> Ptr ID3DInclude ->\r\n Maybe String -> String ->\r\n [D3DCompileFlag] -> [D3DCompileEffectFlag] ->\r\n IO (Either (HRESULT, Ptr ID3DBlob) (Ptr ID3DBlob))\r\nd3dCompileFromFile fileName sourceName defines pInclude entryPoint target compileFlags effectFlags =\r\n withFile fileName ReadMode $ \\handle -> do\r\n contents <- hGetContents handle\r\n d3dCompile contents sourceName defines pInclude entryPoint target compileFlags effectFlags\r\n\r\nmain :: IO ()\r\nmain = do\r\n _vb <- compileShaderFromFile \"Triangle.fx\" \"VS\" \"vs_4_0\"\r\n return ()\r\n\r\ncompileShaderFromFile :: String -> String -> String -> IO (Ptr ID3DBlob)\r\ncompileShaderFromFile fileName entryPoint shaderModel = do\r\n Right res <- d3dCompileFromFile\r\n fileName\r\n Nothing\r\n Nothing\r\n nullPtr\r\n (Just entryPoint)\r\n shaderModel\r\n [d3dCompileEnableStrictness]\r\n []\r\n return res\r\n}}}\r\n\r\n* `Triangle.fx`\r\n\r\n{{{\r\nfloat4 VS( float4 Pos : POSITION ) : SV_POSITION\r\n{\r\n return Pos;\r\n}\r\n\r\nfloat4 PS( float4 Pos : SV_POSITION ) : SV_Target\r\n{\r\n return float4( 1.0f, 1.0f, 0.0f, 1.0f ); // Yellow, with Alpha = 1\r\n}\r\n}}}\r\n\r\n Make sure that `Triangle.fx` is in the same directory as `Main.hs` when running this program.\r\n\r\nWhen compiled, this program works OK:\r\n\r\n{{{\r\n$ C:\\Users\\RyanGlScott\\Software\\ghc-8.2.0.20170404\\bin\\ghc -lD3DCompiler Main.hs -fforce-recomp\r\n[1 of 1] Compiling Main ( Main.hs, Main.o )\r\nLinking Main.exe ...\r\n$ .\\Main.exe\r\nBefore d3dCompile\r\nAfter d3dCompile\r\n}}}\r\n\r\nBut with GHCi, it crashes:\r\n\r\n{{{\r\n$ C:\\Users\\RyanGlScott\\Software\\ghc-8.2.0.20170404\\bin\\runghc -lD3DCompiler Main.hs\r\nBefore d3dCompile\r\nAccess violation in generated code when writing 0000000000000000\r\n}}}\r\n\r\nI ran these tests on GHC 8.2.1, but I've also reproduced this bug in the past on GHC 8.0.2, so I don't think this is a new bug by any means.","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1Tamar ChristinaTamar Christinahttps://gitlab.haskell.org/ghc/ghc/-/issues/13605GHC Bug when updating stack2019-07-07T18:21:02ZpighcuGHC Bug when updating stackghc: panic! (the 'impossible' happened)
(GHC version 7.10.3 for x86_64-apple-darwin):
Loading temp shared object failed: dlopen(/var/folders/y5/cc8zwjz12w1567wglxgzt05c0000gn/T/ghc39074_0/libghc_68.dylib, 5): no suitable image found....ghc: panic! (the 'impossible' happened)
(GHC version 7.10.3 for x86_64-apple-darwin):
Loading temp shared object failed: dlopen(/var/folders/y5/cc8zwjz12w1567wglxgzt05c0000gn/T/ghc39074_0/libghc_68.dylib, 5): no suitable image found. Did find:
/var/folders/y5/cc8zwjz12w1567wglxgzt05c0000gn/T/ghc39074_0/libghc_68.dylib: malformed mach-o: load commands size (49368) \> 32768
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.10.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 Bug when updating stack","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"ghc: panic! (the 'impossible' happened)\r\n (GHC version 7.10.3 for x86_64-apple-darwin):\r\n Loading temp shared object failed: dlopen(/var/folders/y5/cc8zwjz12w1567wglxgzt05c0000gn/T/ghc39074_0/libghc_68.dylib, 5): no suitable image found. Did find:\r\n /var/folders/y5/cc8zwjz12w1567wglxgzt05c0000gn/T/ghc39074_0/libghc_68.dylib: malformed mach-o: load commands size (49368) > 32768\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/13604ghci no longer loads dynamic .o files2023-09-08T10:44:31Zgeorge.colpittsghci no longer loads dynamic .o filesIn 8.2.1-rc1 loading a file compiled with -O2 into ghci results in ghci recompiling the file into interpreted byte code. In 8.0.2 it simply loads the compiled object file.
1. 2.1
```
ghc -dynamic -O2 eh2.hs
[1 of 1] Compiling Main ...In 8.2.1-rc1 loading a file compiled with -O2 into ghci results in ghci recompiling the file into interpreted byte code. In 8.0.2 it simply loads the compiled object file.
1. 2.1
```
ghc -dynamic -O2 eh2.hs
[1 of 1] Compiling Main ( eh2.hs, eh2.o )
Linking eh2 ...
bash-3.2$ ghci -ignore-dot-ghci
GHCi, version 8.2.0.20170404: http://www.haskell.org/ghc/ :? for help
Prelude> :load eh2
[1 of 1] Compiling Main ( eh2.hs, interpreted ) [flags changed]
Ok, modules loaded: Main.
```
1. 0.2
```
ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2
bash-3.2$ pwd
/Users/gcolpitts/haskell
bash-3.2$ ghc -dynamic -O2 eh2.hs
[1 of 1] Compiling Main ( eh2.hs, eh2.o )
Linking eh2 ...
bash-3.2$ ghci -ignore-dot-ghci
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Prelude> :load eh2
Ok, modules loaded: Main (eh2.o).
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | GHCi |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"regression in ghc 8.2.1-rc1 (8.2.0.2017040)","status":"New","operating_system":"","component":"GHCi","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"In 8.2.1-rc1 loading a file compiled with -O2 into ghci results in ghci recompiling the file into interpreted byte code. In 8.0.2 it simply loads the compiled object file.\r\n\r\n8.2.1\r\n{{{\r\n ghc -dynamic -O2 eh2.hs\r\n[1 of 1] Compiling Main ( eh2.hs, eh2.o )\r\nLinking eh2 ...\r\nbash-3.2$ ghci -ignore-dot-ghci\r\nGHCi, version 8.2.0.20170404: http://www.haskell.org/ghc/ :? for help\r\nPrelude> :load eh2\r\n[1 of 1] Compiling Main ( eh2.hs, interpreted ) [flags changed]\r\nOk, modules loaded: Main.\r\n}}}\r\n\r\n8.0.2 \r\n\r\n{{{\r\n ghc --version\r\nThe Glorious Glasgow Haskell Compilation System, version 8.0.2\r\nbash-3.2$ pwd\r\n/Users/gcolpitts/haskell\r\nbash-3.2$ ghc -dynamic -O2 eh2.hs\r\n[1 of 1] Compiling Main ( eh2.hs, eh2.o )\r\nLinking eh2 ...\r\nbash-3.2$ ghci -ignore-dot-ghci\r\nGHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help\r\nPrelude> :load eh2\r\nOk, modules loaded: Main (eh2.o).\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1David FeuerDavid Feuerhttps://gitlab.haskell.org/ghc/ghc/-/issues/13603Can't resolve levity polymorphic superclass2019-07-07T18:21:04ZIcelandjackCan't resolve levity polymorphic superclassThis works
```hs
{-# Language PolyKinds, TypeInType #-}
import GHC.Exts (TYPE, RuntimeRep)
class A (a :: TYPE rep)
class A a => B (a :: TYPE rep)
instance A b => A (a -> (b :: TYPE rep))
instance B b => B (a -> b)
```
but the...This works
```hs
{-# Language PolyKinds, TypeInType #-}
import GHC.Exts (TYPE, RuntimeRep)
class A (a :: TYPE rep)
class A a => B (a :: TYPE rep)
instance A b => A (a -> (b :: TYPE rep))
instance B b => B (a -> b)
```
but the moment you add (`b :: TYPE rep`) to the last line it stops working
```hs
-- t3I7.hs:9:10-40: error: …
-- • Could not deduce (A b)
-- arising from the superclasses of an instance declaration
-- from the context: B b
-- bound by the instance declaration at /tmp/t3I7.hs:9:10-40
-- • In the instance declaration for ‘B (a -> b)’
-- Compilation failed.
{-# Language PolyKinds, TypeInType #-}
import GHC.Exts (TYPE, RuntimeRep)
class A (a :: TYPE rep)
class A a => B (a :: TYPE rep)
instance A b => A (a -> (b :: TYPE rep))
instance B b => B (a -> (b :: TYPE rep))
```
<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 | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Can't resolve levity polymorphic superclass","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":["LevityPolymorphism,","TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This works\r\n\r\n{{{#!hs\r\n{-# Language PolyKinds, TypeInType #-}\r\n\r\nimport GHC.Exts (TYPE, RuntimeRep)\r\n\r\nclass A (a :: TYPE rep)\r\nclass A a => B (a :: TYPE rep)\r\n\r\ninstance A b => A (a -> (b :: TYPE rep))\r\ninstance B b => B (a -> b)\r\n}}}\r\n\r\nbut the moment you add (`b :: TYPE rep`) to the last line it stops working\r\n\r\n\r\n{{{#!hs\r\n-- t3I7.hs:9:10-40: error: …\r\n-- • Could not deduce (A b)\r\n-- arising from the superclasses of an instance declaration\r\n-- from the context: B b\r\n-- bound by the instance declaration at /tmp/t3I7.hs:9:10-40\r\n-- • In the instance declaration for ‘B (a -> b)’\r\n-- Compilation failed.\r\n\r\n{-# Language PolyKinds, TypeInType #-}\r\n\r\nimport GHC.Exts (TYPE, RuntimeRep)\r\n\r\nclass A (a :: TYPE rep)\r\nclass A a => B (a :: TYPE rep)\r\n\r\ninstance A b => A (a -> (b :: TYPE rep))\r\ninstance B b => B (a -> (b :: TYPE rep))\r\n}}}\r\n\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/13602Pattern syntax in expression context must be clarified2019-07-07T18:21:04ZvantoPattern syntax in expression context must be clarifiedTo simonpj\\\\
see tickets `#13557` and `#13579`\\\\
Typed Holes does not exist if we compile with GHC version 7.6.3.
Instead of "error found holes" it indicates "pattern syntax in expression context: _".\\\\
I then understood that to i...To simonpj\\\\
see tickets `#13557` and `#13579`\\\\
Typed Holes does not exist if we compile with GHC version 7.6.3.
Instead of "error found holes" it indicates "pattern syntax in expression context: _".\\\\
I then understood that to improve Typed Holes it was first necessary to remove the ambiguity of the error in GHC 7.6.3 about pattern syntax in expression.\\\\
`let f = [True | x <- [_, _]]` raise the error
`pattern syntax in expression context: _`\\\\
But as Typed Holes, this error has no sense here.\\\\
`let f' = [_ | x <- [1,2]]`will give a result like
`"__"` And this calculation also makes sense if one refers to the rule of inference, as the function
`f`
1. \\\\
\\\\
The compiler should not impose its way.\\\\
The programmer must be the master of his code.
Here the rule of inference seems flouted.\\\\
Good sense or reason is argued to be the same in all people, yet differences in opinion are not due to differences in intelligence but to the fact that we use different approaches and consider different things.\\\\
Here you will find some ideas:\\\\
Instead of "underscore _" as "pattern syntax" we could use a new type called "indefinite" in expression.\\\\
Any calculation with "indefinite" will result in "indefinite".\\\\
In another calculation, the "indefinite" type could have a type defined according to a directive applied to the compiler.\\\\
example:\\\\
indefinite :: Int\\\\
f = \[1,2,3,indefinite,5,6\]\\\\
I took a look at ticket `#9497` and find it very interesting.\\\\
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.0.2 |
| 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":"Pattern syntax in expression context must be clarified","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"To simonpj\\\\\r\nsee tickets {{{#13557}}} and {{{#13579}}}\\\\\r\n\r\n\r\nTyped Holes does not exist if we compile with GHC version 7.6.3.\r\nInstead of \"error found holes\" it indicates \"pattern syntax in expression context: _\".\\\\\r\nI then understood that to improve Typed Holes it was first necessary to remove the ambiguity of the error in GHC 7.6.3 about pattern syntax in expression.\\\\\r\n\r\n{{{let f = [True | x <- [_, _]]}}} raise the error \r\n{{{pattern syntax in expression context: _}}}\\\\\r\nBut as Typed Holes, this error has no sense here.\\\\\r\n\r\n{{{let f' = [_ | x <- [1,2]]}}}will give a result like \r\n{{{\"__\"}}} And this calculation also makes sense if one refers to the rule of inference, as the function \r\n{{{f}}}\r\n.\\\\\r\n\\\\\r\nThe compiler should not impose its way.\\\\\r\nThe programmer must be the master of his code.\r\nHere the rule of inference seems flouted.\\\\\r\n\r\nGood sense or reason is argued to be the same in all people, yet differences in opinion are not due to differences in intelligence but to the fact that we use different approaches and consider different things.\\\\\r\n\r\nHere you will find some ideas:\\\\\r\nInstead of \"underscore _\" as \"pattern syntax\" we could use a new type called \"indefinite\" in expression.\\\\\r\nAny calculation with \"indefinite\" will result in \"indefinite\".\\\\\r\nIn another calculation, the \"indefinite\" type could have a type defined according to a directive applied to the compiler.\\\\\r\nexample:\\\\\r\nindefinite :: Int\\\\\r\nf = [1,2,3,indefinite,5,6]\\\\\r\n\r\nI took a look at ticket {{{#9497}}} and find it very interesting.\\\\\r\n\r\n\r\n\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/13601GHC errors but hangs2019-07-07T18:21:04ZIcelandjackGHC errors but hangs```hs
{-# LANGUAGE TypeFamilies, DataKinds, TypeInType #-}
import GHC.Exts
import Prelude (Bool(True,False),Integer,Ordering,undefined)
import qualified Prelude
import Data.Kind
--------------------
-- class hierarchy
type family
Re...```hs
{-# LANGUAGE TypeFamilies, DataKinds, TypeInType #-}
import GHC.Exts
import Prelude (Bool(True,False),Integer,Ordering,undefined)
import qualified Prelude
import Data.Kind
--------------------
-- class hierarchy
type family
Rep (rep :: RuntimeRep) :: RuntimeRep where
-- Rep IntRep = IntRep
-- Rep DoubleRep = IntRep
-- Rep PtrRepUnlifted = IntRep
-- Rep PtrRepLifted = PtrRepLifted
class Boolean (Logic a) => Eq (a :: TYPE rep) where
type Logic (a :: TYPE rep) :: TYPE (Rep rep)
(==) :: a -> a -> Logic a
class Eq a => POrd (a :: TYPE rep) where
inf :: a -> a -> a
class POrd a => MinBound (a :: TYPE rep) where
minBound :: () -> a
class POrd a => Lattice (a :: TYPE rep) where
sup :: a -> a -> a
class (Lattice a, MinBound a) => Bounded (a :: TYPE rep) where
maxBound :: () -> a
class Bounded a => Complemented (a :: TYPE rep) where
not :: a -> a
class Bounded a => Heyting (a :: TYPE rep) where
infixr 3 ==>
(==>) :: a -> a -> a
class (Complemented a, Heyting a) => Boolean a
(||) :: Boolean a => a -> a -> a
(||) = sup
(&&) :: Boolean a => a -> a -> a
(&&) = inf
```
hangs with
```
$ ghci a.hs
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( a.hs, interpreted )
a.hs:18:16: error: C-c C-cInterrupted.
```
<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 | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC errors but hangs","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!hs\r\n{-# LANGUAGE TypeFamilies, DataKinds, TypeInType #-}\r\n\r\nimport GHC.Exts\r\nimport Prelude (Bool(True,False),Integer,Ordering,undefined)\r\nimport qualified Prelude\r\nimport Data.Kind\r\n\r\n--------------------\r\n-- class hierarchy\r\n\r\ntype family\r\n Rep (rep :: RuntimeRep) :: RuntimeRep where\r\n -- Rep IntRep = IntRep\r\n -- Rep DoubleRep = IntRep\r\n -- Rep PtrRepUnlifted = IntRep\r\n -- Rep PtrRepLifted = PtrRepLifted\r\n\r\nclass Boolean (Logic a) => Eq (a :: TYPE rep) where\r\n type Logic (a :: TYPE rep) :: TYPE (Rep rep)\r\n (==) :: a -> a -> Logic a\r\n\r\nclass Eq a => POrd (a :: TYPE rep) where\r\n inf :: a -> a -> a\r\n\r\nclass POrd a => MinBound (a :: TYPE rep) where\r\n minBound :: () -> a\r\n\r\nclass POrd a => Lattice (a :: TYPE rep) where\r\n sup :: a -> a -> a\r\n\r\nclass (Lattice a, MinBound a) => Bounded (a :: TYPE rep) where\r\n maxBound :: () -> a\r\n\r\nclass Bounded a => Complemented (a :: TYPE rep) where\r\n not :: a -> a\r\n\r\nclass Bounded a => Heyting (a :: TYPE rep) where\r\n infixr 3 ==>\r\n (==>) :: a -> a -> a\r\n\r\nclass (Complemented a, Heyting a) => Boolean a\r\n\r\n(||) :: Boolean a => a -> a -> a\r\n(||) = sup\r\n\r\n(&&) :: Boolean a => a -> a -> a\r\n(&&) = inf\r\n}}}\r\n\r\nhangs with\r\n\r\n{{{\r\n$ ghci a.hs\r\nGHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( a.hs, interpreted )\r\n\r\na.hs:18:16: error: C-c C-cInterrupted.\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/13600surprising error message with bang pattern2020-12-18T15:20:30ZAndrew U. Franksurprising error message with bang patternthe following code
```
f3 :: [Int] -> IO Int
f3 x = return (sum x)
f4 :: [Int] -> IO Int
f4 !x = return (sum x)
```
gives `The type signature for ‘f4’ lacks an accompanying binding` for the second function (the two functions are...the following code
```
f3 :: [Int] -> IO Int
f3 x = return (sum x)
f4 :: [Int] -> IO Int
f4 !x = return (sum x)
```
gives `The type signature for ‘f4’ lacks an accompanying binding` for the second function (the two functions are exactly the same except for the added bang). I do not understand bang patterns well, but would expect a more instructive error message. without the type definition, the second function f4 compiles with the bang).
<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 | Linux |
| Architecture | x86_64 (amd64) |
</details>
<!-- {"blocked_by":[],"summary":"surprising error message with bang pattern","status":"New","operating_system":"Linux","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.2","keywords":[],"differentials":[],"test_case":"","architecture":"x86_64 (amd64)","cc":[""],"type":"Bug","description":"the following code \r\n\r\n{{{\r\nf3 :: [Int] -> IO Int \r\nf3 x = return (sum x) \r\n\r\nf4 :: [Int] -> IO Int \r\nf4 !x = return (sum x) \r\n}}}\r\n\r\ngives `The type signature for ‘f4’ lacks an accompanying binding` for the second function (the two functions are exactly the same except for the added bang). I do not understand bang patterns well, but would expect a more instructive error message. without the type definition, the second function f4 compiles with the bang). ","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Sasha Bogicevicsasa.bogicevic@pm.meSasha Bogicevicsasa.bogicevic@pm.mehttps://gitlab.haskell.org/ghc/ghc/-/issues/13599Something is fishy in Windows hLock implementation2019-07-07T18:21:05ZBen GamariSomething is fishy in Windows hLock implementationEver since we merged the package database locking patch (#13194) I have suspected that something isn't quite right in the locking logic on Windows. The first suspicious sign is that we had to limit the locking range (7e273ea28fe3630a8fed...Ever since we merged the package database locking patch (#13194) I have suspected that something isn't quite right in the locking logic on Windows. The first suspicious sign is that we had to limit the locking range (7e273ea28fe3630a8fede75ed28f471b7be21b5f) due to mysterious `ERROR_LOCK_INVALID_RANGE` errors on Harbormaster. While the fix in 7e273ea28fe3630a8fede75ed28f471b7be21b5f seemed to make the issue disappear, we never were able to pin down the issue.
However, now I'm seeing the `ERROR_LOCK_INVALID_RANGE` issue once again on my local Windows during `binary-dist-prep`. In particular, it `binary-dist-prep` seems to reliably fail while registering the `compiler` directory. Watching the system calls performed by `ghc-pkg` with `procmon` suggests that the issue is a negative offset being passed to `LockFile`. Moreover, `LockFile` calls from previous `ghc-pkg` invocations show other, apparently random offset values being passed. The offset is passed to `LockFileEx` (the interface used by our `hLock` implementation) via an `OVERLAPPED` structure, which we locally allocate and zero prior to the `LockFileEx` call. I still haven't worked out where these random values are coming from.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | highest |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | arybczak |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Something is fishy in Windows hLock implementation","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.2.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["arybczak"],"type":"Bug","description":"Ever since we merged the package database locking patch (#13194) I have suspected that something isn't quite right in the locking logic on Windows. The first suspicious sign is that we had to limit the locking range (7e273ea28fe3630a8fede75ed28f471b7be21b5f) due to mysterious `ERROR_LOCK_INVALID_RANGE` errors on Harbormaster. While the fix in 7e273ea28fe3630a8fede75ed28f471b7be21b5f seemed to make the issue disappear, we never were able to pin down the issue.\r\n\r\nHowever, now I'm seeing the `ERROR_LOCK_INVALID_RANGE` issue once again on my local Windows during `binary-dist-prep`. In particular, it `binary-dist-prep` seems to reliably fail while registering the `compiler` directory. Watching the system calls performed by `ghc-pkg` with `procmon` suggests that the issue is a negative offset being passed to `LockFile`. Moreover, `LockFile` calls from previous `ghc-pkg` invocations show other, apparently random offset values being passed. The offset is passed to `LockFileEx` (the interface used by our `hLock` implementation) via an `OVERLAPPED` structure, which we locally allocate and zero prior to the `LockFileEx` call. I still haven't worked out where these random values are coming from.","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/13598role annotation for newtype (partially?) ignored?2019-07-07T18:21:06Zedsko@edsko.netrole annotation for newtype (partially?) ignored?A constraint `Coercible o (T a)` is ambiguous if the role of `a` is representational (provided `a` is not otherwise constrained, of course), but unambiguous if `a` is a phantom type:
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ...A constraint `Coercible o (T a)` is ambiguous if the role of `a` is representational (provided `a` is not otherwise constrained, of course), but unambiguous if `a` is a phantom type:
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RoleAnnotations #-}
module CoerceTest where
import Data.Coerce
type role A phantom
data A a = MkA Int
type role B representational
data B a = MkB Int
-- accepted by the type checker (as it should be)
fooA :: Coercible o (A a) => o -> ()
fooA _ = ()
-- rejected by the type checker (as it should be) with
-- "Couldn't match representation of type ‘a0’ with that of ‘a’"
-- fooB :: Coercible o (B a) => o -> ()
-- fooB _ = ()
```
However, for `newtype`s something odd happens:
```hs
type role C representational
newtype C a = MkC Int
-- accepted by the type checker (but should not be)
fooC :: Coercible o (C a) => o -> ()
fooC _ = ()
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.1-rc2 |
| 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":"role annotation for newtype (partially?) ignored?","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.1-rc2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"A constraint `Coercible o (T a)` is ambiguous if the role of `a` is representational (provided `a` is not otherwise constrained, of course), but unambiguous if `a` is a phantom type:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE RoleAnnotations #-}\r\nmodule CoerceTest where\r\n\r\nimport Data.Coerce\r\n\r\ntype role A phantom\r\ndata A a = MkA Int\r\n\r\ntype role B representational\r\ndata B a = MkB Int\r\n\r\n-- accepted by the type checker (as it should be)\r\nfooA :: Coercible o (A a) => o -> ()\r\nfooA _ = ()\r\n\r\n-- rejected by the type checker (as it should be) with\r\n-- \"Couldn't match representation of type ‘a0’ with that of ‘a’\"\r\n-- fooB :: Coercible o (B a) => o -> ()\r\n-- fooB _ = ()\r\n}}}\r\n\r\nHowever, for `newtype`s something odd happens:\r\n\r\n{{{#!hs\r\ntype role C representational\r\nnewtype C a = MkC Int\r\n\r\n-- accepted by the type checker (but should not be)\r\nfooC :: Coercible o (C a) => o -> ()\r\nfooC _ = ()\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/13597ghc: panic! (the 'impossible' happened)2019-07-07T18:21:06Zrzilghc: panic! (the 'impossible' happened)```
Downloading stack-1.4.0...
Configuring stack-1.4.0...
Building stack-1.4.0...
Failed to install stack-1.4.0
Build log ( /Users/ruben/.cabal/logs/stack-1.4.0.log ):
cabal: Entering directory '/var/folders/sr/jktws8p56m58qw9h6k53dbfr00...```
Downloading stack-1.4.0...
Configuring stack-1.4.0...
Building stack-1.4.0...
Failed to install stack-1.4.0
Build log ( /Users/ruben/.cabal/logs/stack-1.4.0.log ):
cabal: Entering directory '/var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-4956/stack-1.4.0'
[1 of 1] Compiling Main ( /var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-4956/stack-1.4.0/dist/setup/setup.hs, /var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-4956/stack-1.4.0/dist/setup/Main.o )
Linking /var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-4956/stack-1.4.0/dist/setup/setup ...
Configuring stack-1.4.0...
Building stack-1.4.0...
Preprocessing library stack-1.4.0...
[ 1 of 124] Compiling Text.PrettyPrint.Leijen.Extended ( src/Text/PrettyPrint/Leijen/Extended.hs, dist/build/Text/PrettyPrint/Leijen/Extended.o )
[ 2 of 124] Compiling Hackage.Security.Client.Repository.HttpLib.HttpClient ( src/Hackage/Security/Client/Repository/HttpLib/HttpClient.hs, dist/build/Hackage/Security/Client/Repository/HttpLib/HttpClient.o )
[ 3 of 124] Compiling Stack.Options.ScriptParser ( src/Stack/Options/ScriptParser.hs, dist/build/Stack/Options/ScriptParser.o )
[ 4 of 124] Compiling Stack.Ghci.Script ( src/Stack/Ghci/Script.hs, dist/build/Stack/Ghci/Script.o )
[ 5 of 124] Compiling Stack.FileWatch ( src/Stack/FileWatch.hs, dist/build/Stack/FileWatch.o )
[ 6 of 124] Compiling System.Process.PagerEditor ( src/System/Process/PagerEditor.hs, dist/build/System/Process/PagerEditor.o )
[ 7 of 124] Compiling System.Process.Log ( src/System/Process/Log.hs, dist/build/System/Process/Log.o )
[ 8 of 124] Compiling Paths_stack ( dist/build/autogen/Paths_stack.hs, dist/build/Paths_stack.o )
[ 9 of 124] Compiling Path.Find ( src/Path/Find.hs, dist/build/Path/Find.o )
[ 10 of 124] Compiling Path.Extra ( src/Path/Extra.hs, dist/build/Path/Extra.o )
[ 11 of 124] Compiling System.Process.Read ( src/System/Process/Read.hs, dist/build/System/Process/Read.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.1 for x86_64-apple-darwin):
Loading temp shared object failed: dlopen(/var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/ghc17927_0/libghc_85.dylib, 5): no suitable image found. Did find:
/var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/ghc17927_0/libghc_85.dylib: malformed mach-o: load commands size (39456) > 32768
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
cabal: Leaving directory '/var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-4956/stack-1.4.0'
cabal: Error: some packages failed to install:
stack-1.4.0 failed during the building phase. The exception was:
ExitFailure 1
```
<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 | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ghc: panic! (the 'impossible' happened)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\r\nDownloading stack-1.4.0...\r\nConfiguring stack-1.4.0...\r\nBuilding stack-1.4.0...\r\nFailed to install stack-1.4.0\r\nBuild log ( /Users/ruben/.cabal/logs/stack-1.4.0.log ):\r\ncabal: Entering directory '/var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-4956/stack-1.4.0'\r\n[1 of 1] Compiling Main ( /var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-4956/stack-1.4.0/dist/setup/setup.hs, /var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-4956/stack-1.4.0/dist/setup/Main.o )\r\nLinking /var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-4956/stack-1.4.0/dist/setup/setup ...\r\nConfiguring stack-1.4.0...\r\nBuilding stack-1.4.0...\r\nPreprocessing library stack-1.4.0...\r\n[ 1 of 124] Compiling Text.PrettyPrint.Leijen.Extended ( src/Text/PrettyPrint/Leijen/Extended.hs, dist/build/Text/PrettyPrint/Leijen/Extended.o )\r\n[ 2 of 124] Compiling Hackage.Security.Client.Repository.HttpLib.HttpClient ( src/Hackage/Security/Client/Repository/HttpLib/HttpClient.hs, dist/build/Hackage/Security/Client/Repository/HttpLib/HttpClient.o )\r\n[ 3 of 124] Compiling Stack.Options.ScriptParser ( src/Stack/Options/ScriptParser.hs, dist/build/Stack/Options/ScriptParser.o )\r\n[ 4 of 124] Compiling Stack.Ghci.Script ( src/Stack/Ghci/Script.hs, dist/build/Stack/Ghci/Script.o )\r\n[ 5 of 124] Compiling Stack.FileWatch ( src/Stack/FileWatch.hs, dist/build/Stack/FileWatch.o )\r\n[ 6 of 124] Compiling System.Process.PagerEditor ( src/System/Process/PagerEditor.hs, dist/build/System/Process/PagerEditor.o )\r\n[ 7 of 124] Compiling System.Process.Log ( src/System/Process/Log.hs, dist/build/System/Process/Log.o )\r\n[ 8 of 124] Compiling Paths_stack ( dist/build/autogen/Paths_stack.hs, dist/build/Paths_stack.o )\r\n[ 9 of 124] Compiling Path.Find ( src/Path/Find.hs, dist/build/Path/Find.o )\r\n[ 10 of 124] Compiling Path.Extra ( src/Path/Extra.hs, dist/build/Path/Extra.o )\r\n[ 11 of 124] Compiling System.Process.Read ( src/System/Process/Read.hs, dist/build/System/Process/Read.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.0.1 for x86_64-apple-darwin):\r\n\tLoading temp shared object failed: dlopen(/var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/ghc17927_0/libghc_85.dylib, 5): no suitable image found. Did find:\r\n\t/var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/ghc17927_0/libghc_85.dylib: malformed mach-o: load commands size (39456) > 32768\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\ncabal: Leaving directory '/var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-4956/stack-1.4.0'\r\ncabal: Error: some packages failed to install:\r\nstack-1.4.0 failed during the building phase. The exception was:\r\nExitFailure 1\r\n\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/13596Try disabling inlining of DynFlags combinators2019-07-07T18:21:06ZBen GamariTry disabling inlining of DynFlags combinators`DynFlags` requires a surprisingly amount of effort to compile. One thing I've been meaning to try is disabling inlining of `make_ord_flag` and such to characterize how much of an impact these inlinings have on simplification effort.
<d...`DynFlags` requires a surprisingly amount of effort to compile. One thing I've been meaning to try is disabling inlining of `make_ord_flag` and such to characterize how much of an impact these inlinings have on simplification effort.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.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":"Try disabling inlining of DynFlags combinators","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"`DynFlags` requires a surprisingly amount of effort to compile. One thing I've been meaning to try is disabling inlining of `make_ord_flag` and such to characterize how much of an impact these inlinings have on simplification effort.","type_of_failure":"OtherFailure","blocking":[]} -->Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/13595Should ‘coerce’ be levity polymorphic?2019-07-07T18:21:06ZIcelandjackShould ‘coerce’ be levity polymorphic?I'm not able to write `coerce @Int# @Int#` or `coerce :: Double# -> Double#`, just checking to see if its intentional or not
```
>>> :set -XTypeApplications
>>> :set -XMagicHash
>>> import Data.Coerce
>>> import GHC.Exts
>>>> :t coerc...I'm not able to write `coerce @Int# @Int#` or `coerce :: Double# -> Double#`, just checking to see if its intentional or not
```
>>> :set -XTypeApplications
>>> :set -XMagicHash
>>> import Data.Coerce
>>> import GHC.Exts
>>>> :t coerce @Int
coerce @Int :: Coercible b Int => Int -> b
>>> :t coerce @Int#
<interactive>:1:1: error:
Couldn't match a lifted type with an unlifted type
When matching types
b :: *
Int# :: TYPE 'IntRep
<interactive>:1:9: error:
• Expecting a lifted type, but ‘Int#’ is unlifted
• In the type ‘Int#’
In the expression: coerce @Int#
```
This was needed for #13592.
<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 | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Should ‘coerce’ be levity polymorphic?","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I'm not able to write `coerce @Int# @Int#` or `coerce :: Double# -> Double#`, just checking to see if its intentional or not\r\n\r\n{{{\r\n>>> :set -XTypeApplications\r\n>>> :set -XMagicHash\r\n\r\n>>> import Data.Coerce\r\n>>> import GHC.Exts\r\n\r\n>>>> :t coerce @Int\r\ncoerce @Int :: Coercible b Int => Int -> b\r\n>>> :t coerce @Int#\r\n\r\n<interactive>:1:1: error:\r\n Couldn't match a lifted type with an unlifted type\r\n When matching types\r\n b :: *\r\n Int# :: TYPE 'IntRep\r\n\r\n<interactive>:1:9: error:\r\n • Expecting a lifted type, but ‘Int#’ is unlifted\r\n • In the type ‘Int#’\r\n In the expression: coerce @Int#\r\n}}} \r\n\r\nThis was needed for #13592.","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/13594Typechecker behavior w.r.t. BangPatterns and nested foralls has changed in 8.22019-07-07T18:21:07ZRyan ScottTypechecker behavior w.r.t. BangPatterns and nested foralls has changed in 8.2Try running this code in GHCi:
```
λ> :set -XBangPatterns -XRankNTypes -XTypeFamilies
λ> let x :: forall a . a ~ Integer => forall b. b ~ Integer => (a, b); !x = (1, 2)
```
In GHC 8.0.1 and 8.0.2, this works. But in GHC 8.2.1:
```
<...Try running this code in GHCi:
```
λ> :set -XBangPatterns -XRankNTypes -XTypeFamilies
λ> let x :: forall a . a ~ Integer => forall b. b ~ Integer => (a, b); !x = (1, 2)
```
In GHC 8.0.1 and 8.0.2, this works. But in GHC 8.2.1:
```
<interactive>:3:74:
Couldn't match expected type ‘forall a.
(a ~ Integer) =>
forall b. (b ~ Integer) => (a, b)’
with actual type ‘(Integer, Integer)’
In the expression: (1, 2)
In a pattern binding: !x = (1, 2)
```
If you put this code into a source file:
```hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
module Bug where
x :: forall a . a ~ Integer => forall b. b ~ Integer => (a, b)
!x = (1, 2)
```
Then it also works in GHC 8.0.1. and 8.0.2, but it errors on GHC 8.2 (this time with a different error):
```
GHCi, version 8.2.0.20170413: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:6:1: error:
Overloaded signature conflicts with monomorphism restriction
x :: forall a. a ~ Integer => forall b. b ~ Integer => (a, b)
|
6 | x :: forall a . a ~ Integer => forall b. b ~ Integer => (a, b)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.2.1-rc2 |
| 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":"Typechecker behavior w.r.t. BangPatterns and nested foralls has changed in 8.2","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.1-rc2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Try running this code in GHCi:\r\n\r\n{{{\r\nλ> :set -XBangPatterns -XRankNTypes -XTypeFamilies \r\nλ> let x :: forall a . a ~ Integer => forall b. b ~ Integer => (a, b); !x = (1, 2)\r\n}}}\r\n\r\nIn GHC 8.0.1 and 8.0.2, this works. But in GHC 8.2.1:\r\n\r\n{{{\r\n<interactive>:3:74:\r\n Couldn't match expected type ‘forall a.\r\n (a ~ Integer) =>\r\n forall b. (b ~ Integer) => (a, b)’\r\n with actual type ‘(Integer, Integer)’\r\n In the expression: (1, 2)\r\n In a pattern binding: !x = (1, 2)\r\n}}}\r\n\r\nIf you put this code into a source file:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE BangPatterns #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE RankNTypes #-}\r\nmodule Bug where\r\n\r\nx :: forall a . a ~ Integer => forall b. b ~ Integer => (a, b)\r\n!x = (1, 2)\r\n}}}\r\n\r\nThen it also works in GHC 8.0.1. and 8.0.2, but it errors on GHC 8.2 (this time with a different error):\r\n\r\n{{{\r\nGHCi, version 8.2.0.20170413: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 1] Compiling Bug ( Bug.hs, interpreted )\r\n\r\nBug.hs:6:1: error:\r\n Overloaded signature conflicts with monomorphism restriction\r\n x :: forall a. a ~ Integer => forall b. b ~ Integer => (a, b)\r\n |\r\n6 | x :: forall a . a ~ Integer => forall b. b ~ Integer => (a, b)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/13593Unexpected behavior from Data.List.groupBy2019-07-07T18:21:07ZdsfUnexpected behavior from Data.List.groupByI was hoping that
```hs
let notBoth1 a b = not (a == 1 && b == 1) in
groupBy notBoth1 [1,1,2,3,1,1,4,5,6,1]
```
would give me
```
[[1],[1,2,3,1],[1,4,5,6,1]]
```
but instead I get
```
[[1],[1,2,3],[1],[1,4,5,6],[1]]
```
It seems t...I was hoping that
```hs
let notBoth1 a b = not (a == 1 && b == 1) in
groupBy notBoth1 [1,1,2,3,1,1,4,5,6,1]
```
would give me
```
[[1],[1,2,3,1],[1,4,5,6,1]]
```
but instead I get
```
[[1],[1,2,3],[1],[1,4,5,6],[1]]
```
It seems that groupBy assumes transitivity in the argument function. I have a new implementation that does not make this assumption. Of course, the implications of changing this function's behavior are troubling.
```hs
groupBy' :: (a -> a -> Bool) -> [a] -> [[a]]
groupBy' p (x : xs) = go [x] xs
where
go (x : xs) (y : zs) | p x y = go (y : x : xs) zs
go g (y : zs) = reverse g : go [y] zs
go g [] = [reverse g]
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------------------ |
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | IncorrectResultAtRuntime |
| Priority | normal |
| Resolution | Unresolved |
| Component | Core Libraries |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Unexpected behavior from Data.List.groupBy","status":"New","operating_system":"","component":"Core Libraries","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I was hoping that\r\n{{{#!hs\r\nlet notBoth1 a b = not (a == 1 && b == 1) in\r\ngroupBy notBoth1 [1,1,2,3,1,1,4,5,6,1]\r\n}}}\r\nwould give me\r\n{{{\r\n[[1],[1,2,3,1],[1,4,5,6,1]]\r\n}}}\r\nbut instead I get\r\n{{{\r\n[[1],[1,2,3],[1],[1,4,5,6],[1]]\r\n}}}\r\nIt seems that groupBy assumes transitivity in the argument function. I have a new implementation that does not make this assumption. Of course, the implications of changing this function's behavior are troubling.\r\n{{{#!hs\r\ngroupBy' :: (a -> a -> Bool) -> [a] -> [[a]]\r\ngroupBy' p (x : xs) = go [x] xs\r\n where\r\n go (x : xs) (y : zs) | p x y = go (y : x : xs) zs\r\n go g (y : zs) = reverse g : go [y] zs\r\n go g [] = [reverse g]\r\n}}}","type_of_failure":"IncorrectResultAtRuntime","blocking":[]} -->