cmptype: Compare types of any kinds

[ bsd3, library, type ] [ Propose Tags ]

Please see the README on GitHub at

[Skip to Readme]
Versions [faq],,
Change log
Dependencies base (>=4.7 && <5), ghc (>=8.6.3 && <8.8), magic-tyfams (>= && <0.2) [details]
License BSD-3-Clause
Copyright 2019 Sandy Maguire
Author Sandy Maguire
Category Type
Home page
Bug tracker
Source repo head: git clone
Uploaded by isovector at 2019-08-11T15:58:59Z
Distributions NixOS:
Downloads 872 total (15 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-08-11 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for cmptype-

[back to package description]




Comparison is an act of violence against the self.

--Iyanla Vanzant


cmptype provides a magical type family that lets you compare types:

type family CmpType (a :: k) (b :: k) :: Ordering

When you turn on the -fplugin=Type.Compare.Plugin flag, it will let you compare arbitrary types. Why would you want such a thing? Probably because you want to write a type-level container that isn't a fucking list!


Big thanks to Boris Rozinov for the initial idea, and for making as much coffee as I could drink while I wrote it. Also thanks to Christiaan Baaij and Matt Pickering for their indispensable help convincing GHC to do the right thing here.