app package:brick

The library application abstraction. Your application's operations are provided in an App and then the App is provided to one of the various main functions in this module. An application App s e n is in terms of an application state type s, an application event type e, and a resource name type n. In the simplest case e is unused (left polymorphic or set to ()), but you may define your own event type and use customMain to provide custom events. The state type s is the type of application state to be provided by you and iteratively modified by event handlers. The resource name type n is the type of names you can assign to rendering resources such as viewports and cursor locations. Your application must define this type.
Insert a set of attribute mappings to an attribute map.
The attribute map that should be used during rendering.
This function chooses which of the zero or more cursor locations reported by the rendering process should be selected as the one to use to place the cursor. If this returns Nothing, no cursor is placed. The rationale here is that many widgets may request a cursor placement but your application state is what you probably want to use to decide which one wins.
This function turns your application state into a list of widget layers. The layers are listed topmost first.
This function handles an event and updates the current application state.
This function gets called once just prior to the first drawing of your application. Here is where you can make initial scrolling requests, for example.
Apply customizations using a custom lookup function. Customizations are obtained for each attribute name in the theme. Any customizations already set are lost.
Apply an editing operation to the editor's contents. This is subject to the restrictions of the underlying text zipper; for example, if the underlying zipper has a line limit configured, any edits applied here will be ignored if they edit text outside the line limit.
The event was an application event.
Return a list of mappings including each key bound to any event combined with the list of events to which it is bound. This is useful for identifying problematic key binding collisions. Since key binding collisions cannot be determined in general, we leave it up to the application author to determine which key-to-event bindings are problematic.
A simple application with reasonable defaults to be overridden as desired:
  • Draws only the specified widget
  • Quits on any event other than resizes
  • Has no start event handler
  • Provides no attribute map
  • Never shows any cursors
Customizations for individual entries of the default mapping. Note that this will only affect entries in the default mapping; any attributes named here that are not present in the default mapping will not be considered.
The default attribute mapping to use.