Monoid instances by hallvabo

a=b=d=e=f=''
x,y='Monoid ',' `mappend` '
n=1
while n<26:n+=1;c=chr(n+96);a+=", "+x+c;b+=","+c;d+=",%c1"%c;e+=",%c2"%c;f+=",%c1"%c+y+c+"2";print"instance ("+x+"a%s) =>"%a,x+"(a%s) where\n    mempty = ("%b+(',mempty'*n)[1:]+")\n    (a1%s)"%d+y+"(a2%s) = (a1"%e+y+"a2%s)\n"%f

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page