N      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLM(c) Daniel Winograd-Cort 2014 )see the LICENSE file in the distribution dwc@cs.yale.edu  experimental  Safe-InferredEM,G\The BufferOperation data type wraps up the data and operational commands to control an  eventbuffer. HSet the buffer's tempo I7Set a new play status (True = Playing, False = Paused) J%Append data to the end of the buffer KMerge data into the buffer L2Skip ahead a certain amount of time in the buffer MErase the buffer NNo Buffer Operation OTempo is just a Double. PUInstances of the ArrowIO class have an arrowized ability to perform IO actions. Q7The liftAIO function lifts an IO action into an arrow. RThe initialAIO function performs an IO action once upon the initialization of the arrow and then uses the result of that action to generate the arrow itself. SInstances of this class have arrowized access to time. This is convenient in many cases where time is necessary but we would prefer not to make it an explicit argument. U8DeltaT is a type synonym referring to a change in Time. V(Time is simply represented as a Double. WDSEvent is short for "Stream Event" and is a type synonym for Maybe. X)constA is an arrowized version of const. Y#constSF is a convenience composing X with the given SF. Zedge generates an event whenever the Boolean input signal changes from False to True -- in signal processing this is called an ``edge detector,'' and thus the name chosen here. [The signal function (accum v) starts with the value v, but then applies the function attached to the first event to that value to get the next value, and so on. \ZThe signal function unique will produce an event each time its input signal changes. ]hold is a signal function whose output starts as the value of the static argument. This value is held until the first input event happens, at which point it changes to the value attached to that event, which it then holds until the next event, and so on. ^Now is a signal function that produces one event and then forever after produces nothing. It is essentially an impulse function. _=mergeE merges two events with the given resolution function. `#This is an infix specialization of _ to lists. NReturns n samples of type b from the input stream at a time, updating after k samples. This function is good for chunking data and is a critical component to fftA aqCombines the input list of arrows into one arrow that takes a list of inputs and returns a list of outputs. bThis essentially allows an arrow that processes b to c to take [b] and recursively generate cs, combining them all into a final output d. c+This is a special case of foldA for lists. d3For folding results of a list of signal functions. eThis behaves much like the maybe function except lifted to the ArrowChoice level. The arrow behaves like its first argument when the input stream is Nothing and like its second when it is a Just value. fwThis lifts the arrow to an event-based arrow that behaves as a constant stream of Nothing when there is no event. gfdelay is a delay function that delays for a fixed amount of time, given as the static argument. It returns a signal function that takes the current time and an event stream and delays the event stream by the delay amount. fdelay guarantees that the order of events in is the same as the order of events out and that no event will be skipped. However, if events are too densely packed in the signal (compared to the clock rate of the underlying arrow), then some events may be over delayed. hvdelay is a delay function that delays for a variable amount of time. It takes the current time, an amount of time to delay, and an event stream and delays the event stream by the delay amount. vdelay, like fdelay, guarantees that the order of events in is the same as the order of events out and that no event will be skipped. If the events are too dense or the delay argument drops too quickly, some events may be over delayed. iTfcdelay is a continuous version of fdelay. It takes an initial value to emit for the first dt seconds. After that, the delay will always be accurate, but some data may be ommitted entirely. As such, it is not advisable to use fcdelay for event streams where every event must be processed (that's what fdelay is for). jyvcdelay is a continuous version of vdelay. It will always emit the value that was produced dt seconds earlier (erring on the side of an older value if necessary). Be warned that this version of delay can both omit some data entirely and emit the same data multiple times. As such, it is usually inappropriate for events (use vdelay). vcdelay takes a maxDTl argument that stands for the maximum delay time that it can handle. This is to prevent a space leak. Implementation note: Rather than keep a single buffer, we keep two sequences that act to produce a sort of lens for a buffer. qlow has all the values that are older than what we currently need, and qhigh has all of the newer ones. Obviously, as time moves forward and the delay amount variably changes, values are moved back and forth between these two sequences as necessary. This should provide a slight performance boost. ktimer is a variable duration timer. This timer takes the current time as well as the (variable) time between events and returns an SEvent steam. When the second argument is non-positive, the output will be a steady stream of events. As long as the clock speed is fast enough compared to the timer frequency, this should give accurate and predictable output and stay synchronized with any other timer and with time itself. lgenEvents is a timer that instead of returning unit events returns the next element of the input list. When the input list is empty, the output stream becomes all Nothing. meventBuffer allows for a timed series of events to be prepared and emitted. The streaming input is a BufferOperation, described above. Note that the default play status is playing and the default tempo is 1. Just as MIDI files have events timed based on ticks since the last event, the events here are timed based on seconds since the last event. If an event is to occur 0.0 seconds after the last event, then it is assumed to be played at the same time as the last event, and all simultaneous events are emitted at the same timestep. In addition to any events emitted, a streaming Bool is emitted that is True if the buffer is empty and False if the buffer is full (meaning that events will still come). nVeventBuffer' is a version that takes Time explicitly rather than with ArrowTime. oThe asyncV functions is for "Virtual time" asynchrony. The embedded signal function is given along with an expected clockrate, and the output conforms to that clockrate as well as it can. The clockrate is the simulated rate of the input signal function. The buffer is the amount of time the given signal function is allowed to get ahead of real time. The threadHandler is where the ThreadId of the forked thread is sent. The output signal function takes and returns values in real time. The input must be paired with time, and the return values are the list of bs generated in the given time step, each time stamped. Note that the returned list may be long if the clockrate is much faster than real time and potentially empty if it's slower. Note also that the caller can check the time stamp on the element at the end of the list to see if the inner, "simulated" signal function is performing as fast as it should. pThe asyncE (E for "Event") function takes a signal function (an Automaton) and converts it into an asynchronous event-based signal function usable in a ArrowIO signal function context. The output arrow takes events of type a, feeds them to the asynchronously running input signal function, and returns events with the output b whenever they are ready. The input signal function is expected to run slowly compared to the output one, but it is capable of running just as fast. qThe asyncC (C for "Continuous time") function allows a continuous signal function to run as fast as it can asynchronously. There are no guarantees that all input data make it to the asynchronous signal function; if this is required, asyncE should be used instead. Rather, the embedded signal function runs as fast as it can on whatever value it has most recently seen. Its results are bundled together in a list to be returned to the main signal function. reThis is a version of asyncC that does IO actions on either end of the embedded signal function. 2GHIJKLMNOPQRSTUVWXYZ[\]^_`NabcdefghijklmnOPQRSo Clockrate Amount of time to buffer The thread handler %The automaton to convert to realtime pThe thread handler )The automaton to convert to asynchronize qThe thread handler %The automaton to convert to realtime rThe thread handler 6Effectful input and output channels for the automaton )The automaton to convert to asynchronize /DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr/WVUSTPQRXYZ[\]^_`acbdefFhgjiklOGNMLKJIHmnEDopqr(GNMLKJIHOPQRSTUVWXYZ[\]^_`NabcdefghijklmnOPQRSopqrNone(Graphic is just a wrapper for OpenGL IO T"boolean to remember if it's dirty U[if window is marked as dirty, mark it clean, draw and swap buffer; otherwise do nothing. `setGraphic set the given Graphic over empty (black) background for display in current Window. LgetWindowEvent and maybeGetWindowEvent both take an additional argument sleepTime that tells how long to sleep in the case where there are no window events to return. This is used to allow the cpu to take other tasks at these times rather than needlessly spinning. The sleepTime parameter used to be fixed at 0.01. VWhen a window is resized, all of the resize events queue up until the mouse button is released. This causes some delay as each individual resize event is handled and then the window is redrawn. This function clears all resize and refresh events until the last resize one. Note that because this function is used, a Refresh event should follow the resizing. !use GLFW's high resolution timer 5Designed to be used with Key, CharKey, or SpecialKey astuvwxyz{|}~WXYTZ[\]^_`abUcdefVghijkl  !"#$%&'()*+,-./0123456789:;<=>?@ABCstuvwxyz{|}~C  !"#$%&'()*+,-./0123456789:;<=>?@ABs~|yxwvut}z{zFs~|yxwvut}z{zWXYTZ[\]^_`abUcdefVghijkl(c) Daniel Winograd-Cort 2014 )see the LICENSE file in the distribution dwc@cs.yale.edu  experimental NoneCFThe dirty bit is a bit to indicate if the widget needs to be redrawn. *The FocusInfo means one of the following: rIndicates that the widget whose id is given should take focus. That widget should then pass NoFocus onward. RIndicates that there is no focus information to communicate between widgets. Indicates that this widget is a subwidget of a widget that is in focus. Thus, this widget too is in focus, and this widget should pass HasFocus forward. The WidgetID for any given widget is dynamic based on how many focusable widgets are active at the moment. It is designed basically as a counter that focusable widgets will automatically (via the focusable function) increment. The Focus type helps focusable widgets communicate with each other about which widget is in focus. It consists of a WidgetID and a FocusInfo. dMore complicated layouts can be manually constructed with direct access to the Layout data type. hFill and vFill specify how much stretching space (in comparative units) in the horizontal and vertical directions should be allocated for this widget. hFixed and vFixed specify how much non-stretching space (in pixels) of width and height should be allocated for this widget. qminW and minH specify minimum values (in pixels) of width and height for the widget's stretchy dimensions. A dimension can either be: %Fixed with a size measured in pixels 'Stretchy with a minimum size in pixels 0A rectangle has a corner point and a dimension. A dimension specifies size. !Flow determines widget ordering. -A rendering context specifies the following: %A layout direction to flow widgets. A rectangle bound of current drawing area to render a UI component. It specifies the max size of a widget, not the actual size. It's up to each individual widget to decide where in this bound to put itself. 0A flag to tell whether we are in a conjoined state or not. A conjoined context will duplicate itself for subcomponents rather than splitting. This can be useful for making compound widgets when one widget takes up space and the other performs some side effect having to do with that space. ;The termination procedure is simply a potential IO action. -The null termination procedure is no action. 1A method for merging two termination procedures. Layouts for individual widgets typically come in a few standard flavors, so we have this convenience function for their creation. This function takes layout information for first the horizontal dimension and then the vertical. `The null layout is useful for "widgets" that do not appear or take up space on the screen. -Divides the CTX among the two given layouts. Merge two layouts into one. Merging two graphics can be achieved with overGraphic, but the mergeGraphic function additionally constrains the graphics based on their layouts and the context. TODO: Make sure this works as well as it should (Horizontal Layout information Vertical Layout information (((c) Daniel Winograd-Cort 2014(see the LICENSE file in the distributiondwc@cs.yale.edu experimentalNone24CMThe UIParams data type provides an interface for modifying some of the settings for runUI without forcing runUI to take a zillion arguments. Typical usage will be to modify the below defaultUIParams using record syntax.An initialization action.A termination action.The UI window's title.The size of the UI window.The initial Flow setting.How long the UI will sleep between clock ticks if no events are detected. This should be probably be set to O(milliseconds), but it can be set to 0 for better performance (but also higher CPU usage)Lift an IO source to UISF.Lift an IO sink to UISF.Lift an IO pipe to UISF.)Lift an IO source to an event-based UISF.'Lift an IO sink to an event-based UISF.'Lift an IO pipe to an event-based UISF. Get the time signal from a UISF.#Get the context signal from a UISF.#Get the UIEvent signal from a UISF.Get the focus data from a UISF.&Add a termination procedure to a UISF.#Get the mouse position from a UISF.7This function creates a UISF with the given parameters.]This is the standard one that appropriately keeps track of simulated time vs real time. The clockrate is the simulated rate of the input signal function. The buffer is the number of time steps the given signal function is allowed to get ahead of real time. The real amount of time that it can get ahead is the buffer divided by the clockrate seconds. The output signal function takes and returns values in real time. The return values are the list of bs generated in the given time step, each time stamped.1Note that the returned list may be long if the clockrate is much faster than real time and potentially empty if it's slower. Note also that the caller can check the time stamp on the element at the end of the list to see if the inner, "simulated" signal function is performing as fast as it should.<We can also lift a signal function to a UISF asynchronously.!Set a new layout for this widget.\A convenience function for setLayout, setSize sets the layout to a fixed size (in pixels)."Add space padding around a widget.>This is the default UIParams value and what is used in runUI'.'Run the UISF with the default settings. 'Run the UISF with the given parameters.5mnopq rstuvwxyz' ' +mnopq rstuvwxyz(c) Daniel Winograd-Cort 2014 )see the LICENSE file in the distribution dwc@cs.yale.edu  experimental NoneCE 8Labels are always left aligned and vertically centered. [DisplayStr is an output widget showing the instantaneous value of a signal of strings. Ddisplay is a widget that takes any show-able value and displays it. pwithDisplay is a widget modifier that modifies the given widget so that it also displays its output value. OTextbox is a widget showing the instantaneous value of a signal of strings. ]The textbox widget will often be used with ArrowLoop (the rec keyword). However, it uses F8 internally, so there should be no fear of a blackhole. The textbox widget supports mouse clicks and typing as well as the left, right, end, home, delete, and backspace special keys. This variant of the textbox takes a static argument that is the initial value in the textbox. Then, it takes a stream of 'SEvent String' and only externally updates the contents of the textbox when an event occurs. @Title frames a UI by borders, and displays a static title text. A button is a focusable input widget with a state of being on or off. It can be activated with either a button press or the enter key. (Currently, there is no support for the space key due to non-special keys not having Release events.) Buttons also show a static label. gThe regular button is down as long as the mouse button or key press is down and then returns to up. The sticky button, on the other hand, once pressed, remains depressed until is is clicked again to be released. Thus, it looks like a button, but it behaves more like a checkbox. lCheckbox allows selection or deselection of an item. It has a static label as well as an initial state. )The checkGroup widget creates a group of es that all send their outputs to the same output stream. It takes a static list of labels for the check boxes and assumes they all start unchecked. yThe output stream is a list of each a value that was paired with a String value for which the check box is checked. $Radio button presents a list of choices and only one of them can be selected at a time. It takes a static list of choices (as Strings) and the index of the initially selected one, and the widget itself returns the continuous stream representing the index of the selected choice. CThe listbox widget creates a box with selectable entries. The input stream is the list of entries as well as which entry is currently selected, and the output stream is the index of the newly selected entry. Note that the index can be greater than the length of the list (simply indicating no choice selected). Horizontal Continuous Slider Vertical Continuous Slider Horizontal Discrete Slider Vertical Discrete Slider !kThe realtimeGraph widget creates a graph of the data with trailing values. It takes a dimension parameter, the length of the history of the graph measured in time, and a color for the graphed line. The signal function then takes an input stream of (value,time) event pairs, but since there can be zero or more points at once, we use [] rather than WX for the type. The values in the (value,time) event pairs should be between -1 and 1. "The histogram widget creates a histogram of the input map. It assumes that the elements are to be displayed linearly and evenly spaced. #MThe histogramWithScale widget creates a histogram and an x coordinate scale. $mkWidget is a helper function to make stateful widgets easier to write. In essence, it breaks down the idea of a widget into 4 constituent components: state, layout, computation, and drawing. As $Y allows for making stateful widgets, the first parameter is simply the initial state. The layout is the static layout that this widget will use. It cannot be dependent on any streaming arguments, but a layout can have "stretchy" sides so that it can expand/shrink to fit an area. Learn more about making layouts in UIType6s UI Layout section -- specifically, check out the  function and the  data type. The computation is where the logic of the widget is held. This function takes as input the streaming argument a, the widget's state, a Rect of coordinates indicating the area that has been allotted for this widget, and the sG that is triggering this widget's activation (see the definition of s in SOE). The output consists of the streaming output, the new state, and the dirty bit, which represents whether the widget needs to be redrawn. BLastly, the drawing routine takes the same Rect as the computation, a Bool that is true when this widget is in focus and false otherwise, and the current state of the widget (technically, this state is the one freshly returned from the computation). Its output is the Graphic that this widget should display. %OOccasionally, one may want to display a non-interactive graphic in the UI. %m facilitates this. It takes a layout and a simple drawing routine and produces a non-interacting widget. &-The toggle is useful in the creation of both es and  buttons. It displays on/off according to its input, and when the mouse is clicked on it, it will output True (otherwise it outputs False). uThe UISF returned from a call to toggle accepts the state stream and returns whether the toggle is being clicked. 'FThe mkSlider widget builder is useful in the creation of all sliders. (Canvas displays any graphics. The input is a signal of graphics events because we only want to redraw the screen when the input is there. )Ycanvas' uses a layout and a graphic generator. This allows it to behave similarly to (4, but it can adjust in cases with stretchy layouts. *kcyclebox is a clickable widget that cycles through a predefined set set of appearances/output values. +wcyclebox' is a cyclebox that additionally accepts input events that can set it to a particular appearance/output. ,Making a widget focusable makes it accessible to tabbing and allows it to see any mouse button clicks and keystrokes when it is actually in focus. - Although mouse button clicks and keystrokes will be available once a widget marks itself as focusable, the widget may also simply want to know whether it is currently in focus to change its appearance. This can be achieved with the following signal function. 1     !"#$initial state layout  computation drawing routine %layout drawing routine &Initial state value The layout for the toggle The drawing routine '(True for horizontal, False for vertical 0A function for converting a value to a position 0A function for converting a position to a value `A function for determining how much to jump when a click is on the slider but not the target !The initial value for the slider ()*+,-./0123456789:1     !"#$%&'()*+,-./0123456789:1     !"#$%&'()*+,-.3210/456798:1     !"#$%&'()*+,-./0123456789:None{|}~DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr  !"#()<  !"#()None;EThis example displays the time from the start of the GUI application.<This example shows off \s and state by presenting a plus and minus button with a counter that is adjusted by them.=This example shows off the  widgets.>This example shows off the  button widget.?4This example shows off integral sliders (horizontal s in this case).@<This example shows off both vertical sliders as well as the ( widget. The canvas widget can be used to easily create custom graphics in the GUI. Here, it is used to make a color swatch that is controllable with RGB values by the sliders.AThis example shows off the F widget. Text can be typed in, and that text is transferred to the + widget below when the button is pressed.B*This is the main demo that incorporates all of the other examples together. In addition to demonstrating how different widgets can connect, it also shows off the tabbing behavior built in to the GUI. Pressing tab cycles through focuable elements, and pressing shift-tab cycles in reverse.;<=>?@AB;<=>?@AB;<=>?@AB;<=>?@ABNoneCI<This function will run the crud GUI with the default names. J main = crud KThis is the main function that creates the crud GUI. It takes an initial database of names as an argument. See notes below on the use of banana brackets and nested do blocks. CDEFGHIJKLM CDEFGHIJK GCDEFMLHIJKCDEFGHIJKLM                     ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O PQRPQRPSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLLMNOPQKRSTUVWXYZ[\]^_`abcdefghijklmn>opqrstuvwxyz{|} ~ ~ ~ ~ ~ ~ ~ ~  ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~  UISF-0.3.0.1 FRP.UISF.SOEFRP.UISF.AuxFunctionsFRP.UISF.UITypes FRP.UISF.UISFFRP.UISF.WidgetFRP.UISF.Examples.ExamplesFRP.UISF.Examples.CrudFRP.UISFbaseGHC.WordWord32 GLFW-0.5.2.2Graphics.UI.GLFWCharKey SpecialKeyKeyUNKNOWNESCF1F2F3F4F5F6F7F8F9F10F11F12F13F14F15F16F17F18F19F20F21F22F23F24F25UPDOWNLEFTRIGHTLSHIFTRSHIFTLCTRLRCTRLLALTRALTTABENTER BACKSPACEINSERTDELPAGEUPPAGEDOWNHOMEENDKP_0KP_1KP_2KP_3KP_4KP_5KP_6KP_7KP_8KP_9 KP_DIVIDE KP_MULTIPLY KP_SUBTRACTKP_ADD KP_DECIMALKP_EQUALKP_ENTERarrows-0.4.4.1#Control.Arrow.Transformer.Automaton AutomatonControl.Arrow.OperationsdelayBufferOperationSetBufferTempoSetBufferPlayStatusAppendToBuffer MergeInBufferSkipAheadInBuffer ClearBufferNoBOpTempoArrowIOliftAIO initialAIO ArrowTimetimeDeltaTTimeSEventconstAconstSFedgeaccumuniqueholdnowmergeE~++concatAfoldA runDynamicfoldSFmaybeAevMapfdelayvdelayfcdelayvcdelaytimer genEvents eventBuffer eventBuffer'asyncVasyncEasyncCasyncC'UIEvent NoUIEventClosedRefreshResize MouseMoveButtonptisLeftSKeyskeychar modifiersisDownPointRGBARGBAngleColorWhiteYellowMagentaRedCyanGreenBlueBlack RedrawModeGraphicWindowSizeTitle runGraphics openWindow openWindowExgetMainWindowSize clearWindow drawInWindowdrawInWindowNow setGraphic setGraphic'setDirty closeWindow drawGraphicdrawBufferedGraphic nullGraphic emptyGraphictranslateGraphic overGraphic overGraphics withColor withColor'rgbrgbatextellipse shearEllipselinepolygonpolyline polyBezierarcscissorGraphichasShiftModifierhasCtrlModifierhasAltModifiergetWindowEventmaybeGetWindowEvent timeGetTime word32ToInt isKeyPressedDirtyBit FocusInfo SetFocusToNoFocusHasFocusWidgetIDFocusLayouthFillvFillhFixedvFixedminWminH LayoutTypeFixed fixedSizeStretchyminSizeRect DimensionFlow RightLeft LeftRightBottomUpTopDownCTXflowbounds isConjoinedTerminationProcnullTPmergeTP makeLayout nullLayout divideCTX mergeLayout mergeGraphicsUIParams uiInitializeuiCloseuiTitleuiSize uiInitFlow uiTickDelayUISF uisfLayoutuisfFun uisfSourceuisfSinkuisfPipe uisfSourceE uisfSinkE uisfPipeEgetTimegetCTX getEvents getFocusDataaddTerminationProcgetMousePositionmkUISF asyncUISFV asyncUISFEtopDownbottomUp leftRight rightLeftconjoin unconjoin setLayoutsetSizepaddefaultUIParamsrunUI'runUIpadding//whenGlabel displayStrdisplay withDisplaytextboxtextboxEtitlebutton stickyButton genButtoncheckbox checkGroupradiolistboxhSlidervSliderhiSliderviSliderslideriSlider realtimeGraph histogramhistogramWithScalemkWidget mkBasicWidgettogglemkSlidercanvascanvas'cyclebox cyclebox' focusable isInFocusbggray0gray1gray2gray3blue3boxcircleblockpushedpoppedmarkedinsidetimeExbuttonEx checkboxEx radioButtonEx shoppinglist colorDemo textboxdemomain NameEntry firstNamelastNameDatabase defaultnamescrudcrudUISF $fEqNameEntry$fShowNameEntryquantize=>>->>.|.snapshot snapshot_ graphicVarupdateWindowIfDirtygetLastResizeEvent eventsChankeyStateaddCharToKeyStateaddSKeyToKeyStateremoveCharFromKeyStateremoveSKeyFromKeyState initializedopened initialize closeWindow_ colorToRGBc2fbeziervertex3normaliseBounds fromPointfromSizesegment modifyFlow modifyCTX defaultCTX defaultFocus resetFocus windowUser makeStream$fArrowTimeUISF $fArrowIOUISF$fArrowCircuitUISF$fArrowChoiceUISF$fArrowLoopUISF $fArrowUISF$fCategory*UISF Control.Arrowarrfirstapp|||loop***Kleisli ArrowChoiceControl.Category>>>leftApp^<<<<^>>^^>>returnA&&&secondArrow runKleisli zeroArrow ArrowZero<+> ArrowPlus+++rightleft ArrowApply ArrowMonad ArrowLoop<<<