Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell: FRP Reactive Parsec?

Is there (or is it possible to have) a reactive Parsec (or any other pure functional parser) in Haskell?

Simply put, I want to feed parser myself char by char and get results as much as I feed enough to get output.

Or much simpler, how can I do it in foldr or at least map?

Do we need a different version of them to support such reactive behavior?

EDIT

My question is about FRP in particular. I used a parser as an example, which was the best I could think of to clarify my question and give big picture of what I need.

I believe FRP is not just about UI, right?

like image 438
KA1 Avatar asked Jul 13 '11 07:07

KA1


1 Answers

You cannot do online parsing in Parsec, it has to consume all the input in order to determine whether there is a valid parse or not.

However there are alternatives. One possiblity is to use the Utrecht parser combinators, it has online parsing among its features.

like image 96
Federico Squartini Avatar answered Oct 02 '22 18:10

Federico Squartini