snowleopard / alga

Algebraic graphs
MIT License
717 stars 68 forks source link

Smart constructor for Symbol rather than requiring -XOverloadedLists #297

Open ocramz opened 2 years ago

ocramz commented 2 years ago

It took me a minute to realize coffeeTeaAutomaton only works when OverloadedLists is on. Requiring the extension runs the risk of breaking other code in a module (just happened to me), which is not ideal.

Feature request : Can we have smart constructors for Symbol ? e.g.

symbol :: a -> Label a
symbol = Symbol 

and

symbols :: Foldable t => t a -> Label a
symbols = foldr ((<>) . Symbol) Zero
snowleopard commented 2 years ago

Thanks for the PR! I'm hesitant to change the example in coffeeTeaAutomaton though since it would make it more cluttered. How about extending the corresponding comment, pointing out that the inner lists are overloaded?