ChrisPenner / rasa

Extremely modular text editor built in Haskell
GNU General Public License v3.0
614 stars 42 forks source link

Use Pipes for async event and Action dispatch #33

Closed ChrisPenner closed 7 years ago

ChrisPenner commented 7 years ago

Refactors event system to use Pipes and Pipes.Parse; this lets us cleanly allow dispatching events asynchronously to mailboxes which provide for the main event loop. This is convenient when running persistent actions which may yield several events; for example listening for network traffic or running expensive parsers, or listening for file-system events.

Adds the following utilities:

asyncEventProvider :: Typeable a => ((a -> IO ()) -> IO ()) -> Action ()
asyncActionProvider :: ((Action () -> IO ()) -> IO ()) -> Action ()
dispatchActionAsync ::  IO (Action ()) -> Action ()
dispatchEventAsync :: Typeable a => IO a -> Action ()
ChrisPenner commented 7 years ago

@clojj You'll want to take a look at this; could help clean up the Syntax Highlighting system.

clojj commented 7 years ago

This and the Free Monad commits.... great stuff to wrap my head around. Serious stuff. Nice achievement!