Commit Graph

30 Commits

Author SHA1 Message Date
Jonathan Daugherty
6f1b62ae53 AttrName: remove IsString instance
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"
2022-08-04 18:44:57 -07:00
Jonathan Daugherty
4ea1f65d86 Update demo programs for changes to EventM 2022-07-16 23:10:03 -07:00
Jonathan Daugherty
bd89f787d2 Support GHC 8.4 (fixes #162)
This change splits up Monoid instances into Monoid and Semigroup. It
also conditionally imports Data.Monoid on GHCs prior to 8.4.
2018-03-17 09:03:59 -07:00
Jonathan Daugherty
fc8cfe3b4a Remove appLiftVtyEvent in favor of library event type BrickEvent
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.
2016-10-25 20:19:31 -07:00
Jonathan Daugherty
bd95299148 Resolve master merge conflicts 2016-05-19 20:29:12 -07:00
Alan Gilbert
e0f9195737 renaming Data.Vector to avoid ambiguity 2016-05-15 19:34:07 +03:00
Jonathan Daugherty
f3950cf96d API: migrate "lens" usage to "microlens" packages 2016-05-08 18:05:30 -07:00
Jonathan Daugherty
00eebed6f6 Add Named class, make List focus-aware, add experimental withFocusRing combinator 2016-03-04 15:50:10 -08:00
Jonathan Daugherty
3081e7367d Replace "Name" type with custom name type variable everywhere
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.
2016-03-04 14:42:49 -08:00
Jøhannes Lippmann
be47eb2a2b Changed ListDemo list type from List Int to List Char, small bugfix.
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)).
2015-10-22 11:26:51 +02:00
Jonathan Daugherty
1671c3732c List: pass the item height to the constructor instead of the draw function to make it available to event handlers 2015-08-19 21:46:55 -07:00
Jonathan Daugherty
0f84d19cdf API: handleEvent now runs in EventM 2015-08-19 19:52:34 -07:00
Jonathan Daugherty
736a81de97 API: move EventM and Next to Brick.Types 2015-08-19 19:48:55 -07:00
Jonathan Daugherty
35aa2ad8a4 Monster patch: move most data types to Brick.Types, remove IsString
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
2015-08-19 19:40:06 -07:00
Jonathan Daugherty
693abbb345 List: refactor rendering routine to only render the items in view (fixes #7)
- 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
2015-08-18 13:06:36 -07:00
Jonathan Daugherty
74aa344564 ListDemo: missing uses of Vector API 2015-08-18 09:39:58 -07:00
Jonathan Daugherty
14d2147c85 List: use Vector instead of [] to manage elements to improve performance 2015-08-17 23:33:47 -07:00
Jonathan Daugherty
d7bf9e1c97 List: instead of passing the draw function to the constructor, we pass it at rendering time 2015-08-17 22:19:08 -07:00
Jonathan Daugherty
e2b71a51be ListDemo: stale import 2015-07-11 16:53:06 -07:00
Jonathan Daugherty
962e7c83df Rename appMakeVtyEvent to appLiftVtyEvent 2015-07-10 13:53:21 -07:00
Jonathan Daugherty
75cab4340c ListDemo: use explicit imports 2015-07-10 13:25:44 -07:00
Jonathan Daugherty
201dfdc4a3 Rename Brick.Core to Brick.Types 2015-07-07 17:00:42 -07:00
Jonathan Daugherty
2ba4f822e6 List demo: make items smaller to avoid pointless performance meltdown 2015-07-03 14:23:35 -07:00
Jonathan Daugherty
afc0c95be8 Flip the arguments to application event handlers to make event pattern-matching more natural 2015-07-01 13:05:28 -07:00
Jonathan Daugherty
9601098d46 Add appStartEvent to support getting scroll requests on the first rendering of the app state before other events have arrived 2015-06-30 19:15:29 -07:00
Jonathan Daugherty
52bf9ec288 Clean up attribute management combinators, use attribute names instead of attributes 2015-06-28 22:08:54 -07:00
Jonathan Daugherty
0faa130f13 List demo improvements 2015-06-28 20:05:30 -07:00
Jonathan Daugherty
34e14bf1dd Simplify list demo application state 2015-06-28 13:22:05 -07:00
Jonathan Daugherty
549c4b8663 Improve list demo 2015-06-28 13:15:15 -07:00
Jonathan Daugherty
dc5b8f51e2 Add list demo 2015-06-28 13:06:22 -07:00