Monoid instances by I., S.

p=map
(#)=(++)
m=("Monoid "#)
e="mempty"
x&y=x#" `mappend` "#y
c x y="("#drop y(concatMap(take y", "#)x)#")"
i="\n    "
f x=putStr$"instance "#c(p m x)2#" => "#m(c x 1)#" where"#i#e#" = "#c[e|y<-x]1#i#c(p(#"1")x)1&c(p(#"2")x)1#" = "#c[y#"1"&y#"2"|y<-x]1#"\n\n"
main=mapM f$p(`take`p(\x->[x])['a'..])[2..26]

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

download

return to the top page