Hi Marcin,
Nice work; I also implemented free groups in the free-algebra package
Wonderful - I'll take a look. Those were a bit rough, and it'd be good to see how you encoded them in `free-algebra`. Maybe we can collaborate on expanding the knowledgebase and utility of free group calculations in our respective packages :)
However 'FG' is the free group in the class of all groups.
I'm glad you noted this as well! The `DList` encoding is interesting - I'll need to study that a bit :)
There's an interesting difference between 'FreeGroup' (using notation of your package) and 'FG'. First one is not a free group in the class of all groups, but only free in the class of groups for which multiplication is strict in the left argument
Correct. Regarding motivation, I provided both because I know some people do like to operate in the fast-and-loose strict subset of Haskell. It's no skin off my back. But I was very unsatisfied with strict (vis. "moral") Free constructions with respect to bottoms, and, inspired by Dan Doel's article (
http://comonad.com/reader/2015/free-monoids-in-haskell/), attempted to find a free construction for groups that was more in line with Haskell's domain-like types. I note this article in the documentation for FG.
Maybe this deserves a broader blog post?
I identified that `Foldable` can only be defined for algebraic structures for which `Endo b` has the same algebra type; this fails for groups: only automorphisms form a group. Having a seprate `GroupFoldable` class makes sense.
That class ended up being good for two things:
- Great puns.
- Very convenient word evaluation
If you'd like to add to it, I'd be stoked.
Cheers,
Emily