
On 10/08/2021 5:33 AM Anthony Clayden
wrote: > I was surprised to find the below code doesn't typecheck even with -XLiberalTypeSynonyms. Am I missing something or is this really not possible?
Reading the error message would help:
* The type synonym `Foo' should have 2 arguments, but has been given 1
I'm not sure what in my question made it seem like I hadn't read this error message. With my code as written I can't apply both arguments, and I'm trying to solve the problem in front of me given that fact.
-XLiberalTypeSynonyms relaxes the 'saturated application' rule a little https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/liberal_type_synonym...
"You can apply a type synonym to a partially applied type synonym:"
But that isn't what you're doing. The docs say that still
" ... malformedness ... * Partially-applied type synonym."
Type Synonyms are not functions. Think of them as 'macro' expansions.
Interestingly I get an almost identical error when defining Foo as a type family, which seems a lot more akin to a function.
Possibly your `Bar` could be a type synonym, taking `(Foo Maybe)` as an argument in the `instance Eq`.
Thank you for this concrete suggestion. I'd actually tried variations on this before asking on the list, and I've tried a few more just now, but I'm very willing to believe I'm simply not looking in the right place. Certainly a simple `type Bar' x = Bar x` isn't changing anything.
What type is it exactly that you want to derive an instance for?
Other than excluding unnecessary details, I've provided code that's pretty similar to the real code I'm working on. The biggest difference is that `Bar` is actually defined more like: data Bar (m :: * -> *) = Bar { a :: m Int, b :: m Bool, c :: m Double } So it really does need to take a `* -> *` type Thanks, Tom
_______________________________________________Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.