tQ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP NoneAOT\A typeclass to ensure people don't dispatch events to states which shouldn't accept them.[To allow dispatching events in an action over your state simply define the empty instance: =instance HasEvents MyState where -- Don't need anything here.8Represents a state which can itself store more states. + is a lens which points to a given state's  map.,A map of state types to their current value.Q=A wrapper to allow storing types of states in the same place.PA polymorphic lens which accesses stored states. It returns the default value (R") if a state has not yet been set.A utility which creates a state-nested version of a lens. If you pass this function a lens from your state to one of its fields, it will return a lens which can be used within an App or Action.$The resulting lens will be of type: )newLens :: HasStates s => Lens' s MyState Or if you prefer, you may wish to specify the state it operates over more specifically to prevent using the lens where it was not originally planned. For instance: !newLens :: Lens' AppState MyState pdata SimpleState = SimpleState { _myString :: String } makeLenses ''SimpleState instance Default SimpleState where def = SimpleState "default" myStringStateLens :: HasStates s => Lens' s String myStringStateLens = makeStateLens myString myAction :: App () myAction = do myStringStateLens .= "Hi!" str <- use myStringStateLens liftIO $ print str -- "Hi!"DFor more complex Prisms or Traversals you can write your own using QSQSSafe          None29:;<=DIORT eBase Action type. Allows paramaterization over application state, zoomed state and underlying monad..A Free Functor for storing lifted App actions.An App% has the same base and zoomed values.THelper method to run FreeTs.~This runs an `Action MyState a` over the MyState which is stored in the currently focused state and returns the result. Use Y if you'd like to specify a particular MyState which is accessed by a Lens or Traversal.Given a U or V or LensLike from  Control.Lens$ which focuses the state (t) of an Action+ from a base state (s), this will convert Action t a -> Action s a so that it may be run in an  Action s aAllows you to run an App inside of an Action4Runs an application and returns the value and state.4Runs an application and returns the resulting value.4Runs an application and returns the resulting state.T   TNone&&A basic default state which underlies / Contains only a map of .,A more general version of .0 which lets you to specify the underlying monad.-A more general version of /- which lets you specify the underlying monad..An .; is a monad over some zoomed in state, they are run inside / using . For example an .O which operates over a String somewhere in your app state would be written as: !alterString :: 'Action' String ()/An /V is a base level monad which operates over your main application state. You may call  inside an app to run .s over other states.0/Accesses a queue for dispatching async actions.1-Tells the application to quit. This triggers onExit- listeners following the current event loop.2/Checks whether we're in the process of exiting.&'(WXYZ)*+,-./[\]01234 &'(,-./012 &'(/.,-120&'(WXYZ)*+,-./[\]01234None9;<=AT5wDispatch an action which is generated by some IO. Note that state of the application may have changed between calling 5 and running the resulting .61This allows long-running IO processes to provide .#s to the application asyncronously.asyncEventProvider is simpler to use, however 67 provides more power and expressivity. When in doubt, asyncEventProvider probably meets your needs.JDon't let the type signature confuse you; it's much simpler than it seems.Let's break it down:When you call 6( you pass it a function which accepts a dispatch9 function as an argument and then calls it with various .s within the resulting ^. The dispatch& function it is passed will have type (App () -> IO ())XNote that this function calls forkIO internally, so there's no need to do that yourself.Here's an example: data Timer = Timer myTimer :: (App () -> IO ()) -> IO () myTimer dispatch = forever $ dispatch (myInt += 1) >> threadDelay 1000000 myInit :: App () myInit = asyncActionProvider myTimer56565656None%&AOT7BThis is a type alias to make defining your functions for use with K easier; It represents the function your event provider function will be passed to allow dispatching events. Using this type requires the  RankNTypes language pragma._$Store the listeners in the state-map`:A map of event types to a list of listeners for that event8wAn opaque reverence to a specific registered event-listener. A ListenerId is used only to remove listeners later with I.9:A wrapper around event listeners so they can be stored in `.:PRegisters an action to be performed directly following the Initialization phase.MAt this point any listeners in the initialization block have run, so you may Bs here.;ORegisters an action to be performed BEFORE each async event is processed phase.=;Registers an action to be performed AFTER each event phase.?oRegisters an action to be run before shutdown. Any asynchronous combinators used in this block will NOT be run.@A local version of BH. The local version dispatches the event in the context of the current Action8, If you don't know what this means, you probably want B insteadBMRuns any listeners registered for the provided event with the provided event; You can also query listeners and receive a (a al) result. data RequestNames = GetFirstName | GetLastName provideName1, provideName2 :: RequestNames -> App [String] provideName1 GetFirstNames = return ["Bob"] provideName1 GetLastNames = return ["Smith"] provideName2 GetFirstNames = return ["Sally"] provideName2 GetLastNames = return ["Jenkins"] -- Note that if we registered an action of type 'GetFirstName -> ()' it would NOT -- be run in response to the following 'dispatchEvent', since it's type doesn't match. greetNames :: App [String] greetNames = do addListener_ provideName1 addListener_ provideName2 firstNames <- dispatchEvent GetFirstName lastNames <- dispatchEvent GetLastName liftIO $ print firstNames -- ["Bob", "Sally"] liftIO $ print lastNames -- ["Smith", "Jenkins"]DThe local version of F(. It will register a listener within an ActionLs local event context. If you don't know what this means you probably want F instead.F Registers an Action or App to respond to an event.For a given use: addListener myListener,  myListener might have the type MyEvent -> App a it will register the function  myListener to be run in response to a !dispatchEvent (MyEvent eventInfo) and will be provided (MyEvent eventInfo) as an argument.This returns a 8; which corresponds to the registered listener for use with IHThe local version of I#. This removes a listener from an ActionFs event context. If you don't know what this means you probably want I instead.I3Unregisters a listener referred to by the provided 8JThis function takes an IO which results in some event, it runs the IO asynchronously, THEN dispatches the event. Note that only the code which generates the event is asynchronous, not any responses to the event itself.beThis extracts all event listeners from a map of listeners which match the type of the provided event.c5Extract the listener function from eventType listenerKYThis allows long-running IO processes to provide Events to the application asyncronously.JDon't let the type signature confuse you; it's much simpler than it seems.Let's break it down: Using the 7+ type with asyncEventProvider requires the  RankNTypes language pragma.<This type as a whole represents a function which accepts an 7 and returns an ^-; the dispatcher itself accepts data of ANY d type and emits it as an event.When you call K( you pass it a function which accepts a dispatchU function as an argument and then calls it with various events within the resulting ^.XNote that this function calls forkIO internally, so there's no need to do that yourself. Here's an example which fires a Timer event every second. {-# language RankNTypes #-} data Timer = Timer myTimer :: EventDispatcher -> IO () myTimer dispatch = forever $ dispatch Timer >> threadDelay 1000000 myInit :: App () myInit = asyncEventProvider myTimer7_e`8f9g:;<=>?@ABCDEFGHIJhbcKLM789:;<=>?@ABCDEFGHIJKBC@AJFGDEIHK:;<=>?9877_e`8f9g:;<=>?@ABCDEFGHIJhbcKLMNoneN This runs your application like Os, It is polymorphic in the Monad it operates over, so you may use it with any custom base monad which implements i4. Upon termination of the app it returns the final &.O`This runs your application. It accepts an initialization block (which is the same as any other / or .j block, which registers event listeners and event providers. Note that nothing in this block should use BX since it is possible that not all listeners have yet been registered. You can use the :Y trigger to dispatch any events you'd like to run at start-up. Here's a simple example: import Eve initialize = App () initialize = do addListener_ myListener asyncEventProvider myProvider startApp :: IO () startApp = eve_ initializejThis is the main event loop, it runs recursively forever until something sets the exit status. It runs the pre-event listeners, then checks if any async events have finished, then runs the post event listeners and repeats.NOjNONONOjNonePPPP None(&./156789:;<=>?@ABCDEFGHIJKNO(O/.1BCFGI98K7:;<=>?&N@ADEH6J5k     !"#$%&'()**+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWTXYZ[YZ\]]^_``abcdefghijkglme;<ngopqr eve-0.1.7-AN1TXBrCT3v9qE7mRwxl88Eve.Internal.StatesEve.Internal.EventsEve.Internal.ActionsEve.Internal.AppStateEve.Internal.AsyncEve.Internal.ListenersEve.Internal.Run Eve.TestingEve HasEvents HasStatesstatesStates stateLens makeStateLensExit AfterEvent BeforeEvent AfterInitInitActionT getActionAppFRunAppAppT runAction runActionOverrunApprunEveevalEveexecEve$fZoomActionTActionTst$fMonadTransActionT$fMonadFreeAppFActionT $fFunctorAppF$fApplicativeAppF$fFunctorActionT$fApplicativeActionT$fMonadActionT$fMonadIOActionT$fMonadStateActionTAppState _baseStates$fHasEventsAppState$fHasStatesAppState$fDefaultAppStateActionMAppMActionApp asyncQueueexit isExiting$fDefaultExiting$fDefaultAsyncQueuedispatchActionAsyncasyncActionProviderEventDispatcher ListenerIdListener afterInit beforeEvent beforeEvent_ afterEvent afterEvent_onExitdispatchLocalEventdispatchLocalEvent_ dispatchEventdispatchEvent_addLocalListeneraddLocalListener_ addListener addListener_removeLocalListenerremoveListenerdispatchEventAsyncasyncEventProvider$fDefaultLocalListeners$fEqListenerIdeveeve_noIOTest StateWrapper1data-default-class-0.1.2.0-FYQpjIylblBDctdkHAFeXAData.Default.ClassdefunLift!lens-4.15.1-X68zRms69QGtSko8pZIk7Control.Lens.TypeLens Traversal AsyncQueue _asyncQueue' baseStatesExiting asyncQueue'ghc-prim GHC.TypesIOLocalListeners ListenersbaseGHC.BaseMonoidmatchingListeners getListenerData.Typeable.InternalTypeablelocalListenersControl.Monad.IO.ClassMonadIO eventLoop