tonymorris/fp-course

Use applicative style in Course.Parser

bagl opened this issue · 1 comments

bagl commented

Applicative style of parsing will make the whole module cleaner.

I would also move instances of different classes directly below blbindParser so that they can be used in the subsequent exercises.

I could rework the module if this change would be accepted.

ahaxu commented

I tried to implement Applicative for ParseResult

 instance Applicative ParseResult where
     pure ::
        a
        -> ParseResult a
     pure a = undefined

     (<*>) ::
        ParseResult (a->b)
        -> ParseResult a
        -> ParseResult b
     (<*>)= undefined

but, I don't know how to start with pure

Can you help @bagl ? Thank you.