predicate-typed-0.6.0.0: Predicates, Refinement types and Dsl

Safe HaskellNone
LanguageHaskell2010

Predicate.Util

Contents

Description

Utility methods for Predicate / methods for displaying the evaluation tree

Synopsis

TT

data TT a Source #

represents the evaluation tree for predicates

Constructors

TT 

Fields

Instances
Foldable TT Source # 
Instance details

Defined in Predicate.Util

Methods

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 #

toList :: TT a -> [a] #

null :: TT a -> Bool #

length :: TT a -> Int #

elem :: Eq a => a -> TT a -> Bool #

maximum :: Ord a => TT a -> a #

minimum :: Ord a => TT a -> a #

sum :: Num a => TT a -> a #

product :: Num a => TT a -> a #

Show a => Show (TT a) Source # 
Instance details

Defined in Predicate.Util

Methods

showsPrec :: Int -> TT a -> ShowS #

show :: TT a -> String #

showList :: [TT a] -> ShowS #

tBool :: Lens (TT a) (TT b) (BoolT a) (BoolT b) Source #

lens for accessing BoolT in TT

fixBoolT :: TT Bool -> TT Bool Source #

fix PresentT Bool to TrueT or FalseT

BoolT

data BoolT a where Source #

contains the typed result from evaluating the expression tree

Constructors

FailT :: !String -> BoolT a 
FalseT :: BoolT Bool 
TrueT :: BoolT Bool 
PresentT :: !a -> BoolT a 
Instances
Foldable BoolT Source # 
Instance details

Defined in Predicate.Util

Methods

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 #

toList :: BoolT a -> [a] #

null :: BoolT a -> Bool #

length :: BoolT a -> Int #

elem :: Eq a => a -> BoolT a -> Bool #

maximum :: Ord a => BoolT a -> a #

minimum :: Ord a => BoolT a -> a #

sum :: Num a => BoolT a -> a #

product :: Num a => BoolT a -> a #

Eq a => Eq (BoolT a) Source # 
Instance details

Defined in Predicate.Util

Methods

(==) :: BoolT a -> BoolT a -> Bool #

(/=) :: BoolT a -> BoolT a -> Bool #

Show a => Show (BoolT a) Source # 
Instance details

Defined in Predicate.Util

Methods

showsPrec :: Int -> BoolT a -> ShowS #

show :: BoolT a -> String #

showList :: [BoolT a] -> ShowS #

BoolP

boolT2P :: Lens' (BoolT a) BoolP Source #

a lens from typed BoolT to the untyped BoolP

data BoolP Source #

contains the untyped result from evaluating the expression tree

Instances
Eq BoolP Source # 
Instance details

Defined in Predicate.Util

Methods

(==) :: BoolP -> BoolP -> Bool #

(/=) :: BoolP -> BoolP -> Bool #

Show BoolP Source # 
Instance details

Defined in Predicate.Util

Methods

showsPrec :: Int -> BoolP -> ShowS #

show :: BoolP -> String #

showList :: [BoolP] -> ShowS #

data PE Source #

represents the untyped evaluation tree for final display

Constructors

PE BoolP [String] 
Instances
Show PE Source # 
Instance details

Defined in Predicate.Util

Methods

showsPrec :: Int -> PE -> ShowS #

show :: PE -> String #

showList :: [PE] -> ShowS #

create tree functions

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

tree manipulation

fromTT :: TT a -> Tree PE Source #

converts a typed tree to an untyped on for display

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

fixLite :: forall a. Show a => POpts -> a -> Tree PE -> String Source #

fixit :: ((Int, x), TT a) -> TT a Source #

prefixMsg :: String -> TT a -> TT a Source #

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

display options

data POpts Source #

customizable options

Constructors

POpts 

Fields

  • oWidth :: !Int

    length of data to display for showLitImpl

  • oDebug :: !ODebug

    debug level

  • oDisp :: !Disp

    display the tree using the normal tree or unicode

  • oColor :: !(String, PColor)

    color palette used

Instances
Show POpts Source # 
Instance details

Defined in Predicate.Util

Methods

showsPrec :: Int -> POpts -> ShowS #

show :: POpts -> String #

showList :: [POpts] -> ShowS #

data ODebug Source #

Constructors

OZero

one line summary used mainly for testing

OLite

one line summary with additional context from the head of the evaluation tree

OSubNormal

outputs the evaluation tree but skips noisy subtrees

ONormal

outputs the evaluation tree but skips noisy subtrees

OVerbose

outputs the entire evaluation tree

Instances
Bounded ODebug Source # 
Instance details

Defined in Predicate.Util

Enum ODebug Source # 
Instance details

Defined in Predicate.Util

Eq ODebug Source # 
Instance details

Defined in Predicate.Util

Methods

(==) :: ODebug -> ODebug -> Bool #

(/=) :: ODebug -> ODebug -> Bool #

Ord ODebug Source # 
Instance details

Defined in Predicate.Util

Show ODebug Source # 
Instance details

Defined in Predicate.Util

oz :: POpts Source #

minimal data without colors

ol :: POpts Source #

returns the summary without colors

olc :: POpts Source #

same as ol but with colors

o0 :: POpts Source #

displays the detailed evaluation tree without colors.

o2 :: POpts Source #

displays the detailed evaluation tree using colors.

o2n :: POpts Source #

same as o2 but for a narrow display

o3 :: POpts Source #

same as o2 for a wider display and verbose debug mode setting

ou :: POpts Source #

displays the detailed evaluation tree using unicode and colors. (o2 works better on Windows)

ou3 :: POpts Source #

same as ou for a wider display and verbose debug mode setting

oun :: POpts Source #

same as ou but for a narrow display

setw :: Int -> POpts -> POpts Source #

helper method to limit the width of the tree

setu :: POpts -> POpts Source #

set display to unicode and colors

setc :: (String, PColor) -> POpts -> POpts Source #

set a color palette

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

color2 :: (String, PColor) Source #

color palettes

italics dont work but underline does

color3 :: (String, PColor) Source #

color palettes

italics dont work but underline does

color4 :: (String, PColor) Source #

color palettes

italics dont work but underline does

colorMe :: POpts -> BoolP -> String -> String Source #

colors the result of the predicate based on the current color palette

lite :: POpts -> POpts Source #

skip displaying the tree and just output the result

subnormal :: POpts -> POpts Source #

helper method to set the debug level

normal :: POpts -> POpts Source #

helper method to set the debug level

verbose :: POpts -> POpts Source #

helper method to set the debug level

isVerbose :: POpts -> Bool Source #

helper method to set the debug level

ansi :: POpts -> POpts Source #

normal display

unicode :: POpts -> POpts Source #

display in unicode (non-Windows)

formatting functions

show01 :: (Show a1, Show a2) => POpts -> String -> a1 -> a2 -> String Source #

lit01 :: Show a1 => POpts -> String -> a1 -> String -> String Source #

show01' :: (Show a1, Show a2) => POpts -> String -> a1 -> String -> a2 -> String Source #

lit01' :: Show a1 => POpts -> String -> a1 -> String -> String -> String Source #

showLit0 :: POpts -> String -> String -> String Source #

display all data regardless of debug level

showLit1 :: POpts -> String -> String -> String Source #

more restrictive: only display data at debug level 1 or less

show0 :: Show a => POpts -> String -> a -> String Source #

show3 :: Show a => POpts -> String -> a -> String Source #

show1 :: Show a => POpts -> String -> a -> String Source #

showL :: Show a => Int -> a -> String Source #

regular expressions

data ROpt Source #

Regex options for Rescan Resplit Re etc

Constructors

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

Instances
Bounded ROpt Source # 
Instance details

Defined in Predicate.Util

Enum ROpt Source # 
Instance details

Defined in Predicate.Util

Methods

succ :: ROpt -> ROpt #

pred :: ROpt -> ROpt #

toEnum :: Int -> ROpt #

fromEnum :: ROpt -> Int #

enumFrom :: ROpt -> [ROpt] #

enumFromThen :: ROpt -> ROpt -> [ROpt] #

enumFromTo :: ROpt -> ROpt -> [ROpt] #

enumFromThenTo :: ROpt -> ROpt -> ROpt -> [ROpt] #

Eq ROpt Source # 
Instance details

Defined in Predicate.Util

Methods

(==) :: ROpt -> ROpt -> Bool #

(/=) :: ROpt -> ROpt -> Bool #

Ord ROpt Source # 
Instance details

Defined in Predicate.Util

Methods

compare :: ROpt -> ROpt -> Ordering #

(<) :: ROpt -> ROpt -> Bool #

(<=) :: ROpt -> ROpt -> Bool #

(>) :: ROpt -> ROpt -> Bool #

(>=) :: ROpt -> ROpt -> Bool #

max :: ROpt -> ROpt -> ROpt #

min :: ROpt -> ROpt -> ROpt #

Show ROpt Source # 
Instance details

Defined in Predicate.Util

Methods

showsPrec :: Int -> ROpt -> ShowS #

show :: ROpt -> String #

showList :: [ROpt] -> ShowS #

GetROpts ([] :: [ROpt]) Source # 
Instance details

Defined in Predicate.Util

(GetROpt r, GetROpts rs) => GetROpts (r ': rs) Source # 
Instance details

Defined in Predicate.Util

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

Instances
GetROpts ([] :: [ROpt]) Source # 
Instance details

Defined in Predicate.Util

(GetROpt r, GetROpts rs) => GetROpts (r ': rs) Source # 
Instance details

Defined in Predicate.Util

data RReplace Source #

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 RReplace

Instances
Show RReplace Source # 
Instance details

Defined in Predicate.Util

useful type families

type family ZwischenT (a :: Nat) (b :: Nat) (v :: Nat) :: Constraint where ... Source #

type level Between

Equations

ZwischenT m n v = FailUnlessT (AndT (m <=? v) (v <=? n)) (((Text "ZwischenT failure" :$$: ShowType v) :$$: Text " is outside of ") :$$: ((ShowType m :<>: Text " and ") :<>: ShowType n)) 

type family FailWhenT (b :: Bool) (msg :: ErrorMessage) :: Constraint where ... Source #

helper method to fail with a msg when True

Equations

FailWhenT False _ = () 
FailWhenT True e = TypeError e 

type family FailUnlessT (b :: Bool) (msg :: ErrorMessage) :: Constraint where ... Source #

helper method to fail with msg when False

Equations

FailUnlessT True _ = () 
FailUnlessT False e = TypeError e 

type family AndT (b :: Bool) (b1 :: Bool) :: Bool where ... Source #

typelevel And

Equations

AndT False _ = False 
AndT True b1 = b1 

type family OrT (b :: Bool) (b1 :: Bool) :: Bool where ... Source #

typelevel Or

Equations

OrT True _ = True 
OrT False b1 = b1 

type family NotT (b :: Bool) :: Bool where ... Source #

typelevel Not

Equations

NotT True = False 
NotT False = True 

type family RepeatT (n :: Nat) (p :: k) :: [k] where ... Source #

Equations

RepeatT 0 p = TypeError (Text "RepeatT is not defined for zero") 
RepeatT 1 p = p ': '[] 
RepeatT n p = p ': RepeatT (n - 1) p 

type family IntersperseT (s :: Symbol) (xs :: [Symbol]) :: Symbol where ... Source #

Equations

IntersperseT s '[] = "" 
IntersperseT s '[x] = x 
IntersperseT s (x ': (y ': xs)) = x <%> (s <%> IntersperseT s (y ': xs)) 

type family LenT (xs :: [k]) :: Nat where ... Source #

Equations

LenT '[] = 0 
LenT (x ': xs) = 1 + LenT xs 

class InductTupleC x where Source #

takes a flat n-tuple and creates a reversed inductive tuple. see PrintT

>>> inductTupleC (123,'x',False,"abc")
("abc",(False,('x',(123,()))))
>>> inductTupleC (123,'x')
('x',(123,()))

Associated Types

type InductTupleP x Source #

Instances
(TypeError (Text "InductTupleC: inductive tuple cannot be empty") :: Constraint) => InductTupleC () Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP () :: Type Source #

Methods

inductTupleC :: () -> InductTupleP () Source #

InductTupleC (a, b) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b) :: Type Source #

Methods

inductTupleC :: (a, b) -> InductTupleP (a, b) Source #

InductTupleC (a, b, c) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b, c) :: Type Source #

Methods

inductTupleC :: (a, b, c) -> InductTupleP (a, b, c) Source #

InductTupleC (a, b, c, d) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b, c, d) :: Type Source #

Methods

inductTupleC :: (a, b, c, d) -> InductTupleP (a, b, c, d) Source #

InductTupleC (a, b, c, d, e) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b, c, d, e) :: Type Source #

Methods

inductTupleC :: (a, b, c, d, e) -> InductTupleP (a, b, c, d, e) Source #

InductTupleC (a, b, c, d, e, f) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b, c, d, e, f) :: Type Source #

Methods

inductTupleC :: (a, b, c, d, e, f) -> InductTupleP (a, b, c, d, e, f) Source #

InductTupleC (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b, c, d, e, f, g) :: Type Source #

Methods

inductTupleC :: (a, b, c, d, e, f, g) -> InductTupleP (a, b, c, d, e, f, g) Source #

InductTupleC (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b, c, d, e, f, g, h) :: Type Source #

Methods

inductTupleC :: (a, b, c, d, e, f, g, h) -> InductTupleP (a, b, c, d, e, f, g, h) Source #

InductTupleC (a, b, c, d, e, f, g, h, i) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b, c, d, e, f, g, h, i) :: Type Source #

Methods

inductTupleC :: (a, b, c, d, e, f, g, h, i) -> InductTupleP (a, b, c, d, e, f, g, h, i) Source #

InductTupleC (a, b, c, d, e, f, g, h, i, j) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b, c, d, e, f, g, h, i, j) :: Type Source #

Methods

inductTupleC :: (a, b, c, d, e, f, g, h, i, j) -> InductTupleP (a, b, c, d, e, f, g, h, i, j) Source #

InductTupleC (a, b, c, d, e, f, g, h, i, j, k) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b, c, d, e, f, g, h, i, j, k) :: Type Source #

Methods

inductTupleC :: (a, b, c, d, e, f, g, h, i, j, k) -> InductTupleP (a, b, c, d, e, f, g, h, i, j, k) Source #

InductTupleC (a, b, c, d, e, f, g, h, i, j, k, l) Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductTupleP (a, b, c, d, e, f, g, h, i, j, k, l) :: Type Source #

Methods

inductTupleC :: (a, b, c, d, e, f, g, h, i, j, k, l) -> InductTupleP (a, b, c, d, e, f, g, h, i, j, k, l) Source #

class InductListC (n :: Nat) a where Source #

takes a list and converts to a reversed inductive tuple. see PrintL

>>> inductListC @4 [10,12,13,1]
(1,(13,(12,(10,()))))
>>> inductListC @2 ["ab","cc"]
("cc",("ab",()))

Associated Types

type InductListP n a Source #

Methods

inductListC :: [a] -> InductListP n a Source #

Instances
(TypeError (Text "InductListC: inductive tuple cannot be empty") :: Constraint) => InductListC 0 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 0 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 0 a Source #

(TypeError (Text "InductListC: inductive tuple cannot have one element") :: Constraint) => InductListC 1 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 1 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 1 a Source #

InductListC 2 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 2 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 2 a Source #

InductListC 3 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 3 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 3 a Source #

InductListC 4 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 4 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 4 a Source #

InductListC 5 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 5 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 5 a Source #

InductListC 6 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 6 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 6 a Source #

InductListC 7 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 7 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 7 a Source #

InductListC 8 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 8 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 8 a Source #

InductListC 9 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 9 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 9 a Source #

InductListC 10 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 10 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 10 a Source #

InductListC 11 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 11 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 11 a Source #

InductListC 12 a Source # 
Instance details

Defined in Predicate.Util

Associated Types

type InductListP 12 a :: Type Source #

Methods

inductListC :: [a] -> InductListP 12 a Source #

type family FlipT (d :: k1 -> k -> k2) (p :: k) (q :: k1) :: k2 where ... Source #

Equations

FlipT d p q = d q p 

type family IfT (b :: Bool) (t :: k) (f :: k) :: k where ... Source #

Equations

IfT True t f = t 
IfT False t f = f 

type family SumT (ns :: [Nat]) :: Nat where ... Source #

Equations

SumT '[] = 0 
SumT (n ': ns) = n + SumT ns 

type family MapT (f :: k -> k1) (xs :: [k]) :: [k1] where ... Source #

Equations

MapT f '[] = '[] 
MapT f (x ': xs) = f x ': MapT f xs 

type family ConsT s where ... Source #

Extract 'a' from a list like container

Equations

ConsT [a] = a 
ConsT (ZipList a) = a 
ConsT Text = Char 
ConsT ByteString = Word8 
ConsT (Seq a) = a 
ConsT s = TypeError (Text "invalid ConsT instance" :$$: (Text "s = " :<>: ShowType s)) 

type family (p :: k -> k1) %% (q :: k) :: k1 where ... infixl 9 Source #

Equations

p %% q = p q 

type family (p :: k) %& (q :: k -> k1) :: k1 where ... infixr 9 Source #

Equations

p %& q = q p 

type (<%>) s t = AppendSymbol s t infixr 7 Source #

extract values from the type level

nat :: forall n a. (KnownNat n, Num a) => a Source #

get a Nat from the typelevel

>>> nat @14
14

symb :: forall s. KnownSymbol s => String Source #

gets the Symbol from the typelevel

>>> symb @"abc"
"abc"

class GetNats as where Source #

get a list of Nats from the typelevel

>>> getNats @'[10,12,1]
[10,12,1]

Methods

getNats :: [Int] Source #

Instances
GetNats ([] :: [k]) Source # 
Instance details

Defined in Predicate.Util

Methods

getNats :: [Int] Source #

(KnownNat n, GetNats ns) => GetNats (n ': ns :: [Nat]) Source # 
Instance details

Defined in Predicate.Util

Methods

getNats :: [Int] Source #

class GetSymbs ns where Source #

get a list of Symbols from the typelevel

>>> getSymbs @'["abc","def","g"]
["abc","def","g"]

Methods

getSymbs :: [String] Source #

Instances
GetSymbs ([] :: [k]) Source # 
Instance details

Defined in Predicate.Util

Methods

getSymbs :: [String] Source #

(KnownSymbol s, GetSymbs ss) => GetSymbs (s ': ss :: [Symbol]) Source # 
Instance details

Defined in Predicate.Util

Methods

getSymbs :: [String] Source #

class GetLen xs where Source #

get the length of a typelevel container

>>> getLen @'["abc","def","g"]
3
>>> getLen @'[]
0
>>> getLen @(9 ':| '[1,2,3])
4
>>> getLen @('These 9 "Asfs")
1
>>> getLen @('This 1)
0

Methods

getLen :: Int Source #

Instances
GetLen ([] :: [k]) Source # 
Instance details

Defined in Predicate.Util

Methods

getLen :: Int Source #

GetLen (Nothing :: Maybe a) Source # 
Instance details

Defined in Predicate.Util

Methods

getLen :: Int Source #

GetLen (Just a2 :: Maybe a1) Source # 
Instance details

Defined in Predicate.Util

Methods

getLen :: Int Source #

GetLen xs => GetLen (x ': xs :: [a]) Source # 
Instance details

Defined in Predicate.Util

Methods

getLen :: Int Source #

GetLen xs => GetLen (x :| xs :: NonEmpty a) Source # 
Instance details

Defined in Predicate.Util

Methods

getLen :: Int Source #

GetLen (Right a2 :: Either a1 b) Source # 
Instance details

Defined in Predicate.Util

Methods

getLen :: Int Source #

GetLen (Left a2 :: Either a1 b) Source # 
Instance details

Defined in Predicate.Util

Methods

getLen :: Int Source #

GetLen (That a2 :: These a1 b) Source # 
Instance details

Defined in Predicate.Util

Methods

getLen :: Int Source #

GetLen (This a2 :: These a1 b) Source # 
Instance details

Defined in Predicate.Util

Methods

getLen :: Int Source #

GetLen (These a2 b2 :: These a1 b1) Source # 
Instance details

Defined in Predicate.Util

Methods

getLen :: Int Source #

class GetThese th where Source #

Methods

getThese :: (String, These w v -> Bool) Source #

Instances
GetThese (That y :: These a b) Source # 
Instance details

Defined in Predicate.Util

Methods

getThese :: (String, These w v -> Bool) Source #

GetThese (This x :: These a b) Source # 
Instance details

Defined in Predicate.Util

Methods

getThese :: (String, These w v -> Bool) Source #

GetThese (These x y :: These a b) Source # 
Instance details

Defined in Predicate.Util

Methods

getThese :: (String, These w v -> Bool) Source #

class GetOrdering (cmp :: Ordering) where Source #

get ordering from the typelevel

Instances
GetOrdering LT Source # 
Instance details

Defined in Predicate.Util

GetOrdering EQ Source # 
Instance details

Defined in Predicate.Util

GetOrdering GT Source # 
Instance details

Defined in Predicate.Util

class GetBool (a :: Bool) where Source #

get bool from the typelevel

Methods

getBool :: Bool Source #

Instances
GetBool False Source # 
Instance details

Defined in Predicate.Util

Methods

getBool :: Bool Source #

GetBool True Source # 
Instance details

Defined in Predicate.Util

Methods

getBool :: Bool Source #

class GetOrd (k :: OrderingP) where Source #

Methods

getOrd :: Ord a => (String, a -> a -> Bool) Source #

Instances
GetOrd CGt Source # 
Instance details

Defined in Predicate.Util

Methods

getOrd :: Ord a => (String, a -> a -> Bool) Source #

GetOrd CGe Source # 
Instance details

Defined in Predicate.Util

Methods

getOrd :: Ord a => (String, a -> a -> Bool) Source #

GetOrd CEq Source # 
Instance details

Defined in Predicate.Util

Methods

getOrd :: Ord a => (String, a -> a -> Bool) Source #

GetOrd CLe Source # 
Instance details

Defined in Predicate.Util

Methods

getOrd :: Ord a => (String, a -> a -> Bool) Source #

GetOrd CLt Source # 
Instance details

Defined in Predicate.Util

Methods

getOrd :: Ord a => (String, a -> a -> Bool) Source #

GetOrd CNe Source # 
Instance details

Defined in Predicate.Util

Methods

getOrd :: Ord a => (String, a -> a -> Bool) Source #

printing methods

prtTTIO :: POpts -> IO (TT a) -> IO () Source #

prtTT :: POpts -> Identity (TT a) -> IO () Source #

prtTree :: POpts -> Tree PE -> IO () Source #

boolean methods

(~>) :: Bool -> Bool -> Bool Source #

boolean implication

>>> True ~> False
False
>>> True ~> True
True
>>> False ~> False
True
>>> False ~> True
True

miscellaneous

data Holder Source #

a monomorphic container of trees

hh :: TT w -> Holder Source #

convenience method to wrap a typed tree

showT :: forall (t :: Type). Typeable t => String Source #

removeAnsi :: Show a => Either String a -> IO () Source #

strip ansi characters from a string and print it (for doctests)

class Monad m => MonadEval m where Source #

a typeclass for choosing which monad to run in

Methods

runIO :: IO a -> m (Maybe a) Source #

catchit :: Exception e => a -> m (Either String a) Source #

catchitNF :: (Exception e, NFData a) => a -> m (Either String a) Source #

liftEval :: m a -> IO a Source #

Instances
MonadEval IO Source # 
Instance details

Defined in Predicate.Util

Methods

runIO :: IO a -> IO (Maybe a) Source #

catchit :: Exception e => a -> IO (Either String a) Source #

catchitNF :: (Exception e, NFData a) => a -> IO (Either String a) Source #

liftEval :: IO a -> IO a Source #

MonadEval Identity Source # 
Instance details

Defined in Predicate.Util