predicate-typed-0.7.4.5: Predicates, Refinement types and Dsl
Safe HaskellNone
LanguageHaskell2010

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

getBool :: Bool Source #

Instances

Instances details
GetBool 'False Source # 
Instance details

Defined in Predicate.Misc

Methods

getBool :: Bool Source #

GetBool 'True Source # 
Instance details

Defined in Predicate.Misc

Methods

getBool :: Bool 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

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

Defined in Predicate.Misc

Methods

getLen :: Int Source #

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

Defined in Predicate.Misc

Methods

getLen :: Int Source #

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

Defined in Predicate.Misc

Methods

getLen :: Int Source #

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

Defined in Predicate.Misc

Methods

getLen :: Int Source #

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

Defined in Predicate.Misc

Methods

getLen :: Int Source #

GetLen ('ENone :: Elr a b) Source # 
Instance details

Defined in Predicate.Elr

Methods

getLen :: Int Source #

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

Defined in Predicate.Misc

Methods

getLen :: Int Source #

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

Defined in Predicate.Misc

Methods

getLen :: Int Source #

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

Defined in Predicate.Misc

Methods

getLen :: Int Source #

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

Defined in Predicate.Misc

Methods

getLen :: Int Source #

GetLen ('ERight b2 :: Elr a b1) Source # 
Instance details

Defined in Predicate.Elr

Methods

getLen :: Int Source #

GetLen ('ELeft a2 :: Elr a1 b) Source # 
Instance details

Defined in Predicate.Elr

Methods

getLen :: Int Source #

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

Defined in Predicate.Misc

Methods

getLen :: Int Source #

GetLen ('EBoth a2 b2 :: Elr a1 b1) Source # 
Instance details

Defined in Predicate.Elr

Methods

getLen :: Int Source #

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 details

Defined in Predicate.Misc

Methods

getThese' :: These () () Source #

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

Defined in Predicate.Misc

Methods

getThese' :: These () () Source #

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

Defined in Predicate.Misc

Methods

getThese' :: 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

Instances

Instances details
GetOrdering 'LT Source # 
Instance details

Defined in Predicate.Misc

GetOrdering 'EQ Source # 
Instance details

Defined in Predicate.Misc

GetOrdering 'GT Source # 
Instance details

Defined in Predicate.Misc

data OrderingP Source #

all the ways to compare two values

Constructors

CGt 
CGe 
CEq 
CLe 
CLt 
CNe 

class GetOrd (k :: OrderingP) where Source #

extract OrderingP from the typelevel

Methods

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

Instances

Instances details
GetOrd 'CGt Source # 
Instance details

Defined in Predicate.Misc

Methods

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

GetOrd 'CGe Source # 
Instance details

Defined in Predicate.Misc

Methods

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

GetOrd 'CEq Source # 
Instance details

Defined in Predicate.Misc

Methods

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

GetOrd 'CLe Source # 
Instance details

Defined in Predicate.Misc

Methods

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

GetOrd 'CLt Source # 
Instance details

Defined in Predicate.Misc

Methods

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

GetOrd 'CNe Source # 
Instance details

Defined in Predicate.Misc

Methods

getOrd :: 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 details

Defined in Predicate.Misc

Associated Types

type ToITupleP () Source #

Methods

toITupleC :: () -> ToITupleP () Source #

ToITupleC (a, b) Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleP (a, b) Source #

Methods

toITupleC :: (a, b) -> ToITupleP (a, b) Source #

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

Defined in Predicate.Misc

Associated Types

type ToITupleP (a, b, c) Source #

Methods

toITupleC :: (a, b, c) -> ToITupleP (a, b, c) Source #

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

Defined in Predicate.Misc

Associated Types

type ToITupleP (a, b, c, d) Source #

Methods

toITupleC :: (a, b, c, d) -> ToITupleP (a, b, c, d) Source #

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

Defined in Predicate.Misc

Associated Types

type ToITupleP (a, b, c, d, e) Source #

Methods

toITupleC :: (a, b, c, d, e) -> ToITupleP (a, b, c, d, e) Source #

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

Defined in Predicate.Misc

Associated Types

type ToITupleP (a, b, c, d, e, f) Source #

Methods

toITupleC :: (a, b, c, d, e, f) -> ToITupleP (a, b, c, d, e, f) Source #

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

Defined in Predicate.Misc

Associated Types

type ToITupleP (a, b, c, d, e, f, g) Source #

Methods

toITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

type ToITupleP (a, b, c, d, e, f, g, h) Source #

Methods

toITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

type ToITupleP (a, b, c, d, e, f, g, h, i) Source #

Methods

toITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

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

Methods

toITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

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

Methods

toITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

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

Methods

toITupleC :: (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
FromITupleC () Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type FromITupleP () Source #

Methods

fromITupleC :: () -> FromITupleP () Source #

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

Defined in Predicate.Misc

Associated Types

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

Methods

fromITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

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

Methods

fromITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

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

Methods

fromITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

type FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, ()))))))))) Source #

Methods

fromITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

type FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, ())))))))) Source #

Methods

fromITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

type FromITupleP (a, (b, (c, (d, (e, (f, (g, ()))))))) Source #

Methods

fromITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

type FromITupleP (a, (b, (c, (d, (e, (f, ())))))) Source #

Methods

fromITupleC :: (a, (b, (c, (d, (e, (f, ())))))) -> FromITupleP (a, (b, (c, (d, (e, (f, ())))))) Source #

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

Defined in Predicate.Misc

Associated Types

type FromITupleP (a, (b, (c, (d, (e, ()))))) Source #

Methods

fromITupleC :: (a, (b, (c, (d, (e, ()))))) -> FromITupleP (a, (b, (c, (d, (e, ()))))) Source #

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

Defined in Predicate.Misc

Associated Types

type FromITupleP (a, (b, (c, (d, ())))) Source #

Methods

fromITupleC :: (a, (b, (c, (d, ())))) -> FromITupleP (a, (b, (c, (d, ())))) Source #

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

Defined in Predicate.Misc

Associated Types

type FromITupleP (a, (b, (c, ()))) Source #

Methods

fromITupleC :: (a, (b, (c, ()))) -> FromITupleP (a, (b, (c, ()))) Source #

FromITupleC (a, (b, ())) Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type FromITupleP (a, (b, ())) Source #

Methods

fromITupleC :: (a, (b, ())) -> FromITupleP (a, (b, ())) Source #

FromITupleC (a, ()) Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type FromITupleP (a, ()) Source #

Methods

fromITupleC :: (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 details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 0 a Source #

ToITupleListC 1 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 1 a Source #

ToITupleListC 2 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 2 a Source #

ToITupleListC 3 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 3 a Source #

ToITupleListC 4 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 4 a Source #

ToITupleListC 5 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 5 a Source #

ToITupleListC 6 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 6 a Source #

ToITupleListC 7 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 7 a Source #

ToITupleListC 8 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 8 a Source #

ToITupleListC 9 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 9 a Source #

ToITupleListC 10 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 10 a Source #

ToITupleListC 11 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ToITupleListP 11 a Source #

ToITupleListC 12 a Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type 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 details

Defined in Predicate.Misc

Associated Types

type ReverseITupleT x () ys Source #

Methods

reverseITupleC :: x -> () -> ys -> ReverseITupleT x () ys Source #

ReverseITupleC w ws (x, ys) => ReverseITupleC x (w, ws) ys Source # 
Instance details

Defined in Predicate.Misc

Associated Types

type ReverseITupleT x (w, ws) ys Source #

Methods

reverseITupleC :: 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 details

Defined in Predicate.Misc

Associated Types

type TupleT 2 a Source #

Methods

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

TupleC 3 a Source #

convert a list of at least 3 elements to a 3-tuple

Instance details

Defined in Predicate.Misc

Associated Types

type TupleT 3 a Source #

Methods

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

TupleC 4 a Source #

convert a list of at least 4 elements to a 4-tuple

Instance details

Defined in Predicate.Misc

Associated Types

type TupleT 4 a Source #

Methods

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

TupleC 5 a Source #

convert a list of at least 5 elements to a 5-tuple

Instance details

Defined in Predicate.Misc

Associated Types

type TupleT 5 a Source #

Methods

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

TupleC 6 a Source #

convert a list of at least 6 elements to a 6-tuple

Instance details

Defined in Predicate.Misc

Associated Types

type TupleT 6 a Source #

Methods

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

TupleC 7 a Source #

convert a list of at least 7 elements to a 7-tuple

Instance details

Defined in Predicate.Misc

Associated Types

type TupleT 7 a Source #

Methods

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

TupleC 8 a Source #

convert a list of at least 8 elements to a 8-tuple

Instance details

Defined in Predicate.Misc

Associated Types

type TupleT 8 a Source #

Methods

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

TupleC 9 a Source #

convert a list of at least 9 elements to a 9-tuple

Instance details

Defined in Predicate.Misc

Associated Types

type TupleT 9 a Source #

Methods

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

TupleC 10 a Source #

convert a list of at least 10 elements to a 10-tuple

Instance details

Defined in Predicate.Misc

Associated Types

type TupleT 10 a Source #

Methods

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

TupleC 11 a Source #

convert a list of at least 11 elements to a 11-tuple

Instance details

Defined in Predicate.Misc

Associated Types

type TupleT 11 a Source #

Methods

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

TupleC 12 a Source #

convert a list of at least 12 elements to a 12-tuple

Instance details

Defined in Predicate.Misc

Associated Types

type TupleT 12 a Source #

Methods

getTupleC :: [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 details

Defined in Predicate.Misc

Associated Types

type ExtractL1T (a, b) Source #

Methods

extractL1C :: (a, b) -> ExtractL1T (a, b) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL1T (a, b, c) Source #

Methods

extractL1C :: (a, b, c) -> ExtractL1T (a, b, c) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL1T (a, b, c, d) Source #

Methods

extractL1C :: (a, b, c, d) -> ExtractL1T (a, b, c, d) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL1T (a, b, c, d, e) Source #

Methods

extractL1C :: (a, b, c, d, e) -> ExtractL1T (a, b, c, d, e) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL1T (a, b, c, d, e, f) Source #

Methods

extractL1C :: (a, b, c, d, e, f) -> ExtractL1T (a, b, c, d, e, f) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL1T (a, b, c, d, e, f, g) Source #

Methods

extractL1C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL1T (a, b, c, d, e, f, g, h) Source #

Methods

extractL1C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL2T (a, b) Source #

Methods

extractL2C :: (a, b) -> ExtractL2T (a, b) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL2T (a, b, c) Source #

Methods

extractL2C :: (a, b, c) -> ExtractL2T (a, b, c) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL2T (a, b, c, d) Source #

Methods

extractL2C :: (a, b, c, d) -> ExtractL2T (a, b, c, d) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL2T (a, b, c, d, e) Source #

Methods

extractL2C :: (a, b, c, d, e) -> ExtractL2T (a, b, c, d, e) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL2T (a, b, c, d, e, f) Source #

Methods

extractL2C :: (a, b, c, d, e, f) -> ExtractL2T (a, b, c, d, e, f) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL2T (a, b, c, d, e, f, g) Source #

Methods

extractL2C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL2T (a, b, c, d, e, f, g, h) Source #

Methods

extractL2C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL3T (a, b) Source #

Methods

extractL3C :: (a, b) -> ExtractL3T (a, b) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL3T (a, b, c) Source #

Methods

extractL3C :: (a, b, c) -> ExtractL3T (a, b, c) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL3T (a, b, c, d) Source #

Methods

extractL3C :: (a, b, c, d) -> ExtractL3T (a, b, c, d) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL3T (a, b, c, d, e) Source #

Methods

extractL3C :: (a, b, c, d, e) -> ExtractL3T (a, b, c, d, e) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL3T (a, b, c, d, e, f) Source #

Methods

extractL3C :: (a, b, c, d, e, f) -> ExtractL3T (a, b, c, d, e, f) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL3T (a, b, c, d, e, f, g) Source #

Methods

extractL3C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL3T (a, b, c, d, e, f, g, h) Source #

Methods

extractL3C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL4T (a, b) Source #

Methods

extractL4C :: (a, b) -> ExtractL4T (a, b) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL4T (a, b, c) Source #

Methods

extractL4C :: (a, b, c) -> ExtractL4T (a, b, c) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL4T (a, b, c, d) Source #

Methods

extractL4C :: (a, b, c, d) -> ExtractL4T (a, b, c, d) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL4T (a, b, c, d, e) Source #

Methods

extractL4C :: (a, b, c, d, e) -> ExtractL4T (a, b, c, d, e) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL4T (a, b, c, d, e, f) Source #

Methods

extractL4C :: (a, b, c, d, e, f) -> ExtractL4T (a, b, c, d, e, f) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL4T (a, b, c, d, e, f, g) Source #

Methods

extractL4C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL4T (a, b, c, d, e, f, g, h) Source #

Methods

extractL4C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL5T (a, b) Source #

Methods

extractL5C :: (a, b) -> ExtractL5T (a, b) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL5T (a, b, c) Source #

Methods

extractL5C :: (a, b, c) -> ExtractL5T (a, b, c) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL5T (a, b, c, d) Source #

Methods

extractL5C :: (a, b, c, d) -> ExtractL5T (a, b, c, d) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL5T (a, b, c, d, e) Source #

Methods

extractL5C :: (a, b, c, d, e) -> ExtractL5T (a, b, c, d, e) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL5T (a, b, c, d, e, f) Source #

Methods

extractL5C :: (a, b, c, d, e, f) -> ExtractL5T (a, b, c, d, e, f) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL5T (a, b, c, d, e, f, g) Source #

Methods

extractL5C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL5T (a, b, c, d, e, f, g, h) Source #

Methods

extractL5C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL6T (a, b) Source #

Methods

extractL6C :: (a, b) -> ExtractL6T (a, b) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL6T (a, b, c) Source #

Methods

extractL6C :: (a, b, c) -> ExtractL6T (a, b, c) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL6T (a, b, c, d) Source #

Methods

extractL6C :: (a, b, c, d) -> ExtractL6T (a, b, c, d) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL6T (a, b, c, d, e) Source #

Methods

extractL6C :: (a, b, c, d, e) -> ExtractL6T (a, b, c, d, e) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL6T (a, b, c, d, e, f) Source #

Methods

extractL6C :: (a, b, c, d, e, f) -> ExtractL6T (a, b, c, d, e, f) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL6T (a, b, c, d, e, f, g) Source #

Methods

extractL6C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL6T (a, b, c, d, e, f, g, h) Source #

Methods

extractL6C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL7T (a, b) Source #

Methods

extractL7C :: (a, b) -> ExtractL7T (a, b) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL7T (a, b, c) Source #

Methods

extractL7C :: (a, b, c) -> ExtractL7T (a, b, c) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL7T (a, b, c, d) Source #

Methods

extractL7C :: (a, b, c, d) -> ExtractL7T (a, b, c, d) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL7T (a, b, c, d, e) Source #

Methods

extractL7C :: (a, b, c, d, e) -> ExtractL7T (a, b, c, d, e) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL7T (a, b, c, d, e, f) Source #

Methods

extractL7C :: (a, b, c, d, e, f) -> ExtractL7T (a, b, c, d, e, f) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL7T (a, b, c, d, e, f, g) Source #

Methods

extractL7C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL7T (a, b, c, d, e, f, g, h) Source #

Methods

extractL7C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL8T (a, b) Source #

Methods

extractL8C :: (a, b) -> ExtractL8T (a, b) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL8T (a, b, c) Source #

Methods

extractL8C :: (a, b, c) -> ExtractL8T (a, b, c) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL8T (a, b, c, d) Source #

Methods

extractL8C :: (a, b, c, d) -> ExtractL8T (a, b, c, d) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL8T (a, b, c, d, e) Source #

Methods

extractL8C :: (a, b, c, d, e) -> ExtractL8T (a, b, c, d, e) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL8T (a, b, c, d, e, f) Source #

Methods

extractL8C :: (a, b, c, d, e, f) -> ExtractL8T (a, b, c, d, e, f) Source #

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

Defined in Predicate.Misc

Associated Types

type ExtractL8T (a, b, c, d, e, f, g) Source #

Methods

extractL8C :: (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 details

Defined in Predicate.Misc

Associated Types

type ExtractL8T (a, b, c, d, e, f, g, h) Source #

Methods

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

primes

isPrime :: Int -> Bool Source #

prime predicate

>>> isPrime 7
True
>>> isPrime 6
False

primeStream :: [Integer] Source #

primes stream

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

primeFactors :: Integer -> [Integer] Source #

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
Bounded ROpt Source # 
Instance details

Defined in Predicate.Misc

Enum ROpt Source # 
Instance details

Defined in Predicate.Misc

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.Misc

Methods

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

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

Ord ROpt Source # 
Instance details

Defined in Predicate.Misc

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 #

Read ROpt Source # 
Instance details

Defined in Predicate.Misc

Show ROpt Source # 
Instance details

Defined in Predicate.Misc

Methods

showsPrec :: Int -> ROpt -> ShowS #

show :: ROpt -> String #

showList :: [ROpt] -> ShowS #

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

Defined in Predicate.Misc

Methods

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

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

Defined in Predicate.Misc

Methods

getROpts :: ([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 details

Defined in Predicate.Misc

Methods

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

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

Defined in Predicate.Misc

Methods

getROpts :: ([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

Instances

Instances details
Show RReplace Source # 
Instance details

Defined in Predicate.Misc

class GetReplaceFnSub (k :: ReplaceFnSub) where Source #

extract replacement options from typelevel

Instances

Instances details
GetReplaceFnSub 'RPrepend Source # 
Instance details

Defined in Predicate.Misc

GetReplaceFnSub 'ROverWrite Source # 
Instance details

Defined in Predicate.Misc

GetReplaceFnSub 'RAppend Source # 
Instance details

Defined in Predicate.Misc

data ReplaceFnSub Source #

simple regex string replacement options

Constructors

RPrepend 
ROverWrite 
RAppend 

Instances

Instances details
Bounded ReplaceFnSub Source # 
Instance details

Defined in Predicate.Misc

Enum ReplaceFnSub Source # 
Instance details

Defined in Predicate.Misc

Eq ReplaceFnSub Source # 
Instance details

Defined in Predicate.Misc

Read ReplaceFnSub Source # 
Instance details

Defined in Predicate.Misc

Show ReplaceFnSub Source # 
Instance details

Defined in Predicate.Misc

P (ReplaceAllStringT o p q r) x => P (ReplaceAllString o p q r :: Type) x Source # 
Instance details

Defined in Predicate.Data.Regex

Associated Types

type PP (ReplaceAllString o p q r) x Source #

Methods

eval :: 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 details

Defined 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
Bounded SColor Source # 
Instance details

Defined in Predicate.Misc

Enum SColor Source # 
Instance details

Defined in Predicate.Misc

Show SColor Source # 
Instance details

Defined in Predicate.Misc

class GetColor (a :: Color) where Source #

get Color from the typelevel

Instances

Instances details
GetColor 'Default Source # 
Instance details

Defined in Predicate.Misc

GetColor 'White Source # 
Instance details

Defined in Predicate.Misc

GetColor 'Cyan Source # 
Instance details

Defined in Predicate.Misc

GetColor 'Magenta Source # 
Instance details

Defined in Predicate.Misc

GetColor 'Blue Source # 
Instance details

Defined in Predicate.Misc

GetColor 'Yellow Source # 
Instance details

Defined in Predicate.Misc

GetColor 'Green Source # 
Instance details

Defined in Predicate.Misc

GetColor 'Red Source # 
Instance details

Defined in Predicate.Misc

GetColor 'Black Source # 
Instance details

Defined in Predicate.Misc

styles

newtype SStyle Source #

wrapper for a Show instance around Color

Constructors

SStyle Style 

Instances

Instances details
Bounded SStyle Source # 
Instance details

Defined in Predicate.Misc

Enum SStyle Source # 
Instance details

Defined in Predicate.Misc

Show SStyle Source # 
Instance details

Defined in Predicate.Misc

class GetStyle (a :: Style) where Source #

get Style from the typelevel

Instances

Instances details
GetStyle 'Reverse Source # 
Instance details

Defined in Predicate.Misc

GetStyle 'ColoredNormal Source # 
Instance details

Defined in Predicate.Misc

GetStyle 'SlowBlink Source # 
Instance details

Defined in Predicate.Misc

GetStyle 'Underline Source # 
Instance details

Defined in Predicate.Misc

GetStyle 'Italic Source # 
Instance details

Defined in Predicate.Misc

GetStyle 'Faint Source # 
Instance details

Defined in Predicate.Misc

GetStyle 'Bold Source # 
Instance details

Defined in Predicate.Misc

GetStyle 'Normal Source # 
Instance details

Defined in Predicate.Misc

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
SwapC Either Source # 
Instance details

Defined in Predicate.Misc

Methods

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

SwapC (,) Source # 
Instance details

Defined in Predicate.Misc

Methods

swapC :: (a, b) -> (b, a) Source #

SwapC Arg Source # 
Instance details

Defined in Predicate.Misc

Methods

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

SwapC These Source # 
Instance details

Defined in Predicate.Misc

Methods

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

SwapC Elr Source # 
Instance details

Defined in Predicate.Elr

Methods

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

SwapC ((,,) a) Source # 
Instance details

Defined in Predicate.Misc

Methods

swapC :: (a, a0, b) -> (a, b, a0) Source #

SwapC ((,,,) a b) Source # 
Instance details

Defined in Predicate.Misc

Methods

swapC :: (a, b, a0, b0) -> (a, b, b0, a0) Source #

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

Defined in Predicate.Misc

Methods

swapC :: (a, b, c, a0, b0) -> (a, b, c, b0, a0) Source #

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

Defined in Predicate.Misc

Methods

swapC :: (a, b, c, d, a0, b0) -> (a, b, c, d, b0, a0) Source #

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

Defined in Predicate.Misc

Methods

swapC :: (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

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

nullSpace :: String -> String Source #

append a space if the given value is not empty

nullIf :: String -> String -> String Source #

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

errorInProgram :: HasCallStack => String -> x Source #

fail with a programmer error

drawTreeU :: Tree String -> String Source #

draw a tree using unicode

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

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

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
AssocC Either Source # 
Instance details

Defined in Predicate.Misc

Methods

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

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

AssocC (,) Source # 
Instance details

Defined in Predicate.Misc

Methods

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

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

AssocC These Source # 
Instance details

Defined in Predicate.Misc

Methods

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

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

AssocC Elr Source # 
Instance details

Defined in Predicate.Elr

Methods

assoc :: 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']