[Haskell-cafe] Unique Ordered Types

Richard Eisenberg eir at cis.upenn.edu
Thu Aug 13 02:21:30 UTC 2015

Hi Silvio,

I'm the author of the units package. Yes, the types are annoying and painfully indirect, exactly because of the problem you identify.

CmpSymbol might work for you. Note that it works only on Symbols (type-level strings) and not arbitrary types. I didn't like it because I wanted it to be possible to leverage Haskell's module system to allow distinct units but with the same name, declared in different modules. (For example, "pound" can refer to a plethora of different units.) This requirement may have been a step too far, and I'd be curious to see how much the system could be simplified without it.

Good luck!


On Aug 12, 2015, at 7:41 PM, Silvio Frischknecht <silvio.frischi at gmail.com> wrote:

> Btw I think I found a solution in
> https://hackage.haskell.org/package/base-
> there is a type level sort
> type family CmpSymbol m n :: Ordering
> This might work.
> Silvio
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list