Copyright | (c) Grant Weyburne 2019 |
---|---|
License | BSD-3 |
Maintainer | gbwey9@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
class P is the main class. Most of this code contains instances of this class that evaluation of expressions at the type level.
Synopsis
- class P p a where
- evalBool :: (MonadEval m, P p a, PP p a ~ Bool) => Proxy p -> POpts -> a -> m (TT (PP p a))
- type Asc = Ands (Map (Fst Id <= Snd Id) Pairs)
- type Asc' = Ands (Map (Fst Id < Snd Id) Pairs)
- type Desc = Ands (Map (Fst Id >= Snd Id) Pairs)
- type Desc' = Ands (Map (Fst Id > Snd Id) Pairs)
- type Between p q = Ge p && Le q
- type Between' p q r = (r >= p) && (r <= q)
- type AllPositive = Ands (Map Positive Id)
- type AllNegative = Ands (Map Negative Id)
- type Positive = Gt 0
- type Negative = Lt 0
- type AllPositive' = FoldMap All (Map Positive Id)
- type AllNegative' = FoldMap All (Map Negative Id)
- type All x p = Ands (Map x p)
- type Any x p = Ors (Map x p)
- type Unzip = (Map (Fst Id) Id, Map (Snd Id) Id)
- data Re' (rs :: [ROpt]) p q
- type Re p q = Re' '[] p q
- data Rescan' (rs :: [ROpt]) p q
- type Rescan p q = Rescan' '[] p q
- data RescanRanges' (rs :: [ROpt]) p q
- type RescanRanges p q = RescanRanges' '[] p q
- data Resplit' (rs :: [ROpt]) p q
- type Resplit p q = Resplit' '[] p q
- _MX :: Int
- data ReplaceImpl (alle :: Bool) (rs :: [ROpt]) p q r
- type ReplaceAll' (rs :: [ROpt]) p q r = ReplaceImpl True rs p q r
- type ReplaceAll p q r = ReplaceAll' '[] p q r
- type ReplaceOne' (rs :: [ROpt]) p q r = ReplaceImpl False rs p q r
- type ReplaceOne p q r = ReplaceOne' '[] p q r
- type ReplaceAllString' (rs :: [ROpt]) p q r = ReplaceAll' rs p (MakeRR q) r
- type ReplaceAllString p q r = ReplaceAllString' '[] p q r
- type ReplaceOneString' (rs :: [ROpt]) p q r = ReplaceOne' rs p (MakeRR q) r
- type ReplaceOneString p q r = ReplaceOneString' '[] p q r
- data MakeRR p
- data MakeRR1 p
- data MakeRR2 p
- data MakeRR3 p
- data IsCharSet (cs :: CharSet)
- data CharSet
- = CLower
- | CUpper
- | CNumber
- | CSpace
- | CPunctuation
- | CControl
- | CHexDigit
- | COctDigit
- | CSeparator
- | CLatin1
- class GetCharSet (cs :: CharSet) where
- getCharSet :: (CharSet, Char -> Bool)
- type IsLower = IsCharSet CLower
- type IsUpper = IsCharSet CUpper
- type IsNumber = IsCharSet CNumber
- type IsSpace = IsCharSet CSpace
- type IsPunctuation = IsCharSet CPunctuation
- type IsControl = IsCharSet CControl
- type IsHexDigit = IsCharSet CHexDigit
- type IsOctDigit = IsCharSet COctDigit
- type IsSeparator = IsCharSet CSeparator
- type IsLatin1 = IsCharSet CLatin1
- data ToLower
- data ToUpper
- data Inits
- data Tails
- data Ones p
- data ShowP p
- data FormatTimeP p q
- data ParseTimeP' t p q
- type ParseTimeP (t :: Type) p q = ParseTimeP' (Hole t) p q
- data ParseTimes' t p q
- type ParseTimes (t :: Type) p q = ParseTimes' (Hole t) p q
- data MkDay' p q r
- type MkDay = MkDay' (Fst Id) (Snd Id) (Thd Id)
- data UnMkDay p
- data ReadP'' t p
- type ReadP (t :: Type) = ReadP'' (Hole t) Id
- type ReadP' (t :: Type) p = ReadP'' (Hole t) p
- data Min
- data Max
- type Max' t = FoldMap (Max t) Id
- data SortBy p q
- type SortOn p q = SortBy (OrdA p) q
- type SortOnDesc p q = SortBy (Swap >> OrdA p) q
- type SortByHelper p = Partition (p >> (Id == GT)) Id
- data Len
- data Length p
- data L1 p
- type Fst p = L1 p
- class ExtractL1C tp where
- type ExtractL1T tp
- extractL1C :: tp -> ExtractL1T tp
- data L2 p
- type Snd p = L2 p
- class ExtractL2C tp where
- type ExtractL2T tp
- extractL2C :: tp -> ExtractL2T tp
- data L3 p
- type Thd p = L3 p
- class ExtractL3C tp where
- type ExtractL3T tp
- extractL3C :: tp -> ExtractL3T tp
- data L4 p
- class ExtractL4C tp where
- type ExtractL4T tp
- extractL4C :: tp -> ExtractL4T tp
- data L5 p
- class ExtractL5C tp where
- type ExtractL5T tp
- extractL5C :: tp -> ExtractL5T tp
- data L6 p
- class ExtractL6C tp where
- type ExtractL6T tp
- extractL6C :: tp -> ExtractL6T tp
- data I
- data Id
- data IdT
- data FromStringP' t s
- type FromStringP (t :: Type) p = FromStringP' (Hole t) p
- data FromInteger' t n
- type FromInteger (t :: Type) p = FromInteger' (Hole t) p
- type FromIntegerP n = FromInteger' Unproxy n
- data FromIntegral' t n
- type FromIntegral (t :: Type) p = FromIntegral' (Hole t) p
- data ToRational p
- data FromRational' t r
- type FromRational (t :: Type) p = FromRational' (Hole t) p
- data Truncate' t p
- type Truncate (t :: Type) p = Truncate' (Hole t) p
- data Ceiling' t p
- type Ceiling (t :: Type) p = Ceiling' (Hole t) p
- data Floor' t p
- type Floor (t :: Type) p = Floor' (Hole t) p
- data MkProxy
- type family DoExpandT (ps :: [k]) :: Type where ...
- data Do (ps :: [k])
- data MaybeB b p
- data EitherB b p q
- data TupleI (ps :: [k])
- data Msg prt p
- type Msg' prt p = Msg (Printf "[%s] " prt) p
- data Pad (left :: Bool) n p q
- type PadL n p q = Pad True n p q
- type PadR n p q = Pad False n p q
- data SplitAts ns p
- data SplitAt n p
- type Take n p = SplitAt n p >> Fst Id
- type Drop n p = SplitAt n p >> Snd Id
- type Tail = Uncons >> Just (Snd Id)
- type Head = Uncons >> Just (Fst Id)
- type Init = Unsnoc >> Just (Fst Id)
- type Last = Unsnoc >> Just (Snd Id)
- type (&&&) p q = W '(p, q)
- data (p :: k) *** (q :: k1)
- type Star p q = p *** q
- type First p = Star p I
- type Second q = Star I q
- data (p :: k) ||| (q :: k1)
- type EitherIn p q = p ||| q
- type IsLeft = True ||| False
- type IsRight = False ||| True
- data (p :: k) +++ (q :: k1)
- type Dup = '(Id, Id)
- data BinOp
- type Mult p q = Bin BMult p q
- type Add p q = Bin BAdd p q
- type Sub p q = Bin BSub p q
- type (+) p q = Add p q
- type (-) p q = Sub p q
- type * p q = Mult p q
- type (>) p q = Cmp Cgt p q
- type (>=) p q = Cmp Cge p q
- type (==) p q = Cmp Ceq p q
- type (/=) p q = Cmp Cne p q
- type (<=) p q = Cmp Cle p q
- type (<) p q = Cmp Clt p q
- type (>?) p q = CmpI Cgt p q
- type (>=?) p q = CmpI Cge p q
- type (==?) p q = CmpI Ceq p q
- type (/=?) p q = CmpI Cne p q
- type (<=?) p q = CmpI Cle p q
- type (<?) p q = CmpI Clt p q
- class GetBinOp (k :: BinOp) where
- data Bin (op :: BinOp) p q
- data DivF p q
- type (/) p q = DivF p q
- data p % q
- type (%-) p q = Negate (p % q)
- type (-%) p q = Negate (p % q)
- data Negate p
- data Abs p
- data Signum p
- data Unwrap p
- data Wrap' t p
- type Wrap (t :: Type) p = Wrap' (Hole t) p
- data Coerce (t :: k)
- data Coerce2 (t :: k)
- data MEmptyT2' t
- type MEmptyT2 t = MEmptyT2' (Hole t)
- data Pure2 (t :: Type -> Type)
- type Right t = Pure (Either t) Id
- type Left t = Right t >> Swap
- data Reverse
- data ReverseL
- data Swap
- data SuccB p q
- type SuccB' q = SuccB (Failp "Succ bounded failed") q
- data PredB p q
- type PredB' q = PredB (Failp "Pred bounded failed") q
- data Succ p
- data Pred p
- data FromEnum p
- data ToEnum' t p
- type ToEnum (t :: Type) p = ToEnum' (Hole t) p
- data ToEnumB' t def
- type ToEnumB (t :: Type) def = ToEnumB' (Hole t) def
- type ToEnumBF (t :: Type) = ToEnumB' (Hole t) (Failp "ToEnum bounded failed")
- data Prime p
- data Not p
- data KeepImpl (keep :: Bool) p q
- type Remove p q = KeepImpl False p q
- type Keep p q = KeepImpl True p q
- data Elem p q
- type Head' p = HeadFail "Head(empty)" p
- type Tail' p = TailFail "Tail(empty)" p
- type Last' p = LastFail "Last(empty)" p
- type Init' p = InitFail "Init(empty)" p
- data Fmap_1
- data Fmap_2
- type HeadDef p q = GDef (Uncons >> Fmap_1) p q
- type HeadP q = GProxy (Uncons >> Fmap_1) q
- type HeadFail msg q = GFail (Uncons >> Fmap_1) msg q
- type TailDef p q = GDef (Uncons >> Fmap_2) p q
- type TailP q = GProxy (Uncons >> Fmap_2) q
- type TailFail msg q = GFail (Uncons >> Fmap_2) msg q
- type LastDef p q = GDef (Unsnoc >> Fmap_2) p q
- type LastP q = GProxy (Unsnoc >> Fmap_2) q
- type LastFail msg q = GFail (Unsnoc >> Fmap_2) msg q
- type InitDef p q = GDef (Unsnoc >> Fmap_1) p q
- type InitP q = GProxy (Unsnoc >> Fmap_1) q
- type InitFail msg q = GFail (Unsnoc >> Fmap_1) msg q
- type GDef' z p q r = '(I, r >> z) >> MaybeXP (X >> p) q (Snd Id)
- type JustDef' p q r = GDef' I p q r
- type GDef'' z p q r = '(I, r >> z) >> MaybeXP p q (Snd Id)
- type JustDef'' p q r = GDef'' I p q r
- type PA = Snd Id
- type A = Snd Id
- type X = Fst Id >> Fst Id
- type XA = I
- type XPA = I
- type GDef_X z p q r = '(I, r >> z) >> MaybeXP (X >> p) ('(X, A) >> q) A
- type JustDef''' p q r = GDef_X I p q r
- type GDef_PA z p q r = (Hide % '(I, r >> z)) >> MaybeXP (PA >> p) ('(X, A) >> q) A
- type GDef z p q = '(I, q >> z) >> MaybeXP (X >> p) A A
- type GProxy z q = '(I, q >> z) >> MaybeXP (PA >> MEmptyP) A A
- type GFail z msg q = '(I, q >> z) >> MaybeXP (Fail (PA >> Unproxy) (X >> msg)) A A
- type LookupDef' x y p q = GDef (Lookup x y) p q
- type LookupP' x y q = GProxy (Lookup x y) q
- type LookupFail' msg x y q = GFail (Lookup x y) msg q
- type LookupDef x y p = LookupDef' x y p I
- type LookupP x y = LookupP' x y I
- type LookupFail msg x y = LookupFail' msg x y I
- type Just' p = JustFail "expected Just" p
- type Left' p = LeftFail "expected Left" p
- type Right' p = RightFail "expected Right" p
- type This' p = ThisFail "expected This" p
- type That' p = ThatFail "expected That" p
- type TheseIn' p = TheseFail "expected These" p
- type JustDef p q = GDef I p q
- type JustP q = GProxy I q
- type JustFail msg q = GFail I msg q
- type LeftDef p q = GDef LeftToMaybe p q
- type LeftP q = GProxy LeftToMaybe q
- type LeftFail msg q = GFail LeftToMaybe msg q
- type RightDef p q = GDef RightToMaybe p q
- type RightP q = GProxy RightToMaybe q
- type RightFail msg q = GFail RightToMaybe msg q
- type ThisDef p q = GDef ThisToMaybe p q
- type ThisP q = GProxy ThisToMaybe q
- type ThisFail msg q = GFail ThisToMaybe msg q
- type ThatDef p q = GDef ThatToMaybe p q
- type ThatP q = GProxy ThatToMaybe q
- type ThatFail msg q = GFail ThatToMaybe msg q
- type TheseDef p q = GDef TheseToMaybe p q
- type TheseP q = GProxy TheseToMaybe q
- type TheseFail msg q = GFail TheseToMaybe msg q
- data MaybeXP p q r
- type MaybeX p q r = MaybeXP (Fst Id >> p) q r
- type family MaybeXPT lr x q where ...
- data LeftToMaybe
- data RightToMaybe
- data ThisToMaybe
- data ThatToMaybe
- data TheseToMaybe
- data EitherX p q r
- type family EitherXT lr x p where ...
- data TheseX p q r s
- type family TheseXT lr x p where ...
- data MaybeIn p q
- type IsNothing = MaybeIn True False
- type IsJust = MaybeIn False True
- data STimes n p
- data Pure (t :: Type -> Type) p
- type PMEmpty = MEmptyT' Proxy
- data MEmptyT' t
- type MEmptyT (t :: Type) = MEmptyT' (Hole t)
- type MEmptyP = MEmptyT' Unproxy
- data MEmptyProxy
- data EmptyT (t :: Type -> Type) p
- data MkNothing' t
- type MkNothing (t :: Type) = MkNothing' (Hole t)
- data MkJust p
- data MkLeft' t p
- type MkLeft (t :: Type) p = MkLeft' (Hole t) p
- data MkRight' t p
- type MkRight (t :: Type) p = MkRight' (Hole t) p
- data MkThis' t p
- type MkThis (t :: Type) p = MkThis' (Hole t) p
- data MkThat' t p
- type MkThat (t :: Type) p = MkThat' (Hole t) p
- data MkThese p q
- data MConcat p
- type FoldMap (t :: Type) p = Map (Wrap t Id) p >> Unwrap (MConcat Id)
- type Sum (t :: Type) = FoldMap (Sum t) Id
- type Min' (t :: Type) = FoldMap (Min t) Id
- data Concat p
- data ProxyT' t
- type ProxyT (t :: Type) = ProxyT' (Hole t)
- data Ix (n :: Nat) def
- type Ix' (n :: Nat) = Ix n (Failp "Ix index not found")
- data IxL p q def
- type (!!) p q = IxL p q (Failp "(!!) index not found")
- data Lookup p q
- type (!!!) p q = Lookup p q >> MaybeIn (Failp "index not found") Id
- type Lookup' (t :: Type) p q = (q &&& Lookup p q) >> If (Snd Id >> IsNothing) (ShowP (Fst Id) >> Fail (Hole t) (Printf "index(%s) not found" Id)) (Snd Id >> Just Id)
- data Ands p
- type Ands' p = FoldMap All p
- data Ors p
- type Ors' p = FoldMap Any p
- data p :+ q
- data p +: q
- data Uncons
- data Unsnoc
- data IsEmpty
- data Null
- data EnumFromTo p q
- type MapMaybe p q = ConcatMap (p >> MaybeIn MEmptyP '[Id]) q
- type CatMaybes q = MapMaybe Id q
- data PartitionEithers
- data PartitionThese
- type Thiss = PartitionThese >> Fst Id
- type Thats = PartitionThese >> Snd Id
- type Theses = PartitionThese >> Thd Id
- data Scanl p q r
- type ScanN n p q = Scanl (Fst Id >> q) p (EnumFromTo 1 n)
- type ScanNA q = ScanN (Fst Id) (Snd Id) q
- type FoldN n p q = Last' (ScanN n p q)
- type Foldl p q r = Last' (Scanl p q r)
- type family UnfoldT mbs where ...
- data Unfoldr p q
- type IterateN n f = Unfoldr (MaybeB (Fst Id > 0) '(Snd Id, Pred Id *** f)) '(n, Id)
- type IterateUntil p f = IterateWhile (Not p) f
- type IterateWhile p f = Unfoldr (MaybeB p '(Id, f)) Id
- type IterateNWhile n p f = '(n, Id) >> (IterateWhile ((Fst Id > 0) && (Snd Id >> p)) (Pred Id *** f) >> Map (Snd Id) Id)
- type IterateNUntil n p f = IterateNWhile n (Not p) f
- data Map p q
- type ConcatMap p q = Concat (Map p q)
- data If p q r
- data Pairs
- data Partition p q
- type FilterBy p q = Partition p q >> Fst Id
- data Break p q
- type Span p q = Break (Not p) q
- data Fail t prt
- type Failp s = Fail Unproxy s
- type Failt (t :: Type) prt = Fail (Hole t) prt
- type FailS s = Fail I s
- type FailPrt (t :: Type) prt = Fail (Hole t) (Printf prt)
- type FailPrt2 (t :: Type) prt = Fail (Hole t) (Printf2 prt)
- data Hole (t :: Type)
- type T (t :: Type) = Hole t
- data Unproxy
- data W (p :: k)
- data Catch p q
- type Catch' p s = Catch p (FailCatch s)
- type FailCatch s = Fail (Snd Id >> Unproxy) (Fst Id >> s)
- type Even = Mod I 2 >> Same 0
- type Odd = Mod I 2 >> Same 1
- type Div' p q = DivMod p q >> Fst Id
- type Mod' p q = DivMod p q >> Snd Id
- data Div p q
- data Mod p q
- data DivMod p q
- data QuotRem p q
- type Quot p q = QuotRem p q >> Fst Id
- type Rem p q = QuotRem p q >> Snd Id
- type OneP = Guard (Printf "expected list of length 1 but found length=%d" Len) (Len >> Same 1) >> Head
- strictmsg :: forall strict. GetBool strict => String
- data GuardsImpl (n :: Nat) (strict :: Bool) (os :: [(k, k1)])
- type Guards (os :: [(k, k1)]) = GuardsImplW True os
- type GuardsLax (os :: [(k, k1)]) = GuardsImplW False os
- type GuardsQuick (prt :: k) (os :: [k1]) = Guards (ToGuardsT prt os)
- data GuardsImplW (strict :: Bool) (ps :: [(k, k1)])
- data Guard prt p
- type Guard' p = Guard "Guard" p
- type ExitWhen prt p = Guard prt (Not p)
- type ExitWhen' p = ExitWhen "ExitWhen" p
- data GuardSimple p
- data Skip p
- type (|>) p q = Skip p >> q
- type (>|) p q = p >> Skip q
- data (p :: k) >> (q :: k1)
- type (<<) p q = q >> p
- data (p :: k) && (q :: k1)
- type And p q = p && q
- data (p :: k) || (q :: k1)
- type OR p q = p || q
- data (p :: k) ~> (q :: k1)
- type Imply p q = p ~> q
- data OrdP p q
- type (===) p q = OrdP p q
- type OrdA' p q = OrdP (Fst Id >> p) (Snd Id >> q)
- type OrdA p = OrdA' p p
- data OrdI p q
- type (===?) p q = OrdI p q
- data Cmp (o :: OrderingP) p q
- data CmpI (o :: OrderingP) p q
- type Gt n = Cmp Cgt I n
- type Ge n = Cmp Cge I n
- type Same n = Cmp Ceq I n
- type Le n = Cmp Cle I n
- type Lt n = Cmp Clt I n
- type Ne n = Cmp Cne I n
- data IToList' t p
- type IToList (t :: Type) = IToList' (Hole t) Id
- data ToList
- data ToList' p
- data ToListExt
- data FromList (t :: Type)
- data FromListF (t :: Type)
- data IsTh (th :: These x y) p
- type IsThis p = IsTh (This ()) p
- type IsThat p = IsTh (That ()) p
- type IsThese p = IsTh (These () ()) p
- data TheseIn p q r
- type Theseid p q = TheseIn '(I, p) '(q, I) I
- data EmptyList' t
- type EmptyList (t :: Type) = EmptyList' (Hole t)
- type Singleton p = p :+ EmptyT [] p
- data Char1 (s :: Symbol)
- data ZipThese p q
- data ZipTheseF p q
- type family ExtractAFromTA (ta :: Type) :: Type where ...
- data Zip (lc :: Bool) (rc :: Bool) p q
- type Ziplc p q = Zip True False p q
- type Ziprc p q = Zip False True p q
- type Zipn p q = Zip False False p q
- data Luhn p
- pe0 :: forall p a. (Show (PP p a), P p a) => a -> IO (BoolT (PP p a))
- pe :: forall p a. (Show (PP p a), P p a) => a -> IO (BoolT (PP p a))
- pe1 :: forall p a. (Show (PP p a), P p a) => a -> IO (BoolT (PP p a))
- pe2 :: forall p a. (Show (PP p a), P p a) => a -> IO (BoolT (PP p a))
- pu :: forall p a. (Show (PP p a), P p a) => a -> IO (BoolT (PP p a))
- pex :: forall p a. (Show (PP p a), P p a) => a -> IO (BoolT (PP p a))
- pe3 :: forall p a. (Show (PP p a), P p a) => a -> IO (BoolT (PP p a))
- pl :: forall p a. (Show (PP p a), P p a) => a -> IO (BoolT (PP p a))
- plc :: forall p a. (Show (PP p a), P p a) => a -> IO (BoolT (PP p a))
- peWith :: forall p a. (Show (PP p a), P p a) => POpts -> a -> IO (BoolT (PP p a))
- data ReadBase' t (n :: Nat) p
- type ReadBase (t :: Type) (n :: Nat) = ReadBase' (Hole t) n Id
- type ReadBaseInt (n :: Nat) = ReadBase' (Hole Int) n Id
- getValidBase :: Int -> String
- data ShowBase (n :: Nat)
- type Assocl = '(I *** Fst Id, Snd Id >> Snd Id)
- type Assocr = '(Fst Id >> Fst Id, Snd Id *** I)
- data Intercalate p q
- getStringPrefix :: String -> (String, String)
- data Printf s p
- type family GuardsT (ps :: [k]) where ...
- type Guards' (ps :: [k]) = Para (GuardsT ps)
- type ToPara (os :: [k]) = Proxy (ParaImplW True os)
- type ToGuards (prt :: k) (os :: [k1]) = Proxy (Guards (ToGuardsT prt os))
- type family ToGuardsT (prt :: k) (os :: [k1]) :: [(k, k1)] where ...
- data ParaImpl (n :: Nat) (strict :: Bool) (os :: [k])
- type Para (os :: [k]) = ParaImplW True os
- type ParaLax (os :: [k]) = ParaImplW False os
- data ParaImplW (strict :: Bool) (ps :: [k])
- type family GuardsViaParaT prt ps where ...
- type GuardsViaPara prt ps = Para (GuardsViaParaT prt ps)
- data CaseImpl (n :: Nat) (e :: k0) (ps :: [k]) (qs :: [k1]) (r :: k2)
- data Case (e :: k0) (ps :: [k]) (qs :: [k1]) (r :: k2)
- type Case' (ps :: [k]) (qs :: [k1]) (r :: k2) = Case (Snd Id >> Failp "Case:no match") ps qs r
- type Case'' s (ps :: [k]) (qs :: [k1]) (r :: k2) = Case (FailCase s) ps qs r
- type FailCase p = Fail (Snd Id >> Unproxy) (Fst Id >> p)
- data Sequence
- type Traverse p q = Map p q >> Sequence
- data Hide p
- type H = Hide
- data ReadFile p
- type FileExists p = ReadFile p >> IsJust
- data ReadDir p
- type DirExists p = ReadDir p >> IsJust
- data ReadEnv p
- data ReadEnvAll
- data TimeU
- data TimeZ
- data FHandle s
- class GetFHandle (x :: FHandle Symbol) where
- data WFMode
- class GetMode (x :: WFMode) where
- data WritefileImpl (hh :: FHandle Symbol) p
- type Appendfile (s :: Symbol) p = WritefileImpl (FOther s WFAppend) p
- type Writefile' (s :: Symbol) p = WritefileImpl (FOther s WFWriteForce) p
- type Writefile (s :: Symbol) p = WritefileImpl (FOther s WFWrite) p
- type Stdout p = WritefileImpl FStdout p
- type Stderr p = WritefileImpl FStderr p
- data Stdin
- type Nothing' = Guard "expected Nothing" IsNothing
- data IsFixImpl (cmp :: Ordering) (ignore :: Bool) p q
- type IsPrefix p q = IsFixImpl LT False p q
- type IsInfix p q = IsFixImpl EQ False p q
- type IsSuffix p q = IsFixImpl GT False p q
- type IsPrefixI p q = IsFixImpl LT True p q
- type IsInfixI p q = IsFixImpl EQ True p q
- type IsSuffixI p q = IsFixImpl GT True p q
- data p <> q
- type Sapa' (t :: Type) = Wrap t (Fst Id) <> Wrap t (Snd Id)
- type Sapa = Fst Id <> Snd Id
- runPQ :: (P p a, P q a, MonadEval m) => String -> Proxy p -> Proxy q -> POpts -> a -> m (Either (TT x) (PP p a, PP q a, TT (PP p a), TT (PP q a)))
- class PrintC x where
- prtC :: (PrintfArg a, PrintfType r) => String -> (a, x) -> r
- data TupleListImpl (strict :: Bool) (n :: Nat)
- type TupleList (n :: Nat) = TupleListImpl True n
- type TupleListLax (n :: Nat) = TupleListImpl False n
- data ReverseTupleN
- data Printfn s p
- type Printfnt (n :: Nat) s = Printfn s (TupleList n)
- type PrintfntLax (n :: Nat) s = Printfn s (TupleListLax n)
- type Printf2 (s :: Symbol) = Printfn s '(Fst Id, '(Snd Id, ()))
- type Printf3 (s :: Symbol) = Printfn s '(Fst Id, '(Snd Id >> Fst Id, '(Snd Id >> Snd Id, ())))
- type Printf3' (s :: Symbol) = Printfn s (TupleI '[Fst Id, Snd Id >> Fst Id, Snd Id >> Snd Id])
- type family CheckT (tp :: Type) :: Bool where ...
- type family ApplyConstT (ta :: Type) (b :: Type) :: Type where ...
- data p <$ q
- data p <* q
- type (*>) p q = q <* p
- data p <|> q
- data Extract
- data Duplicate
- data Join
- data p $ q
- type (&) p q = q $ p
- type family FnT ab :: Type where ...
- evalQuick :: forall p i. P p i => i -> Either String (PP p i)
- data Trim' (left :: Bool) (right :: Bool) p
- type Trim p = Trim' True True p
- type TrimStart p = Trim' True False p
- type TrimEnd p = Trim' False True p
- data StripLR (right :: Bool) p q
- type StripRight p q = StripLR True p q
- type StripLeft p q = StripLR False p q
- data ParaImplN (strict :: Bool) (n :: Nat) p
- type ParaN (n :: Nat) p = ParaImplN True n p
- type ParaLaxN (n :: Nat) p = ParaImplN False n p
- data GuardsImplN (strict :: Bool) prt (n :: Nat) p
- type GuardsN prt (n :: Nat) p = GuardsImplN True prt n p
- type GuardsLaxN prt (n :: Nat) p = GuardsImplN False prt n p
- data Repeat (n :: Nat) p
- data DoN (n :: Nat) p
Documentation
This is the core class. Each instance of this class can be combined into a dsl using >>
Instances
GetBool b => P (b :: Bool) a Source # | pulls the type level
|
GetOrdering cmp => P (cmp :: Ordering) a Source # | extracts the value level representation of the promoted
|
KnownNat n => P (n :: Nat) a Source # | extracts the value level representation of the type level
|
KnownSymbol s => P (s :: Symbol) a Source # | pulls the type level
|
P () a Source # | extracts the value level representation of the type level '()
|
Show a => P () a Source # |
|
(ReverseTupleC tp, Show (ReverseTupleP tp), Show tp) => P ReverseTupleN tp Source # | |
P Stdin a Source # | |
P TimeZ a Source # | |
P TimeU a Source # | |
P ReadEnvAll a Source # | |
(Show l, IsList l, Show (Item l)) => P ToListExt l Source # | |
(Show (t a), Foldable t, t a ~ as) => P Null as Source # | |
(Show as, AsEmpty as) => P IsEmpty as Source # | |
(Show (ConsT s), Show s, Snoc s s (ConsT s) (ConsT s)) => P Unsnoc s Source # | |
(Show (ConsT s), Show s, Cons s s (ConsT s) (ConsT s)) => P Uncons s Source # | |
(Show t, Reversing t) => P ReverseL t Source # | |
(Show a, as ~ [a]) => P Reverse as Source # | |
Show a => P MkProxy a Source # | |
(Typeable a, Show a) => P IdT a Source # | |
Show a => P Id a Source # | |
P I a Source # | |
(Show a, as ~ [a]) => P Len as Source # | |
(Show a, IsText a) => P ToUpper a Source # | |
(Show a, IsText a) => P ToLower a Source # | |
(Show (t (t a)), Show (t a), Monad t) => P Join (t (t a)) Source # | |
(Show (t a), Show (t (t a)), Comonad t) => P Duplicate (t a) Source # | |
(Show (t a), Show a, Comonad t) => P Extract (t a) Source # | |
(Show (f (t a)), Show (t (f a)), Traversable t, Applicative f) => P Sequence (t (f a)) Source # | |
(Show (t a), Foldable t, Show a) => P ToList (t a) Source # | |
Show a => P Pairs [a] Source # | |
(Show a, Show b) => P PartitionThese [These a b] Source # | |
(Show a, Show b) => P PartitionEithers [Either a b] Source # | |
Functor f => P Fmap_2 (f (x, a)) Source # | |
Functor f => P Fmap_1 (f (a, x)) Source # | |
(Ord a, Show a) => P Max [a] Source # | |
(Ord a, Show a) => P Min [a] Source # | |
Show a => P Tails [a] Source # | |
Show a => P Inits [a] Source # | |
Typeable a => P Unproxy (Proxy a) Source # | |
Monoid a => P MEmptyProxy (Proxy a) Source # | |
P TheseToMaybe (These a b) Source # | |
P ThatToMaybe (These x a) Source # | |
P ThisToMaybe (These a x) Source # | |
P RightToMaybe (Either x a) Source # | |
P LeftToMaybe (Either a x) Source # | |
(Show (p a b), Swapped p, Show (p b a)) => P Swap (p a b) Source # | |
P ([] :: [k]) a Source # | extracts the value level representation of the type level '[]
|
(Show a, 2 <= n, n <= 36, KnownNat n, Integral a) => P (ShowBase n :: Type) a Source # | |
(KnownSymbol s, NullT s ~ False) => P (Char1 s :: Type) a Source # | |
(Show l, IsList l, l ~ l') => P (FromListF l' :: Type) l Source # | |
Typeable t => P (Hole t :: Type) a Source # | Acts as a proxy in this dsl where you can explicitly set the Type. It is passed around as an argument to help the type checker when needed.
see |
(GetCharSet cs, Show a, IsText a) => P (IsCharSet cs :: Type) a Source # | |
P (Nothing :: Maybe a1) (Maybe a2) Source # | expects Nothing otherwise it fails if the value is Nothing then it returns 'Proxy a' as this provides more information than '()'
|
(a ~ Item t, Show t, IsList t) => P (FromList t :: Type) [a] Source # | |
(Show (f (t a)), Show (f a), Applicative t, Functor f) => P (Pure2 t :: Type) (f a) Source # | |
P (Proxy t :: Type) a Source # | |
(PP p x ~ String, P p x) => P (ReadEnv p :: Type) x Source # | |
(PP p x ~ String, P p x) => P (ReadDir p :: Type) x Source # | |
(PP p x ~ String, P p x) => P (ReadFile p :: Type) x Source # | |
P p x => P (Hide p :: Type) x Source # | |
(PP p x ~ [Int], P p x) => P (Luhn p :: Type) x Source # | |
P (EmptyList' t :: Type) x Source # | |
(PP p x ~ t a, P p x, Show (t a), Foldable t, Show a) => P (ToList' p :: Type) x Source # | |
(Show (PP p a), P p a) => P (Skip p :: Type) a Source # | |
(Show a, P p a, PP p a ~ Bool) => P (GuardSimple p :: Type) a Source # | |
P p a => P (W p :: Type) a Source # | |
(PP p x ~ t a, P p x, Show (t a), Foldable t, a ~ Bool) => P (Ors p :: Type) x Source # | |
(PP p x ~ t a, P p x, Show (t a), Foldable t, a ~ Bool) => P (Ands p :: Type) x Source # | |
Typeable t => P (ProxyT' t :: Type) a Source # | |
(Show a, Show (t [a]), PP p x ~ t [a], P p x, Foldable t) => P (Concat p :: Type) x Source # | |
(PP p x ~ [a], P p x, Show a, Monoid a) => P (MConcat p :: Type) x Source # | |
(PP p x ~ a, P p x, Show a) => P (MkJust p :: Type) x Source # | |
P (MkNothing' t :: Type) a Source # | |
(Show (PP t a), Monoid (PP t a)) => P (MEmptyT' t :: Type) a Source # | |
(PP p x ~ Bool, P p x) => P (Not p :: Type) x Source # | |
(PP p x ~ a, P p x, Show a, Integral a) => P (Prime p :: Type) x Source # | |
(Show a, Enum a, PP p x ~ a, P p x) => P (FromEnum p :: Type) x Source # | |
(Show a, Enum a, PP p x ~ a, P p x) => P (Pred p :: Type) x Source # | |
(Show a, Enum a, PP p x ~ a, P p x) => P (Succ p :: Type) x Source # | |
(Show a, Show t, Coercible t a) => P (Coerce t :: Type) a Source # | |
(PP p x ~ s, P p x, Show s, Show (Unwrapped s), Wrapped s) => P (Unwrap p :: Type) x Source # | |
(Show (PP p x), Num (PP p x), P p x) => P (Signum p :: Type) x Source # | |
(Show (PP p x), Num (PP p x), P p x) => P (Abs p :: Type) x Source # | |
(Show (PP p x), Num (PP p x), P p x) => P (Negate p :: Type) x Source # | |
P (TupleI ([] :: [k]) :: Type) a Source # | |
(P p a, P (TupleI ps) a, Show a) => P (TupleI (p ': ps) :: Type) a Source # | |
P (DoExpandT ps) a => P (Do ps :: Type) a Source # | |
(a ~ PP p x, Show a, Real a, P p x) => P (ToRational p :: Type) x Source # | |
(Show (ExtractL6T (PP p x)), ExtractL6C (PP p x), P p x, Show (PP p x)) => P (L6 p :: Type) x Source # | |
(Show (ExtractL5T (PP p x)), ExtractL5C (PP p x), P p x, Show (PP p x)) => P (L5 p :: Type) x Source # | |
(Show (ExtractL4T (PP p x)), ExtractL4C (PP p x), P p x, Show (PP p x)) => P (L4 p :: Type) x Source # | |
(Show (ExtractL3T (PP p x)), ExtractL3C (PP p x), P p x, Show (PP p x)) => P (L3 p :: Type) x Source # | |
(Show (ExtractL2T (PP p x)), ExtractL2C (PP p x), P p x, Show (PP p x)) => P (L2 p :: Type) x Source # | |
(Show (ExtractL1T (PP p x)), ExtractL1C (PP p x), P p x, Show (PP p x)) => P (L1 p :: Type) x Source # | |
(PP p x ~ t a, P p x, Show (t a), Foldable t) => P (Length p :: Type) x Source # | |
(PP p x ~ Day, P p x) => P (UnMkDay p :: Type) x Source # | |
(Show (PP p x), P p x) => P (ShowP p :: Type) x Source # | |
(PP p x ~ [a], P p x, Show a) => P (Ones p :: Type) x Source # | |
(PP p x ~ ([String] -> String), P p x) => P (MakeRR3 p :: Type) x Source # | |
(PP p x ~ (String -> String), P p x) => P (MakeRR2 p :: Type) x Source # | |
(PP p x ~ (String -> [String] -> String), P p x) => P (MakeRR1 p :: Type) x Source # | |
(PP p x ~ String, P p x) => P (MakeRR p :: Type) x Source # | |
(Show (PP p a2), P p a2, Show a2) => P (Just p :: Maybe a1) (Maybe a2) Source # | extracts the 'a' from type level 'Maybe a' if the value exists
|
(Show a, KnownNat n, GetBool strict, TupleListD (ToN n) a, Show (TupleListT (ToN n) a)) => P (TupleListImpl strict n :: Type) [a] Source # | |
(Show (f a), Show (f (PP t (f a))), Functor f, Monoid (PP t (f a))) => P (MEmptyT2' t :: Type) (f a) Source # | |
(Show (f a), Show (f t), Coercible t a, Functor f) => P (Coerce2 t :: Type) (f a) Source # | |
(Show (PP p a2), Show a2, P (p1 ': ps) a2, PP (p1 ': ps) a2 ~ [PP p1 a2], P p a2, PP p a2 ~ PP p1 a2) => P (p ': (p1 ': ps) :: [a1]) a2 Source # | |
(Show (PP p a), Show a, P p a) => P (p ': ([] :: [k]) :: [k]) a Source # | runs each predicate in turn from the promoted list
|
P (DoExpandT (RepeatT n p)) a => P (DoN n p :: Type) a Source # | |
P (RepeatT n p) a => P (Repeat n p :: Type) a Source # | |
(GetFHandle fh, P p a, PP p a ~ String) => P (WritefileImpl fh p :: Type) a Source # | |
(P p x, PP p x ~ a, Show (t a), Show a, Alternative t) => P (EmptyT t p :: Type) x Source # | |
(P p x, Show (PP p x), Show (t (PP p x)), Applicative t) => P (Pure t p :: Type) x Source # | |
(GetBool strict, GetLen ps, P (ParaImpl (LenT ps) strict ps) [a]) => P (ParaImplW strict ps :: Type) [a] Source # | |
(P def (Proxy a), PP def (Proxy a) ~ a, KnownNat n, Show a) => P (Ix n def :: Type) [a] Source # | |
(FailIfT (NotT (OrT l r)) (Text "Trim': left and right cannot both be False"), GetBool l, GetBool r, IsText (PP p x), P p x) => P (Trim' l r p :: Type) x Source # | |
(P p x, P q x, PP p x ~ (a -> b), FnT (PP p x) ~ b, PP q x ~ a, Show a, Show b) => P (p $ q :: Type) x Source # | |
(P p x, P q x, Show (t b), Alternative t, t b ~ PP p x, PP q x ~ t b) => P (p <|> q :: Type) x Source # | |
(Show (t c), P p x, P q x, Show (t b), Applicative t, t b ~ PP p x, PP q x ~ t c) => P (p <* q :: Type) x Source # | |
(P p x, P q x, Show (PP p x), Functor t, PP q x ~ t c, ApplyConstT (PP q x) (PP p x) ~ t (PP p x)) => P (p <$ q :: Type) x Source # | |
(KnownNat (TupleLenT as), PrintC bs, (b, bs) ~ ReverseTupleP (a, as), ReverseTupleC (a, as), Show a, Show as, PrintfArg b, PP s x ~ String, PP p x ~ (a, as), P s x, P p x, CheckT (PP p x) ~ True) => P (Printfn s p :: Type) x Source # | |
(Semigroup (PP p x), PP p x ~ PP q x, P p x, Show (PP q x), P q x) => P (p <> q :: Type) x Source # | |
(PrintfArg (PP p x), Show (PP p x), PP s x ~ String, P s x, P p x) => P (Printf s p :: Type) x Source # | |
(PP p x ~ [a], PP q x ~ PP p x, P p x, P q x, Show a) => P (Intercalate p q :: Type) x Source # | |
(Show (f y), PP p a ~ f x, PP q a ~ f y, ExtractAFromTA (f x) ~ x, ExtractAFromTA (f y) ~ y, Show (f x), Align f, Show (f (These x y)), P p a, P q a) => P (ZipTheseF p q :: Type) a Source # | |
(PP p a ~ [x], PP q a ~ [y], P p a, P q a, Show x, Show y) => P (ZipThese p q :: Type) a Source # | |
(Show x, P p x, Typeable (PP t (PP p x)), Show (PP t (PP p x)), FoldableWithIndex (PP t (PP p x)) f, PP p x ~ f a, Show a) => P (IToList' t p :: Type) x Source # | |
(PP p a ~ String, PP p a ~ PP q a, P p a, P q a) => P (OrdI p q :: Type) a Source # | |
(Ord (PP p a), PP p a ~ PP q a, P p a, Show (PP q a), P q a) => P (OrdP p q :: Type) a Source # | |
(P p a, P q a, PP p a ~ Bool, PP q a ~ Bool) => P (p ~> q :: Type) a Source # | |
(P p a, P q a, PP p a ~ Bool, PP q a ~ Bool) => P (p || q :: Type) a Source # | |
(P p a, P q a, PP p a ~ Bool, PP q a ~ Bool) => P (p && q :: Type) a Source # | |
(Show (PP p a), Show (PP q (PP p a)), P p a, P q (PP p a)) => P (p >> q :: Type) a Source # | |
(Show a, P prt a, PP prt a ~ String, P p a, PP p a ~ Bool) => P (Guard prt p :: Type) a Source # | |
(PP p a ~ PP q a, P p a, P q a, Show (PP p a), Integral (PP p a)) => P (QuotRem p q :: Type) a Source # | |
(PP p a ~ PP q a, P p a, P q a, Show (PP p a), Integral (PP p a)) => P (DivMod p q :: Type) a Source # | |
(PP p a ~ PP q a, P p a, P q a, Show (PP p a), Integral (PP p a)) => P (Mod p q :: Type) a Source # | |
(PP p a ~ PP q a, P p a, P q a, Show (PP p a), Integral (PP p a)) => P (Div p q :: Type) a Source # | |
(P p x, P q ((String, x), Proxy (PP p x)), PP p x ~ PP q ((String, x), Proxy (PP p x))) => P (Catch p q :: Type) x Source # | |
(P prt a, PP prt a ~ String) => P (Fail t prt :: Type) a Source # | |
(P p x, PP q a ~ [x], PP p x ~ Bool, P q a) => P (Break p q :: Type) a Source # | |
(P p x, Show x, PP q a ~ [x], PP p x ~ Bool, P q a) => P (Partition p q :: Type) a Source # | |
(Show (PP p a), P p a, PP q x ~ f a, P q x, Show a, Show (f a), Foldable f) => P (Map p q :: Type) x Source # | |
(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 Source # | |
(P p x, P q x, PP p x ~ a, Show a, PP q x ~ a, Enum a) => P (EnumFromTo p q :: Type) x Source # | |
(P p x, P q x, Show (PP q x), Show (PP p x), Snoc (PP p x) (PP p x) (PP q x) (PP q x)) => P (p +: q :: Type) x Source # | |
(P p x, P q x, Show (PP p x), Show (PP q x), Cons (PP q x) (PP q x) (PP p x) (PP p x)) => P (p :+ q :: Type) x Source # | |
(P q a, P p a, Show (PP p a), Ixed (PP p a), PP q a ~ Index (PP p a), Show (Index (PP p a)), Show (IxValue (PP p a))) => P (Lookup p q :: Type) a Source # | |
(P p a, P q a, Show (PP p a), Show (PP q a)) => P (MkThese p q :: Type) a Source # | |
(Show (PP p x), P p x) => P (MkThat' t p :: Type) x Source # | |
(Show (PP p x), P p x) => P (MkThis' t p :: Type) x Source # | |
(Show (PP p x), P p x) => P (MkRight' t p :: Type) x Source # | |
(Show (PP p x), P p x) => P (MkLeft' t p :: Type) x Source # | |
(P n a, Integral (PP n a), Semigroup (PP p a), P p a, Show (PP p a)) => P (STimes n p :: Type) a Source # | |
([PP p a] ~ PP q a, P p a, P q a, Show (PP p a), Eq (PP p a)) => P (Elem p q :: Type) a Source # | |
(P def (Proxy (PP t a)), PP def (Proxy (PP t a)) ~ PP t a, Show a, Show (PP t a), Bounded (PP t a), Enum (PP t a), Integral a) => P (ToEnumB' t def :: Type) a Source # | |
(PP p x ~ a, P p x, Show a, Enum (PP t x), Show (PP t x), Integral a) => P (ToEnum' t p :: Type) x Source # | |
(PP q x ~ a, P q x, P p (Proxy a), PP p (Proxy a) ~ a, Show a, Eq a, Bounded a, Enum a) => P (PredB p q :: Type) x Source # | |
(PP q x ~ a, P q x, P p (Proxy a), PP p (Proxy a) ~ a, Show a, Eq a, Bounded a, Enum a) => P (SuccB p q :: Type) x Source # | |
(Show (PP p x), P p x, Unwrapped (PP s x) ~ PP p x, Wrapped (PP s x), Show (PP s x)) => P (Wrap' s p :: Type) x Source # | |
(Integral (PP p x), Integral (PP q x), Eq (PP q x), P p x, P q x, Show (PP p x), Show (PP q x)) => P (p % q :: Type) x Source # | |
(PP p a ~ PP q a, Eq (PP q a), P p a, P q a, Show (PP p a), Fractional (PP p a)) => P (DivF p q :: Type) a Source # | |
(PP p a ~ [b], P n a, P p a, Show b, Integral (PP n a)) => P (SplitAt n p :: Type) a Source # | |
(P ns x, P p x, PP p x ~ [a], Show n, Show a, PP ns x ~ [n], Integral n) => P (SplitAts ns p :: Type) x Source # | |
(P prt a, PP prt a ~ String, P p a) => P (Msg prt p :: Type) a Source # | |
(Show (PP p a), P b a, P p a, PP b a ~ Bool) => P (MaybeB b p :: Type) a Source # | |
(Show (PP p x), P p x, Show (PP t x), RealFrac (PP p x), Integral (PP t x)) => P (Floor' t p :: Type) x Source # | |
(Show (PP p x), P p x, Show (PP t x), RealFrac (PP p x), Integral (PP t x)) => P (Ceiling' t p :: Type) x Source # | |
(Show (PP p x), P p x, Show (PP t x), RealFrac (PP p x), Integral (PP t x)) => P (Truncate' t p :: Type) x Source # | |
(P r a, PP r a ~ Rational, Show (PP t a), Fractional (PP t a)) => P (FromRational' t r :: Type) a Source # | |
(Num (PP t a), Integral (PP n a), P n a, Show (PP t a), Show (PP n a)) => P (FromIntegral' t n :: Type) a Source # | |
(Num (PP t a), Integral (PP n a), P n a, Show (PP t a)) => P (FromInteger' t n :: Type) a Source # | |
(P s a, PP s a ~ String, Show (PP t a), IsString (PP t a)) => P (FromStringP' t s :: Type) a Source # | |
(P p (a, a), P q x, Show a, PP q x ~ [a], PP p (a, a) ~ Ordering) => P (SortBy p q :: Type) x Source # | |
(P p x, PP p x ~ String, Typeable (PP t x), Show (PP t x), Read (PP t x)) => P (ReadP'' t p :: Type) x Source # | |
(PP p x ~ String, FormatTime (PP q x), P p x, Show (PP q x), P q x) => P (FormatTimeP p q :: Type) x Source # | |
(P (ParaImpl (LenT (RepeatT n p)) strict (RepeatT n p)) [a], GetLen (RepeatT n p), GetBool strict) => P (ParaImplN strict n p :: Type) [a] Source # | |
(TypeError (Text "ParaImpl '[] invalid: requires at least one value in the list") :: Constraint) => P (ParaImpl n strict ([] :: [k]) :: Type) [a] Source # | |
(KnownNat n, GetBool strict, GetLen ps, P p a, P (ParaImpl n strict (p1 ': ps)) [a], PP (ParaImpl n strict (p1 ': ps)) [a] ~ [PP p a], Show a, Show (PP p a)) => P (ParaImpl n strict (p ': (p1 ': ps)) :: Type) [a] Source # | |
(Show (PP p a), KnownNat n, GetBool strict, Show a, P p a) => P (ParaImpl n strict (p ': ([] :: [k])) :: Type) [a] Source # | |
(GetBool strict, GetLen ps, P (GuardsImpl (LenT ps) strict ps) [a]) => P (GuardsImplW strict ps :: Type) [a] Source # | |
(P q a, Show a, Show (PP q a), PP p (Proxy (PP q a)) ~ PP q a, P p (Proxy (PP q a))) => P (MaybeIn p q :: Type) (Maybe a) Source # | |
(Show (PP p a), Show (PP q b), P p a, P q b, Show a, Show b) => P (p +++ q :: Type) (Either a b) Source # | |
(Show (PP p a), P p a, P q b, PP p a ~ PP q b, Show a, Show b) => P (p ||| q :: Type) (Either a b) Source # | |
(Show (PP p a), Show (PP q b), P p a, P q b, Show a, Show b) => P (p *** q :: Type) (a, b) Source # | |
(GetBool r, PP p x ~ String, P p x, IsText (PP q x), P q x) => P (StripLR r p q :: Type) x Source # | |
(Typeable (PP t x), BetweenT 2 36 n, Show (PP t x), Num (PP t x), KnownNat n, PP p x ~ String, P p x) => P (ReadBase' t n p :: Type) x Source # | |
(PP p x ~ These a b, P p x, Show a, Show b, GetThese th) => P (IsTh th p :: Type) x Source # | |
(PP p a ~ String, GetOrd o, PP p a ~ PP q a, P p a, P q a) => P (CmpI o p q :: Type) a Source # | |
(GetOrd o, Ord (PP p a), Show (PP p a), PP p a ~ PP q a, P p a, P q a) => P (Cmp o p q :: Type) a Source # | |
(GetBool keep, Eq a, Show a, P p x, P q x, PP p x ~ PP q x, PP q x ~ [a]) => P (KeepImpl keep p q :: Type) x Source # | |
(GetBinOp op, PP p a ~ PP q a, P p a, P q a, Show (PP p a), Num (PP p a)) => P (Bin op p q :: Type) a Source # | |
(GetROpts rs, PP p x ~ String, PP q x ~ String, P p x, P q x) => P (Resplit' rs p q :: Type) x Source # | |
(GetROpts rs, PP p x ~ String, PP q x ~ String, P p x, P q x) => P (RescanRanges' rs p q :: Type) x Source # | |
(GetROpts rs, PP p x ~ String, PP q x ~ String, P p x, P q x) => P (Rescan' rs p q :: Type) x Source # | |
(GetROpts rs, PP p x ~ String, PP q x ~ String, P p x, P q x) => P (Re' rs p q :: Type) x Source # | |
(KnownNat n, GetBool strict, Show a) => P (GuardsImpl n strict ([] :: [(k, k1)]) :: Type) [a] Source # | |
(PP prt (Int, a) ~ String, P prt (Int, a), KnownNat n, GetBool strict, GetLen ps, P p a, PP p a ~ Bool, P (GuardsImpl n strict ps) [a], PP (GuardsImpl n strict ps) [a] ~ [a], Show a) => P (GuardsImpl n strict ((,) prt p ': ps) :: Type) [a] Source # | |
(GetBool ignore, P p x, P q x, PP p x ~ String, PP q x ~ String, GetOrdering cmp) => P (IsFixImpl cmp ignore p q :: Type) x Source # | |
(GetBool lc, GetBool rc, PP p a ~ [x], PP q a ~ [y], P p a, P q a, Show x, Show y) => P (Zip lc rc p q :: Type) a Source # | |
(Show (PP r a), P p a, PP p a ~ Bool, P q a, P r a, PP q a ~ PP r a) => P (If p q r :: Type) a Source # | |
(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 Source # | |
(P q a, P p a, Show (PP p a), Ixed (PP p a), PP q a ~ Index (PP p a), Show (Index (PP p a)), Show (IxValue (PP p a)), P r (Proxy (IxValue (PP p a))), PP r (Proxy (IxValue (PP p a))) ~ IxValue (PP p a)) => P (IxL p q r :: Type) a Source # | |
(P r x, P p (x, a), P q (x, b), PP r x ~ Either a b, PP p (x, a) ~ c, PP q (x, b) ~ c) => P (EitherX p q r :: Type) x Source # | |
(P r x, P p (x, Proxy a), P q (x, a), PP r x ~ Maybe a, PP p (x, Proxy a) ~ b, PP q (x, a) ~ b) => P (MaybeXP p q r :: Type) x Source # | |
(Show (PP p a), P p a, Show (PP q a), P q a, P b a, PP b a ~ Bool) => P (EitherB b p q :: Type) a Source # | |
(P p x, P q x, P r x, PP p x ~ Int, PP q x ~ Int, PP r x ~ Int) => P (MkDay' p q r :: Type) x Source # | |
(ParseTime (PP t a), Typeable (PP t a), Show (PP t a), P p a, P q a, PP p a ~ [String], PP q a ~ String) => P (ParseTimes' t p q :: Type) a Source # | |
(ParseTime (PP t a), Typeable (PP t a), Show (PP t a), P p a, P q a, PP p a ~ String, PP q a ~ String) => P (ParseTimeP' t p q :: Type) a Source # | |
(GetBool strict, GetLen (ToGuardsT prt (RepeatT n p)), P (GuardsImpl (LenT (ToGuardsT prt (RepeatT n p))) strict (ToGuardsT prt (RepeatT n p))) [a]) => P (GuardsImplN strict prt n p :: Type) [a] Source # | |
(Show a, Show b, Show (PP p a), P p a, P q b, P r (a, b), PP p a ~ PP q b, PP p a ~ PP r (a, b), PP q b ~ PP r (a, b)) => P (TheseIn p q r :: Type) (These a b) Source # | |
(P n a, GetBool left, Integral (PP n a), [PP p a] ~ PP q a, P p a, P q a, Show (PP p a)) => P (Pad left n p q :: Type) a Source # | |
(FailIfT (NotT (LenT ps == LenT qs)) (((Text "lengths are not the same " :<>: ShowType (LenT ps)) :<>: Text " vs ") :<>: ShowType (LenT qs)), P (CaseImpl (LenT ps) e ps qs r) x) => P (Case e ps qs r :: Type) x Source # | |
(P s x, P p (x, a), P q (x, b), P r (x, (a, b)), PP s x ~ These a b, PP p (x, a) ~ c, PP q (x, b) ~ c, PP r (x, (a, b)) ~ c) => P (TheseX p q r s :: Type) x Source # | |
(GetBool b, GetROpts rs, PP p x ~ String, PP q x ~ RR, PP r x ~ String, P p x, P q x, P r x) => P (ReplaceImpl b rs p q r :: Type) x Source # | |
(KnownNat n, GetLen ps, P r x, P p (PP r x), P q (PP r x), PP p (PP r x) ~ Bool, Show (PP q (PP r x)), Show (PP r x), P (CaseImpl n e (p1 ': ps) (q1 ': qs) r) x, PP (CaseImpl n e (p1 ': ps) (q1 ': qs) r) x ~ PP q (PP r x)) => P (CaseImpl n e (p ': (p1 ': ps)) (q ': (q1 ': qs)) r :: Type) x Source # | |
(P r x, P q (PP r x), Show (PP q (PP r x)), P p (PP r x), PP p (PP r x) ~ Bool, KnownNat n, Show (PP r x), P e (PP r x, Proxy (PP q (PP r x))), PP e (PP r x, Proxy (PP q (PP r x))) ~ PP q (PP r x)) => P (CaseImpl n e (p ': ([] :: [k])) (q ': ([] :: [k1])) r :: Type) x Source # | |
(TypeError (Text "CaseImpl '[] invalid: lists are both empty") :: Constraint) => P (CaseImpl n e ([] :: [k]) ([] :: [k1]) r :: Type) x Source # | |
(TypeError (Text "CaseImpl '[] invalid: rhs requires at least one value in the list") :: Constraint) => P (CaseImpl n e (p ': ps) ([] :: [k1]) r :: Type) x Source # | |
(TypeError (Text "CaseImpl '[] invalid: lhs requires at least one value in the list") :: Constraint) => P (CaseImpl n e ([] :: [k]) (q ': qs) r :: Type) x Source # | |
Show a => P (Proxy :: Proxy t) a Source # | converts the value to the corresponding
|
(Show a2, Show (PP p a2), P p a2) => P (Right p :: Either a1 b) (Either x a2) Source # | extracts the 'b' from type level 'Either a b' if the value exists
|
(Show a2, Show (PP p a2), P p a2) => P (Left p :: Either a1 b) (Either a2 x) Source # | extracts the 'a' from type level 'Either a b' if the value exists
|
(Show a2, Show (PP p a2), P p a2) => P (That p :: These a1 b) (These x a2) Source # | extracts the 'b' from type level 'These a b' if the value exists
|
(Show a2, Show (PP p a2), P p a2) => P (This p :: These a1 b) (These a2 x) Source # | extracts the 'a' from type level 'These a b' if the value exists
|
(P p a, P q a) => P ((,) p q :: (k2, k1)) a Source # | run the predicates in a promoted 2-tuple; similar to
|
(Show a2, Show b2, P p a2, P q b2, Show (PP p a2), Show (PP q b2)) => P (These p q :: These a1 b1) (These a2 b2) Source # | extracts the (a,b) from type level 'These a b' if the value exists
|
(P p a, P q a, P r a) => P ((,,) p q r :: (k3, k2, k1)) a Source # | run the predicates in a promoted 3-tuple
|
(P p a, P q a, P r a, P s a) => P ((,,,) p q r s :: (k4, k3, k2, k1)) a Source # | run the predicates in a promoted 4-tuple
|
evalBool :: (MonadEval m, P p a, PP p a ~ Bool) => Proxy p -> POpts -> a -> m (TT (PP p a)) Source #
A specialised form of eval
that works only on predicates
type Asc = Ands (Map (Fst Id <= Snd Id) Pairs) Source #
a type level predicate for a monotonic increasing list
type Asc' = Ands (Map (Fst Id < Snd Id) Pairs) Source #
a type level predicate for a strictly increasing list
type Desc = Ands (Map (Fst Id >= Snd Id) Pairs) Source #
a type level predicate for a monotonic decreasing list
type Desc' = Ands (Map (Fst Id > Snd Id) Pairs) Source #
a type level predicate for a strictly decreasing list
type Between p q = Ge p && Le q Source #
A predicate that determines if the value is between 'p' and 'q'
type AllPositive = Ands (Map Positive Id) Source #
a type level predicate for all positive elements in a list
type AllNegative = Ands (Map Negative Id) Source #
a type level predicate for all negative elements in a list
data Re' (rs :: [ROpt]) p q Source #
represents a predicate using a Symbol
as a regular expression
evaluates Re
and returns True if there is a match
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Re "^\\d{2}:\\d{2}:\\d{2}$" Id) "13:05:25"
True TrueT
data Rescan' (rs :: [ROpt]) p q Source #
runs a regex matcher returning the original values and optionally any groups
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Rescan "^(\\d{2}):(\\d{2}):(\\d{2})$" Id) "13:05:25"
Present [("13:05:25",["13","05","25"])] PresentT [("13:05:25",["13","05","25"])]
>>>
pl @(Rescan (Snd Id) "13:05:25") ('a',"^(\\d{2}):(\\d{2}):(\\d{2})$")
Present [("13:05:25",["13","05","25"])] PresentT [("13:05:25",["13","05","25"])]
data RescanRanges' (rs :: [ROpt]) p q Source #
similar to Rescan
but gives the column start and ending positions instead of values
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(RescanRanges "^(\\d{2}):(\\d{2}):(\\d{2})$" Id) "13:05:25"
Present [((0,8),[(0,2),(3,5),(6,8)])] PresentT [((0,8),[(0,2),(3,5),(6,8)])]
type RescanRanges p q = RescanRanges' '[] p q Source #
data Resplit' (rs :: [ROpt]) p q Source #
splits a string on a regex delimiter
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Resplit "\\." Id) "141.201.1.22"
Present ["141","201","1","22"] PresentT ["141","201","1","22"]
>>>
pl @(Resplit (Singleton (Fst Id)) (Snd Id)) (':', "12:13:1")
Present ["12","13","1"] PresentT ["12","13","1"]
data ReplaceImpl (alle :: Bool) (rs :: [ROpt]) p q r Source #
replaces regex 's' with a string 's1' inside the value
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ReplaceAllString "\\." ":" Id) "141.201.1.22"
Present "141:201:1:22" PresentT "141:201:1:22"
type ReplaceAll' (rs :: [ROpt]) p q r = ReplaceImpl True rs p q r Source #
type ReplaceAll p q r = ReplaceAll' '[] p q r Source #
type ReplaceOne' (rs :: [ROpt]) p q r = ReplaceImpl False rs p q r Source #
type ReplaceOne p q r = ReplaceOne' '[] p q r Source #
type ReplaceAllString' (rs :: [ROpt]) p q r = ReplaceAll' rs p (MakeRR q) r Source #
type ReplaceAllString p q r = ReplaceAllString' '[] p q r Source #
type ReplaceOneString' (rs :: [ROpt]) p q r = ReplaceOne' rs p (MakeRR q) r Source #
type ReplaceOneString p q r = ReplaceOneString' '[] p q r Source #
Simple replacement string: see ReplaceAllString
and ReplaceOneString
A replacement function (String -> [String] -> String) which returns the whole match and the groups
Used by sub
and sub
Requires Text.Show.Functions
A replacement function (String -> String) that yields the whole match
Used by sub
and sub
Requires Text.Show.Functions
>>>
:m + Text.Show.Functions
>>>
pl @(ReplaceAll "\\." (MakeRR2 (Fst Id)) (Snd Id)) (\x -> x <> ":" <> x, "141.201.1.22")
Present "141.:.201.:.1.:.22" PresentT "141.:.201.:.1.:.22"
A replacement function ([String] -> String) which yields the groups
Used by sub
and sub
Requires Text.Show.Functions
>>>
:m + Text.Show.Functions
>>>
pl @(ReplaceAll "^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$" (MakeRR3 (Fst Id)) (Snd Id)) (\ys -> intercalate " | " $ map (show . succ . read @Int) ys, "141.201.1.22")
Present "142 | 202 | 2 | 23" PresentT "142 | 202 | 2 | 23"
data IsCharSet (cs :: CharSet) Source #
a predicate for determining if a string IsText
belongs to the given character set
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
import qualified Data.Text as T
>>>
pl @IsLower "abc"
True TrueT
>>>
pl @IsLower "abcX"
False FalseT
>>>
pl @IsLower (T.pack "abcX")
False FalseT
>>>
pl @IsHexDigit "01efA"
True TrueT
>>>
pl @IsHexDigit "01egfA"
False FalseT
class GetCharSet (cs :: CharSet) where Source #
type IsPunctuation = IsCharSet CPunctuation Source #
type IsHexDigit = IsCharSet CHexDigit Source #
type IsOctDigit = IsCharSet COctDigit Source #
type IsSeparator = IsCharSet CSeparator Source #
converts a string IsText
value to lower case
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @ToLower "HeLlO wOrld!"
Present "hello world!" PresentT "hello world!"
converts a string IsText
value to upper case
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @ToUpper "HeLlO wOrld!"
Present "HELLO WORLD!" PresentT "HELLO WORLD!"
similar to inits
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Inits [4,8,3,9]
Present [[],[4],[4,8],[4,8,3],[4,8,3,9]] PresentT [[],[4],[4,8],[4,8,3],[4,8,3,9]]
>>>
pl @Inits []
Present [[]] PresentT [[]]
similar to tails
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Tails [4,8,3,9]
Present [[4,8,3,9],[8,3,9],[3,9],[9],[]] PresentT [[4,8,3,9],[8,3,9],[3,9],[9],[]]
>>>
pl @Tails []
Present [[]] PresentT [[]]
split a list into single values
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Ones Id) [4,8,3,9]
Present [[4],[8],[3],[9]] PresentT [[4],[8],[3],[9]]
>>>
pl @(Ones Id) []
Present [] PresentT []
similar to show
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ShowP Id) [4,8,3,9]
Present "[4,8,3,9]" PresentT "[4,8,3,9]"
>>>
pl @(ShowP Id) 'x'
Present "'x'" PresentT "'x'"
>>>
pl @(ShowP (42 %- 10)) 'x'
Present "(-21) % 5" PresentT "(-21) % 5"
data FormatTimeP p q Source #
type level expression representing a formatted time
similar to formatTime
using a type level Symbol
to get the formatting string
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(FormatTimeP "%F %T" Id) (read "2019-05-24 05:19:59" :: LocalTime)
Present "2019-05-24 05:19:59" PresentT "2019-05-24 05:19:59"
>>>
pl @(FormatTimeP (Fst Id) (Snd Id)) ("the date is %d/%m/%Y", read "2019-05-24" :: Day)
Present "the date is 24/05/2019" PresentT "the date is 24/05/2019"
data ParseTimeP' t p q Source #
similar to parseTimeM
where 't' is the ParseTime
type, 'p' is the datetime format and 'q' points to the content to parse
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ParseTimeP LocalTime "%F %T" Id) "2019-05-24 05:19:59"
Present 2019-05-24 05:19:59 PresentT 2019-05-24 05:19:59
>>>
pl @(ParseTimeP LocalTime "%F %T" "2019-05-24 05:19:59") (Right "we ignore this using Symbol and not Id")
Present 2019-05-24 05:19:59 PresentT 2019-05-24 05:19:59
keeping 'q' as we might want to extract from a tuple
type ParseTimeP (t :: Type) p q = ParseTimeP' (Hole t) p q Source #
data ParseTimes' t p q Source #
A convenience method to match against many different datetime formats to find a match
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ParseTimes LocalTime '["%Y-%m-%d %H:%M:%S", "%m/%d/%y %H:%M:%S", "%B %d %Y %H:%M:%S", "%Y-%m-%dT%H:%M:%S"] "03/11/19 01:22:33") ()
Present 2019-03-11 01:22:33 PresentT 2019-03-11 01:22:33
>>>
pl @(ParseTimes LocalTime (Fst Id) (Snd Id)) (["%Y-%m-%d %H:%M:%S", "%m/%d/%y %H:%M:%S", "%B %d %Y %H:%M:%S", "%Y-%m-%dT%H:%M:%S"], "03/11/19 01:22:33")
Present 2019-03-11 01:22:33 PresentT 2019-03-11 01:22:33
type ParseTimes (t :: Type) p q = ParseTimes' (Hole t) p q Source #
create a Day
from three int values passed in as year month and day
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @MkDay (2019,12,30)
Present Just (2019-12-30,1,1) PresentT (Just (2019-12-30,1,1))
>>>
pl @(MkDay' (Fst Id) (Snd Id) (Thd Id)) (2019,99,99999)
Present Nothing PresentT Nothing
>>>
pl @MkDay (1999,3,13)
Present Just (1999-03-13,10,6) PresentT (Just (1999-03-13,10,6))
uncreate a Day
returning year month and day
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(UnMkDay Id) (read "2019-12-30")
Present (2019,12,30) PresentT (2019,12,30)
uses the Read
of the given type 't' and 'p' which points to the content to read
>>>
:set -XTypeApplications
>>>
:set -XTypeOperators
>>>
:set -XDataKinds
>>>
pl @(ReadP Rational) "4 % 5"
Present 4 % 5 PresentT (4 % 5)
>>>
pl @(ReadP' Day Id >> Between (ReadP' Day "2017-04-11") (ReadP' Day "2018-12-30")) "2018-10-12"
True TrueT
>>>
pl @(ReadP' Day Id >> Between (ReadP' Day "2017-04-11") (ReadP' Day "2018-12-30")) "2016-10-12"
False FalseT
similar to minimum
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Min [10,4,5,12,3,4]
Present 3 PresentT 3
>>>
pl @Min []
Error empty list FailT "empty list"
similar to maximum
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Max [10,4,5,12,3,4]
Present 12 PresentT 12
>>>
pl @Max []
Error empty list FailT "empty list"
sort a list
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(SortOn (Fst Id) Id) [(10,"abc"), (3,"def"), (4,"gg"), (10,"xyz"), (1,"z")]
Present [(1,"z"),(3,"def"),(4,"gg"),(10,"abc"),(10,"xyz")] PresentT [(1,"z"),(3,"def"),(4,"gg"),(10,"abc"),(10,"xyz")]
similar to length
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Len [10,4,5,12,3,4]
Present 6 PresentT 6
>>>
pl @Len []
Present 0 PresentT 0
similar to length
for Foldable
instances
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Length Id) (Left "aa")
Present 0 PresentT 0
>>>
pl @(Length Id) (Right "aa")
Present 1 PresentT 1
>>>
pl @(Length (Right' Id)) (Right "abcd")
Present 4 PresentT 4
similar to fst
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id) (10,"Abc")
Present 10 PresentT 10
>>>
pl @(Fst Id) (10,"Abc",'x')
Present 10 PresentT 10
>>>
pl @(Fst Id) (10,"Abc",'x',False)
Present 10 PresentT 10
class ExtractL1C tp where Source #
type ExtractL1T tp Source #
extractL1C :: tp -> ExtractL1T tp Source #
Instances
ExtractL1C (a, b) Source # | |
Defined in Predicate type ExtractL1T (a, b) :: Type Source # extractL1C :: (a, b) -> ExtractL1T (a, b) Source # | |
ExtractL1C (a, b, c) Source # | |
Defined in Predicate type ExtractL1T (a, b, c) :: Type Source # extractL1C :: (a, b, c) -> ExtractL1T (a, b, c) Source # | |
ExtractL1C (a, b, c, d) Source # | |
Defined in Predicate type ExtractL1T (a, b, c, d) :: Type Source # extractL1C :: (a, b, c, d) -> ExtractL1T (a, b, c, d) Source # | |
ExtractL1C (a, b, c, d, e) Source # | |
Defined in Predicate type ExtractL1T (a, b, c, d, e) :: Type 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 type ExtractL1T (a, b, c, d, e, f) :: Type Source # extractL1C :: (a, b, c, d, e, f) -> ExtractL1T (a, b, c, d, e, f) Source # |
similar to snd
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Snd Id) (10,"Abc")
Present "Abc" PresentT "Abc"
>>>
pl @(Snd Id) (10,"Abc",True)
Present "Abc" PresentT "Abc"
class ExtractL2C tp where Source #
type ExtractL2T tp Source #
extractL2C :: tp -> ExtractL2T tp Source #
Instances
ExtractL2C (a, b) Source # | |
Defined in Predicate type ExtractL2T (a, b) :: Type Source # extractL2C :: (a, b) -> ExtractL2T (a, b) Source # | |
ExtractL2C (a, b, c) Source # | |
Defined in Predicate type ExtractL2T (a, b, c) :: Type Source # extractL2C :: (a, b, c) -> ExtractL2T (a, b, c) Source # | |
ExtractL2C (a, b, c, d) Source # | |
Defined in Predicate type ExtractL2T (a, b, c, d) :: Type Source # extractL2C :: (a, b, c, d) -> ExtractL2T (a, b, c, d) Source # | |
ExtractL2C (a, b, c, d, e) Source # | |
Defined in Predicate type ExtractL2T (a, b, c, d, e) :: Type 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 type ExtractL2T (a, b, c, d, e, f) :: Type Source # extractL2C :: (a, b, c, d, e, f) -> ExtractL2T (a, b, c, d, e, f) Source # |
similar to 3rd element in a n-tuple
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Thd Id) (10,"Abc",133)
Present 133 PresentT 133
>>>
pl @(Thd Id) (10,"Abc",133,True)
Present 133 PresentT 133
class ExtractL3C tp where Source #
type ExtractL3T tp Source #
extractL3C :: tp -> ExtractL3T tp Source #
Instances
ExtractL3C (a, b) Source # | |
Defined in Predicate type ExtractL3T (a, b) :: Type Source # extractL3C :: (a, b) -> ExtractL3T (a, b) Source # | |
ExtractL3C (a, b, c) Source # | |
Defined in Predicate type ExtractL3T (a, b, c) :: Type Source # extractL3C :: (a, b, c) -> ExtractL3T (a, b, c) Source # | |
ExtractL3C (a, b, c, d) Source # | |
Defined in Predicate type ExtractL3T (a, b, c, d) :: Type Source # extractL3C :: (a, b, c, d) -> ExtractL3T (a, b, c, d) Source # | |
ExtractL3C (a, b, c, d, e) Source # | |
Defined in Predicate type ExtractL3T (a, b, c, d, e) :: Type 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 type ExtractL3T (a, b, c, d, e, f) :: Type Source # extractL3C :: (a, b, c, d, e, f) -> ExtractL3T (a, b, c, d, e, f) Source # |
similar to 4th element in a n-tuple
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(L4 Id) (10,"Abc",'x',True)
Present True PresentT True
>>>
pl @(L4 (Fst (Snd Id))) ('x',((10,"Abc",'x',999),"aa",1),9)
Present 999 PresentT 999
class ExtractL4C tp where Source #
type ExtractL4T tp Source #
extractL4C :: tp -> ExtractL4T tp Source #
Instances
ExtractL4C (a, b) Source # | |
Defined in Predicate type ExtractL4T (a, b) :: Type Source # extractL4C :: (a, b) -> ExtractL4T (a, b) Source # | |
ExtractL4C (a, b, c) Source # | |
Defined in Predicate type ExtractL4T (a, b, c) :: Type Source # extractL4C :: (a, b, c) -> ExtractL4T (a, b, c) Source # | |
ExtractL4C (a, b, c, d) Source # | |
Defined in Predicate type ExtractL4T (a, b, c, d) :: Type Source # extractL4C :: (a, b, c, d) -> ExtractL4T (a, b, c, d) Source # | |
ExtractL4C (a, b, c, d, e) Source # | |
Defined in Predicate type ExtractL4T (a, b, c, d, e) :: Type 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 type ExtractL4T (a, b, c, d, e, f) :: Type Source # extractL4C :: (a, b, c, d, e, f) -> ExtractL4T (a, b, c, d, e, f) Source # |
similar to 5th element in a n-tuple
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(L5 Id) (10,"Abc",'x',True,1)
Present 1 PresentT 1
class ExtractL5C tp where Source #
type ExtractL5T tp Source #
extractL5C :: tp -> ExtractL5T tp Source #
Instances
ExtractL5C (a, b) Source # | |
Defined in Predicate type ExtractL5T (a, b) :: Type Source # extractL5C :: (a, b) -> ExtractL5T (a, b) Source # | |
ExtractL5C (a, b, c) Source # | |
Defined in Predicate type ExtractL5T (a, b, c) :: Type Source # extractL5C :: (a, b, c) -> ExtractL5T (a, b, c) Source # | |
ExtractL5C (a, b, c, d) Source # | |
Defined in Predicate type ExtractL5T (a, b, c, d) :: Type Source # extractL5C :: (a, b, c, d) -> ExtractL5T (a, b, c, d) Source # | |
ExtractL5C (a, b, c, d, e) Source # | |
Defined in Predicate type ExtractL5T (a, b, c, d, e) :: Type 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 type ExtractL5T (a, b, c, d, e, f) :: Type Source # extractL5C :: (a, b, c, d, e, f) -> ExtractL5T (a, b, c, d, e, f) Source # |
similar to 6th element in a n-tuple
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(L6 Id) (10,"Abc",'x',True,1,99)
Present 99 PresentT 99
class ExtractL6C tp where Source #
type ExtractL6T tp Source #
extractL6C :: tp -> ExtractL6T tp Source #
Instances
ExtractL6C (a, b) Source # | |
Defined in Predicate type ExtractL6T (a, b) :: Type Source # extractL6C :: (a, b) -> ExtractL6T (a, b) Source # | |
ExtractL6C (a, b, c) Source # | |
Defined in Predicate type ExtractL6T (a, b, c) :: Type Source # extractL6C :: (a, b, c) -> ExtractL6T (a, b, c) Source # | |
ExtractL6C (a, b, c, d) Source # | |
Defined in Predicate type ExtractL6T (a, b, c, d) :: Type Source # extractL6C :: (a, b, c, d) -> ExtractL6T (a, b, c, d) Source # | |
ExtractL6C (a, b, c, d, e) Source # | |
Defined in Predicate type ExtractL6T (a, b, c, d, e) :: Type 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 type ExtractL6T (a, b, c, d, e, f) :: Type Source # extractL6C :: (a, b, c, d, e, f) -> ExtractL6T (a, b, c, d, e, f) Source # |
identity function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @I 23
Present 23 PresentT 23
identity function that displays the input
even more constraints than I
so we might need to add explicit type signatures
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Id 23
Present 23 PresentT 23
identity function that also displays the type information for debugging
even more constraints than Id
so we might need to explicitly add types (Typeable)
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @IdT 23
Present 23 PresentT 23
data FromStringP' t s Source #
fromString
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
:set -XOverloadedStrings
>>>
pl @(FromStringP (Identity _) Id) "abc"
Present Identity "abc" PresentT (Identity "abc")
>>>
pl @(FromStringP (Seq.Seq _) Id) "abc"
Present fromList "abc" PresentT (fromList "abc")
type FromStringP (t :: Type) p = FromStringP' (Hole t) p Source #
data FromInteger' t n Source #
fromInteger
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(FromInteger (SG.Sum _) Id) 23
Present Sum {getSum = 23} PresentT (Sum {getSum = 23})
type FromInteger (t :: Type) p = FromInteger' (Hole t) p Source #
type FromIntegerP n = FromInteger' Unproxy n Source #
data FromIntegral' t n Source #
fromIntegral
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(FromIntegral (SG.Sum _) Id) 23
Present Sum {getSum = 23} PresentT (Sum {getSum = 23})
type FromIntegral (t :: Type) p = FromIntegral' (Hole t) p Source #
data ToRational p Source #
toRational
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ToRational Id) 23.5
Present 47 % 2 PresentT (47 % 2)
data FromRational' t r Source #
fromRational
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(FromRational Rational Id) 23.5
Present 47 % 2 PresentT (47 % 2)
type FromRational (t :: Type) p = FromRational' (Hole t) p Source #
truncate
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Truncate Int Id) (23 % 5)
Present 4 PresentT 4
ceiling
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Ceiling Int Id) (23 % 5)
Present 5 PresentT 5
floor
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Floor Int Id) (23 % 5)
Present 4 PresentT 4
converts a value to a Proxy
: the same as '\'Proxy'
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @MkProxy 'x'
Present Proxy PresentT Proxy
processes a type level list predicates running each in sequence: see >>
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Do [Pred Id, ShowP Id, Id &&& Len]) 9876543
Present ("9876542",7) PresentT ("9876542",7)
Convenient method to convert a value 'p' to a Maybe
based on a predicate '\b\'
if '\b\' then Just 'p' else Nothing
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MaybeB (Id > 4) Id) 24
Present Just 24 PresentT (Just 24)
>>>
pl @(MaybeB (Id > 4) Id) (-5)
Present Nothing PresentT Nothing
Convenient method to convert a 'p' or '\q' to a Either
based on a predicate '\b\'
if 'b' then Right 'p' else Left '\q\'
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(EitherB (Fst Id > 4) (Snd Id >> Fst Id) (Snd Id >> (Snd Id))) (24,(-1,999))
Present Right 999 PresentT (Right 999)
>>>
pl @(EitherB (Fst Id > 4) (Snd Id >> Fst Id) (Snd Id >> (Snd Id))) (1,(-1,999))
Present Left (-1) PresentT (Left (-1))
data TupleI (ps :: [k]) Source #
create inductive tuples from a type level list of predicates
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(TupleI '[Id,ShowP Id,Pred Id,W "str", W 999]) 666
Present (666,("666",(665,("str",(999,()))))) PresentT (666,("666",(665,("str",(999,())))))
add a message to give more context to the evaluation tree
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pe @(Msg' "somemessage" Id) 999
P [somemessage] Id 999 PresentT 999
data Pad (left :: Bool) n p q Source #
pad 'q' with '\n' values from '\p'\
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(PadL 5 999 Id) [12,13]
Present [999,999,999,12,13] PresentT [999,999,999,12,13]
>>>
pl @(PadR 5 (Fst Id) '[12,13]) (999,'x')
Present [12,13,999,999,999] PresentT [12,13,999,999,999]
>>>
pl @(PadR 2 (Fst Id) '[12,13,14]) (999,'x')
Present [12,13,14] PresentT [12,13,14]
split a list 'p' into parts using the lengths in the type level list 'ns'
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(SplitAts '[2,3,1,1] Id) "hello world"
Present ["he","llo"," ","w","orld"] PresentT ["he","llo"," ","w","orld"]
>>>
pl @(SplitAts '[2] Id) "hello world"
Present ["he","llo world"] PresentT ["he","llo world"]
>>>
pl @(SplitAts '[10,1,1,5] Id) "hello world"
Present ["hello worl","d","",""] PresentT ["hello worl","d","",""]
similar to splitAt
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(SplitAt 4 Id) "hello world"
Present ("hell","o world") PresentT ("hell","o world")
>>>
pl @(SplitAt 20 Id) "hello world"
Present ("hello world","") PresentT ("hello world","")
>>>
pl @(SplitAt 0 Id) "hello world"
Present ("","hello world") PresentT ("","hello world")
>>>
pl @(SplitAt (Snd Id) (Fst Id)) ("hello world",4)
Present ("hell","o world") PresentT ("hell","o world")
data (p :: k) *** (q :: k1) infixr 3 Source #
similar to ***
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Pred Id *** ShowP Id) (13, True)
Present (12,"True") PresentT (12,"True")
data (p :: k) ||| (q :: k1) infixr 2 Source #
similar |||
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Pred Id ||| Id) (Left 13)
Present 12 PresentT 12
>>>
pl @(ShowP Id ||| Id) (Right "hello")
Present "hello" PresentT "hello"
data (p :: k) +++ (q :: k1) infixr 2 Source #
similar +++
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Pred Id +++ Id) (Left 13)
Present Left 12 PresentT (Left 12)
>>>
pl @(ShowP Id +++ Reverse) (Right "hello")
Present Right "olleh" PresentT (Right "olleh")
data Bin (op :: BinOp) p q Source #
addition, multiplication and subtraction
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
:set -XNoStarIsType
>>>
pl @(Fst Id * (Snd Id)) (13,5)
Present 65 PresentT 65
>>>
pl @(Fst Id + 4 * (Snd Id >> Len) - 4) (3,"hello")
Present 19 PresentT 19
fractional division
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id / (Snd Id)) (13,2)
Present 6.5 PresentT 6.5
>>>
pl @(ToRational 13 / Id) 0
Error DivF zero denominator FailT "DivF zero denominator"
creates a Ratio
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
:set -XNoStarIsType
>>>
pl @(Fst Id % (Snd Id)) (13,2)
Present 13 % 2 PresentT (13 % 2)
>>>
pl @(13 % Id) 0
Error MkRatio zero denominator FailT "MkRatio zero denominator"
>>>
pl @(4 % 3 + 5 % 7) "asfd"
Present 43 % 21 PresentT (43 % 21)
>>>
pl @(4 %- 7 * 5 %- 3) "asfd"
Present 20 % 21 PresentT (20 % 21)
>>>
pl @(Negate (14 % 3)) ()
Present (-14) % 3 PresentT ((-14) % 3)
>>>
pl @(14 % 3) ()
Present 14 % 3 PresentT (14 % 3)
>>>
pl @(Negate (14 % 3) === FromIntegral _ (Negate 5)) ()
Present GT PresentT GT
>>>
pl @(14 -% 3 === 5 %- 1) "aa"
Present GT PresentT GT
>>>
pl @(Negate (14 % 3) === Negate 5 % 2) ()
Present LT PresentT LT
>>>
pl @(14 -% 3 * 5 -% 1) ()
Present 70 % 3 PresentT (70 % 3)
>>>
pl @(14 % 3 === 5 % 1) ()
Present LT PresentT LT
>>>
pl @(15 % 3 / 4 % 2) ()
Present 5 % 2 PresentT (5 % 2)
similar to negate
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
:set -XTypeOperators
>>>
pl @(Negate Id) 14
Present -14 PresentT (-14)
>>>
pl @(Negate (Fst Id * (Snd Id))) (14,3)
Present -42 PresentT (-42)
>>>
pl @(Negate (15 %- 4)) "abc"
Present 15 % 4 PresentT (15 % 4)
>>>
pl @(Negate (15 % 3)) ()
Present (-5) % 1 PresentT ((-5) % 1)
>>>
pl @(Negate (Fst Id % (Snd Id))) (14,3)
Present (-14) % 3 PresentT ((-14) % 3)
similar to abs
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Abs Id) (-14)
Present 14 PresentT 14
>>>
pl @(Abs (Snd Id)) ("xx",14)
Present 14 PresentT 14
>>>
pl @(Abs Id) 0
Present 0 PresentT 0
>>>
pl @(Abs (Negate 44)) "aaa"
Present 44 PresentT 44
similar to signum
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Signum Id) (-14)
Present -1 PresentT (-1)
>>>
pl @(Signum Id) 14
Present 1 PresentT 1
>>>
pl @(Signum Id) 0
Present 0 PresentT 0
unwraps a value (see Wrapped
)
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Unwrap Id) (SG.Sum (-13))
Present -13 PresentT (-13)
wraps a value (see Wrapped
and Wrapped
)
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
:m + Data.List.NonEmpty
>>>
pl @(Wrap (SG.Sum _) Id) (-13)
Present Sum {getSum = -13} PresentT (Sum {getSum = -13})
>>>
pl @(Wrap SG.Any (Ge 4)) 13
Present Any {getAny = True} PresentT (Any {getAny = True})
>>>
pl @(Wrap (NonEmpty _) (Uncons >> 'Just Id)) "abcd"
Present 'a' :| "bcd" PresentT ('a' :| "bcd")
similar to coerce
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Coerce (SG.Sum Integer)) (Identity (-13))
Present Sum {getSum = -13} PresentT (Sum {getSum = -13})
data Coerce2 (t :: k) Source #
see Coerce
: coerce over a functor
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Coerce2 (SG.Sum Integer)) [Identity (-13), Identity 4, Identity 99]
Present [Sum {getSum = -13},Sum {getSum = 4},Sum {getSum = 99}] PresentT [Sum {getSum = -13},Sum {getSum = 4},Sum {getSum = 99}]
>>>
pl @(Coerce2 (SG.Sum Integer)) (Just (Identity (-13)))
Present Just (Sum {getSum = -13}) PresentT (Just (Sum {getSum = -13}))
>>>
pl @(Coerce2 (SG.Sum Int)) (Nothing @(Identity Int))
Present Nothing PresentT Nothing
lift mempty over a Functor
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MEmptyT2 (SG.Product Int)) [Identity (-13), Identity 4, Identity 99]
Present [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}] PresentT [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}]
data Pure2 (t :: Type -> Type) Source #
lift pure over a Functor
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Pure2 (Either String)) [1,2,4]
Present [Right 1,Right 2,Right 4] PresentT [Right 1,Right 2,Right 4]
similar to reverse
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Reverse [1,2,4]
Present [4,2,1] PresentT [4,2,1]
>>>
pl @Reverse "AbcDeF"
Present "FeDcbA" PresentT "FeDcbA"
reverses using reversing
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
import Data.Text (Text)
>>>
pl @ReverseL ("AbcDeF" :: Text)
Present "FeDcbA" PresentT "FeDcbA"
swaps using swapped
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Swap (Left 123)
Present Right 123 PresentT (Right 123)
>>>
pl @Swap (Right 123)
Present Left 123 PresentT (Left 123)
>>>
pl @Swap (These 'x' 123)
Present These 123 'x' PresentT (These 123 'x')
>>>
pl @Swap (This 'x')
Present That 'x' PresentT (That 'x')
>>>
pl @Swap (That 123)
Present This 123 PresentT (This 123)
>>>
pl @Swap (123,'x')
Present ('x',123) PresentT ('x',123)
bounded succ
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(SuccB' Id) (13 :: Int)
Present 14 PresentT 14
>>>
pl @(SuccB' Id) LT
Present EQ PresentT EQ
>>>
pl @(SuccB 'LT Id) GT
Present LT PresentT LT
>>>
pl @(SuccB' Id) GT
Error Succ bounded failed FailT "Succ bounded failed"
bounded pred
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(PredB' Id) (13 :: Int)
Present 12 PresentT 12
unbounded succ
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Succ Id) 13
Present 14 PresentT 14
>>>
pl @(Succ Id) LT
Present EQ PresentT EQ
>>>
pl @(Succ Id) GT
Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument"
unbounded pred
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Pred Id) 13
Present 12 PresentT 12
fromEnum
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(FromEnum Id) 'x'
Present 120 PresentT 120
unsafe toEnum
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ToEnum Char Id) 120
Present 'x' PresentT 'x'
bounded toEnum
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ToEnumB Ordering LT) 2
Present GT PresentT GT
>>>
pl @(ToEnumB Ordering LT) 6
Present LT PresentT LT
>>>
pl @(ToEnumBF Ordering) 6
Error ToEnum bounded failed FailT "ToEnum bounded failed"
a predicate on prime numbers
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Prime Id) 2
True TrueT
>>>
pl @(Map '(Id,Prime Id) Id) [0..12]
Present [(0,False),(1,False),(2,True),(3,True),(4,False),(5,True),(6,False),(7,True),(8,False),(9,False),(10,False),(11,True),(12,False)] PresentT [(0,False),(1,False),(2,True),(3,True),(4,False),(5,True),(6,False),(7,True),(8,False),(9,False),(10,False),(11,True),(12,False)]
not
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Not Id) False
True TrueT
>>>
pl @(Not Id) True
False FalseT
>>>
pl @(Not (Fst Id)) (True,22)
False FalseT
data KeepImpl (keep :: Bool) p q Source #
filters a list 'q' keeping or removing those elements in 'p'
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Keep '[5] '[1,5,5,2,5,2]) ()
Present [5,5,5] PresentT [5,5,5]
>>>
pl @(Keep '[0,1,1,5] '[1,5,5,2,5,2]) ()
Present [1,5,5,5] PresentT [1,5,5,5]
>>>
pl @(Remove '[5] '[1,5,5,2,5,2]) ()
Present [1,2,2] PresentT [1,2,2]
>>>
pl @(Remove '[0,1,1,5] '[1,5,5,2,5,2]) ()
Present [2,2] PresentT [2,2]
>>>
pl @(Remove '[99] '[1,5,5,2,5,2]) ()
Present [1,5,5,2,5,2] PresentT [1,5,5,2,5,2]
>>>
pl @(Remove '[99,91] '[1,5,5,2,5,2]) ()
Present [1,5,5,2,5,2] PresentT [1,5,5,2,5,2]
>>>
pl @(Remove Id '[1,5,5,2,5,2]) []
Present [1,5,5,2,5,2] PresentT [1,5,5,2,5,2]
>>>
pl @(Remove '[] '[1,5,5,2,5,2]) 44 -- works if you make this a number!
Present [1,5,5,2,5,2] PresentT [1,5,5,2,5,2]
elem
function
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Elem (Fst Id) (Snd Id)) ('x',"abcdxy")
True TrueT
>>>
pl @(Elem (Fst Id) (Snd Id)) ('z',"abcdxy")
False FalseT
similar to fmap fst
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Fmap_1 (Just (13,"Asf"))
Present Just 13 PresentT (Just 13)
to make this work we grab the fst or snd out of the Maybe so it is a head or not/ is a tail or not etc! we still have access to the whole original list so we dont lose anything!
similar to fmap snd
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Fmap_2 (Just ("asf",13))
Present Just 13 PresentT (Just 13)
type JustDef''' p q r = GDef_X I p q r Source #
type LookupDef' x y p q = GDef (Lookup x y) p q Source #
type LookupFail' msg x y q = GFail (Lookup x y) msg q Source #
type LookupDef x y p = LookupDef' x y p I Source #
type LookupFail msg x y = LookupFail' msg x y I Source #
type LeftDef p q = GDef LeftToMaybe p q Source #
type LeftP q = GProxy LeftToMaybe q Source #
type LeftFail msg q = GFail LeftToMaybe msg q Source #
type RightDef p q = GDef RightToMaybe p q Source #
type RightP q = GProxy RightToMaybe q Source #
type RightFail msg q = GFail RightToMaybe msg q Source #
type ThisDef p q = GDef ThisToMaybe p q Source #
type ThisP q = GProxy ThisToMaybe q Source #
type ThisFail msg q = GFail ThisToMaybe msg q Source #
type ThatDef p q = GDef ThatToMaybe p q Source #
type ThatP q = GProxy ThatToMaybe q Source #
type ThatFail msg q = GFail ThatToMaybe msg q Source #
type TheseDef p q = GDef TheseToMaybe p q Source #
type TheseP q = GProxy TheseToMaybe q Source #
type TheseFail msg q = GFail TheseToMaybe msg q Source #
data LeftToMaybe Source #
similar to either Just (const Nothing)
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @LeftToMaybe (Left 13)
Present Just 13 PresentT (Just 13)
>>>
pl @LeftToMaybe (Right 13)
Present Nothing PresentT Nothing
data RightToMaybe Source #
similar to either (const Nothing) Just
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @RightToMaybe (Right 13)
Present Just 13 PresentT (Just 13)
>>>
pl @RightToMaybe (Left 13)
Present Nothing PresentT Nothing
data ThisToMaybe Source #
data ThatToMaybe Source #
data TheseToMaybe Source #
similar to |||
but additionally gives 'p' and 'q' the original input
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(EitherX (ShowP ((Fst Id >> Fst Id) + (Snd Id))) (ShowP Id) (Snd Id)) (9,Left 123)
Present "132" PresentT "132"
>>>
pl @(EitherX (ShowP ((Fst Id >> Fst Id) + (Snd Id))) (ShowP Id) (Snd Id)) (9,Right 'x')
Present "((9,Right 'x'),'x')" PresentT "((9,Right 'x'),'x')"
>>>
pl @(EitherX (ShowP Id) (ShowP (Second (Succ Id))) (Snd Id)) (9,Right 'x')
Present "((9,Right 'x'),'y')" PresentT "((9,Right 'x'),'y')"
similar to mergeTheseWith
but additionally provides 'p', '\q' and 'r' the original input as the first element in the tuple
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(TheseX (((Fst Id >> Fst Id) + (Snd Id)) >> ShowP Id) (ShowP Id) (Snd Id >> (Snd Id)) (Snd Id)) (9,This 123)
Present "132" PresentT "132"
>>>
pl @(TheseX '(Snd Id,"fromthis") '(Negate 99,(Snd Id)) (Snd Id) Id) (This 123)
Present (123,"fromthis") PresentT (123,"fromthis")
>>>
pl @(TheseX '(Snd Id,"fromthis") '(Negate 99,(Snd Id)) (Snd Id) Id) (That "fromthat")
Present (-99,"fromthat") PresentT (-99,"fromthat")
>>>
pl @(TheseX '(Snd Id,"fromthis") '(Negate 99,(Snd Id)) (Snd Id) Id) (These 123 "fromthese")
Present (123,"fromthese") PresentT (123,"fromthese")
similar to maybe
similar to MaybeX
but provides a Proxy to the result of 'q' and does not provide the surrounding context
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MaybeIn "foundnothing" (ShowP (Pred Id))) (Just 20)
Present "19" PresentT "19"
>>>
pl @(MaybeIn "found nothing" (ShowP (Pred Id))) Nothing
Present "found nothing" PresentT "found nothing"
similar to stimes
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(STimes 4 Id) (SG.Sum 3)
Present Sum {getSum = 12} PresentT (Sum {getSum = 12})
>>>
pl @(STimes 4 Id) "ab"
Present "abababab" PresentT "abababab"
data Pure (t :: Type -> Type) p Source #
similar to pure
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Pure Maybe Id) 4
Present Just 4 PresentT (Just 4)
>>>
pl @(Pure [] Id) 4
Present [4] PresentT [4]
>>>
pl @(Pure (Either String) (Fst Id)) (13,True)
Present Right 13 PresentT (Right 13)
similar to mempty
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MEmptyT (SG.Sum Int)) ()
Present Sum {getSum = 0} PresentT (Sum {getSum = 0})
no Monoid for Maybe a unless a is also a monoid but can use empty!
data MEmptyProxy Source #
data EmptyT (t :: Type -> Type) p Source #
similar to empty
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(EmptyT Maybe Id) ()
Present Nothing PresentT Nothing
>>>
pl @(EmptyT [] Id) ()
Present [] PresentT []
>>>
pl @(EmptyT [] (Char1 "x")) (13,True)
Present "" PresentT ""
>>>
pl @(EmptyT (Either String) (Fst Id)) (13,True)
Present Left "" PresentT (Left "")
data MkNothing' t Source #
Instances
P (MkNothing' t :: Type) a Source # | |
type PP (MkNothing' t :: Type) a Source # | |
Just
constructor
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MkJust Id) 44
Present Just 44 PresentT (Just 44)
Left
constructor
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MkLeft _ Id) 44
Present Left 44 PresentT (Left 44)
Right
constructor
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MkRight _ Id) 44
Present Right 44 PresentT (Right 44)
This
constructor
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MkThis _ Id) 44
Present This 44 PresentT (This 44)
That
constructor
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MkThat _ Id) 44
Present That 44 PresentT (That 44)
These
constructor
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MkThese (Fst Id) (Snd Id)) (44,'x')
Present These 44 'x' PresentT (These 44 'x')
similar to mconcat
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(MConcat Id) [SG.Sum 44, SG.Sum 12, SG.Sum 3]
Present Sum {getSum = 59} PresentT (Sum {getSum = 59})
type FoldMap (t :: Type) p = Map (Wrap t Id) p >> Unwrap (MConcat Id) Source #
similar to a limited form of foldMap
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(FoldMap (SG.Sum _) Id) [44, 12, 3]
Present 59 PresentT 59
>>>
pl @(FoldMap (SG.Product _) Id) [44, 12, 3]
Present 1584 PresentT 1584
similar to concat
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Concat Id) ["abc","D","eF","","G"]
Present "abcDeFG" PresentT "abcDeFG"
>>>
pl @(Concat (Snd Id)) ('x',["abc","D","eF","","G"])
Present "abcDeFG" PresentT "abcDeFG"
data Ix (n :: Nat) def Source #
similar to !!
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Ix 4 "not found") ["abc","D","eF","","G"]
Present "G" PresentT "G"
>>>
pl @(Ix 40 "not found") ["abc","D","eF","","G"]
Present "not found" PresentT "not found"
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
import qualified Data.Map.Strict as M
>>>
pl @(Id !! 2) ["abc","D","eF","","G"]
Present "eF" PresentT "eF"
>>>
pl @(Id !! 20) ["abc","D","eF","","G"]
Error (!!) index not found FailT "(!!) index not found"
>>>
pl @(Id !! "eF") (M.fromList (flip zip [0..] ["abc","D","eF","","G"]))
Present 2 PresentT 2
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
import qualified Data.Map.Strict as M
>>>
pl @(Id !!! 2) ["abc","D","eF","","G"]
Present "eF" PresentT "eF"
>>>
pl @(Id !!! 20) ["abc","D","eF","","G"]
Error index not found FailT "index not found"
>>>
pl @(Id !!! "eF") (M.fromList (flip zip [0..] ["abc","D","eF","","G"]))
Present 2 PresentT 2
>>>
pl @(Lookup Id 2) ["abc","D","eF","","G"]
Present Just "eF" PresentT (Just "eF")
>>>
pl @(Lookup Id 20) ["abc","D","eF","","G"]
Present Nothing PresentT Nothing
type Lookup' (t :: Type) p q = (q &&& Lookup p q) >> If (Snd Id >> IsNothing) (ShowP (Fst Id) >> Fail (Hole t) (Printf "index(%s) not found" Id)) (Snd Id >> Just Id) Source #
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Ands Id) [True,True,True]
True TrueT
>>>
pl @(Ands Id) [True,True,True,False]
False FalseT
>>>
pl @(Ands Id) []
True TrueT
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Ors Id) [False,False,False]
False FalseT
>>>
pl @(Ors Id) [True,True,True,False]
True TrueT
>>>
pl @(Ors Id) []
False FalseT
similar to cons
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id :+ (Snd Id)) (99,[1,2,3,4])
Present [99,1,2,3,4] PresentT [99,1,2,3,4]
>>>
pl @(Snd Id :+ Fst Id) ([],5)
Present [5] PresentT [5]
>>>
pl @(123 :+ EmptyList _) "somestuff"
Present [123] PresentT [123]
similar to snoc
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Snd Id +: Fst Id) (99,[1,2,3,4])
Present [1,2,3,4,99] PresentT [1,2,3,4,99]
>>>
pl @(Fst Id +: (Snd Id)) ([],5)
Present [5] PresentT [5]
>>>
pl @(EmptyT [] Id +: 5) 5
Present [5] PresentT [5]
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Uncons [1,2,3,4]
Present Just (1,[2,3,4]) PresentT (Just (1,[2,3,4]))
>>>
pl @Uncons []
Present Nothing PresentT Nothing
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Unsnoc [1,2,3,4]
Present Just ([1,2,3],4) PresentT (Just ([1,2,3],4))
>>>
pl @Unsnoc []
Present Nothing PresentT Nothing
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @IsEmpty [1,2,3,4]
False FalseT
>>>
pl @IsEmpty []
True TrueT
>>>
pl @IsEmpty LT
False FalseT
>>>
pl @IsEmpty EQ
True TrueT
data EnumFromTo p q Source #
similar to enumFromTo
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(EnumFromTo 2 5) ()
Present [2,3,4,5] PresentT [2,3,4,5]
>>>
pl @(EnumFromTo LT GT) ()
Present [LT,EQ,GT] PresentT [LT,EQ,GT]
data PartitionEithers Source #
similar to partitionEithers
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @PartitionEithers [Left 'a',Right 2,Left 'c',Right 4,Right 99]
Present ("ac",[2,4,99]) PresentT ("ac",[2,4,99])
data PartitionThese Source #
similar to partitionThese
. returns a 3-tuple with the results so use Fst
Snd
Thd
to extract
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @PartitionThese [This 'a', That 2, This 'c', These 'z' 1, That 4, These 'a' 2, That 99]
Present ("ac",[2,4,99],[('z',1),('a',2)]) PresentT ("ac",[2,4,99],[('z',1),('a',2)])
similar to scanl
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Scanl (Snd Id :+ Fst Id) (Fst Id) (Snd Id)) ([99],[1..5])
Present [[99],[1,99],[2,1,99],[3,2,1,99],[4,3,2,1,99],[5,4,3,2,1,99]] PresentT [[99],[1,99],[2,1,99],[3,2,1,99],[4,3,2,1,99],[5,4,3,2,1,99]]
>>>
pl @(ScanN 4 Id (Succ Id)) 'c'
Present "cdefg" PresentT "cdefg"
>>>
pl @(FoldN 4 Id (Succ Id)) 'c'
Present 'g' PresentT 'g'
similar to unfoldr
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Unfoldr (MaybeB (Not Null) (SplitAt 2 Id)) Id) [1..5]
Present [[1,2],[3,4],[5]] PresentT [[1,2],[3,4],[5]]
>>>
pl @(IterateN 4 (Succ Id)) 4
Present [4,5,6,7] PresentT [4,5,6,7]
type IterateUntil p f = IterateWhile (Not p) f Source #
type IterateNWhile n p f = '(n, Id) >> (IterateWhile ((Fst Id > 0) && (Snd Id >> p)) (Pred Id *** f) >> Map (Snd Id) Id) Source #
type IterateNUntil n p f = IterateNWhile n (Not p) f Source #
similar to map
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Map (Pred Id) Id) [1..5]
Present [0,1,2,3,4] PresentT [0,1,2,3,4]
if p then run q else run r
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(If (Gt 4) "greater than 4" "less than or equal to 4" ) 10
Present "greater than 4" PresentT "greater than 4"
>>>
pl @(If (Gt 4) "greater than 4" "less than or equal to 4") 0
Present "less than or equal to 4" PresentT "less than or equal to 4"
creates a list of overlapping pairs of elements. requires two or more elements
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Pairs [1,2,3,4]
Present [(1,2),(2,3),(3,4)] PresentT [(1,2),(2,3),(3,4)]
>>>
pl @Pairs []
Error Pairs no data found FailT "Pairs no data found"
>>>
pl @Pairs [1]
Error Pairs only one element found FailT "Pairs only one element found"
similar to partition
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Partition (Ge 3) Id) [10,4,1,7,3,1,3,5]
Present ([10,4,7,3,3,5],[1,1]) PresentT ([10,4,7,3,3,5],[1,1])
>>>
pl @(Partition (Prime Id) Id) [10,4,1,7,3,1,3,5]
Present ([7,3,3,5],[10,4,1,1]) PresentT ([7,3,3,5],[10,4,1,1])
>>>
pl @(Partition (Ge 300) Id) [10,4,1,7,3,1,3,5]
Present ([],[10,4,1,7,3,1,3,5]) PresentT ([],[10,4,1,7,3,1,3,5])
>>>
pl @(Partition (Id < 300) Id) [10,4,1,7,3,1,3,5]
Present ([10,4,1,7,3,1,3,5],[]) PresentT ([10,4,1,7,3,1,3,5],[])
similar to break
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Break (Ge 3) Id) [10,4,1,7,3,1,3,5]
Present ([],[10,4,1,7,3,1,3,5]) PresentT ([],[10,4,1,7,3,1,3,5])
>>>
pl @(Break (Lt 3) Id) [10,4,1,7,3,1,3,5]
Present ([10,4],[1,7,3,1,3,5]) PresentT ([10,4],[1,7,3,1,3,5])
Fails the computation with a message
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Failt Int (Printf "value=%03d" Id)) 99
Error value=099 FailT "value=099"
>>>
pl @(FailS (Printf2 "value=%03d string=%s")) (99,"somedata")
Error value=099 string=somedata FailT "value=099 string=somedata"
transparent predicate wrapper to make k of kind Type so it can be in a promoted list (cant mix kinds) see Do
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Do '[W 123, W "xyz", Len &&& Id, Pred Id *** Id<>Id]) ()
Present (2,"xyzxyz") PresentT (2,"xyzxyz")
>>>
pl @(TupleI '[W 999,W "somestring",W 'True, Id, ShowP (Pred Id)]) 23
Present (999,("somestring",(True,(23,("22",()))))) PresentT (999,("somestring",(True,(23,("22",())))))
catch a failure
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Catch (Succ Id) (Fst Id >> Second (ShowP Id) >> Printf2 "%s %s" >> 'LT)) GT
Present LT PresentT LT
>>>
pl @(Catch' (Succ Id) (Second (ShowP Id) >> Printf2 "%s %s")) GT
Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument GT FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument GT"
>>>
pl @(Catch' (Succ Id) (Second (ShowP Id) >> Printf2 "%s %s")) LT
Present EQ PresentT EQ
more flexible: takes a (String,x) and a proxy so we can still call 'False 'True now takes the FailT string and x so you can print more detail if you want need the proxy so we can fail without having to explicitly specify a type
similar to div
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Div (Fst Id) (Snd Id)) (10,4)
Present 2 PresentT 2
>>>
pl @(Div (Fst Id) (Snd Id)) (10,0)
Error Div zero denominator FailT "Div zero denominator"
similar to mod
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Mod (Fst Id) (Snd Id)) (10,3)
Present 1 PresentT 1
>>>
pl @(Mod (Fst Id) (Snd Id)) (10,0)
Error Mod zero denominator FailT "Mod zero denominator"
similar to divMod
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(DivMod (Fst Id) (Snd Id)) (10,3)
Present (3,1) PresentT (3,1)
>>>
pl @(DivMod (Fst Id) (Snd Id)) (10,-3)
Present (-4,-2) PresentT (-4,-2)
>>>
pl @(DivMod (Fst Id) (Snd Id)) (-10,3)
Present (-4,2) PresentT (-4,2)
>>>
pl @(DivMod (Fst Id) (Snd Id)) (-10,-3)
Present (3,-1) PresentT (3,-1)
>>>
pl @(DivMod (Fst Id) (Snd Id)) (10,0)
Error DivMod zero denominator FailT "DivMod zero denominator"
similar to quotRem
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(QuotRem (Fst Id) (Snd Id)) (10,3)
Present (3,1) PresentT (3,1)
>>>
pl @(QuotRem (Fst Id) (Snd Id)) (10,-3)
Present (-3,1) PresentT (-3,1)
>>>
pl @(QuotRem (Fst Id) (Snd Id)) (-10,-3)
Present (3,-1) PresentT (3,-1)
>>>
pl @(QuotRem (Fst Id) (Snd Id)) (-10,3)
Present (-3,-1) PresentT (-3,-1)
>>>
pl @(QuotRem (Fst Id) (Snd Id)) (10,0)
Error QuotRem zero denominator FailT "QuotRem zero denominator"
type OneP = Guard (Printf "expected list of length 1 but found length=%d" Len) (Len >> Same 1) >> Head Source #
data GuardsImpl (n :: Nat) (strict :: Bool) (os :: [(k, k1)]) Source #
Guards contain a type level list of tuples the action to run on failure of the predicate and the predicate itself Each tuple validating against the corresponding value in a value list
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 4)]) [17,4]
Present [17,4] PresentT [17,4]
>>>
pl @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 5)]) [17,4]
Error arg2 failed FailT "arg2 failed"
>>>
pl @(Guards '[ '("arg1 failed",Gt 99), '("arg2 failed", Same 4)]) [17,4]
Error arg1 failed FailT "arg1 failed"
>>>
pl @(Guards '[ '(Printf2 "arg %d failed with value %d",Gt 4), '(Printf2 "%d %d", Same 4)]) [17,3]
Error 2 3 FailT "2 3"
>>>
pl @(GuardsQuick (Printf2 "arg %d failed with value %d") '[Gt 4, Ge 3, Same 4]) [17,3,5]
Error arg 3 failed with value 5 FailT "arg 3 failed with value 5"
>>>
pl @(GuardsQuick (Printf2 "arg %d failed with value %d") '[Gt 4, Ge 3, Same 4]) [17,3,5,99]
Error Guards: data elements(4) /= predicates(3) FailT "Guards: data elements(4) /= predicates(3)"
Instances
(KnownNat n, GetBool strict, Show a) => P (GuardsImpl n strict ([] :: [(k, k1)]) :: Type) [a] Source # | |
(PP prt (Int, a) ~ String, P prt (Int, a), KnownNat n, GetBool strict, GetLen ps, P p a, PP p a ~ Bool, P (GuardsImpl n strict ps) [a], PP (GuardsImpl n strict ps) [a] ~ [a], Show a) => P (GuardsImpl n strict ((,) prt p ': ps) :: Type) [a] Source # | |
type PP (GuardsImpl n strict ((,) prt p ': ps) :: Type) [a] Source # | |
Defined in Predicate | |
type PP (GuardsImpl n strict ([] :: [(k, k1)]) :: Type) [a] Source # | |
Defined in Predicate |
type Guards (os :: [(k, k1)]) = GuardsImplW True os Source #
type GuardsLax (os :: [(k, k1)]) = GuardsImplW False os Source #
type GuardsQuick (prt :: k) (os :: [k1]) = Guards (ToGuardsT prt os) Source #
data GuardsImplW (strict :: Bool) (ps :: [(k, k1)]) Source #
'p' is the predicate and on failure of the predicate runs 'prt'
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Guard "expected > 3" (Gt 3)) 17
Present 17 PresentT 17
>>>
pl @(Guard "expected > 3" (Gt 3)) 1
Error expected > 3 FailT "expected > 3"
>>>
pl @(Guard (Printf "%d not > 3" Id) (Gt 3)) (-99)
Error -99 not > 3 FailT "-99 not > 3"
data GuardSimple p Source #
similar to Guard
but uses the root message of the False predicate case as the failure message
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(GuardSimple (Luhn Id)) [1..4]
Error Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4] FailT "Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4]"
>>>
pl @(GuardSimple (Luhn Id)) [1,2,3,0]
Present [1,2,3,0] PresentT [1,2,3,0]
>>>
pl @(GuardSimple (Len > 30)) [1,2,3,0]
Error 4 > 30 FailT "4 > 30"
just run the effect but skip the value for example for use with Stdout so it doesnt interfere with the 'a' on the rhs unless there is an error
data (p :: k) >> (q :: k1) infixr 1 Source #
This is composition for predicates
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id >> Succ (Id !! 0)) ([11,12],'x')
Present 12 PresentT 12
>>>
pl @(Len *** Succ Id >> ShowP (First (Pred Id))) ([11,12],'x')
Present "(1,'y')" PresentT "(1,'y')"
data (p :: k) && (q :: k1) infixr 3 Source #
similar to &&
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id && (Snd Id >> Len >> Ge 4)) (True,[11,12,13,14])
True TrueT
>>>
pl @(Fst Id && (Snd Id >> Len >> Same 4)) (True,[12,11,12,13,14])
False FalseT
data (p :: k) || (q :: k1) infixr 2 Source #
similar to ||
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id || (Snd Id >> Len >> Ge 4)) (False,[11,12,13,14])
True TrueT
>>>
pl @((Not (Fst Id)) || (Snd Id >> Len >> Same 4)) (True,[12,11,12,13,14])
False FalseT
data (p :: k) ~> (q :: k1) infixr 1 Source #
implication
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id ~> (Snd Id >> Len >> Ge 4)) (True,[11,12,13,14])
True TrueT
>>>
pl @(Fst Id ~> (Snd Id >> Len >> Same 4)) (True,[12,11,12,13,14])
False FalseT
>>>
pl @(Fst Id ~> (Snd Id >> Len >> Same 4)) (False,[12,11,12,13,14])
True TrueT
>>>
pl @(Fst Id ~> (Snd Id >> Len >> Ge 4)) (False,[11,12,13,14])
True TrueT
type OrdA' p q = OrdP (Fst Id >> p) (Snd Id >> q) Source #
similar to compare
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id === (Snd Id)) (10,9)
Present GT PresentT GT
>>>
pl @(14 % 3 === Fst Id %- (Snd Id)) (-10,7)
Present GT PresentT GT
>>>
pl @(Fst Id === (Snd Id)) (10,11)
Present LT PresentT LT
>>>
pl @(Snd Id === (Fst Id >> Snd Id >> Head' Id)) (('x',[10,12,13]),10)
Present EQ PresentT EQ
>>>
pl @(Snd Id === Head' (Snd (Fst Id))) (('x',[10,12,13]),10)
Present EQ PresentT EQ
compare two strings ignoring case
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id ===? (Snd Id)) ("abC","aBc")
Present EQ PresentT EQ
>>>
pl @(Fst Id ===? (Snd Id)) ("abC","DaBc")
Present LT PresentT LT
similar to itoList
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(IToList _) ("aBc" :: String)
Present [(0,'a'),(1,'B'),(2,'c')] PresentT [(0,'a'),(1,'B'),(2,'c')]
similar to toList
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @ToList ("aBc" :: String)
Present "aBc" PresentT "aBc"
>>>
pl @ToList (Just 14)
Present [14] PresentT [14]
>>>
pl @ToList Nothing
Present [] PresentT []
>>>
pl @ToList (Left "xx")
Present [] PresentT []
>>>
pl @ToList (These 12 "xx")
Present ["xx"] PresentT ["xx"]
similar to toList
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ToList' Id) ("aBc" :: String)
Present "aBc" PresentT "aBc"
>>>
pl @(ToList' Id) (Just 14)
Present [14] PresentT [14]
>>>
pl @(ToList' Id) Nothing
Present [] PresentT []
>>>
pl @(ToList' Id) (Left "xx")
Present [] PresentT []
>>>
pl @(ToList' Id) (These 12 "xx")
Present ["xx"] PresentT ["xx"]
data IsTh (th :: These x y) p Source #
predicate on These
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(IsThis Id) (This "aBc")
True TrueT
>>>
pl @(IsThis Id) (These 1 'a')
False FalseT
>>>
pl @(IsThese Id) (These 1 'a')
True TrueT
similar to these
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(TheseIn Id Len (Fst Id + Length (Snd Id))) (This 13)
Present 13 PresentT 13
>>>
pl @(TheseIn Id Len (Fst Id + Length (Snd Id))) (That "this is a long string")
Present 21 PresentT 21
>>>
pl @(TheseIn Id Len (Fst Id + Length (Snd Id))) (These 20 "somedata")
Present 28 PresentT 28
>>>
pl @(TheseIn (Left _) (Right _) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (That "this is a long string")
Present Right "this is a long string" PresentT (Right "this is a long string")
>>>
pl @(TheseIn (Left _) (Right _) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (These 1 "this is a long string")
Present Right "this is a long string" PresentT (Right "this is a long string")
>>>
pl @(TheseIn (Left _) (Right _) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (These 100 "this is a long string")
Present Left 100 PresentT (Left 100)
data EmptyList' t Source #
creates an empty list of the given type
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Id :+ EmptyList _) 99
Present [99] PresentT [99]
data Char1 (s :: Symbol) Source #
creates a singleton from a value
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Singleton (Char1 "aBc")) ()
Present "a" PresentT "a"
>>>
pl @(Singleton Id) False
Present [False] PresentT [False]
extracts the first character from a non empty Symbol
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Char1 "aBc") ()
Present 'a' PresentT 'a'
similar to align
thats pads with This
or That
if one list is shorter than the other
the key is that all information about both lists are preserved
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ZipThese (Fst Id) (Snd Id)) ("aBc", [1..5])
Present [These 'a' 1,These 'B' 2,These 'c' 3,That 4,That 5] PresentT [These 'a' 1,These 'B' 2,These 'c' 3,That 4,That 5]
>>>
pl @(ZipThese (Fst Id) (Snd Id)) ("aBcDeF", [1..3])
Present [These 'a' 1,These 'B' 2,These 'c' 3,This 'D',This 'e',This 'F'] PresentT [These 'a' 1,These 'B' 2,These 'c' 3,This 'D',This 'e',This 'F']
Instances
(Show (f y), PP p a ~ f x, PP q a ~ f y, ExtractAFromTA (f x) ~ x, ExtractAFromTA (f y) ~ y, Show (f x), Align f, Show (f (These x y)), P p a, P q a) => P (ZipTheseF p q :: Type) a Source # | |
type PP (ZipTheseF p q :: Type) a Source # | |
Defined in Predicate type PP (ZipTheseF p q :: Type) a = ApplyConstT (PP p a) (These (ExtractAFromTA (PP p a)) (ExtractAFromTA (PP q a))) |
type family ExtractAFromTA (ta :: Type) :: Type where ... Source #
ExtractAFromTA (t a) = a | |
ExtractAFromTA ta = TypeError (Text "ExtractAFromTA: expected (t a) but found something else" :$$: (Text "t a = " :<>: ShowType ta)) |
data Zip (lc :: Bool) (rc :: Bool) p q Source #
Zip two lists optionally cycling the one of the lists to match the size
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Ziplc (Fst Id) (Snd Id)) ("abc", [1..5])
Present [('a',1),('b',2),('c',3),('a',4),('b',5)] PresentT [('a',1),('b',2),('c',3),('a',4),('b',5)]
>>>
pl @(Ziplc (Fst Id) (Snd Id)) ("abcdefg", [1..5])
Present [('a',1),('b',2),('c',3),('d',4),('e',5)] PresentT [('a',1),('b',2),('c',3),('d',4),('e',5)]
>>>
pl @(Ziprc (Fst Id) (Snd Id)) ("abcdefg", [1..5])
Present [('a',1),('b',2),('c',3),('d',4),('e',5),('f',1),('g',2)] PresentT [('a',1),('b',2),('c',3),('d',4),('e',5),('f',1),('g',2)]
Luhn predicate check on last digit
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Luhn Id) [1,2,3,0]
True TrueT
>>>
pl @(Luhn Id) [1,2,3,4]
False FalseT
data ReadBase' t (n :: Nat) p Source #
Read a number base 2 via 36
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ReadBase Int 16) "00feD"
Present 4077 PresentT 4077
>>>
pl @(ReadBase Int 16) "-ff"
Present -255 PresentT (-255)
>>>
pl @(ReadBase Int 2) "10010011"
Present 147 PresentT 147
supports negative numbers unlike readInt
getValidBase :: Int -> String Source #
data ShowBase (n :: Nat) Source #
Display a number at base 2 to 36
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ShowBase 16) 4077
Present "fed" PresentT "fed"
>>>
pl @(ShowBase 16) (-255)
Present "-ff" PresentT "-ff"
>>>
pl @(ShowBase 2) 147
Present "10010011" PresentT "10010011"
supports negative numbers unlike showIntAtBase
data Intercalate p q Source #
Intercalate
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Intercalate '["aB"] '["xxxx","yz","z","www","xyz"]) ()
Present ["xxxx","aB","yz","aB","z","aB","www","aB","xyz"] PresentT ["xxxx","aB","yz","aB","z","aB","www","aB","xyz"]
uses Printf to format output
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Printf "value=%03d" Id) 12
Present "value=012" PresentT "value=012"
splits string into pieces before "%" that way we have a chance of catching any errors
data ParaImpl (n :: Nat) (strict :: Bool) (os :: [k]) Source #
runs values in parallel unlike Do
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Para '[Id,Id + 1,Id * 4]) [10,20,30]
Present [10,21,120] PresentT [10,21,120]
Instances
(TypeError (Text "ParaImpl '[] invalid: requires at least one value in the list") :: Constraint) => P (ParaImpl n strict ([] :: [k]) :: Type) [a] Source # | |
(KnownNat n, GetBool strict, GetLen ps, P p a, P (ParaImpl n strict (p1 ': ps)) [a], PP (ParaImpl n strict (p1 ': ps)) [a] ~ [PP p a], Show a, Show (PP p a)) => P (ParaImpl n strict (p ': (p1 ': ps)) :: Type) [a] Source # | |
(Show (PP p a), KnownNat n, GetBool strict, Show a, P p a) => P (ParaImpl n strict (p ': ([] :: [k])) :: Type) [a] Source # | |
type PP (ParaImpl n strict (p ': (p1 ': ps)) :: Type) [a] Source # | |
type PP (ParaImpl n strict (p ': ([] :: [k])) :: Type) [a] Source # | |
type PP (ParaImpl n strict ([] :: [k]) :: Type) [a] Source # | |
type family GuardsViaParaT prt ps where ... Source #
GuardsViaParaT prt '[] = '[] | |
GuardsViaParaT prt (p ': ps) = Guard prt p ': GuardsViaParaT prt ps |
type GuardsViaPara prt ps = Para (GuardsViaParaT prt ps) Source #
data CaseImpl (n :: Nat) (e :: k0) (ps :: [k]) (qs :: [k1]) (r :: k2) Source #
tries each predicate ps and on the first match runs the corresponding qs but if there is no match on ps then runs the fail case e
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Case (FailS "asdf" >> (Snd Id) >> Unproxy ) '[Lt 4,Lt 10,Same 50] '[Printf "%d is lt4" Id, Printf "%d is lt10" Id, Printf "%d is same50" Id] Id) 50
Present "50 is same50" PresentT "50 is same50"
>>>
pl @(Case (FailS "asdf" >> (Snd Id) >> Unproxy ) '[Lt 4,Lt 10,Same 50] '[Printf "%d is lt4" Id, Printf "%d is lt10" Id, Printf "%d is same50" Id] Id) 9
Present "9 is lt10" PresentT "9 is lt10"
>>>
pl @(Case (FailS "asdf" >> (Snd Id) >> Unproxy ) '[Lt 4,Lt 10,Same 50] '[Printf "%d is lt4" Id, Printf "%d is lt10" Id, Printf "%d is same50" Id] Id) 3
Present "3 is lt4" PresentT "3 is lt4"
>>>
pl @(Case (FailS "asdf" >> (Snd Id) >> Unproxy ) '[Lt 4,Lt 10,Same 50] '[Printf "%d is lt4" Id, Printf "%d is lt10" Id, Printf "%d is same50" Id] Id) 99
Error asdf FailT "asdf"
Instances
(KnownNat n, GetLen ps, P r x, P p (PP r x), P q (PP r x), PP p (PP r x) ~ Bool, Show (PP q (PP r x)), Show (PP r x), P (CaseImpl n e (p1 ': ps) (q1 ': qs) r) x, PP (CaseImpl n e (p1 ': ps) (q1 ': qs) r) x ~ PP q (PP r x)) => P (CaseImpl n e (p ': (p1 ': ps)) (q ': (q1 ': qs)) r :: Type) x Source # | |
(P r x, P q (PP r x), Show (PP q (PP r x)), P p (PP r x), PP p (PP r x) ~ Bool, KnownNat n, Show (PP r x), P e (PP r x, Proxy (PP q (PP r x))), PP e (PP r x, Proxy (PP q (PP r x))) ~ PP q (PP r x)) => P (CaseImpl n e (p ': ([] :: [k])) (q ': ([] :: [k1])) r :: Type) x Source # | |
(TypeError (Text "CaseImpl '[] invalid: lists are both empty") :: Constraint) => P (CaseImpl n e ([] :: [k]) ([] :: [k1]) r :: Type) x Source # | |
(TypeError (Text "CaseImpl '[] invalid: rhs requires at least one value in the list") :: Constraint) => P (CaseImpl n e (p ': ps) ([] :: [k1]) r :: Type) x Source # | |
(TypeError (Text "CaseImpl '[] invalid: lhs requires at least one value in the list") :: Constraint) => P (CaseImpl n e ([] :: [k]) (q ': qs) r :: Type) x Source # | |
type PP (CaseImpl n e (p ': (p1 ': ps)) (q ': (q1 ': qs)) r :: Type) x Source # | |
type PP (CaseImpl n e (p ': ([] :: [k])) (q ': ([] :: [k1])) r :: Type) x Source # | |
type PP (CaseImpl n e ([] :: [k]) ([] :: [k1]) r :: Type) x Source # | |
type PP (CaseImpl n e (p ': ps) ([] :: [k1]) r :: Type) x Source # | |
type PP (CaseImpl n e ([] :: [k]) (q ': qs) r :: Type) x Source # | |
data Case (e :: k0) (ps :: [k]) (qs :: [k1]) (r :: k2) Source #
type Case' (ps :: [k]) (qs :: [k1]) (r :: k2) = Case (Snd Id >> Failp "Case:no match") ps qs r Source #
similar to sequenceA
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Sequence [Just 10, Just 20, Just 30]
Present Just [10,20,30] PresentT (Just [10,20,30])
>>>
pl @Sequence [Just 10, Just 20, Just 30, Nothing, Just 40]
Present Nothing PresentT Nothing
similar to readFile
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ReadFile ".ghci" >> 'Just Id >> Len >> Gt 0) ()
True TrueT
>>>
pl @(FileExists "xyzzy") ()
False FalseT
does the directory exists
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(DirExists ".") ()
True TrueT
does the directory exists
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(DirExists ".") ()
True TrueT
data ReadEnvAll Source #
Instances
P ReadEnvAll a Source # | |
type PP ReadEnvAll a Source # | |
Defined in Predicate |
class GetFHandle (x :: FHandle Symbol) where Source #
Instances
GetFHandle (FStdout :: FHandle Symbol) Source # | |
GetFHandle (FStderr :: FHandle Symbol) Source # | |
(GetMode w, KnownSymbol s) => GetFHandle (FOther s w) Source # | |
data WritefileImpl (hh :: FHandle Symbol) p Source #
Instances
(GetFHandle fh, P p a, PP p a ~ String) => P (WritefileImpl fh p :: Type) a Source # | |
type PP (WritefileImpl fh p :: Type) a Source # | |
Defined in Predicate |
type Appendfile (s :: Symbol) p = WritefileImpl (FOther s WFAppend) p Source #
type Writefile' (s :: Symbol) p = WritefileImpl (FOther s WFWriteForce) p Source #
type Stdout p = WritefileImpl FStdout p Source #
type Stderr p = WritefileImpl FStderr p Source #
data IsFixImpl (cmp :: Ordering) (ignore :: Bool) p q Source #
isInfixOf
isPrefixOf
isSuffixOf
equivalents
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(IsInfixI "abc" "axAbCd") ()
True TrueT
>>>
pl @(IsPrefixI "abc" "aBcbCd") ()
True TrueT
>>>
pl @(IsPrefix "abc" "aBcbCd") ()
False FalseT
>>>
pl @(IsSuffix "bCd" "aBcbCd") ()
True TrueT
prefix infix suffix for strings
similar to <>
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id <> (Snd Id)) ("abc","def")
Present "abcdef" PresentT "abcdef"
runPQ :: (P p a, P q a, MonadEval m) => String -> Proxy p -> Proxy q -> POpts -> a -> m (Either (TT x) (PP p a, PP q a, TT (PP p a), TT (PP q a))) Source #
data TupleListImpl (strict :: Bool) (n :: Nat) Source #
Instances
(Show a, KnownNat n, GetBool strict, TupleListD (ToN n) a, Show (TupleListT (ToN n) a)) => P (TupleListImpl strict n :: Type) [a] Source # | |
type PP (TupleListImpl strict n :: Type) [a] Source # | |
Defined in Predicate |
type TupleListLax (n :: Nat) = TupleListImpl False n Source #
data ReverseTupleN Source #
Instances
(ReverseTupleC tp, Show (ReverseTupleP tp), Show tp) => P ReverseTupleN tp Source # | |
type PP ReverseTupleN tp Source # | |
Defined in Predicate |
Printfn prints
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Printfn "%s %s" Id) ("123",("def",()))
Present "123 def" PresentT "123 def"
>>>
pl @(Printfn "s=%s d=%03d" Id) ("ab",(123,()))
Present "s=ab d=123" PresentT "s=ab d=123"
type PrintfntLax (n :: Nat) s = Printfn s (TupleListLax n) Source #
type Printf3 (s :: Symbol) = Printfn s '(Fst Id, '(Snd Id >> Fst Id, '(Snd Id >> Snd Id, ()))) Source #
type Printf3' (s :: Symbol) = Printfn s (TupleI '[Fst Id, Snd Id >> Fst Id, Snd Id >> Snd Id]) Source #
similar to <$
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id <$ (Snd Id)) ("abc",Just 20)
Present Just "abc" PresentT (Just "abc")
type (*>) p q = q <* p infixl 4 Source #
similar to <*
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id <* (Snd Id)) (Just "abc",Just 20)
Present Just "abc" PresentT (Just "abc")
data p <|> q infixl 3 Source #
similar to <|>
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Fst Id <|> (Snd Id)) (Nothing,Just 20)
Present Just 20 PresentT (Just 20)
>>>
pl @(Fst Id <|> (Snd Id)) (Just 10,Just 20)
Present Just 10 PresentT (Just 10)
>>>
pl @(Fst Id <|> (Snd Id)) (Nothing,Nothing)
Present Nothing PresentT Nothing
similar to extract
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Extract (Nothing,Just 20)
Present Just 20 PresentT (Just 20)
>>>
pl @Extract (Identity 20)
Present 20 PresentT 20
similar to duplicate
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Duplicate (20,"abc")
Present (20,(20,"abc")) PresentT (20,(20,"abc"))
similar to join
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @Join (Just (Just 20))
Present Just 20 PresentT (Just 20)
data Trim' (left :: Bool) (right :: Bool) p Source #
similar to strip
stripStart
stripEnd
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Trim (Snd Id)) (20," abc " :: String)
Present "abc" PresentT "abc"
>>>
import Data.Text (Text)
>>>
pl @(Trim (Snd Id)) (20," abc " :: Text)
Present "abc" PresentT "abc"
>>>
pl @(TrimStart (Snd Id)) (20," abc ")
Present "abc " PresentT "abc "
>>>
pl @(TrimEnd (Snd Id)) (20," abc ")
Present " abc" PresentT " abc"
>>>
pl @(TrimEnd " abc ") ()
Present " abc" PresentT " abc"
>>>
pl @(TrimEnd "") ()
Present "" PresentT ""
>>>
pl @(Trim " ") ()
Present "" PresentT ""
>>>
pl @(Trim "") ()
Present "" PresentT ""
data StripLR (right :: Bool) p q Source #
similar to stripLeft
stripRight
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(StripLeft "xyz" Id) ("xyzHello" :: String)
Present Just "Hello" PresentT (Just "Hello")
>>>
import Data.Text (Text)
>>>
pl @(StripLeft "xyz" Id) ("xyzHello" :: Text)
Present Just "Hello" PresentT (Just "Hello")
>>>
pl @(StripLeft "xyz" Id) "xywHello"
Present Nothing PresentT Nothing
>>>
pl @(StripRight "xyz" Id) "Hello xyz"
Present Just "Hello " PresentT (Just "Hello ")
>>>
pl @(StripRight "xyz" Id) "xyzHelloxyw"
Present Nothing PresentT Nothing
>>>
pl @(StripRight "xyz" Id) ""
Present Nothing PresentT Nothing
>>>
pl @(StripRight "xyz" "xyz") ()
Present Just "" PresentT (Just "")
type StripRight p q = StripLR True p q Source #
data ParaImplN (strict :: Bool) (n :: Nat) p Source #
leverages Para
for repeating predicates (passthrough method)
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(ParaImplN 'True 4 (Succ Id)) [1..4]
Present [2,3,4,5] PresentT [2,3,4,5]
>>>
pl @(ParaLaxN 4 (Succ Id)) "azwxm"
Present "b{xy" PresentT "b{xy"
>>>
pl @(ParaN 4 (Succ Id)) "azwxm"
Error Para: data elements(5) /= predicates(4) FailT "Para: data elements(5) /= predicates(4)"
>>>
pl @(ParaN 4 (Succ Id)) "azwx"
Present "b{xy" PresentT "b{xy"
data GuardsImplN (strict :: Bool) prt (n :: Nat) p Source #
leverages GuardsQuick
for repeating predicates (passthrough method)
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(GuardsN (Printf2 "id=%d must be between 0 and 255, found %d") 4 (Between 0 255)) [121,33,7,256]
Error id=4 must be between 0 and 255, found 256 FailT "id=4 must be between 0 and 255, found 256"
>>>
pl @(GuardsN (Printf2 "id=%d must be between 0 and 255, found %d") 4 (Between 0 255)) [121,33,7,44]
Present [121,33,7,44] PresentT [121,33,7,44]
Instances
(GetBool strict, GetLen (ToGuardsT prt (RepeatT n p)), P (GuardsImpl (LenT (ToGuardsT prt (RepeatT n p))) strict (ToGuardsT prt (RepeatT n p))) [a]) => P (GuardsImplN strict prt n p :: Type) [a] Source # | |
type PP (GuardsImplN strict prt n p :: Type) [a] Source # | |
Defined in Predicate type PP (GuardsImplN strict prt n p :: Type) [a] = PP (GuardsImplW strict (ToGuardsT prt (RepeatT n p))) [a] |
type GuardsLaxN prt (n :: Nat) p = GuardsImplN False prt n p Source #
data Repeat (n :: Nat) p Source #
creates a promoted list of predicates and then evaluates them into a list. see PP instance for '[k]
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(Repeat 4 (Succ Id)) 'c'
Present "dddd" PresentT "dddd"
>>>
pl @(Repeat 4 "abc") ()
Present ["abc","abc","abc","abc"] PresentT ["abc","abc","abc","abc"]
data DoN (n :: Nat) p Source #
leverages Do
for repeating predicates (passthrough method)
same as 'DoN n p' == 'FoldN n p Id' but more efficient
>>>
:set -XTypeApplications
>>>
:set -XDataKinds
>>>
pl @(DoN 4 (Succ Id)) 'c'
Present 'g' PresentT 'g'
>>>
pl @(DoN 4 (Id <> " | ")) "abc"
Present "abc | | | | " PresentT "abc | | | | "
>>>
pl @(DoN 4 (Id <> "|" <> Id)) "abc"
Present "abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc" PresentT "abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc"