Skip to content

TH Names can't be used in patterns

Here's an example where I try to use a Name (with double ticks) as a pattern:

{-# LANGUAGE TemplateHaskell #-}

foo :: Name -> ()
foo ''Int = ()

It fails with this error:

test.hs:4:5-9: Parse error in pattern: ''Int

Seems like a bug to me (if we can compare Names, why can't we pattern-match on them?).

Trac metadata
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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information