[Haskell-cafe] Partially applied type synonyms
Anthony Clayden
anthony.d.clayden at gmail.com
Fri Oct 8 03:33:07 UTC 2021
> 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
-XLiberalTypeSynonyms relaxes the 'saturated application' rule a little
https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/liberal_type_synonyms.html?highlight=type%20synonym#liberalised-type-synonyms
"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.
Possibly your `Bar` could be a type synonym, taking `(Foo Maybe)` as an
argument in the `instance Eq`. What type is it exactly that you want to
derive an instance for?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20211008/5eea3756/attachment.html>
More information about the Haskell-Cafe
mailing list