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

On Wednesday, 22 November 2023 10:30:01 PM ACDT haskell-cafe-request@haskell.org wrote:
Thank you to anyone in advance who can help; I do really appreciate it.
I think a simple redefinition of "Formable" takes care of the described obstacle. Do you have other requirements that make it impractical?
-- Viktor.
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. The short answer is that I'm not sure yet whether there are any other requirements that bear on this, given the exploratory nature of the little project, but having just played with your modifications and then worked it back to the main code, this solution looks excellent at this stage. Really appreciate it. Regards, D.

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.
participants (2)
-
Darryn
-
Viktor Dukhovni