Skip to content

Meaningless top-level pattern binding

Summary

I was playing around with pattern bindings when I found out about this particular example:

module B9 where 

Just y = Nothing *> Nothing 

data Haskell a =  Brooks String | Curry String

Curry x = Curry "Blah" `seq` Brooks x

Brooks z = undefined 

The module above typechecks without a single warning. I don't think it's semantically correct. But of course, I might be wrong and confused.

It seems like if the RHS contains a function application or bottom value, GHC accepts it. Otherwise, GHC reports a redundant pattern match.

Environment

GHC versions tested: 9.6.2, HEAD

Edited by Artin Ghasivand
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information