Skip to content

ApplicativeDo causes GHC panic on irrefutable list pattern match

So this just happened:

{-# language ApplicativeDo #-}
module Main where

main :: IO ()
main = do
  [_] <- pure []
  pure ()

Compiling (under Stack) with stack exec -- ghc --make src/Main.hs yields

[1 of 1] Compiling Main             ( src/Main.hs, src/Main.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.2.1 for x86_64-unknown-linux):
	isStrictPattern

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

This does not happen on GHC-8.0.2. It does not happen when ApplicativeDo is not activated. It also does not happen when the pattern match line is changed to

  [] <- pure []

For completeness, the compiler used by stack is that which comes with nightly-2017-08-10. I am on Linux x64 (Ubuntu).

Trac metadata
Trac field Value
Version 8.2.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information