Safe Haskell | None |
---|
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
static
name
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 {}
- 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
.
Output | |
|
Is this result visible? If not, report
will not show it.
:: ([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.
:: Int | Find at least this many. If this number is less than or equal
to zero, |
-> (a -> [b]) | Fanout function |
-> Pred b | |
-> Pred a |
Indents and formats output for display.