Eq Void instance
bergmark opened this issue · comments
No biggie, but we forgot to add this before the release. @hesselink did you figure out what instance you liked best? :)
I think something like this is fine:
instance Eq Void where
x == _ = magic x
Saying True
or False
seems weird to me, since you'd be giving a result for comparing two bottoms. After that we'd have to make a choice about laziness (i.e. is (undefined ==) :: Void -> Bool
already bottom, or can you first apply it to another bottom?). I'd say only the resulting Bool
should be bottom. Then we'd have to choose which one. We can't choose both, so the first one is as good as any, I guess.
I've just pushed this, as well as instances for Ord
(similar) and Read
(always failing) to void-instances. Any more we should add?
Eq
is the only one I've needed so far.
I also forgot, was there a reason we don't use the void
package?
We didn't want to pull in the dependencies for such a simple data type, especially since we didn't really do much with it initially. Now that we're adding more functionality, we could switch, although it doesn't matter much: nobody's going to interface between different Void
types, I guess. Also (very minor): I like our representation better. :)
Shall I merge this?
Do it!
Committed as 4baa3de, will release as rest-types-1.13.1.