úΊI…:P      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO(c) Gershom Bazerman, 2012 BSD 3 Clausegershomb@gmail.com experimentalNone2468'This class should not be used directly.'This class should not be used directly.¶A JsonRPC is a named function that takes a handle to some state, and yields a function from request to result in some monad. It is a representation of the server side of an RPC call.,A JSON result is either an error or a value. "A JSON request is a list of values retErr = return . Left )Takes a compatible function to a JsonRPC. STakes a compatible function to a JsonRPC making use of state (i.e. a conversation). ÆSend a function on Jsonable values to a function of the same signature whose logic is invokable on a remote server. This function operates on the type of its argument. The body can remain undefined.]Takes a name and a function and yields both the server-side JsonRPC and the client-side stub.BJMacro Javascript stub to invoke json-rpc calls from web browsers.id with a helpful type.±Given a function for managing local state, and a list of JsonRPCs over that local state, produce a function from Bytestring to Bytestring mapping json-rpc requests to responses.ÿqUsed for creating server backends. Yes, this type is confusing. But unless you are creating a server backend, you can ignore it. Takes a function to generate some time identifier, a function to cull page state, a rpc handler, a function for creating a single page, a function to initialize a page state, and a bunch of rpcs, and creates a pair of handler functions (one for POST and one for GET) such that individual clients first pull a page with an embedded ID, along with client-side rpc functions. Those functions in turn interact with state local to that invocation of a page when they make json-rpc requests to the server. The cull function is in IO so it has access to whatever notion of time it desires, including the opportunity to not run at all. Note that the POST page should be served from the same url as the get page, but with an additional "/jrpcs" directory guard.LConverts a json rpc to a javascript declaration of the appropriate function.       (c) Gershom Bazerman, 2012  BSD 3 Clause gershomb@gmail.com  experimental None !"2346<EM%ÿA Panel is the pair of an action to produce a PageSlice and an action to produce a list of locations with updated PageSlices. The former is used to draw the initial page, and the latter to modify it in response to events. Panels are also naturally Monoidal. ÕA PageSlice is a pair of Html and JavaScript. When a Panel is rendered, all JavaScript ends up joined together in the head of the page, and all HTML below it. PageSlices are naturally Monoidal, just as Html is. !?The PState Monad Transformer provides access o the PanelState. "EA PanelState contains environment information used to render Panels. )¹Sinks likewise are tagged as JS, Hask, or parametric. A sink of type JS can be written to purely on the client side, with no round trip. A sink of type Hask is a contravariant functor. ,ÿHA Signal can contain information drawn from client-side inputs. Signals are tagged as JS, Hask, or parametric. A signal of type JS can be read from purely on the client side, with no round trip. A signal of type Hask forms an applicative functor, so we can build server-side values with complex computed behaviours. Note that  Signal Hask5 actually bends the applicative functor laws in that fmap id on a signal that can be calculated directly in JS can send it to a signal that cannot be. This is a flaw, and it will be fixed. 0íConceptually, an Event is something that can trigger an update. We can join two events (which gives us "or" semantics), and we can trigger on an event. That's it. In reality, an event is composed of the panelpaths to it's sources. 29Unique label for any given panel in a control structure. 3EType tag for Sinks and Signals that require server-side interaction. 4CType tag for Sinks and Signals that can be run in pure JavaScript. 5ESince only some Signals are applicative functors, pureSig provides a pure operation over all Signals. 6BA JavaScript funcion can be contravariantly mapped over a Sink JS 7%We can zip sinks up to combine them. 84We can get a fresh identifier out of a panel state. 9ýAnd we can get an identifier out before descending into a "local" environment whose identifiers don't affect the main supply. Hence if a local environment alters its pattern of consumption, identifiers in the outer environment will remain stable. :-We can lift any Html into a Panel trivially. ;€Similarly, we can map over any Html inside a panel (although the behavior may be odd on panels with internal update semantics). <tGiven a function to join Html sections, we can fuse a list of panels into a single pannel by lifting that function. =|Given an arbitrary Signal, and a continuation accepting a value of the underlying type of the signal, yield a simple Panel. >YGiven a Signal JS, produce a JavaScript expression that samples the value of the signal. ?IGiven an Event, and a Panel, update the Panel each time the event fires. @Feed a value to a Sink. AÎGiven an event, a signal, and a sink, on each firing of the event, feed the sink the current sampled value of the signal. If the Signal and Sink are both in JS, this can happen entirely on the client side. BÿThis is a general purpose function for constructing Panels that provide signals and events, and optionally sinks. It takes a function from an identifier path to an intial value of a signal, optional sinks into the signal, and a panel "controlling" the signal. From this it yields a continuation function from the event and signal associated wih the panel, the optional sinks, and the signal "control" panel to a new panel to the new panel iself. Usage of this function is best understood by viewing the source of inputs built using it. CaTakes an initial value and a continuation taking an event and the button itself, yields a panel. D‡Takes an intial (label, value) pair, a list of pairs of labeled values, and a continuation, building a Panel with a dropdown selector. E¬Perform an action in the underlying monad and feed the result to a panel. Synchronous. Note that this action will occur on every update, even when guarded by an onEvent. FaExecute an IO action when triggered by an event. This action only occurs when the event fires. QbindEventIO e act = onEvent e $ Panel (return mempty) (lift act >> return mempty) GJa wrapper around select that immediately samples from the yielded signal. YselectInput defOpt opts k = select defOpt opts $ e sig p -> withSample sig $ i -> k e i p H†A basic text input box. This box provides a Sink as well as a Signal, so it's contents can be controlled from elsewhere in the Panel. ITA hidden input Panel that can be used as a mutable store, akin to an IORef or MVar. J3Put a bunch of panels into a single div element. inDiv = onHtml H.div . mconcat K"Put some text into a p element. $para = plainHTML . H.p . fromString LHAlign a list of panels into a table with rows of the specified width. ƒmkTable n xs = onHtml H.table . mconcat . map row $ chunksOf n xs where row ys = onHtml H.tr . mconcat $ map (onHtml H.td) ys M1JavaScript code for the reactive runtime system. NOGeneral function used to create backends for different servers and frameworks. O*Example panel that displays a calculator. K !"#$%&'()*+,-./01234P5QR67STUV89WXY:Z;[<=\>?@ABYgiven a path, construct a so-located panel with an intial value and possibly some Sinks. Pgiven a so-constructed panel, event, and signal, declare what panel to produce.  result panel CDEFGHIJKLMN,A function which serves stateless JsonRPCs. 4A function which renders Text to a server response. An optional url to find JQuery A page title. The panel to server nTwo page handlers -- one for handling updates (POSTs), and the second for rendering the initial page (GETs). O]^_`ab8 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO843201,/.-)+*"#$%&'(!89 576:;<BJKL=>?@AEFCDGHIMNO9 !"#$%&'()+*,/.-01234P5QR67STUV89WXY:Z;[<=\>?@ABCDEFGHIJKLMNO]^_`abc       !"##$%&'()*+,-./00123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abjmacro-rpc-0.3.2Network.JMacroRPC.BaseNetwork.JMacroRPC.Panels JStateAsyncJState ToJsonRPCCalltoJsonRPCCall_ ToJsonRPC toJsonRPC_JsonRPCJResultJRequestretErr toJsonRPC toJsonConvRPC toJsonRPCCall mkJsonRPCPair invokeRPCLibasIO handleRpcsmkConversationPageGen jsonRPCToDecl$fToJsonRPCCall(->)(->)$fToJsonRPCCallIO(->)$fToJsonRPC(->)m$fToJsonRPCIOIO UpdateListPaneldrawPupdateP PageSlicePShtmlPjsPPState PanelStateps_pathps_env ps_env_clean ps_events ps_listenerSinkPureSink ServerSinkSignalMultiSigOneSigPureSigEvent PanelPathHaskJSpureSig contramapJszipSinksnewIdent descended plainHTMLonHtmljoinWith withSample sampleSigJsonEventtellSink bindSigSink buildInputbuttonselectsampleIO bindEventIO selectInputtextPanenewVarinDivparamkTable panelPreludepanelToPageGen calcPanel printPathliftSinkrunSink extractIds readSignalsetEnvincrPath runPanelDrawrunPanelUpdateSlicerunPanelUpdateManyonHtmlPS joinWithPSsetDependenciesSig $fMonoidPanel$fMonoidPageSlice$fContravariantSink$fApplicativeSignal$fFunctorSignal $fMonoidEvent