[Haskell-cafe] A question about type families conflicting instances

Viktor Dukhovni ietf-dane at dukhovni.org
Thu Nov 23 05:59:59 UTC 2023


On Thu, Nov 23, 2023 at 10:27:39AM +1030, Darryn wrote:

> > I think a simple redefinition of "Formable" takes care of the described
> > obstacle.  Do you have other requirements that make it impractical?
> 
> Hi Viktor. Thanks again for taking a look at this and giving me
> advice. I hadn't thought of the problem like this, using kind
> representation.

I hope that I didn't give the impression that the use of 

    import Data.Kind (Type)

was an essential (or even required) part of the suggested alternative.
It is was rather just pedantic precision.  The "kind annotation" in

        type Aof b :: Type

is entirely optional, the actual change was to define how "a" depends
on "b", rather than how "b" depends on a.  This is because extracting:

    (S a) -> a
    (W a) -> a

is just simple pattern matching, while divining with of (S a) or (W a)
to associate with "a" is hopelessly ambiguous.

-- 
    Viktor.


More information about the Haskell-Cafe mailing list