HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulebrick-2.10Haskell2010

Brick.Focus

This module provides a type and functions for handling focus rings of values.

  • 1 type
  • 10 values
  • Packagebrick-2.10
  • Exports11
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceFocus.hs
newtypenewtype FocusRing n
#

A focus ring containing a sequence of resource names to focus and a currently-focused name.

Instances1Show
valuefocusRing :: [n] -> FocusRing n
#

Construct a focus ring from the list of resource names.

valuefocusSetCurrent :: Eq n => n -> FocusRing n -> FocusRing n
#

Set the currently-focused resource name in the ring, provided the name is in the ring. Otherwise return the ring unmodified.

valuefocusRingToList :: FocusRing n -> [n]
#

Return all of the entries in the focus ring, starting with the currently-focused entry and wrapping around the ring.

For example, if a ring contains A, B, C, and D, and the current entry is B, the result will be [B, C, D, A].

valuewithFocusRing
  1. :: (Eq n, Named a n)
  2. => FocusRing n

    The focus ring to use as the source of focus state.

  3. -> (Bool -> a -> b)

    A function that takes a value and its focus state.

  4. -> a

    The widget state value that we need to check for focus.

  5. -> b

    The rest of the computation.

#

This function is a convenience function to look up a widget state value's resource name in a focus ring and set its focus setting according to the focus ring's state. This function determines whether a given widget state value is the focus of the ring and passes the resulting boolean to a rendering function, along with the state value (a), to produce whatever comes next (b).

Focus-aware widgets have rendering functions that should be usable with this combinator; see List and Brick.Widgets.Edit.Edit.

valuefocusRingModify :: (CList n -> CList n) -> FocusRing n -> FocusRing n
#

Modify the internal circular list structure of a focus ring directly. This function permits modification of the circular list using the rich Data.CircularList API.