'Composite typeclasses in Haskell
Is there any practical difference between
class (From a b, To a b) => IsomorphismFromTo a b
instance (From a b, To a b) => IsomorphismFromTo a b
and
type IsomorphismFromTo a b = (From a b, To a b)
where no instance of IsomorphismFromTo a b is provided apart from the trivial one,
apart from the ability to quantify
--type IsomorphismFromTo a b = (From a b, To a b) -- fails
class (From a, To a) => IsomorphismFromTo a b -- works
type IsomorphismFromTo1 f g = forall x. IsomorphismFromTo (f x) (g x)
-- "You can't specify an instance for a tuple constraint" with the constraint synonym
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
