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

Safe HaskellNone
LanguageHaskell2010

Predicate.Data.Iterator

Description

promoted iterator functions

Synopsis

Documentation

data Scanl p q r #

similar to scanl

>>> pz @(Scanl (Snd :+ Fst) Fst Snd) ([99],[1..5])
Val [[99],[1,99],[2,1,99],[3,2,1,99],[4,3,2,1,99],[5,4,3,2,1,99]]
>>> pl @(Scanl (Snd :+ Fst) Fst Snd) ([99],[])
Present [[99]] (Scanl [[99]] | b=[99] | as=[])
Val [[99]]
Instances
(PP p (b, a) ~ b, PP q x ~ b, PP r x ~ [a], P p (b, a), P q x, P r x, Show b, Show a) => P (Scanl p q r :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (Scanl p q r) x :: Type #

Methods

eval :: MonadEval m => proxy (Scanl p q r) -> POpts -> x -> m (TT (PP (Scanl p q r) x)) #

Show (Scanl p q r) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> Scanl p q r -> ShowS #

show :: Scanl p q r -> String #

showList :: [Scanl p q r] -> ShowS #

type PP (Scanl p q r :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (Scanl p q r :: Type) x = [PP q x]

data ScanN n p q #

iterates n times keeping all the results

>>> pz @(ScanN 4 Succ Id) 'c'
Val "cdefg"
>>> pz @(Dup >> ScanN 4 (Pred *** Succ) Id) 'g'
Val [('g','g'),('f','h'),('e','i'),('d','j'),('c','k')]
>>> pz @(ScanN 4 Succ Id) 4
Val [4,5,6,7,8]
>>> pz @('(0,1) >> ScanN 20 '(Snd, Fst + Snd) Id >> Map Fst) "sdf"
Val [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765]
>>> pl @(ScanN 2 Succ Id) 4
Present [4,5,6] (Scanl [4,5,6] | b=4 | as=[1,2])
Val [4,5,6]
>>> pl @(ScanN 5 Id Id) 4
Present [4,4,4,4,4,4] (Scanl [4,4,4,4,4,4] | b=4 | as=[1,2,3,4,5])
Val [4,4,4,4,4,4]
>>> pl @(ScanN 2 Succ Id >> PadR 10 (MEmptyT Ordering) Id) LT
Present [LT,EQ,GT,EQ,EQ,EQ,EQ,EQ,EQ,EQ] ((>>) [LT,EQ,GT,EQ,EQ,EQ,EQ,EQ,EQ,EQ] | {PadR 10 pad=EQ [LT,EQ,GT,EQ,EQ,EQ,EQ,EQ,EQ,EQ] | [LT,EQ,GT]})
Val [LT,EQ,GT,EQ,EQ,EQ,EQ,EQ,EQ,EQ]
>>> pl @(ScanN 4 Pred Id) 99
Present [99,98,97,96,95] (Scanl [99,98,97,96,95] | b=99 | as=[1,2,3,4])
Val [99,98,97,96,95]
Instances
P (ScanNT n p q) x => P (ScanN n p q :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (ScanN n p q) x :: Type #

Methods

eval :: MonadEval m => proxy (ScanN n p q) -> POpts -> x -> m (TT (PP (ScanN n p q) x)) #

Show (ScanN n p q) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> ScanN n p q -> ShowS #

show :: ScanN n p q -> String #

showList :: [ScanN n p q] -> ShowS #

type PP (ScanN n p q :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (ScanN n p q :: Type) x

data ScanNA q #

tuple version of ScanN

>>> pl @(ScanNA Succ) (4,'a')
Present "abcde" (Scanl "abcde" | b='a' | as=[1,2,3,4])
Val "abcde"
>>> pl @(ScanNA Tail) (4,"abcd")
Present ["abcd","bcd","cd","d",""] (Scanl ["abcd","bcd","cd","d",""] | b="abcd" | as=[1,2,3,4])
Val ["abcd","bcd","cd","d",""]
>>> pl @(Len &&& Id >> ScanNA Tail) "abcd"
Present ["abcd","bcd","cd","d",""] ((>>) ["abcd","bcd","cd","d",""] | {Scanl ["abcd","bcd","cd","d",""] | b="abcd" | as=[1,2,3,4]})
Val ["abcd","bcd","cd","d",""]
Instances
P (ScanNAT q) x => P (ScanNA q :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (ScanNA q) x :: Type #

Methods

eval :: MonadEval m => proxy (ScanNA q) -> POpts -> x -> m (TT (PP (ScanNA q) x)) #

Show (ScanNA q) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> ScanNA q -> ShowS #

show :: ScanNA q -> String #

showList :: [ScanNA q] -> ShowS #

type PP (ScanNA q :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (ScanNA q :: Type) x

data FoldN n p q #

iterates n times keeping only the last result

>>> pz @(FoldN 4 Succ Id) 'c'
Val 'g'
>>> pz @(ReadP Day Id >> Id ... FoldN 5 Succ Id) "2020-07-27"
Val [2020-07-27,2020-07-28,2020-07-29,2020-07-30,2020-07-31,2020-08-01]
>>> pl @(FoldN 2 Succ Id) LT
Present GT ((>>) GT | {Last GT | [LT,EQ,GT]})
Val GT
>>> pl @(FoldN 30 Succ Id) LT
Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument (Scanl)
Fail "Succ IO e=Prelude.Enum.Ordering.succ: bad argument"
>>> pl @(FoldN 6 Succ Id) 'a'
Present 'g' ((>>) 'g' | {Last 'g' | "abcdefg"})
Val 'g'
>>> pl @(FoldN 6 Pred Id) 'a'
Present '[' ((>>) '[' | {Last '[' | "a`_^]\\["})
Val '['
>>> pl @(FoldN 0 Succ Id) LT
Present LT ((>>) LT | {Last LT | [LT]})
Val LT
>>> pl @(FoldN 2 Succ Id >> FoldN 2 Pred Id) LT
Present LT ((>>) LT | {Last LT | [GT,EQ,LT]})
Val LT
>>> pz @(FoldN 4 (Id <> Id) Id) "abc" -- same as above
Val "abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc"
Instances
P (FoldNT n p q) x => P (FoldN n p q :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (FoldN n p q) x :: Type #

Methods

eval :: MonadEval m => proxy (FoldN n p q) -> POpts -> x -> m (TT (PP (FoldN n p q) x)) #

Show (FoldN n p q) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> FoldN n p q -> ShowS #

show :: FoldN n p q -> String #

showList :: [FoldN n p q] -> ShowS #

type PP (FoldN n p q :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (FoldN n p q :: Type) x

data Foldl p q r #

Foldl similar to foldl

>>> pl @(Foldl (Fst + Snd) 0 (1 ... 10)) ()
Present 55 ((>>) 55 | {Last 55 | [0,1,3,6,10,15,21,28,36,45,55]})
Val 55
>>> pz @(Foldl (Snd :+ Fst) '[99] (1 ... 10)) ()
Val [10,9,8,7,6,5,4,3,2,1,99]
>>> pl @(Foldl Fst '() (EnumFromTo 1 9999)) ()
Error Scanl list size exceeded (max is 100)
Fail "Scanl list size exceeded"
>>> pl @(Foldl (Guard "someval" (Fst < Snd) >> Snd) Head Tail) [1,4,7,9,16]
Present 16 ((>>) 16 | {Last 16 | [1,4,7,9,16]})
Val 16
>>> pl @(Foldl (Guard (PrintT "%d not less than %d" Id) (Fst < Snd) >> Snd) Head Tail) [1,4,7,6,16]
Error 7 not less than 6 (Scanl)
Fail "7 not less than 6"
>>> pl @(Foldl (If (L11 && (Snd > L12)) '( 'True, Snd) '( 'False, L12)) '( 'True, Head) Tail) [1,4,7,9,16]
Present (True,16) ((>>) (True,16) | {Last (True,16) | [(True,1),(True,4),(True,7),(True,9),(True,16)]})
Val (True,16)
>>> pl @(Foldl (If (L11 && (Snd > L12)) '( 'True, Snd) '( 'False, L12)) '( 'True, Head) Tail) [1,4,7,9,16,2]
Present (False,16) ((>>) (False,16) | {Last (False,16) | [(True,1),(True,4),(True,7),(True,9),(True,16),(False,16)]})
Val (False,16)
>>> pl @(Foldl (Snd :+ Fst) (MEmptyT [_]) Id) [1..5]
Present [5,4,3,2,1] ((>>) [5,4,3,2,1] | {Last [5,4,3,2,1] | [[],[1],[2,1],[3,2,1],[4,3,2,1],[5,4,3,2,1]]})
Val [5,4,3,2,1]
>>> pl @('Just Uncons >> Foldl (If L11 (If (L12 < Snd) '( 'True,Snd) '( 'False, Snd)) Fst) '( 'True,Fst) Snd) [-10,-2,2,3,4,10,9,11]
Present (False,9) ((>>) (False,9) | {Last (False,9) | [(True,-10),(True,-2),(True,2),(True,3),(True,4),(True,10),(False,9),(False,9)]})
Val (False,9)
>>> pl @('Just Uncons >> Foldl (If L11 (If (L12 < Snd) '( 'True,Snd) '( 'False, Snd)) Fst) '( 'True,Fst) Snd) [-10,2,3,4,10,11]
Present (True,11) ((>>) (True,11) | {Last (True,11) | [(True,-10),(True,2),(True,3),(True,4),(True,10),(True,11)]})
Val (True,11)
Instances
P (FoldLT p q r) x => P (Foldl p q r :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (Foldl p q r) x :: Type #

Methods

eval :: MonadEval m => proxy (Foldl p q r) -> POpts -> x -> m (TT (PP (Foldl p q r) x)) #

Show (Foldl p q r) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> Foldl p q r -> ShowS #

show :: Foldl p q r -> String #

showList :: [Foldl p q r] -> ShowS #

type PP (Foldl p q r :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (Foldl p q r :: Type) x

data Unfoldr p q #

similar to unfoldr

>>> pz @(Unfoldr (MaybeBool (Not Null) (SplitAt 2 Id)) Id) [1..5]
Val [[1,2],[3,4],[5]]
>>> pl @(Unfoldr (If Null (MkNothing _) ('(Take 3 Id, Drop 1 Id) >> MkJust Id)) Id) "abcdefghi"
Present ["abc","bcd","cde","def","efg","fgh","ghi","hi","i"] (Unfoldr "abcdefghi" ["abc","bcd","cde","def","efg","fgh","ghi","hi","i"] | s="abcdefghi")
Val ["abc","bcd","cde","def","efg","fgh","ghi","hi","i"]
>>> pl @(Unfoldr (If Null (MkNothing _) (Pure _ (SplitAt 2 Id))) Id) [1..5]
Present [[1,2],[3,4],[5]] (Unfoldr [1,2,3,4,5] [[1,2],[3,4],[5]] | s=[1,2,3,4,5])
Val [[1,2],[3,4],[5]]
>>> pl @(Unfoldr (MaybeBool (Not Null) (SplitAt 2 Id)) Id) [1..5]
Present [[1,2],[3,4],[5]] (Unfoldr [1,2,3,4,5] [[1,2],[3,4],[5]] | s=[1,2,3,4,5])
Val [[1,2],[3,4],[5]]
>>> pl @(Unfoldr (If Null (MkNothing _) (Guard "yy" (Len < 3) >> Pure _ (SplitAt 2 Id))) Id) [1..5]
Error yy (Unfoldr [1,2,3,4,5])
Fail "yy"
>>> pl @(Unfoldr (MaybeBool (Not Null) (Guard "yy" (Len < 3) >> SplitAt 2 Id)) Id) [1..5]
Error yy (Unfoldr [1,2,3,4,5])
Fail "yy"
>>> pl @(Unfoldr (Guard "xx" (Len > 4) >> Uncons) Id) [1..10]
Error xx (Unfoldr [1,2,3,4,5,6,7,8,9,10])
Fail "xx"
>>> pl @(Unfoldr Uncons Id) [1..10]
Present [1,2,3,4,5,6,7,8,9,10] (Unfoldr [1,2,3,4,5,6,7,8,9,10] [1,2,3,4,5,6,7,8,9,10] | s=[1,2,3,4,5,6,7,8,9,10])
Val [1,2,3,4,5,6,7,8,9,10]
>>> pan @(Unfoldr (If (Id < 1) (MkNothing _) (MkJust (DivMod Id 2 >> Swap))) Id) 8
P Unfoldr 8 [0,0,0,1]
|
+- P Id 8
|
+- P i=1: If 'False Just (0,4)
|
+- P i=2: If 'False Just (0,2)
|
+- P i=3: If 'False Just (0,1)
|
+- P i=4: If 'False Just (1,0)
|
`- P i=5: If 'True Nothing
Val [0,0,0,1]
Instances
(PP q a ~ s, PP p s ~ Maybe (b, s), P q a, P p s, Show s, Show b) => P (Unfoldr p q :: Type) a # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (Unfoldr p q) a :: Type #

Methods

eval :: MonadEval m => proxy (Unfoldr p q) -> POpts -> a -> m (TT (PP (Unfoldr p q) a)) #

Show (Unfoldr p q) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> Unfoldr p q -> ShowS #

show :: Unfoldr p q -> String #

showList :: [Unfoldr p q] -> ShowS #

type PP (Unfoldr p q :: Type) a # 
Instance details

Defined in Predicate.Data.Iterator

type PP (Unfoldr p q :: Type) a

data IterateUntil p f #

unfolds a value applying f until the condition p is true

>>> pl @(IterateUntil (Id < 90) Pred) 94
Present [94,93,92,91,90] (Unfoldr 94 [94,93,92,91,90] | s=94)
Val [94,93,92,91,90]
Instances
P (IterateUntilT p f) x => P (IterateUntil p f :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (IterateUntil p f) x :: Type #

Methods

eval :: MonadEval m => proxy (IterateUntil p f) -> POpts -> x -> m (TT (PP (IterateUntil p f) x)) #

Show (IterateUntil p f) # 
Instance details

Defined in Predicate.Data.Iterator

type PP (IterateUntil p f :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (IterateUntil p f :: Type) x

data IterateWhile p f #

unfolds a value applying f while the condition p is true

>>> pl @(IterateWhile (Id > 90) Pred) 94
Present [94,93,92,91] (Unfoldr 94 [94,93,92,91] | s=94)
Val [94,93,92,91]
Instances
P (IterateWhileT p f) x => P (IterateWhile p f :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (IterateWhile p f) x :: Type #

Methods

eval :: MonadEval m => proxy (IterateWhile p f) -> POpts -> x -> m (TT (PP (IterateWhile p f) x)) #

Show (IterateWhile p f) # 
Instance details

Defined in Predicate.Data.Iterator

type PP (IterateWhile p f :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (IterateWhile p f :: Type) x

data IterateNWhile n p f #

unfolds a value applying f while the condition p is true or n times

>>> pl @(IterateNWhile 10 (Id > 90) Pred) 95
Present [95,94,93,92,91] ((>>) [95,94,93,92,91] | {Map [95,94,93,92,91] | [(10,95),(9,94),(8,93),(7,92),(6,91)]})
Val [95,94,93,92,91]
>>> pl @(IterateNWhile 3 (Id > 90) Pred) 95
Present [95,94,93] ((>>) [95,94,93] | {Map [95,94,93] | [(3,95),(2,94),(1,93)]})
Val [95,94,93]
Instances
P (IterateNWhileT n p f) x => P (IterateNWhile n p f :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (IterateNWhile n p f) x :: Type #

Methods

eval :: MonadEval m => proxy (IterateNWhile n p f) -> POpts -> x -> m (TT (PP (IterateNWhile n p f) x)) #

Show (IterateNWhile n p f) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> IterateNWhile n p f -> ShowS #

show :: IterateNWhile n p f -> String #

showList :: [IterateNWhile n p f] -> ShowS #

type PP (IterateNWhile n p f :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (IterateNWhile n p f :: Type) x

data IterateNUntil n p f #

unfolds a value applying f until the condition p is true or n times

>>> pl @(IterateNUntil 10 (Id <= 90) Pred) 95
Present [95,94,93,92,91] ((>>) [95,94,93,92,91] | {Map [95,94,93,92,91] | [(10,95),(9,94),(8,93),(7,92),(6,91)]})
Val [95,94,93,92,91]
>>> pl @(IterateNUntil 3 (Id <= 90) Pred) 95
Present [95,94,93] ((>>) [95,94,93] | {Map [95,94,93] | [(3,95),(2,94),(1,93)]})
Val [95,94,93]
>>> pl @(IterateNUntil 9999 'False Id) 1
Error Unfoldr (9999,1):recursion limit i=100 (Unfoldr (9999,1))
Fail "Unfoldr (9999,1):recursion limit i=100"
Instances
P (IterateNUntilT n p f) x => P (IterateNUntil n p f :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (IterateNUntil n p f) x :: Type #

Methods

eval :: MonadEval m => proxy (IterateNUntil n p f) -> POpts -> x -> m (TT (PP (IterateNUntil n p f) x)) #

Show (IterateNUntil n p f) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> IterateNUntil n p f -> ShowS #

show :: IterateNUntil n p f -> String #

showList :: [IterateNUntil n p f] -> ShowS #

type PP (IterateNUntil n p f :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (IterateNUntil n p f :: Type) x

data UnfoldN n p s #

run p n times with state s

>>> :m + System.Random
>>> pz @(UnfoldN 10 (RandomRNext Int 1 100 Id) Id) (mkStdGen 3)
Val [64,94,33,26,12,8,81,41,21,89]
Instances
P (IterateNT n p s) x => P (UnfoldN n p s :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (UnfoldN n p s) x :: Type #

Methods

eval :: MonadEval m => proxy (UnfoldN n p s) -> POpts -> x -> m (TT (PP (UnfoldN n p s) x)) #

Show (UnfoldN n p s) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> UnfoldN n p s -> ShowS #

show :: UnfoldN n p s -> String #

showList :: [UnfoldN n p s] -> ShowS #

type PP (UnfoldN n p s :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (UnfoldN n p s :: Type) x

data Para (ps :: [k]) #

runs values in parallel unlike Do which is serial

>>> pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30]
Val [10,21,120]
>>> pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30,40]
Fail "Para:invalid length(4) expected 3"
>>> pl @(Para '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99,-999]
Present [True,False,False,True] (Para(0) [True,False,False,True] | [1,2,-99,-999])
Val [True,False,False,True]
>>> pl @(Para '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99]
Error Para:invalid length(3) expected 4
Fail "Para:invalid length(3) expected 4"
>>> pl @(Para '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99,-999,1,1,2]
Error Para:invalid length(7) expected 4
Fail "Para:invalid length(7) expected 4"
Instances
([a] ~ x, GetLen ps, P (ParaImpl (LenT ps) ps) x) => P (Para ps :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (Para ps) x :: Type #

Methods

eval :: MonadEval m => proxy (Para ps) -> POpts -> x -> m (TT (PP (Para ps) x)) #

Show (Para ps) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> Para ps -> ShowS #

show :: Para ps -> String #

showList :: [Para ps] -> ShowS #

type PP (Para ps :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (Para ps :: Type) x

data ParaN (n :: Nat) p #

leverages Para for repeating expressions (passthrough method)

>>> pz @(ParaN 4 Succ) [1..4]
Val [2,3,4,5]
>>> pz @(ParaN 4 Succ) "azwxm"
Fail "Para:invalid length(5) expected 4"
>>> pz @(ParaN 4 Succ) "azwx"
Val "b{xy"
>>> pl @(ParaN 5 (Guard "0-255" (Between 0 255 Id))) [1,2,3,4,12]
Present [1,2,3,4,12] (Para(0) [1,2,3,4,12] | [1,2,3,4,12])
Val [1,2,3,4,12]
>>> pl @(ParaN 5 (Guard "0-255" (Between 0 255 Id))) [1,2,3,400,12]
Error 0-255 (Guard | 400 | Para(3 of 4))
Fail "0-255"
>>> pz @(ParaN 5 (Guard (PrintF "bad value %d" Id) (Between 0 255 Id))) [1,2,3,400,12]
Fail "bad value 400"
>>> pl @(ParaN 4 (PrintF "%03d" Id)) [141,21,3,0]
Present ["141","021","003","000"] (Para(0) ["141","021","003","000"] | [141,21,3,0])
Val ["141","021","003","000"]
Instances
(x ~ [a], P (ParaImpl (LenT (RepeatT n p)) (RepeatT n p)) x, GetLen (RepeatT n p)) => P (ParaN n p :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (ParaN n p) x :: Type #

Methods

eval :: MonadEval m => proxy (ParaN n p) -> POpts -> x -> m (TT (PP (ParaN n p) x)) #

Show (ParaN n p) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> ParaN n p -> ShowS #

show :: ParaN n p -> String #

showList :: [ParaN n p] -> ShowS #

type PP (ParaN n p :: Type) x # 
Instance details

Defined in Predicate.Data.Iterator

type PP (ParaN n p :: Type) x = PP (Para (RepeatT n p)) x

data DoN (n :: Nat) p #

leverages Do for repeating predicates (passthrough method) same as DoN n p == FoldN n p Id but more efficient

>>> pz @(DoN 4 Succ) 'c'
Val 'g'
>>> pz @(DoN 4 (Id <> " | ")) "abc"
Val "abc |  |  |  | "
>>> pz @(DoN 4 (Id <> "|" <> Id)) "abc"
Val "abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc"
>>> pl @(DoN 4 (Id + 4)) 1
Present 17 ((>>) 17 | {13 + 4 = 17})
Val 17
>>> pl @(DoN 4 (Id + 7)) 3
Present 31 ((>>) 31 | {24 + 7 = 31})
Val 31
>>> pl @(DoN 4 9) ()
Present 9 ((>>) 9 | {'9})
Val 9
>>> pl @(DoN 4 "xy") 3
Present "xy" ((>>) "xy" | {'"xy"})
Val "xy"
Instances
P (DoNT n p) a => P (DoN n p :: Type) a # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (DoN n p) a :: Type #

Methods

eval :: MonadEval m => proxy (DoN n p) -> POpts -> a -> m (TT (PP (DoN n p) a)) #

Show (DoN n p) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> DoN n p -> ShowS #

show :: DoN n p -> String #

showList :: [DoN n p] -> ShowS #

type PP (DoN n p :: Type) a # 
Instance details

Defined in Predicate.Data.Iterator

type PP (DoN n p :: Type) a

data Repeat (n :: Nat) p #

creates a promoted list of predicates and then evaluates them into a list. see PP instance for '[k]

>>> pz @(Repeat 4 Succ) 'c'
Val "dddd"
>>> pz @(Repeat 4 "abc") ()
Val ["abc","abc","abc","abc"]
>>> pl @(Repeat 4 "xy") 3
Present ["xy","xy","xy","xy"] ('["xy","xy","xy","xy"] ('"xy") | 3)
Val ["xy","xy","xy","xy"]
Instances
P (RepeatT n p) a => P (Repeat n p :: Type) a # 
Instance details

Defined in Predicate.Data.Iterator

Associated Types

type PP (Repeat n p) a :: Type #

Methods

eval :: MonadEval m => proxy (Repeat n p) -> POpts -> a -> m (TT (PP (Repeat n p) a)) #

Show (Repeat n p) # 
Instance details

Defined in Predicate.Data.Iterator

Methods

showsPrec :: Int -> Repeat n p -> ShowS #

show :: Repeat n p -> String #

showList :: [Repeat n p] -> ShowS #

type PP (Repeat n p :: Type) a # 
Instance details

Defined in Predicate.Data.Iterator

type PP (Repeat n p :: Type) a = PP (RepeatT n p) a