News for hackers. Stuff that matters.
Re:What the heck is a parser-combinator? by Mehdi2277 on Wednesday June 21, 2017 @05:08AM (#14602163)
Yeah that type is enough to make a monad. In slightly fancy language the type you just wrote is just StateT Input Maybe. Monadic mostly makes me think of bind which is just about chaining (technically also return is needed, but here return is just always succeed and give that value) and parsers have a natural notion of run one after the other.
Re:What the heck is a parser-combinator? by tel on Wednesday June 21, 2017 @01:50PM (#14606196)
It's only a monad if you define it to be. It's also "just" an applicative if you like. The monadic part arises when people actually _use_ bind and then you lose some information that might be nice for optimizations.
Re:What the heck is a parser-combinator? by lomnakkus on Wednesday June 21, 2017 @07:39AM (#14602798)
> In slightly fancy language the type you just wrote is just StateT Input Maybe.

Except the newtype -- which was kind of my point :).