Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-brick for openSUSE:Factory checked in at 2021-04-24 23:08:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-brick (Old) and /work/SRC/openSUSE:Factory/.ghc-brick.new.12324 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-brick" Sat Apr 24 23:08:56 2021 rev:13 rq:888029 version:0.61 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-brick/ghc-brick.changes 2021-04-10 15:28:19.782445676 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-brick.new.12324/ghc-brick.changes 2021-04-24 23:10:06.819476302 +0200 @@ -1,0 +2,12 @@ +Fri Apr 9 08:54:26 UTC 2021 - psim...@suse.com + +- Update brick to version 0.61. + 0.61 + ---- + + API changes: + * Brick.Forms got `editShowableFieldWithValidate`, a generalization + of `editShowableField` that allows the caller to specify an + additional validation function (thanks Ben Selfridge) + +------------------------------------------------------------------- Old: ---- brick-0.60.2.tar.gz brick.cabal New: ---- brick-0.61.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-brick.spec ++++++ --- /var/tmp/diff_new_pack.xVBNik/_old 2021-04-24 23:10:07.279476953 +0200 +++ /var/tmp/diff_new_pack.xVBNik/_new 2021-04-24 23:10:07.283476958 +0200 @@ -19,13 +19,12 @@ %global pkg_name brick %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.60.2 +Version: 0.61 Release: 0 Summary: A declarative terminal user interface library License: BSD-3-Clause URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-bytestring-devel BuildRequires: ghc-config-ini-devel @@ -85,7 +84,6 @@ %prep %autosetup -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ brick-0.60.2.tar.gz -> brick-0.61.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brick-0.60.2/CHANGELOG.md new/brick-0.61/CHANGELOG.md --- old/brick-0.60.2/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 +++ new/brick-0.61/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 @@ -2,6 +2,14 @@ Brick changelog --------------- +0.61 +---- + +API changes: + * Brick.Forms got `editShowableFieldWithValidate`, a generalization + of `editShowableField` that allows the caller to specify an + additional validation function (thanks Ben Selfridge) + 0.60.2 ------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brick-0.60.2/README.md new/brick-0.61/README.md --- old/brick-0.60.2/README.md 2001-09-09 03:46:40.000000000 +0200 +++ new/brick-0.61/README.md 2001-09-09 03:46:40.000000000 +0200 @@ -71,6 +71,7 @@ | [`ghcup`](https://www.haskell.org/ghcup/) | A TUI for `ghcup`, the Haskell toolchain manager | | [`cbookview`](https://github.com/mlang/chessIO) | A TUI for exploring polyglot chess opening book files | | [`thock`](https://github.com/rmehri01/thock) | A modern TUI typing game featuring online racing against friends | +| [`fifteen`](https://github.com/benjaminselfridge/fifteen) | An implementation of the [15 puzzle](https://en.wikipedia.org/wiki/15_puzzle) | These third-party packages also extend `brick`: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brick-0.60.2/brick.cabal new/brick-0.61/brick.cabal --- old/brick-0.60.2/brick.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/brick-0.61/brick.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ name: brick -version: 0.60.2 +version: 0.61 synopsis: A declarative terminal user interface library description: Write terminal user interfaces (TUIs) painlessly with 'brick'! You @@ -114,7 +114,7 @@ Brick.Types.Internal Brick.Widgets.Internal - build-depends: base <= 4.15, + build-depends: base < 4.16.0.0, vty >= 5.31, transformers, data-clist >= 0.1, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brick-0.60.2/docs/guide.rst new/brick-0.61/docs/guide.rst --- old/brick-0.60.2/docs/guide.rst 2001-09-09 03:46:40.000000000 +0200 +++ new/brick-0.61/docs/guide.rst 2001-09-09 03:46:40.000000000 +0200 @@ -1355,6 +1355,11 @@ later validate that state and convert it back into the approprate type for storage in ``UserInfo``. +The form value itself -- of type ``Form`` -- must be stored in your +application state. You should only ever call ``newForm`` when you need +to initialize a totally new form. Once initialized, the form needs to be +kept around and updated by event handlers in order to work. + For example, if the initial ``UserInfo`` value's ``_age`` field has the value ``0``, the ``editShowableField`` will call ``show`` on ``0``, convert that to ``Text``, and initialize the editor for ``_age`` with diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brick-0.60.2/programs/MouseDemo.hs new/brick-0.61/programs/MouseDemo.hs --- old/brick-0.60.2/programs/MouseDemo.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/brick-0.61/programs/MouseDemo.hs 2001-09-09 03:46:40.000000000 +0200 @@ -95,8 +95,8 @@ let T.Location pos = loc M.continue $ st & lastReportedClick .~ Just (n, loc) & edit %~ E.applyEdit (if n == TextBox then moveCursor (swap pos) else id) -appEvent st (T.MouseUp _ _ _) = M.continue $ st & lastReportedClick .~ Nothing -appEvent st (T.VtyEvent (V.EvMouseUp _ _ _)) = M.continue $ st & lastReportedClick .~ Nothing +appEvent st (T.MouseUp {}) = M.continue $ st & lastReportedClick .~ Nothing +appEvent st (T.VtyEvent (V.EvMouseUp {})) = M.continue $ st & lastReportedClick .~ Nothing appEvent st (T.VtyEvent (V.EvKey V.KUp [V.MCtrl])) = M.vScrollBy (M.viewportScroll Prose) (-1) >> M.continue st appEvent st (T.VtyEvent (V.EvKey V.KDown [V.MCtrl])) = M.vScrollBy (M.viewportScroll Prose) 1 >> M.continue st appEvent st (T.VtyEvent (V.EvKey V.KEsc [])) = M.halt st diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brick-0.60.2/src/Brick/BorderMap.hs new/brick-0.61/src/Brick/BorderMap.hs --- old/brick-0.60.2/src/Brick/BorderMap.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/brick-0.61/src/Brick/BorderMap.hs 2001-09-09 03:46:40.000000000 +0200 @@ -165,8 +165,8 @@ } where bounds' = neighbors coordinates' - values' = pure gc - <*> _coordinates m + values' = gc + <$> _coordinates m <*> coordinates' <*> bounds' <*> _values m diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brick-0.60.2/src/Brick/Forms.hs new/brick-0.61/src/Brick/Forms.hs --- old/brick-0.60.2/src/Brick/Forms.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/brick-0.61/src/Brick/Forms.hs 2001-09-09 03:46:40.000000000 +0200 @@ -3,9 +3,9 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} --- | NOTE: This API is experimental and will probably change. Please try --- it out! Feedback is very much appreciated, and your patience in the --- face of breaking API changes is also appreciated! It's also worth +-- | Note - This API is experimental and will probably change. Please +-- try it out! Feedback is very much appreciated, and your patience in +-- the face of breaking API changes is also appreciated! It's also worth -- bearing in mind that this API is designed to support a narrow range -- of use cases. If you find that you need more customization than this -- offers, then you will need to consider building your own layout and @@ -32,6 +32,10 @@ -- 'FormField's combined for a single 'FormFieldState' (e.g. a radio -- button sequence). -- +-- To use a 'Form', you must include it within your application state +-- type. You can use 'formState' to access the underlying s whenever you +-- need it. See @programs/FormDemo.hs@ for a complete working example. +-- -- Also note that, by default, forms and their field inputs are -- concatenated together in a 'vBox'. This can be customized on a -- per-field basis and for the entire form by using the functions @@ -65,6 +69,7 @@ -- * Simple form field constructors , editTextField , editShowableField + , editShowableFieldWithValidate , editPasswordField , radioField , checkboxField @@ -83,6 +88,7 @@ where import Graphics.Vty hiding (showCursor) +import Control.Monad ((<=<)) #if !(MIN_VERSION_base(4,11,0)) import Data.Monoid #endif @@ -188,7 +194,8 @@ } -> FormFieldState s e n -- | A form: a sequence of input fields that manipulate the fields of an --- underlying state that you choose. +-- underlying state that you choose. This value must be stored in the +-- Brick application's state. -- -- Type variables are as follows: -- @@ -560,6 +567,38 @@ limit = Just 1 renderText = txt . T.unlines in editField stLens n limit ini val renderText id + +-- | A form field using a single-line editor to edit the 'Show' representation +-- of a state field value of type @a@. This automatically uses its 'Read' +-- instance to validate the input, and also accepts an additional user-defined +-- pass for validation. This field is mostly useful in cases where the +-- user-facing representation of a value matches the 'Show' representation +-- exactly, such as with 'Int', but you don't want to accept just /any/ 'Int'. +-- +-- This field responds to all events handled by 'editor', including +-- mouse events. +editShowableFieldWithValidate :: (Ord n, Show n, Read a, Show a) + => Lens' s a + -- ^ The state lens for this value. + -> n + -- ^ The resource name for the input field. + -> (a -> Bool) + -- ^ Additional validation step for input. + -- 'True' indicates that the value is + -- valid. + -> s + -- ^ The initial form state. + -> FormFieldState s e n +editShowableFieldWithValidate stLens n isValid = + let ini = T.pack . show + val ls = do + val <- readMaybe $ T.unpack $ T.intercalate "\n" ls + if isValid val + then return val + else Nothing + limit = Just 1 + renderText = txt . T.unlines + in editField stLens n limit ini val renderText id -- | A form field using an editor to edit a text value. Since the value -- is free-form text, it is always valid. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brick-0.60.2/tests/Main.hs new/brick-0.61/tests/Main.hs --- old/brick-0.60.2/tests/Main.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/brick-0.61/tests/Main.hs 2001-09-09 03:46:40.000000000 +0200 @@ -60,16 +60,16 @@ prop_compare l r = compare l r == compare (lower l) (lower r) prop_applicativeIdentity :: I -> Bool -prop_applicativeIdentity v = (pure id <*> v) == v +prop_applicativeIdentity v = (id <$> v) == v prop_applicativeComposition :: IMap (O -> O) -> IMap (O -> O) -> IMap O -> Bool -prop_applicativeComposition u v w = (pure (.) <*> u <*> v <*> w) == (u <*> (v <*> w)) +prop_applicativeComposition u v w = ((.) <$> u <*> v <*> w) == (u <*> (v <*> w)) prop_applicativeHomomorphism :: (O -> O) -> O -> Bool -prop_applicativeHomomorphism f x = (pure f <*> pure x :: I) == pure (f x) +prop_applicativeHomomorphism f x = (f <$> pure x :: I) == pure (f x) prop_applicativeInterchange :: IMap (O -> O) -> O -> Bool -prop_applicativeInterchange u y = (u <*> pure y) == (pure ($ y) <*> u) +prop_applicativeInterchange u y = (u <*> pure y) == (($ y) <$> u) prop_empty :: Bool prop_empty = lower (IMap.empty :: I) == IntMap.empty