[Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation....

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Tue Jan 6 18:09:36 UTC 2015


On Tue, Jan 06, 2015 at 05:43:47PM +0000, Nicholls, Mark wrote:
> Its quite common in maths to have operations in a theory that are (set)
> closed, i just want to translate that notion to a typeclass

Do you really need a typeclass (or indeed any way) of doing this?  I suspect
it will not work.  If you consider the multiplication for the monoid of
concatenation of lists

    (++) :: [a] -> [a] -> [a]

you see that its type already implies that it is "closed".

Tom


More information about the Haskell-Cafe mailing list