On Fri, Jul 26, 2013 at 5:08 PM, Micah Cowan <mi...@cowan.name> wrote:
> I was wondering if there was a way to do it in "pure" Haskell (i.e., no > GHC pragmas required), and also the specific reason for why the above > example doesn't work without the pragma (I think it's just that in > general a -> b is not syntactically allowed for type specifiers within > instance declarations)? > The error message you get without the pragma tells you exactly what's wrong, and that's not it. 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. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe