Skip to content

Eq1 Fixed is dubious

I added this instance without not too much thinking:

instance Eq1 Fixed where
    liftEq _eq (MkFixed x) (MkFixed y) = x == y

but I'm not sure it makes sense as liftEq allows comparing of different types, which is very not right for Fixed types:

Prelude Data.Fixed Data.Functor.Classes> liftEq undefined (12 :: Micro) (12000 :: Milli) 
True

One would expect 12000 :: Micro and 12 :: Milli (i.e. otherway around) be equal! (or alternatively the first argument of undefined would make some resolution conversion)

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