This change is motivated by the API wart that results from the
overloading of both "<>" and string literals that resulted in code like
this:
a :: AttrName
a = "blah" <> "things"
While this worked to create an AttrName with two segments, it is far too
easy to read this as two strings concatenated. The overloading hides
what is really going on with the segments of the attribute name. The way
to write the above example after this change is:
a :: AttrName
a = attrName "blah" <> attrName "things"
This change makes it possible for brick to extent the event space using
its own event notions in addition those provided by Vty and the
application itself. This means we no longer need the user to provide the
type and appLiftVtyEvent went away. This makes pattern-matching in event
handlers a little noisier with the benefit that we can now add events
like mouse clicks or drags to the event type.
This experimental change makes it possible to:
* Avoid runtime errors due to name typos
* Achieve compile-time guarantees about name matching and usage
* Force widget functions to be name-agnostic by being polymorphic
in their name type
* Clean up focus handling by making it possible to pattern-match
on cursor location names
The change also made many types more heavyweight and in some cases
this is unpleasant when we don't want to have to care about names.
But in those cases we can just use 'n' or '()' depending on how
concrete we need to be. I'm not yet sure how this is going to play
out in practice.
This might improve the understanding of what is a list item and what
is a position. Also in when running the demo it was possible to create
identical items by removing an element form the middle and adding a
new one (wich got the number (length of list), not (smallest unused
element in list)).
instance for Widget
- This makes the module layout more predictable since Brick.Widgets.Core
now (mostly) only contains widgets and widget transformations
- Utility functions closely related to types are now in Brick.Types
- Brick.Types.Internal contains types used internal by the renderer,
some are re-exported by Brick.Types
- Changes renderList to expect an item height and all rendered items
must match this height
- Uses vector slicing to efficiently get the sub-list of items to be
rendered
- Renders 2 * H items at time instead of all N, where H is the height of
the list's viewport