brick-0.52.1: A declarative terminal user interface library

Safe Haskell | None
Language | Haskell2010

Brick.Types

Contents

- The Widget type
- Location types and lenses
- Viewports
- Event-handling types
- Rendering infrastructure
  - The rendering context
  - Rendering results
  - Rendering result lenses
  - Visibility requests
- Making lenses
- Dynamic borders
- Miscellaneous
- Renderer internals (for benchmarking)
- Orphan instances

Description

Basic types used by this library.

Synopsis

- data Widget n = Widget {
  - hSize :: Size
  - vSize :: Size
  - render :: RenderM n (Result n)
  }
- data Location = Location {
  - loc :: (Int, Int)
  }
- locL :: Lens' Location (Int, Int)
- class TerminalLocation a where
  - locationColumnL :: Lens' a Int
  - locationColumn :: a -> Int
  - locationRowL :: Lens' a Int
  - locationRow :: a -> Int
- data CursorLocation n = CursorLocation {
  - cursorLocation :: !Location
  - cursorLocationName :: !(Maybe n)
  }
- cursorLocationL :: forall n. Lens' (CursorLocation n) Location
- cursorLocationNameL :: forall n n. Lens (CursorLocation n) (CursorLocation n) (Maybe n) (Maybe n)
- data Viewport = VP {
  - _vpLeft :: Int
  - _vpTop :: Int
  - _vpSize :: DisplayRegion
  }
- data ViewportType
  - = Vertical
  - | Horizontal
  - | Both
- vpSize :: Lens' Viewport DisplayRegion
- vpTop :: Lens' Viewport Int
- vpLeft :: Lens' Viewport Int
- newtype EventM n a = EventM {
  - runEventM :: ReaderT (EventRO n) (StateT (EventState n) IO) a
  }
- data Next a
- data BrickEvent n e
  - = VtyEvent Event
  - | AppEvent e
  - | MouseDown n Button [Modifier] Location
  - | MouseUp n (Maybe Button) Location
- handleEventLensed :: a -> Lens' a b -> (e -> b -> EventM n b) -> e -> EventM n a
- type RenderM n a = ReaderT Context (State (RenderState n)) a
- getContext :: RenderM n Context
- data Context
- attrL :: forall r. Getting r Context Attr
- availWidthL :: Lens' Context Int
- availHeightL :: Lens' Context Int
- ctxAttrMapL :: Lens' Context AttrMap
- ctxAttrNameL :: Lens' Context AttrName
- ctxBorderStyleL :: Lens' Context BorderStyle
- ctxDynBordersL :: Lens' Context Bool
- data Result n = Result {
  - image :: Image
  - cursors :: [CursorLocation n]
  - visibilityRequests :: [VisibilityRequest]
  - extents :: [Extent n]
  - borders :: BorderMap DynBorder
  }
- emptyResult :: Result n
- lookupAttrName :: AttrName -> RenderM n Attr
- data Extent n = Extent {
  - extentName :: n
  - extentUpperLeft :: Location
  - extentSize :: (Int, Int)
  - extentOffset :: Location
  }
- imageL :: forall n. Lens' (Result n) Image
- cursorsL :: forall n. Lens' (Result n) [CursorLocation n]
- visibilityRequestsL :: forall n. Lens' (Result n) [VisibilityRequest]
- extentsL :: forall n. Lens' (Result n) [Extent n]
- data VisibilityRequest = VR {
  - vrPosition :: Location
  - vrSize :: DisplayRegion
  }
- vrPositionL :: Lens' VisibilityRequest Location
- vrSizeL :: Lens' VisibilityRequest DisplayRegion
- suffixLenses :: Name -> DecsQ
- bordersL :: forall n. Lens' (Result n) (BorderMap DynBorder)
- data DynBorder = DynBorder {
  - dbStyle :: BorderStyle
  - dbAttr :: Attr
  - dbSegments :: Edges BorderSegment
  }
- dbStyleL :: Lens' DynBorder BorderStyle
- dbAttrL :: Lens' DynBorder Attr
- dbSegmentsL :: Lens' DynBorder (Edges BorderSegment)
- data BorderSegment = BorderSegment {
  - bsAccept :: Bool
  - bsOffer :: Bool
  - bsDraw :: Bool
  }
- bsAcceptL :: Lens' BorderSegment Bool
- bsOfferL :: Lens' BorderSegment Bool
- bsDrawL :: Lens' BorderSegment Bool
- data Edges a = Edges {
  - eTop, eBottom, eLeft, eRight :: a
  }
- eTopL :: forall a. Lens' (Edges a) a
- eBottomL :: forall a. Lens' (Edges a) a
- eRightL :: forall a. Lens' (Edges a) a
- eLeftL :: forall a. Lens' (Edges a) a
- data Size
  - = Fixed
  - | Greedy
- data Padding
  - = Pad Int
  - | Max
- data Direction
  - = Up
  - | Down
- data RenderState n

# The Widget type

data Widget n Source #

The type of widgets.

Constructors

Widget |

Fields

- hSize :: Size

  This widget's horizontal growth policy

- vSize :: Size

  This widget's vertical growth policy

- render :: RenderM n (Result n)

  This widget's rendering function

# Location types and lenses

data Location Source #

A terminal screen location.

Constructors

Location |

Fields

- loc :: (Int, Int)

  (Column, Row)

#### Instances

Instances details

Eq Location Source # |
Instance details Defined in Brick.Types.Common Methods (==) :: Location -> Location -> Bool (/=) :: Location -> Location -> Bool
Ord Location Source # |
Instance details Defined in Brick.Types.Common Methods compare :: Location -> Location -> Ordering (<) :: Location -> Location -> Bool (<=) :: Location -> Location -> Bool (>) :: Location -> Location -> Bool (>=) :: Location -> Location -> Bool max :: Location -> Location -> Location min :: Location -> Location -> Location
Read Location Source # |
Instance details Defined in Brick.Types.Common Methods readsPrec :: Int -> ReadS Location readList :: ReadS [Location] readPrec :: ReadPrec Location readListPrec :: ReadPrec [Location]
Show Location Source # |
Instance details Defined in Brick.Types.Common Methods showsPrec :: Int -> Location -> ShowS show :: Location -> String showList :: [Location] -> ShowS
Generic Location Source # |
Instance details Defined in Brick.Types.Common Associated Types type Rep Location :: Type -> Type Methods from :: Location -> Rep Location x to :: Rep Location x -> Location
Semigroup Location Source # |
Instance details Defined in Brick.Types.Common Methods (<>) :: Location -> Location -> Location sconcat :: NonEmpty Location -> Location stimes :: Integral b => b -> Location -> Location
Monoid Location Source # |
Instance details Defined in Brick.Types.Common Methods mempty :: Location mappend :: Location -> Location -> Location mconcat :: [Location] -> Location
NFData Location Source # |
Instance details Defined in Brick.Types.Common Methods rnf :: Location -> ()
TerminalLocation Location Source # |
Instance details Defined in Brick.Types.Internal Methods locationColumnL :: Lens' Location Int Source # locationColumn :: Location -> Int Source # locationRowL :: Lens' Location Int Source # locationRow :: Location -> Int Source #
Field1 Location Location Int Int Source # |
Instance details Defined in Brick.Types.Common Methods _1 :: Lens Location Location Int Int Source #
Field2 Location Location Int Int Source # |
Instance details Defined in Brick.Types.Common Methods _2 :: Lens Location Location Int Int Source #
type Rep Location Source # |
Instance details Defined in Brick.Types.Common type Rep Location = D1 ('MetaData "Location" "Brick.Types.Common" "brick-0.52.1-9Q8kaUnuStoIrShYXXbvhp" 'False) (C1 ('MetaCons "Location" 'PrefixI 'True) (S1 ('MetaSel ('Just "loc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Int, Int))))

locL :: Lens' Location (Int, Int) Source #

class TerminalLocation a where Source #

The class of types that behave like terminal locations.

Methods

locationColumnL :: Lens' a Int Source #

Get the column out of the value

locationColumn :: a -> Int Source #

locationRowL :: Lens' a Int Source #

Get the row out of the value

locationRow :: a -> Int Source #

#### Instances

Instances details

TerminalLocation Location Source # |
Instance details Defined in Brick.Types.Internal Methods locationColumnL :: Lens' Location Int Source # locationColumn :: Location -> Int Source # locationRowL :: Lens' Location Int Source # locationRow :: Location -> Int Source #
TerminalLocation (CursorLocation n) Source # |
Instance details Defined in Brick.Types Methods locationColumnL :: Lens' (CursorLocation n) Int Source # locationColumn :: CursorLocation n -> Int Source # locationRowL :: Lens' (CursorLocation n) Int Source # locationRow :: CursorLocation n -> Int Source #

data CursorLocation n Source #

A cursor location. These are returned by the rendering process.

Constructors

CursorLocation |

Fields

- cursorLocation :: !Location

  The location

- cursorLocationName :: !(Maybe n)

  The name of the widget associated with the location

#### Instances

Instances details

Read n => Read (CursorLocation n) Source # |
Instance details Defined in Brick.Types.Internal Methods readsPrec :: Int -> ReadS (CursorLocation n) readList :: ReadS [CursorLocation n] readPrec :: ReadPrec (CursorLocation n) readListPrec :: ReadPrec [CursorLocation n]
Show n => Show (CursorLocation n) Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> CursorLocation n -> ShowS show :: CursorLocation n -> String showList :: [CursorLocation n] -> ShowS
Generic (CursorLocation n) Source # |
Instance details Defined in Brick.Types.Internal Associated Types type Rep (CursorLocation n) :: Type -> Type Methods from :: CursorLocation n -> Rep (CursorLocation n) x to :: Rep (CursorLocation n) x -> CursorLocation n
NFData n => NFData (CursorLocation n) Source # |
Instance details Defined in Brick.Types.Internal Methods rnf :: CursorLocation n -> ()
TerminalLocation (CursorLocation n) Source # |
Instance details Defined in Brick.Types Methods locationColumnL :: Lens' (CursorLocation n) Int Source # locationColumn :: CursorLocation n -> Int Source # locationRowL :: Lens' (CursorLocation n) Int Source # locationRow :: CursorLocation n -> Int Source #
type Rep (CursorLocation n) Source # |

Instance details

Defined in Brick.Types.Internal

type Rep (CursorLocation n) = D1 ('MetaData "CursorLocation" "Brick.Types.Internal" "brick-0.52.1-9Q8kaUnuStoIrShYXXbvhp" 'False) (C1 ('MetaCons "CursorLocation" 'PrefixI 'True) (S1 ('MetaSel ('Just "cursorLocation") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Location) :*: S1 ('MetaSel ('Just "cursorLocationName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe n))))

cursorLocationL :: forall n. Lens' (CursorLocation n) Location Source #

cursorLocationNameL :: forall n n. Lens (CursorLocation n) (CursorLocation n) (Maybe n) (Maybe n) Source #

# Viewports

data Viewport Source #

Describes the state of a viewport as it appears as its most recent rendering.

Constructors

VP |

Fields

- _vpLeft :: Int

  The column offset of left side of the viewport.

- _vpTop :: Int

  The row offset of the top of the viewport.

- _vpSize :: DisplayRegion

  The size of the viewport.

#### Instances

Instances details

Read Viewport Source # |
Instance details Defined in Brick.Types.Internal Methods readsPrec :: Int -> ReadS Viewport readList :: ReadS [Viewport] readPrec :: ReadPrec Viewport readListPrec :: ReadPrec [Viewport]
Show Viewport Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> Viewport -> ShowS show :: Viewport -> String showList :: [Viewport] -> ShowS
Generic Viewport Source # |
Instance details Defined in Brick.Types.Internal Associated Types type Rep Viewport :: Type -> Type Methods from :: Viewport -> Rep Viewport x to :: Rep Viewport x -> Viewport
NFData Viewport Source # |
Instance details Defined in Brick.Types.Internal Methods rnf :: Viewport -> ()
type Rep Viewport Source # |

Instance details

Defined in Brick.Types.Internal

type Rep Viewport = D1 ('MetaData "Viewport" "Brick.Types.Internal" "brick-0.52.1-9Q8kaUnuStoIrShYXXbvhp" 'False) (C1 ('MetaCons "VP" 'PrefixI 'True) (S1 ('MetaSel ('Just "_vpLeft") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "_vpTop") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "_vpSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DisplayRegion))))

data ViewportType Source #

The type of viewports that indicates the direction(s) in which a viewport is scrollable.

Constructors

Vertical | Viewports of this type are scrollable only vertically.
Horizontal | Viewports of this type are scrollable only horizontally.
Both | Viewports of this type are scrollable vertically and horizontally.

#### Instances

Instances details

Eq ViewportType Source # |
Instance details Defined in Brick.Types.Internal Methods (==) :: ViewportType -> ViewportType -> Bool (/=) :: ViewportType -> ViewportType -> Bool
Show ViewportType Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> ViewportType -> ShowS show :: ViewportType -> String showList :: [ViewportType] -> ShowS

vpSize :: Lens' Viewport DisplayRegion Source #

vpTop :: Lens' Viewport Int Source #

vpLeft :: Lens' Viewport Int Source #

# Event-handling types

newtype EventM n a Source #

The monad in which event handlers run. Although it may be tempting to dig into the reader value yourself, just use `lookupViewport`.

Constructors

EventM |

Fields

- runEventM :: ReaderT (EventRO n) (StateT (EventState n) IO) a

#### Instances

Instances details

Monad (EventM n) Source # |
Instance details Defined in Brick.Types Methods (>>=) :: EventM n a -> (a -> EventM n b) -> EventM n b (>>) :: EventM n a -> EventM n b -> EventM n b return :: a -> EventM n a
Functor (EventM n) Source # |
Instance details Defined in Brick.Types Methods fmap :: (a -> b) -> EventM n a -> EventM n b (<$) :: a -> EventM n b -> EventM n a
MonadFail (EventM n) Source # |
Instance details Defined in Brick.Types Methods fail :: String -> EventM n a
Applicative (EventM n) Source # |
Instance details Defined in Brick.Types Methods pure :: a -> EventM n a (<*>) :: EventM n (a -> b) -> EventM n a -> EventM n b liftA2 :: (a -> b -> c) -> EventM n a -> EventM n b -> EventM n c (*>) :: EventM n a -> EventM n b -> EventM n b (<*) :: EventM n a -> EventM n b -> EventM n a
MonadThrow (EventM n) Source # |
Instance details Defined in Brick.Types Methods throwM :: Exception e => e -> EventM n a Source #
MonadCatch (EventM n) Source # |
Instance details Defined in Brick.Types Methods catch :: Exception e => EventM n a -> (e -> EventM n a) -> EventM n a Source #
MonadMask (EventM n) Source # |
Instance details Defined in Brick.Types Methods mask :: ((forall a. EventM n a -> EventM n a) -> EventM n b) -> EventM n b Source # uninterruptibleMask :: ((forall a. EventM n a -> EventM n a) -> EventM n b) -> EventM n b Source # generalBracket :: EventM n a -> (a -> ExitCase b -> EventM n c) -> (a -> EventM n b) -> EventM n (b, c) Source #
MonadIO (EventM n) Source # |
Instance details Defined in Brick.Types Methods liftIO :: IO a -> EventM n a

data Next a Source #

The type of actions to take upon completion of an event handler.

#### Instances

Instances details

Functor Next Source # |
Instance details Defined in Brick.Types.Internal Methods fmap :: (a -> b) -> Next a -> Next b (<$) :: a -> Next b -> Next a

data BrickEvent n e Source #

The type of events.

Constructors

VtyEvent Event | The event was a Vty event.
AppEvent e | The event was an application event.
MouseDown n Button [Modifier] Location | A mouse-down event on the specified region was received. The `n` value is the resource name of the clicked widget (see `clickable`).
MouseUp n (Maybe Button) Location | A mouse-up event on the specified region was received. The `n` value is the resource name of the clicked widget (see `clickable`).

#### Instances

Instances details

(Eq e, Eq n) => Eq (BrickEvent n e) Source # |
Instance details Defined in Brick.Types.Internal Methods (==) :: BrickEvent n e -> BrickEvent n e -> Bool (/=) :: BrickEvent n e -> BrickEvent n e -> Bool
(Ord e, Ord n) => Ord (BrickEvent n e) Source # |

Instance details

Defined in Brick.Types.Internal

Methods

compare :: BrickEvent n e -> BrickEvent n e -> Ordering

(<) :: BrickEvent n e -> BrickEvent n e -> Bool

(<=) :: BrickEvent n e -> BrickEvent n e -> Bool

(>) :: BrickEvent n e -> BrickEvent n e -> Bool

(>=) :: BrickEvent n e -> BrickEvent n e -> Bool

max :: BrickEvent n e -> BrickEvent n e -> BrickEvent n e

min :: BrickEvent n e -> BrickEvent n e -> BrickEvent n e

(Show e, Show n) => Show (BrickEvent n e) Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> BrickEvent n e -> ShowS show :: BrickEvent n e -> String showList :: [BrickEvent n e] -> ShowS

handleEventLensed Source #

Arguments

:: a | The state value.
-> Lens' a b | The lens to use to extract and store the target of the event.
-> (e -> b -> EventM n b) | The event handler.
-> e | The event to handle.
-> EventM n a |

A convenience function for handling events intended for values that are targets of lenses in your application state. This function obtains the target value of the specified lens, invokes `handleEvent` on it, and stores the resulting transformed value back in the state using the lens.

# Rendering infrastructure

type RenderM n a = ReaderT Context (State (RenderState n)) a Source #

The type of the rendering monad. This monad is used by the library's rendering routines to manage rendering state and communicate rendering parameters to widgets' rendering functions.

getContext :: RenderM n Context Source #

Get the current rendering context.

## The rendering context

data Context Source #

The rendering context. This tells widgets how to render: how much space they have in which to render, which attribute they should use to render, which bordering style should be used, and the attribute map available for rendering.

#### Instances

Instances details

Show Context Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> Context -> ShowS show :: Context -> String showList :: [Context] -> ShowS

attrL :: forall r. Getting r Context Attr Source #

The rendering context's current drawing attribute.

availWidthL :: Lens' Context Int Source #

availHeightL :: Lens' Context Int Source #

ctxAttrMapL :: Lens' Context AttrMap Source #

ctxAttrNameL :: Lens' Context AttrName Source #

ctxBorderStyleL :: Lens' Context BorderStyle Source #

ctxDynBordersL :: Lens' Context Bool Source #

## Rendering results

data Result n Source #

The type of result returned by a widget's rendering function. The result provides the image, cursor positions, and visibility requests that resulted from the rendering process.

Constructors

Result |

Fields

- image :: Image

  The final rendered image for a widget

- cursors :: [CursorLocation n]

  The list of reported cursor positions for the application to choose from

- visibilityRequests :: [VisibilityRequest]

  The list of visibility requests made by widgets rendered while rendering this one (used by viewports)

- extents :: [Extent n]
- borders :: BorderMap DynBorder

  Places where we may rewrite the edge of the image when placing this widget next to another one.

#### Instances

Instances details

Read n => Read (Result n) Source # |
Instance details Defined in Brick.Types.Internal Methods readsPrec :: Int -> ReadS (Result n) readList :: ReadS [Result n] readPrec :: ReadPrec (Result n) readListPrec :: ReadPrec [Result n]
Show n => Show (Result n) Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> Result n -> ShowS show :: Result n -> String showList :: [Result n] -> ShowS
Generic (Result n) Source # |
Instance details Defined in Brick.Types.Internal Associated Types type Rep (Result n) :: Type -> Type Methods from :: Result n -> Rep (Result n) x to :: Rep (Result n) x -> Result n
NFData n => NFData (Result n) Source # |
Instance details Defined in Brick.Types.Internal Methods rnf :: Result n -> ()
type Rep (Result n) Source # |

Instance details

Defined in Brick.Types.Internal

type Rep (Result n) = D1 ('MetaData "Result" "Brick.Types.Internal" "brick-0.52.1-9Q8kaUnuStoIrShYXXbvhp" 'False) (C1 ('MetaCons "Result" 'PrefixI 'True) ((S1 ('MetaSel ('Just "image") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Image) :*: S1 ('MetaSel ('Just "cursors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [CursorLocation n])) :*: (S1 ('MetaSel ('Just "visibilityRequests") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [VisibilityRequest]) :*: (S1 ('MetaSel ('Just "extents") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Extent n]) :*: S1 ('MetaSel ('Just "borders") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (BorderMap DynBorder))))))

emptyResult :: Result n Source #

lookupAttrName :: AttrName -> RenderM n Attr Source #

Given an attribute name, obtain the attribute for the attribute name by consulting the context's attribute map.

data Extent n Source #

An extent of a named area: its size, location, and origin.

Constructors

Extent |

Fields

- extentName :: n
- extentUpperLeft :: Location
- extentSize :: (Int, Int)
- extentOffset :: Location

#### Instances

Instances details

Read n => Read (Extent n) Source # |
Instance details Defined in Brick.Types.Internal Methods readsPrec :: Int -> ReadS (Extent n) readList :: ReadS [Extent n] readPrec :: ReadPrec (Extent n) readListPrec :: ReadPrec [Extent n]
Show n => Show (Extent n) Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> Extent n -> ShowS show :: Extent n -> String showList :: [Extent n] -> ShowS
Generic (Extent n) Source # |
Instance details Defined in Brick.Types.Internal Associated Types type Rep (Extent n) :: Type -> Type Methods from :: Extent n -> Rep (Extent n) x to :: Rep (Extent n) x -> Extent n
NFData n => NFData (Extent n) Source # |
Instance details Defined in Brick.Types.Internal Methods rnf :: Extent n -> ()
type Rep (Extent n) Source # |

Instance details

Defined in Brick.Types.Internal

type Rep (Extent n) = D1 ('MetaData "Extent" "Brick.Types.Internal" "brick-0.52.1-9Q8kaUnuStoIrShYXXbvhp" 'False) (C1 ('MetaCons "Extent" 'PrefixI 'True) ((S1 ('MetaSel ('Just "extentName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 n) :*: S1 ('MetaSel ('Just "extentUpperLeft") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Location)) :*: (S1 ('MetaSel ('Just "extentSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Int, Int)) :*: S1 ('MetaSel ('Just "extentOffset") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Location))))

## Rendering result lenses

imageL :: forall n. Lens' (Result n) Image Source #

cursorsL :: forall n. Lens' (Result n) [CursorLocation n] Source #

visibilityRequestsL :: forall n. Lens' (Result n) [VisibilityRequest] Source #

extentsL :: forall n. Lens' (Result n) [Extent n] Source #

## Visibility requests

data VisibilityRequest Source #

Constructors

VR |

Fields

- vrPosition :: Location
- vrSize :: DisplayRegion

#### Instances

Instances details

Eq VisibilityRequest Source # |
Instance details Defined in Brick.Types.Internal Methods (==) :: VisibilityRequest -> VisibilityRequest -> Bool (/=) :: VisibilityRequest -> VisibilityRequest -> Bool
Read VisibilityRequest Source # |
Instance details Defined in Brick.Types.Internal Methods readsPrec :: Int -> ReadS VisibilityRequest readList :: ReadS [VisibilityRequest] readPrec :: ReadPrec VisibilityRequest readListPrec :: ReadPrec [VisibilityRequest]
Show VisibilityRequest Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> VisibilityRequest -> ShowS show :: VisibilityRequest -> String showList :: [VisibilityRequest] -> ShowS
Generic VisibilityRequest Source # |
Instance details Defined in Brick.Types.Internal Associated Types type Rep VisibilityRequest :: Type -> Type Methods from :: VisibilityRequest -> Rep VisibilityRequest x to :: Rep VisibilityRequest x -> VisibilityRequest
NFData VisibilityRequest Source # |
Instance details Defined in Brick.Types.Internal Methods rnf :: VisibilityRequest -> ()
type Rep VisibilityRequest Source # |

Instance details

Defined in Brick.Types.Internal

type Rep VisibilityRequest = D1 ('MetaData "VisibilityRequest" "Brick.Types.Internal" "brick-0.52.1-9Q8kaUnuStoIrShYXXbvhp" 'False) (C1 ('MetaCons "VR" 'PrefixI 'True) (S1 ('MetaSel ('Just "vrPosition") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Location) :*: S1 ('MetaSel ('Just "vrSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DisplayRegion)))

vrPositionL :: Lens' VisibilityRequest Location Source #

vrSizeL :: Lens' VisibilityRequest DisplayRegion Source #

# Making lenses

suffixLenses :: Name -> DecsQ Source #

A template haskell function to build lenses for a record type. This function differs from the `makeLenses` function in that it does not require the record fields to be prefixed with underscores and it adds an L suffix to lens names to make it clear that they are lenses.

# Dynamic borders

bordersL :: forall n. Lens' (Result n) (BorderMap DynBorder) Source #

data DynBorder Source #

Information about how to redraw a dynamic border character when it abuts another dynamic border character.

Constructors

DynBorder |

Fields

- dbStyle :: BorderStyle

  The `Char`s to use when redrawing the border. Also used to filter connections: only dynamic borders with equal `BorderStyle`s will connect to each other.

- dbAttr :: Attr

  What `Attr` to use to redraw the border character. Also used to filter connections: only dynamic borders with equal `Attr`s will connect to each other.

- dbSegments :: Edges BorderSegment

#### Instances

Instances details

Eq DynBorder Source # |
Instance details Defined in Brick.Types.Internal Methods (==) :: DynBorder -> DynBorder -> Bool (/=) :: DynBorder -> DynBorder -> Bool
Read DynBorder Source # |
Instance details Defined in Brick.Types.Internal Methods readsPrec :: Int -> ReadS DynBorder readList :: ReadS [DynBorder] readPrec :: ReadPrec DynBorder readListPrec :: ReadPrec [DynBorder]
Show DynBorder Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> DynBorder -> ShowS show :: DynBorder -> String showList :: [DynBorder] -> ShowS
Generic DynBorder Source # |
Instance details Defined in Brick.Types.Internal Associated Types type Rep DynBorder :: Type -> Type Methods from :: DynBorder -> Rep DynBorder x to :: Rep DynBorder x -> DynBorder
NFData DynBorder Source # |
Instance details Defined in Brick.Types.Internal Methods rnf :: DynBorder -> ()
type Rep DynBorder Source # |

Instance details

Defined in Brick.Types.Internal

type Rep DynBorder = D1 ('MetaData "DynBorder" "Brick.Types.Internal" "brick-0.52.1-9Q8kaUnuStoIrShYXXbvhp" 'False) (C1 ('MetaCons "DynBorder" 'PrefixI 'True) (S1 ('MetaSel ('Just "dbStyle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BorderStyle) :*: (S1 ('MetaSel ('Just "dbAttr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Attr) :*: S1 ('MetaSel ('Just "dbSegments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Edges BorderSegment)))))

dbStyleL :: Lens' DynBorder BorderStyle Source #

dbAttrL :: Lens' DynBorder Attr Source #

dbSegmentsL :: Lens' DynBorder (Edges BorderSegment) Source #

data BorderSegment Source #

A border character has four segments, one extending in each direction (horizontally and vertically) from the center of the character.

Constructors

BorderSegment |

Fields

- bsAccept :: Bool

  Would this segment be willing to be drawn if a neighbor wanted to connect to it?

- bsOffer :: Bool

  Does this segment want to connect to its neighbor?

- bsDraw :: Bool

  Should this segment be represented visually?

#### Instances

Instances details

Eq BorderSegment Source # |
Instance details Defined in Brick.Types.Internal Methods (==) :: BorderSegment -> BorderSegment -> Bool (/=) :: BorderSegment -> BorderSegment -> Bool
Ord BorderSegment Source # |

Instance details

Defined in Brick.Types.Internal

Methods

compare :: BorderSegment -> BorderSegment -> Ordering

(<) :: BorderSegment -> BorderSegment -> Bool

(<=) :: BorderSegment -> BorderSegment -> Bool

(>) :: BorderSegment -> BorderSegment -> Bool

(>=) :: BorderSegment -> BorderSegment -> Bool

max :: BorderSegment -> BorderSegment -> BorderSegment

min :: BorderSegment -> BorderSegment -> BorderSegment

Read BorderSegment Source # |
Instance details Defined in Brick.Types.Internal Methods readsPrec :: Int -> ReadS BorderSegment readList :: ReadS [BorderSegment] readPrec :: ReadPrec BorderSegment readListPrec :: ReadPrec [BorderSegment]
Show BorderSegment Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> BorderSegment -> ShowS show :: BorderSegment -> String showList :: [BorderSegment] -> ShowS
Generic BorderSegment Source # |
Instance details Defined in Brick.Types.Internal Associated Types type Rep BorderSegment :: Type -> Type Methods from :: BorderSegment -> Rep BorderSegment x to :: Rep BorderSegment x -> BorderSegment
NFData BorderSegment Source # |
Instance details Defined in Brick.Types.Internal Methods rnf :: BorderSegment -> ()
type Rep BorderSegment Source # |

Instance details

Defined in Brick.Types.Internal

type Rep BorderSegment = D1 ('MetaData "BorderSegment" "Brick.Types.Internal" "brick-0.52.1-9Q8kaUnuStoIrShYXXbvhp" 'False) (C1 ('MetaCons "BorderSegment" 'PrefixI 'True) (S1 ('MetaSel ('Just "bsAccept") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "bsOffer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "bsDraw") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))

bsAcceptL :: Lens' BorderSegment Bool Source #

bsOfferL :: Lens' BorderSegment Bool Source #

bsDrawL :: Lens' BorderSegment Bool Source #

data Edges a Source #

Constructors

Edges |

Fields

- eTop, eBottom, eLeft, eRight :: a

#### Instances

Instances details

Monad Edges Source # |
Instance details Defined in Brick.Types.Common Methods (>>=) :: Edges a -> (a -> Edges b) -> Edges b (>>) :: Edges a -> Edges b -> Edges b return :: a -> Edges a
Functor Edges Source # |
Instance details Defined in Brick.Types.Common Methods fmap :: (a -> b) -> Edges a -> Edges b (<$) :: a -> Edges b -> Edges a
Applicative Edges Source # |
Instance details Defined in Brick.Types.Common Methods pure :: a -> Edges a (<*>) :: Edges (a -> b) -> Edges a -> Edges b liftA2 :: (a -> b -> c) -> Edges a -> Edges b -> Edges c (*>) :: Edges a -> Edges b -> Edges b (<*) :: Edges a -> Edges b -> Edges a
Eq a => Eq (Edges a) Source # |
Instance details Defined in Brick.Types.Common Methods (==) :: Edges a -> Edges a -> Bool (/=) :: Edges a -> Edges a -> Bool
Ord a => Ord (Edges a) Source # |
Instance details Defined in Brick.Types.Common Methods compare :: Edges a -> Edges a -> Ordering (<) :: Edges a -> Edges a -> Bool (<=) :: Edges a -> Edges a -> Bool (>) :: Edges a -> Edges a -> Bool (>=) :: Edges a -> Edges a -> Bool max :: Edges a -> Edges a -> Edges a min :: Edges a -> Edges a -> Edges a
Read a => Read (Edges a) Source # |
Instance details Defined in Brick.Types.Common Methods readsPrec :: Int -> ReadS (Edges a) readList :: ReadS [Edges a] readPrec :: ReadPrec (Edges a) readListPrec :: ReadPrec [Edges a]
Show a => Show (Edges a) Source # |
Instance details Defined in Brick.Types.Common Methods showsPrec :: Int -> Edges a -> ShowS show :: Edges a -> String showList :: [Edges a] -> ShowS
Generic (Edges a) Source # |
Instance details Defined in Brick.Types.Common Associated Types type Rep (Edges a) :: Type -> Type Methods from :: Edges a -> Rep (Edges a) x to :: Rep (Edges a) x -> Edges a
NFData a => NFData (Edges a) Source # |
Instance details Defined in Brick.Types.Common Methods rnf :: Edges a -> ()
type Rep (Edges a) Source # |

Instance details

Defined in Brick.Types.Common

type Rep (Edges a) = D1 ('MetaData "Edges" "Brick.Types.Common" "brick-0.52.1-9Q8kaUnuStoIrShYXXbvhp" 'False) (C1 ('MetaCons "Edges" 'PrefixI 'True) ((S1 ('MetaSel ('Just "eTop") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "eBottom") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :*: (S1 ('MetaSel ('Just "eLeft") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "eRight") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))))

eTopL :: forall a. Lens' (Edges a) a Source #

eBottomL :: forall a. Lens' (Edges a) a Source #

eRightL :: forall a. Lens' (Edges a) a Source #

eLeftL :: forall a. Lens' (Edges a) a Source #

# Miscellaneous

data Size Source #

Widget size policies. These policies communicate how a widget uses space when being rendered. These policies influence rendering order and space allocation in the box layout algorithm for `hBox` and `vBox`.

Constructors

Fixed | Widgets advertising this size policy should take up the same amount of space no matter how much they are given, i.e. their size depends on their contents alone rather than on the size of the rendering area.
Greedy | Widgets advertising this size policy must take up all the space they are given.

#### Instances

Instances details

Eq Size Source # |
Instance details Defined in Brick.Types Methods (==) :: Size -> Size -> Bool (/=) :: Size -> Size -> Bool
Ord Size Source # |
Instance details Defined in Brick.Types Methods compare :: Size -> Size -> Ordering (<) :: Size -> Size -> Bool (<=) :: Size -> Size -> Bool (>) :: Size -> Size -> Bool (>=) :: Size -> Size -> Bool max :: Size -> Size -> Size min :: Size -> Size -> Size
Show Size Source # |
Instance details Defined in Brick.Types Methods showsPrec :: Int -> Size -> ShowS show :: Size -> String showList :: [Size] -> ShowS

data Padding Source #

The type of padding.

Constructors

Pad Int | Pad by the specified number of rows or columns.
Max | Pad up to the number of available rows or columns.

data Direction Source #

Scrolling direction.

Constructors

Up | Up/left
Down | Down/right

#### Instances

Instances details

Eq Direction Source # |
Instance details Defined in Brick.Types.Internal Methods (==) :: Direction -> Direction -> Bool (/=) :: Direction -> Direction -> Bool
Read Direction Source # |
Instance details Defined in Brick.Types.Internal Methods readsPrec :: Int -> ReadS Direction readList :: ReadS [Direction] readPrec :: ReadPrec Direction readListPrec :: ReadPrec [Direction]
Show Direction Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> Direction -> ShowS show :: Direction -> String showList :: [Direction] -> ShowS
Generic Direction Source # |
Instance details Defined in Brick.Types.Internal Associated Types type Rep Direction :: Type -> Type Methods from :: Direction -> Rep Direction x to :: Rep Direction x -> Direction
NFData Direction Source # |
Instance details Defined in Brick.Types.Internal Methods rnf :: Direction -> ()
type Rep Direction Source # |
Instance details Defined in Brick.Types.Internal type Rep Direction = D1 ('MetaData "Direction" "Brick.Types.Internal" "brick-0.52.1-9Q8kaUnuStoIrShYXXbvhp" 'False) (C1 ('MetaCons "Up" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Down" 'PrefixI 'False) (U1 :: Type -> Type))

# Renderer internals (for benchmarking)

data RenderState n Source #

#### Instances

Instances details

(Ord n, Read n) => Read (RenderState n) Source # |
Instance details Defined in Brick.Types.Internal Methods readsPrec :: Int -> ReadS (RenderState n) readList :: ReadS [RenderState n] readPrec :: ReadPrec (RenderState n) readListPrec :: ReadPrec [RenderState n]
Show n => Show (RenderState n) Source # |
Instance details Defined in Brick.Types.Internal Methods showsPrec :: Int -> RenderState n -> ShowS show :: RenderState n -> String showList :: [RenderState n] -> ShowS
Generic (RenderState n) Source # |
Instance details Defined in Brick.Types.Internal Associated Types type Rep (RenderState n) :: Type -> Type Methods from :: RenderState n -> Rep (RenderState n) x to :: Rep (RenderState n) x -> RenderState n
NFData n => NFData (RenderState n) Source # |
Instance details Defined in Brick.Types.Internal Methods rnf :: RenderState n -> ()
type Rep (RenderState n) Source # |
Instance details Defined in Brick.Types.Internal type Rep (RenderState n)

# Orphan instances

TerminalLocation (CursorLocation n) Source # |
Instance details Methods locationColumnL :: Lens' (CursorLocation n) Int Source # locationColumn :: CursorLocation n -> Int Source # locationRowL :: Lens' (CursorLocation n) Int Source # locationRow :: CursorLocation n -> Int Source #