brick 0.6 → 0.6.1
raw patch · 5 files changed
+45/−30 lines, 5 filesdep ~microlensPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: microlens
API changes (from Hackage documentation)
- Brick.Widgets.Dialog: dialogButtonsL :: Lens (Dialog a_aR4K) (Dialog a_aR5f) [(String, a_aR4K)] [(String, a_aR5f)]
+ Brick.Widgets.Dialog: dialogButtonsL :: Lens (Dialog a_aR4M) (Dialog a_aR5h) [(String, a_aR4M)] [(String, a_aR5h)]
- Brick.Widgets.Dialog: dialogNameL :: Lens' (Dialog a_aR4K) Name
+ Brick.Widgets.Dialog: dialogNameL :: Lens' (Dialog a_aR4M) Name
- Brick.Widgets.Dialog: dialogSelectedIndexL :: Lens' (Dialog a_aR4K) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: Lens' (Dialog a_aR4M) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: Lens' (Dialog a_aR4K) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: Lens' (Dialog a_aR4M) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: Lens' (Dialog a_aR4K) Int
+ Brick.Widgets.Dialog: dialogWidthL :: Lens' (Dialog a_aR4M) Int
- Brick.Widgets.List: listElementsL :: Lens (List e_aXI5) (List e_aXOO) (Vector e_aXI5) (Vector e_aXOO)
+ Brick.Widgets.List: listElementsL :: Lens (List e_aXI8) (List e_aXOR) (Vector e_aXI8) (Vector e_aXOR)
- Brick.Widgets.List: listItemHeightL :: Lens' (List e_aXI5) Int
+ Brick.Widgets.List: listItemHeightL :: Lens' (List e_aXI8) Int
- Brick.Widgets.List: listNameL :: Lens' (List e_aXI5) Name
+ Brick.Widgets.List: listNameL :: Lens' (List e_aXI8) Name
- Brick.Widgets.List: listSelectedL :: Lens' (List e_aXI5) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: Lens' (List e_aXI8) (Maybe Int)
Files
- CHANGELOG.md +15/−0
- README.md +5/−5
- brick.cabal +8/−8
- docs/guide.rst +11/−11
- programs/ListDemo.hs +6/−6
CHANGELOG.md view
@@ -2,6 +2,21 @@ Brick changelog --------------- +0.6.1+-----++Package changes:+ * Added lower bound for microlens >= 0.3.0.0 to fix build failure due+ to Field1 not being defined (thanks Markus Hauck)++Documentation changes:+ * Updated user guide and README to link to and mention microlens+ instead of lens++Misc:+ * Fixed a qualified import in the List demo to avoid ambiguity (thanks+ Alan Gilbert)+ 0.6 ---
README.md view
@@ -45,11 +45,11 @@ * Attribute management is flexible and can be customized at runtime on a per-widget basis. -`brick` exports [lens](http://github.com/ekmett/lens) and non-`lens`-interfaces for most things, so you can get the full power of `lens` if-you want it or use plain Haskell if you don't. If a `brick` library-function named `thing` has a `lens` version, the `lens` version is named-`thingL`.+`brick` exports+[microlens](http://hackage.haskell.org/package/microlens) and non-lens+interfaces for most things, so you can get the power of lenses if+desired or use plain Haskell if you don't. If a `brick` library function+named `thing` has a lens version, the lens version is named `thingL`. Getting Started ---------------
brick.cabal view
@@ -1,5 +1,5 @@ name: brick-version: 0.6+version: 0.6.1 synopsis: A declarative terminal user interface library description: Write terminal applications painlessly with 'brick'! You write an@@ -81,7 +81,7 @@ transformers, data-default, containers,- microlens,+ microlens >= 0.3.0.0, microlens-th, vector, contravariant,@@ -102,7 +102,7 @@ vty >= 5.5.0, data-default, text,- microlens,+ microlens >= 0.3.0.0, microlens-th executable brick-viewport-scroll-demo@@ -145,7 +145,7 @@ vty >= 5.5.0, data-default, text,- microlens,+ microlens >= 0.3.0.0, microlens-th executable brick-suspend-resume-demo@@ -160,7 +160,7 @@ vty >= 5.5.0, data-default, text,- microlens,+ microlens >= 0.3.0.0, microlens-th executable brick-padding-demo@@ -217,7 +217,7 @@ vty >= 5.5.0, data-default, text,- microlens,+ microlens >= 0.3.0.0, vector executable brick-custom-event-demo@@ -232,7 +232,7 @@ vty >= 5.5.0, data-default, text,- microlens,+ microlens >= 0.3.0.0, microlens-th executable brick-hello-world-demo@@ -261,7 +261,7 @@ vty >= 5.5.0, data-default, text,- microlens,+ microlens >= 0.3.0.0, microlens-th executable brick-border-demo
docs/guide.rst view
@@ -69,15 +69,15 @@ documentation and as you explore the library source and write your own programs. -- Use of `lens`_: ``brick`` uses ``lens`` functions internally and also- exposes lenses for many types in the library. However, if you prefer- not to use the ``lens`` interface in your program, all ``lens``- interfaces have non-`lens` equivalents exported by the same module. In- general, the "``L``" suffix on something tells you it is a ``lens``;- the name without the "``L``" suffix is the non-`lens` version. You can- get by without using ``brick``'s ``lens`` interface but your life will- probably be much more pleasant once your application state becomes- sufficiently complex if you use lenses to modify it (see+- Use of `microlens`_ packages: ``brick`` uses ``microlens`` family of+ packages internally and also exposes lenses for many types in the+ library. However, if you prefer not to use the lens interface in your+ program, all lens interfaces have non-lens equivalents exported by+ the same module. In general, the "``L``" suffix on something tells+ you it is a lens; the name without the "``L``" suffix is the non-lens+ version. You can get by without using ``brick``'s lens interface but+ your life will probably be much more pleasant once your application+ state becomes sufficiently complex if you use lenses to modify it (see `appHandleEvent: Handling Events`_). - Attribute names: some modules export attribute names (see `How Attributes Work`_) associated with user interface elements. These tend@@ -806,7 +806,7 @@ , ctxAttrMap :: AttrMap } -and has `lens` fields exported as described in `Conventions`_.+and has lens fields exported as described in `Conventions`_. The job of the rendering function is to return a rendering result which, at a minimum, means producing a ``vty`` ``Image``. In addition, if you@@ -874,4 +874,4 @@ .. _vty: https://github.com/coreyoconnor/vty .. _Hackage: http://hackage.haskell.org/-.. _lens: http://hackage.haskell.org/package/lens+.. _microlens: http://hackage.haskell.org/package/microlens
programs/ListDemo.hs view
@@ -13,7 +13,7 @@ import qualified Brick.Widgets.List as L import qualified Brick.Widgets.Center as C import qualified Brick.AttrMap as A-import qualified Data.Vector as V+import qualified Data.Vector as Vec import Brick.Types ( Widget )@@ -34,7 +34,7 @@ cur = case l^.(L.listSelectedL) of Nothing -> str "-" Just i -> str (show (i + 1))- total = str $ show $ V.length $ l^.(L.listElementsL)+ total = str $ show $ Vec.length $ l^.(L.listElementsL) box = B.borderWithLabel label $ hLimit 25 $ vLimit 15 $@@ -50,7 +50,7 @@ case e of V.EvKey (V.KChar '+') [] -> let el = nextElement (L.listElements l)- pos = V.length $ l^.(L.listElementsL)+ pos = Vec.length $ l^.(L.listElementsL) in M.continue $ L.listInsert pos el l V.EvKey (V.KChar '-') [] ->@@ -62,8 +62,8 @@ ev -> M.continue =<< T.handleEvent ev l where- nextElement :: V.Vector Char -> Char- nextElement v = fromMaybe '?' $ V.find (flip V.notElem v) (V.fromList ['a' .. 'z'])+ nextElement :: Vec.Vector Char -> Char+ nextElement v = fromMaybe '?' $ Vec.find (flip Vec.notElem v) (Vec.fromList ['a' .. 'z']) listDrawElement :: (Show a) => Bool -> a -> Widget listDrawElement sel a =@@ -73,7 +73,7 @@ in C.hCenter $ str "Item " <+> (selStr $ show a) initialState :: L.List Char-initialState = L.list (T.Name "list") (V.fromList ['a','b','c']) 1+initialState = L.list (T.Name "list") (Vec.fromList ['a','b','c']) 1 customAttr :: A.AttrName customAttr = L.listSelectedAttr <> "custom"