[Haskell-cafe] Use cases of empty type classes
david.feuer at gmail.com
Thu Mar 10 19:59:23 UTC 2016
The constraints package currently uses
class Any => Bottom where
no :: Dict a
It should probably actually use
no :: a
but that's a minor point.
There are two ideas:
1. The class constraint Any is a stuck type family, so it's utterly
impossible to create an instance of Bottom. Thus any entailment c :-
Bottom implies that c is unsatisfiable.
2. There's an entailment
bottom :: Bottom :- c
bottom = Sub no
On Thu, Mar 10, 2016 at 1:42 PM, Mitchell Rosen <mitchellwrosen at gmail.com>
> One empty typeclass I use often not only has no methods, but also has no
> class Void
> This is useful in type families that return Constraint, when you want to
> say this constraint is "unsatisfiable". I suppose returning something like
> "True ~ False" would also suffice, but isn't as pretty.
> On Monday, March 7, 2016 at 10:10:48 PM UTC-8, Tomas Tauber wrote:
>> Hi everyone,
>> I have one question. What are current use cases of type classes with no
>> I saw early uses in type-level programming (e.g. HList ).
>> In the OO world, interfaces with no methods are called marker interfaces
>> -- their use cases range from things that could be done with datatype
>> generic programming in Haskell (e.g. serialization) to metadata annotations
>> (e.g. RandomAccess ).
>> Tomas Tauber
>>  http://okmij.org/ftp/Haskell/HList-ext.pdf
>>  https://docs.oracle.com/javase/8/docs/api/java/util/RandomAccess.html
>> Haskell-Cafe mailing list
>> Haskel... at haskell.org
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe