Toxaris / coalgebraic-parsing

0 stars 0 forks source link

Introduce Cobind typeclass and make Parser an instance of it. #3

Closed b-studios closed 9 years ago

b-studios commented 9 years ago

For dicussion. Also see https://github.com/Toxaris/coalgebraic-parsing/commit/803305b0b50474064092fea1451ef00b068a0058#commitcomment-11757924

Toxaris commented 9 years ago

What's the status of these commits?

So I propose to rearrange the commits and only merge the delegate stuff.

b-studios commented 9 years ago

The Cobind typeclass gives us some standard operators like <<= and =<=. These might be helpful (or not) once we deeply understood the semantics of delegate (== duplicate).

b-studios commented 9 years ago

In addition, so far we always followed the "implement all operations as instances of appropriate typeclasses" approach. Cobind sadly is only defined as one part of Comonad, so I inlined it here.

Toxaris commented 9 years ago

For me, the point of implementing operators as methods of standard type classes is that there is existing code that works generically for all instances of the type class. By also supporting the type class, we can reuse this existing code. For example, by supporting Applicative for our parsers, we can use combinators like traverse.

This particular argument for type classes doesn't work for self-defined classes like CoBind.

Toxaris commented 9 years ago

Split into #4 and #6,closing.