<div dir="ltr"><div class="gmail_extra">On Fri, Jul 26, 2013 at 5:08 PM, Micah Cowan <span dir="ltr"><<a href="mailto:micah@cowan.name" target="_blank">micah@cowan.name</a>></span> wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":9gt" style="overflow:hidden">I was wondering if there was a way to do it in "pure" Haskell (i.e., no<br>
GHC pragmas required), and also the specific reason for why the above<br>
example doesn't work without the pragma (I think it's just that in<br>
general a -> b is not syntactically allowed for type specifiers within<br>
instance declarations)?</div></blockquote></div><br>The error message you get without the pragma tells you exactly what's wrong, and that's not it.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
Standard Haskell is *very* conservative about what it allows in an instance declaration; you may not have literal types, nor may you repeat a type variable, only things of the form (Type var1 var2 ...) are permitted. (The (String -> String) is not syntactically a problem; it's read as ((->) String String) which would conform *if* it didn't use literal types. You can verify this by rephrasing it in prefix form --- note the error message uses the infix form even if you phrase it as a prefix!) This is widely seen as unnecessarily restrictive.<br clear="all">
<div><br></div>-- <br><div dir="ltr"><div>brandon s allbery kf8nh sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a> <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div>
<div>unix, openafs, kerberos, infrastructure, xmonad <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div>
</div></div>