<div dir="ltr"><font style="background-color:rgb(255,255,255)" face="arial, sans-serif"><br></font><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif">> <span style="color:rgb(0,0,0);white-space:pre-wrap">I was surprised to find the below code doesn't typecheck even with -XLiberalTypeSynonyms. Am I missing something or is this really not possible?</span></font></div><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><font size="2" style="background-color:rgb(255,255,255)" face="arial, sans-serif">
</font></pre><font style="background-color:rgb(255,255,255)" face="arial, sans-serif">Reading the error message would help:</font><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif"><br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif">* The type synonym `Foo' should have 2 arguments, but has been given 1<br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif"><br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif">-XLiberalTypeSynonyms relaxes the 'saturated application' rule a little <a href="https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/liberal_type_synonyms.html?highlight=type%20synonym#liberalised-type-synonyms">https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/liberal_type_synonyms.html?highlight=type%20synonym#liberalised-type-synonyms</a></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif"><br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif"><span style="color:rgb(64,64,64)">"You can apply a </span><span class="gmail-highlighted" style="box-sizing:border-box;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;display:inline-block;padding:0px 6px;color:rgb(64,64,64)">type</span><span style="color:rgb(64,64,64)"> </span><span class="gmail-highlighted" style="box-sizing:border-box;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;display:inline-block;padding:0px 6px;color:rgb(64,64,64)">synonym</span><span style="color:rgb(64,64,64)"> to a partially applied type synonym:"</span><br></font></div><div><span style="color:rgb(64,64,64);background-color:rgb(255,255,255)"><font face="arial, sans-serif"><br></font></span></div><div><span style="color:rgb(64,64,64);background-color:rgb(255,255,255)"><font face="arial, sans-serif">But that isn't what you're doing. The docs say that still</font></span></div><div><span style="color:rgb(64,64,64);background-color:rgb(255,255,255)"><font face="arial, sans-serif"><br></font></span></div><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif"><span style="color:rgb(64,64,64)">" ... </span><span style="color:rgb(64,64,64)">malformedness ... * </span><span style="color:rgb(64,64,64)">Partially-applied </span><span class="gmail-highlighted" style="color:rgb(64,64,64);box-sizing:border-box;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;display:inline-block;padding:0px 6px">type</span><span style="color:rgb(64,64,64)"> </span><span class="gmail-highlighted" style="color:rgb(64,64,64);box-sizing:border-box;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;display:inline-block;padding:0px 6px">synonym</span><span style="color:rgb(64,64,64)">."</span></font></div><div><span style="color:rgb(64,64,64);background-color:rgb(255,255,255)"><font face="arial, sans-serif"><br></font></span></div><div><span style="background-color:rgb(252,252,252);color:rgb(64,64,64)"><font face="arial, sans-serif">Type Synonyms are not functions. Think of them as 'macro' expansions.</font></span></div><div><span style="background-color:rgb(252,252,252);color:rgb(64,64,64)"><font face="arial, sans-serif"><br></font></span></div><div><span style="background-color:rgb(252,252,252);color:rgb(64,64,64)"><font face="arial, sans-serif">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?</font></span></div><div><span style="background-color:rgb(252,252,252);color:rgb(64,64,64)"><font face="arial, sans-serif"><br></font></span></div><div><span style="background-color:rgb(252,252,252);color:rgb(64,64,64);font-size:16px"><br></span></div></div>