Safe Haskell | None |
---|---|
Language | Haskell2010 |
helper methods
Synopsis
- type family AndT (b :: Bool) (b1 :: Bool) :: Bool where ...
- type family OrT (b :: Bool) (b1 :: Bool) :: Bool where ...
- type family NotT (b :: Bool) :: Bool where ...
- type family RepeatT (n :: Nat) (p :: k) :: [k] where ...
- type family IntersperseT (s :: Symbol) (xs :: [Symbol]) :: Symbol where ...
- type family LenT (xs :: [k]) :: Nat where ...
- type family FlipT (d :: k1 -> k -> k2) (p :: k) (q :: k1) :: k2 where ...
- type family IfT (b :: Bool) (t :: k) (f :: k) :: k where ...
- type family SumT (ns :: [Nat]) :: Nat where ...
- type family MapT (f :: k -> k1) (xs :: [k]) :: [k1] where ...
- type family ConsT s where ...
- type family (p :: k -> k1) %% (q :: k) :: k1 where ...
- type family (p :: k) %& (q :: k -> k1) :: k1 where ...
- type (<%>) s t = AppendSymbol s t
- type family ExtractAFromList (as :: Type) :: Type where ...
- type family ExtractAFromTA (ta :: Type) :: Type where ...
- type family ExtractTFromTA (ta :: Type) :: Type -> Type where ...
- type family MaybeT mb where ...
- type family LeftT lr where ...
- type family RightT lr where ...
- type family ThisT lr where ...
- type family ThatT lr where ...
- type family TheseT lr where ...
- type family FnT ab :: Type where ...
- type family ApplyConstT (ta :: Type) (b :: Type) :: Type where ...
- type family JoinT x y where ...
- type family FailWhenT (b :: Bool) (msg :: ErrorMessage) :: Constraint where ...
- type family FailUnlessT (b :: Bool) (msg :: ErrorMessage) :: Constraint where ...
- type family BetweenT (s :: Symbol) (a :: Nat) (b :: Nat) (v :: Nat) :: Constraint where ...
- class GetBool (a :: Bool) where
- class GetLen xs where
- class GetThese (th :: These a b) where
- getThese :: forall th. GetThese th => These () ()
- class GetOrdering (cmp :: Ordering) where
- data OrderingP
- class GetOrd (k :: OrderingP) where
- nat :: forall n a. (KnownNat n, Num a) => a
- symb :: forall s. KnownSymbol s => String
- class ToITupleC x where
- class FromITupleC x where
- type FromITupleP x
- fromITupleC :: x -> FromITupleP x
- class ToITupleListC (n :: Nat) (a :: Type) where
- type ToITupleListP n a
- toITupleListC :: [a] -> Either String (ToITupleListP n a)
- class ReverseITupleC (x :: Type) (xs :: Type) (ys :: Type) where
- type ReverseITupleT x xs ys
- reverseITupleC :: x -> xs -> ys -> ReverseITupleT x xs ys
- class TupleC (n :: Nat) (a :: Type) where
- type family T4_1 x where ...
- type family T4_2 x where ...
- type family T4_3 x where ...
- type family T4_4 x where ...
- type family T5_1 x where ...
- type family T5_2 x where ...
- type family T5_3 x where ...
- type family T5_4 x where ...
- type family T5_5 x where ...
- class ExtractL1C (tp :: Type) where
- type ExtractL1T tp
- extractL1C :: tp -> ExtractL1T tp
- class ExtractL2C (tp :: Type) where
- type ExtractL2T tp
- extractL2C :: tp -> ExtractL2T tp
- class ExtractL3C (tp :: Type) where
- type ExtractL3T tp
- extractL3C :: tp -> ExtractL3T tp
- class ExtractL4C (tp :: Type) where
- type ExtractL4T tp
- extractL4C :: tp -> ExtractL4T tp
- class ExtractL5C (tp :: Type) where
- type ExtractL5T tp
- extractL5C :: tp -> ExtractL5T tp
- class ExtractL6C (tp :: Type) where
- type ExtractL6T tp
- extractL6C :: tp -> ExtractL6T tp
- class ExtractL7C (tp :: Type) where
- type ExtractL7T tp
- extractL7C :: tp -> ExtractL7T tp
- class ExtractL8C (tp :: Type) where
- type ExtractL8T tp
- extractL8C :: tp -> ExtractL8T tp
- isPrime :: Int -> Bool
- primeStream :: [Integer]
- primeFactors :: Integer -> [Integer]
- compileRegex :: forall rs. GetROpts rs => String -> String -> Either (String, String) Regex
- data ROpt
- class GetROpts (os :: [ROpt]) where
- getROpts :: ([String], [PCREOption])
- data RReplace
- class GetReplaceFnSub (k :: ReplaceFnSub) where
- data ReplaceFnSub
- displayROpts :: [String] -> String
- newtype SColor = SColor Color
- class GetColor (a :: Color) where
- newtype SStyle = SStyle Style
- class GetStyle (a :: Style) where
- class Bifunctor p => SwapC p where
- swapC :: p a b -> p b a
- showTK :: forall r. Typeable r => String
- showT :: forall (t :: Type). Typeable t => String
- showThese :: These a b -> String
- prettyOrd :: Ordering -> String
- unlessNull :: (AsEmpty t, Monoid m) => t -> m -> m
- unlessNullM :: (AsEmpty t, Applicative m) => t -> (t -> m ()) -> m ()
- nullSpace :: String -> String
- nullIf :: String -> String -> String
- pureTryTest :: a -> IO (Either () a)
- pureTryTestPred :: (String -> Bool) -> a -> IO (Either String (Either () a))
- (~>) :: Bool -> Bool -> Bool
- errorInProgram :: HasCallStack => String -> x
- drawTreeU :: Tree String -> String
- removeAnsi :: Show a => Either String a -> IO ()
- _Id :: Lens (Identity a) (Identity b) a b
- sum' :: (Foldable t, Num a) => t a -> a
- product' :: (Foldable t, Num a) => t a -> a
- foldMapStrict :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
- cycle' :: [a] -> [a]
- cmpOf :: Eq a => Ordering -> ([a] -> [a] -> Bool, String)
- ifM :: Monad m => m Bool -> m a -> m a -> m a
- class AssocC p where
- simpleAlign :: [a] -> [b] -> [These a b]
useful type families
type family IntersperseT (s :: Symbol) (xs :: [Symbol]) :: Symbol where ... Source #
Intersperse a symbol inside a list of symbols
IntersperseT _s '[] = "" | |
IntersperseT _s '[x] = x | |
IntersperseT s (x ': (y ': xs)) = x <%> (s <%> IntersperseT s (y ': xs)) |
type family FlipT (d :: k1 -> k -> k2) (p :: k) (q :: k1) :: k2 where ... Source #
flip
at the type level
FlipT d p q = d q p |
type family (p :: k -> k1) %% (q :: k) :: k1 where ... infixl 9 Source #
type level application: see $
which works for type level functions
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
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
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
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
ExtractTFromTA (t _a) = t | |
ExtractTFromTA z = TypeError ('Text "ExtractTFromTA: expected (t a) but found something else" :$$: ('Text "t a = " :<>: 'ShowType z)) |
type family ApplyConstT (ta :: Type) (b :: Type) :: Type where ... Source #
replace the type inside a container using b
type family FailWhenT (b :: Bool) (msg :: ErrorMessage) :: Constraint where ... Source #
helper method that fails with a msg when True
type family FailUnlessT (b :: Bool) (msg :: ErrorMessage) :: Constraint where ... Source #
helper method that fails with msg when False
FailUnlessT 'True _ = () | |
FailUnlessT 'False e = TypeError e |
type family BetweenT (s :: Symbol) (a :: Nat) (b :: Nat) (v :: Nat) :: Constraint where ... Source #
type level Between
extract values from the type level
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
Instances
GetLen ('[] :: [k]) Source # | |
Defined in Predicate.Misc | |
GetLen ('Nothing :: Maybe a) Source # | |
Defined in Predicate.Misc | |
GetLen ('Just a2 :: Maybe a1) Source # | |
Defined in Predicate.Misc | |
GetLen xs => GetLen (x ': xs :: [a]) Source # | |
Defined in Predicate.Misc | |
GetLen xs => GetLen (x :| xs :: NonEmpty a) Source # | |
Defined in Predicate.Misc | |
GetLen ('ENone :: Elr a b) Source # | |
Defined in Predicate.Elr | |
GetLen ('Right a2 :: Either a1 b) Source # | |
Defined in Predicate.Misc | |
GetLen ('Left a2 :: Either a1 b) Source # | |
Defined in Predicate.Misc | |
GetLen ('That a2 :: These a1 b) Source # | |
Defined in Predicate.Misc | |
GetLen ('This a2 :: These a1 b) Source # | |
Defined in Predicate.Misc | |
GetLen ('ERight b2 :: Elr a b1) Source # | |
Defined in Predicate.Elr | |
GetLen ('ELeft a2 :: Elr a1 b) Source # | |
Defined in Predicate.Elr | |
GetLen ('These a2 b2 :: These a1 b1) Source # | |
Defined in Predicate.Misc | |
GetLen ('EBoth a2 b2 :: Elr a1 b1) Source # | |
Defined in Predicate.Elr |
class GetThese (th :: These a b) where Source #
get These
from the typelevel
class GetOrdering (cmp :: Ordering) where Source #
get ordering from the typelevel
Instances
GetOrdering 'LT Source # | |
Defined in Predicate.Misc | |
GetOrdering 'EQ Source # | |
Defined in Predicate.Misc | |
GetOrdering 'GT Source # | |
Defined in Predicate.Misc |
all the ways to compare two values
Instances
Bounded OrderingP Source # | |
Enum OrderingP Source # | |
Defined in Predicate.Misc succ :: OrderingP -> OrderingP # pred :: OrderingP -> OrderingP # fromEnum :: OrderingP -> Int # enumFrom :: OrderingP -> [OrderingP] # enumFromThen :: OrderingP -> OrderingP -> [OrderingP] # enumFromTo :: OrderingP -> OrderingP -> [OrderingP] # enumFromThenTo :: OrderingP -> OrderingP -> OrderingP -> [OrderingP] # | |
Eq OrderingP Source # | |
Read OrderingP Source # | |
Show OrderingP Source # | |
class GetOrd (k :: OrderingP) where Source #
extract OrderingP
from the typelevel
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',()))
Instances
(TypeError ('Text "ToITupleC: invalid empty tuple") :: Constraint) => ToITupleC () Source # | |
ToITupleC (a, b) Source # | |
ToITupleC (a, b, c) Source # | |
ToITupleC (a, b, c, d) Source # | |
ToITupleC (a, b, c, d, e) Source # | |
ToITupleC (a, b, c, d, e, f) Source # | |
ToITupleC (a, b, c, d, e, f, g) Source # | |
ToITupleC (a, b, c, d, e, f, g, h) Source # | |
ToITupleC (a, b, c, d, e, f, g, h, i) Source # | |
ToITupleC (a, b, c, d, e, f, g, h, i, j) Source # | |
ToITupleC (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 # | |
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')
type FromITupleP x Source #
fromITupleC :: x -> FromITupleP x Source #
Instances
FromITupleC () Source # | |
FromITupleC (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, ())))))))))))) Source # | |
Defined in Predicate.Misc type 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, (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 # | |
Defined in Predicate.Misc type FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, ()))))))))))) Source # 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 # | |
Defined in Predicate.Misc type FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, ())))))))))) Source # 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 # | |
Defined in Predicate.Misc type FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, (i, ()))))))))) Source # 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 # | |
Defined in Predicate.Misc type FromITupleP (a, (b, (c, (d, (e, (f, (g, (h, ())))))))) Source # 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 # | |
Defined in Predicate.Misc type FromITupleP (a, (b, (c, (d, (e, (f, (g, ()))))))) Source # 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 # | |
Defined in Predicate.Misc type FromITupleP (a, (b, (c, (d, (e, (f, ())))))) Source # fromITupleC :: (a, (b, (c, (d, (e, (f, ())))))) -> FromITupleP (a, (b, (c, (d, (e, (f, ())))))) Source # | |
FromITupleC (a, (b, (c, (d, (e, ()))))) Source # | |
Defined in Predicate.Misc type FromITupleP (a, (b, (c, (d, (e, ()))))) Source # fromITupleC :: (a, (b, (c, (d, (e, ()))))) -> FromITupleP (a, (b, (c, (d, (e, ()))))) Source # | |
FromITupleC (a, (b, (c, (d, ())))) Source # | |
Defined in Predicate.Misc type FromITupleP (a, (b, (c, (d, ())))) Source # fromITupleC :: (a, (b, (c, (d, ())))) -> FromITupleP (a, (b, (c, (d, ())))) Source # | |
FromITupleC (a, (b, (c, ()))) Source # | |
Defined in Predicate.Misc type FromITupleP (a, (b, (c, ()))) Source # fromITupleC :: (a, (b, (c, ()))) -> FromITupleP (a, (b, (c, ()))) Source # | |
FromITupleC (a, (b, ())) Source # | |
Defined in Predicate.Misc type FromITupleP (a, (b, ())) Source # fromITupleC :: (a, (b, ())) -> FromITupleP (a, (b, ())) Source # | |
FromITupleC (a, ()) Source # | |
Defined in Predicate.Misc type FromITupleP (a, ()) Source # 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"
type ToITupleListP n a Source #
toITupleListC :: [a] -> Either String (ToITupleListP n a) Source #
Instances
class ReverseITupleC (x :: Type) (xs :: Type) (ys :: Type) where Source #
reverse an inductive tuple
type ReverseITupleT x xs ys Source #
reverseITupleC :: x -> xs -> ys -> ReverseITupleT x xs ys Source #
Instances
ReverseITupleC x () ys Source # | |
Defined in Predicate.Misc type ReverseITupleT x () ys Source # reverseITupleC :: x -> () -> ys -> ReverseITupleT x () ys Source # | |
ReverseITupleC w ws (x, ys) => ReverseITupleC x (w, ws) ys Source # | |
Defined in Predicate.Misc type ReverseITupleT x (w, ws) ys Source # 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
Instances
TupleC 2 a Source # | convert a list of at least 2 elements to a 2-tuple |
TupleC 3 a Source # | convert a list of at least 3 elements to a 3-tuple |
TupleC 4 a Source # | convert a list of at least 4 elements to a 4-tuple |
TupleC 5 a Source # | convert a list of at least 5 elements to a 5-tuple |
TupleC 6 a Source # | convert a list of at least 6 elements to a 6-tuple |
TupleC 7 a Source # | convert a list of at least 7 elements to a 7-tuple |
TupleC 8 a Source # | convert a list of at least 8 elements to a 8-tuple |
TupleC 9 a Source # | convert a list of at least 9 elements to a 9-tuple |
TupleC 10 a Source # | convert a list of at least 10 elements to a 10-tuple |
TupleC 11 a Source # | convert a list of at least 11 elements to a 11-tuple |
TupleC 12 a Source # | convert a list of at least 12 elements to a 12-tuple |
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
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
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
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
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
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
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
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
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
T5_5 '(_, _, _, _, i) = i |
tuple classes
class ExtractL1C (tp :: Type) where Source #
extract element 1 from a n-tuple
type ExtractL1T tp Source #
extractL1C :: tp -> ExtractL1T tp Source #
Instances
ExtractL1C (a, b) Source # | |
Defined in Predicate.Misc type ExtractL1T (a, b) Source # extractL1C :: (a, b) -> ExtractL1T (a, b) Source # | |
ExtractL1C (a, b, c) Source # | |
Defined in Predicate.Misc type ExtractL1T (a, b, c) Source # extractL1C :: (a, b, c) -> ExtractL1T (a, b, c) Source # | |
ExtractL1C (a, b, c, d) Source # | |
Defined in Predicate.Misc type ExtractL1T (a, b, c, d) Source # extractL1C :: (a, b, c, d) -> ExtractL1T (a, b, c, d) Source # | |
ExtractL1C (a, b, c, d, e) Source # | |
Defined in Predicate.Misc type ExtractL1T (a, b, c, d, e) Source # extractL1C :: (a, b, c, d, e) -> ExtractL1T (a, b, c, d, e) Source # | |
ExtractL1C (a, b, c, d, e, f) Source # | |
Defined in Predicate.Misc type ExtractL1T (a, b, c, d, e, f) Source # extractL1C :: (a, b, c, d, e, f) -> ExtractL1T (a, b, c, d, e, f) Source # | |
ExtractL1C (a, b, c, d, e, f, g) Source # | |
Defined in Predicate.Misc type ExtractL1T (a, b, c, d, e, f, g) Source # 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 # | |
Defined in Predicate.Misc type ExtractL1T (a, b, c, d, e, f, g, h) Source # 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
type ExtractL2T tp Source #
extractL2C :: tp -> ExtractL2T tp Source #
Instances
ExtractL2C (a, b) Source # | |
Defined in Predicate.Misc type ExtractL2T (a, b) Source # extractL2C :: (a, b) -> ExtractL2T (a, b) Source # | |
ExtractL2C (a, b, c) Source # | |
Defined in Predicate.Misc type ExtractL2T (a, b, c) Source # extractL2C :: (a, b, c) -> ExtractL2T (a, b, c) Source # | |
ExtractL2C (a, b, c, d) Source # | |
Defined in Predicate.Misc type ExtractL2T (a, b, c, d) Source # extractL2C :: (a, b, c, d) -> ExtractL2T (a, b, c, d) Source # | |
ExtractL2C (a, b, c, d, e) Source # | |
Defined in Predicate.Misc type ExtractL2T (a, b, c, d, e) Source # extractL2C :: (a, b, c, d, e) -> ExtractL2T (a, b, c, d, e) Source # | |
ExtractL2C (a, b, c, d, e, f) Source # | |
Defined in Predicate.Misc type ExtractL2T (a, b, c, d, e, f) Source # extractL2C :: (a, b, c, d, e, f) -> ExtractL2T (a, b, c, d, e, f) Source # | |
ExtractL2C (a, b, c, d, e, f, g) Source # | |
Defined in Predicate.Misc type ExtractL2T (a, b, c, d, e, f, g) Source # 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 # | |
Defined in Predicate.Misc type ExtractL2T (a, b, c, d, e, f, g, h) Source # 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
type ExtractL3T tp Source #
extractL3C :: tp -> ExtractL3T tp Source #
Instances
ExtractL3C (a, b) Source # | |
Defined in Predicate.Misc type ExtractL3T (a, b) Source # extractL3C :: (a, b) -> ExtractL3T (a, b) Source # | |
ExtractL3C (a, b, c) Source # | |
Defined in Predicate.Misc type ExtractL3T (a, b, c) Source # extractL3C :: (a, b, c) -> ExtractL3T (a, b, c) Source # | |
ExtractL3C (a, b, c, d) Source # | |
Defined in Predicate.Misc type ExtractL3T (a, b, c, d) Source # extractL3C :: (a, b, c, d) -> ExtractL3T (a, b, c, d) Source # | |
ExtractL3C (a, b, c, d, e) Source # | |
Defined in Predicate.Misc type ExtractL3T (a, b, c, d, e) Source # extractL3C :: (a, b, c, d, e) -> ExtractL3T (a, b, c, d, e) Source # | |
ExtractL3C (a, b, c, d, e, f) Source # | |
Defined in Predicate.Misc type ExtractL3T (a, b, c, d, e, f) Source # extractL3C :: (a, b, c, d, e, f) -> ExtractL3T (a, b, c, d, e, f) Source # | |
ExtractL3C (a, b, c, d, e, f, g) Source # | |
Defined in Predicate.Misc type ExtractL3T (a, b, c, d, e, f, g) Source # 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 # | |
Defined in Predicate.Misc type ExtractL3T (a, b, c, d, e, f, g, h) Source # 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
type ExtractL4T tp Source #
extractL4C :: tp -> ExtractL4T tp Source #
Instances
ExtractL4C (a, b) Source # | |
Defined in Predicate.Misc type ExtractL4T (a, b) Source # extractL4C :: (a, b) -> ExtractL4T (a, b) Source # | |
ExtractL4C (a, b, c) Source # | |
Defined in Predicate.Misc type ExtractL4T (a, b, c) Source # extractL4C :: (a, b, c) -> ExtractL4T (a, b, c) Source # | |
ExtractL4C (a, b, c, d) Source # | |
Defined in Predicate.Misc type ExtractL4T (a, b, c, d) Source # extractL4C :: (a, b, c, d) -> ExtractL4T (a, b, c, d) Source # | |
ExtractL4C (a, b, c, d, e) Source # | |
Defined in Predicate.Misc type ExtractL4T (a, b, c, d, e) Source # extractL4C :: (a, b, c, d, e) -> ExtractL4T (a, b, c, d, e) Source # | |
ExtractL4C (a, b, c, d, e, f) Source # | |
Defined in Predicate.Misc type ExtractL4T (a, b, c, d, e, f) Source # extractL4C :: (a, b, c, d, e, f) -> ExtractL4T (a, b, c, d, e, f) Source # | |
ExtractL4C (a, b, c, d, e, f, g) Source # | |
Defined in Predicate.Misc type ExtractL4T (a, b, c, d, e, f, g) Source # 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 # | |
Defined in Predicate.Misc type ExtractL4T (a, b, c, d, e, f, g, h) Source # 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
type ExtractL5T tp Source #
extractL5C :: tp -> ExtractL5T tp Source #
Instances
ExtractL5C (a, b) Source # | |
Defined in Predicate.Misc type ExtractL5T (a, b) Source # extractL5C :: (a, b) -> ExtractL5T (a, b) Source # | |
ExtractL5C (a, b, c) Source # | |
Defined in Predicate.Misc type ExtractL5T (a, b, c) Source # extractL5C :: (a, b, c) -> ExtractL5T (a, b, c) Source # | |
ExtractL5C (a, b, c, d) Source # | |
Defined in Predicate.Misc type ExtractL5T (a, b, c, d) Source # extractL5C :: (a, b, c, d) -> ExtractL5T (a, b, c, d) Source # | |
ExtractL5C (a, b, c, d, e) Source # | |
Defined in Predicate.Misc type ExtractL5T (a, b, c, d, e) Source # extractL5C :: (a, b, c, d, e) -> ExtractL5T (a, b, c, d, e) Source # | |
ExtractL5C (a, b, c, d, e, f) Source # | |
Defined in Predicate.Misc type ExtractL5T (a, b, c, d, e, f) Source # extractL5C :: (a, b, c, d, e, f) -> ExtractL5T (a, b, c, d, e, f) Source # | |
ExtractL5C (a, b, c, d, e, f, g) Source # | |
Defined in Predicate.Misc type ExtractL5T (a, b, c, d, e, f, g) Source # 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 # | |
Defined in Predicate.Misc type ExtractL5T (a, b, c, d, e, f, g, h) Source # 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
type ExtractL6T tp Source #
extractL6C :: tp -> ExtractL6T tp Source #
Instances
ExtractL6C (a, b) Source # | |
Defined in Predicate.Misc type ExtractL6T (a, b) Source # extractL6C :: (a, b) -> ExtractL6T (a, b) Source # | |
ExtractL6C (a, b, c) Source # | |
Defined in Predicate.Misc type ExtractL6T (a, b, c) Source # extractL6C :: (a, b, c) -> ExtractL6T (a, b, c) Source # | |
ExtractL6C (a, b, c, d) Source # | |
Defined in Predicate.Misc type ExtractL6T (a, b, c, d) Source # extractL6C :: (a, b, c, d) -> ExtractL6T (a, b, c, d) Source # | |
ExtractL6C (a, b, c, d, e) Source # | |
Defined in Predicate.Misc type ExtractL6T (a, b, c, d, e) Source # extractL6C :: (a, b, c, d, e) -> ExtractL6T (a, b, c, d, e) Source # | |
ExtractL6C (a, b, c, d, e, f) Source # | |
Defined in Predicate.Misc type ExtractL6T (a, b, c, d, e, f) Source # extractL6C :: (a, b, c, d, e, f) -> ExtractL6T (a, b, c, d, e, f) Source # | |
ExtractL6C (a, b, c, d, e, f, g) Source # | |
Defined in Predicate.Misc type ExtractL6T (a, b, c, d, e, f, g) Source # 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 # | |
Defined in Predicate.Misc type ExtractL6T (a, b, c, d, e, f, g, h) Source # 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
type ExtractL7T tp Source #
extractL7C :: tp -> ExtractL7T tp Source #
Instances
ExtractL7C (a, b) Source # | |
Defined in Predicate.Misc type ExtractL7T (a, b) Source # extractL7C :: (a, b) -> ExtractL7T (a, b) Source # | |
ExtractL7C (a, b, c) Source # | |
Defined in Predicate.Misc type ExtractL7T (a, b, c) Source # extractL7C :: (a, b, c) -> ExtractL7T (a, b, c) Source # | |
ExtractL7C (a, b, c, d) Source # | |
Defined in Predicate.Misc type ExtractL7T (a, b, c, d) Source # extractL7C :: (a, b, c, d) -> ExtractL7T (a, b, c, d) Source # | |
ExtractL7C (a, b, c, d, e) Source # | |
Defined in Predicate.Misc type ExtractL7T (a, b, c, d, e) Source # extractL7C :: (a, b, c, d, e) -> ExtractL7T (a, b, c, d, e) Source # | |
ExtractL7C (a, b, c, d, e, f) Source # | |
Defined in Predicate.Misc type ExtractL7T (a, b, c, d, e, f) Source # extractL7C :: (a, b, c, d, e, f) -> ExtractL7T (a, b, c, d, e, f) Source # | |
ExtractL7C (a, b, c, d, e, f, g) Source # | |
Defined in Predicate.Misc type ExtractL7T (a, b, c, d, e, f, g) Source # 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 # | |
Defined in Predicate.Misc type ExtractL7T (a, b, c, d, e, f, g, h) Source # 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
type ExtractL8T tp Source #
extractL8C :: tp -> ExtractL8T tp Source #
Instances
ExtractL8C (a, b) Source # | |
Defined in Predicate.Misc type ExtractL8T (a, b) Source # extractL8C :: (a, b) -> ExtractL8T (a, b) Source # | |
ExtractL8C (a, b, c) Source # | |
Defined in Predicate.Misc type ExtractL8T (a, b, c) Source # extractL8C :: (a, b, c) -> ExtractL8T (a, b, c) Source # | |
ExtractL8C (a, b, c, d) Source # | |
Defined in Predicate.Misc type ExtractL8T (a, b, c, d) Source # extractL8C :: (a, b, c, d) -> ExtractL8T (a, b, c, d) Source # | |
ExtractL8C (a, b, c, d, e) Source # | |
Defined in Predicate.Misc type ExtractL8T (a, b, c, d, e) Source # extractL8C :: (a, b, c, d, e) -> ExtractL8T (a, b, c, d, e) Source # | |
ExtractL8C (a, b, c, d, e, f) Source # | |
Defined in Predicate.Misc type ExtractL8T (a, b, c, d, e, f) Source # extractL8C :: (a, b, c, d, e, f) -> ExtractL8T (a, b, c, d, e, f) Source # | |
ExtractL8C (a, b, c, d, e, f, g) Source # | |
Defined in Predicate.Misc type ExtractL8T (a, b, c, d, e, f, g) Source # 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 # | |
Defined in Predicate.Misc type ExtractL8T (a, b, c, d, e, f, g, h) Source # extractL8C :: (a, b, c, d, e, f, g, h) -> ExtractL8T (a, b, c, d, e, f, g, h) Source # |
primes
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
Regex options for Rescan Resplit Re etc
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
Bounded ROpt Source # | |
Enum ROpt Source # | |
Eq ROpt Source # | |
Ord ROpt Source # | |
Read ROpt Source # | |
Show ROpt Source # | |
GetROpts ('[] :: [ROpt]) Source # | |
Defined in Predicate.Misc getROpts :: ([String], [PCREOption]) Source # | |
(Typeable r, GetROpt r, GetROpts rs) => GetROpts (r ': rs) Source # | |
Defined in Predicate.Misc getROpts :: ([String], [PCREOption]) Source # |
class GetROpts (os :: [ROpt]) where Source #
extract the regex options from the type level list
getROpts :: ([String], [PCREOption]) 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
class GetReplaceFnSub (k :: ReplaceFnSub) where Source #
extract replacement options from typelevel
Instances
GetReplaceFnSub 'RPrepend Source # | |
Defined in Predicate.Misc | |
GetReplaceFnSub 'ROverWrite Source # | |
Defined in Predicate.Misc | |
GetReplaceFnSub 'RAppend Source # | |
Defined in Predicate.Misc |
data ReplaceFnSub Source #
simple regex string replacement options
Instances
displayROpts :: [String] -> String Source #
display regex options
colors
wrapper for a Show instance around Color
class GetColor (a :: Color) where Source #
get Color
from the typelevel
Instances
GetColor 'Default Source # | |
Defined in Predicate.Misc | |
GetColor 'White Source # | |
Defined in Predicate.Misc | |
GetColor 'Cyan Source # | |
Defined in Predicate.Misc | |
GetColor 'Magenta Source # | |
Defined in Predicate.Misc | |
GetColor 'Blue Source # | |
Defined in Predicate.Misc | |
GetColor 'Yellow Source # | |
Defined in Predicate.Misc | |
GetColor 'Green Source # | |
Defined in Predicate.Misc | |
GetColor 'Red Source # | |
Defined in Predicate.Misc | |
GetColor 'Black Source # | |
Defined in Predicate.Misc |
styles
wrapper for a Show instance around Color
class GetStyle (a :: Style) where Source #
get Style
from the typelevel
Instances
GetStyle 'Reverse Source # | |
Defined in Predicate.Misc | |
GetStyle 'ColoredNormal Source # | |
Defined in Predicate.Misc | |
GetStyle 'SlowBlink Source # | |
Defined in Predicate.Misc | |
GetStyle 'Underline Source # | |
Defined in Predicate.Misc | |
GetStyle 'Italic Source # | |
Defined in Predicate.Misc | |
GetStyle 'Faint Source # | |
Defined in Predicate.Misc | |
GetStyle 'Bold Source # | |
Defined in Predicate.Misc | |
GetStyle 'Normal Source # | |
Defined in Predicate.Misc |
miscellaneous
class Bifunctor p => SwapC p where Source #
swap values in a bifunctor
Instances
SwapC Either Source # | |
SwapC (,) Source # | |
Defined in Predicate.Misc | |
SwapC Arg Source # | |
SwapC These Source # | |
SwapC Elr Source # | |
SwapC ((,,) a) Source # | |
Defined in Predicate.Misc | |
SwapC ((,,,) a b) Source # | |
Defined in Predicate.Misc | |
SwapC ((,,,,) a b c) Source # | |
Defined in Predicate.Misc | |
SwapC ((,,,,,) a b c d) Source # | |
Defined in Predicate.Misc | |
SwapC ((,,,,,,) a b c d e) Source # | |
Defined in Predicate.Misc |
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
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
removeAnsi :: Show a => Either String a -> IO () Source #
strip ansi characters from a string and print it (for doctests)
foldMapStrict :: (Foldable t, Monoid m) => (a -> m) -> t a -> m Source #
strict version of foldMap
: replace with Data.Foldable.foldMap' when more generally available
cmpOf :: Eq a => Ordering -> ([a] -> [a] -> Bool, String) Source #
return a function that compares two lists based on the Ordering parameter
associate and unassociate certain two parameter types
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']