Skip to content

Error when using empty record update on binary pattern synonym

Using an empty record update with patterns works here

pattern Singleton a = [a]

isSingleton :: [a] -> Bool
isSingleton Singleton{} = True
isSingleton _           = False

but fails in the follow example (there may exist a more minimal example)

pattern P a b = Just (a, b)
foo P{} = True

which outputs (GHC 7.8.2)

$ ghci -ignore-dot-ghci tmp.g2WZtTUkhJ.hs
GHCi, version 7.8.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( tmp.g2WZtTUkhJ.hs, interpreted )
Var/Type length mismatch: 
    [t{tv aIW} [sk]]
    []
Ok, modules loaded: Main.
*Main> 
Trac metadata
Trac field Value
Version 7.8.2
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