[Haskell-cafe] Do type classes have a partial order?

Ling Yang lyang at cs.stanford.edu
Mon Nov 14 13:35:55 CET 2011


It seems like you would, going by semantics of System F, where types
with type variables name a certain subset of types, => constraints
further restrict the types of the same "shape" (are they an
independent kind of restriction?),  so typeclass declarations
with/without => specify a partial order over types because the subset
relation is.

On Mon, Nov 14, 2011 at 3:47 AM, Patrick Browne <patrick.browne at dit.ie> wrote:
> Is there a partial order on Haskell type classes?
> If so, does it induce any quasi-order relation on types named in the
> instances?
> In the example below types C and D have the same operation f
> Thanks,
> Pat
>
> data C = C deriving Show
> data D = D deriving Show
>
> class A t where
>  f::t->t
>  f t = t
>
> instance A C where
> instance A D where
>
>
> class A t => B t where
>
> instance B C where
> instance B D where
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>



More information about the Haskell-Cafe mailing list