dyna-brick-0.1.0.0: FRP for brick Terminal user interface library
Safe HaskellNone
LanguageHaskell2010

Dyna.Brick

Synopsis

Brick helper types

type Box = Widget BoxId Source #

Synonym to fix the Widget parameter

newtype BoxId Source #

Box identifier

Constructors

BoxId 

Fields

Instances

Instances details
Eq BoxId Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(==) :: BoxId -> BoxId -> Bool #

(/=) :: BoxId -> BoxId -> Bool #

Ord BoxId Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

compare :: BoxId -> BoxId -> Ordering #

(<) :: BoxId -> BoxId -> Bool #

(<=) :: BoxId -> BoxId -> Bool #

(>) :: BoxId -> BoxId -> Bool #

(>=) :: BoxId -> BoxId -> Bool #

max :: BoxId -> BoxId -> BoxId #

min :: BoxId -> BoxId -> BoxId #

Read BoxId Source # 
Instance details

Defined in Dyna.Brick.Types

Show BoxId Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

showsPrec :: Int -> BoxId -> ShowS #

show :: BoxId -> String #

showList :: [BoxId] -> ShowS #

data Win Source #

Window of the application

Constructors

Win 

Fields

data Act Source #

Actions for Brick rendering engine

Constructors

Quit

Quit the app

data MouseUpEvent Source #

Mouse up events only

data MouseDownEvent Source #

Mouse down events only

Re-exports

liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c #

Lift a binary function to actions.

Some functors support an implementation of liftA2 that is more efficient than the default one. In particular, if fmap is an expensive operation, it is likely better to use liftA2 than to fmap over the structure and then use <*>.

This became a typeclass method in 4.10.0.0. Prior to that, it was a function defined in terms of <*> and fmap.

Using ApplicativeDo: 'liftA2 f as bs' can be understood as the do expression

do a <- as
   b <- bs
   pure (f a b)

sort2B :: (IfB a, OrdB a) => (a, a) -> (a, a) #

Variant of min and max using ifB and (<=*)

maxB :: (IfB a, OrdB a) => a -> a -> a #

Variant of max using ifB and (>=*)

minB :: (IfB a, OrdB a) => a -> a -> a #

Variant of min using ifB and (<=*)

caseB :: (IfB b, bool ~ BooleanOf b) => a -> [(a -> bool, b)] -> b -> b #

A generalized version of a case like control structure.

guardedB :: (IfB b, bool ~ BooleanOf b) => bool -> [(bool, b)] -> b -> b #

A generalized replacement for guards and chained ifs.

crop :: (Applicative f, Monoid (f a), IfB a, bool ~ BooleanOf a) => f bool -> f a -> f a #

Generalized cropping, filling in mempty where the test yields false.

cond :: (Applicative f, IfB a, bool ~ BooleanOf a) => f bool -> f a -> f a -> f a #

Point-wise conditional

boolean :: (IfB a, bool ~ BooleanOf a) => a -> a -> bool -> a #

Expression-lifted conditional with condition last

class Boolean b where #

Generalized boolean class

Methods

true :: b #

false :: b #

notB :: b -> b #

(&&*) :: b -> b -> b infixr 3 #

(||*) :: b -> b -> b infixr 2 #

Instances

Instances details
Boolean Bool 
Instance details

Defined in Data.Boolean

Methods

true :: Bool #

false :: Bool #

notB :: Bool -> Bool #

(&&*) :: Bool -> Bool -> Bool #

(||*) :: Bool -> Bool -> Bool #

Boolean a => Boolean (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

true :: Dyn a #

false :: Dyn a #

notB :: Dyn a -> Dyn a #

(&&*) :: Dyn a -> Dyn a -> Dyn a #

(||*) :: Dyn a -> Dyn a -> Dyn a #

Boolean bool => Boolean (z -> bool) 
Instance details

Defined in Data.Boolean

Methods

true :: z -> bool #

false :: z -> bool #

notB :: (z -> bool) -> z -> bool #

(&&*) :: (z -> bool) -> (z -> bool) -> z -> bool #

(||*) :: (z -> bool) -> (z -> bool) -> z -> bool #

(Boolean b, Frp m) => Boolean (Dyn m b) 
Instance details

Defined in Dyna

Methods

true :: Dyn m b #

false :: Dyn m b #

notB :: Dyn m b -> Dyn m b #

(&&*) :: Dyn m b -> Dyn m b -> Dyn m b #

(||*) :: Dyn m b -> Dyn m b -> Dyn m b #

type family BooleanOf a #

BooleanOf computed the boolean analog of a specific type.

Instances

Instances details
type BooleanOf Bool 
Instance details

Defined in Data.Boolean

type BooleanOf Char 
Instance details

Defined in Data.Boolean

type BooleanOf Double 
Instance details

Defined in Data.Boolean

type BooleanOf Float 
Instance details

Defined in Data.Boolean

type BooleanOf Int 
Instance details

Defined in Data.Boolean

type BooleanOf Integer 
Instance details

Defined in Data.Boolean

type BooleanOf [a] 
Instance details

Defined in Data.Boolean

type BooleanOf [a] = BooleanOf a
type BooleanOf (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

type BooleanOf (Dyn a) = Dyn (BooleanOf a)
type BooleanOf (z -> a) 
Instance details

Defined in Data.Boolean

type BooleanOf (z -> a) = z -> BooleanOf a
type BooleanOf (a, b) 
Instance details

Defined in Data.Boolean

type BooleanOf (a, b) = BooleanOf a
type BooleanOf (Dyn m a) 
Instance details

Defined in Dyna

type BooleanOf (Dyn m a) = Dyn m (BooleanOf a)
type BooleanOf (a :> b) 
Instance details

Defined in Data.Maclaurin

type BooleanOf (a :> b) = BooleanOf b
type BooleanOf (a, b, c) 
Instance details

Defined in Data.Boolean

type BooleanOf (a, b, c) = BooleanOf a
type BooleanOf (a, b, c, d) 
Instance details

Defined in Data.Boolean

type BooleanOf (a, b, c, d) = BooleanOf a

class Boolean (BooleanOf a) => IfB a where #

Types with conditionals

Methods

ifB :: bool ~ BooleanOf a => bool -> a -> a -> a #

Instances

Instances details
IfB Bool 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf Bool => bool -> Bool -> Bool -> Bool #

IfB Char 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf Char => bool -> Char -> Char -> Char #

IfB Double 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf Double => bool -> Double -> Double -> Double #

IfB Float 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf Float => bool -> Float -> Float -> Float #

IfB Int 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf Int => bool -> Int -> Int -> Int #

IfB Integer 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf Integer => bool -> Integer -> Integer -> Integer #

(Boolean (BooleanOf a), BooleanOf a ~ Bool) => IfB [a] 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf [a] => bool -> [a] -> [a] -> [a] #

IfB a => IfB (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

ifB :: bool ~ BooleanOf (Dyn a) => bool -> Dyn a -> Dyn a -> Dyn a #

IfB a => IfB (z -> a) 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf (z -> a) => bool -> (z -> a) -> (z -> a) -> z -> a #

(bool ~ BooleanOf p, bool ~ BooleanOf q, IfB p, IfB q) => IfB (p, q) 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf (p, q) => bool -> (p, q) -> (p, q) -> (p, q) #

(Frp m, IfB a) => IfB (Dyn m a) 
Instance details

Defined in Dyna

Methods

ifB :: bool ~ BooleanOf (Dyn m a) => bool -> Dyn m a -> Dyn m a -> Dyn m a #

(AdditiveGroup v, HasBasis u, HasTrie (Basis u), IfB v) => IfB (u :> v) 
Instance details

Defined in Data.Maclaurin

Methods

ifB :: bool ~ BooleanOf (u :> v) => bool -> (u :> v) -> (u :> v) -> u :> v #

(bool ~ BooleanOf p, bool ~ BooleanOf q, bool ~ BooleanOf r, IfB p, IfB q, IfB r) => IfB (p, q, r) 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf (p, q, r) => bool -> (p, q, r) -> (p, q, r) -> (p, q, r) #

(bool ~ BooleanOf p, bool ~ BooleanOf q, bool ~ BooleanOf r, bool ~ BooleanOf s, IfB p, IfB q, IfB r, IfB s) => IfB (p, q, r, s) 
Instance details

Defined in Data.Boolean

Methods

ifB :: bool ~ BooleanOf (p, q, r, s) => bool -> (p, q, r, s) -> (p, q, r, s) -> (p, q, r, s) #

class Boolean (BooleanOf a) => EqB a where #

Types with equality. Minimum definition: (==*).

Minimal complete definition

(==*)

Methods

(==*) :: bool ~ BooleanOf a => a -> a -> bool infix 4 #

(/=*) :: bool ~ BooleanOf a => a -> a -> bool infix 4 #

Instances

Instances details
EqB Bool 
Instance details

Defined in Data.Boolean

Methods

(==*) :: bool ~ BooleanOf Bool => Bool -> Bool -> bool #

(/=*) :: bool ~ BooleanOf Bool => Bool -> Bool -> bool #

EqB Char 
Instance details

Defined in Data.Boolean

Methods

(==*) :: bool ~ BooleanOf Char => Char -> Char -> bool #

(/=*) :: bool ~ BooleanOf Char => Char -> Char -> bool #

EqB Double 
Instance details

Defined in Data.Boolean

Methods

(==*) :: bool ~ BooleanOf Double => Double -> Double -> bool #

(/=*) :: bool ~ BooleanOf Double => Double -> Double -> bool #

EqB Float 
Instance details

Defined in Data.Boolean

Methods

(==*) :: bool ~ BooleanOf Float => Float -> Float -> bool #

(/=*) :: bool ~ BooleanOf Float => Float -> Float -> bool #

EqB Int 
Instance details

Defined in Data.Boolean

Methods

(==*) :: bool ~ BooleanOf Int => Int -> Int -> bool #

(/=*) :: bool ~ BooleanOf Int => Int -> Int -> bool #

EqB Integer 
Instance details

Defined in Data.Boolean

Methods

(==*) :: bool ~ BooleanOf Integer => Integer -> Integer -> bool #

(/=*) :: bool ~ BooleanOf Integer => Integer -> Integer -> bool #

EqB a => EqB (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(==*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

(/=*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

EqB a => EqB (z -> a) 
Instance details

Defined in Data.Boolean

Methods

(==*) :: bool ~ BooleanOf (z -> a) => (z -> a) -> (z -> a) -> bool #

(/=*) :: bool ~ BooleanOf (z -> a) => (z -> a) -> (z -> a) -> bool #

(EqB a, Frp m) => EqB (Dyn m a) 
Instance details

Defined in Dyna

Methods

(==*) :: bool ~ BooleanOf (Dyn m a) => Dyn m a -> Dyn m a -> bool #

(/=*) :: bool ~ BooleanOf (Dyn m a) => Dyn m a -> Dyn m a -> bool #

class Boolean (BooleanOf a) => OrdB a where #

Types with inequality. Minimum definition: (<*).

Minimal complete definition

(<*)

Methods

(<*) :: bool ~ BooleanOf a => a -> a -> bool infix 4 #

(<=*) :: bool ~ BooleanOf a => a -> a -> bool infix 4 #

(>*) :: bool ~ BooleanOf a => a -> a -> bool infix 4 #

(>=*) :: bool ~ BooleanOf a => a -> a -> bool infix 4 #

Instances

Instances details
OrdB Bool 
Instance details

Defined in Data.Boolean

Methods

(<*) :: bool ~ BooleanOf Bool => Bool -> Bool -> bool #

(<=*) :: bool ~ BooleanOf Bool => Bool -> Bool -> bool #

(>*) :: bool ~ BooleanOf Bool => Bool -> Bool -> bool #

(>=*) :: bool ~ BooleanOf Bool => Bool -> Bool -> bool #

OrdB Char 
Instance details

Defined in Data.Boolean

Methods

(<*) :: bool ~ BooleanOf Char => Char -> Char -> bool #

(<=*) :: bool ~ BooleanOf Char => Char -> Char -> bool #

(>*) :: bool ~ BooleanOf Char => Char -> Char -> bool #

(>=*) :: bool ~ BooleanOf Char => Char -> Char -> bool #

OrdB Double 
Instance details

Defined in Data.Boolean

Methods

(<*) :: bool ~ BooleanOf Double => Double -> Double -> bool #

(<=*) :: bool ~ BooleanOf Double => Double -> Double -> bool #

(>*) :: bool ~ BooleanOf Double => Double -> Double -> bool #

(>=*) :: bool ~ BooleanOf Double => Double -> Double -> bool #

OrdB Float 
Instance details

Defined in Data.Boolean

Methods

(<*) :: bool ~ BooleanOf Float => Float -> Float -> bool #

(<=*) :: bool ~ BooleanOf Float => Float -> Float -> bool #

(>*) :: bool ~ BooleanOf Float => Float -> Float -> bool #

(>=*) :: bool ~ BooleanOf Float => Float -> Float -> bool #

OrdB Int 
Instance details

Defined in Data.Boolean

Methods

(<*) :: bool ~ BooleanOf Int => Int -> Int -> bool #

(<=*) :: bool ~ BooleanOf Int => Int -> Int -> bool #

(>*) :: bool ~ BooleanOf Int => Int -> Int -> bool #

(>=*) :: bool ~ BooleanOf Int => Int -> Int -> bool #

OrdB Integer 
Instance details

Defined in Data.Boolean

Methods

(<*) :: bool ~ BooleanOf Integer => Integer -> Integer -> bool #

(<=*) :: bool ~ BooleanOf Integer => Integer -> Integer -> bool #

(>*) :: bool ~ BooleanOf Integer => Integer -> Integer -> bool #

(>=*) :: bool ~ BooleanOf Integer => Integer -> Integer -> bool #

OrdB a => OrdB (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(<*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

(<=*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

(>*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

(>=*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

OrdB a => OrdB (z -> a) 
Instance details

Defined in Data.Boolean

Methods

(<*) :: bool ~ BooleanOf (z -> a) => (z -> a) -> (z -> a) -> bool #

(<=*) :: bool ~ BooleanOf (z -> a) => (z -> a) -> (z -> a) -> bool #

(>*) :: bool ~ BooleanOf (z -> a) => (z -> a) -> (z -> a) -> bool #

(>=*) :: bool ~ BooleanOf (z -> a) => (z -> a) -> (z -> a) -> bool #

(OrdB a, Frp m) => OrdB (Dyn m a) 
Instance details

Defined in Dyna

Methods

(<*) :: bool ~ BooleanOf (Dyn m a) => Dyn m a -> Dyn m a -> bool #

(<=*) :: bool ~ BooleanOf (Dyn m a) => Dyn m a -> Dyn m a -> bool #

(>*) :: bool ~ BooleanOf (Dyn m a) => Dyn m a -> Dyn m a -> bool #

(>=*) :: bool ~ BooleanOf (Dyn m a) => Dyn m a -> Dyn m a -> bool #

OrdB v => OrdB (u :> v) 
Instance details

Defined in Data.Maclaurin

Methods

(<*) :: bool ~ BooleanOf (u :> v) => (u :> v) -> (u :> v) -> bool #

(<=*) :: bool ~ BooleanOf (u :> v) => (u :> v) -> (u :> v) -> bool #

(>*) :: bool ~ BooleanOf (u :> v) => (u :> v) -> (u :> v) -> bool #

(>=*) :: bool ~ BooleanOf (u :> v) => (u :> v) -> (u :> v) -> bool #

liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d #

Lift a ternary function to actions.

Using ApplicativeDo: 'liftA3 f as bs cs' can be understood as the do expression

do a <- as
   b <- bs
   c <- cs
   pure (f a b c)

makeVisible :: Ord n => n -> EventM n () #

Request that the specified UI element be made visible on the next rendering. This is provided to allow event handlers to make visibility requests in the same way that the visible function does at rendering time.

suspendAndResume :: IO s -> EventM n (Next s) #

Suspend the event loop, save the terminal state, and run the specified action. When it returns an application state value, restore the terminal state, empty the rendering cache, redraw the application from the new state, and resume the event loop.

Note that any changes made to the terminal's input state are ignored when Brick resumes execution and are not preserved in the final terminal input state after the Brick application returns the terminal to the user.

halt :: s -> EventM n (Next s) #

Halt the event loop and return the specified application state as the final state value.

continueWithoutRedraw :: s -> EventM n (Next s) #

Continue running the event loop with the specified application state without redrawing the screen. This is faster than continue because it skips the redraw, but the drawback is that you need to be really sure that you don't want a screen redraw. If your state changed in a way that needs to be reflected on the screen, use continue. This function is for cases where you know that you did something that won't have an impact on the screen state and you want to save on redraw cost.

continue :: s -> EventM n (Next s) #

Continue running the event loop with the specified application state.

viewportScroll :: n -> ViewportScroll n #

Build a viewport scroller for the viewport with the specified name.

showCursorNamed :: Eq n => n -> [CursorLocation n] -> Maybe (CursorLocation n) #

Show the cursor with the specified resource name, if such a cursor location has been reported.

showFirstCursor :: s -> [CursorLocation n] -> Maybe (CursorLocation n) #

Always show the first cursor, if any, returned by the rendering process. This is a convenience function useful as an appChooseCursor value when a simple program has zero or more widgets that advertise a cursor position.

neverShowCursor :: s -> [CursorLocation n] -> Maybe (CursorLocation n) #

Ignore all requested cursor positions returned by the rendering process. This is a convenience function useful as an appChooseCursor value when a simple application has no need to position the cursor.

invalidateCache :: Ord n => EventM n () #

Invalidate the entire rendering cache.

invalidateCacheEntry :: Ord n => n -> EventM n () #

Invalidate the rendering cache entry with the specified resource name.

getVtyHandle :: EventM n Vty #

Get the Vty handle currently in use.

findClickedExtents :: (Int, Int) -> EventM n [Extent n] #

Given a mouse click location, return the extents intersected by the click. The returned extents are sorted such that the first extent in the list is the most specific extent and the last extent is the most generic (top-level). So if two extents A and B both intersected the mouse click but A contains B, then they would be returned [B, A].

lookupExtent :: Eq n => n -> EventM n (Maybe (Extent n)) #

Given a resource name, get the most recent rendering extent for the name (if any).

clickedExtent :: (Int, Int) -> Extent n -> Bool #

Did the specified mouse coordinates (column, row) intersect the specified extent?

lookupViewport :: Ord n => n -> EventM n (Maybe Viewport) #

Given a viewport name, get the viewport's size and offset information from the most recent rendering. Returns Nothing if no such state could be found, either because the name was invalid or because no rendering has occurred (e.g. in an appStartEvent handler). An important consequence of this behavior is that if this function is called before a viewport is rendered for the first time, no state will be found because the renderer only knows about viewports it has rendered in the most recent rendering. As a result, if you need to make viewport transformations before they are drawn for the first time, you may need to use viewportScroll and its associated functions without relying on this function. Those functions queue up scrolling requests that can be made in advance of the next rendering to affect the viewport.

customMainWithVty #

Arguments

:: Ord n 
=> Vty

The initial Vty handle to use.

-> IO Vty

An IO action to build a Vty handle. This is used to build a Vty handle whenever the event loop needs to reinitialize the terminal, e.g. on resume after suspension.

-> Maybe (BChan e)

An event channel for sending custom events to the event loop (you write to this channel, the event loop reads from it). Provide Nothing if you don't plan on sending custom events.

-> App s e n

The application.

-> s

The initial application state.

-> IO (s, Vty) 

Like customMain, except the last Vty handle used by the application is returned without being shut down with shutdown. This allows the caller to re-use the Vty handle for something else, such as another Brick application.

customMain #

Arguments

:: Ord n 
=> Vty

The initial Vty handle to use.

-> IO Vty

An IO action to build a Vty handle. This is used to build a Vty handle whenever the event loop needs to reinitialize the terminal, e.g. on resume after suspension.

-> Maybe (BChan e)

An event channel for sending custom events to the event loop (you write to this channel, the event loop reads from it). Provide Nothing if you don't plan on sending custom events.

-> App s e n

The application.

-> s

The initial application state.

-> IO s 

The custom event loop entry point to use when the simpler ones don't permit enough control. Returns the final application state after the application halts.

Note that this function guarantees that the terminal input state prior to the first Vty initialization is the terminal input state that is restored on shutdown (regardless of exceptions).

resizeOrQuit :: s -> BrickEvent n e -> EventM n (Next s) #

An event-handling function which continues execution of the event loop only when resize events occur; all other types of events trigger a halt. This is a convenience function useful as an appHandleEvent value for simple applications using the Event type that do not need to get more sophisticated user input.

simpleApp :: Widget n -> App s e n #

A simple application with reasonable defaults to be overridden as desired:

  • Draws only the specified widget
  • Quits on any event other than resizes
  • Has no start event handler
  • Provides no attribute map
  • Never shows any cursors

simpleMain #

Arguments

:: Ord n 
=> Widget n

The widget to draw.

-> IO () 

A simple main entry point which takes a widget and renders it. This event loop terminates when the user presses any key, but terminal resize events cause redraws.

defaultMain #

Arguments

:: Ord n 
=> App s e n

The application.

-> s

The initial application state.

-> IO s 

The default main entry point which takes an application and an initial state and returns the final state returned by a halt operation.

data App s e n #

The library application abstraction. Your application's operations are provided in an App and then the App is provided to one of the various main functions in this module. An application App s e n is in terms of an application state type s, an application event type e, and a resource name type n. In the simplest case e is unused (left polymorphic or set to ()), but you may define your own event type and use customMain to provide custom events. The state type s is the type of application state to be provided by you and iteratively modified by event handlers. The resource name type n is the type of names you can assign to rendering resources such as viewports and cursor locations. Your application must define this type.

Constructors

App 

Fields

  • appDraw :: s -> [Widget n]

    This function turns your application state into a list of widget layers. The layers are listed topmost first.

  • appChooseCursor :: s -> [CursorLocation n] -> Maybe (CursorLocation n)

    This function chooses which of the zero or more cursor locations reported by the rendering process should be selected as the one to use to place the cursor. If this returns Nothing, no cursor is placed. The rationale here is that many widgets may request a cursor placement but your application state is what you probably want to use to decide which one wins.

  • appHandleEvent :: s -> BrickEvent n e -> EventM n (Next s)

    This function takes the current application state and an event and returns an action to be taken and a corresponding transformed application state. Possible options are continue, continueWithoutRedraw, suspendAndResume, and halt.

  • appStartEvent :: s -> EventM n s

    This function gets called once just prior to the first drawing of your application. Here is where you can make initial scrolling requests, for example.

  • appAttrMap :: s -> AttrMap

    The attribute map that should be used during rendering.

data ViewportScroll n #

A viewport scrolling handle for managing the scroll state of viewports.

(<=>) #

Arguments

:: Widget n

Top

-> Widget n

Bottom

-> Widget n 

Vertical box layout: put the specified widgets one above the other in the specified order. Defers growth policies to the growth policies of both widgets. This operator is a binary version of vBox.

(<+>) #

Arguments

:: Widget n

Left

-> Widget n

Right

-> Widget n 

Horizontal box layout: put the specified widgets next to each other in the specified order. Defers growth policies to the growth policies of both widgets. This operator is a binary version of hBox.

visibleRegion :: Location -> DisplayRegion -> Widget n -> Widget n #

Similar to visible, request that a region (with the specified Location as its origin and DisplayRegion as its size) be made visible when it is rendered inside a viewport. The Location is relative to the specified widget's upper-left corner of (0, 0).

This does nothing if not rendered in a viewport.

visible :: Widget n -> Widget n #

Request that the specified widget be made visible when it is rendered inside a viewport. This permits widgets (whose sizes and positions cannot be known due to being embedded in arbitrary layouts) to make a request for a parent viewport to locate them and scroll enough to put them in view. This, together with viewport, is what makes the text editor and list widgets possible without making them deal with the details of scrolling state management.

This does nothing if not rendered in a viewport.

unsafeLookupViewport :: Ord n => n -> RenderM n (Maybe Viewport) #

Given a name, obtain the viewport for that name by consulting the viewport map in the rendering monad. NOTE! Some care must be taken when calling this function, since it only returns useful values after the viewport in question has been rendered. If you call this function during rendering before a viewport has been rendered, you may get nothing or you may get a stale version of the viewport. This is because viewports are updated during rendering and the one you are interested in may not have been rendered yet. So if you want to use this, be sure you know what you are doing.

horizontalScrollbar #

Arguments

:: Ord n 
=> ScrollbarRenderer n

The renderer to use.

-> n

The viewport name associated with this scroll bar.

-> Maybe (ClickableScrollbarElement -> n -> n)

Constructor for clickable scroll bar element names.

-> Bool

Whether to show handles.

-> Int

The total viewport width in effect.

-> Int

The viewport horizontal scrolling offset in effect.

-> Int

The total viewport content width.

-> Widget n 

Build a horizontal scroll bar using the specified render and settings.

You probably don't want to use this directly; instead, use viewport, withHScrollBars, and, if needed, withHScrollBarRenderer. This is exposed so that if you want to render a scroll bar of your own, you can do so outside the viewport context.

verticalScrollbar #

Arguments

:: Ord n 
=> ScrollbarRenderer n

The renderer to use.

-> n

The viewport name associated with this scroll bar.

-> Maybe (ClickableScrollbarElement -> n -> n)

Constructor for clickable scroll bar element names.

-> Bool

Whether to display handles.

-> Int

The total viewport height in effect.

-> Int

The viewport vertical scrolling offset in effect.

-> Int

The total viewport content height.

-> Widget n 

Build a vertical scroll bar using the specified render and settings.

You probably don't want to use this directly; instead, use viewport, withVScrollBars, and, if needed, withVScrollBarRenderer. This is exposed so that if you want to render a scroll bar of your own, you can do so outside the viewport context.

scrollbarHandleAttr :: AttrName #

The attribute for scroll bar handles. This attribute is a specialization of scrollbarAttr.

scrollbarTroughAttr :: AttrName #

The attribute for scroll bar troughs. This attribute is a specialization of scrollbarAttr.

scrollbarAttr :: AttrName #

The base attribute for scroll bars.

viewport #

Arguments

:: (Ord n, Show n) 
=> n

The name of the viewport (must be unique and stable for reliable behavior)

-> ViewportType

The type of viewport (indicates the permitted scrolling direction)

-> Widget n

The widget to be rendered in the scrollable viewport

-> Widget n 

Render the specified widget in a named viewport with the specified type. This permits widgets to be scrolled without being scrolling-aware. To make the most use of viewports, the specified widget should use the visible combinator to make a "visibility request". This viewport combinator will then translate the resulting rendering to make the requested region visible. In addition, the EventM monad provides primitives to scroll viewports created by this function if visible is not what you want.

This function can automatically render vertical and horizontal scroll bars if desired. To enable scroll bars, wrap your call to viewport with a call to withVScrollBars and/or withHScrollBars. If you don't like the appearance of the resulting scroll bars (defaults: verticalScrollbarRenderer and horizontalScrollbarRenderer), you can customize how they are drawn by making your own ScrollbarRenderer and using withVScrollBarRenderer and/or withHScrollBarRenderer. Note that when you enable scrollbars, the content of your viewport will lose one column of available space if vertical scroll bars are enabled and one row of available space if horizontal scroll bars are enabled.

If a viewport receives more than one visibility request, then the visibility requests are merged with the inner visibility request taking preference. If a viewport receives more than one scrolling request from EventM, all are honored in the order in which they are received.

Some caution should be advised when using this function. The viewport renders its contents anew each time the viewport is drawn; in many cases this is prohibitively expensive, and viewports should not be used to display large contents for scrolling. This function is best used when the contents are not too large OR when the contents are large and render-cacheable.

Also, be aware that there is a rich API for accessing viewport information from within the EventM monad; check the docs for Brick.Main to learn more about ways to get information about viewports after they're drawn.

horizontalScrollbarRenderer :: ScrollbarRenderer n #

The default renderer for horizontal viewport scroll bars. Override with withHScrollBarRenderer.

withHScrollBarRenderer :: ScrollbarRenderer n -> Widget n -> Widget n #

Render horizontal viewport scroll bars in the specified widget with the specified renderer. This is only needed if you want to override the use of the default renderer, horizontalScrollbarRenderer.

withHScrollBarHandles :: Widget n -> Widget n #

Enable scroll bar handles on all horizontal scroll bars in the specified widget. Handles appear at the ends of the scroll bar, representing the "handles" that are typically clickable in graphical UIs to move the scroll bar incrementally. Horizontal scroll bars are also clickable if mouse mode is enabled and if withClickableHScrollBars is used.

This will only have an effect if withHScrollBars is also called.

withClickableVScrollBars :: (ClickableScrollbarElement -> n -> n) -> Widget n -> Widget n #

Enable mouse click reporting on vertical scroll bars in the specified widget. This must be used with withVScrollBars. The provided function is used to build a resource name containing the scroll bar element clicked and the viewport name associated with the scroll bar. It is usually a data constructor of the n type.

withClickableHScrollBars :: (ClickableScrollbarElement -> n -> n) -> Widget n -> Widget n #

Enable mouse click reporting on horizontal scroll bars in the specified widget. This must be used with withHScrollBars. The provided function is used to build a resource name containing the scroll bar element clicked and the viewport name associated with the scroll bar. It is usually a data constructor of the n type.

withHScrollBars :: HScrollBarOrientation -> Widget n -> Widget n #

Enable horizontal scroll bars on all viewports in the specified widget and draw them with the specified orientation.

verticalScrollbarRenderer :: ScrollbarRenderer n #

The default renderer for vertical viewport scroll bars. Override with withVScrollBarRenderer.

withVScrollBarRenderer :: ScrollbarRenderer n -> Widget n -> Widget n #

Render vertical viewport scroll bars in the specified widget with the specified renderer. This is only needed if you want to override the use of the default renderer, verticalScrollbarRenderer.

withVScrollBarHandles :: Widget n -> Widget n #

Enable scroll bar handles on all vertical scroll bars in the specified widget. Handles appear at the ends of the scroll bar, representing the "handles" that are typically clickable in graphical UIs to move the scroll bar incrementally. Vertical scroll bars are also clickable if mouse mode is enabled and if withClickableVScrollBars is used.

This will only have an effect if withVScrollBars is also called.

withVScrollBars :: VScrollBarOrientation -> Widget n -> Widget n #

Enable vertical scroll bars on all viewports in the specified widget and draw them with the specified orientation.

cached :: Ord n => n -> Widget n -> Widget n #

If the specified resource name has an entry in the rendering cache, use the rendered version from the cache. If not, render the specified widget and update the cache with the result.

To ensure that mouse events are emitted correctly for cached widgets, in addition to the rendered widget, we also cache (the names of) any clickable extents that were rendered and restore that when utilizing the cache.

See also invalidateCacheEntry.

putCursor :: n -> Location -> Widget n -> Widget n #

When rendering the specified widget, also register a cursor positioning request using the specified name and location. The cursor will only be positioned but not made visible.

showCursor :: n -> Location -> Widget n -> Widget n #

When rendering the specified widget, also register a cursor positioning request using the specified name and location.

cropBottomTo :: Int -> Widget n -> Widget n #

Crop the specified widget to the specified size from the bottom. Defers to the cropped widget for growth policy.

cropBottomBy :: Int -> Widget n -> Widget n #

Crop the specified widget on the bottom by the specified number of rows. Defers to the cropped widget for growth policy.

cropTopTo :: Int -> Widget n -> Widget n #

Crop the specified widget to the specified size from the top. Defers to the cropped widget for growth policy.

cropTopBy :: Int -> Widget n -> Widget n #

Crop the specified widget on the top by the specified number of rows. Defers to the cropped widget for growth policy.

cropRightTo :: Int -> Widget n -> Widget n #

Crop the specified widget to the specified size from the right. Defers to the cropped widget for growth policy.

cropRightBy :: Int -> Widget n -> Widget n #

Crop the specified widget on the right by the specified number of columns. Defers to the cropped widget for growth policy.

cropLeftTo :: Int -> Widget n -> Widget n #

Crop the specified widget to the specified size from the left. Defers to the cropped widget for growth policy.

cropLeftBy :: Int -> Widget n -> Widget n #

Crop the specified widget on the left by the specified number of columns. Defers to the cropped widget for growth policy.

translateBy :: Location -> Widget n -> Widget n #

Translate the specified widget by the specified offset amount. Defers to the translated widget for growth policy.

raw :: Image -> Widget n #

Build a widget directly from a raw Vty image.

overrideAttr :: AttrName -> AttrName -> Widget n -> Widget n #

Override the lookup of the attribute name targetName to return the attribute value associated with fromName when rendering the specified widget.

For example:

   appAttrMap = attrMap (white on blue) [ ("highlight", fg yellow)
                                          , ("notice", fg red)
                                          ]

   renderA :: (String, String) -> [Widget n]
   renderA (a, b) = str a + str " is " + withAttr "highlight" (str b)

   render1 = withAttr "notice" $ renderA (Brick, "fun")
   render2 = overrideAttr "highlight" "notice" render1

In the example above, render1 will show Brick is fun where the first two words are red on a blue background, but fun is yellow on a blue background. However, render2 will show all three words in red on a blue background.

forceAttr :: AttrName -> Widget n -> Widget n #

When rendering the specified widget, force all attribute lookups in the attribute map to use the value currently assigned to the specified attribute name. This means that the attribute lookups will behave as if they all used the name specified here. That further means that the resolved attribute will still inherit from its parent entry in the attribute map as would normally be the case. If you want to have more control over the resulting attribute, consider modifyDefAttr.

For example:

   ...
   appAttrMap = attrMap (white on blue) [ ("highlight", fg yellow)
                                          , ("notice", fg red) ]
   ...

   renderA :: (String, String) -> [Widget n]
   renderA (a,b) = hBox [ withAttr "highlight" (str a)
                        , str " is "
                        , withAttr "highlight" (str b)
                        ]

   render1 = renderA (Brick, "fun")
   render2 = forceAttr "notice" render1

In the above, render1 will show "Brick is fun" where the first and last words are yellow on a blue background and the middle word is white on a blue background. However, render2 will show all words in red on a blue background. In both versions, the middle word will be in white on a blue background.

updateAttrMap :: (AttrMap -> AttrMap) -> Widget n -> Widget n #

While rendering the specified widget, use a transformed version of the current attribute map. This is a very general function with broad capabilities: you probably want a more specific function such as withDefAttr or withAttr.

withDefAttr :: AttrName -> Widget n -> Widget n #

Update the attribute map used while rendering the specified widget (and any sub-widgets): set its new *default* attribute (i.e. the attribute components that will be applied if not overridden by any more specific attributes) to the one that we get by looking up the specified attribute name in the map.

For example:

   ...
   appAttrMap = attrMap (white on blue) [ ("highlight", fg yellow)
                                          , ("warning", bg magenta)
                                          , ("good", white on green) ]
   ...

   renderA :: (String, String) -> [Widget n]
   renderA (a,b) = hBox [ withAttr "good" (str a)
                        , str " is "
                        , withAttr "highlight" (str b) ]

   render1 = renderA (Brick, "fun")
   render2 = withDefAttr "warning" render1

In the above, render1 will show "Brick is fun" where the first word is white on a green background, the middle word is white on a blue background, and the last word is yellow on a blue background. However, render2 will show the first word in the same colors but the middle word will be shown in whatever the terminal's normal foreground is on a magenta background, and the third word will be yellow on a magenta background.

modifyDefAttr :: (Attr -> Attr) -> Widget n -> Widget n #

Update the attribute map while rendering the specified widget: set the map's default attribute to the one that we get by applying the specified function to the current map's default attribute. This is a variant of withDefAttr; see the latter for more information.

withAttr :: AttrName -> Widget n -> Widget n #

When drawing the specified widget, set the attribute used for drawing to the one with the specified name. Note that the widget may use further calls to withAttr to change the active drawing attribute, so this only takes effect if nothing in the specified widget invokes withAttr. If you want to prevent that, use forceAttr. Attributes used this way still get merged hierarchically and still fall back to the attribute map's default attribute. If you want to change the default attribute, use withDefAttr.

For example:

   appAttrMap = attrMap (white on blue) [ ("highlight", fg yellow)
                                          , ("warning", bg magenta)
                                          ]

   renderA :: (String, String) -> [Widget n]
   renderA (a,b) = hBox [ str a
                        , str " is "
                        , withAttr "highlight" (str b)
                        ]

   render1 = renderA (Brick, "fun")
   render2 = withAttr "warning" render1

In the example above, render1 will show Brick is fun where the first two words are white on a blue background and the last word is yellow on a blue background. However, render2 will show the first two words in white on magenta although the last word is still rendered in yellow on blue.

setAvailableSize :: (Int, Int) -> Widget n -> Widget n #

Set the rendering context height and width for this widget. This is useful for relaxing the rendering size constraints on e.g. layer widgets where cropping to the screen size is undesirable.

vLimitPercent :: Int -> Widget n -> Widget n #

Limit the space available to the specified widget to the specified percentage of available height, as a value between 0 and 100 inclusive. Values outside the valid range will be clamped to the range endpoints. This is important for constraining the vertical growth of otherwise-greedy widgets. This is non-greedy vertically and defers to the limited widget horizontally.

vLimit :: Int -> Widget n -> Widget n #

Limit the space available to the specified widget to the specified number of rows. This is important for constraining the vertical growth of otherwise-greedy widgets. This is non-greedy vertically and defers to the limited widget horizontally.

hLimitPercent :: Int -> Widget n -> Widget n #

Limit the space available to the specified widget to the specified percentage of available width, as a value between 0 and 100 inclusive. Values outside the valid range will be clamped to the range endpoints. This is important for constraining the horizontal growth of otherwise-greedy widgets. This is non-greedy horizontally and defers to the limited widget vertically.

hLimit :: Int -> Widget n -> Widget n #

Limit the space available to the specified widget to the specified number of columns. This is important for constraining the horizontal growth of otherwise-greedy widgets. This is non-greedy horizontally and defers to the limited widget vertically.

hBox :: [Widget n] -> Widget n #

Horizontal box layout: put the specified widgets next to each other in the specified order (leftmost first). Defers growth policies to the growth policies of the contained widgets (if any are greedy, so is the box).

vBox :: [Widget n] -> Widget n #

Vertical box layout: put the specified widgets one above the other in the specified order (uppermost first). Defers growth policies to the growth policies of the contained widgets (if any are greedy, so is the box).

fill :: Char -> Widget n #

Fill all available space with the specified character. Grows both horizontally and vertically.

padAll :: Int -> Widget n -> Widget n #

Pad a widget on all sides. Defers to the padded widget for growth policy.

padTopBottom :: Int -> Widget n -> Widget n #

Pad a widget on the top and bottom. Defers to the padded widget for growth policy.

padLeftRight :: Int -> Widget n -> Widget n #

Pad a widget on the left and right. Defers to the padded widget for growth policy.

padBottom :: Padding -> Widget n -> Widget n #

Pad the specified widget on the bottom. If max padding is used, this grows greedily vertically; otherwise it defers to the padded widget.

padTop :: Padding -> Widget n -> Widget n #

Pad the specified widget on the top. If max padding is used, this grows greedily vertically; otherwise it defers to the padded widget.

padRight :: Padding -> Widget n -> Widget n #

Pad the specified widget on the right. If max padding is used, this grows greedily horizontally; otherwise it defers to the padded widget.

padLeft :: Padding -> Widget n -> Widget n #

Pad the specified widget on the left. If max padding is used, this grows greedily horizontally; otherwise it defers to the padded widget.

hyperlink :: Text -> Widget n -> Widget n #

Hyperlink the given widget to the specified URL. Not all terminal emulators support this. In those that don't, this should have no discernible effect.

txt :: Text -> Widget n #

Build a widget from a Text value. Behaves the same as str when the input contains multiple lines.

The input string must not contain tab characters. If it does, interface corruption will result since the terminal will likely render it as taking up more than a single column. The caller should replace tabs with the appropriate number of spaces as desired. The input text should not contain escape sequences or carriage returns.

str :: String -> Widget n #

Build a widget from a String. Breaks newlines up and space-pads short lines out to the length of the longest line.

The input string must not contain tab characters. If it does, interface corruption will result since the terminal will likely render it as taking up more than a single column. The caller should replace tabs with the appropriate number of spaces as desired. The input string should not contain escape sequences or carriage returns.

txtWrapWith :: WrapSettings -> Text -> Widget n #

Make a widget from text, but wrap the words in the input's lines at the available width using the specified wrapping settings. The input text should not contain escape sequences or carriage returns.

Unlike txt, this is greedy horizontally.

txtWrap :: Text -> Widget n #

Make a widget from text, but wrap the words in the input's lines at the available width using the default wrapping settings. The input text should not contain escape sequences or carriage returns.

Unlike txt, this is greedy horizontally.

strWrapWith :: WrapSettings -> String -> Widget n #

Make a widget from a string, but wrap the words in the input's lines at the available width using the specified wrapping settings. The input string should not contain escape sequences or carriage returns.

Unlike str, this is greedy horizontally.

strWrap :: String -> Widget n #

Make a widget from a string, but wrap the words in the input's lines at the available width using the default wrapping settings. The input string should not contain escape sequences or carriage returns.

Unlike str, this is greedy horizontally.

clickable :: Ord n => n -> Widget n -> Widget n #

Request mouse click events on the specified widget.

Regions used with clickable can be scrolled into view with makeVisible.

reportExtent :: Ord n => n -> Widget n -> Widget n #

Render the specified widget and record its rendering extent using the specified name (see also lookupExtent).

This function is the counterpart to makeVisible; any visibility requests made with makeVisible must have a corresponding reportExtent in order to work. The clickable function will also work for this purpose to tell the renderer about the clickable region.

addResultOffset :: Location -> Result n -> Result n #

Add an offset to all cursor locations, visbility requests, and extents in the specified rendering result. This function is critical for maintaining correctness in the rendering results as they are processed successively by box layouts and other wrapping combinators, since calls to this function result in converting from widget-local coordinates to (ultimately) terminal-global ones so they can be used by other combinators. You should call this any time you render something and then translate it or otherwise offset it from its original origin.

emptyWidget :: Widget n #

The empty widget.

freezeBorders :: Widget n -> Widget n #

After the specified widget has been rendered, freeze its borders. A frozen border will not be affected by neighbors, nor will it affect neighbors. Compared to separateBorders, freezeBorders will not affect whether borders connect internally to a widget (whereas separateBorders prevents them from connecting).

Frozen borders cannot be thawed.

separateBorders :: Widget n -> Widget n #

When rendering the specified widget, use static borders. This may be marginally faster, but will introduce a small gap between neighboring orthogonal borders.

This is the default for backwards compatibility.

joinBorders :: Widget n -> Widget n #

When rendering the specified widget, create borders that respond dynamically to their neighbors to form seamless connections.

withBorderStyle :: BorderStyle -> Widget n -> Widget n #

When rendering the specified widget, use the specified border style for any border rendering.

class TextWidth a where #

The class of text types that have widths measured in terminal columns. NEVER use length etc. to measure the length of a string if you need to compute how much screen space it will occupy; always use textWidth.

Methods

textWidth :: a -> Int #

Instances

Instances details
TextWidth Text 
Instance details

Defined in Brick.Widgets.Core

Methods

textWidth :: Text -> Int #

Foldable f => TextWidth (f Char) 
Instance details

Defined in Brick.Widgets.Core

Methods

textWidth :: f Char -> Int #

class Named a n where #

The class of types that store interface element names.

Methods

getName :: a -> n #

Get the name of the specified value.

cropToContext :: Widget n -> Widget n #

After rendering the specified widget, crop its result image to the dimensions in the rendering context.

lookupAttrName :: AttrName -> RenderM n Attr #

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

attrL :: Getting r (Context n) Attr #

The rendering context's current drawing attribute.

handleEventLensed #

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.

data Padding #

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.

newtype EventM n a #

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

Instances

Instances details
Monad (EventM n) 
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) 
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) 
Instance details

Defined in Brick.Types

Methods

fail :: String -> EventM n a #

Applicative (EventM n) 
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 #

MonadIO (EventM n) 
Instance details

Defined in Brick.Types

Methods

liftIO :: IO a -> EventM n a #

MonadThrow (EventM n) 
Instance details

Defined in Brick.Types

Methods

throwM :: Exception e => e -> EventM n a #

MonadCatch (EventM n) 
Instance details

Defined in Brick.Types

Methods

catch :: Exception e => EventM n a -> (e -> EventM n a) -> EventM n a #

MonadMask (EventM n) 
Instance details

Defined in Brick.Types

Methods

mask :: ((forall a. EventM n a -> EventM n a) -> EventM n b) -> EventM n b #

uninterruptibleMask :: ((forall a. EventM n a -> EventM n a) -> EventM n b) -> EventM n b #

generalBracket :: EventM n a -> (a -> ExitCase b -> EventM n c) -> (a -> EventM n b) -> EventM n (b, c) #

clOffset :: CursorLocation n -> Location -> CursorLocation n #

Add a Location offset to the specified CursorLocation.

bg :: Color -> Attr #

Create an attribute from the specified background color (the background color is the "default").

fg :: Color -> Attr #

Create an attribute from the specified foreground color (the background color is the "default").

on #

Arguments

:: Color

The foreground color

-> Color

The background color

-> Attr 

Build an attribute from a foreground color and a background color. Intended to be used infix.

clamp #

Arguments

:: Ord a 
=> a

The minimum value

-> a

The maximum value

-> a

The value to clamp

-> a 

Given a minimum value and a maximum value, clamp a value to that range (values less than the minimum map to the minimum and values greater than the maximum map to the maximum).

>>> clamp 1 10 11
10
>>> clamp 1 10 2
2
>>> clamp 5 10 1
5

getContext :: RenderM n (Context n) #

Get the current rendering context.

data Size #

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 
Instance details

Defined in Brick.Types.Internal

Methods

(==) :: Size -> Size -> Bool #

(/=) :: Size -> Size -> Bool #

Ord Size 
Instance details

Defined in Brick.Types.Internal

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 
Instance details

Defined in Brick.Types.Internal

Methods

showsPrec :: Int -> Size -> ShowS #

show :: Size -> String #

showList :: [Size] -> ShowS #

data Widget n #

The type of widgets.

Constructors

Widget 

Fields

data RenderState n #

Instances

Instances details
(Ord n, Read n) => Read (RenderState n) 
Instance details

Defined in Brick.Types.Internal

Show n => Show (RenderState n) 
Instance details

Defined in Brick.Types.Internal

Generic (RenderState n) 
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) 
Instance details

Defined in Brick.Types.Internal

Methods

rnf :: RenderState n -> () #

type Rep (RenderState n) 
Instance details

Defined in Brick.Types.Internal

type Rep (RenderState n) = D1 ('MetaData "RenderState" "Brick.Types.Internal" "brick-0.68.1-CVaBpv5Fx673dDbo389k7Y" 'False) (C1 ('MetaCons "RS" 'PrefixI 'True) ((S1 ('MetaSel ('Just "viewportMap") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map n Viewport)) :*: (S1 ('MetaSel ('Just "rsScrollRequests") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [(n, ScrollRequest)]) :*: S1 ('MetaSel ('Just "observedNames") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set n)))) :*: (S1 ('MetaSel ('Just "renderCache") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map n ([n], Result n))) :*: (S1 ('MetaSel ('Just "clickableNames") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [n]) :*: S1 ('MetaSel ('Just "requestedVisibleNames_") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set n))))))

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

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.

data VScrollBarOrientation #

Orientations for vertical scroll bars.

Constructors

OnLeft 
OnRight 

data HScrollBarOrientation #

Orientations for horizontal scroll bars.

Constructors

OnBottom 
OnTop 

data ScrollbarRenderer n #

A scroll bar renderer.

Constructors

ScrollbarRenderer 

Fields

  • renderScrollbar :: Widget n

    How to render the body of the scroll bar. This should provide a widget that expands in whatever direction(s) this renderer will be used for. So, for example, if this was used to render vertical scroll bars, this widget would need to be one that expands vertically such as fill. The same goes for the trough widget.

  • renderScrollbarTrough :: Widget n

    How to render the "trough" of the scroll bar (the area to either side of the scroll bar body). This should expand as described in the documentation for the scroll bar field.

  • renderScrollbarHandleBefore :: Widget n

    How to render the handle that appears at the top or left of the scrollbar. The result should be at most one row high for horizontal handles and one column wide for vertical handles.

  • renderScrollbarHandleAfter :: Widget n

    How to render the handle that appears at the bottom or right of the scrollbar. The result should be at most one row high for horizontal handles and one column wide for vertical handles.

data VisibilityRequest #

Constructors

VR 

Instances

Instances details
Eq VisibilityRequest 
Instance details

Defined in Brick.Types.Internal

Read VisibilityRequest 
Instance details

Defined in Brick.Types.Internal

Show VisibilityRequest 
Instance details

Defined in Brick.Types.Internal

Generic VisibilityRequest 
Instance details

Defined in Brick.Types.Internal

Associated Types

type Rep VisibilityRequest :: Type -> Type #

NFData VisibilityRequest 
Instance details

Defined in Brick.Types.Internal

Methods

rnf :: VisibilityRequest -> () #

type Rep VisibilityRequest 
Instance details

Defined in Brick.Types.Internal

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

data Viewport #

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

Constructors

VP 

Fields

Instances

Instances details
Read Viewport 
Instance details

Defined in Brick.Types.Internal

Show Viewport 
Instance details

Defined in Brick.Types.Internal

Generic Viewport 
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 
Instance details

Defined in Brick.Types.Internal

Methods

rnf :: Viewport -> () #

type Rep Viewport 
Instance details

Defined in Brick.Types.Internal

data ViewportType #

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 
Instance details

Defined in Brick.Types.Internal

Show ViewportType 
Instance details

Defined in Brick.Types.Internal

data Extent n #

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

Constructors

Extent 

Instances

Instances details
Read n => Read (Extent n) 
Instance details

Defined in Brick.Types.Internal

Show n => Show (Extent n) 
Instance details

Defined in Brick.Types.Internal

Methods

showsPrec :: Int -> Extent n -> ShowS #

show :: Extent n -> String #

showList :: [Extent n] -> ShowS #

Generic (Extent n) 
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) 
Instance details

Defined in Brick.Types.Internal

Methods

rnf :: Extent n -> () #

type Rep (Extent n) 
Instance details

Defined in Brick.Types.Internal

type Rep (Extent n) = D1 ('MetaData "Extent" "Brick.Types.Internal" "brick-0.68.1-CVaBpv5Fx673dDbo389k7Y" '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)))))

data Next a #

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

Instances

Instances details
Functor Next 
Instance details

Defined in Brick.Types.Internal

Methods

fmap :: (a -> b) -> Next a -> Next b #

(<$) :: a -> Next b -> Next a #

data Direction #

Scrolling direction.

Constructors

Up

Up/left

Down

Down/right

Instances

Instances details
Eq Direction 
Instance details

Defined in Brick.Types.Internal

Read Direction 
Instance details

Defined in Brick.Types.Internal

Show Direction 
Instance details

Defined in Brick.Types.Internal

Generic Direction 
Instance details

Defined in Brick.Types.Internal

Associated Types

type Rep Direction :: Type -> Type #

NFData Direction 
Instance details

Defined in Brick.Types.Internal

Methods

rnf :: Direction -> () #

type Rep Direction 
Instance details

Defined in Brick.Types.Internal

type Rep Direction = D1 ('MetaData "Direction" "Brick.Types.Internal" "brick-0.68.1-CVaBpv5Fx673dDbo389k7Y" 'False) (C1 ('MetaCons "Up" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Down" 'PrefixI 'False) (U1 :: Type -> Type))

class TerminalLocation a where #

The class of types that behave like terminal locations.

Methods

locationColumnL :: Lens' a Int #

Get the column out of the value

locationColumn :: a -> Int #

locationRowL :: Lens' a Int #

Get the row out of the value

locationRow :: a -> Int #

data CursorLocation n #

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

Constructors

CursorLocation 

Fields

Instances

Instances details
Read n => Read (CursorLocation n) 
Instance details

Defined in Brick.Types.Internal

Show n => Show (CursorLocation n) 
Instance details

Defined in Brick.Types.Internal

Generic (CursorLocation n) 
Instance details

Defined in Brick.Types.Internal

Associated Types

type Rep (CursorLocation n) :: Type -> Type #

NFData n => NFData (CursorLocation n) 
Instance details

Defined in Brick.Types.Internal

Methods

rnf :: CursorLocation n -> () #

type Rep (CursorLocation n) 
Instance details

Defined in Brick.Types.Internal

type Rep (CursorLocation n) = D1 ('MetaData "CursorLocation" "Brick.Types.Internal" "brick-0.68.1-CVaBpv5Fx673dDbo389k7Y" '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)) :*: S1 ('MetaSel ('Just "cursorLocationVisible") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))))

data BorderSegment #

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 
Instance details

Defined in Brick.Types.Internal

Ord BorderSegment 
Instance details

Defined in Brick.Types.Internal

Read BorderSegment 
Instance details

Defined in Brick.Types.Internal

Show BorderSegment 
Instance details

Defined in Brick.Types.Internal

Generic BorderSegment 
Instance details

Defined in Brick.Types.Internal

Associated Types

type Rep BorderSegment :: Type -> Type #

NFData BorderSegment 
Instance details

Defined in Brick.Types.Internal

Methods

rnf :: BorderSegment -> () #

type Rep BorderSegment 
Instance details

Defined in Brick.Types.Internal

type Rep BorderSegment = D1 ('MetaData "BorderSegment" "Brick.Types.Internal" "brick-0.68.1-CVaBpv5Fx673dDbo389k7Y" '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))))

data DynBorder #

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

Constructors

DynBorder 

Fields

Instances

Instances details
Eq DynBorder 
Instance details

Defined in Brick.Types.Internal

Read DynBorder 
Instance details

Defined in Brick.Types.Internal

Show DynBorder 
Instance details

Defined in Brick.Types.Internal

Generic DynBorder 
Instance details

Defined in Brick.Types.Internal

Associated Types

type Rep DynBorder :: Type -> Type #

NFData DynBorder 
Instance details

Defined in Brick.Types.Internal

Methods

rnf :: DynBorder -> () #

type Rep DynBorder 
Instance details

Defined in Brick.Types.Internal

type Rep DynBorder = D1 ('MetaData "DynBorder" "Brick.Types.Internal" "brick-0.68.1-CVaBpv5Fx673dDbo389k7Y" '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)))))

data Result n #

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

Instances

Instances details
Read n => Read (Result n) 
Instance details

Defined in Brick.Types.Internal

Show n => Show (Result n) 
Instance details

Defined in Brick.Types.Internal

Methods

showsPrec :: Int -> Result n -> ShowS #

show :: Result n -> String #

showList :: [Result n] -> ShowS #

Generic (Result n) 
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) 
Instance details

Defined in Brick.Types.Internal

Methods

rnf :: Result n -> () #

type Rep (Result n) 
Instance details

Defined in Brick.Types.Internal

data BrickEvent n e #

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) 
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) 
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) 
Instance details

Defined in Brick.Types.Internal

Methods

showsPrec :: Int -> BrickEvent n e -> ShowS #

show :: BrickEvent n e -> String #

showList :: [BrickEvent n e] -> ShowS #

data Context n #

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.

eTopL :: Lens' (Edges a) a #

eRightL :: Lens' (Edges a) a #

eLeftL :: Lens' (Edges a) a #

data Edges a #

Constructors

Edges 

Fields

Instances

Instances details
Monad Edges 
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 
Instance details

Defined in Brick.Types.Common

Methods

fmap :: (a -> b) -> Edges a -> Edges b #

(<$) :: a -> Edges b -> Edges a #

Applicative Edges 
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) 
Instance details

Defined in Brick.Types.Common

Methods

(==) :: Edges a -> Edges a -> Bool #

(/=) :: Edges a -> Edges a -> Bool #

Ord a => Ord (Edges a) 
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) 
Instance details

Defined in Brick.Types.Common

Show a => Show (Edges a) 
Instance details

Defined in Brick.Types.Common

Methods

showsPrec :: Int -> Edges a -> ShowS #

show :: Edges a -> String #

showList :: [Edges a] -> ShowS #

Generic (Edges a) 
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) 
Instance details

Defined in Brick.Types.Common

Methods

rnf :: Edges a -> () #

type Rep (Edges a) 
Instance details

Defined in Brick.Types.Common

type Rep (Edges a) = D1 ('MetaData "Edges" "Brick.Types.Common" "brick-0.68.1-CVaBpv5Fx673dDbo389k7Y" '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))))

data Location #

A terminal screen location.

Constructors

Location 

Fields

Instances

Instances details
Eq Location 
Instance details

Defined in Brick.Types.Common

Ord Location 
Instance details

Defined in Brick.Types.Common

Read Location 
Instance details

Defined in Brick.Types.Common

Show Location 
Instance details

Defined in Brick.Types.Common

Generic Location 
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 
Instance details

Defined in Brick.Types.Common

Monoid Location 
Instance details

Defined in Brick.Types.Common

TerminalLocation Location 
Instance details

Defined in Brick.Types.Internal

NFData Location 
Instance details

Defined in Brick.Types.Common

Methods

rnf :: Location -> () #

Field1 Location Location Int Int 
Instance details

Defined in Brick.Types.Common

Field2 Location Location Int Int 
Instance details

Defined in Brick.Types.Common

type Rep Location 
Instance details

Defined in Brick.Types.Common

type Rep Location = D1 ('MetaData "Location" "Brick.Types.Common" "brick-0.68.1-CVaBpv5Fx673dDbo389k7Y" 'False) (C1 ('MetaCons "Location" 'PrefixI 'True) (S1 ('MetaSel ('Just "loc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Int, Int))))

suffixLensesWith :: String -> LensRules -> Name -> DecsQ #

A more general version of suffixLenses that allows customization of the lens-building rules and allows customization of the suffix.

suffixLenses :: Name -> DecsQ #

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.

mapAttrNames :: [(AttrName, AttrName)] -> AttrMap -> AttrMap #

Map several attributes to return the value associated with an alternate name. Applies mapAttrName across a list of mappings.

mapAttrName :: AttrName -> AttrName -> AttrMap -> AttrMap #

Update an attribute map such that a lookup of ontoName returns the attribute value specified by fromName. This is useful for composite widgets with specific attribute names mapping those names to the sub-widget's expected name when calling that sub-widget's rendering function. See the ProgressBarDemo for an example usage, and overrideAttr for an alternate syntax.

applyAttrMappings :: [(AttrName, Attr)] -> AttrMap -> AttrMap #

Insert a set of attribute mappings to an attribute map.

getDefaultAttr :: AttrMap -> Attr #

Get the default attribute value in an attribute map.

setDefaultAttr :: Attr -> AttrMap -> AttrMap #

Set the default attribute value in an attribute map.

attrMapLookup :: AttrName -> AttrMap -> Attr #

Look up the specified attribute name in the map. Map lookups proceed as follows. If the attribute map is forcing all lookups to a specific attribute, that attribute is returned along with its style settings. If the attribute name is empty, the map's default attribute is returned. If the attribute name is non-empty, every subsequence of names from the specified name are used to perform a lookup and the results are combined as in mergeWithDefault, with more specific results taking precedence over less specific ones. As attributes are merged, styles are also merged. If a more specific attribute name introduces a style (underline, say) and a less specific attribute name introduces an additional style (bold, say) then the final result will include both styles.

For example:

attrMapLookup ("foo" <> "bar") (attrMap a []) == a
attrMapLookup ("foo" <> "bar") (attrMap (bg blue) [("foo" <> "bar", fg red)]) == red `on` blue
attrMapLookup ("foo" <> "bar") (attrMap (bg blue) [("foo" <> "bar", red on cyan)]) == red `on` cyan
attrMapLookup ("foo" <> "bar") (attrMap (bg blue) [("foo" <> "bar", fg red), ("foo", bg cyan)]) == red `on` cyan
attrMapLookup ("foo" <> "bar") (attrMap (bg blue) [("foo", fg red)]) == red `on` blue

mergeWithDefault :: Attr -> AttrMap -> Attr #

Given an attribute and a map, merge the attribute with the map's default attribute. If the map is forcing all lookups to a specific attribute, the forced attribute is returned without merging it with the one specified here. Otherwise the attribute given here is merged with the attribute map's default attribute in that any aspect of the specified attribute that is not provided falls back to the map default. For example,

mergeWithDefault (fg blue) $ attrMap (bg red) []

returns

blue `on` red

forceAttrMap :: Attr -> AttrMap #

Create an attribute map in which all lookups map to the same attribute. This is functionally equivalent to AttrMap attr [].

attrMap #

Arguments

:: Attr

The map's default attribute to be returned when a name lookup fails, and the attribute that will be merged with successful lookups.

-> [(AttrName, Attr)]

The map's initial contents.

-> AttrMap 

Create an attribute map.

attrNameComponents :: AttrName -> [String] #

Get the components of an attribute name.

attrName :: String -> AttrName #

Create an attribute name from a string.

data AttrName #

An attribute name. Attribute names are hierarchical; use mappend (<>) to assemble them. Hierarchy in an attribute name is used to represent increasing levels of specificity in referring to the attribute you want to use for a visual element, with names to the left being general and names to the right being more specific. For example:

"window" <> "border"
"window" <> "title"
"header" <> "clock" <> "seconds"

Instances

Instances details
Eq AttrName 
Instance details

Defined in Brick.AttrMap

Ord AttrName 
Instance details

Defined in Brick.AttrMap

Read AttrName 
Instance details

Defined in Brick.AttrMap

Show AttrName 
Instance details

Defined in Brick.AttrMap

IsString AttrName 
Instance details

Defined in Brick.AttrMap

Generic AttrName 
Instance details

Defined in Brick.AttrMap

Associated Types

type Rep AttrName :: Type -> Type #

Methods

from :: AttrName -> Rep AttrName x #

to :: Rep AttrName x -> AttrName #

Semigroup AttrName 
Instance details

Defined in Brick.AttrMap

Monoid AttrName 
Instance details

Defined in Brick.AttrMap

NFData AttrName 
Instance details

Defined in Brick.AttrMap

Methods

rnf :: AttrName -> () #

type Rep AttrName 
Instance details

Defined in Brick.AttrMap

type Rep AttrName = D1 ('MetaData "AttrName" "Brick.AttrMap" "brick-0.68.1-CVaBpv5Fx673dDbo389k7Y" 'False) (C1 ('MetaCons "AttrName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String])))

data AttrMap #

An attribute map which maps AttrName values to Attr values.

Instances

Instances details
Show AttrMap 
Instance details

Defined in Brick.AttrMap

Generic AttrMap 
Instance details

Defined in Brick.AttrMap

Associated Types

type Rep AttrMap :: Type -> Type #

Methods

from :: AttrMap -> Rep AttrMap x #

to :: Rep AttrMap x -> AttrMap #

NFData AttrMap 
Instance details

Defined in Brick.AttrMap

Methods

rnf :: AttrMap -> () #

type Rep AttrMap 
Instance details

Defined in Brick.AttrMap

class Default a where #

A class for types with a default value.

Minimal complete definition

Nothing

Methods

def :: a #

The default value for this type.

Instances

Instances details
Default Double 
Instance details

Defined in Data.Default.Class

Methods

def :: Double #

Default Float 
Instance details

Defined in Data.Default.Class

Methods

def :: Float #

Default Int 
Instance details

Defined in Data.Default.Class

Methods

def :: Int #

Default Int8 
Instance details

Defined in Data.Default.Class

Methods

def :: Int8 #

Default Int16 
Instance details

Defined in Data.Default.Class

Methods

def :: Int16 #

Default Int32 
Instance details

Defined in Data.Default.Class

Methods

def :: Int32 #

Default Int64 
Instance details

Defined in Data.Default.Class

Methods

def :: Int64 #

Default Integer 
Instance details

Defined in Data.Default.Class

Methods

def :: Integer #

Default Ordering 
Instance details

Defined in Data.Default.Class

Methods

def :: Ordering #

Default Word 
Instance details

Defined in Data.Default.Class

Methods

def :: Word #

Default Word8 
Instance details

Defined in Data.Default.Class

Methods

def :: Word8 #

Default Word16 
Instance details

Defined in Data.Default.Class

Methods

def :: Word16 #

Default Word32 
Instance details

Defined in Data.Default.Class

Methods

def :: Word32 #

Default Word64 
Instance details

Defined in Data.Default.Class

Methods

def :: Word64 #

Default () 
Instance details

Defined in Data.Default.Class

Methods

def :: () #

Default All 
Instance details

Defined in Data.Default.Class

Methods

def :: All #

Default Any 
Instance details

Defined in Data.Default.Class

Methods

def :: Any #

Default CShort 
Instance details

Defined in Data.Default.Class

Methods

def :: CShort #

Default CUShort 
Instance details

Defined in Data.Default.Class

Methods

def :: CUShort #

Default CInt 
Instance details

Defined in Data.Default.Class

Methods

def :: CInt #

Default CUInt 
Instance details

Defined in Data.Default.Class

Methods

def :: CUInt #

Default CLong 
Instance details

Defined in Data.Default.Class

Methods

def :: CLong #

Default CULong 
Instance details

Defined in Data.Default.Class

Methods

def :: CULong #

Default CLLong 
Instance details

Defined in Data.Default.Class

Methods

def :: CLLong #

Default CULLong 
Instance details

Defined in Data.Default.Class

Methods

def :: CULLong #

Default CFloat 
Instance details

Defined in Data.Default.Class

Methods

def :: CFloat #

Default CDouble 
Instance details

Defined in Data.Default.Class

Methods

def :: CDouble #

Default CPtrdiff 
Instance details

Defined in Data.Default.Class

Methods

def :: CPtrdiff #

Default CSize 
Instance details

Defined in Data.Default.Class

Methods

def :: CSize #

Default CSigAtomic 
Instance details

Defined in Data.Default.Class

Methods

def :: CSigAtomic #

Default CClock 
Instance details

Defined in Data.Default.Class

Methods

def :: CClock #

Default CTime 
Instance details

Defined in Data.Default.Class

Methods

def :: CTime #

Default CUSeconds 
Instance details

Defined in Data.Default.Class

Methods

def :: CUSeconds #

Default CSUSeconds 
Instance details

Defined in Data.Default.Class

Methods

def :: CSUSeconds #

Default CIntPtr 
Instance details

Defined in Data.Default.Class

Methods

def :: CIntPtr #

Default CUIntPtr 
Instance details

Defined in Data.Default.Class

Methods

def :: CUIntPtr #

Default CIntMax 
Instance details

Defined in Data.Default.Class

Methods

def :: CIntMax #

Default CUIntMax 
Instance details

Defined in Data.Default.Class

Methods

def :: CUIntMax #

Default Spec Source # 
Instance details

Defined in Dyna.Brick.Run

Methods

def :: Spec #

Default [a] 
Instance details

Defined in Data.Default.Class

Methods

def :: [a] #

Default (Maybe a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Maybe a #

Integral a => Default (Ratio a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Ratio a #

Default a => Default (IO a) 
Instance details

Defined in Data.Default.Class

Methods

def :: IO a #

(Default a, RealFloat a) => Default (Complex a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Complex a #

Default (First a) 
Instance details

Defined in Data.Default.Class

Methods

def :: First a #

Default (Last a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Last a #

Default a => Default (Dual a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Dual a #

Default (Endo a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Endo a #

Num a => Default (Sum a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Sum a #

Num a => Default (Product a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Product a #

Default r => Default (e -> r) 
Instance details

Defined in Data.Default.Class

Methods

def :: e -> r #

(Default a, Default b) => Default (a, b) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b) #

(Default a, Default b, Default c) => Default (a, b, c) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c) #

(Default a, Default b, Default c, Default d) => Default (a, b, c, d) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d) #

(Default a, Default b, Default c, Default d, Default e) => Default (a, b, c, d, e) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d, e) #

(Default a, Default b, Default c, Default d, Default e, Default f) => Default (a, b, c, d, e, f) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d, e, f) #

(Default a, Default b, Default c, Default d, Default e, Default f, Default g) => Default (a, b, c, d, e, f, g) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d, e, f, g) #

newtype Sum a #

Monoid under group addition. Alternative to the Sum in Data.Monoid, which uses Num instead of AdditiveGroup.

Constructors

Sum 

Fields

Instances

Instances details
Functor Sum 
Instance details

Defined in Data.AdditiveGroup

Methods

fmap :: (a -> b) -> Sum a -> Sum b #

(<$) :: a -> Sum b -> Sum a #

Applicative Sum 
Instance details

Defined in Data.AdditiveGroup

Methods

pure :: a -> Sum a #

(<*>) :: Sum (a -> b) -> Sum a -> Sum b #

liftA2 :: (a -> b -> c) -> Sum a -> Sum b -> Sum c #

(*>) :: Sum a -> Sum b -> Sum b #

(<*) :: Sum a -> Sum b -> Sum a #

Bounded a => Bounded (Sum a) 
Instance details

Defined in Data.AdditiveGroup

Methods

minBound :: Sum a #

maxBound :: Sum a #

Eq a => Eq (Sum a) 
Instance details

Defined in Data.AdditiveGroup

Methods

(==) :: Sum a -> Sum a -> Bool #

(/=) :: Sum a -> Sum a -> Bool #

Ord a => Ord (Sum a) 
Instance details

Defined in Data.AdditiveGroup

Methods

compare :: Sum a -> Sum a -> Ordering #

(<) :: Sum a -> Sum a -> Bool #

(<=) :: Sum a -> Sum a -> Bool #

(>) :: Sum a -> Sum a -> Bool #

(>=) :: Sum a -> Sum a -> Bool #

max :: Sum a -> Sum a -> Sum a #

min :: Sum a -> Sum a -> Sum a #

Read a => Read (Sum a) 
Instance details

Defined in Data.AdditiveGroup

Show a => Show (Sum a) 
Instance details

Defined in Data.AdditiveGroup

Methods

showsPrec :: Int -> Sum a -> ShowS #

show :: Sum a -> String #

showList :: [Sum a] -> ShowS #

AdditiveGroup a => Semigroup (Sum a) 
Instance details

Defined in Data.AdditiveGroup

Methods

(<>) :: Sum a -> Sum a -> Sum a #

sconcat :: NonEmpty (Sum a) -> Sum a #

stimes :: Integral b => b -> Sum a -> Sum a #

AdditiveGroup a => Monoid (Sum a) 
Instance details

Defined in Data.AdditiveGroup

Methods

mempty :: Sum a #

mappend :: Sum a -> Sum a -> Sum a #

mconcat :: [Sum a] -> Sum a #

AdditiveGroup a => AdditiveGroup (Sum a) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: Sum a #

(^+^) :: Sum a -> Sum a -> Sum a #

negateV :: Sum a -> Sum a #

(^-^) :: Sum a -> Sum a -> Sum a #

class AdditiveGroup v where #

Additive group v.

Minimal complete definition

Nothing

Methods

zeroV :: v #

The zero element: identity for (^+^)

(^+^) :: v -> v -> v infixl 6 #

Add vectors

negateV :: v -> v #

Additive inverse

(^-^) :: v -> v -> v infixl 6 #

Group subtraction

Instances

Instances details
AdditiveGroup Double 
Instance details

Defined in Data.AdditiveGroup

AdditiveGroup Float 
Instance details

Defined in Data.AdditiveGroup

AdditiveGroup Int 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: Int #

(^+^) :: Int -> Int -> Int #

negateV :: Int -> Int #

(^-^) :: Int -> Int -> Int #

AdditiveGroup Integer 
Instance details

Defined in Data.AdditiveGroup

AdditiveGroup () 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: () #

(^+^) :: () -> () -> () #

negateV :: () -> () #

(^-^) :: () -> () -> () #

AdditiveGroup CSChar 
Instance details

Defined in Data.AdditiveGroup

AdditiveGroup CShort 
Instance details

Defined in Data.AdditiveGroup

AdditiveGroup CInt 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: CInt #

(^+^) :: CInt -> CInt -> CInt #

negateV :: CInt -> CInt #

(^-^) :: CInt -> CInt -> CInt #

AdditiveGroup CLong 
Instance details

Defined in Data.AdditiveGroup

AdditiveGroup CLLong 
Instance details

Defined in Data.AdditiveGroup

AdditiveGroup CFloat 
Instance details

Defined in Data.AdditiveGroup

AdditiveGroup CDouble 
Instance details

Defined in Data.AdditiveGroup

AdditiveGroup CIntMax 
Instance details

Defined in Data.AdditiveGroup

AdditiveGroup a => AdditiveGroup (Maybe a) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: Maybe a #

(^+^) :: Maybe a -> Maybe a -> Maybe a #

negateV :: Maybe a -> Maybe a #

(^-^) :: Maybe a -> Maybe a -> Maybe a #

Integral a => AdditiveGroup (Ratio a) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: Ratio a #

(^+^) :: Ratio a -> Ratio a -> Ratio a #

negateV :: Ratio a -> Ratio a #

(^-^) :: Ratio a -> Ratio a -> Ratio a #

(RealFloat v, AdditiveGroup v) => AdditiveGroup (Complex v) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: Complex v #

(^+^) :: Complex v -> Complex v -> Complex v #

negateV :: Complex v -> Complex v #

(^-^) :: Complex v -> Complex v -> Complex v #

AdditiveGroup a => AdditiveGroup (Sum a) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: Sum a #

(^+^) :: Sum a -> Sum a -> Sum a #

negateV :: Sum a -> Sum a #

(^-^) :: Sum a -> Sum a -> Sum a #

AdditiveGroup (Diff (VRep p)) => AdditiveGroup (GenericDiff p) 
Instance details

Defined in Data.AffineSpace

Methods

zeroV :: GenericDiff p #

(^+^) :: GenericDiff p -> GenericDiff p -> GenericDiff p #

negateV :: GenericDiff p -> GenericDiff p #

(^-^) :: GenericDiff p -> GenericDiff p -> GenericDiff p #

AdditiveGroup a => AdditiveGroup (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

zeroV :: Dyn a #

(^+^) :: Dyn a -> Dyn a -> Dyn a #

negateV :: Dyn a -> Dyn a #

(^-^) :: Dyn a -> Dyn a -> Dyn a #

AdditiveGroup v => AdditiveGroup (a -> v) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: a -> v #

(^+^) :: (a -> v) -> (a -> v) -> a -> v #

negateV :: (a -> v) -> a -> v #

(^-^) :: (a -> v) -> (a -> v) -> a -> v #

(AdditiveGroup u, AdditiveGroup v) => AdditiveGroup (u, v) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: (u, v) #

(^+^) :: (u, v) -> (u, v) -> (u, v) #

negateV :: (u, v) -> (u, v) #

(^-^) :: (u, v) -> (u, v) -> (u, v) #

(HasTrie u, AdditiveGroup v) => AdditiveGroup (u :->: v) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: u :->: v #

(^+^) :: (u :->: v) -> (u :->: v) -> u :->: v #

negateV :: (u :->: v) -> u :->: v #

(^-^) :: (u :->: v) -> (u :->: v) -> u :->: v #

(AdditiveGroup a, Frp m) => AdditiveGroup (Dyn m a) 
Instance details

Defined in Dyna

Methods

zeroV :: Dyn m a #

(^+^) :: Dyn m a -> Dyn m a -> Dyn m a #

negateV :: Dyn m a -> Dyn m a #

(^-^) :: Dyn m a -> Dyn m a -> Dyn m a #

(HasBasis a, HasTrie (Basis a), AdditiveGroup u) => AdditiveGroup (a :> u) 
Instance details

Defined in Data.Maclaurin

Methods

zeroV :: a :> u #

(^+^) :: (a :> u) -> (a :> u) -> a :> u #

negateV :: (a :> u) -> a :> u #

(^-^) :: (a :> u) -> (a :> u) -> a :> u #

(HasTrie (Basis u), AdditiveGroup v) => AdditiveGroup (u :-* v) 
Instance details

Defined in Data.LinearMap

Methods

zeroV :: u :-* v #

(^+^) :: (u :-* v) -> (u :-* v) -> u :-* v #

negateV :: (u :-* v) -> u :-* v #

(^-^) :: (u :-* v) -> (u :-* v) -> u :-* v #

AdditiveGroup a => AdditiveGroup (Rec0 a s) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: Rec0 a s #

(^+^) :: Rec0 a s -> Rec0 a s -> Rec0 a s #

negateV :: Rec0 a s -> Rec0 a s #

(^-^) :: Rec0 a s -> Rec0 a s -> Rec0 a s #

(AdditiveGroup u, AdditiveGroup v, AdditiveGroup w) => AdditiveGroup (u, v, w) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: (u, v, w) #

(^+^) :: (u, v, w) -> (u, v, w) -> (u, v, w) #

negateV :: (u, v, w) -> (u, v, w) #

(^-^) :: (u, v, w) -> (u, v, w) -> (u, v, w) #

(AffineSpace (f p), AffineSpace (g p)) => AdditiveGroup (AffineDiffProductSpace f g p) 
Instance details

Defined in Data.AffineSpace

Methods

zeroV :: AffineDiffProductSpace f g p #

(^+^) :: AffineDiffProductSpace f g p -> AffineDiffProductSpace f g p -> AffineDiffProductSpace f g p #

negateV :: AffineDiffProductSpace f g p -> AffineDiffProductSpace f g p #

(^-^) :: AffineDiffProductSpace f g p -> AffineDiffProductSpace f g p -> AffineDiffProductSpace f g p #

(AdditiveGroup (f p), AdditiveGroup (g p)) => AdditiveGroup ((f :*: g) p) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: (f :*: g) p #

(^+^) :: (f :*: g) p -> (f :*: g) p -> (f :*: g) p #

negateV :: (f :*: g) p -> (f :*: g) p #

(^-^) :: (f :*: g) p -> (f :*: g) p -> (f :*: g) p #

(AdditiveGroup u, AdditiveGroup v, AdditiveGroup w, AdditiveGroup x) => AdditiveGroup (u, v, w, x) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: (u, v, w, x) #

(^+^) :: (u, v, w, x) -> (u, v, w, x) -> (u, v, w, x) #

negateV :: (u, v, w, x) -> (u, v, w, x) #

(^-^) :: (u, v, w, x) -> (u, v, w, x) -> (u, v, w, x) #

AdditiveGroup (f p) => AdditiveGroup (M1 i c f p) 
Instance details

Defined in Data.AdditiveGroup

Methods

zeroV :: M1 i c f p #

(^+^) :: M1 i c f p -> M1 i c f p -> M1 i c f p #

negateV :: M1 i c f p -> M1 i c f p #

(^-^) :: M1 i c f p -> M1 i c f p -> M1 i c f p #

sumV :: (Foldable f, AdditiveGroup v) => f v -> v #

Sum over several vectors

inSum :: (a -> b) -> Sum a -> Sum b #

Application a unary function inside a Sum

inSum2 :: (a -> b -> c) -> Sum a -> Sum b -> Sum c #

Application a binary function inside a Sum

class (VectorSpace v, AdditiveGroup (Scalar v)) => InnerSpace v where #

Adds inner (dot) products.

Minimal complete definition

Nothing

Methods

(<.>) :: v -> v -> Scalar v infixr 7 #

Inner/dot product

Instances

Instances details
InnerSpace Double 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Double -> Double -> Scalar Double #

InnerSpace Float 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Float -> Float -> Scalar Float #

InnerSpace Int 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Int -> Int -> Scalar Int #

InnerSpace Integer 
Instance details

Defined in Data.VectorSpace

InnerSpace CSChar 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: CSChar -> CSChar -> Scalar CSChar #

InnerSpace CShort 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: CShort -> CShort -> Scalar CShort #

InnerSpace CInt 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: CInt -> CInt -> Scalar CInt #

InnerSpace CLong 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: CLong -> CLong -> Scalar CLong #

InnerSpace CLLong 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: CLLong -> CLLong -> Scalar CLLong #

InnerSpace CFloat 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: CFloat -> CFloat -> Scalar CFloat #

InnerSpace CDouble 
Instance details

Defined in Data.VectorSpace

InnerSpace CIntMax 
Instance details

Defined in Data.VectorSpace

InnerSpace a => InnerSpace (Maybe a) 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Maybe a -> Maybe a -> Scalar (Maybe a) #

Integral a => InnerSpace (Ratio a) 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Ratio a -> Ratio a -> Scalar (Ratio a) #

(RealFloat v, InnerSpace v) => InnerSpace (Complex v) 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Complex v -> Complex v -> Scalar (Complex v) #

InnerSpace (Diff (VRep p)) => InnerSpace (GenericDiff p) 
Instance details

Defined in Data.AffineSpace

Methods

(<.>) :: GenericDiff p -> GenericDiff p -> Scalar (GenericDiff p) #

InnerSpace v => InnerSpace (a -> v) 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: (a -> v) -> (a -> v) -> Scalar (a -> v) #

(InnerSpace u, s ~ Scalar u, InnerSpace v, s ~ Scalar v) => InnerSpace (u, v) 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: (u, v) -> (u, v) -> Scalar (u, v) #

(InnerSpace u, s ~ Scalar u, AdditiveGroup s, HasBasis a, HasTrie (Basis a)) => InnerSpace (a :> u) 
Instance details

Defined in Data.Maclaurin

Methods

(<.>) :: (a :> u) -> (a :> u) -> Scalar (a :> u) #

InnerSpace a => InnerSpace (Rec0 a s) 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Rec0 a s -> Rec0 a s -> Scalar (Rec0 a s) #

(InnerSpace u, s ~ Scalar u, InnerSpace v, s ~ Scalar v, InnerSpace w, s ~ Scalar w) => InnerSpace (u, v, w) 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: (u, v, w) -> (u, v, w) -> Scalar (u, v, w) #

(AffineSpace (f p), AffineSpace (g p), InnerSpace (Diff (f p)), InnerSpace (Diff (g p)), Scalar (Diff (f p)) ~ Scalar (Diff (g p)), Num (Scalar (Diff (f p)))) => InnerSpace (AffineDiffProductSpace f g p) 
Instance details

Defined in Data.AffineSpace

Methods

(<.>) :: AffineDiffProductSpace f g p -> AffineDiffProductSpace f g p -> Scalar (AffineDiffProductSpace f g p) #

(InnerSpace (f p), InnerSpace (g p), Scalar (f p) ~ Scalar (g p), Num (Scalar (f p))) => InnerSpace ((f :*: g) p) 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: (f :*: g) p -> (f :*: g) p -> Scalar ((f :*: g) p) #

(InnerSpace u, s ~ Scalar u, InnerSpace v, s ~ Scalar v, InnerSpace w, s ~ Scalar w, InnerSpace x, s ~ Scalar x) => InnerSpace (u, v, w, x) 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: (u, v, w, x) -> (u, v, w, x) -> Scalar (u, v, w, x) #

InnerSpace (f p) => InnerSpace (M1 i c f p) 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: M1 i c f p -> M1 i c f p -> Scalar (M1 i c f p) #

class AdditiveGroup v => VectorSpace v where #

Vector space v.

Minimal complete definition

Nothing

Associated Types

type Scalar v #

type Scalar v = Scalar (VRep v)

Methods

(*^) :: Scalar v -> v -> v infixr 7 #

Scale a vector

Instances

Instances details
VectorSpace Double 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar Double #

Methods

(*^) :: Scalar Double -> Double -> Double #

VectorSpace Float 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar Float #

Methods

(*^) :: Scalar Float -> Float -> Float #

VectorSpace Int 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar Int #

Methods

(*^) :: Scalar Int -> Int -> Int #

VectorSpace Integer 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar Integer #

VectorSpace CSChar 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CSChar #

Methods

(*^) :: Scalar CSChar -> CSChar -> CSChar #

VectorSpace CShort 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CShort #

Methods

(*^) :: Scalar CShort -> CShort -> CShort #

VectorSpace CInt 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CInt #

Methods

(*^) :: Scalar CInt -> CInt -> CInt #

VectorSpace CLong 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CLong #

Methods

(*^) :: Scalar CLong -> CLong -> CLong #

VectorSpace CLLong 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CLLong #

Methods

(*^) :: Scalar CLLong -> CLLong -> CLLong #

VectorSpace CFloat 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CFloat #

Methods

(*^) :: Scalar CFloat -> CFloat -> CFloat #

VectorSpace CDouble 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CDouble #

VectorSpace CIntMax 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CIntMax #

VectorSpace v => VectorSpace (Maybe v) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (Maybe v) #

Methods

(*^) :: Scalar (Maybe v) -> Maybe v -> Maybe v #

Integral a => VectorSpace (Ratio a) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (Ratio a) #

Methods

(*^) :: Scalar (Ratio a) -> Ratio a -> Ratio a #

(RealFloat v, VectorSpace v) => VectorSpace (Complex v) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (Complex v) #

Methods

(*^) :: Scalar (Complex v) -> Complex v -> Complex v #

VectorSpace (Diff (VRep p)) => VectorSpace (GenericDiff p) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Scalar (GenericDiff p) #

Methods

(*^) :: Scalar (GenericDiff p) -> GenericDiff p -> GenericDiff p #

VectorSpace a => VectorSpace (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Associated Types

type Scalar (Dyn a) #

Methods

(*^) :: Scalar (Dyn a) -> Dyn a -> Dyn a #

VectorSpace v => VectorSpace (a -> v) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (a -> v) #

Methods

(*^) :: Scalar (a -> v) -> (a -> v) -> a -> v #

(VectorSpace u, s ~ Scalar u, VectorSpace v, s ~ Scalar v) => VectorSpace (u, v) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (u, v) #

Methods

(*^) :: Scalar (u, v) -> (u, v) -> (u, v) #

(HasTrie a, VectorSpace v) => VectorSpace (a :->: v) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (a :->: v) #

Methods

(*^) :: Scalar (a :->: v) -> (a :->: v) -> a :->: v #

(VectorSpace a, Frp m) => VectorSpace (Dyn m a) 
Instance details

Defined in Dyna

Associated Types

type Scalar (Dyn m a) #

Methods

(*^) :: Scalar (Dyn m a) -> Dyn m a -> Dyn m a #

(HasBasis a, HasTrie (Basis a), VectorSpace u) => VectorSpace (a :> u) 
Instance details

Defined in Data.Maclaurin

Associated Types

type Scalar (a :> u) #

Methods

(*^) :: Scalar (a :> u) -> (a :> u) -> a :> u #

(HasTrie (Basis u), VectorSpace v) => VectorSpace (u :-* v) 
Instance details

Defined in Data.LinearMap

Associated Types

type Scalar (u :-* v) #

Methods

(*^) :: Scalar (u :-* v) -> (u :-* v) -> u :-* v #

VectorSpace a => VectorSpace (Rec0 a s) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (Rec0 a s) #

Methods

(*^) :: Scalar (Rec0 a s) -> Rec0 a s -> Rec0 a s #

(VectorSpace u, s ~ Scalar u, VectorSpace v, s ~ Scalar v, VectorSpace w, s ~ Scalar w) => VectorSpace (u, v, w) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (u, v, w) #

Methods

(*^) :: Scalar (u, v, w) -> (u, v, w) -> (u, v, w) #

(AffineSpace (f p), AffineSpace (g p), VectorSpace (Diff (f p)), VectorSpace (Diff (g p)), Scalar (Diff (f p)) ~ Scalar (Diff (g p))) => VectorSpace (AffineDiffProductSpace f g p) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Scalar (AffineDiffProductSpace f g p) #

Methods

(*^) :: Scalar (AffineDiffProductSpace f g p) -> AffineDiffProductSpace f g p -> AffineDiffProductSpace f g p #

(VectorSpace (f p), VectorSpace (g p), Scalar (f p) ~ Scalar (g p)) => VectorSpace ((f :*: g) p) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar ((f :*: g) p) #

Methods

(*^) :: Scalar ((f :*: g) p) -> (f :*: g) p -> (f :*: g) p #

(VectorSpace u, s ~ Scalar u, VectorSpace v, s ~ Scalar v, VectorSpace w, s ~ Scalar w, VectorSpace x, s ~ Scalar x) => VectorSpace (u, v, w, x) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (u, v, w, x) #

Methods

(*^) :: Scalar (u, v, w, x) -> (u, v, w, x) -> (u, v, w, x) #

VectorSpace (f p) => VectorSpace (M1 i c f p) 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (M1 i c f p) #

Methods

(*^) :: Scalar (M1 i c f p) -> M1 i c f p -> M1 i c f p #

type family Scalar v #

Instances

Instances details
type Scalar Double 
Instance details

Defined in Data.VectorSpace

type Scalar Float 
Instance details

Defined in Data.VectorSpace

type Scalar Int 
Instance details

Defined in Data.VectorSpace

type Scalar Int = Int
type Scalar Integer 
Instance details

Defined in Data.VectorSpace

type Scalar CSChar 
Instance details

Defined in Data.VectorSpace

type Scalar CShort 
Instance details

Defined in Data.VectorSpace

type Scalar CInt 
Instance details

Defined in Data.VectorSpace

type Scalar CLong 
Instance details

Defined in Data.VectorSpace

type Scalar CLLong 
Instance details

Defined in Data.VectorSpace

type Scalar CFloat 
Instance details

Defined in Data.VectorSpace

type Scalar CDouble 
Instance details

Defined in Data.VectorSpace

type Scalar CIntMax 
Instance details

Defined in Data.VectorSpace

type Scalar (Maybe v) 
Instance details

Defined in Data.VectorSpace

type Scalar (Maybe v) = Scalar v
type Scalar (Ratio a) 
Instance details

Defined in Data.VectorSpace

type Scalar (Ratio a) = Ratio a
type Scalar (Complex v) 
Instance details

Defined in Data.VectorSpace

type Scalar (Complex v) = Scalar v
type Scalar (GenericDiff p) 
Instance details

Defined in Data.AffineSpace

type Scalar (GenericDiff p) = Scalar (VRep (GenericDiff p))
type Scalar (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

type Scalar (Dyn a) = Scalar (Dyn Run a)
type Scalar (a -> v) 
Instance details

Defined in Data.VectorSpace

type Scalar (a -> v) = a -> Scalar v
type Scalar (u, v) 
Instance details

Defined in Data.VectorSpace

type Scalar (u, v) = Scalar u
type Scalar (a :->: v) 
Instance details

Defined in Data.VectorSpace

type Scalar (a :->: v) = Scalar v
type Scalar (Dyn m a) 
Instance details

Defined in Dyna

type Scalar (Dyn m a) = Dyn m (Scalar a)
type Scalar (a :> u) 
Instance details

Defined in Data.Maclaurin

type Scalar (a :> u) = a :> Scalar u
type Scalar (u :-* v) 
Instance details

Defined in Data.LinearMap

type Scalar (u :-* v) = Scalar v
type Scalar (Rec0 a s) 
Instance details

Defined in Data.VectorSpace

type Scalar (Rec0 a s) = Scalar a
type Scalar (u, v, w) 
Instance details

Defined in Data.VectorSpace

type Scalar (u, v, w) = Scalar u
type Scalar (AffineDiffProductSpace f g p) 
Instance details

Defined in Data.AffineSpace

type Scalar (AffineDiffProductSpace f g p) = Scalar (VRep (AffineDiffProductSpace f g p))
type Scalar ((f :*: g) p) 
Instance details

Defined in Data.VectorSpace

type Scalar ((f :*: g) p) = Scalar (f p)
type Scalar (u, v, w, x) 
Instance details

Defined in Data.VectorSpace

type Scalar (u, v, w, x) = Scalar u
type Scalar (M1 i c f p) 
Instance details

Defined in Data.VectorSpace

type Scalar (M1 i c f p) = Scalar (f p)

(^/) :: (VectorSpace v, s ~ Scalar v, Fractional s) => v -> s -> v infixr 7 #

Vector divided by scalar

(^*) :: (VectorSpace v, s ~ Scalar v) => v -> s -> v infixl 7 #

Vector multiplied by scalar

lerp :: VectorSpace v => v -> v -> Scalar v -> v #

Linear interpolation between a (when t==0) and b (when t==1).

linearCombo :: VectorSpace v => [(v, Scalar v)] -> v #

Linear combination of vectors

magnitudeSq :: (InnerSpace v, s ~ Scalar v) => v -> s #

Square of the length of a vector. Sometimes useful for efficiency. See also magnitude.

magnitude :: (InnerSpace v, s ~ Scalar v, Floating s) => v -> s #

Length of a vector. See also magnitudeSq.

normalized :: (InnerSpace v, s ~ Scalar v, Floating s) => v -> v #

Vector in same direction as given one but with length of one. If given the zero vector, then return it.

project :: (InnerSpace v, s ~ Scalar v, Fractional s) => v -> v -> v #

project u v computes the projection of v onto u.

class AdditiveGroup (Diff p) => AffineSpace p where #

Minimal complete definition

Nothing

Associated Types

type Diff p #

Associated vector space

type Diff p = GenericDiff p

Methods

(.-.) :: p -> p -> Diff p infix 6 #

Subtract points

(.+^) :: p -> Diff p -> p infixl 6 #

Point plus vector

Instances

Instances details
AffineSpace Double 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff Double #

AffineSpace Float 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff Float #

Methods

(.-.) :: Float -> Float -> Diff Float #

(.+^) :: Float -> Diff Float -> Float #

AffineSpace Int 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff Int #

Methods

(.-.) :: Int -> Int -> Diff Int #

(.+^) :: Int -> Diff Int -> Int #

AffineSpace Integer 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff Integer #

AffineSpace CSChar 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff CSChar #

AffineSpace CShort 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff CShort #

AffineSpace CInt 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff CInt #

Methods

(.-.) :: CInt -> CInt -> Diff CInt #

(.+^) :: CInt -> Diff CInt -> CInt #

AffineSpace CLong 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff CLong #

Methods

(.-.) :: CLong -> CLong -> Diff CLong #

(.+^) :: CLong -> Diff CLong -> CLong #

AffineSpace CLLong 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff CLLong #

AffineSpace CFloat 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff CFloat #

AffineSpace CDouble 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff CDouble #

AffineSpace CIntMax 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff CIntMax #

Integral a => AffineSpace (Ratio a) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff (Ratio a) #

Methods

(.-.) :: Ratio a -> Ratio a -> Diff (Ratio a) #

(.+^) :: Ratio a -> Diff (Ratio a) -> Ratio a #

AffineSpace a => AffineSpace (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Associated Types

type Diff (Dyn a) #

Methods

(.-.) :: Dyn a -> Dyn a -> Diff (Dyn a) #

(.+^) :: Dyn a -> Diff (Dyn a) -> Dyn a #

AffineSpace p => AffineSpace (a -> p) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff (a -> p) #

Methods

(.-.) :: (a -> p) -> (a -> p) -> Diff (a -> p) #

(.+^) :: (a -> p) -> Diff (a -> p) -> a -> p #

(AffineSpace p, AffineSpace q) => AffineSpace (p, q) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff (p, q) #

Methods

(.-.) :: (p, q) -> (p, q) -> Diff (p, q) #

(.+^) :: (p, q) -> Diff (p, q) -> (p, q) #

(AffineSpace p, Frp m) => AffineSpace (Dyn m p) 
Instance details

Defined in Dyna

Associated Types

type Diff (Dyn m p) #

Methods

(.-.) :: Dyn m p -> Dyn m p -> Diff (Dyn m p) #

(.+^) :: Dyn m p -> Diff (Dyn m p) -> Dyn m p #

AffineSpace a => AffineSpace (Rec0 a s) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff (Rec0 a s) #

Methods

(.-.) :: Rec0 a s -> Rec0 a s -> Diff (Rec0 a s) #

(.+^) :: Rec0 a s -> Diff (Rec0 a s) -> Rec0 a s #

(AffineSpace p, AffineSpace q, AffineSpace r) => AffineSpace (p, q, r) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff (p, q, r) #

Methods

(.-.) :: (p, q, r) -> (p, q, r) -> Diff (p, q, r) #

(.+^) :: (p, q, r) -> Diff (p, q, r) -> (p, q, r) #

(AffineSpace (f p), AffineSpace (g p)) => AffineSpace (AffineDiffProductSpace f g p) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff (AffineDiffProductSpace f g p) #

Methods

(.-.) :: AffineDiffProductSpace f g p -> AffineDiffProductSpace f g p -> Diff (AffineDiffProductSpace f g p) #

(.+^) :: AffineDiffProductSpace f g p -> Diff (AffineDiffProductSpace f g p) -> AffineDiffProductSpace f g p #

(AffineSpace (f p), AffineSpace (g p)) => AffineSpace ((f :*: g) p) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff ((f :*: g) p) #

Methods

(.-.) :: (f :*: g) p -> (f :*: g) p -> Diff ((f :*: g) p) #

(.+^) :: (f :*: g) p -> Diff ((f :*: g) p) -> (f :*: g) p #

AffineSpace (f p) => AffineSpace (M1 i c f p) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Diff (M1 i c f p) #

Methods

(.-.) :: M1 i c f p -> M1 i c f p -> Diff (M1 i c f p) #

(.+^) :: M1 i c f p -> Diff (M1 i c f p) -> M1 i c f p #

type family Diff p #

Associated vector space

Instances

Instances details
type Diff Double 
Instance details

Defined in Data.AffineSpace

type Diff Float 
Instance details

Defined in Data.AffineSpace

type Diff Int 
Instance details

Defined in Data.AffineSpace

type Diff Int = Int
type Diff Integer 
Instance details

Defined in Data.AffineSpace

type Diff CSChar 
Instance details

Defined in Data.AffineSpace

type Diff CShort 
Instance details

Defined in Data.AffineSpace

type Diff CInt 
Instance details

Defined in Data.AffineSpace

type Diff CInt = CInt
type Diff CLong 
Instance details

Defined in Data.AffineSpace

type Diff CLLong 
Instance details

Defined in Data.AffineSpace

type Diff CFloat 
Instance details

Defined in Data.AffineSpace

type Diff CDouble 
Instance details

Defined in Data.AffineSpace

type Diff CIntMax 
Instance details

Defined in Data.AffineSpace

type Diff (Ratio a) 
Instance details

Defined in Data.AffineSpace

type Diff (Ratio a) = Ratio a
type Diff (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

type Diff (Dyn a) = Diff (Dyn Run a)
type Diff (a -> p) 
Instance details

Defined in Data.AffineSpace

type Diff (a -> p) = a -> Diff p
type Diff (p, q) 
Instance details

Defined in Data.AffineSpace

type Diff (p, q) = (Diff p, Diff q)
type Diff (Dyn m p) 
Instance details

Defined in Dyna

type Diff (Dyn m p) = Dyn m (Diff p)
type Diff (Rec0 a s) 
Instance details

Defined in Data.AffineSpace

type Diff (Rec0 a s) = Diff a
type Diff (p, q, r) 
Instance details

Defined in Data.AffineSpace

type Diff (p, q, r) = (Diff p, Diff q, Diff r)
type Diff (AffineDiffProductSpace f g p) 
Instance details

Defined in Data.AffineSpace

type Diff (AffineDiffProductSpace f g p) = AffineDiffProductSpace f g p
type Diff ((f :*: g) p) 
Instance details

Defined in Data.AffineSpace

type Diff ((f :*: g) p) = AffineDiffProductSpace f g p
type Diff (M1 i c f p) 
Instance details

Defined in Data.AffineSpace

type Diff (M1 i c f p) = Diff (f p)

(.-^) :: AffineSpace p => p -> Diff p -> p infixl 6 #

Point minus vector

distanceSq :: (AffineSpace p, v ~ Diff p, InnerSpace v) => p -> p -> Scalar v #

Square of the distance between two points. Sometimes useful for efficiency. See also distance.

distance :: (AffineSpace p, v ~ Diff p, InnerSpace v, s ~ Scalar v, Floating (Scalar v)) => p -> p -> s #

Distance between two points. See also distanceSq.

alerp :: (AffineSpace p, VectorSpace (Diff p)) => p -> p -> Scalar (Diff p) -> p #

Affine linear interpolation. Varies from p to p' as s varies from 0 to 1. See also lerp (on vector spaces).

affineCombo :: (AffineSpace p, v ~ Diff p, VectorSpace v) => p -> [(p, Scalar v)] -> p #

Compute an affine combination (weighted average) of points. The first element is used as origin and is weighted such that all coefficients sum to 1. For example,

affineCombo a [(0.3,b), (0.2,c)]

is equal to

a .+^ (0.3 *^ (b .-. a) ^+^ 0.2 *^ (c .-. a))

and if a, b, and c were in a vector space would also be equal to

0.5 *^ a ^+^ 0.3 *^ b ^+^ 0.2 *^ c

See also linearCombo (on vector spaces).

class HasCross3 v where #

Cross product of various forms of 3D vectors

Methods

cross3 :: v -> v -> v #

Instances

Instances details
HasCross3 a => HasCross3 (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

cross3 :: Dyn a -> Dyn a -> Dyn a #

(HasCross3 v, Frp m) => HasCross3 (Dyn m v) 
Instance details

Defined in Dyna

Methods

cross3 :: Dyn m v -> Dyn m v -> Dyn m v #

(HasBasis a, HasTrie (Basis a), VectorSpace v, HasCross3 v) => HasCross3 (a :> v) 
Instance details

Defined in Data.Cross

Methods

cross3 :: (a :> v) -> (a :> v) -> a :> v #

Num s => HasCross3 (s, s, s) 
Instance details

Defined in Data.Cross

Methods

cross3 :: (s, s, s) -> (s, s, s) -> (s, s, s) #

class HasCross2 v where #

Cross product of various forms of 2D vectors

Methods

cross2 :: v -> v #

Instances

Instances details
HasCross2 a => HasCross2 (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

cross2 :: Dyn a -> Dyn a #

AdditiveGroup u => HasCross2 (u, u) 
Instance details

Defined in Data.Cross

Methods

cross2 :: (u, u) -> (u, u) #

(HasCross2 v, Frp m) => HasCross2 (Dyn m v) 
Instance details

Defined in Dyna

Methods

cross2 :: Dyn m v -> Dyn m v #

(HasTrie (Basis a), HasCross2 v) => HasCross2 (a :> v) 
Instance details

Defined in Data.Cross

Methods

cross2 :: (a :> v) -> a :> v #

type Three s = (s, s, s) #

Homogeneous triple

type Two s = (s, s) #

Homogeneous pair

type One s = s #

Singleton

class HasNormal v where #

Thing with a normal vector (not necessarily normalized).

Methods

normalVec :: v -> v #

Instances

Instances details
(VectorSpace s, HasBasis s, HasTrie (Basis s), HasNormal (Two s :> Three s)) => HasNormal (Three (Two s :> s)) 
Instance details

Defined in Data.Cross

Methods

normalVec :: Three (Two s :> s) -> Three (Two s :> s) #

(VectorSpace s, HasBasis s, HasTrie (Basis s), Basis s ~ ()) => HasNormal (Two (One s :> s)) 
Instance details

Defined in Data.Cross

Methods

normalVec :: Two (One s :> s) -> Two (One s :> s) #

HasNormal a => HasNormal (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

normalVec :: Dyn a -> Dyn a #

(HasNormal v, Frp m) => HasNormal (Dyn m v) 
Instance details

Defined in Dyna

Methods

normalVec :: Dyn m v -> Dyn m v #

(Num s, HasTrie (Basis (s, s)), HasBasis s, Basis s ~ ()) => HasNormal (Two s :> Three s) 
Instance details

Defined in Data.Cross

Methods

normalVec :: (Two s :> Three s) -> Two s :> Three s #

(HasBasis s, HasTrie (Basis s), Basis s ~ ()) => HasNormal (One s :> Two s) 
Instance details

Defined in Data.Cross

Methods

normalVec :: (One s :> Two s) -> One s :> Two s #

normal :: (HasNormal v, InnerSpace v, Floating (Scalar v)) => v -> v #

Normalized normal vector. See also cross.

class Loop a where #

Methods

loop :: a -> a #

Loops over the sound

Instances

Instances details
Loop (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

loop :: Evt a -> Evt a #

Frp m => Loop (Evt m a) 
Instance details

Defined in Dyna

Methods

loop :: Evt m a -> Evt m a #

class Limit a where #

Methods

lim :: DurOf a -> a -> a #

Limits the duration of the sound source.

Instances

Instances details
Limit (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

lim :: DurOf (Evt a) -> Evt a -> Evt a #

Frp m => Limit (Evt m a) 
Instance details

Defined in Dyna

Methods

lim :: DurOf (Evt m a) -> Evt m a -> Evt m a #

class (Melody a, Harmony a) => Compose a #

Instances

Instances details
Compose (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Frp m => Compose (Evt m a) 
Instance details

Defined in Dyna

class Harmony a where #

Minimal complete definition

har | (=:=)

Methods

har :: [a] -> a #

Parallel composition for a list of values (harmony).

(=:=) :: a -> a -> a #

Parallel composition. Play two tracks simultaneously.

Instances

Instances details
Harmony (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

har :: [Evt a] -> Evt a #

(=:=) :: Evt a -> Evt a -> Evt a #

Frp m => Harmony (Evt m a) 
Instance details

Defined in Dyna

Methods

har :: [Evt m a] -> Evt m a #

(=:=) :: Evt m a -> Evt m a -> Evt m a #

class Melody a where #

Minimal complete definition

mel | (+:+)

Methods

mel :: [a] -> a #

Sequent composition for a list of values (melody).

(+:+) :: a -> a -> a #

Sequent composition. Play first track then second.

Instances

Instances details
Melody (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

mel :: [Evt a] -> Evt a #

(+:+) :: Evt a -> Evt a -> Evt a #

Frp m => Melody (Evt m a) 
Instance details

Defined in Dyna

Methods

mel :: [Evt m a] -> Evt m a #

(+:+) :: Evt m a -> Evt m a -> Evt m a #

recompose :: HasBasis v => [(Basis v, Scalar v)] -> v #

type family Basis v #

Representation of the canonical basis for v

Instances

Instances details
type Basis Double 
Instance details

Defined in Data.Basis

type Basis Double = ()
type Basis Float 
Instance details

Defined in Data.Basis

type Basis Float = ()
type Basis CFloat 
Instance details

Defined in Data.Basis

type Basis CFloat = ()
type Basis CDouble 
Instance details

Defined in Data.Basis

type Basis CDouble = ()
type Basis (Ratio a) 
Instance details

Defined in Data.Basis

type Basis (Ratio a) = ()
type Basis (GenericDiff p) 
Instance details

Defined in Data.AffineSpace

type Basis (GenericDiff p) = Basis (VRep (GenericDiff p))
type Basis (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

type Basis (Dyn a) = Basis (Dyn Run a)
type Basis (u, v) 
Instance details

Defined in Data.Basis

type Basis (u, v) = Either (Basis u) (Basis v)
type Basis (Dyn m v) 
Instance details

Defined in Dyna

type Basis (Dyn m v) = Dyn m (Basis v)
type Basis (Rec0 a s) 
Instance details

Defined in Data.Basis

type Basis (Rec0 a s) = Basis a
type Basis (u, v, w) 
Instance details

Defined in Data.Basis

type Basis (u, v, w) = Basis (u, (v, w))
type Basis (AffineDiffProductSpace f g p) 
Instance details

Defined in Data.AffineSpace

type Basis (AffineDiffProductSpace f g p) = Either (Basis (Diff (f p))) (Basis (Diff (g p)))
type Basis ((f :*: g) p) 
Instance details

Defined in Data.Basis

type Basis ((f :*: g) p) = Either (Basis (f p)) (Basis (g p))
type Basis (M1 i c f p) 
Instance details

Defined in Data.Basis

type Basis (M1 i c f p) = Basis (f p)

class VectorSpace v => HasBasis v where #

Minimal complete definition

Nothing

Associated Types

type Basis v #

Representation of the canonical basis for v

type Basis v = Basis (VRep v)

Methods

basisValue :: Basis v -> v #

Interpret basis rep as a vector

decompose :: v -> [(Basis v, Scalar v)] #

Extract coordinates

decompose' :: v -> Basis v -> Scalar v #

Experimental version. More elegant definitions, and friendly to infinite-dimensional vector spaces.

Instances

Instances details
HasBasis Double 
Instance details

Defined in Data.Basis

Associated Types

type Basis Double #

HasBasis Float 
Instance details

Defined in Data.Basis

Associated Types

type Basis Float #

HasBasis CFloat 
Instance details

Defined in Data.Basis

Associated Types

type Basis CFloat #

HasBasis CDouble 
Instance details

Defined in Data.Basis

Associated Types

type Basis CDouble #

Integral a => HasBasis (Ratio a) 
Instance details

Defined in Data.Basis

Associated Types

type Basis (Ratio a) #

Methods

basisValue :: Basis (Ratio a) -> Ratio a #

decompose :: Ratio a -> [(Basis (Ratio a), Scalar (Ratio a))] #

decompose' :: Ratio a -> Basis (Ratio a) -> Scalar (Ratio a) #

HasBasis (Diff (VRep p)) => HasBasis (GenericDiff p) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Basis (GenericDiff p) #

Methods

basisValue :: Basis (GenericDiff p) -> GenericDiff p #

decompose :: GenericDiff p -> [(Basis (GenericDiff p), Scalar (GenericDiff p))] #

decompose' :: GenericDiff p -> Basis (GenericDiff p) -> Scalar (GenericDiff p) #

(BasisArity a, HasBasis a) => HasBasis (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Associated Types

type Basis (Dyn a) #

Methods

basisValue :: Basis (Dyn a) -> Dyn a #

decompose :: Dyn a -> [(Basis (Dyn a), Scalar (Dyn a))] #

decompose' :: Dyn a -> Basis (Dyn a) -> Scalar (Dyn a) #

(HasBasis u, s ~ Scalar u, HasBasis v, s ~ Scalar v) => HasBasis (u, v) 
Instance details

Defined in Data.Basis

Associated Types

type Basis (u, v) #

Methods

basisValue :: Basis (u, v) -> (u, v) #

decompose :: (u, v) -> [(Basis (u, v), Scalar (u, v))] #

decompose' :: (u, v) -> Basis (u, v) -> Scalar (u, v) #

(BasisArity v, HasBasis v, Frp m) => HasBasis (Dyn m v) 
Instance details

Defined in Dyna

Associated Types

type Basis (Dyn m v) #

Methods

basisValue :: Basis (Dyn m v) -> Dyn m v #

decompose :: Dyn m v -> [(Basis (Dyn m v), Scalar (Dyn m v))] #

decompose' :: Dyn m v -> Basis (Dyn m v) -> Scalar (Dyn m v) #

HasBasis a => HasBasis (Rec0 a s) 
Instance details

Defined in Data.Basis

Associated Types

type Basis (Rec0 a s) #

Methods

basisValue :: Basis (Rec0 a s) -> Rec0 a s #

decompose :: Rec0 a s -> [(Basis (Rec0 a s), Scalar (Rec0 a s))] #

decompose' :: Rec0 a s -> Basis (Rec0 a s) -> Scalar (Rec0 a s) #

(HasBasis u, s ~ Scalar u, HasBasis v, s ~ Scalar v, HasBasis w, s ~ Scalar w) => HasBasis (u, v, w) 
Instance details

Defined in Data.Basis

Associated Types

type Basis (u, v, w) #

Methods

basisValue :: Basis (u, v, w) -> (u, v, w) #

decompose :: (u, v, w) -> [(Basis (u, v, w), Scalar (u, v, w))] #

decompose' :: (u, v, w) -> Basis (u, v, w) -> Scalar (u, v, w) #

(AffineSpace (f p), AffineSpace (g p), HasBasis (Diff (f p)), HasBasis (Diff (g p)), Scalar (Diff (f p)) ~ Scalar (Diff (g p))) => HasBasis (AffineDiffProductSpace f g p) 
Instance details

Defined in Data.AffineSpace

Associated Types

type Basis (AffineDiffProductSpace f g p) #

Methods

basisValue :: Basis (AffineDiffProductSpace f g p) -> AffineDiffProductSpace f g p #

decompose :: AffineDiffProductSpace f g p -> [(Basis (AffineDiffProductSpace f g p), Scalar (AffineDiffProductSpace f g p))] #

decompose' :: AffineDiffProductSpace f g p -> Basis (AffineDiffProductSpace f g p) -> Scalar (AffineDiffProductSpace f g p) #

(HasBasis (f p), HasBasis (g p), Scalar (f p) ~ Scalar (g p)) => HasBasis ((f :*: g) p) 
Instance details

Defined in Data.Basis

Associated Types

type Basis ((f :*: g) p) #

Methods

basisValue :: Basis ((f :*: g) p) -> (f :*: g) p #

decompose :: (f :*: g) p -> [(Basis ((f :*: g) p), Scalar ((f :*: g) p))] #

decompose' :: (f :*: g) p -> Basis ((f :*: g) p) -> Scalar ((f :*: g) p) #

HasBasis (f p) => HasBasis (M1 i c f p) 
Instance details

Defined in Data.Basis

Associated Types

type Basis (M1 i c f p) #

Methods

basisValue :: Basis (M1 i c f p) -> M1 i c f p #

decompose :: M1 i c f p -> [(Basis (M1 i c f p), Scalar (M1 i c f p))] #

decompose' :: M1 i c f p -> Basis (M1 i c f p) -> Scalar (M1 i c f p) #

data Key #

Representations of non-modifier keys.

  • KFun is indexed from 0 to 63. Range of supported FKeys varies by terminal and keyboard.
  • KUpLeft, KUpRight, KDownLeft, KDownRight, KCenter support varies by terminal and keyboard.
  • Actually, support for most of these but KEsc, KChar, KBS, and KEnter vary by terminal and keyboard.

Instances

Instances details
Eq Key 
Instance details

Defined in Graphics.Vty.Input.Events

Methods

(==) :: Key -> Key -> Bool #

(/=) :: Key -> Key -> Bool #

Ord Key 
Instance details

Defined in Graphics.Vty.Input.Events

Methods

compare :: Key -> Key -> Ordering #

(<) :: Key -> Key -> Bool #

(<=) :: Key -> Key -> Bool #

(>) :: Key -> Key -> Bool #

(>=) :: Key -> Key -> Bool #

max :: Key -> Key -> Key #

min :: Key -> Key -> Key #

Read Key 
Instance details

Defined in Graphics.Vty.Input.Events

Show Key 
Instance details

Defined in Graphics.Vty.Input.Events

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

Generic Key 
Instance details

Defined in Graphics.Vty.Input.Events

Associated Types

type Rep Key :: Type -> Type #

Methods

from :: Key -> Rep Key x #

to :: Rep Key x -> Key #

NFData Key 
Instance details

Defined in Graphics.Vty.Input.Events

Methods

rnf :: Key -> () #

Parse Key 
Instance details

Defined in Graphics.Vty.Config

Methods

parseValue :: Parser Key

type Rep Key 
Instance details

Defined in Graphics.Vty.Input.Events

type Rep Key = D1 ('MetaData "Key" "Graphics.Vty.Input.Events" "vty-5.35.1-KZM7sNe0OABAUeGlQIWLj" 'False) ((((C1 ('MetaCons "KEsc" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KChar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'NoSourceStrictness 'DecidedStrict) (Rec0 Char)) :+: C1 ('MetaCons "KBS" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "KEnter" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KLeft" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KRight" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "KUp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KDown" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KUpLeft" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "KUpRight" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KDownLeft" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KDownRight" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "KCenter" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KFun" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)) :+: C1 ('MetaCons "KBackTab" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "KPrtScr" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KPause" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KIns" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "KHome" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KPageUp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KDel" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "KEnd" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KPageDown" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "KBegin" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KMenu" 'PrefixI 'False) (U1 :: Type -> Type))))))

data Modifier #

Modifier keys. Key codes are interpreted such that users are more likely to have Meta than Alt; for instance on the PC Linux console, MMeta will generally correspond to the physical Alt key.

Constructors

MShift 
MCtrl 
MMeta 
MAlt 

Instances

Instances details
Eq Modifier 
Instance details

Defined in Graphics.Vty.Input.Events

Ord Modifier 
Instance details

Defined in Graphics.Vty.Input.Events

Read Modifier 
Instance details

Defined in Graphics.Vty.Input.Events

Show Modifier 
Instance details

Defined in Graphics.Vty.Input.Events

Generic Modifier 
Instance details

Defined in Graphics.Vty.Input.Events

Associated Types

type Rep Modifier :: Type -> Type #

Methods

from :: Modifier -> Rep Modifier x #

to :: Rep Modifier x -> Modifier #

NFData Modifier 
Instance details

Defined in Graphics.Vty.Input.Events

Methods

rnf :: Modifier -> () #

Parse Modifier 
Instance details

Defined in Graphics.Vty.Config

Methods

parseValue :: Parser Modifier

type Rep Modifier 
Instance details

Defined in Graphics.Vty.Input.Events

type Rep Modifier = D1 ('MetaData "Modifier" "Graphics.Vty.Input.Events" "vty-5.35.1-KZM7sNe0OABAUeGlQIWLj" 'False) ((C1 ('MetaCons "MShift" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MCtrl" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MMeta" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MAlt" 'PrefixI 'False) (U1 :: Type -> Type)))

data Dyn a Source #

Dynamic value that continuously changes over time

Instances

Instances details
Functor Dyn Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

fmap :: (a -> b) -> Dyn a -> Dyn b #

(<$) :: a -> Dyn b -> Dyn a #

Applicative Dyn Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

pure :: a -> Dyn a #

(<*>) :: Dyn (a -> b) -> Dyn a -> Dyn b #

liftA2 :: (a -> b -> c) -> Dyn a -> Dyn b -> Dyn c #

(*>) :: Dyn a -> Dyn b -> Dyn b #

(<*) :: Dyn a -> Dyn b -> Dyn a #

RunFunctor Dyn Source # 
Instance details

Defined in Dyna.Brick.Frp

Methods

fmap' :: (a -> Run b) -> Dyn a -> Dyn b Source #

Fractional a => Fractional (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(/) :: Dyn a -> Dyn a -> Dyn a #

recip :: Dyn a -> Dyn a #

fromRational :: Rational -> Dyn a #

Num a => Num (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(+) :: Dyn a -> Dyn a -> Dyn a #

(-) :: Dyn a -> Dyn a -> Dyn a #

(*) :: Dyn a -> Dyn a -> Dyn a #

negate :: Dyn a -> Dyn a #

abs :: Dyn a -> Dyn a #

signum :: Dyn a -> Dyn a #

fromInteger :: Integer -> Dyn a #

IsString a => IsString (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

fromString :: String -> Dyn a #

Semigroup a => Semigroup (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(<>) :: Dyn a -> Dyn a -> Dyn a #

sconcat :: NonEmpty (Dyn a) -> Dyn a #

stimes :: Integral b => b -> Dyn a -> Dyn a #

Monoid a => Monoid (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

mempty :: Dyn a #

mappend :: Dyn a -> Dyn a -> Dyn a #

mconcat :: [Dyn a] -> Dyn a #

Boolean a => Boolean (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

true :: Dyn a #

false :: Dyn a #

notB :: Dyn a -> Dyn a #

(&&*) :: Dyn a -> Dyn a -> Dyn a #

(||*) :: Dyn a -> Dyn a -> Dyn a #

IfB a => IfB (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

ifB :: bool ~ BooleanOf (Dyn a) => bool -> Dyn a -> Dyn a -> Dyn a #

EqB a => EqB (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(==*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

(/=*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

OrdB a => OrdB (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(<*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

(<=*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

(>*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

(>=*) :: bool ~ BooleanOf (Dyn a) => Dyn a -> Dyn a -> bool #

AdditiveGroup a => AdditiveGroup (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

zeroV :: Dyn a #

(^+^) :: Dyn a -> Dyn a -> Dyn a #

negateV :: Dyn a -> Dyn a #

(^-^) :: Dyn a -> Dyn a -> Dyn a #

VectorSpace a => VectorSpace (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Associated Types

type Scalar (Dyn a) #

Methods

(*^) :: Scalar (Dyn a) -> Dyn a -> Dyn a #

AffineSpace a => AffineSpace (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Associated Types

type Diff (Dyn a) #

Methods

(.-.) :: Dyn a -> Dyn a -> Diff (Dyn a) #

(.+^) :: Dyn a -> Diff (Dyn a) -> Dyn a #

HasCross3 a => HasCross3 (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

cross3 :: Dyn a -> Dyn a -> Dyn a #

HasCross2 a => HasCross2 (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

cross2 :: Dyn a -> Dyn a #

HasNormal a => HasNormal (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

normalVec :: Dyn a -> Dyn a #

(BasisArity a, HasBasis a) => HasBasis (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

Associated Types

type Basis (Dyn a) #

Methods

basisValue :: Basis (Dyn a) -> Dyn a #

decompose :: Dyn a -> [(Basis (Dyn a), Scalar (Dyn a))] #

decompose' :: Dyn a -> Basis (Dyn a) -> Scalar (Dyn a) #

type BooleanOf (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

type BooleanOf (Dyn a) = Dyn (BooleanOf a)
type Scalar (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

type Scalar (Dyn a) = Scalar (Dyn Run a)
type Diff (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

type Diff (Dyn a) = Diff (Dyn Run a)
type Basis (Dyn a) Source # 
Instance details

Defined in Dyna.Brick.Types

type Basis (Dyn a) = Basis (Dyn Run a)

data Evt a Source #

Event stream

Instances

Instances details
Monad Evt Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(>>=) :: Evt a -> (a -> Evt b) -> Evt b #

(>>) :: Evt a -> Evt b -> Evt b #

return :: a -> Evt a #

Functor Evt Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

fmap :: (a -> b) -> Evt a -> Evt b #

(<$) :: a -> Evt b -> Evt a #

Applicative Evt Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

pure :: a -> Evt a #

(<*>) :: Evt (a -> b) -> Evt a -> Evt b #

liftA2 :: (a -> b -> c) -> Evt a -> Evt b -> Evt c #

(*>) :: Evt a -> Evt b -> Evt b #

(<*) :: Evt a -> Evt b -> Evt a #

RunFunctor Evt Source # 
Instance details

Defined in Dyna.Brick.Frp

Methods

fmap' :: (a -> Run b) -> Evt a -> Evt b Source #

Semigroup (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(<>) :: Evt a -> Evt a -> Evt a #

sconcat :: NonEmpty (Evt a) -> Evt a #

stimes :: Integral b => b -> Evt a -> Evt a #

Monoid (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

mempty :: Evt a #

mappend :: Evt a -> Evt a -> Evt a #

mconcat :: [Evt a] -> Evt a #

Loop (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

loop :: Evt a -> Evt a #

Limit (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

lim :: DurOf (Evt a) -> Evt a -> Evt a #

Compose (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Harmony (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

har :: [Evt a] -> Evt a #

(=:=) :: Evt a -> Evt a -> Evt a #

Melody (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

mel :: [Evt a] -> Evt a #

(+:+) :: Evt a -> Evt a -> Evt a #

type DurOf (Evt a) Source # 
Instance details

Defined in Dyna.Brick.Types

type DurOf (Evt a) = Float

data Run a Source #

Instances

Instances details
Monad Run Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

(>>=) :: Run a -> (a -> Run b) -> Run b #

(>>) :: Run a -> Run b -> Run b #

return :: a -> Run a #

Functor Run Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

fmap :: (a -> b) -> Run a -> Run b #

(<$) :: a -> Run b -> Run a #

Applicative Run Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

pure :: a -> Run a #

(<*>) :: Run (a -> b) -> Run a -> Run b #

liftA2 :: (a -> b -> c) -> Run a -> Run b -> Run c #

(*>) :: Run a -> Run b -> Run b #

(<*) :: Run a -> Run b -> Run a #

MonadIO Run Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

liftIO :: IO a -> Run a #

MonadRandom Run Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

getRandomR :: Random a => (a, a) -> Run a #

getRandom :: Random a => Run a #

getRandomRs :: Random a => (a, a) -> Run [a] #

getRandoms :: Random a => Run [a] #

Frp Run Source # 
Instance details

Defined in Dyna.Brick.Types

Associated Types

type Ref Run :: Type -> Type #

MonadReader Env Run Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

ask :: Run Env #

local :: (Env -> Env) -> Run a -> Run a #

reader :: (Env -> a) -> Run a #

MonadBase IO Run Source # 
Instance details

Defined in Dyna.Brick.Types

Methods

liftBase :: IO α -> Run α #

MonadBaseControl IO Run Source # 
Instance details

Defined in Dyna.Brick.Types

Associated Types

type StM Run a #

Methods

liftBaseWith :: (RunInBase Run IO -> IO a) -> Run a #

restoreM :: StM Run a -> Run a #

type Ref Run Source # 
Instance details

Defined in Dyna.Brick.Types

type Ref Run = IORef
type StM Run a Source # 
Instance details

Defined in Dyna.Brick.Types

type StM Run a

data Spec Source #

Instances

Instances details
Default Spec Source # 
Instance details

Defined in Dyna.Brick.Run

Methods

def :: Spec #

runApp :: Spec -> Run Win -> IO () Source #

Run application

class RunFunctor f where Source #

Methods

fmap' :: (a -> Run b) -> f a -> f b Source #

Instances

Instances details
RunFunctor Dyn Source # 
Instance details

Defined in Dyna.Brick.Frp

Methods

fmap' :: (a -> Run b) -> Dyn a -> Dyn b Source #

RunFunctor Evt Source # 
Instance details

Defined in Dyna.Brick.Frp

Methods

fmap' :: (a -> Run b) -> Evt a -> Evt b Source #

data DynRef a Source #

Reference to running dynamic process by which we can query values (readDyn). Also note that we no longer need the reference we should release the resources by calling cancelDyn.

constDyn :: Run a -> Dyn a Source #

Dyn that is constructed from effectful callback.

runDyn :: Dyn a -> Run (DynRef a) Source #

Executes dynamic for observation. The dynamic is step-wise constant function that is driven by some event stream. The function runs the event stream process in background and samples the updated state.

We can observe the value with readDyn. We need to shut down the stream when we no longer need it with cancelDyn function.

once :: Run a -> Evt a Source #

Event that happens only once and happens right away.

never :: Evt a Source #

Event that never happens. Callback function is ignored.

newEvt :: Evt a -> Run (Evt a) Source #

Runs the argument event stream as background process and produces event stream that is fed with events over channel (unagi-channel package). When result event stream shuts down the background process also shuts down.

newDyn :: Dyn a -> Run (Dyn a) Source #

Runs the dynamic process in background and returns dynamic that just samples the background proces with readDyn.

accum :: (a -> s -> (b, s)) -> s -> Evt a -> Evt b Source #

Accumulate over event stream.

accum' :: (a -> s -> Run (b, s)) -> s -> Evt a -> Evt b Source #

Accumulate over event stream.

accumMay :: (a -> s -> Maybe (b, s)) -> s -> Evt a -> Evt b Source #

Accumulate over event stream.

accumMay' :: (a -> s -> Run (Maybe (b, s))) -> s -> Evt a -> Evt b Source #

Accumulate over event stream.

scan :: (a -> b -> b) -> b -> Evt a -> Evt b Source #

scan over event stream. Example:

naturals = scan (+) 0 pulse

scan' :: (a -> b -> Run b) -> b -> Evt a -> Evt b Source #

scan over event stream with effectful function.

scanMay :: (a -> b -> Maybe b) -> b -> Evt a -> Evt b Source #

scan combined with filter. If accumulator function produces Nothing on event then that event is ignored and state is kept to previous state.

scanMay' :: (a -> b -> Run (Maybe b)) -> b -> Evt a -> Evt b Source #

scan combined with filter for effectful function. See scanMay for details.

foldMaps :: Monoid b => (a -> b) -> Evt a -> Evt b Source #

Combo of fmap and appendE

races :: Evt a -> Evt a -> Evt a Source #

Repeatedly executes the same event stream

forks :: Evt a -> Evt a Source #

Repeatedly executes the same event stream

forevers :: Evt a -> Evt a Source #

Repeatedly executes the same event stream

iterates :: (a -> a) -> a -> Evt b -> Evt a Source #

Iterates over event stream. It's like scan but it ignores the values of underying stream and starts with initial value as first element.

withIterates :: (a -> a) -> a -> Evt b -> Evt (a, b) Source #

iterates' :: (a -> Run a) -> a -> Evt b -> Evt a Source #

Effectful version for iterateE.

readDyn :: DynRef a -> Run a Source #

Reads current dynamic value.

cancelDyn :: DynRef a -> Run () Source #

Shuts down the background process for dynamic and releases resulrces for event stream that drives the dynamic.

hold :: a -> Evt a -> Dyn a Source #

Turns event stream to dynamic. It holds the values of events until the next event happen. It starts with initial value.

hold initVal events = ...

count :: Evt a -> Evt Int Source #

Counts how many events accured so far on the stream.

withCount :: Evt a -> Evt (Int, a) Source #

unhold :: Dyn a -> Evt a Source #

Turns dynamic into event stream of underlying events that trigger dynamic updates.

scanD :: (a -> b -> b) -> b -> Evt a -> Dyn b Source #

scans over event stream and converts it to dynamic.

accumB :: a -> Evt (a -> a) -> Dyn a Source #

Accumulates the values with event stream that produce functions.

scanMayD :: (a -> b -> Maybe b) -> b -> Evt a -> Dyn b Source #

Dynamic scan that can also filter out events. If Nothing is produced then the event is skipped.

foreach :: (a -> Run ()) -> Evt a -> Evt a Source #

Adds some procedure to callback. Procedure is called prior to callback execution.

posteach :: (a -> Run ()) -> Evt a -> Evt a Source #

Adds some procedure to callback. Procedure is called after callback execution.

apply :: Dyn (a -> b) -> Evt a -> Evt b Source #

Applies a function to event stream value. The function is sampled from dynamic process.

apply' :: Dyn (a -> Run b) -> Evt a -> Evt b Source #

Effectful variant of apply.

(<@>) :: Dyn (a -> b) -> Evt a -> Evt b infixl 4 Source #

Infix variant of apply

(<@) :: Dyn a -> Evt b -> Evt a infixl 4 Source #

Infix variant of snap.

applyMay :: Dyn (a -> Maybe b) -> Evt a -> Evt b Source #

Apply combined with filter.

applyMay' :: Dyn (a -> Run (Maybe b)) -> Evt a -> Evt b Source #

Effectful applyMay.

snap :: Dyn a -> Evt b -> Evt a Source #

Snapshot of dynamic process with event stream. All values in the event stream are substituted with current value of dynamic.

attach :: Dyn a -> Evt b -> Evt (a, b) Source #

Kind of zipWith function for dynamics and event streams.

attachWith :: (a -> b -> c) -> Dyn a -> Evt b -> Evt c Source #

Kind of zipWith function for dynamics and event streams.

attachWithMay :: (a -> b -> Maybe c) -> Dyn a -> Evt b -> Evt c Source #

Attach with filtering. When Nothing is produced event is omitted from the stream.

mapMay :: (a -> Maybe b) -> Evt a -> Evt b Source #

Map with filtering. When Nothing is produced event is omitted from the stream.

mapMay' :: (a -> Run (Maybe b)) -> Evt a -> Evt b Source #

Map with filtering. When Nothing is produced event is omitted from the stream.

filters :: (a -> Bool) -> Evt a -> Evt a Source #

Filtering of the event strewams. Only events that produce True remain in the stream.

filters' :: (a -> Run Bool) -> Evt a -> Evt a Source #

Effectful filtering for event streams.

filterJust :: Evt (Maybe a) -> Evt a Source #

Filters based on Maybe. If Nothing is produced forthe event it is omitted from the stream.

whens :: Dyn Bool -> Evt a -> Evt a Source #

Filters with dynamic. When dynamic is true events pass through and when it's false events are omitted.

splits :: Evt (Either a b) -> (Evt a, Evt b) Source #

Splits the either event stream.

lefts :: Evt (Either a b) -> Evt a Source #

Gets all left events from the stream

rights :: Evt (Either a b) -> Evt b Source #

Gets all right events from the stream

takes :: Int -> Evt a -> Evt a Source #

Takes only so many events from the stream

drops :: Int -> Evt a -> Evt a Source #

Takes only so many events from the stream

takesWhile :: (a -> Bool) -> Evt a -> Evt a Source #

Takes events only while predicate is true.

dropsWhile :: (a -> Bool) -> Evt a -> Evt a Source #

Takes events only while predicate is true.

listAt :: [a] -> Evt Int -> Evt a Source #

Takes elements from the list by index. If index is out of bounds the event is omitted.

toToggle :: Evt a -> Evt Bool Source #

Turns event stream to toggle stream. It produce cyclic sequence of [True, False]

cycles :: [a] -> Evt b -> Evt a Source #

Cycles the values in the list over event sream.

sums :: Num a => Evt a -> Evt a Source #

Sums all the elements in the event stream

sumD :: Num a => Float -> Dyn a -> Dyn a Source #

Sums all the elements in the event stream

integrate :: (VectorSpace v, Scalar v ~ Float) => Float -> Dyn v -> Dyn v Source #

products :: Num a => Evt a -> Evt a Source #

Finds the product of all elements in the event stream.

appends :: Monoid a => Evt a -> Evt a Source #

Monoidal append of all elements in the stream

folds :: Monoid a => Evt a -> Run a Source #

Monoidal fold for event streams, note that stream have to be finite for the function to complete

foldls :: (b -> a -> b) -> b -> Evt a -> Run b Source #

Left fold for event streams, note that stream have to be finite for the function to complete

foldls' :: (b -> a -> Run b) -> b -> Evt a -> Run b Source #

Effectful left fold

foldrs :: (a -> b -> b) -> b -> Evt a -> Run b Source #

Right fold for event streams, note that stream have to be finite for the function to complete

foldrs' :: (a -> b -> Run b) -> b -> Evt a -> Run b Source #

Effectful right fold

prints :: Show a => Evt a -> Run () Source #

Starts event stream process and as callback prints it values.

putStrLns :: Evt String -> Run () Source #

Starts event stream process and as callback prints it values.

switchDyn :: Dyn (Evt a) -> Evt a Source #

Queries the event stream form dynamic and runs it all next event streams are ignored.

joins :: Evt (Evt a) -> Evt a Source #

Joins event stream of streams. If stream is started it runs until the end.

fix1 :: (Evt a -> Run (Evt a)) -> Evt a Source #

Recursion on event streams. As event streams are functions we can not use normal recursion that haskell provides. It will stuck the execution. But we can use fix1 to create event stream that feeds back the events to itself.

Note that any sort of recursion can be implemented with fix1. For example if we need 3-recursive event stream:

fix3 ::
     (Evt a -> Evt b -> Evt c -> (Evt a, Evt b, Evt c))
  -> (Evt a, Evt b, Evt c)

we can use sum tpye tags to join it to single stream:

data Tag a b c = TagA a | TagB b | TagC c
fix3 f = unwrap $ fix1 g
  where
     g x = wrap (f (unwrapA x) (unwrapB x) (unwrapC x))

     wrap a b c = mconcat [TagA <$> a, TagB <$> b, TagC <$> c]
     unwrap evt = (unwrapA evt, unwrapB evt, unwrapC evt)

     unwrapA = flip mapMay $ \x -> case x of
                                 TagA a -> Just a
                                 _      -> Nothing

We can use this trck with any number of streams. There are helper functions: fix2, fix3, fix4

fix2 :: (Evt a -> Evt b -> Run (Evt a, Evt b)) -> (Evt a, Evt b) Source #

Recursion for binary functions

fix3 :: (Evt a -> Evt b -> Evt c -> Run (Evt a, Evt b, Evt c)) -> (Evt a, Evt b, Evt c) Source #

Recursion for ternary functions

fix4 :: (Evt a -> Evt b -> Evt c -> Evt d -> Run (Evt a, Evt b, Evt c, Evt d)) -> (Evt a, Evt b, Evt c, Evt d) Source #

Recursion for functions of four arguments

switch :: Evt (Evt a) -> Evt a Source #

Flattens event stream producer by switching between event streams. When next event stream happens it shuts down the previous one.

switchD :: Dyn a -> Evt (Dyn a) -> Dyn a Source #

Switches between dynamic producers.

mchanEvt :: Chan a -> Evt a Source #

Creates the event stream that listens to MVar based channel. If any value is put chan the event stream fires the callback.

tchanEvt :: TChan a -> Evt a Source #

Creates the event stream that listens to MVar based channel. If any value is put chan the event stream fires the callback.

uchanEvt :: InChan a -> Evt a Source #

Creates the event stream that listens to unagi channel (package unagi-chan). If any value is put chan the event stream fires the callback.

clock :: NominalDiffTime -> Evt UTCTime Source #

Queries current time periodically with given period in seconds.

pulse :: NominalDiffTime -> Evt () Source #

Produces pulse events with given period in seconds.

ticks :: Float -> Evt Float Source #

Produces pulse events with given period in seconds and also tells how many seconds exactly has passed. It can be useful for simulations of models that are based on differential equations. As event streams carries how much time has passed between simulation steps.

timer :: Float -> Evt Float Source #

Timer behaves like tocks only it produces accumulated time since beginning of the process. It calculates them by querying current time and suntracting start time from it.

It can be though of as:

sumE ticks

timerD :: Float -> Dyn Float Source #

Continuous timeline updated at given interval.

toRandom :: Random b => Evt a -> Evt b Source #

Substitutes values in event stream with random values.

toRandomR :: Random b => (b, b) -> Evt a -> Evt b Source #

Substitutes values in event stream with random values from the given range.

withRandom :: Random b => Evt a -> Evt (b, a) Source #

Substitutes values in event stream with random values.

withRandomR :: Random b => (b, b) -> Evt a -> Evt (b, a) Source #

Substitutes values in event stream with random values from the given range.

oneOf :: [a] -> Evt b -> Evt a Source #

Picks at random one element from the list

withOneOf :: [a] -> Evt b -> Evt (a, b) Source #

Picks at random one element from the list

freqOf :: Dyn [(a, Rational)] -> Evt b -> Evt a Source #

Picks at random one element from the list. We also provide distribution of events. Probability to pick up the element. Sum of probabilities should equal to 1.

withFreqOf :: Dyn [(a, Rational)] -> Evt b -> Evt (a, b) Source #

Picks at random one element from the list. We also provide distribution of events. Probability to pick up the element. Sum of probabilities should equal to 1.

randSkip :: Dyn Double -> Evt a -> Evt a Source #

Skips at random elements from the list. We provide frequency to skip events with dynamic first argument.

randSkipBy :: Dyn (a -> Double) -> Evt a -> Evt a Source #

Skips elements at random. The probability to skip element depends on the element itself.

delay :: NominalDiffTime -> Evt a -> Evt a Source #

Delays in the thread of execution. Note that it can interfere and screw up functions like clock, timer, pulse, ticks

delayFork :: NominalDiffTime -> Evt a -> Evt a Source #

Delays in background by forking on each event. Note tht if delayed event was put into background prior to stopping of the main event stream it will fire anyway. There is no way to stop it.