| Safe Haskell | Safe-Inferred |
|---|
Prednote.Core
Description
Pred core functions. If your needs are simple, Prednote.Prebuilt
is easier to use. However, the types and functions in this module
give you more control.
Each function in this module that returns a Pred returns one with
the following characteristics:
- No
staticname
Upon evaluation:
Thus, the Pred created by this module are rather bare-bones, but
you can modify them as you see fit; Prednote.Prebuilt already
does this for you.
This module exports some names that conflict with Prelude names, so you might want to do something like
import qualified Prednote.Pred.Core as P
- type Chunker = Int -> [Chunk]
- data Pred a = Pred {}
- data Output = Output {}
- newtype Visible = Visible {
- unVisible :: Bool
- shown :: Visible
- hidden :: Visible
- all :: [Pred a] -> Pred a
- any :: [Pred a] -> Pred a
- not :: Pred a -> Pred a
- fan :: ([Bool] -> (Bool, Visible, Maybe Int)) -> (a -> [b]) -> Pred b -> Pred a
- fanAll :: (a -> [b]) -> Pred b -> Pred a
- fanAny :: (a -> [b]) -> Pred b -> Pred a
- fanAtLeast :: Int -> (a -> [b]) -> Pred b -> Pred a
- report :: Int -> Tree Output -> [Chunk]
- plan :: Int -> Pred a -> [Chunk]
- test :: Pred a -> a -> Bool
- testV :: Pred a -> a -> (Bool, [Chunk])
- filter :: Pred a -> [a] -> [a]
- filterV :: Pred a -> [a] -> ([a], [Chunk])
- shorter :: [a] -> [a] -> Bool
Documentation
type Chunker = Int -> [Chunk]Source
Indicates how to display text. This function is applied to an
Int that is the level of indentation; each level of descent
through a tree of Pred increments this Int by one. Because the
function returns a list of Chunk, you can use multiple colors.
Typically this function will indent text accordingly, with a
newline at the end.
The result of evaluating a Pred.
Constructors
| Output | |
Fields
| |
Instances
| Show Output |
Is this result visible? If not, report will not show it.
Arguments
| :: ([Bool] -> (Bool, Visible, Maybe Int)) | This function is applied to a list of the The resulting |
| -> (a -> [b]) | Fanout function |
| -> Pred b | |
| -> Pred a |
Fanout. May short circuit.
Fanout all. The resulting Pred is True if no child item
returns False; an empty list of child items returns True. May
short circuit.
Fanout any. The resulting Pred is True if at least one child
item returns True; an empty list of child items returns False.
May short circuit.
Arguments
| :: Int | Find at least this many. If this number is less than or equal
to zero, |
| -> (a -> [b]) | Fanout function |
| -> Pred b | |
| -> Pred a |
Fanout at least. The resulting Pred is True if at least the
given number of child items return True. May short circuit.
Indents and formats output for display.