Skip to content

Type synonym unused binds no warning?

I was taken aback this was accepted

type Silly a b = Maybe b

x :: Silly Int Bool
x = Just True
y :: Silly Char Bool
y = Just False

z = x == y                    -- returns False

What's with the a in Silly's decl? That's not a phantom type. It's ignored and thrown away. So x and y are the same type, and can be compare for equality.

I expected a rule: all tyvars in the type's head must appear on rhs. Or at least a warning there was something silly. I tried -Wall, -fwarn-unused-binds, -Wunused-type-patterns.

I was just checking up on a remark that type synonyms are at the type level like implicit bidirectional pattern synonyms. For those, all vars must appear on both sides.

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