I would like to thank this community for answering my off the wall questions in the past, comp.lang.haskell has been quite helpful to me in learning haskell, but also functional programming. Here comes another.
In a paper by Mark Jones "Functional Programming with Overloading and Higher-Order Polymorphism" he (re)defines the monoid class
>> class Monoid a where >> e :: a >> op :: a -> a -> a
then he defines some monoid instances. In particular interest he defines
>> instance Monoid ( a -> a ) where >> e = id >> op = ( . )
which is very interesting because one could, if they desired build even more structure from this monoid, and do some very interesting things from a theoretical (but perhaps not practical) point of view. However, when I try to load the above in hugs I get the following error: "Repeated variable "a" in instance head." I don't know how to intepret that message, and don't really know why it does not work. It makes sense to have a monoid defined thus.
>> instance Monoid (\f -> f) >> e = id >> op = ( . )
which has type a -> a, but then I get an error. "Syntax error. Unexpected backslash (lambda)", even though I did not expect it to work, I got an error message, that might be related to the first, that someone could find helpful.
"jon.gallagher.04" <jon.gallagher...@gmail.com> writes: >>> instance Monoid ( a -> a ) where >>> e = id >>> op = ( . ) > However, when I try to load the above in hugs I get the following > error: "Repeated variable "a" in instance head."