prednote-0.26.0.2

Safe HaskellSafe-Inferred

Prednote.Prebuilt

Description

Functions to work with Pred. This module works with Text and produces Pred that make sparing use of color. For more control over the Pred produced, use Prednote.Pred.Core.

Exports some names that conflict with Prelude names, so you might want to do something like

 import qualified Prednote.Pred as P

Synopsis

Documentation

predicateSource

Arguments

:: Text

Static label

-> (a -> Text)

Computes the dynamic label. Do not indicate whether the result is True or False; this is automatically done for you.

-> (a -> Bool)

Predicate function

-> Pred a 

Builds predicates.

true :: Pred aSource

Always returns True and is always visible.

false :: Pred aSource

Always returns False and is always visible.

same :: Pred BoolSource

Returns the subject as is; is always visible.

wrapSource

Arguments

:: Text

Static label

-> (a -> Text)

Computes the dynamic label. Do not indicate whether the result is True or False; this is automatically done for you.

-> (a -> b) 
-> Pred b 
-> Pred a 

Makes an existing Pred the child of a new Pred. The new Pred has the same result as the child Pred. The new Pred is always visible and never short circuits.

visibilitySource

Arguments

:: (Bool -> Visible)

When applied to the result of the Pred, this function returns the desired visibility.

-> Pred a 
-> Pred a 

Creates a Pred with its visibility modified.

reveal :: Pred a -> Pred aSource

Creates a Pred that is always shown.

hide :: Pred a -> Pred aSource

Creates a Pred that is always hidden.

showTrue :: Pred a -> Pred aSource

Creates a Pred that is shown only if its result is True.

showFalse :: Pred a -> Pred aSource

Creates a Pred that is shown only if its result is False.

all :: [Pred a] -> Pred aSource

No child Pred may be False. An empty list of child Pred returns True. Always visible.

(&&&) :: Pred a -> Pred a -> Pred aSource

Creates all Pred that are always visible.

any :: [Pred a] -> Pred aSource

At least one child Pred must be True. An empty list of child Pred returns False. Always visible.

(|||) :: Pred a -> Pred a -> Pred aSource

Creates any Pred that are always visible.

not :: Pred a -> Pred aSource

Negation. Always visible.

fanAll :: (a -> [b]) -> Pred b -> Pred aSource

No fanned-out item may be False. An empty list of child items returns True.

fanAny :: (a -> [b]) -> Pred b -> Pred aSource

At least one fanned-out item must be True. An empty list of child items returns False.

fanAtLeast :: Int -> (a -> [b]) -> Pred b -> Pred aSource

At least the given number of child items must be True.