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

Predicate.Misc

Description

helper methods

Synopsis

## useful type families

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

typelevel boolean And

Equations

 AndT 'False _ = 'False AndT 'True b1 = b1

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

typelevel boolean Or

Equations

 OrT 'True _ = 'True OrT 'False b1 = b1

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

typelevel boolean Not

Equations

 NotT 'True = 'False NotT 'False = 'True

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

Repeat an expression n times

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 #

Intersperse a symbol inside a list of symbols

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 #

length of a type level list

Equations

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

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

flip at the type level

Equations

 FlipT d p q = d q p

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

'if' at the type level

Equations

 IfT 'True t _f = t IfT 'False _t f = f

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

sum at the type level for a list of Nat

Equations

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

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

map at the type level

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 # type level application: see  which works for type level functions Equations  p %% q = p q type family (p :: k) %& (q :: k -> k1) :: k1 where ... infixr 9 Source # reverse type level application: see & which works for type level functions Equations  p %& q = q p type (<%>) s t = AppendSymbol s t infixr 7 Source # type operator for appending a type level symbol type family ExtractAFromList (as :: Type) :: Type where ... Source # type family to extract a from a list of a Equations  ExtractAFromList [a] = a ExtractAFromList z = TypeError ('Text "ExtractAFromList: expected [a] but found something else" :$$: ('Text "as = " :<>: 'ShowType z))

type family ExtractAFromTA (ta :: Type) :: Type where ... Source #

type family to extract a from t a

Equations

 ExtractAFromTA (_t a) = a ExtractAFromTA z = TypeError ('Text "ExtractAFromTA: expected (t a) but found something else" :$$: ('Text "t a = " :<>: 'ShowType z)) type family ExtractTFromTA (ta :: Type) :: Type -> Type where ... Source # type family to extract t from t a Equations  ExtractTFromTA (t _a) = t ExtractTFromTA z = TypeError ('Text "ExtractTFromTA: expected (t a) but found something else" :$$: ('Text "t a = " :<>: 'ShowType z))

type family MaybeT mb where ... Source #

extract a from a Maybe container

Equations

 MaybeT (Maybe a) = a MaybeT o = TypeError ('Text "MaybeT: expected 'Maybe a' " :$$: ('Text "o = " :<>: 'ShowType o)) type family LeftT lr where ... Source # extract a from a Either container Equations  LeftT (Either a _) = a LeftT o = TypeError ('Text "LeftT: expected 'Either a b' " :$$: ('Text "o = " :<>: 'ShowType o))

type family RightT lr where ... Source #

extract b from a Either container

Equations

 RightT (Either _a b) = b RightT o = TypeError ('Text "RightT: expected 'Either a b' " :$$: ('Text "o = " :<>: 'ShowType o)) type family ThisT lr where ... Source # extract a from a These container Equations  ThisT (These a _b) = a ThisT o = TypeError ('Text "ThisT: expected 'These a b' " :$$: ('Text "o = " :<>: 'ShowType o))

type family ThatT lr where ... Source #

extract b from a These container

Equations

 ThatT (These _a b) = b ThatT o = TypeError ('Text "ThatT: expected 'These a b' " :$$: ('Text "o = " :<>: 'ShowType o)) type family TheseT lr where ... Source # extract a and b from a These container Equations  TheseT (These a b) = (a, b) TheseT o = TypeError ('Text "TheseT: expected 'These a b' " :$$: ('Text "o = " :<>: 'ShowType o))

type family FnT ab :: Type where ... Source #

extract b from an arrow type

Equations

 FnT (_a -> b) = b FnT ab = TypeError ('Text "FnT: expected Type -> Type but found a simple Type?" :$$: ('Text "ab = " :<>: 'ShowType ab)) type family ApplyConstT (ta :: Type) (b :: Type) :: Type where ... Source # replace the type inside a container using b Equations  ApplyConstT (t _) b = t b ApplyConstT ta b = TypeError (('Text "ApplyConstT: (t a) b but found something else" :$$: ('Text "t a = " :<>: 'ShowType ta)) :$$: ('Text "b = " :<>: 'ShowType b)) type family JoinT x y where ... Source # combine two containers Equations  JoinT (t a) (t b) = t (a, b) JoinT ta tb = TypeError (('Text "JoinT: expected (t a) (t b) but found something else" :$$: ('Text "t a = " :<>: 'ShowType ta)) :$$: ('Text "t b = " :<>: 'ShowType tb)) type family FailWhenT (b :: Bool) (msg :: ErrorMessage) :: Constraint where ... Source # helper method that fails 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 that fails with msg when False Equations  FailUnlessT 'True _ = () FailUnlessT 'False e = TypeError e type family BetweenT (s :: Symbol) (a :: Nat) (b :: Nat) (v :: Nat) :: Constraint where ... Source # type level Between Equations  BetweenT s m n v = FailUnlessT (AndT (m <=? v) (v <=? n)) (('Text s :<>: 'Text " failed") :$$: ((((('ShowType v :<>: 'Text " is outside the range [") :<>: 'ShowType m) :<>: 'Text "..") :<>: 'ShowType n) :<>: 'Text "]"))

## extract values from the type level

class GetBool (a :: Bool) where Source #

get Bool from the typelevel

Methods

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods

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

#### Instances

Instances details
 GetLen ('[] :: [k]) Source # Instance detailsDefined in Predicate.Misc Methods GetLen ('Nothing :: Maybe a) Source # Instance detailsDefined in Predicate.Misc Methods GetLen ('Just a2 :: Maybe a1) Source # Instance detailsDefined in Predicate.Misc Methods GetLen xs => GetLen (x ': xs :: [a]) Source # Instance detailsDefined in Predicate.Misc Methods GetLen xs => GetLen (x :| xs :: NonEmpty a) Source # Instance detailsDefined in Predicate.Misc Methods GetLen ('ENone :: Elr a b) Source # Instance detailsDefined in Predicate.Elr Methods GetLen ('Right a2 :: Either a1 b) Source # Instance detailsDefined in Predicate.Misc Methods GetLen ('Left a2 :: Either a1 b) Source # Instance detailsDefined in Predicate.Misc Methods GetLen ('That a2 :: These a1 b) Source # Instance detailsDefined in Predicate.Misc Methods GetLen ('This a2 :: These a1 b) Source # Instance detailsDefined in Predicate.Misc Methods GetLen ('ERight b2 :: Elr a b1) Source # Instance detailsDefined in Predicate.Elr Methods GetLen ('ELeft a2 :: Elr a1 b) Source # Instance detailsDefined in Predicate.Elr Methods GetLen ('These a2 b2 :: These a1 b1) Source # Instance detailsDefined in Predicate.Misc Methods GetLen ('EBoth a2 b2 :: Elr a1 b1) Source # Instance detailsDefined in Predicate.Elr Methods

class GetThese (th :: These a b) where Source #

get These from the typelevel

Methods

getThese' :: These () () Source #

#### Instances

Instances details
 GetThese ('That y :: These a b) Source # Instance detailsDefined in Predicate.Misc MethodsgetThese' :: These () () Source # GetThese ('This x :: These a b) Source # Instance detailsDefined in Predicate.Misc MethodsgetThese' :: These () () Source # GetThese ('These x y :: These a b) Source # Instance detailsDefined in Predicate.Misc MethodsgetThese' :: These () () Source #

getThese :: forall th. GetThese th => These () () Source #

get These from the typelevel

class GetOrdering (cmp :: Ordering) where Source #

get ordering from the typelevel

Methods

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods

data OrderingP Source #

all the ways to compare two values

Constructors

 CGt CGe CEq CLe CLt CNe

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc MethodsenumFrom :: OrderingP -> [OrderingP] # Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc MethodsshowList :: [OrderingP] -> ShowS #

class GetOrd (k :: OrderingP) where Source #

extract OrderingP from the typelevel

Methods

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

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc MethodsgetOrd :: Ord a => (String, a -> a -> Bool) Source # Source # Instance detailsDefined in Predicate.Misc MethodsgetOrd :: Ord a => (String, a -> a -> Bool) Source # Source # Instance detailsDefined in Predicate.Misc MethodsgetOrd :: Ord a => (String, a -> a -> Bool) Source # Source # Instance detailsDefined in Predicate.Misc MethodsgetOrd :: Ord a => (String, a -> a -> Bool) Source # Source # Instance detailsDefined in Predicate.Misc MethodsgetOrd :: Ord a => (String, a -> a -> Bool) Source # Source # Instance detailsDefined in Predicate.Misc MethodsgetOrd :: Ord a => (String, a -> a -> Bool) Source #

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"


## inductive tuples

class ToITupleC x where Source #

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

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

>>> toITupleC (123,'x')
(123,('x',()))


Associated Types

type ToITupleP x Source #

Methods

toITupleC :: x -> ToITupleP x Source #

#### Instances

Instances details
 (TypeError ('Text "ToITupleC: invalid empty tuple") :: Constraint) => ToITupleC () Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP () Source # MethodstoITupleC :: () -> ToITupleP () Source # ToITupleC (a, b) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b) Source # MethodstoITupleC :: (a, b) -> ToITupleP (a, b) Source # ToITupleC (a, b, c) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b, c) Source # MethodstoITupleC :: (a, b, c) -> ToITupleP (a, b, c) Source # ToITupleC (a, b, c, d) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b, c, d) Source # MethodstoITupleC :: (a, b, c, d) -> ToITupleP (a, b, c, d) Source # ToITupleC (a, b, c, d, e) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b, c, d, e) Source # MethodstoITupleC :: (a, b, c, d, e) -> ToITupleP (a, b, c, d, e) Source # ToITupleC (a, b, c, d, e, f) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b, c, d, e, f) Source # MethodstoITupleC :: (a, b, c, d, e, f) -> ToITupleP (a, b, c, d, e, f) Source # ToITupleC (a, b, c, d, e, f, g) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b, c, d, e, f, g) Source # MethodstoITupleC :: (a, b, c, d, e, f, g) -> ToITupleP (a, b, c, d, e, f, g) Source # ToITupleC (a, b, c, d, e, f, g, h) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b, c, d, e, f, g, h) Source # MethodstoITupleC :: (a, b, c, d, e, f, g, h) -> ToITupleP (a, b, c, d, e, f, g, h) Source # ToITupleC (a, b, c, d, e, f, g, h, i) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b, c, d, e, f, g, h, i) Source # MethodstoITupleC :: (a, b, c, d, e, f, g, h, i) -> ToITupleP (a, b, c, d, e, f, g, h, i) Source # ToITupleC (a, b, c, d, e, f, g, h, i, j) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b, c, d, e, f, g, h, i, j) Source # MethodstoITupleC :: (a, b, c, d, e, f, g, h, i, j) -> ToITupleP (a, b, c, d, e, f, g, h, i, j) Source # ToITupleC (a, b, c, d, e, f, g, h, i, j, k) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b, c, d, e, f, g, h, i, j, k) Source # MethodstoITupleC :: (a, b, c, d, e, f, g, h, i, j, k) -> ToITupleP (a, b, c, d, e, f, g, h, i, j, k) Source # ToITupleC (a, b, c, d, e, f, g, h, i, j, k, l) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleP (a, b, c, d, e, f, g, h, i, j, k, l) Source # MethodstoITupleC :: (a, b, c, d, e, f, g, h, i, j, k, l) -> ToITupleP (a, b, c, d, e, f, g, h, i, j, k, l) Source #

class FromITupleC x where Source #

takes an inductive tuple and creates a flat n-tuple

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

>>> fromITupleC (123,('x',()))
(123,'x')


Associated Types

type FromITupleP x Source #

Methods

fromITupleC :: x -> FromITupleP x Source #

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP () Source # MethodsfromITupleC :: () -> FromITupleP () Source # FromITupleC (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, ())))))))))))) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, ())))))))))))) Source # MethodsfromITupleC :: (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, ())))))))))))) -> FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, ())))))))))))) Source # FromITupleC (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, ()))))))))))) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, ()))))))))))) Source # MethodsfromITupleC :: (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, ()))))))))))) -> FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, ()))))))))))) Source # FromITupleC (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, ())))))))))) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, ())))))))))) Source # MethodsfromITupleC :: (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, ())))))))))) -> FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, ())))))))))) Source # FromITupleC (a, (b, (c, (d, (e, (f, (g, (h, (i, ()))))))))) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, ()))))))))) Source # MethodsfromITupleC :: (a, (b, (c, (d, (e, (f, (g, (h, (i, ()))))))))) -> FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, ()))))))))) Source # FromITupleC (a, (b, (c, (d, (e, (f, (g, (h, ())))))))) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, ())))))))) Source # MethodsfromITupleC :: (a, (b, (c, (d, (e, (f, (g, (h, ())))))))) -> FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, ())))))))) Source # FromITupleC (a, (b, (c, (d, (e, (f, (g, ()))))))) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, (c, (d, (e, (f, (g, ()))))))) Source # MethodsfromITupleC :: (a, (b, (c, (d, (e, (f, (g, ()))))))) -> FromITupleP (a, (b, (c, (d, (e, (f, (g, ()))))))) Source # FromITupleC (a, (b, (c, (d, (e, (f, ())))))) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, (c, (d, (e, (f, ())))))) Source # MethodsfromITupleC :: (a, (b, (c, (d, (e, (f, ())))))) -> FromITupleP (a, (b, (c, (d, (e, (f, ())))))) Source # FromITupleC (a, (b, (c, (d, (e, ()))))) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, (c, (d, (e, ()))))) Source # MethodsfromITupleC :: (a, (b, (c, (d, (e, ()))))) -> FromITupleP (a, (b, (c, (d, (e, ()))))) Source # FromITupleC (a, (b, (c, (d, ())))) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, (c, (d, ())))) Source # MethodsfromITupleC :: (a, (b, (c, (d, ())))) -> FromITupleP (a, (b, (c, (d, ())))) Source # FromITupleC (a, (b, (c, ()))) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, (c, ()))) Source # MethodsfromITupleC :: (a, (b, (c, ()))) -> FromITupleP (a, (b, (c, ()))) Source # FromITupleC (a, (b, ())) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, (b, ())) Source # MethodsfromITupleC :: (a, (b, ())) -> FromITupleP (a, (b, ())) Source # FromITupleC (a, ()) Source # Instance detailsDefined in Predicate.Misc Associated Typestype FromITupleP (a, ()) Source # MethodsfromITupleC :: (a, ()) -> FromITupleP (a, ()) Source #

class ToITupleListC (n :: Nat) (a :: Type) where Source #

takes a list of size n and converts it to an inductive tuple. see PrintL

>>> toITupleListC @4 [10,12,13,1]
Right (10,(12,(13,(1,()))))

>>> toITupleListC @2 ["ab","cc"]
Right ("ab",("cc",()))

>>> toITupleListC @10 [10,12,13,1]
Left "toITupleListC: expected exactly 10 values"

>>> toITupleListC @2 [10,12,13,1]
Left "toITupleListC: expected exactly 2 values"


Associated Types

type ToITupleListP n a Source #

#### Instances

Instances details
 (TypeError ('Text "ToITupleListC: inductive tuple cannot be empty") :: Constraint) => ToITupleListC 0 a Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 0 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 0 a) Source # Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 1 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 1 a) Source # Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 2 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 2 a) Source # Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 3 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 3 a) Source # Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 4 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 4 a) Source # Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 5 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 5 a) Source # Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 6 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 6 a) Source # Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 7 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 7 a) Source # Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 8 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 8 a) Source # Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 9 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 9 a) Source # ToITupleListC 10 a Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 10 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 10 a) Source # ToITupleListC 11 a Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 11 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 11 a) Source # ToITupleListC 12 a Source # Instance detailsDefined in Predicate.Misc Associated Typestype ToITupleListP 12 a Source # MethodstoITupleListC :: [a] -> Either String (ToITupleListP 12 a) Source #

class ReverseITupleC (x :: Type) (xs :: Type) (ys :: Type) where Source #

reverse an inductive tuple

Associated Types

type ReverseITupleT x xs ys Source #

Methods

reverseITupleC :: x -> xs -> ys -> ReverseITupleT x xs ys Source #

#### Instances

Instances details
 ReverseITupleC x () ys Source # Instance detailsDefined in Predicate.Misc Associated Typestype ReverseITupleT x () ys Source # MethodsreverseITupleC :: x -> () -> ys -> ReverseITupleT x () ys Source # ReverseITupleC w ws (x, ys) => ReverseITupleC x (w, ws) ys Source # Instance detailsDefined in Predicate.Misc Associated Typestype ReverseITupleT x (w, ws) ys Source # MethodsreverseITupleC :: x -> (w, ws) -> ys -> ReverseITupleT x (w, ws) ys Source #

class TupleC (n :: Nat) (a :: Type) where Source #

try to convert a list to a n-tuple

Associated Types

type TupleT n a Source #

Methods

getTupleC :: [a] -> Maybe (TupleT n a) Source #

#### Instances

Instances details
 TupleC 2 a Source # convert a list of at least 2 elements to a 2-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 2 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 2 a) Source # TupleC 3 a Source # convert a list of at least 3 elements to a 3-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 3 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 3 a) Source # TupleC 4 a Source # convert a list of at least 4 elements to a 4-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 4 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 4 a) Source # TupleC 5 a Source # convert a list of at least 5 elements to a 5-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 5 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 5 a) Source # TupleC 6 a Source # convert a list of at least 6 elements to a 6-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 6 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 6 a) Source # TupleC 7 a Source # convert a list of at least 7 elements to a 7-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 7 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 7 a) Source # TupleC 8 a Source # convert a list of at least 8 elements to a 8-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 8 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 8 a) Source # TupleC 9 a Source # convert a list of at least 9 elements to a 9-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 9 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 9 a) Source # TupleC 10 a Source # convert a list of at least 10 elements to a 10-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 10 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 10 a) Source # TupleC 11 a Source # convert a list of at least 11 elements to a 11-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 11 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 11 a) Source # TupleC 12 a Source # convert a list of at least 12 elements to a 12-tuple Instance detailsDefined in Predicate.Misc Associated Typestype TupleT 12 a Source # MethodsgetTupleC :: [a] -> Maybe (TupleT 12 a) Source #

## extract from n-tuple

type family T4_1 x where ... Source #

extract opts part of 4 tuple from the type level for use with Refined2

Equations

 T4_1 '(opts, _, _, _) = opts

type family T4_2 x where ... Source #

extract ip part of 4 tuple from the type level for use with Refined2

Equations

 T4_2 '(_, ip, _, _) = ip

type family T4_3 x where ... Source #

extract op part of 4 tuple from the type level for use with Refined2

Equations

 T4_3 '(_, _, op, _) = op

type family T4_4 x where ... Source #

extract i part of 4 tuple from the type level for use with Refined2

Equations

 T4_4 '(_, _, _, i) = i

type family T5_1 x where ... Source #

extract opts part of 5 tuple from the type level for use with Refined3

Equations

 T5_1 '(opts, _, _, _, _) = opts

type family T5_2 x where ... Source #

extract ip part of 5 tuple from the type level for use with Refined3

Equations

 T5_2 '(_, ip, _, _, _) = ip

type family T5_3 x where ... Source #

extract op part of 5 tuple from the type level for use with Refined3

Equations

 T5_3 '(_, _, op, _, _) = op

type family T5_4 x where ... Source #

extract fmt part of 5 tuple from the type level for use with Refined3

Equations

 T5_4 '(_, _, _, fmt, _) = fmt

type family T5_5 x where ... Source #

extract i part of 5 tuple from the type level for use with Refined3

Equations

 T5_5 '(_, _, _, _, i) = i

## tuple classes

class ExtractL1C (tp :: Type) where Source #

extract element 1 from a n-tuple

Associated Types

type ExtractL1T tp Source #

Methods

extractL1C :: tp -> ExtractL1T tp Source #

#### Instances

Instances details
 ExtractL1C (a, b) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL1T (a, b) Source # MethodsextractL1C :: (a, b) -> ExtractL1T (a, b) Source # ExtractL1C (a, b, c) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL1T (a, b, c) Source # MethodsextractL1C :: (a, b, c) -> ExtractL1T (a, b, c) Source # ExtractL1C (a, b, c, d) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL1T (a, b, c, d) Source # MethodsextractL1C :: (a, b, c, d) -> ExtractL1T (a, b, c, d) Source # ExtractL1C (a, b, c, d, e) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL1T (a, b, c, d, e) Source # MethodsextractL1C :: (a, b, c, d, e) -> ExtractL1T (a, b, c, d, e) Source # ExtractL1C (a, b, c, d, e, f) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL1T (a, b, c, d, e, f) Source # MethodsextractL1C :: (a, b, c, d, e, f) -> ExtractL1T (a, b, c, d, e, f) Source # ExtractL1C (a, b, c, d, e, f, g) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL1T (a, b, c, d, e, f, g) Source # MethodsextractL1C :: (a, b, c, d, e, f, g) -> ExtractL1T (a, b, c, d, e, f, g) Source # ExtractL1C (a, b, c, d, e, f, g, h) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL1T (a, b, c, d, e, f, g, h) Source # MethodsextractL1C :: (a, b, c, d, e, f, g, h) -> ExtractL1T (a, b, c, d, e, f, g, h) Source #

class ExtractL2C (tp :: Type) where Source #

extract element 2 from a n-tuple

Associated Types

type ExtractL2T tp Source #

Methods

extractL2C :: tp -> ExtractL2T tp Source #

#### Instances

Instances details
 ExtractL2C (a, b) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL2T (a, b) Source # MethodsextractL2C :: (a, b) -> ExtractL2T (a, b) Source # ExtractL2C (a, b, c) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL2T (a, b, c) Source # MethodsextractL2C :: (a, b, c) -> ExtractL2T (a, b, c) Source # ExtractL2C (a, b, c, d) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL2T (a, b, c, d) Source # MethodsextractL2C :: (a, b, c, d) -> ExtractL2T (a, b, c, d) Source # ExtractL2C (a, b, c, d, e) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL2T (a, b, c, d, e) Source # MethodsextractL2C :: (a, b, c, d, e) -> ExtractL2T (a, b, c, d, e) Source # ExtractL2C (a, b, c, d, e, f) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL2T (a, b, c, d, e, f) Source # MethodsextractL2C :: (a, b, c, d, e, f) -> ExtractL2T (a, b, c, d, e, f) Source # ExtractL2C (a, b, c, d, e, f, g) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL2T (a, b, c, d, e, f, g) Source # MethodsextractL2C :: (a, b, c, d, e, f, g) -> ExtractL2T (a, b, c, d, e, f, g) Source # ExtractL2C (a, b, c, d, e, f, g, h) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL2T (a, b, c, d, e, f, g, h) Source # MethodsextractL2C :: (a, b, c, d, e, f, g, h) -> ExtractL2T (a, b, c, d, e, f, g, h) Source #

class ExtractL3C (tp :: Type) where Source #

extract element 3 from a n-tuple

Associated Types

type ExtractL3T tp Source #

Methods

extractL3C :: tp -> ExtractL3T tp Source #

#### Instances

Instances details
 ExtractL3C (a, b) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL3T (a, b) Source # MethodsextractL3C :: (a, b) -> ExtractL3T (a, b) Source # ExtractL3C (a, b, c) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL3T (a, b, c) Source # MethodsextractL3C :: (a, b, c) -> ExtractL3T (a, b, c) Source # ExtractL3C (a, b, c, d) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL3T (a, b, c, d) Source # MethodsextractL3C :: (a, b, c, d) -> ExtractL3T (a, b, c, d) Source # ExtractL3C (a, b, c, d, e) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL3T (a, b, c, d, e) Source # MethodsextractL3C :: (a, b, c, d, e) -> ExtractL3T (a, b, c, d, e) Source # ExtractL3C (a, b, c, d, e, f) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL3T (a, b, c, d, e, f) Source # MethodsextractL3C :: (a, b, c, d, e, f) -> ExtractL3T (a, b, c, d, e, f) Source # ExtractL3C (a, b, c, d, e, f, g) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL3T (a, b, c, d, e, f, g) Source # MethodsextractL3C :: (a, b, c, d, e, f, g) -> ExtractL3T (a, b, c, d, e, f, g) Source # ExtractL3C (a, b, c, d, e, f, g, h) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL3T (a, b, c, d, e, f, g, h) Source # MethodsextractL3C :: (a, b, c, d, e, f, g, h) -> ExtractL3T (a, b, c, d, e, f, g, h) Source #

class ExtractL4C (tp :: Type) where Source #

extract element 4 from a n-tuple

Associated Types

type ExtractL4T tp Source #

Methods

extractL4C :: tp -> ExtractL4T tp Source #

#### Instances

Instances details
 ExtractL4C (a, b) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL4T (a, b) Source # MethodsextractL4C :: (a, b) -> ExtractL4T (a, b) Source # ExtractL4C (a, b, c) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL4T (a, b, c) Source # MethodsextractL4C :: (a, b, c) -> ExtractL4T (a, b, c) Source # ExtractL4C (a, b, c, d) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL4T (a, b, c, d) Source # MethodsextractL4C :: (a, b, c, d) -> ExtractL4T (a, b, c, d) Source # ExtractL4C (a, b, c, d, e) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL4T (a, b, c, d, e) Source # MethodsextractL4C :: (a, b, c, d, e) -> ExtractL4T (a, b, c, d, e) Source # ExtractL4C (a, b, c, d, e, f) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL4T (a, b, c, d, e, f) Source # MethodsextractL4C :: (a, b, c, d, e, f) -> ExtractL4T (a, b, c, d, e, f) Source # ExtractL4C (a, b, c, d, e, f, g) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL4T (a, b, c, d, e, f, g) Source # MethodsextractL4C :: (a, b, c, d, e, f, g) -> ExtractL4T (a, b, c, d, e, f, g) Source # ExtractL4C (a, b, c, d, e, f, g, h) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL4T (a, b, c, d, e, f, g, h) Source # MethodsextractL4C :: (a, b, c, d, e, f, g, h) -> ExtractL4T (a, b, c, d, e, f, g, h) Source #

class ExtractL5C (tp :: Type) where Source #

extract element 5 from a n-tuple

Associated Types

type ExtractL5T tp Source #

Methods

extractL5C :: tp -> ExtractL5T tp Source #

#### Instances

Instances details
 ExtractL5C (a, b) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL5T (a, b) Source # MethodsextractL5C :: (a, b) -> ExtractL5T (a, b) Source # ExtractL5C (a, b, c) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL5T (a, b, c) Source # MethodsextractL5C :: (a, b, c) -> ExtractL5T (a, b, c) Source # ExtractL5C (a, b, c, d) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL5T (a, b, c, d) Source # MethodsextractL5C :: (a, b, c, d) -> ExtractL5T (a, b, c, d) Source # ExtractL5C (a, b, c, d, e) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL5T (a, b, c, d, e) Source # MethodsextractL5C :: (a, b, c, d, e) -> ExtractL5T (a, b, c, d, e) Source # ExtractL5C (a, b, c, d, e, f) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL5T (a, b, c, d, e, f) Source # MethodsextractL5C :: (a, b, c, d, e, f) -> ExtractL5T (a, b, c, d, e, f) Source # ExtractL5C (a, b, c, d, e, f, g) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL5T (a, b, c, d, e, f, g) Source # MethodsextractL5C :: (a, b, c, d, e, f, g) -> ExtractL5T (a, b, c, d, e, f, g) Source # ExtractL5C (a, b, c, d, e, f, g, h) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL5T (a, b, c, d, e, f, g, h) Source # MethodsextractL5C :: (a, b, c, d, e, f, g, h) -> ExtractL5T (a, b, c, d, e, f, g, h) Source #

class ExtractL6C (tp :: Type) where Source #

extract element 6 from a n-tuple

Associated Types

type ExtractL6T tp Source #

Methods

extractL6C :: tp -> ExtractL6T tp Source #

#### Instances

Instances details
 ExtractL6C (a, b) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL6T (a, b) Source # MethodsextractL6C :: (a, b) -> ExtractL6T (a, b) Source # ExtractL6C (a, b, c) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL6T (a, b, c) Source # MethodsextractL6C :: (a, b, c) -> ExtractL6T (a, b, c) Source # ExtractL6C (a, b, c, d) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL6T (a, b, c, d) Source # MethodsextractL6C :: (a, b, c, d) -> ExtractL6T (a, b, c, d) Source # ExtractL6C (a, b, c, d, e) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL6T (a, b, c, d, e) Source # MethodsextractL6C :: (a, b, c, d, e) -> ExtractL6T (a, b, c, d, e) Source # ExtractL6C (a, b, c, d, e, f) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL6T (a, b, c, d, e, f) Source # MethodsextractL6C :: (a, b, c, d, e, f) -> ExtractL6T (a, b, c, d, e, f) Source # ExtractL6C (a, b, c, d, e, f, g) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL6T (a, b, c, d, e, f, g) Source # MethodsextractL6C :: (a, b, c, d, e, f, g) -> ExtractL6T (a, b, c, d, e, f, g) Source # ExtractL6C (a, b, c, d, e, f, g, h) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL6T (a, b, c, d, e, f, g, h) Source # MethodsextractL6C :: (a, b, c, d, e, f, g, h) -> ExtractL6T (a, b, c, d, e, f, g, h) Source #

class ExtractL7C (tp :: Type) where Source #

extract element 7 from a n-tuple

Associated Types

type ExtractL7T tp Source #

Methods

extractL7C :: tp -> ExtractL7T tp Source #

#### Instances

Instances details
 ExtractL7C (a, b) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL7T (a, b) Source # MethodsextractL7C :: (a, b) -> ExtractL7T (a, b) Source # ExtractL7C (a, b, c) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL7T (a, b, c) Source # MethodsextractL7C :: (a, b, c) -> ExtractL7T (a, b, c) Source # ExtractL7C (a, b, c, d) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL7T (a, b, c, d) Source # MethodsextractL7C :: (a, b, c, d) -> ExtractL7T (a, b, c, d) Source # ExtractL7C (a, b, c, d, e) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL7T (a, b, c, d, e) Source # MethodsextractL7C :: (a, b, c, d, e) -> ExtractL7T (a, b, c, d, e) Source # ExtractL7C (a, b, c, d, e, f) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL7T (a, b, c, d, e, f) Source # MethodsextractL7C :: (a, b, c, d, e, f) -> ExtractL7T (a, b, c, d, e, f) Source # ExtractL7C (a, b, c, d, e, f, g) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL7T (a, b, c, d, e, f, g) Source # MethodsextractL7C :: (a, b, c, d, e, f, g) -> ExtractL7T (a, b, c, d, e, f, g) Source # ExtractL7C (a, b, c, d, e, f, g, h) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL7T (a, b, c, d, e, f, g, h) Source # MethodsextractL7C :: (a, b, c, d, e, f, g, h) -> ExtractL7T (a, b, c, d, e, f, g, h) Source #

class ExtractL8C (tp :: Type) where Source #

extract element 8 from a n-tuple

Associated Types

type ExtractL8T tp Source #

Methods

extractL8C :: tp -> ExtractL8T tp Source #

#### Instances

Instances details
 ExtractL8C (a, b) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL8T (a, b) Source # MethodsextractL8C :: (a, b) -> ExtractL8T (a, b) Source # ExtractL8C (a, b, c) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL8T (a, b, c) Source # MethodsextractL8C :: (a, b, c) -> ExtractL8T (a, b, c) Source # ExtractL8C (a, b, c, d) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL8T (a, b, c, d) Source # MethodsextractL8C :: (a, b, c, d) -> ExtractL8T (a, b, c, d) Source # ExtractL8C (a, b, c, d, e) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL8T (a, b, c, d, e) Source # MethodsextractL8C :: (a, b, c, d, e) -> ExtractL8T (a, b, c, d, e) Source # ExtractL8C (a, b, c, d, e, f) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL8T (a, b, c, d, e, f) Source # MethodsextractL8C :: (a, b, c, d, e, f) -> ExtractL8T (a, b, c, d, e, f) Source # ExtractL8C (a, b, c, d, e, f, g) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL8T (a, b, c, d, e, f, g) Source # MethodsextractL8C :: (a, b, c, d, e, f, g) -> ExtractL8T (a, b, c, d, e, f, g) Source # ExtractL8C (a, b, c, d, e, f, g, h) Source # Instance detailsDefined in Predicate.Misc Associated Typestype ExtractL8T (a, b, c, d, e, f, g, h) Source # MethodsextractL8C :: (a, b, c, d, e, f, g, h) -> ExtractL8T (a, b, c, d, e, f, g, h) Source #

## primes

prime predicate

>>> isPrime 7
True

>>> isPrime 6
False


primes stream

>>> take 10 primeStream
[2,3,5,7,11,13,17,19,23,29]


prime factors

>>> primeFactors 100
[2,2,5,5]

>>> primeFactors 123
[3,41]


## regular expressions

compileRegex :: forall rs. GetROpts rs => String -> String -> Either (String, String) Regex Source #

compile a regex using type level options

data ROpt Source #

Regex options for Rescan Resplit Re etc

Constructors

 Anchored Force pattern anchoring AutoCallout Compile automatic callouts Caseless Do caseless matching DollarEndonly 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 NewlineCr Set CR as the newline sequence NewlineCrlf Set CrlF as the newline sequence NewlineLf Set LF as the newline sequence NoAutoCapture Disable numbered capturing parentheses (named ones available) Ungreedy Invert greediness of quantifiers Utf8 Run in UTF--8 mode NoUtf8Check Do not check the pattern for UTF-8 validity

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methodssucc :: 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] # Source # Instance detailsDefined in Predicate.Misc Methods(==) :: ROpt -> ROpt -> Bool #(/=) :: ROpt -> ROpt -> Bool # Source # Instance detailsDefined in Predicate.Misc Methodscompare :: ROpt -> ROpt -> Ordering #(<) :: ROpt -> ROpt -> Bool #(<=) :: ROpt -> ROpt -> Bool #(>) :: ROpt -> ROpt -> Bool #(>=) :: ROpt -> ROpt -> Bool #max :: ROpt -> ROpt -> ROpt #min :: ROpt -> ROpt -> ROpt # Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc MethodsshowsPrec :: Int -> ROpt -> ShowS #show :: ROpt -> String #showList :: [ROpt] -> ShowS # GetROpts ('[] :: [ROpt]) Source # Instance detailsDefined in Predicate.Misc MethodsgetROpts :: ([String], [PCREOption]) Source # (Typeable r, GetROpt r, GetROpts rs) => GetROpts (r ': rs) Source # Instance detailsDefined in Predicate.Misc MethodsgetROpts :: ([String], [PCREOption]) Source #

class GetROpts (os :: [ROpt]) where Source #

extract the regex options from the type level list

Methods

getROpts :: ([String], [PCREOption]) Source #

#### Instances

Instances details
 GetROpts ('[] :: [ROpt]) Source # Instance detailsDefined in Predicate.Misc MethodsgetROpts :: ([String], [PCREOption]) Source # (Typeable r, GetROpt r, GetROpts rs) => GetROpts (r ': rs) Source # Instance detailsDefined in Predicate.Misc MethodsgetROpts :: ([String], [PCREOption]) Source #

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

Constructors

 RReplace !ReplaceFnSub !String RReplace1 !(String -> [String] -> String) RReplace2 !(String -> String) RReplace3 !([String] -> String)

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc MethodsshowList :: [RReplace] -> ShowS #

class GetReplaceFnSub (k :: ReplaceFnSub) where Source #

extract replacement options from typelevel

Methods

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods

simple regex string replacement options

Constructors

 RPrepend ROverWrite RAppend

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc MethodsshowList :: [ReplaceFnSub] -> ShowS # P (ReplaceAllStringT o p q r) x => P (ReplaceAllString o p q r :: Type) x Source # Instance detailsDefined in Predicate.Data.Regex Associated Typestype PP (ReplaceAllString o p q r) x Source # Methodseval :: MonadEval m => proxy (ReplaceAllString o p q r) -> POpts -> x -> m (TT (PP (ReplaceAllString o p q r) x)) Source # type PP (ReplaceAllString o p q r :: Type) x Source # Instance detailsDefined in Predicate.Data.Regex type PP (ReplaceAllString o p q r :: Type) x

displayROpts :: [String] -> String Source #

display regex options

## colors

newtype SColor Source #

wrapper for a Show instance around Color

Constructors

 SColor Color

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc MethodstoEnum :: Int -> SColor #enumFrom :: SColor -> [SColor] #enumFromThen :: SColor -> SColor -> [SColor] #enumFromTo :: SColor -> SColor -> [SColor] #enumFromThenTo :: SColor -> SColor -> SColor -> [SColor] # Source # Instance detailsDefined in Predicate.Misc MethodsshowsPrec :: Int -> SColor -> ShowS #showList :: [SColor] -> ShowS #

class GetColor (a :: Color) where Source #

get Color from the typelevel

Methods

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods

## styles

newtype SStyle Source #

wrapper for a Show instance around Color

Constructors

 SStyle Style

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc MethodstoEnum :: Int -> SStyle #enumFrom :: SStyle -> [SStyle] #enumFromThen :: SStyle -> SStyle -> [SStyle] #enumFromTo :: SStyle -> SStyle -> [SStyle] #enumFromThenTo :: SStyle -> SStyle -> SStyle -> [SStyle] # Source # Instance detailsDefined in Predicate.Misc MethodsshowsPrec :: Int -> SStyle -> ShowS #showList :: [SStyle] -> ShowS #

class GetStyle (a :: Style) where Source #

get Style from the typelevel

Methods

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods Source # Instance detailsDefined in Predicate.Misc Methods

## miscellaneous

class Bifunctor p => SwapC p where Source #

swap values in a bifunctor

Methods

swapC :: p a b -> p b a Source #

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc MethodsswapC :: Either a b -> Either b a Source # Source # Instance detailsDefined in Predicate.Misc MethodsswapC :: (a, b) -> (b, a) Source # Source # Instance detailsDefined in Predicate.Misc MethodsswapC :: Arg a b -> Arg b a Source # Source # Instance detailsDefined in Predicate.Misc MethodsswapC :: These a b -> These b a Source # Source # Instance detailsDefined in Predicate.Elr MethodsswapC :: Elr a b -> Elr b a Source # SwapC ((,,) a) Source # Instance detailsDefined in Predicate.Misc MethodsswapC :: (a, a0, b) -> (a, b, a0) Source # SwapC ((,,,) a b) Source # Instance detailsDefined in Predicate.Misc MethodsswapC :: (a, b, a0, b0) -> (a, b, b0, a0) Source # SwapC ((,,,,) a b c) Source # Instance detailsDefined in Predicate.Misc MethodsswapC :: (a, b, c, a0, b0) -> (a, b, c, b0, a0) Source # SwapC ((,,,,,) a b c d) Source # Instance detailsDefined in Predicate.Misc MethodsswapC :: (a, b, c, d, a0, b0) -> (a, b, c, d, b0, a0) Source # SwapC ((,,,,,,) a b c d e) Source # Instance detailsDefined in Predicate.Misc MethodsswapC :: (a, b, c, d, e, a0, b0) -> (a, b, c, d, e, b0, a0) Source #

showTK :: forall r. Typeable r => String Source #

show the kind as a string

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

show the type as a string

showThese :: These a b -> String Source #

display constructor name for These

pretty print Ordering

unlessNull :: (AsEmpty t, Monoid m) => t -> m -> m Source #

return the second value if the first is not empty

unlessNullM :: (AsEmpty t, Applicative m) => t -> (t -> m ()) -> m () Source #

return the result of the second value if the first is not empty

append a space if the given value is not empty

combine the two values if the first is not empty

pureTryTest :: a -> IO (Either () a) Source #

catch an exception: for use in testing

pureTryTestPred :: (String -> Bool) -> a -> IO (Either String (Either () a)) Source #

catch an exception and the use a predicate to determine if it is the one we want: for use in testing

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

boolean implication

>>> True ~> False
False

>>> True ~> True
True

>>> False ~> False
True

>>> False ~> True
True


fail with a programmer error

draw a tree using unicode

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

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

_Id :: Lens (Identity a) (Identity b) a b Source #

Identity lens

sum' :: (Foldable t, Num a) => t a -> a Source #

strict version of sum

product' :: (Foldable t, Num a) => t a -> a Source #

strict version of product

foldMapStrict :: (Foldable t, Monoid m) => (a -> m) -> t a -> m Source #

strict version of foldMap: replace with Data.Foldable.foldMap' when more generally available

cycle' :: [a] -> [a] Source #

similar to cycle but if the list is empty will return an empty list

cmpOf :: Eq a => Ordering -> ([a] -> [a] -> Bool, String) Source #

return a function that compares two lists based on the Ordering parameter

ifM :: Monad m => m Bool -> m a -> m a -> m a Source #

lifted if statement

class AssocC p where Source #

associate and unassociate certain two parameter types

Methods

assoc :: p (p a b) c -> p a (p b c) Source #

unassoc :: p a (p b c) -> p (p a b) c Source #

#### Instances

Instances details
 Source # Instance detailsDefined in Predicate.Misc Methodsassoc :: Either (Either a b) c -> Either a (Either b c) Source #unassoc :: Either a (Either b c) -> Either (Either a b) c Source # Source # Instance detailsDefined in Predicate.Misc Methodsassoc :: ((a, b), c) -> (a, (b, c)) Source #unassoc :: (a, (b, c)) -> ((a, b), c) Source # Source # Instance detailsDefined in Predicate.Misc Methodsassoc :: These (These a b) c -> These a (These b c) Source #unassoc :: These a (These b c) -> These (These a b) c Source # Source # Instance detailsDefined in Predicate.Elr Methodsassoc :: Elr (Elr a b) c -> Elr a (Elr b c) Source #unassoc :: Elr a (Elr b c) -> Elr (Elr a b) c Source #

simpleAlign :: [a] -> [b] -> [These a b] Source #

zip two lists using These

>>> simpleAlign "ab" ""
[This 'a',This 'b']

>>> simpleAlign "" "ab"
[That 'a',That 'b']

>>> simpleAlign [1] "ab"
[These 1 'a',That 'b']

>>> simpleAlign [] []
[]

>>> simpleAlign [1,2] "ab"
[These 1 'a',These 2 'b']