[Haskell-cafe] Computing the multiplication table of a group using the GHC inliner ; )

Antoine Latter aslatter at gmail.com
Wed Mar 23 02:13:02 CET 2011

2011/3/22 Daniel Schüssler <anotheraddress at gmx.de>:
> Hello,
> turns out that you can define the group operation of the symmetric group on 3
> elements in this abstract way (via the isomorphism to the group of bijective
> functions from a three-element type to itself):
>        s3mult g2 g1 = fromFun (toFun g2 . toFun g1)
> and convince GHC to compile it down to a nested case statement. It even
> somehow made the left multiplication with the identity non-strict. Just
> thought it's neat ;)

That's quite fantastic.


More information about the Haskell-Cafe mailing list