prednote-0.26.0.4: Evaluate and display trees of predicates

Safe HaskellSafe-Inferred
LanguageHaskell2010

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

predicate Source

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 a Source

Always returns True and is always visible.

false :: Pred a Source

Always returns False and is always visible.

same :: Pred Bool Source

Returns the subject as is; is always visible.

wrap Source

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.

visibility Source

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 a Source

Creates a Pred that is always shown.

hide :: Pred a -> Pred a Source

Creates a Pred that is always hidden.

showTrue :: Pred a -> Pred a Source

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

showFalse :: Pred a -> Pred a Source

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

all :: [Pred a] -> Pred a Source

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

(&&&) :: Pred a -> Pred a -> Pred a infixr 3 Source

Creates all Pred that are always visible.

any :: [Pred a] -> Pred a Source

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

(|||) :: Pred a -> Pred a -> Pred a infixr 2 Source

Creates any Pred that are always visible.

not :: Pred a -> Pred a Source

Negation. Always visible.

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

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

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

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

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

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