Copyright | (c) Grant Weyburne 2019 |
---|---|
License | BSD-3 |
Maintainer | gbwey9@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data TT a = TT {}
- data BoolT a where
- tBool :: Lens (TT a) (TT b) (BoolT a) (BoolT b)
- tStrings :: Lens' (TT a) [String]
- tForest :: Lens' (TT a) (Forest PE)
- pStrings :: Lens' PE [String]
- boolT2P :: Lens' (BoolT a) BoolP
- data BoolP
- data PE = PE {}
- pBool :: Lens' PE BoolP
- mkNode :: POpts -> BoolT a -> [String] -> [Holder] -> TT a
- mkNodeB :: POpts -> Bool -> [String] -> [Holder] -> TT Bool
- partitionTTs :: [TT a] -> ([TT x], [TT a])
- getTTLR :: TT a -> Either (TT x) (TT a)
- partitionTTExtended :: (w, TT a) -> ([((w, TT x), String)], [(w, TT a)])
- getValLRFromTT :: TT a -> Either String a
- getValLR :: BoolT a -> Either String a
- shortTT :: BoolT Bool -> Either String String
- fromTT :: TT a -> Tree PE
- data Holder = Holder {}
- fromTTH :: Holder -> Tree PE
- hh :: TT w -> Holder
- getValueLR :: POpts -> String -> TT a -> [Holder] -> Either (TT x) a
- getValueLRHide :: POpts -> String -> TT a -> [Holder] -> Either (TT x) a
- getValueLRImpl :: Bool -> POpts -> String -> TT a -> [Holder] -> Either (TT x) a
- newtype PColor = PColor {}
- data POpts = POpts {}
- data Disp
- defOpts :: POpts
- ol :: POpts
- olc :: POpts
- o0 :: POpts
- o2 :: POpts
- o2n :: POpts
- o3 :: POpts
- ou :: POpts
- oun :: POpts
- setw :: Int -> POpts -> POpts
- setd :: Int -> POpts -> POpts
- setu :: POpts -> POpts
- setc :: (String, PColor) -> POpts -> POpts
- setc0 :: POpts -> POpts
- setc1 :: POpts -> POpts
- setc2 :: POpts -> POpts
- setc3 :: POpts -> POpts
- setc4 :: POpts -> POpts
- color0 :: (String, PColor)
- color1 :: (String, PColor)
- color2 :: (String, PColor)
- color3 :: (String, PColor)
- color4 :: (String, PColor)
- fixBoolT :: TT Bool -> TT Bool
- show01 :: (Show a1, Show a2) => POpts -> String -> a1 -> a2 -> String
- lit01 :: Show a1 => POpts -> String -> a1 -> String -> String
- show01' :: (Show a1, Show a2) => POpts -> String -> a1 -> String -> a2 -> String
- lit01' :: Show a1 => POpts -> String -> a1 -> String -> String -> String
- showLit0 :: POpts -> String -> String -> String
- showLit1 :: POpts -> String -> String -> String
- showLitImpl :: POpts -> Int -> String -> String -> String
- show0 :: Show a => POpts -> String -> a -> String
- show3 :: Show a => POpts -> String -> a -> String
- show1 :: Show a => POpts -> String -> a -> String
- showAImpl :: Show a => POpts -> Int -> String -> a -> String
- data ROpt
- compileRegex :: forall rs a. GetROpts rs => POpts -> String -> String -> [Holder] -> Either (TT a) Regex
- class GetROpts (os :: [ROpt]) where
- getROpts :: [PCREOption]
- class GetROpt (o :: ROpt) where
- data RR
- splitAndAlign :: Show x => POpts -> [String] -> [((Int, x), TT a)] -> Either (TT w) ([a], [((Int, x), TT a)])
- formatList :: forall x z. Show x => POpts -> [((Int, x), z)] -> String
- valsFromTTs :: [TT a] -> [a]
- isTrue :: BoolT Bool -> Bool
- _boolT :: Prism' (BoolT Bool) Bool
- groupErrors :: [String] -> String
- _FailT :: Prism' (BoolT a) String
- _PresentT :: Prism' (BoolT a) a
- _FalseT :: Prism' (BoolT Bool) ()
- _TrueT :: Prism' (BoolT Bool) ()
- imply :: Bool -> Bool -> Bool
- evalBinStrict :: POpts -> String -> (Bool -> Bool -> Bool) -> TT Bool -> TT Bool -> TT Bool
- type family BetweenT (a :: Nat) (b :: Nat) (v :: Nat) :: Constraint where ...
- type NotZeroT v = FailIfT (v == 0) (Text "found zero value")
- type family NullT (x :: Symbol) :: Bool where ...
- type family FailIfT (b :: Bool) (msg :: ErrorMessage) :: Constraint where ...
- type family AndT (b :: Bool) (b1 :: Bool) :: Bool where ...
- type family OrT (b :: Bool) (b1 :: Bool) :: Bool where ...
- type family NotT (b :: Bool) :: Bool where ...
- nat :: forall n a. (KnownNat n, Num a) => a
- symb :: forall s. KnownSymbol s => String
- class GetNats as where
- class GetSymbs ns where
- getLen :: forall xs. GetLen xs => Int
- class GetLen (xs :: [k]) where
- showThese :: These a b -> String
- class GetThese (th :: These x y) where
- class GetOrdering (cmp :: Ordering) where
- class GetBool (a :: Bool) where
- data N
- type family ToN (n :: Nat) :: N where ...
- type family FromN (n :: N) :: Nat where ...
- class GetNatN (n :: N) where
- getN :: Typeable t => Proxy (t :: N) -> Int
- data OrderingP
- class GetOrd (k :: OrderingP) where
- toNodeString :: POpts -> PE -> String
- nullSpace :: String -> String
- showBoolP :: POpts -> BoolP -> String
- displayMessages :: [String] -> String
- colorMe :: POpts -> BoolP -> String -> String
- prtTTIO :: POpts -> IO (TT a) -> IO ()
- prtTT :: POpts -> Identity (TT a) -> IO ()
- prtTT' :: MonadEval m => POpts -> m (TT a) -> IO ()
- prtTree :: POpts -> Tree PE -> IO ()
- prtImpl :: POpts -> Tree String -> IO ()
- fixLite :: forall a. Show a => POpts -> a -> Tree PE -> String
- fixPresentP :: Show a => POpts -> BoolP -> a -> String
- prtTreePure :: POpts -> Tree PE -> String
- showImpl :: POpts -> Tree String -> String
- lite :: POpts -> POpts
- unicode :: POpts -> POpts
- horizontal :: POpts -> POpts
- prettyRational :: Rational -> String
- fixit :: ((Int, x), TT a) -> TT a
- prefixMsg :: String -> TT a -> TT a
- showNat :: forall n. KnownNat n => String
- showT :: forall (t :: Type). Typeable t => String
- showTProxy :: forall p. Typeable (Proxy p) => String
- prettyOrd :: Ordering -> String
- type family RepeatT (n :: Nat) (p :: k) :: [k] where ...
- type family IntersperseT (s :: Symbol) (xs :: [Symbol]) :: Symbol where ...
- type family LenT (xs :: [k]) :: Nat where ...
- type NEmptyT k = ('[] :| '[] :: NonEmpty [k])
- isPrime :: Integer -> Bool
- type family TupleListT (n :: N) a where ...
- class TupleListD (n :: N) a where
- tupleListD :: Bool -> [a] -> Either String (TupleListT n a)
- class ReverseTupleC x where
- type ReverseTupleP x
- reverseTupleC :: x -> ReverseTupleP x
- type family ArrT (as :: Type) :: Type where ...
- type family TupleLenT (t :: Type) :: Nat where ...
- type family (p :: k -> k1) %% (q :: k) :: k1 where ...
- type family (p :: k) %& (q :: k -> k1) :: k1 where ...
- type family FlipT (d :: k1 -> k -> k2) (p :: k) (q :: k1) :: k2 where ...
- type family IfT (b :: Bool) (t :: k) (f :: k) :: k where ...
- type family SumT (ns :: [Nat]) :: Nat where ...
- type family MapT (f :: k -> k1) (xs :: [k]) :: [k1] where ...
- type family ConsT s where ...
- class Monad m => MonadEval m where
- removeAnsiForDocTest :: Show a => Either String a -> IO ()
Documentation
describes the evaluation tree for predicates
TT | the child nodes |
Instances
Foldable TT Source # | |
Defined in UtilP fold :: Monoid m => TT m -> m # foldMap :: Monoid m => (a -> m) -> TT a -> m # foldr :: (a -> b -> b) -> b -> TT a -> b # foldr' :: (a -> b -> b) -> b -> TT a -> b # foldl :: (b -> a -> b) -> b -> TT a -> b # foldl' :: (b -> a -> b) -> b -> TT a -> b # foldr1 :: (a -> a -> a) -> TT a -> a # foldl1 :: (a -> a -> a) -> TT a -> a # elem :: Eq a => a -> TT a -> Bool # maximum :: Ord a => TT a -> a # | |
Show a => Show (TT a) Source # | |
contains the typed result from evaluating the expression tree to this point
Instances
Foldable BoolT Source # | |
Defined in UtilP fold :: Monoid m => BoolT m -> m # foldMap :: Monoid m => (a -> m) -> BoolT a -> m # foldr :: (a -> b -> b) -> b -> BoolT a -> b # foldr' :: (a -> b -> b) -> b -> BoolT a -> b # foldl :: (b -> a -> b) -> b -> BoolT a -> b # foldl' :: (b -> a -> b) -> b -> BoolT a -> b # foldr1 :: (a -> a -> a) -> BoolT a -> a # foldl1 :: (a -> a -> a) -> BoolT a -> a # elem :: Eq a => a -> BoolT a -> Bool # maximum :: Ord a => BoolT a -> a # minimum :: Ord a => BoolT a -> a # | |
Eq a => Eq (BoolT a) Source # | |
Show a => Show (BoolT a) Source # | |
Semigroup a => Semigroup (BoolT a) Source # | |
Monoid a => Monoid (BoolT a) Source # | |
contains the untyped result from evaluating the expression tree to this point
mkNode :: POpts -> BoolT a -> [String] -> [Holder] -> TT a Source #
creates a Node for the evaluation tree
mkNodeB :: POpts -> Bool -> [String] -> [Holder] -> TT Bool Source #
creates a Boolean node for a predicate type
getValueLR :: POpts -> String -> TT a -> [Holder] -> Either (TT x) a Source #
see getValueLRImpl
: add more detail to the tree if there are errors
getValueLRHide :: POpts -> String -> TT a -> [Holder] -> Either (TT x) a Source #
see getValueLRImpl
: add less detail to the tree if there are errors
getValueLRImpl :: Bool -> POpts -> String -> TT a -> [Holder] -> Either (TT x) a Source #
a helper method to add extra context on failure to the tree or extract the value at the root of the tree
the color palette for displaying the expression tree
customizable options
display format for the tree
NormalDisp | draw horizontal tree |
Unicode | use unicode |
displays the detailed evaluation tree using unicode and colors. (o2
works better on Windows)
color0 :: (String, PColor) Source #
no colors are displayed
color palettes
italics dont work but underline does
color1 :: (String, PColor) Source #
default color palette
color palettes
italics dont work but underline does
showLit1 :: POpts -> String -> String -> String Source #
more restrictive: only display data at debug level 1 or less
Regex options for Rescan Resplit Re etc
Anchored | Force pattern anchoring |
Auto_callout | Compile automatic callouts | Bsr_anycrlf -- R matches only CR, LF, or CrlF | Bsr_unicode -- ^ R matches all Unicode line endings |
Caseless | Do caseless matching |
Dollar_endonly | dollar not to match newline at end |
Dotall | matches anything including NL |
Dupnames | Allow duplicate names for subpatterns |
Extended | Ignore whitespace and # comments |
Extra | PCRE extra features (not much use currently) |
Firstline | Force matching to be before newline |
Multiline | caret and dollar match newlines within data | Newline_any -- ^ Recognize any Unicode newline sequence | Newline_anycrlf -- ^ Recognize CR, LF, and CrlF as newline sequences |
Newline_cr | Set CR as the newline sequence |
Newline_crlf | Set CrlF as the newline sequence |
Newline_lf | Set LF as the newline sequence |
No_auto_capture | Disable numbered capturing parentheses (named ones available) |
Ungreedy | Invert greediness of quantifiers |
Utf8 | Run in UTF--8 mode |
No_utf8_check | Do not check the pattern for UTF-8 validity |
compileRegex :: forall rs a. GetROpts rs => POpts -> String -> String -> [Holder] -> Either (TT a) Regex Source #
compile a regex using the type level symbol
class GetROpts (os :: [ROpt]) where Source #
extract the regex options from the type level list
getROpts :: [PCREOption] Source #
class GetROpt (o :: ROpt) where Source #
convert type level regex option to the value level
getROpt :: PCREOption Source #
Instances
used by ReplaceImpl
and sub
and gsub
to allow more flexible replacement
These parallel the RegexReplacement (not exported) class in Text.Regex.PCRE.Heavy but have overlappable instances which is problematic for this code so I use RR
splitAndAlign :: Show x => POpts -> [String] -> [((Int, x), TT a)] -> Either (TT w) ([a], [((Int, x), TT a)]) Source #
extract values from the trees or if there are errors returned a tree with added context
valsFromTTs :: [TT a] -> [a] Source #
extract all root values from a list of trees
groupErrors :: [String] -> String Source #
evalBinStrict :: POpts -> String -> (Bool -> Bool -> Bool) -> TT Bool -> TT Bool -> TT Bool Source #
applies a boolean binary operation against the values from two boolean trees
type family BetweenT (a :: Nat) (b :: Nat) (v :: Nat) :: Constraint where ... Source #
type level Between
type NotZeroT v = FailIfT (v == 0) (Text "found zero value") Source #
makes zero invalid at the type level
type family FailIfT (b :: Bool) (msg :: ErrorMessage) :: Constraint where ... Source #
helper method to fail with an error if the True
symb :: forall s. KnownSymbol s => String Source #
gets the Symbol from the typelevel
class GetOrdering (cmp :: Ordering) where Source #
get ordering from the typelevel
Instances
GetOrdering LT Source # | |
Defined in UtilP | |
GetOrdering EQ Source # | |
Defined in UtilP | |
GetOrdering GT Source # | |
Defined in UtilP |
Instances
Bounded OrderingP Source # | |
Enum OrderingP Source # | |
Defined in UtilP succ :: OrderingP -> OrderingP # pred :: OrderingP -> OrderingP # fromEnum :: OrderingP -> Int # enumFrom :: OrderingP -> [OrderingP] # enumFromThen :: OrderingP -> OrderingP -> [OrderingP] # enumFromTo :: OrderingP -> OrderingP -> [OrderingP] # enumFromThenTo :: OrderingP -> OrderingP -> OrderingP -> [OrderingP] # | |
Eq OrderingP Source # | |
Show OrderingP Source # | |
displayMessages :: [String] -> String Source #
colorMe :: POpts -> BoolP -> String -> String Source #
colors the result of the predicate based on the current color palette
horizontal :: POpts -> POpts Source #
prettyRational :: Rational -> String Source #
type family IntersperseT (s :: Symbol) (xs :: [Symbol]) :: Symbol where ... Source #
IntersperseT s '[] = "" | |
IntersperseT s '[x] = x | |
IntersperseT s (x ': (y ': xs)) = (x `AppendSymbol` s) `AppendSymbol` IntersperseT s (y ': xs) |
type family TupleListT (n :: N) a where ... Source #
TupleListT Z a = () | |
TupleListT (S n) a = (a, TupleListT n a) |
class TupleListD (n :: N) a where Source #
tupleListD :: Bool -> [a] -> Either String (TupleListT n a) Source #
Instances
TupleListD Z a Source # | |
Defined in UtilP tupleListD :: Bool -> [a] -> Either String (TupleListT Z a) Source # | |
TupleListD n a => TupleListD (S n) a Source # | |
Defined in UtilP tupleListD :: Bool -> [a] -> Either String (TupleListT (S n) a) Source # |
class ReverseTupleC x where Source #
type ReverseTupleP x Source #
reverseTupleC :: x -> ReverseTupleP x Source #
Instances
(TypeError (Text "ReverseTupleC: inductive tuple cannot be empty") :: Constraint) => ReverseTupleC () Source # | |
Defined in UtilP type ReverseTupleP () :: Type Source # reverseTupleC :: () -> ReverseTupleP () Source # | |
ReverseTupleC (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, ())))))))))))) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, ())))))))))))) :: Type Source # reverseTupleC :: (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, ())))))))))))) -> ReverseTupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, ())))))))))))) Source # | |
ReverseTupleC (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, ()))))))))))) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, ()))))))))))) :: Type Source # reverseTupleC :: (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, ()))))))))))) -> ReverseTupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, ()))))))))))) Source # | |
ReverseTupleC (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, ())))))))))) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, ())))))))))) :: Type Source # reverseTupleC :: (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, ())))))))))) -> ReverseTupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, ())))))))))) Source # | |
ReverseTupleC (a, (b, (c, (d, (e, (f, (g, (h, (i, ()))))))))) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, ()))))))))) :: Type Source # reverseTupleC :: (a, (b, (c, (d, (e, (f, (g, (h, (i, ()))))))))) -> ReverseTupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, ()))))))))) Source # | |
ReverseTupleC (a, (b, (c, (d, (e, (f, (g, (h, ())))))))) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, (c, (d, (e, (f, (g, (h, ())))))))) :: Type Source # reverseTupleC :: (a, (b, (c, (d, (e, (f, (g, (h, ())))))))) -> ReverseTupleP (a, (b, (c, (d, (e, (f, (g, (h, ())))))))) Source # | |
ReverseTupleC (a, (b, (c, (d, (e, (f, (g, ()))))))) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, (c, (d, (e, (f, (g, ()))))))) :: Type Source # reverseTupleC :: (a, (b, (c, (d, (e, (f, (g, ()))))))) -> ReverseTupleP (a, (b, (c, (d, (e, (f, (g, ()))))))) Source # | |
ReverseTupleC (a, (b, (c, (d, (e, (f, ())))))) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, (c, (d, (e, (f, ())))))) :: Type Source # reverseTupleC :: (a, (b, (c, (d, (e, (f, ())))))) -> ReverseTupleP (a, (b, (c, (d, (e, (f, ())))))) Source # | |
ReverseTupleC (a, (b, (c, (d, (e, ()))))) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, (c, (d, (e, ()))))) :: Type Source # reverseTupleC :: (a, (b, (c, (d, (e, ()))))) -> ReverseTupleP (a, (b, (c, (d, (e, ()))))) Source # | |
ReverseTupleC (a, (b, (c, (d, ())))) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, (c, (d, ())))) :: Type Source # reverseTupleC :: (a, (b, (c, (d, ())))) -> ReverseTupleP (a, (b, (c, (d, ())))) Source # | |
ReverseTupleC (a, (b, (c, ()))) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, (c, ()))) :: Type Source # reverseTupleC :: (a, (b, (c, ()))) -> ReverseTupleP (a, (b, (c, ()))) Source # | |
ReverseTupleC (a, (b, ())) Source # | |
Defined in UtilP type ReverseTupleP (a, (b, ())) :: Type Source # reverseTupleC :: (a, (b, ())) -> ReverseTupleP (a, (b, ())) Source # | |
ReverseTupleC (a, ()) Source # | |
Defined in UtilP type ReverseTupleP (a, ()) :: Type Source # reverseTupleC :: (a, ()) -> ReverseTupleP (a, ()) Source # |
type family FlipT (d :: k1 -> k -> k2) (p :: k) (q :: k1) :: k2 where ... Source #
FlipT d p q = d q p |