Monoid instances by brx

$M=Monoid;$m=mempty;$;=' `mappend` ';$_="instance ($M a) => $M (a) where
    $m = ($m)
    (a1)$;(a2) = (a1$;a2)

";for$:(b..z){s/($M )?\b\w(.)?\K\)/",$1$:$2)"/ge,s/y.$/y,$m)/m,s/,M/, M/,s/.2.
/$:1$;$&/,print}

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

download

return to the top page