Skip to content

Unlifted types and pattern synonym signatures

The following program is rejected by ghc-8.0.1:

{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PatternSynonyms #-}
module Foo where

import GHC.Exts (Int#)

pattern Zero :: Int# -- commenting out this line works
pattern Zero <- 0#
% ghc-stage2 unlifted-pattern-synonym.hs
[1 of 1] Compiling Foo              ( unlifted-pattern-synonym.hs, unlifted-pattern-synonym.o )

unlifted-pattern-synonym.hs:7:17: error:
    • Expecting a lifted type, but ‘Int#’ is unlifted
    • In the type ‘Int#’

Commenting out the type signature removes the error.

GHC 7.10.3 accepts this program, with and without the type signature.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
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