byorgey / enumeration

Simple Haskell package for efficiently indexable finite and infinite enumerations.
BSD 3-Clause "New" or "Revised" License
11 stars 2 forks source link

Add (Co|Pro)Enumeration #4

Closed viercc closed 4 years ago

viercc commented 4 years ago

Addition explained in issue #3

byorgey commented 4 years ago

Thanks! I hope to get a chance to take a closer look soon.

byorgey commented 4 years ago

@viercc , sorry it's taken me a while to get a chance to look through this, but I finally looked through everything. All looks great! I guess I'm still not sure when/why I might want to use CoEnumeration or ProEnumeration, but I will definitely be on the lookout for opportunities. =)

Do you think we should make a new release with these additions? Or is there other stuff you wanted to talk about adding still?

viercc commented 4 years ago

Thank you for the review and merge!

I prefer one more change to be done, which is to implement IEnumeration in terms of ProEnumeraion.

Currently, I didn't change anything in Enumeration and Invertible modules, to reduce the scope of the PR. Doing this, CoEnumeraion and ProEnumeraion contain plenty of code copied or reimplemented from Invertible.

If I would do refactoring right now, I'd make IEnumeration a a synonym of ProEnumeration a a, or a newtype wrapping it. I'm not sure that can be easily fit into the current APIs though.

And let me notify one-line error in my documentation:This

--- | Direct product of proenumerations.
+-- | Disjoint sum of proenumerations.

I have bad English grammar too. Please fix me!