Skip to content

Data.Typeable: types which should compare equal don't

Here are two ways to construct a TypeRep for the type () -> ():

Prelude> import Data.Typeable
Prelude Data.Typeable> let unitToUnit = typeOf (\() -> ())
Prelude Data.Typeable> let unitToUnit' = mkFunTy (typeOf ()) (typeOf ())

It seems to work:

Prelude Data.Typeable> unitToUnit
() -> ()
Prelude Data.Typeable> unitToUnit'
() -> ()

But the two TypeReps are not equal:

Prelude Data.Typeable> unitToUnit == unitToUnit'
False
Trac metadata
Trac field Value
Version 7.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
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