purebred-0.1.0.0: An mail user agent built around notmuch

Safe HaskellNone
LanguageHaskell2010

UI.Validation

Description

Module providing asynchronous validation for input from widgets

Synopsis

Documentation

dispatchValidation Source #

Arguments

:: (a -> Maybe Error)

validation function

-> Lens' AppState (Maybe Error) 
-> a 
-> AppState 
-> IO AppState 

Schedules validation by sending a PurebredEvent.

We fork a thread to send an event to the application which carries the lens to set the error as well as the error itself. To avoid setting an error on every key stroke, the thread is killed if we find a thread id already set and a new thread is scheduled.