h$ӡ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""""""""#############################################################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'% Safe-Inferred4None '(-./<>?R predicate-typedget   from the typelevelpredicate-typed#wrapper for a Show instance around  predicate-typedused by &' and  and  to allow more flexible replacement These parallel the RegexReplacement (not exported) class in Text.Regex.PCRE.Heavy but have overlappable instances which is problematic for this code so I use predicate-typed*extract replacement options from typelevelpredicate-typed'simple regex string replacement optionspredicate-typed2extract the regex options from the type level listpredicate-typed'Regex options for Rescan Resplit Re etcpredicate-typedForce pattern anchoringpredicate-typedCompile automatic callouts | BsrAnycrlf -- R matches only CR, LF, or CrlF | BsrUnicode -- ^ R matches all Unicode line endings predicate-typedDo caseless matching!predicate-typed"dollar not to match newline at end"predicate-typedmatches anything including NL#predicate-typed%Allow duplicate names for subpatterns$predicate-typed Ignore whitespace and # comments%predicate-typed,PCRE extra features (not much use currently)&predicate-typed#Force matching to be before newline'predicate-typedcaret and dollar match newlines within data | NewlineAny -- ^ Recognize any Unicode newline sequence | NewlineAnycrlf -- ^ Recognize CR, LF, and CrlF as newline sequences(predicate-typedSet CR as the newline sequence)predicate-typed Set CrlF as the newline sequence*predicate-typedSet LF as the newline sequence+predicate-typed=Disable numbered capturing parentheses (named ones available),predicate-typed Invert greediness of quantifiers-predicate-typedRun in UTF--8 mode.predicate-typed+Do not check the pattern for UTF-8 validity/predicate-typedget  from the typelevel1predicate-typed"try to convert a list to a n-tuple4predicate-typed extract element 8 from a n-tuple7predicate-typed extract element 7 from a n-tuple:predicate-typed extract element 6 from a n-tuple=predicate-typed extract element 5 from a n-tuple@predicate-typed extract element 4 from a n-tupleCpredicate-typed extract element 3 from a n-tupleFpredicate-typed extract element 2 from a n-tupleIpredicate-typed extract element 1 from a n-tupleVpredicate-typedtype family to extract a from a list of aWpredicate-typedtype family to extract t from t aXpredicate-typedtype family to extract a from t aYpredicate-typedextract i2 part of 5 tuple from the type level for use with (Zpredicate-typedextract fmt2 part of 5 tuple from the type level for use with ([predicate-typedextract op2 part of 5 tuple from the type level for use with (\predicate-typedextract ip2 part of 5 tuple from the type level for use with (]predicate-typedextract opts2 part of 5 tuple from the type level for use with (^predicate-typedextract i2 part of 4 tuple from the type level for use with )_predicate-typedextract op2 part of 4 tuple from the type level for use with )`predicate-typedextract ip2 part of 4 tuple from the type level for use with )apredicate-typedextract opts2 part of 4 tuple from the type level for use with )bpredicate-typedExtract a from a list-like containercpredicate-typed at the type leveldpredicate-typed! at the type level for a list of epredicate-typed'if' at the type levelfpredicate-typed at the type levellpredicate-typedtakes a list of size n, and converts it to an inductive tuple. see  *toITupleListC @4 [10,12,13,1]Right (10,(12,(13,(1,()))))toITupleListC @2 ["ab","cc"]Right ("ab",("cc",()))toITupleListC @10 [10,12,13,1]0Left "toITupleListC: expected exactly 10 values"toITupleListC @2 [10,12,13,1]/Left "toITupleListC: expected exactly 2 values"opredicate-typed3takes an inductive tuple and creates a flat n-tuple*fromITupleC (123,('x',(False,("abc",()))))(123,'x',False,"abc")fromITupleC (123,('x',())) (123,'x')rpredicate-typed9takes a flat n-tuple and creates an inductive tuple. see  +toITupleC (123,'x',False,"abc")(123,('x',(False,("abc",()))))toITupleC (123,'x')(123,('x',()))upredicate-typedlength of a type level listvpredicate-typed-Intersperse a symbol inside a list of symbolsxpredicate-typedRepeat an expression n timesypredicate-typedextract { from the typelevel{predicate-typed"all the ways to compare two valuespredicate-typedget ordering from the typelevelpredicate-typedget  from typelevelpredicate-typed'get the length of a typelevel containergetLen @'["abc","def","g"]3 getLen @'[]0getLen @(9 ':| '[1,2,3])4getLen @('These 9 "Asfs")1getLen @('This 1)0predicate-typedtypelevel boolean Notpredicate-typedtypelevel boolean Orpredicate-typedtypelevel boolean Andpredicate-typed,helper method that fails with msg when Falsepredicate-typed-helper method that fails with a msg when Truepredicate-typedtype level Betweenpredicate-typeddisplay constructor name for predicate-typedshow the type as a stringpredicate-typedboolean implication True ~> FalseFalse True ~> TrueTrueFalse ~> FalseTrue False ~> TrueTruepredicate-typedprime predicate isPrime 7True isPrime 6Falsepredicate-typed prime factorsprimeFactors 100 [2,2,5,5]primeFactors 123[3,41]predicate-typed primes streamtake 10 primeStream[2,3,5,7,11,13,17,19,23,29]predicate-typed similar to 3 but if the list is empty will return an empty listpredicate-typed pretty print predicate-typedshow the kind as a stringpredicate-typedget a Nat from the typelevelnat @1414predicate-typed"gets the Symbol from the typelevel symb @"abc""abc"predicate-typed(compile a regex using type level optionspredicate-typeddisplay regex optionspredicate-typed'convenience method for optional displaypredicate-typeddraw a tree using unicodepredicate-typed?strip ansi characters from a string and print it (for doctests)predicate-typed lenspredicate-typedstrict version of predicate-typedstrict version of predicate-typed4convert a list of at least 12 elements to a 12-tuplepredicate-typed4convert a list of at least 11 elements to a 11-tuplepredicate-typed4convert a list of at least 10 elements to a 10-tuplepredicate-typed2convert a list of at least 9 elements to a 9-tuplepredicate-typed2convert a list of at least 8 elements to a 8-tuplepredicate-typed2convert a list of at least 7 elements to a 7-tuplepredicate-typed2convert a list of at least 6 elements to a 6-tuplepredicate-typed2convert a list of at least 5 elements to a 5-tuplepredicate-typed2convert a list of at least 4 elements to a 4-tuplepredicate-typed2convert a list of at least 3 elements to a 3-tuplepredicate-typed2convert a list of at least 2 elements to a 2-tuple % !"#$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~xvufedcbhgwVXWUTSRQPOMLN/0{|}~yzrstopqlmnijk123a`_^]\[ZYIJKFGHCDE@AB=>?:;<789456% !"#$&'()*+,-. g9 h9 w71None.2;SNone" '(-./25678;<>?xpredicate-typed9contains the untyped result from evaluating an expressionpredicate-typedevaluation failedpredicate-typedFalse predicatepredicate-typedTrue predicatepredicate-typed Any valuepredicate-typeduntyped child node for predicate-typed)holds the result of running the predicatepredicate-typed*optional strings to include in the resultspredicate-typed7contains the typed result from evaluating an expressionpredicate-typedsemigroup for ValPTrueP <> FalseP <> ValPFalsePValP <> TrueP <> FalsePFalsePValP <> TrueP <> ValPTrueP/FailP "abc" <> (TrueP <> FalseP) <> FailP "def"FailP "abc | def"1(FailP "abc" <> TrueP) <> (FalseP <> FailP "def")FailP "abc | def",FailP "" <> (TrueP <> FalseP) <> FailP "def" FailP "def"&FailP "abc" <> FailP "" <> FailP "def"FailP "abc | def")FailP "abc" <> FailP "xyz" <> FailP "def"FailP "abc | xyz | def"predicate-typed instance for Valreads @(Val Int) "Val 123"[(Val 123,"")]!reads @(Val Bool) "Val False abc"[(Val False," abc")]/reads @(Val Bool) "Fail \"some error message\"" [(Fail "some error message","")]1reads @(Val Double) "Fail \"some error message\"" [(Fail "some error message","")]typed tree holding the results of evaluating a type level expressionpredicate-typedmonoid instance for mempty :: Val (Maybe [Int]) Val Nothing%import qualified Data.Semigroup as SGmempty :: SG.Sum IntSum {getSum = 0}predicate-typedsemigroup instance for Val 123 <> (Val 456 <> Val 789) == (Val 123 <> Val 456) <> Val 789TrueVal True <> Val False Val FalseVal True <> Val TrueVal True3Fail "abc" <> (Val True <> Val False) <> Fail "def"Fail "abc | def"5(Fail "abc" <> Val True) <> (Val False <> Fail "def")Fail "abc | def"0Fail "" <> (Val True <> Val False) <> Fail "def" Fail "def"#Fail "abc" <> Fail "" <> Fail "def"Fail "abc | def"Val False <> (Val True <> Val False) == (Val False <> Val True) <> Val FalseTruepredicate-typedmconcat  options at the type levelx = getOpt @(OptT '[ 'OMsg "test", 'ORecursion 123, OU, OL, 'OMsg "field2"])oMsg x["test","field2"] oRecursion x123predicate-typed#option synonyms to save a keystrokepredicate-typed"extract options from the typelevelpredicate-typedDisplay optionspredicate-typedmemptypredicate-typedset display widthpredicate-typed>set text to add context to a failure message for refined typespredicate-typed set recursion limit eg for regexpredicate-typedset effects for messagespredicate-typedmappendpredicate-typedset color palettepredicate-typedturn on colorspredicate-typedturn off colorspredicate-typed ansi displaypredicate-typedunicode displaypredicate-typeddebug mode return nothingpredicate-typeddebug mode return one linepredicate-typeddebug mode normalpredicate-typeddebug mode verbosepredicate-typedcomposite: no messagespredicate-typedcomposite: lite versionpredicate-typedcomposite: ansi + colorspredicate-typed%composite: ansi + colors + backgroundpredicate-typedcomposite: ansi + no colorspredicate-typed"composite: ansi + colors + verbosepredicate-typed%composite: ansi + no colors + verbosepredicate-typedcomposite: unicode + colorspredicate-typed(composite: unicode + colors + backgroundpredicate-typedcomposite: unicode + no colorspredicate-typed%composite: unicode + colors + verbosepredicate-typed(composite: unicode + no colors + verbosepredicate-typed.a typeclass for choosing which monad to run in hasIO @IOTruehasIO @IdentityFalsepredicate-typedcolor palettespredicate-typed.how much detail to show in the expression treepredicate-typed(one line summary used mainly for testingpredicate-typedone line summary with additional context from the top of the evaluation treepredicate-typed4outputs the evaluation tree but skips noisy subtreespredicate-typed"outputs the entire evaluation treepredicate-typeddisplay format for the treepredicate-typeddraw normal treepredicate-typed use unicodepredicate-typed7customizable options for running a typelevel expressionpredicate-typedlength of data to display for predicate-typed debug levelpredicate-typed1display the tree using the normal tree or unicodepredicate-typedcolor palette usedpredicate-typedmessages associated with typepredicate-typed max recursionpredicate-typedother message effectspredicate-typed no colorspredicate-typed#final set of options using Identitypredicate-typed&creates a Node for the evaluation treepredicate-typed&creates a Node for the evaluation treepredicate-typedfix the ! value for the Bool case: ie use  and fixTTBool (TT ValP (Val True) "x" []) == TT TrueP (Val True) "x" []TruefixTTBool (TT FalseP (Fail "abc") "x" []) == TT (FailP "abc") (Fail "abc") "x" []Truepredicate-typed+creates a Boolean node for a predicate typepredicate-typed(convenience method to pull parts out of predicate-typed5convenience method to pull out the return value from predicate-typed4converts a typed tree to an untyped tree for displaypredicate-typeddecorate the tree with more detail when there are errors but inline the error nodepredicate-typeddefault optionspredicate-typedverbose debug flagpredicate-typed9more restrictive: only display data in verbose debug modepredicate-typedextract values from the trees or if there are errors return a tree with contextpredicate-typedrender  value with colorspredicate-typed display treepredicate-typedextract message part from treepredicate-typedrender numbered treepredicate-typed prefix text in front of ttStringpredicate-typedtraversal for DVerbosehas _DVerbose (getOpt @OU)Falsehas _DVerbose (getOpt @OUV)Truepredicate-typedconvert typelevel options to (oDisp &&& fst . oColor &&& oWidth) (getOpt @(OA ':# OU ':# OA ':# 'OWidth 321 ':# Color4 ':# 'OMsg "test message"))(Ansi,("color4",321)),oMsg (getOpt @('OMsg "abc" ':# 'OMsg "def")) ["abc","def"]oOther (getOpt @('OOther 'False 'Red 'White ':# 'OOther 'True 'Red 'Black))(True,Red,Black)#a = show (getOpt @('OEmpty ':# OU))$b = show (getOpt @(OU ':# 'OEmpty));c = show (getOpt @OU) a==b && b==cTruepredicate-typed&deal with possible recursion on a listpredicate-typed)deal with possible recursion on two listspredicate-typedpretty print a messagepredicate-typedoverride options for " so we dont lose error informationpredicate-typed?render a string for messages using optional color and underlinepredicate-typed"def") +++ (show . succ)) Fail "abcdef"2Right 1.2 & from _ValEither %~ fmap (show . (*10)) Right "12.0"Val True ^. _ValEither Right TrueFail "abc" ^. _ValEither Left "abc"Left "abc" ^. from _ValEither Fail "abc"_ValEither # Right False Val False0[Just (Val 'x')] ^. mapping (mapping _ValEither)[Just (Right 'x')](Just (Fail "abcd") ^. mapping _ValEitherJust (Left "abcd")predicate-typedlens that keeps  in sync with  for TT Bool(TT ValP (Val True) "xxx" [] & ttValBool %~ \b -> fmap not b) == TT FalseP (Val False) "xxx" []True(TT ValP (Val True) "xxx" [] & ttValBool .~ Fail "abc") == TT (FailP "abc") (Fail "abc") "xxx" []True(TT ValP (Val True) "xxx" [] & ttValBool %~ id) == TT TrueP (Val True) "xxx" []True(TT FalseP (Val True) "xxx" [] & ttValBool %~ id) == TT TrueP (Val True) "xxx" []Truepredicate-typed lens from  to  that also keeps  in sync with (TT FalseP (Val True) "xxx" [] & ttVal %~ id) == TT ValP (Val True) "xxx" []True(TT FalseP (Val 123) "xxx" [] & ttVal .~ Fail "aa") == TT (FailP "aa") (Fail "aa") "xxx" []True(TT (FailP "sdf") (Val 123) "xxx" [] & ttVal %~ fmap show) == TT ValP (Val "123") "xxx" []Truepredicate-typed monoid optspredicate-typed' instance for evaluating the expressionpredicate-typed' instance for evaluating the expressionpredicate-typed set underlinepredicate-typedset foreground colorpredicate-typedset background color predicate-typedname of color palettepredicate-typedFail foreground colorpredicate-typedFail background colorpredicate-typedFalse foreground colorpredicate-typedFalse background colorpredicate-typedTrue foreground colorpredicate-typedTrue background colorpredicate-typedPresent foreground colorpredicate-typedPresent background color  6None ./>?ގpredicate-typed6third element in a tuple followed by the third elementpz @L33 (1,2,('c',4,False)) Val Falsepredicate-typed7third element in a tuple followed by the second elementpz @L32 (1,2,('c',4))Val 4predicate-typed6third element in a tuple followed by the first elementpz @L31 (1,2,('c',4))Val 'c'predicate-typed7second element in a tuple followed by the third elementpz @L23 ('x',(10,"ss",4.5),2)Val 4.5predicate-typed8second element in a tuple followed by the second elementpz @L22 ('z',(10,"ss",4.5),2)Val "ss"predicate-typed7second element in a tuple followed by the first elementpz @L21 ('x',(10,"ss",4.5),2)Val 10predicate-typed6first element in a tuple followed by the third elementpz @L13 ((10,"ss",4.5),2)Val 4.5predicate-typed7first element in a tuple followed by the second elementpz @L12 ((10,"ss"),2)Val "ss"predicate-typed6first element in a tuple followed by the first elementpz @L11 ((10,"ss"),2)Val 10predicate-typed similar to ,-.pz @(Coerce (SG.Sum Integer)) (Identity (-13))Val (Sum {getSum = -13})pl @(Coerce SG.Any) True?Present Any {getAny = True} (Coerce Any {getAny = True} | True)Val (Any {getAny = True})pl @(Coerce Bool) (SG.Any True)0Present True (Coerce True | Any {getAny = True})Val Truepz @(Proxy 'True >> Coerce (Proxy 'False)) () ^!? acts . _Val . to typeRep Just 'Falsepz @(Proxy Int >> Coerce (Proxy (String,Char))) () ^!? acts . _Val . to typeRepJust ([Char],Char)import qualified GHC.Exts as GEpz @(Proxy GE.Any >> Coerce (Proxy Int)) () ^!? acts . _Val . to typeRepJust Intpz @(Proxy '(_,_) >> Coerce (Proxy '(Float,Int))) () ^!? acts . _Val . to typeRepJust ('(,) * * Float Int)predicate-typed similar to pz @(Pure Maybe Id) 4 Val (Just 4)pz @(Pure [] Id) 4Val [4](pz @(Pure (Either String) Fst) (13,True)Val (Right 13)pl @(Pure Maybe Id) 'x'&Present Just 'x' (Pure Just 'x' | 'x')Val (Just 'x')pl @(Pure (Either _) Id) 'x'(Present Right 'x' (Pure Right 'x' | 'x')Val (Right 'x')$pl @(Pure (Either _) Id >> Swap) 'x'>Present Left 'x' ((>>) Left 'x' | {Swap Left 'x' | Right 'x'})Val (Left 'x')%pl @(Pure (Either ()) Id >> Swap) 'x'>Present Left 'x' ((>>) Left 'x' | {Swap Left 'x' | Right 'x'})Val (Left 'x'))pl @(Pure (Either String) Id >> Swap) 123>Present Left 123 ((>>) Left 123 | {Swap Left 123 | Right 123})Val (Left 123)predicate-typed similar to + for expressions taking exactly on argument.pl @(Id & L1 & Singleton & Length) (13,"xyzw")Present 1 (Length 1 | [13])Val 1pl @(2 & (&&&) "abc") ()Present ("abc",2) ('("abc",2)) Val ("abc",2)pl @(2 & '(,) "abc") ()Present ("abc",2) ('("abc",2)) Val ("abc",2)pl @('(,) 4 $ '(,) 7 $ "aa") ()$Present (4,(7,"aa")) ('(4,(7,"aa")))Val (4,(7,"aa"))+pl @(L3 $ L2 $ Fst) ((1,("X",9,'a')),(3,4))#Present 'a' (Thd 'a' | ("X",9,'a'))Val 'a'predicate-typedlike ./ for expressions taking exactly on argument ie this doesnt work: pz @('(,) $ 4 $ 'True) () pl @(L1 $ L2 $ Id) ((1,2),(3,4))Present 3 (Fst 3 | (3,4))Val 3)pl @((<=) 4 $ L1 $ L2 $ Id) ((1,2),(3,4))False (4 <= 3) Val Falsepz @('(,) 4 $ 'True) () Val (4,True)predicate-typed swaps using  pz @Swap (Left 123)Val (Right 123)pz @Swap (Right 123)Val (Left 123)pz @Swap (These 'x' 123)Val (These 123 'x')pz @Swap (This 'x')Val (That 'x')pz @Swap (That 123)Val (This 123)pz @Swap (123,'x') Val ('x',123)pz @Swap (Left "abc")Val (Right "abc")pz @Swap (Right 123)Val (Left 123)pl @Swap (Right "asfd")5Present Left "asfd" (Swap Left "asfd" | Right "asfd")Val (Left "asfd")pl @Swap (12,"asfd")4Present ("asfd",12) (Swap ("asfd",12) | (12,"asfd"))Val ("asfd",12)pz @Swap (True,12,"asfd")Val (True,"asfd",12)predicate-typedboolean implication3pz @(Fst ~> (Length Snd >= 4)) (True,[11,12,13,14])Val True6pz @(Fst ~> (Length Snd == 4)) (True,[12,11,12,13,14]) Val False7pz @(Fst ~> (Length Snd == 4)) (False,[12,11,12,13,14])Val True4pz @(Fst ~> (Length Snd >= 4)) (False,[11,12,13,14])Val Truepredicate-typed#short circuit version of boolean Or!pl @(Id > 10 ||~ FailT _ "ss") 11True (True ||~ _ | (11 > 10))Val Truepz @(Id > 10 ||~ Id == 9) 9Val Truepl @(Id > 10 ||~ Id > 9) 9.False (False ||~ False | (9 > 10) ||~ (9 > 9)) Val Falsepredicate-typed similar to 4pz @(Fst || (Length Snd >= 4)) (False,[11,12,13,14])Val True:pz @(Not Fst || (Length Snd == 4)) (True,[12,11,12,13,14]) Val Falsepredicate-typed$short circuit version of boolean And pl @(Id > 10 &&~ FailT _ "ss") 9False (False &&~ _ | (9 > 10)) Val Falsepl @(Id > 10 &&~ Id == 12) 11#False (True &&~ False | (11 == 12)) Val Falsepl @(Id > 10 &&~ Id == 11) 11True (True &&~ True)Val Truepredicate-typed similar to pz @(Fst && Snd) (True, True)Val Truepz @(Id > 15 && Id < 17) 16Val Truepz @(Id > 15 && Id < 17) 30 Val False3pz @(Fst && (Length Snd >= 4)) (True,[11,12,13,14])Val True6pz @(Fst && (Length Snd == 4)) (True,[12,11,12,13,14]) Val Falsepredicate-typedprocesses a type level list predicates running each in sequence with infixl: see &0.pz @(DoL [Pred, ShowP Id, Id &&& Len]) 9876543Val ("9876542",7)pz @(DoL [2,3,4]) ()Val 4pl @(DoL '[4,5,6]) ()Present 6 ((>>) 6 | {'6})Val 6predicate-typedprocesses a type level list predicates running each in sequence with infixr: see &0-pz @(Do [Pred, ShowP Id, Id &&& Len]) 9876543Val ("9876542",7):pz @(Do '[W 123, W "xyz", Len &&& Id, Pred *** Id<>Id]) ()Val (2,"xyzxyz");pl @(Do '[Succ,Id,ShowP Id,Ones,Map (ReadBase Int 8)]) 1239Present [1,2,4,0] ((>>) [1,2,4,0] | {Map [1,2,4,0] | ["1","2","4","0"]}) Val [1,2,4,0];pl @(Do '[Pred,Id,ShowP Id,Ones,Map (ReadBase Int 8)]) 1239.Error invalid base 8 (Map(i=3, a="8") excnt=1)Fail "invalid base 8"pl @(Do '[4,5,6]) ()Present 6 ((>>) 6 | {'6})Val 6+pl @(Do '["abc", "Def", "ggg", "hhhhh"]) ()+Present "hhhhh" ((>>) "hhhhh" | {'"hhhhh"}) Val "hhhhh"pl @(Do '[ 'LT, 'EQ, 'GT ]) ()Present GT ((>>) GT | {'GT})Val GT$pl @(Do '[4 % 4,22 % 1 ,12 -% 4]) ()>) (-3) % 1 | {Negate (-3) % 1 | 3 % 1})Val ((-3) % 1)pl @(Do '[1,2,3]) ()Present 3 ((>>) 3 | {'3})Val 3predicate-typed similar to pz @(Map Pred) [1..5]Val [0,1,2,3,4]predicate-typed similar to  for foldablepz @(Map' Pred Id) [1..5]Val [0,1,2,3,4]predicate-typed#similar to 8th element in a n-tuple-pz @(L8 Id) (10,"Abc",'x',True,1,99,True,'a')Val 'a'predicate-typed#similar to 7th element in a n-tuple(pz @(L7 Id) (10,"Abc",'x',True,1,99,'a')Val 'a'predicate-typed#similar to 6th element in a n-tuple$pz @(L6 Id) (10,"Abc",'x',True,1,99)Val 99predicate-typed#similar to 5th element in a n-tuple!pz @(L5 Id) (10,"Abc",'x',True,1)Val 1predicate-typed#similar to 4th element in a n-tuplepz @(L4 Id) (10,"Abc",'x',True)Val True0pz @(L4 L21) ('x',((10,"Abc",'x',999),"aa",1),9)Val 999$pl @(L4 Id) (99,'a',False,"someval");Present "someval" (L4 "someval" | (99,'a',False,"someval")) Val "someval"predicate-typed#similar to 3rd element in a n-tuplepz @Thd (10,"Abc",133)Val 133pz @Thd (10,"Abc",133,True)Val 133pl @Thd (99,'a',False,1.3).Present False (Thd False | (99,'a',False,1.3)) Val Falsepredicate-typed#similar to 3rd element in a n-tuplepredicate-typed similar to pz @Snd (10,"Abc") Val "Abc"pz @Snd (10,"Abc",True) Val "Abc"pl @Snd (99,'a',False,1.3)*Present 'a' (Snd 'a' | (99,'a',False,1.3))Val 'a'predicate-typed similar to predicate-typed similar to pz @Fst (10,"Abc")Val 10pz @Fst (10,"Abc",'x')Val 10pz @Fst (10,"Abc",'x',False)Val 10pl @Fst (99,'a',False,1.3)(Present 99 (Fst 99 | (99,'a',False,1.3))Val 99predicate-typed similar to predicate-typed similar to pl @(Any Even) [1,5,11,5,3]False (Any(5)) Val Falsepl @(Any Even) [1,5,112,5,3]True (Any(5) i=2 (0 == 0))Val Truepz @(Any Even) [] Val False*pl @(Fst >> Any (Gt 3)) ([10,12,3,5],"ss")(True ((>>) True | {Any(4) i=0 (10 > 3)})Val Truepl @(Any (Same 2)) [1,4,5]False (Any(3)) Val Falsepl @(Any (Same 2)) [1,4,5,2,1]True (Any(5) i=3 (2 == 2))Val Truepredicate-typed similar to ,pl @(All (Between 1 8 Id)) [7,3,4,1,2,9,0,1]False (All(8) i=5 (9 <= 8)) Val Falsepz @(All Odd) [1,5,11,5,3]Val Truepz @(All Odd) []Val True"run @OANV @(All Even) [1,5,11,5,3]4False All(5) i=0 (1 == 0)|+- False i=0: 1 == 0| || +- P 1 `mod` 2 = 1| | || | +- P Id 1| | | | | `- P '2| | | `- P '0|+- False i=1: 1 == 0| || +- P 5 `mod` 2 = 1| | || | +- P Id 5| | | | | `- P '2| | | `- P '0|+- False i=2: 1 == 0| || +- P 11 `mod` 2 = 1| | || | +- P Id 11| | | | | `- P '2| | | `- P '0|+- False i=3: 1 == 0| || +- P 5 `mod` 2 = 1| | || | +- P Id 5| | | | | `- P '2| | | `- P '0|`- False i=4: 1 == 0 | +- P 3 `mod` 2 = 1 | | | +- P Id 3 | | | `- P '2 | `- P '0 Val False*pl @(Fst >> All (Gt 3)) ([10,12,3,5],"ss"))False ((>>) False | {All(4) i=2 (3 > 3)}) Val Falsepl @(All (Lt 3)) [1 .. 10]False (All(10) i=2 (3 < 3)) Val Falsepredicate-typed=A operator predicate that determines if the value is between p and qpz @(5 <..> 8) 6Val Truepz @(10 % 4 <..> 40 % 5) 4Val Truepz @(10 % 4 <..> 40 % 5) 33 Val Falsepl @(Negate 7 <..> 20) (-4)True (-7 <= -4 <= 20)Val Truepl @(Negate 7 <..> 20) 21False (21 <= 20) Val Falsepredicate-typed4A predicate that determines if the value is between p and q%pz @(Between 5 8 Len) [1,2,3,4,5,5,7]Val Truepl @(Between 5 8 Id) 9False (9 <= 8) Val False#pl @(Between L11 L12 Snd) ((1,4),3)True (1 <= 3 <= 4)Val True$pl @(Between L11 L12 Snd) ((1,4),10)False (10 <= 4) Val Falsepredicate-typed(gets the singleton value from a foldablepl @OneP [10..15]"Error OneP:expected one element(6)#Fail "OneP:expected one element(6)" pl @OneP [10]Present 10 (OneP)Val 10 pl @OneP []&Error OneP:expected one element(empty)'Fail "OneP:expected one element(empty)"pl @OneP (Just 10)Present 10 (OneP)Val 10pl @OneP Nothing&Error OneP:expected one element(empty)'Fail "OneP:expected one element(empty)"predicate-typedFails the computation with a message where the input value is a Proxy pz @(Ix 3 (FailP "oops")) "abcd"Val 'd'pz @(Ix 3 (FailP "oops")) "abc" Fail "oops"predicate-typed8Fails the computation with a message (wraps the type in )+pz @(FailT Int (PrintF "value=%03d" Id)) 99Fail "value=099"predicate-typedFails the computation with a message for simple failures: doesnt preserve types>pz @(FailS (PrintT "value=%03d string=%s" Id)) (99,"somedata") Fail "value=099 string=somedata"predicate-typedFails the computation with a message but allows you to set the output type5pz @('False || (Fail 'True "failed")) (99,"somedata") Fail "failed";pz @('False || (Fail (Hole Bool) "failed")) (99,"somedata") Fail "failed"8pz @('False || (Fail (Hole _) "failed")) (99,"somedata") Fail "failed"predicate-typed function on a boolean$pz @('[ 'True] >> Head >> IdBool) ()Val Truepz @(Fst >> IdBool) (False,22) Val Falsepl @(Head >> IdBool) [True]True ((>>) True | {IdBool})Val Truepan @(Head >> Id) [True] P (>>) True|+- P Head True| `- P Id TrueVal Truepan @(Head >> IdBool) [True]True (>>) True|+- P Head True|`- True IdBoolVal Truepredicate-typed functionpz @(Not Id) FalseVal Truepz @(Not Id) True Val Falsepz @(Not Fst) (True,22) Val Falsepl @(Not (Lt 3)) 13True (Not (13 < 3))Val Truepl @(Not 'True) ()False (Not ('True)) Val Falsepredicate-typed similar to  for  instancespz @(Length Id) (Left "aa")Val 0pz @(Length Id) (Right "aa")Val 1"pz @(Length Right') (Right "abcd")Val 4/pz @(Length L23) (True,(23,'x',[10,9,1,3,4,2]))Val 6predicate-typed similar to pz @Len [10,4,5,12,3,4]Val 6 pz @Len []Val 0pz @(Pairs >> Len > 2) "abcdef"Val Truepredicate-typed"used internally for type inference8pz @(FromIntegral' (Proxy (SG.Sum _) >> UnproxyT) 23) ()Val (Sum {getSum = 23})pz @(FromIntegral' (Hole (SG.Sum _)) 23) () -- equivalent to Proxy UnproxyT aboveVal (Sum {getSum = 23})predicate-typedwraps a value (see  and )pz @(Wrap (SG.Sum _) Id) (-13)Val (Sum {getSum = -13})pz @(Wrap SG.Any (Ge 4)) 13Val (Any {getAny = True})(import Data.List.NonEmpty (NonEmpty(..))3pz @(Wrap (NonEmpty _) (Uncons >> 'Just Id)) "abcd"Val ('a' :| "bcd")pl @(Wrap (SG.Sum _) Id) 137Present Sum {getSum = 13} (Wrap Sum {getSum = 13} | 13)Val (Sum {getSum = 13})*pl @(Wrap (SG.Sum _) Id >> STimes 4 Id) 13Present Sum {getSum = 52} ((>>) Sum {getSum = 52} | {getSum = 13})Val (Sum {getSum = 52})&pl @(Wrap _ 13 <> Id) (SG.Sum @Int 12)Present Sum {getSum = 25} (Sum {getSum = 13} <> Sum {getSum = 12} = Sum {getSum = 25})Val (Sum {getSum = 25})predicate-typed similar to  where t points to the typepredicate-typedunwraps a value (see )pz @Unwrap (SG.Sum (-13)) Val (-13)(pl @(Unwrap >> '(Id, 'True)) (SG.Sum 13)1Present (13,True) ((>>) (13,True) | {'(13,True)}) Val (13,True)predicate-typedflipped version of predicate-typedinfixl version of predicate-typedcompose expressions#pz @(L11 >> Not Id) ((True,12),'x') Val False(pz @(L12 >> Succ >> Dup) ((True,12),'x') Val (13,13)(pz @(10 >> '(Id,"abc") >> Second Len) () Val (10,3)predicate-typed.override the display width for the expression ppredicate-typedActs as a proxy for a Type.predicate-typedrun the expression p but remove the subtreespredicate-typed9add a message to give more context to the evaluation tree#pan @(MsgI "[somemessage] " Id) 999P [somemessage] Id 999Val 999"pan @(MsgI Id 999) "info message:"P info message:'999Val 999predicate-typed9add a message to give more context to the evaluation tree!pan @(Msg "[somemessage]" Id) 999P [somemessage] Id 999Val 999!pan @(Msg Id 999) "info message:"P info message: '999Val 999predicate-typed-transparent wrapper to turn kind k into kind  eg useful for putting in a promoted list (cant mix kinds) see pz @'[W 123, Id] 99 Val [123,99]%pz @'[W "abc", W "def", Id, Id] "ghi"Val ["abc","def","ghi","ghi"]predicate-typedidentity function that also displays the type information for debugging pz @IdT 23Val 23predicate-typedidentity function pz @Id 23Val 23predicate-typedThis is the core class. Each instance of this class can be combined into a dsl using predicate-typedA specialised form of  that works only on predicatespredicate-typedA specialised form of 7 that returns the result or the error string on failurepredicate-typed:skips the evaluation tree and just displays the end result(evaluate the type level expression in IO.pl @(Between 4 10 Id) 7 & mapped . _Val %~ notTrue (4 <= 7 <= 10) Val Falseeval (Proxy @'True) defOpts 7 & mapped . ttValBool . _Val %~ notTT {_ttValP = FalseP, _ttVal = Val False, _ttString = "'True", _ttForest = []}predicate-typedsame as # but adds context to the end result(evaluate the type level expression in IO.pl @(Between 4 10 Id) 7 & mapped . _Val %~ notTrue (4 <= 7 <= 10) Val Falseeval (Proxy @'True) defOpts 7 & mapped . ttValBool . _Val %~ notTT {_ttValP = FalseP, _ttVal = Val False, _ttString = "'True", _ttForest = []}predicate-typed9displays the evaluation tree in plain text without colors(evaluate the type level expression in IO.pl @(Between 4 10 Id) 7 & mapped . _Val %~ notTrue (4 <= 7 <= 10) Val Falseeval (Proxy @'True) defOpts 7 & mapped . ttValBool . _Val %~ notTT {_ttValP = FalseP, _ttVal = Val False, _ttString = "'True", _ttForest = []}predicate-typeddisplays the evaluation tree in plain text without colors and verbose(evaluate the type level expression in IO.pl @(Between 4 10 Id) 7 & mapped . _Val %~ notTrue (4 <= 7 <= 10) Val Falseeval (Proxy @'True) defOpts 7 & mapped . ttValBool . _Val %~ notTT {_ttValP = FalseP, _ttVal = Val False, _ttString = "'True", _ttForest = []}predicate-typeddisplays the evaluation tree using colors without background colors(evaluate the type level expression in IO.pl @(Between 4 10 Id) 7 & mapped . _Val %~ notTrue (4 <= 7 <= 10) Val Falseeval (Proxy @'True) defOpts 7 & mapped . ttValBool . _Val %~ notTT {_ttValP = FalseP, _ttVal = Val False, _ttString = "'True", _ttForest = []}predicate-typed4displays the evaluation tree using background colors(evaluate the type level expression in IO.pl @(Between 4 10 Id) 7 & mapped . _Val %~ notTrue (4 <= 7 <= 10) Val Falseeval (Proxy @'True) defOpts 7 & mapped . ttValBool . _Val %~ notTT {_ttValP = FalseP, _ttVal = Val False, _ttString = "'True", _ttForest = []}predicate-typed and verbose(evaluate the type level expression in IO.pl @(Between 4 10 Id) 7 & mapped . _Val %~ notTrue (4 <= 7 <= 10) Val Falseeval (Proxy @'True) defOpts 7 & mapped . ttValBool . _Val %~ notTT {_ttValP = FalseP, _ttVal = Val False, _ttString = "'True", _ttForest = []}predicate-typed6display the evaluation tree using unicode and colors  pu '(Id, "abc", 123) [1..4] @(evaluate the type level expression in IO.pl @(Between 4 10 Id) 7 & mapped . _Val %~ notTrue (4 <= 7 <= 10) Val Falseeval (Proxy @'True) defOpts 7 & mapped . ttValBool . _Val %~ notTT {_ttValP = FalseP, _ttVal = Val False, _ttString = "'True", _ttForest = []}predicate-typeddisplays the evaluation tree using unicode and colors with background colors(evaluate the type level expression in IO.pl @(Between 4 10 Id) 7 & mapped . _Val %~ notTrue (4 <= 7 <= 10) Val Falseeval (Proxy @'True) defOpts 7 & mapped . ttValBool . _Val %~ notTT {_ttValP = FalseP, _ttVal = Val False, _ttString = "'True", _ttForest = []}predicate-typed and verbose(evaluate the type level expression in IO.pl @(Between 4 10 Id) 7 & mapped . _Val %~ notTrue (4 <= 7 <= 10) Val Falseeval (Proxy @'True) defOpts 7 & mapped . ttValBool . _Val %~ notTT {_ttValP = FalseP, _ttVal = Val False, _ttString = "'True", _ttForest = []}predicate-typedevaluate a typelevel expression (use type applications to pass in the options and the expression)run @OZ @Id 123Val 1234run @('OMsg "field1" ':# OL) @('Left Id) (Right 123)"field1 >>> Error 'Left found RightFail "'Left found Right"run @(OptT '[ 'OMsg "test", OU, 'OEmpty, OL, 'OMsg "field2"]) @(FailT _ "oops") ()test | field2 >>> Error oops Fail "oops"predicate-typed.run expression with multiple options in a list1runs @'[OL, 'OMsg "field2"] @'( 'True, 'False) ()/field2 >>> Present (True,False) ('(True,False))Val (True,False)runs @'[ 'OMsg "test", OU, 'OEmpty, OL, 'OMsg "field2"] @(FailT _ "oops") ()test | field2 >>> Error oops Fail "oops"predicate-typed-convenience method to evaluate one expressionpredicate-typedconvenience method to evaluate two expressions using the same input and return the resultspredicate-typedconvenience method to evaluate two boolean expressions using the same input and return the resultspredicate-typedevaluate a boolean expressions but hide the results unless verbosepredicate-typed:evaluate a expressions but hide the results unless verbosepredicate-typedfor use with TH.Lift in a splice. returns a pure value or fails with a treepredicate-typedrun a type level computation and returns the value or a tree with the errorpredicate-typed'converts the type to the corresponding +pz @'Proxy 'x' ^!? acts . _Val . to typeRep Just Char*pz @'Proxy 45 ^!? acts . _Val . to typeRep Just Integer-pz @'Proxy "abc" ^!? acts . _Val . to typeRep Just [Char]&pz @(Pop1' (Proxy ToEnum) 'Proxy 2) LTVal GTpredicate-typed#extracts the (a,b) from type level  These a b if the value exists$pz @('These Id Id) (These 123 "abc")Val (123,"abc")%pz @('These Id 5) (These 123 "abcde") Val (123,5)pz @('These Id Id) (This "aaa")Fail "'These found This"pz @('These Id Id) (That "aaa")Fail "'These found That"predicate-typed extracts the b from type level  These a b if the value existspz @('That Id) (That 123)Val 123pz @('That Id) (This "aaa")Fail "'That found This"pz @('That Id) (These 44 "aaa")Fail "'That found These"predicate-typed extracts the a from type level  These a b if the value existspl @('This Id) (This 12)Present 12 (This)Val 12pz @('This Id) (That "aaa")Fail "'This found That" pz @('This Id) (These 999 "aaa")Fail "'This found These"pl @('This Id) (That 12)Error 'This found ThatFail "'This found That"predicate-typed extracts the b from type level  Either a b if the value existspl @('Right Id) (Right 123)Present 123 (Right)Val 123(pz @('Right Id >> Snd) (Right ('x',123))Val 123pz @('Right Id) (Left "aaa")Fail "'Right found Left"pl @('Right Id) (Left 123)Error 'Right found LeftFail "'Right found Left"predicate-typed extracts the a from type level  Either a b if the value existspz @('Left Id) (Left 123)Val 123pz @('Left Snd) ('x', Left 123)Val 123pz @('Left Id) (Right "aaa")Fail "'Left found Right"pl @('Left Id) (Left 123)Present 123 (Left)Val 123pl @('Left Id) (Right 123)Error 'Left found RightFail "'Left found Right"predicate-typedexpects Nothing otherwise it fails if the value is Nothing then it returns Proxy a" as this provides type informationpz @'Nothing Nothing Val Proxypz @'Nothing (Just True)Fail "'Nothing found Just"predicate-typedtries to extract a from Maybe a otherwise it fails: similar to 12pz @('Just Id) (Just "abc") Val "abc"pl @('Just Id >> Id) (Just 123)!Present 123 ((>>) 123 | {Id 123})Val 123pl @('Just Id) (Just [1,2,3]).Present [1,2,3] ('Just [1,2,3] | Just [1,2,3]) Val [1,2,3]pl @('Just Id) (Just 10)Present 10 ('Just 10 | Just 10)Val 10pl @('Just Id) NothingError 'Just(empty)Fail "'Just(empty)"pz @('Just Fst) (Just 123,'x')Val 123predicate-typed2runs each predicate in turn from the promoted listpz @'[1, 2, 3] 999 Val [1,2,3]pz @'[W 1, W 2, W 3, Id] 999Val [1,2,3,999]predicate-typed=extracts the value level representation of the type level '[] pz @'[] FalseVal []predicate-typed=extracts the value level representation of the type level '() pz @'() ()Val ()predicate-typed:extracts the value level representation of the type level  pz @123 ()Val 123predicate-typed8extracts the value level representation of the promoted pz @'LT "not used"Val LT pz @'EQ ()Val EQpredicate-typed(run the predicates in a promoted 8-tuple.pz @'(4, Id, "inj", 999, 'LT, 1, 2, 3) "hello""Val (4,"hello","inj",999,LT,1,2,3)predicate-typed(run the predicates in a promoted 7-tuple+pz @'(4, Id, "inj", 999, 'LT, 1, 2) "hello" Val (4,"hello","inj",999,LT,1,2)predicate-typed(run the predicates in a promoted 6-tuple(pz @'(4, Id, "inj", 999, 'LT, 1) "hello"Val (4,"hello","inj",999,LT,1)predicate-typed(run the predicates in a promoted 5-tuple%pz @'(4, Id, "inj", 999, 'LT) "hello"Val (4,"hello","inj",999,LT)predicate-typed(run the predicates in a promoted 4-tuple pz @'(4, Id, "inj", 999) "hello"Val (4,"hello","inj",999)predicate-typed(run the predicates in a promoted 3-tuplepz @'(4, Id, "goodbye") "hello"Val (4,"hello","goodbye") pan @'( 'True, 'False, 123) TrueP '(,,)| +- True 'True|+- False 'False| `- P '123Val (True,False,123)predicate-typed5run the predicates in a promoted 2-tuple; similar to 34pz @'(Id, 4) "hello"Val ("hello",4)predicate-typedpulls the type level  to the value level as a .5pz @"hello world" ()Val "hello world"predicate-typedpulls the type level  to the value levelpz @'True "not used"Val True pz @'False () Val Falsepredicate-typedcreate a Proxy for a kind tpz @(Proxy 4) () Val Proxypz @(Proxy Int) () Val Proxy"pz @(Proxy "abc" >> Pop0 Id ()) () Val "abc"predicate-typed [] function pz @[] "Asf"Val []predicate-typed () function pz @() "Asf"Val ()predicate-typedproxy for the expressionpredicate-typeddisplay optionspredicate-typedvaluepredicate-typedreturns a tree of results 10122334111None '(-./2;>?predicate-typed holds the results of creating a  value for displaypredicate-typedAn ADT that summarises the results of evaluating Refined3 representing all possible statespredicate-typedtype family for converting from a 5-tuple '(opts,ip,op,fmt,i) to a  typepredicate-typed$Provides the constraints on Refined3predicate-typedLike &) but additionally reconstructs the output value to a standardized formatopts are the display optionsip converts i to PP ip i* which is the internal type and stored in op$ validates that internal type using PP op (PP ip i) ~ Boolfmt outputs the internal type PP fmt (PP ip i) ~ i and stored in i is the input typePP fmt (PP ip i)& should be valid as input for Refined3Setting ip to Id and fmt to Id is equivalent to 66Setting the input type i to .5 resembles the corresponding Read/Show instances but with an additional predicate on the read valueread a string using ip$ into an internal type and store in validate  using the predicate opshow  using fmt$ and store that formatted result in Although a common scenario is String as input, you are free to choose any input type you likepredicate-typed0field accessor for the converted input value in predicate-typed1field accessor for the converted output value in predicate-typeddirectly load values into 4. It still checks to see that those values are validpredicate-typeddirectly load values into  without any checkingpredicate-typed create a  generator using a generator to restrict the values (so it completes)g = genRefined3 @OAN @(ReadP Int Id) @(Between 10 100 Id && Even) @(ShowP Id) (choose (10,100))xs <- generate (vectorOf 10 g)=all (\x -> let y = r3In x in y >= 0 && y <= 100 && even y) xsTruepredicate-typed create a  generator using a proxypredicate-typedcreates a 5-tuple proxy (see  )use type application to set the 5-tuple or set the individual parameters directlyset the 5-tuple directly> 'Just Id) @(GuardBool "expected a Sunday" (Thd == 7)) @(UnMkDay Fst) (2019,10,13)/Right (Refined3 (2019-10-13,41,7) (2019,10,13))newRefined3 @OL @(MkDayExtra Id >> 'Just Id) @(Msg "expected a Sunday:" (Thd == 7)) @(UnMkDay Fst) (2019,10,12)Left Step 2. False Boolean Check(op) | {expected a Sunday: 6 == 7}newRefined3 @OZ @(MkDayExtra' Fst Snd Thd >> 'Just Id) @(GuardBool "expected a Sunday" (Thd == 7)) @(UnMkDay Fst) (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a SundaynewRefined3 @OL @(ParseTimeP TimeOfDay "%-H:%-M:%-S") @'True @(FormatTimeP "%H:%M:%S") "1:15:7"$Right (Refined3 01:15:07 "01:15:07")newRefined3 @OL @(ParseTimeP TimeOfDay "%-H:%-M:%-S") @'True @(FormatTimeP "%H:%M:%S") "1:2:x"Left Step 1. Failed Initial Conversion(ip) | ParseTimeP TimeOfDay (%-H:%-M:%-S) failed to parsenewRefined3 @OL @(Rescan "^(\\d{1,2}):(\\d{1,2}):(\\d{1,2})$" >> L2 Head >> Map (ReadP Int Id)) @(All (0 <..> 59) && Len == 3) @(PrintL 3 "%02d:%02d:%02d" Id) "1:2:3"#Right (Refined3 [1,2,3] "01:02:03")newRefined3 @OL @(Resplit "\\." >> Map (ReadP Int Id)) @(BoolsN "oops" 4 (Between 0 255 Id)) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "13.2.1.251"/Right (Refined3 [13,2,1,251] "013.002.001.251")newRefined3 @OZ @(Resplit "\\." >> Map (ReadP Int Id)) @(BoolsN "oops" 4 (Between 0 255 Id)) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "13.2.1.259"6Left Step 2. Failed Boolean Check(op) | Bool(3) [oops]newRefined3 @OZ @(Resplit "\\." >> Map (ReadP Int Id)) @(BoolsN "oops" 4 (Between 0 255 Id)) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "13.2.1.253.1"Left Step 2. Failed Boolean Check(op) | Bools:invalid length(5) expected 4predicate-typedcreate a Refined3 using a 5-tuple proxy and aggregate the results on failuretype T4 k = '(OZ, MkDayExtra Id >> 'Just Id, GuardBool "expected a Sunday" (Thd == 7), UnMkDay Fst, k))newRefined3P (Proxy @(T4 _)) (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a Sunday)newRefined3P (Proxy @(T4 _)) (2019,10,13)/Right (Refined3 (2019-10-13,41,7) (2019,10,13))predicate-typed3create a Refined3 value using a 5-tuple proxy (see )use / to package all the types together as a 5-tuplepredicate-typedworkhorse for creating  valuespredicate-typed instance for predicate-typed instance for import Control.Arrow ((+++))import Control.Lensimport Data.Time>type K1 = MakeR3 '(OAN, ReadP Day Id, 'True, ShowP Id, String)type K2 = MakeR3 '(OAN, ReadP Day Id, Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") Id, ShowP Id, String)&r = unsafeRefined3' "2019-04-23" :: K1removeAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r) Refined3 2019-04-23 "2019-04-23"removeAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)Refined3(Binary:get):Step 2. False Boolean Check(op) | {2019-05-30 <= 2019-04-23};*** Step 1. Success Initial Conversion(ip) (2019-04-23) ***P ReadP Day 2019-04-23|`- P Id "2019-04-23"'*** Step 2. False Boolean Check(op) ***False 2019-05-30 <= 2019-04-23|+- P Id 2019-04-23|+- P ReadP Day 2019-05-30| || `- P '"2019-05-30"|`- P ReadP Day 2019-06-01 | `- P '"2019-06-01"predicate-typed instance for xs <- generate (vectorOf 10 (arbitrary @(Refined3 OAN (ReadP Int Id) (1 <..> 120 && Even) (ShowP Id) String))) let y = r3In x in y /= 0 && r3Out x == show y) xsTruepredicate-typed instance for  import qualified Data.Aeson as AA.eitherDecode' @(Refined3 OZ (ReadBase Int 16) (Id > 10 && Id < 256) (ShowBase 16) String) "\"00fe\""Right (Refined3 254 "fe")removeAnsi $ A.eitherDecode' @(Refined3 OAN (ReadBase Int 16) (Id > 10 && Id < 256) (ShowBase 16) String) "\"00fe443a\""Error in $: Refined3(FromJSON:parseJSON):Step 2. False Boolean Check(op) | {True && False | (16663610 < 256)}9*** Step 1. Success Initial Conversion(ip) (16663610) ***P ReadBase(Int,16) 16663610|`- P Id "00fe443a"'*** Step 2. False Boolean Check(op) ***&False True && False | (16663610 < 256)|+- True 16663610 > 10| || +- P Id 16663610| | | `- P '10|`- False 16663610 < 256 | +- P Id 16663610 | `- P '256predicate-typed instance for  import qualified Data.Aeson as AA.encode (unsafeRefined3' @OZ @(ReadBase Int 16) @(0 <..> 0xff) @(ShowBase 16) "fe")"\"fe\""1A.encode (unsafeRefined3' @OZ @Id @'True @Id 123)"123"predicate-typed instance for reads @(Refined3 OZ (ReadBase Int 16) (0 <..> 0xff) (ShowBase 16) String) "Refined3 254 \"fe\""[(Refined3 254 "fe","")]reads @(Refined3 OZ (ReadBase Int 16) (0 <..> 0xff) (ShowBase 16) String) "Refined3 300 \"12c\""[]reads @(Refined3 OZ (ReadBase Int 16) (Id < 0) (ShowBase 16) String) "Refined3 (-1234) \"-4d2\""[(Refined3 (-1234) "-4d2","")]reads @(Refined3 OZ (Map' (ReadP Int Id) (Resplit "\\.")) (GuardBool "len/=4" (Len == 4)) (PrintL 4 "%d.%d.%d.%d" Id) String) "Refined3 [192,168,0,1] \"192.168.0.1\""+[(Refined3 [192,168,0,1] "192.168.0.1","")]predicate-typed instance for Refined3pureTryTest $ fromString @(Refined3 OL (ReadP Int Id) (Id > 12) (ShowP Id) String) "523"Right (Refined3 523 "523")pureTryTest $ fromString @(Refined3 OL (ReadP Int Id) (Id > 12) (ShowP Id) String) "2"Left ()None '(-./2;>?$predicate-typed?type family for converting from a 4-tuple '(opts,ip,op,i) to a  typepredicate-typed holds the results of creating a  value for displaypredicate-typedAn ADT that summarises the results of evaluating Refined2 representing all possible statespredicate-typed$Provides the constraints on Refined2predicate-typedRefinement type for specifying an input type that is different from the output typeopts are the display optionsip converts i to PP ip i which is the internal type in op$ validates that internal type using PP op (PP ip i) ~ Booli& is the input type which is stored in Although a common scenario is String as input, you are free to choose any input type you likepredicate-typed0field accessor for the converted input value in predicate-typed/field accessor for the original input value in predicate-typeddirectly load values into 4. It still checks to see that those values are validpredicate-typeddirectly load values into  without any checkingpredicate-typed create a  generator using a generator to restrict the values (so it completes)g = genRefined2 @OAN @(ToEnum Day) @(UnMkDay Id >> Snd == 10) arbitraryxs <- generate (vectorOf 10 g)all (\x -> let y = toEnum @Day (fromIntegral (r2Out x)) in view _2 (toGregorian y) == 10 && y == r2In x) xsTruepredicate-typed create a  generator using a proxypredicate-typedversion for creating a  value that works for any  instancepredicate-typedsame as $ but runs for any MonadEval instancepredicate-typedpure version for creating a  value3newRefined2 @OZ @(ReadBase Int 16) @(Lt 255) "00fe"Right (Refined2 254 "00fe")newRefined2 @OZ @(ReadBase Int 16) @(GuardBool (PrintF "%#x is too large" Id) (Lt 253)) "00fe"9Left Step 2. Failed Boolean Check(op) | 0xfe is too large3newRefined2 @OZ @(ReadBase Int 16) @(Lt 255) "00fg"> 'Just Id) @(GuardBool "expected a Sunday" (Thd == 7)) (2019,10,13)/Right (Refined2 (2019-10-13,41,7) (2019,10,13))newRefined2 @OL @(MkDayExtra Id >> 'Just Id) @(Msg "expected a Sunday:" (Thd == 7)) (2019,10,12)Left Step 2. False Boolean Check(op) | {expected a Sunday: 6 == 7}newRefined2 @OZ @(MkDayExtra' Fst Snd Thd >> 'Just Id) @(GuardBool "expected a Sunday" (Thd == 7)) (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a SundaynewRefined2 @OL @Id @'True 22Right (Refined2 22 22)newRefined2 @OL @(ReadP UTCTime Id) @(Between (MkDay '(2020,5,2)) (MkDay '(2020,5,7)) (MkJust ToDay)) "2020-05-04 12:13:14Z"?Right (Refined2 2020-05-04 12:13:14 UTC "2020-05-04 12:13:14Z")newRefined2 @OL @(ReadP UTCTime Id) @(Between (MkDay '(2020,5,2)) (MkDay '(2020,5,7)) (MkJust ToDay)) "2020-05-08 12:13:14Z"Left Step 2. False Boolean Check(op) | {Just 2020-05-08 <= Just 2020-05-07}predicate-typedcreate a Refined2 using a 4-tuple proxy and aggregate the results on failuretype T4 k = '(OZ, MkDayExtra Id >> 'Just Id, GuardBool "expected a Sunday" (Thd == 7), k))newRefined2P (Proxy @(T4 _)) (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a Sunday)newRefined2P (Proxy @(T4 _)) (2019,10,13)/Right (Refined2 (2019-10-13,41,7) (2019,10,13))predicate-typed3create a Refined2 value using a 4-tuple proxy (see )predicate-typedworkhorse for creating  valuespredicate-typed"format the output from creating a  value into predicate-typedcreates a 4-tuple proxy (see  )use type application to set the 4-tuple or set the individual parameters directlyset the 4-tuple directly2eg1 = mkProxy2 @'(OL, ReadP Int Id, Gt 10, String)newRefined2P eg1 "24"Right (Refined2 24 "24")skip the 4-tuple and set each parameter individually using type application.eg2 = mkProxy2 @_ @OL @(ReadP Int Id) @(Gt 10)newRefined2P eg2 "24"Right (Refined2 24 "24")predicate-typedsame as : but checks to make sure the proxy is consistent with the  constraintpredicate-typed instance for predicate-typed instance for import Control.Arrow ((+++))import Data.Time2type K1 = Refined2 OAN (ReadP Day Id) 'True Stringtype K2 = Refined2 OAN (ReadP Day Id) (Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") Id) String&r = unsafeRefined2' "2019-04-23" :: K1removeAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r) Refined2 2019-04-23 "2019-04-23"removeAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)Refined2(Binary:get):Step 2. False Boolean Check(op) | {2019-05-30 <= 2019-04-23};*** Step 1. Success Initial Conversion(ip) (2019-04-23) ***P ReadP Day 2019-04-23|`- P Id "2019-04-23"'*** Step 2. False Boolean Check(op) ***False 2019-05-30 <= 2019-04-23|+- P Id 2019-04-23|+- P ReadP Day 2019-05-30| || `- P '"2019-05-30"|`- P ReadP Day 2019-06-01 | `- P '"2019-06-01"predicate-typed instance for  :m + Data.Time.Calendar.WeekDatexs <- generate (vectorOf 10 (arbitrary @(Refined2 OAN (ToEnum Day) (L2 (ToWeekDate Id) == "Tuesday") Int)))all (\x -> let y = toEnum @Day (r2Out x) in view _3 (toWeekDate y) == 2 && r2In x == y) xsTruepredicate-typed instance for  import qualified Data.Aeson as AA.eitherDecode' @(Refined2 OZ (ReadBase Int 16) (Id > 10 && Id < 256) String) "\"00fe\""Right (Refined2 254 "00fe")removeAnsi $ A.eitherDecode' @(Refined2 OAN (ReadBase Int 16) (Id > 10 && Id < 256) String) "\"00fe443a\""Error in $: Refined2(FromJSON:parseJSON):Step 2. False Boolean Check(op) | {True && False | (16663610 < 256)}9*** Step 1. Success Initial Conversion(ip) (16663610) ***P ReadBase(Int,16) 16663610|`- P Id "00fe443a"'*** Step 2. False Boolean Check(op) ***&False True && False | (16663610 < 256)|+- True 16663610 > 10| || +- P Id 16663610| | | `- P '10|`- False 16663610 < 256 | +- P Id 16663610 | `- P '256predicate-typed instance for  import qualified Data.Aeson as AA.encode (unsafeRefined2 @OZ @(ReadBase Int 16) @(0 <..> 0xff) 254 "fe")"\"fe\""5A.encode (unsafeRefined2 @OZ @Id @'True @Int 123 123)"123"predicate-typed instance for reads @(Refined2 OZ (ReadBase Int 16) (0 <..> 0xff) String) "Refined2 254 \"fe\""[(Refined2 254 "fe","")]reads @(Refined2 OZ (ReadBase Int 16) (0 <..> 0xff) String) "Refined2 300 \"12c\""[]reads @(Refined2 OZ (ReadBase Int 16) (Id < 0) String) "Refined2 (-1234) \"-4d2\""[(Refined2 (-1234) "-4d2","")]reads @(Refined2 OZ (Map' (ReadP Int Id) (Resplit "\\.")) (GuardBool "len/=4" (Len == 4)) String) "Refined2 [192,168,0,1] \"192.168.0.1\""+[(Refined2 [192,168,0,1] "192.168.0.1","")]predicate-typed instance for Refined2pureTryTest $ fromString @(Refined2 OL (ReadP Int Id) (Id > 12) String) "523"Right (Refined2 523 "523")pureTryTest $ fromString @(Refined2 OL (ReadP Int Id) (Id > 12) String) "2"Left ()None -./;<=>?8predicate-typed holds the results of creating a  value for displaypredicate-typedthe constraints that  must adhere topredicate-typed4a simple refinement type that ensures the predicate p holds for the type apredicate-typedextract the value from predicate-typedcreate 3 generator using a generator to restrict the valuespredicate-typedverbose display of predicate-typed returns a  value if a is valid for the predicate p for any  instancepredicate-typedreturns a pure  value if a is valid for the predicate p)newRefined @OL @(ReadP Int Id > 99) "123"Right (Refined "123")6left m0Long $ newRefined @OL @(ReadP Int Id > 99) "12"Left "False (12 > 99)"%newRefined @OZ @(Between 10 14 Id) 13Right (Refined 13)4left m0BoolE $ newRefined @OZ @(Between 10 14 Id) 99Left (Right False)?newRefined @OZ @(Last >> Len == 4) ["one","two","three","four"],Right (Refined ["one","two","three","four"])newRefined @OZ @(Re "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$") "141.213.1.99"Right (Refined "141.213.1.99")left m0BoolE $ newRefined @OZ @(Re "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$") "141.213.1"Left (Right False)left m0BoolE $ newRefined @OZ @(Map' (ReadP Int Id) (Resplit "\\.") >> GuardBool (PrintF "bad length: found %d" Len) (Len == 4)) "141.213.1"!Left (Left "bad length: found 3")left m0BoolE $ newRefined @OZ @(Map' (ReadP Int Id) (Resplit "\\.") >> GuardBool (PrintF "bad length: found %d" Len) (Len == 4) && BoolsN (PrintT "octet %d out of range %d" Id) 4 (0 <..> 0xff)) "141.213.1.444"0Left (Left "Bool(3) [octet 3 out of range 444]")left m0BoolE $ newRefined @OZ @(Map' (ReadP Int Id) (Resplit "\\.") >> GuardBool (PrintF "bad length: found %d" Len) (Len == 4) && BoolsN (PrintT "octet %d out of range %d" Id) 4 (0 <..> 0xff)) "141.213.1x34.444"Left (Left "ReadP Int (1x34)")?newRefined @OZ @(Map ('[Id] >> ReadP Int Id) >> IsLuhn) "12344"Right (Refined "12344")left m0BoolE $ newRefined @OZ @(Map ('[Id] >> ReadP Int Id) >> IsLuhn) "12340"Left (Right False)+newRefined @OZ @(Any IsPrime) [11,13,17,18]Right (Refined [11,13,17,18]):left m0BoolE $ newRefined @OZ @(All IsPrime) [11,13,17,18]Left (Right False)newRefined @OZ @(Snd !! Fst >> Len > 5) (2,["abc","defghij","xyzxyazsfd"])2Right (Refined (2,["abc","defghij","xyzxyazsfd"]))left m0BoolE $ newRefined @OZ @(Snd !! Fst >> Len > 5) (27,["abc","defghij","xyzxyazsfd"])"Left (Left "(!!) index not found")left m0BoolE $ newRefined @OZ @(Snd !! Fst >> Len <= 5) (2,["abc","defghij","xyzxyazsfd"])Left (Right False)newRefined @OU @((Id $$ 13) > 100) (\x -> x * 14) ^? _Right . to unRefined . to ($ 99) Just 1386predicate-typedcreate an unsafe $ value without running the predicatepredicate-typedcreate an unsafe ! value and also run the predicatepredicate-typed instance for predicate-typed instance for xs <- generate (vectorOf 10 (arbitrary @(Refined OAN (Id /= 0) Int)))all ((/=0) . unRefined) xsTruexs <- generate (vectorOf 10 (arbitrary @(Refined OAN IsPrime Int)))all (isPrime . unRefined) xsTruepredicate-typed instance for predicate-typed instance for import Data.Timeimport Control.Lensimport Control.Arrow ((+++))3type K1 = Refined OZ (ReadP Day Id >> 'True) Stringtype K2 = Refined OAN (Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") (ReadP Day Id)) String)r = unsafeRefined' @OZ "2019-04-23" :: K1removeAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)Refined "2019-04-23"removeAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)4Refined(Binary:get):False (2019-05-30 <= 2019-04-23)False 2019-05-30 <= 2019-04-23|+- P ReadP Day 2019-04-23| || `- P Id "2019-04-23"|+- P ReadP Day 2019-05-30| || `- P '"2019-05-30"|`- P ReadP Day 2019-06-01 | `- P '"2019-06-01"predicate-typed instance for  import qualified Data.Aeson as A9A.eitherDecode' @(Refined OZ (Between 10 14 Id) Int) "13"Right (Refined 13)removeAnsi $ A.eitherDecode' @(Refined OAN (Between 10 14 Id) Int) "16"8Error in $: Refined(FromJSON:parseJSON):False (16 <= 14)False 16 <= 14| +- P Id 16|+- P '10|`- P '14predicate-typed instance for 2reads @(Refined OZ (0 <..> 299) Int) "Refined 254"[(Refined 254,"")]2reads @(Refined OZ (0 <..> 299) Int) "Refined 300"[]1reads @(Refined OZ 'True Int) "Refined (-123)xyz"[(Refined (-123),"xyz")]predicate-typed instance for RefinedpureTryTest $ fromString @(Refined OL (ReadP Int Id >> Id > 244) String) "523"Right (Refined "523")pureTryTest $ fromString @(Refined OL (ReadP Int Id >> Id > 244) String) "52"Left ()None '(-./2;<>?Ppredicate-typedcreates a 4-tuple proxy (see  )use type application to set the 4-tuple or set the individual parameters directlyset the 4-tuple directly2eg1 = mkProxy2 @'(OL, ReadP Int Id, Gt 10, String)newRefined5P eg1 "24"Right (Refined5 24)skip the 4-tuple and set each parameter individually using type application.eg2 = mkProxy2 @_ @OL @(ReadP Int Id) @(Gt 10)newRefined5P eg2 "24"Right (Refined5 24)?type family for converting from a 4-tuple '(opts,ip,op,i) to a  typepredicate-typedRefinement type for specifying an input type that is different from the output typeopts are the display optionsip converts i to PP ip i which is storedop$ validates that internal type using PP op (PP ip i) ~ Booli is the input type which is discarded after converting to PP ip ipredicate-typedextract the value from predicate-typeddirectly load values into 4. It still checks to see that those values are validpredicate-typeddirectly load values into  without any checkingpredicate-typed create a  generator using a generator to restrict the values (so it completes)predicate-typed create a  generator using a proxypredicate-typed creating a  value for any predicate-typedsame as $ but runs for any MonadEval instancepredicate-typedpure version for creating a  value3newRefined5 @OZ @(ReadBase Int 16) @(Lt 255) "00fe"Right (Refined5 254)newRefined5 @OZ @(ReadBase Int 16) @(GuardBool (PrintF "%#x is too large" Id) (Lt 253)) "00fe"9Left Step 2. Failed Boolean Check(op) | 0xfe is too large3newRefined5 @OZ @(ReadBase Int 16) @(Lt 255) "00fg"> 'Just Id) @(GuardBool "expected a Sunday" (Thd == 7)) (2019,10,13)"Right (Refined5 (2019-10-13,41,7))newRefined5 @OL @(MkDayExtra Id >> 'Just Id) @(Msg "expected a Sunday:" (Thd == 7)) (2019,10,12)Left Step 2. False Boolean Check(op) | {expected a Sunday: 6 == 7}newRefined5 @OZ @(MkDayExtra' Fst Snd Thd >> 'Just Id) @(GuardBool "expected a Sunday" (Thd == 7)) (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a SundaynewRefined5 @OL @Id @'True 22Right (Refined5 22)newRefined5 @OL @(ReadP UTCTime Id) @(Between (MkDay '(2020,5,2)) (MkDay '(2020,5,7)) (MkJust ToDay)) "2020-05-04 12:13:14Z"(Right (Refined5 2020-05-04 12:13:14 UTC)newRefined5 @OL @(ReadP UTCTime Id) @(Between (MkDay '(2020,5,2)) (MkDay '(2020,5,7)) (MkJust ToDay)) "2020-05-08 12:13:14Z"Left Step 2. False Boolean Check(op) | {Just 2020-05-08 <= Just 2020-05-07}predicate-typedcreate a Refined5 using a 4-tuple proxy and aggregate the results on failurepredicate-typed create a " value using a 4-tuple proxy (see 7)predicate-typedworkhorse for creating  valuespredicate-typed instance for predicate-typed instance for predicate-typed instance for  :m + Data.Time.Calendar.WeekDatexs <- generate (vectorOf 10 (arbitrary @(Refined5 OAN (ReadP Int Id) (Negate 10 <..> 10) String))).all (\x -> unRefined5 x `elem` [-10 .. 10]) xsTruepredicate-typed instance for  import qualified Data.Aeson as AA.eitherDecode' @(Refined5 OZ (ReadBase Int 16) (Id > 10 && Id < 256) String) "123"Right (Refined5 123)removeAnsi $ A.eitherDecode' @(Refined5 OL (ReadBase Int 16) (Id > 10 && Id < 256) String) "9"Error in $: Refined5(FromJSON:parseJSON):false boolean check | {False && True | (9 > 10)}FalseA.eitherDecode' @(Refined5 OZ (ReadBase Int 16) (Id > 10 && Id < 256) String) "254"Right (Refined5 254)removeAnsi $ A.eitherDecode' @(Refined5 OAN (ReadBase Int 16) (Id > 10 && Id < 256) String) "12345"Error in $: Refined5(FromJSON:parseJSON):false boolean check | {True && False | (12345 < 256)}#False True && False | (12345 < 256)|+- True 12345 > 10| || +- P Id 12345| | | `- P '10|`- False 12345 < 256 | +- P Id 12345 | `- P '256predicate-typed instance for  import qualified Data.Aeson as AA.encode (unsafeRefined5' @OZ @(ReadBase Int 16) @(Between 0 255 Id) 254)"254"1A.encode (unsafeRefined5 @OZ @Id @'True @Int 123)"123"predicate-typed instance for reads @(Refined5 OZ (ReadBase Int 16) (0 <..> 0xff) String) "Refined5 254"[(Refined5 254,"")]reads @(Refined5 OZ (ReadBase Int 16) (0 <..> 0xff) String) "Refined5 300"[]reads @(Refined5 OZ (ReadBase Int 16) (Id < 0) String) "Refined5 -1234"[(Refined5 (-1234),"")]reads @(Refined5 OZ (Map' (ReadP Int Id) (Resplit "\\.")) (GuardBool "len/=4" (Len == 4)) String) "Refined5 [192,168,0,1]"[(Refined5 [192,168,0,1],"")]reads @(Refined5 OZ (ReadP Rational Id) (Id > Negate 4 % 3) String) "Refined5 (-10 % 9)"[(Refined5 ((-10) % 9),"")]reads @(Refined5 OZ (ReadP Rational Id) (Id > Negate 4 % 3) String) "Refined5 (-10 % 6)"[]predicate-typed instance for Refined5pureTryTest $ fromString @(Refined5 OL (ReadP Int Id) (Id > 12) String) "523"Right (Refined5 523)pureTryTest $ fromString @(Refined5 OL (ReadP Int Id) (Id > 12) String) "2"Left ()   None '(-./>?kpredicate-typed6create inductive tuples from a list of the exact size n9pz @(ToITupleList 4 >> EachITuple Succ) ['a','c','y','B']Val ('b',('d',('z',('C',()))))&pz @(ToITupleList 4) ['a','c','y','B']Val ('a',('c',('y',('B',())))).pz @(Take 10 Id >> ToITupleList 10) ['a'..'z']Val ('a',('b',('c',('d',('e',('f',('g',('h',('i',('j',()))))))))))predicate-typedreverse an inductive tuple0pz @ReverseITuple (1.4,(1,(2,(False,('x',())))))"Val ('x',(False,(2,(1,(1.4,())))))predicate-typed(create flat tuples from inductive tuples&pz @FromITuple (2,(3,(True,('y',()))))Val (2,3,True,'y')pz @FromITuple ()Val ()pz @FromITuple (1,())Val 1predicate-typed(create inductive tuples from flat tuples1pz @(ToITuple >> EachITuple Succ) (1,2,False,'x')Val (2,(3,(True,('y',()))))predicate-typedrun p with inductive tuples/pz @(EachITuple Succ) (False,(2,(LT,('c',()))))Val (True,(3,(EQ,('d',()))))pz @(EachITuple (Id + (4 >> FromIntegral _))) (1,(1/4,(5%6,()))) Val (5 % 1,(17 % 4,(29 % 6,())))pz @(ToITuple >> EachITuple (Id + (4 >> FromIntegral _))) (1000,1/4,5%6)#Val (1004 % 1,(17 % 4,(29 % 6,())))pz @(ToITuple >> EachITuple ((Id >> FromIntegral _) + (4 >> FromIntegral _))) (1000::Integer,17::Int)Val (1004,(21,()))pz @(ToITuple >> EachITuple (Dup >> Fst<>Snd)) (SG.Min 1,SG.First 'x',"abcd")?Val (Min {getMin = 1},(First {getFirst = 'x'},("abcdabcd",())))predicate-typed create a n* tuple from a list and return as an Eitherpz @(Tuple' 4) "abcdefg"Val (Right ('a','b','c','d'))pz @(Tuple' 4) "abc"Val (Left "abc")pz @(Tuple' 4) [] Val (Left [])pl @(Tuple' 4) "abc"5Present Left "abc" (Tuple'(4) not enough elements(3))Val (Left "abc"):set -XPolyKindstype F n i = ChunksOf' n i Id >> Map (Tuple' n) >> PartitionEitherspz @(F 3 1) [1..7];Val ([[6,7],[7]],[(1,2,3),(2,3,4),(3,4,5),(4,5,6),(5,6,7)])predicate-typed create a n tuple from a list or failpz @(Tuple 4) "abcdefg"Val ('a','b','c','d')pz @(Tuple 4) "abc"&Fail "Tuple(4) not enough elements(3)""pz @(Fst >> Tuple 3) ([1..5],True) Val (1,2,3)&pz @(Lift (Tuple 3) Fst) ([1..5],True) Val (1,2,3)predicate-typed similar to 896: may require kind signatures: Both is a better choicepz @(On (==!) Len) ("1ss","x2") -- or use Comparing or Both+CompareVal GT+pz @('(4,2) >> On (**) (FromIntegral _)) ()Val 16.0pz @('(4,2) >> Both (FromIntegral _) >> Fst ** Snd) () -- equivalent to the above but easier on ghcVal 16.0?pz @(On (+) (Id * Id) >> Id ** (1 % 2 >> FromRational _)) (3,4)Val 5.0pz @(Both (Id * Id) >> ((Fst + Snd) ** (1 % 2 >> FromRational _))) (3,4) -- equivalent to the above but easier on ghcVal 5.0predicate-typedapplies p8 to the first and second slot of an n-tuple (similar to )-pl @(Fst >> Both Len) (("abc",[10..17]),True)#Present (3,8) ((>>) (3,8) | {Both}) Val (3,8)*pl @(Lift (Both Pred) Fst) ((12,'z'),True))Present (11,'y') ((>>) (11,'y') | {Both}) Val (11,'y')pl @(Both Succ) (4,'a')Present (5,'b') (Both) Val (5,'b')import Data.Time5pl @(Both (ReadP Day Id)) ("1999-01-01","2001-02-12")&Present (1999-01-01,2001-02-12) (Both)Val (1999-01-01,2001-02-12)pz @(Both (Id * Id) >> ((Fst + Snd) ** (DivI Double 1 2))) (3,4)Val 5.0predicate-typedapplies p to lhs of the tuple and q to the rhs and then Ors them together,pl @(Sum > 44 |+ Id < 2) ([5,6,7,8,14,44],9)True (True (|+) False)Val True'pl @(Sum > 44 |+ Id < 2) ([5,6,7,14],9)1False (False (|+) False | (32 > 44) (|+) (9 < 2)) Val False'pl @(Sum > 44 |+ Id < 2) ([5,6,7,14],1)True (False (|+) True)Val Truepredicate-typedapplies p to lhs of the tuple and q to the rhs and then ors them together: see !pl @(OrA (Gt 3) (Lt 10) Id) (1,2)True (False (|+) True)Val Truepredicate-typedapplies p to lhs of the tuple and q to the rhs and then Ands them together2pl @(SplitAt 4 "abcdefg" >> Len > 4 &* Len < 5) ()0False ((>>) False | {False (&*) True | (4 > 4)}) Val Falsepredicate-typedapplies p to lhs of the tuple and q to the rhs and then ands them together: see "pl @(AndA (Gt 3) (Lt 10) Id) (1,2)!False (False (&*) True | (1 > 3)) Val Falsepredicate-typedapplies a function against the second part of a tuple: similar to 3:pz @(Second Succ) (12,False) Val (12,True)predicate-typedapplies a function against the first part of a tuple: similar to 3;pz @(First Succ) (12,True) Val (13,True)predicate-typed similar to 3<"pz @(Pred *** ShowP Id) (13, True)Val (12,"True")*pl @(Flip (***) Len (Id * 12)) (99,"cdef")/Present (1188,4) ((***) (1188,4) | (99,"cdef")) Val (1188,4),pl @(4 *** "sadf" *** 'LT) ('x',("abv",[1]))Present (4,("sadf",LT)) ((***) (4,("sadf",LT)) | ('x',("abv",[1])))Val (4,("sadf",LT))predicate-typed similar to 343pl @(Min &&& Max >> Id >> Fst < Snd) [10,4,2,12,14]True ((>>) True | {2 < 14})Val True!pl @((123 &&& Id) >> Fst + Snd) 4(Present 127 ((>>) 127 | {123 + 4 = 127})Val 127pl @(4 &&& "sadf" &&& 'LT) ()*Present (4,("sadf",LT)) ('(4,("sadf",LT)))Val (4,("sadf",LT))!pl @(Id &&& '() &&& ()) (Just 10).Present (Just 10,((),())) ('(Just 10,((),())))Val (Just 10,((),()))-pl @(Fst &&& Snd &&& Thd &&& ()) (1,'x',True)2Present (1,('x',(True,()))) ('(1,('x',(True,()))))Val (1,('x',(True,())))-pl @(Fst &&& Snd &&& Thd &&& ()) (1,'x',True)2Present (1,('x',(True,()))) ('(1,('x',(True,()))))Val (1,('x',(True,()))).pl @(Fst &&& Snd &&& Thd &&& ()) (1,1.4,"aaa")4Present (1,(1.4,("aaa",()))) ('(1,(1.4,("aaa",()))))Val (1,(1.4,("aaa",())))predicate-typedcreates a list of overlapping pairs of elements. requires two or more elementspz @Pairs [1,2,3,4]Val [(1,2),(2,3),(3,4)] pz @Pairs []Val [] pz @Pairs [1]Val []pl @Pairs [1,2]'Present [(1,2)] (Pairs [(1,2)] | [1,2]) Val [(1,2)]pl @Pairs [1,2,3]5Present [(1,2),(2,3)] (Pairs [(1,2),(2,3)] | [1,2,3])Val [(1,2),(2,3)]pl @Pairs [1,2,3,4]Present [(1,2),(2,3),(3,4)] (Pairs [(1,2),(2,3),(3,4)] | [1,2,3,4])Val [(1,2),(2,3),(3,4)]pan @(Pairs >> Len >> 'True >> 'False >> FailT _ "xyzzy") "abcde" [Error xyzzy] False|4+- P Pairs [('a','b'),('b','c'),('c','d'),('d','e')]| +- P Len 4| +- True 'True|+- False 'False|`- [Error xyzzy] Fail "xyzzy"predicate-typedduplicate a value into a tuple pl @Dup 4Present (4,4) ('(4,4)) Val (4,4)pl @(Dup >> Id) 4'Present (4,4) ((>>) (4,4) | {Id (4,4)}) Val (4,4)pl @(Dup << Fst * Snd) (4,5)+Present (20,20) ((>>) (20,20) | {'(20,20)}) Val (20,20)pl @(Fst * Snd >> Dup) (4,5)+Present (20,20) ((>>) (20,20) | {'(20,20)}) Val (20,20)3333 None '(-./>?predicate-typed%tries to extract the values from the  constructor)pz @(These' >> Second Succ) (These 1 'a') Val (1,'b')pz @(That' >> Succ) (This 'a')Fail "That' found This"$pz @(These' >> Second Succ) (That 8)Fail "These' found That"predicate-typed"tries to extract a value from the  constructorpz @(That' >> Succ) (That 20)Val 21pz @(That' >> Succ) (This 'a')Fail "That' found This"predicate-typed"tries to extract a value from the  constructorpz @(This' >> Succ) (This 20)Val 21pz @(This' >> Succ) (That 'a')Fail "This' found That"predicate-typedunassoc using "pz @Unassoc (These 123 (This 'x'))Val (This (These 123 'x'))pz @Unassoc (99,('a',True))Val ((99,'a'),True)2pz @Unassoc (This 10 :: These Int (These Bool ()))Val (This (This 10))pz @Unassoc (Right (Right 123))Val (Right 123):pz @Unassoc (Left 'x' :: Either Char (Either Bool Double))Val (Left (Left 'x'))pl @Unassoc (10,('c',True))Present ((10,'c'),True) (Unassoc ((10,'c'),True) | (10,('c',True)))Val ((10,'c'),True)predicate-typed assoc using  pz @Assoc (This (These 123 'x'))Val (These 123 (This 'x'))pz @Assoc ((99,'a'),True)Val (99,('a',True))pz @Assoc ((99,'a'),True)Val (99,('a',True))7pz @Assoc (Right "Abc" :: Either (Either () ()) String)Val (Right (Right "Abc"))pz @Assoc (Left (Left 'x'))Val (Left 'x')pl @Assoc ((10,'c'),True)Present (10,('c',True)) (Assoc (10,('c',True)) | ((10,'c'),True))Val (10,('c',True))&pl @(Assoc >> Unassoc) ((10,'c'),True)Present ((10,'c'),True) ((>>) ((10,'c'),True) | {Unassoc ((10,'c'),True) | (10,('c',True))})Val ((10,'c'),True)predicate-typedextract the These value from a  otherwise fail with a message if there is no These value then p! is passed the whole context only,pz @(TheseFail "oops" Id) (These "abc" 20.4)Val ("abc",20.4)%pz @(TheseFail "oops" Id) (That "aa") Fail "oops"pz @(TheseFail (PrintT "found %s fst=%d" '(ShowP Snd,Fst)) Snd) (123,That "xy") Fail "found That \"xy\" fst=123")pz @(TheseFail (MEmptyT _) Id) (That 222)Fail ""predicate-typedextract the That value from a  otherwise fail with a messageif there is no That value then p! is passed the whole context only$pz @(ThatFail "oops" Id) (That 20.4)Val 20.4$pz @(ThatFail "oops" Id) (This "aa") Fail "oops"pz @(ThatFail (PrintT "found %s fst=%d" '(ShowP Snd,Fst)) Snd) (123,This "xy") Fail "found This \"xy\" fst=123"(pz @(ThatFail (MEmptyT _) Id) (This 222)Fail ""predicate-typedextract the This value from a  otherwise fail with a messageif there is no This value then p! is passed the whole context only$pz @(ThisFail "oops" Id) (This 20.4)Val 20.4$pz @(ThisFail "oops" Id) (That "aa") Fail "oops"pz @(ThisFail (PrintT "found %s fst=%d" '(ShowP Snd,Fst)) Snd) (123,That "xy") Fail "found That \"xy\" fst=123"(pz @(ThisFail (MEmptyT _) Id) (That 222)Fail ""*pl @(ThisFail "sdf" Id) (This (SG.Sum 12)) Present Sum {getSum = 12} (This)Val (Sum {getSum = 12})*pl @(ThisFail "sdf" Id) (That (SG.Sum 12))Error sdf (ThisFail That) Fail "sdf"!pl @(ThisFail "sdf" Id) (That 12)Error sdf (ThisFail That) Fail "sdf"predicate-typed extract the These value from an  otherwise use the default value if there is no These value then p! is passed the whole context only0pz @(TheseDef '(1 % 4,"zz") Id) (These 20.4 "x")Val (102 % 5,"x")+pz @(TheseDef '(1 % 4,"zz") Id) (This 20.4)Val (1 % 4,"zz")*pz @(TheseDef '(1 % 4,"zz") Id) (That "x")Val (1 % 4,"zz")pz @(TheseDef '(PrintT "found %s fst=%d" '(ShowP Snd, Fst),999) Snd) (123,This "xy")%Val ("found This \"xy\" fst=123",999)9pz @(TheseDef (MEmptyT (SG.Sum _, String)) Id) (This 222)Val (Sum {getSum = 0},"")7pz @(TheseDef (MEmptyT _) Id) (These (SG.Sum 222) "aa")Val (Sum {getSum = 222},"aa")-pl @(TheseDef '("xyz",'True) Id) (This "abc")$Present ("xyz",True) (TheseDef This)Val ("xyz",True)-pl @(TheseDef '("xyz",'True) Id) (That False)$Present ("xyz",True) (TheseDef That)Val ("xyz",True)4pl @(TheseDef '("xyz",'True) Id) (These "abc" False)&Present ("abc",False) (TheseDef These)Val ("abc",False)predicate-typedextract the That value from an  otherwise use the default valueif there is no That value then p! is passed the whole context only$pz @(ThatDef (1 % 4) Id) (That 20.4) Val (102 % 5)$pz @(ThatDef (1 % 4) Id) (This "aa") Val (1 % 4))pz @(ThatDef (1 % 4) Id) (These "aa" 2.3) Val (1 % 4)pz @(ThatDef (PrintT "found %s fst=%d" '(ShowP Snd, Fst)) Snd) (123,This "xy")Val "found This \"xy\" fst=123"'pz @(ThatDef (MEmptyT _) Id) (This 222)Val ()6pz @(ThatDef (MEmptyT (SG.Sum _)) Id) (These 'x' 1120)Val (Sum {getSum = 0})predicate-typedextract the This value from an  otherwise use the default value if there is no This value then p! is passed the whole context only$pz @(ThisDef (1 % 4) Id) (This 20.4) Val (102 % 5)$pz @(ThisDef (1 % 4) Id) (That "aa") Val (1 % 4))pz @(ThisDef (1 % 4) Id) (These 2.3 "aa") Val (1 % 4)pz @(ThisDef (PrintT "found %s fst=%d" '(ShowP Snd, Fst)) Snd) (123,That "xy")Val "found That \"xy\" fst=123"'pz @(ThisDef (MEmptyT _) Id) (That 222)Val ()5pz @(ThisDef (MEmptyT (SG.Sum _)) Id) (These 222 'x')Val (Sum {getSum = 0})/pl @(ThisDef (MEmptyT _) Id) (This (SG.Sum 12))(Present Sum {getSum = 12} (ThisDef This)Val (Sum {getSum = 12})&pl @(ThisDef (MEmptyT _) Id) (That 12)Present () (ThisDef That)Val ()predicate-typed similar to => thats pads with  or & if one list is shorter than the other>the key is that all information about both lists are preserved&pz @(ZipThese Fst Snd) ("aBc", [1..5])7Val [These 'a' 1,These 'B' 2,These 'c' 3,That 4,That 5])pz @(ZipThese Fst Snd) ("aBcDeF", [1..3])Val [These 'a' 1,These 'B' 2,These 'c' 3,This 'D',This 'e',This 'F']"pz @(ZipThese Id Reverse) "aBcDeF"Val [These 'a' 'F',These 'B' 'e',These 'c' 'D',These 'D' 'c',These 'e' 'B',These 'F' 'a']pz @(ZipThese Id '[]) "aBcDeF";Val [This 'a',This 'B',This 'c',This 'D',This 'e',This 'F']pz @(ZipThese '[] Id) "aBcDeF";Val [That 'a',That 'B',That 'c',That 'D',That 'e',That 'F']pz @(ZipThese '[] '[]) "aBcDeF"Val []pl @(ZipThese Fst Snd >> Map (TheseIn Id Id Fst)) (['w'..'y'],['a'..'f'])Present "wxydef" ((>>) "wxydef" | {Map "wxydef" | [These 'w' 'a',These 'x' 'b',These 'y' 'c',That 'd',That 'e',That 'f']}) Val "wxydef"pl @(("sdf" &&& Id) >> ZipThese Fst Snd >> Map (TheseIn (Id &&& 0) (C "x" &&& Id) Id)) [1..5]Present [('s',1),('d',2),('f',3),('x',4),('x',5)] ((>>) [('s',1),('d',2),('f',3),('x',4),('x',5)] | {Map [('s',1),('d',2),('f',3),('x',4),('x',5)] | [These 's' 1,These 'd' 2,These 'f' 3,That 4,That 5]})-Val [('s',1),('d',2),('f',3),('x',4),('x',5)]predicate-typedTheseId: given a  returns a tuple but you need to provide default values for both sides'pl @(TheseId "xyz" 'True ) (This "abc")8Present ("abc",True) (TheseIn ("abc",True) | This "abc")Val ("abc",True)&pl @(TheseId "xyz" 'True) (That False):Present ("xyz",False) (TheseIn ("xyz",False) | That False)Val ("xyz",False)-pl @(TheseId "xyz" 'True) (These "abc" False)Present ("abc",False) (TheseIn ("abc",False) | These "abc" False)Val ("abc",False)predicate-typed similar to ?@1pz @(TheseIn Id Len (Fst + Length Snd)) (This 13)Val 13pz @(TheseIn Id Len (Fst + Length Snd)) (That "this is a long string")Val 21=pz @(TheseIn Id Len (Fst + Length Snd)) (These 20 "somedata")Val 28pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst > Length Snd) (MkLeft _ Fst) (MkRight _ Snd))) (That "this is a long string")#Val (Right "this is a long string")pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst > Length Snd) (MkLeft _ Fst) (MkRight _ Snd))) (These 1 "this is a long string")#Val (Right "this is a long string")pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst > Length Snd) (MkLeft _ Fst) (MkRight _ Snd))) (These 100 "this is a long string")Val (Left 100)6pl @(TheseIn "this" "that" "these") (This (SG.Sum 12))8Present "this" (TheseIn "this" | This Sum {getSum = 12}) Val "this"pl @(TheseIn (Id &&& 999) ("no value" &&& Id) Id) (These "Ab" 13)5Present ("Ab",13) (TheseIn ("Ab",13) | These "Ab" 13) Val ("Ab",13)=pl @(TheseIn (Id &&& 999) ("no value" &&& Id) Id) (This "Ab")3Present ("Ab",999) (TheseIn ("Ab",999) | This "Ab")Val ("Ab",999);pl @(TheseIn (Id &&& 999) ("no value" &&& Id) Id) (That 13);Present ("no value",13) (TheseIn ("no value",13) | That 13)Val ("no value",13)predicate-typed predicate on pl @IsThese (This 12)False (IsThese | This 12) Val Falsepz @IsThese (These 1 'a')Val Truepl @IsThese (These 'x' 12)True (IsThese | These 'x' 12)Val Truepl @IsThese (That (SG.Sum 12))*False (IsThese | That (Sum {getSum = 12})) Val False!pl @IsThese (These 1 (SG.Sum 12)),True (IsThese | These 1 (Sum {getSum = 12}))Val Truepredicate-typed predicate on pl @IsThat (This 12)False (IsThat | This 12) Val Falsepredicate-typed predicate on pz @IsThis (This "aBc")Val Truepz @IsThis (These 1 'a') Val Falsepl @IsThis (This 12)True (IsThis | This 12)Val Truepredicate-typed constructorpz @(MkThese Fst Snd) (44,'x')Val (These 44 'x')pl @(MkThese Id 'True) 'x'/Present These 'x' True (MkThese These 'x' True)Val (These 'x' True)predicate-typed constructorpz @(MkThat _ Id) 44 Val (That 44)pz @(MkThat _ "Abc" <> MkThis _ '[1,2] <> MkThese [3,4] "def") ()Val (These [1,2,3,4] "Abcdef")pl @(MkThat () Id) 'x'"Present That 'x' (MkThat That 'x')Val (That 'x')predicate-typed similar to  where t references the typepredicate-typed constructorpl @(MkThis () Id) 'x'"Present This 'x' (MkThis This 'x')Val (This 'x')pl @(MkThis () Fst) ('x',True)"Present This 'x' (MkThis This 'x')Val (This 'x')pz @(MkThis _ Id) 44 Val (This 44)predicate-typed constructor)pz @(Proxy Int >> MkThis' UnproxyT 10) [] Val (This 10)predicate-typed similar to ?A but additionally provides p, q and r5 the original input as the first element in the tuplepz @(TheseX ((L11 + Snd) >> ShowP Id) (ShowP Id) L22 Snd) (9,This 123) Val "132"pz @(TheseX '(Snd,"fromthis") '(Negate 99,Snd) Snd Id) (This 123)Val (123,"fromthis")pz @(TheseX '(Snd,"fromthis") '(Negate 99,Snd) Snd Id) (That "fromthat")Val (-99,"fromthat")pz @(TheseX '(Snd,"fromthis") '(Negate 99,Snd) Snd Id) (These 123 "fromthese")Val (123,"fromthese")pl @(TheseX (PrintF "a=%d" (Snd >> Succ)) ("b=" <> Snd) (PrintT "a=%d b=%s" Snd) Id) (These @Int 9 "rhs")#Present "a=9 b=rhs" (TheseX(These))Val "a=9 b=rhs"pl @(TheseX (PrintF "a=%d" (Snd >> Succ)) ("b=" <> Snd) (PrintT "a=%d b=%s" Snd) Id) (This @Int 9)Present "a=10" (TheseX(This)) Val "a=10"pl @(TheseX (PrintF "a=%d" (Snd >> Succ)) ("b=" <> Snd) (PrintT "a=%d b=%s" Snd) Id) (That @Int "rhs")Present "b=rhs" (TheseX(That)) Val "b=rhs"predicate-typed similar to BC(pz @(ZipThese Id Tail >> Theres) [1..10]Val [2,3,4,5,6,7,8,9,10]predicate-typed similar to BD'pz @(ZipThese Id Tail >> Heres) [1..10]Val [1,2,3,4,5,6,7,8,9,10]predicate-typed similar to BE(pz @(ZipThese Id Tail >> Theses) [1..10]>) "xy" | {Snd "xy" | ([1,10,99],"xy",[])})Val "xy"predicate-typed similar to BG>pz @(Thiss) [That 1, This 'a', These 'b' 33, This 'd', That 4]Val "ad",pz @(Thiss) [That 1, This 'a', These 'b' 33]Val "a"(pz @(Thiss) [That 1, That 9, These 1 33]Val []predicate-typed similar to ,. returns a 3-tuple with the results so use    to extractpz @PartitionThese [This 'a', That 2, This 'c', These 'z' 1, That 4, These 'a' 2, That 99]%Val ("ac",[2,4,99],[('z',1),('a',2)])pl @PartitionThese [This 4, That 'x', That 'y',These 3 'b', This 99, These 5 'x']Present ([4,99],"xy",[(3,'b'),(5,'x')]) (PartitionThese ([4,99],"xy",[(3,'b'),(5,'x')]) | [This 4,That 'x',That 'y',These 3 'b',This 99,These 5 'x'])#Val ([4,99],"xy",[(3,'b'),(5,'x')])pl @PartitionThese [This 1,That 'x',This 4,That 'y',These 9 'z',This 10,These 8 'y']Present ([1,4,10],"xy",[(9,'z'),(8,'y')]) (PartitionThese ([1,4,10],"xy",[(9,'z'),(8,'y')]) | [This 1,That 'x',This 4,That 'y',These 9 'z',This 10,These 8 'y'])%Val ([1,4,10],"xy",[(9,'z'),(8,'y')]) None &'(-./>?predicate-typed- function where you need to provide the type t of the result&pz @(FromString (Identity _) Id) "abc"Val (Identity "abc")(pz @(FromString (Seq.Seq Char) Id) "abc"Val (fromList "abc")predicate-typed< function where you need to provide a reference to the type t of the resultpredicate-typed"very simple conversion to a stringpredicate-typedsimilar to case insensitive HI for stringspredicate-typedsimilar to case insensitive HJ for strings pl @(IsInfixCI "aB" Id) "xyzAbw"True (IsInfixCI | aB xyzAbw)Val True!pz @(IsInfixCI "abc" "axAbCd") ()Val Truepredicate-typedsimilar to case insensitive HK for strings"pz @(IsPrefixCI "abc" "aBcbCd") ()Val Truepredicate-typed similar to HI for strings pl @(IsSuffixC "bw" Id) "xyzabw"True (IsSuffixC | bw xyzabw)Val True pl @(IsSuffixC "bw" Id) "xyzbaw"False (IsSuffixC | bw xyzbaw) Val False!pz @(IsSuffixC "bCd" "aBcbCd") ()Val Truepredicate-typed similar to HJ for stringspl @(IsInfixC "ab" Id) "xyzabw"True (IsInfixC | ab xyzabw)Val Truepl @(IsInfixC "aB" Id) "xyzAbw"False (IsInfixC | aB xyzAbw) Val Falsepl @(IsInfixC "ab" Id) "xyzbaw"False (IsInfixC | ab xyzbaw) Val False&pl @(IsInfixC Fst Snd) ("ab","xyzabw")True (IsInfixC | ab xyzabw)Val Truepredicate-typed similar to HK for strings pl @(IsPrefixC "xy" Id) "xyzabw"True (IsPrefixC | xy xyzabw)Val True pl @(IsPrefixC "ab" Id) "xyzbaw"False (IsPrefixC | ab xyzbaw) Val False!pz @(IsPrefixC "abc" "aBcbCd") () Val Falsepredicate-typed similar to LM!pz @(StripR "xyz" Id) "Hello xyz"Val (Just "Hello ")#pz @(StripR "xyz" Id) "xyzHelloxyw" Val Nothingpz @(StripR "xyz" Id) "" Val Nothingpz @(StripR "xyz" "xyz") () Val (Just "")predicate-typed similar to LN pz @(StripL "xyz" Id) "xyzHello"Val (Just "Hello"))pz @(StripL "xyz" Id) (T.pack "xyzHello")Val (Just "Hello") pz @(StripL "xyz" Id) "xywHello" Val Nothingpredicate-typed similar to LO$pz @(Snd >> TrimBoth) (20," abc ") Val "abc"+pz @(Snd >> TrimBoth) (20,T.pack " abc ") Val "abc" pz @(" " >> TrimBoth) ()Val ""pz @("" >> TrimBoth) ()Val ""predicate-typed similar to LP!pz @(Snd >> TrimR) (20," abc ") Val " abc"pz @(" abc " >> TrimR) () Val " abc"pz @("" >> TrimR) ()Val ""predicate-typed similar to LQ!pz @(Snd >> TrimL) (20," abc ") Val "abc " None '(-./>?i predicate-typedA replacement function ([String] -> String)" which yields the groups Used by  and  Requires Text.Show.Functions:m + Text.Show.Functionsimport Data.List (intercalate)pz @(ReplaceAll "^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$" (ReplaceFn3 Fst) Snd) (\ys -> intercalate " | " $ map (show . succ . readNote @Int "invalid int") ys, "141.201.1.22")Val "142 | 202 | 2 | 23" predicate-typedA replacement function (String -> String)& that yields the whole match Used by  and  Requires Text.Show.Functions:m + Text.Show.Functionspz @(ReplaceAll "\\." (ReplaceFn2 Fst) Snd) (\x -> x <> ":" <> x, "141.201.1.22")Val "141.:.201.:.1.:.22" predicate-typedA replacement function (String -> [String] -> String)7 which returns the whole match and the groups Used by  and  Requires Text.Show.Functions predicate-typedSimple replacement string: see   and  predicate-typed#replace first occurrence of string p with q in rpl @(ReplaceOneString 'ROverWrite "abc" "def" Id) "123abc456abc"Present "123def456abc" (ReplaceOne (abc) 123abc456abc | 123def456abc)Val "123def456abc"pz @(Rescan "^Date\\((\\d+[+-]\\d{4})\\)" >> Head >> Snd >> Id !! 0 >> ReplaceOneString 'RPrepend "\\d{3}[+-]" "." Id >> ParseTimeP ZonedTime "%s%Q%z") "Date(1530144000123+0530)"!Val 2018-06-28 05:30:00.123 +0530pz @(Rescan "^Date\\((\\d+[+-]\\d{4})\\)" >> Head >> Snd >> Id !! 0 >> ReplaceOneString 'RPrepend "\\d{3}[+-]" "." Id >> ParseTimeP ZonedTime "%s%Q%z") "Date(1593460089052+0800)"!Val 2020-06-30 03:48:09.052 +0800 predicate-typedsame as  & but allow setting regex options with rs predicate-typed"replace all occurrences of string p with q in rpl @(ReplaceAllString 'ROverWrite "abc" "def" Id) "123abc456abc"Present "123def456def" (ReplaceAll (abc) 123abc456abc | 123def456def)Val "123def456def"pl @(ReplaceAllString' '[] 'ROverWrite "abc" "def" Id) "123AbC456abc"Present "123AbC456def" (ReplaceAll (abc) 123AbC456abc | 123AbC456def)Val "123AbC456def"pl @(ReplaceAllString' '[ 'Caseless ] 'ROverWrite "abc" "def" Id) "123AbC456abc"Present "123def456def" (ReplaceAll' ['Caseless] (abc) 123AbC456abc | 123def456def)Val "123def456def">pl @(ReplaceAllString 'RPrepend "abc" "def" Id) "123AbC456abc"Present "123AbC456defabc" (ReplaceAll (abc) 123AbC456abc | 123AbC456defabc)Val "123AbC456defabc"pl @(ReplaceAllString 'ROverWrite "abc" "def" Id) "123AbC456abc"Present "123AbC456def" (ReplaceAll (abc) 123AbC456abc | 123AbC456def)Val "123AbC456def"=pl @(ReplaceAllString 'RAppend "abc" "def" Id) "123AbC456abc"Present "123AbC456abcdef" (ReplaceAll (abc) 123AbC456abc | 123AbC456abcdef)Val "123AbC456abcdef">pz @(ReplaceAllString 'ROverWrite "\\." ":" Id) "141.201.1.22"Val "141:201:1:22" predicate-typed"replace all occurrences of string p with q in r using regex options rs predicate-typed!replaces first value using regex p with a replacement function q inside the value r predicate-typed%replaces the first value using regex p with a replacement function q inside the value r using regex options rs predicate-typed replaces all values using regex p with a replacement function q inside the value r predicate-typed replaces all values using regex p with a replacement function q inside the value r using regex options rs predicate-typed*splits a string on a regex delimiter: see "pz @(Resplit "\\.") "141.201.1.22"Val ["141","201","1","22"]!pl @(Resplit "\\.") "123.2.3.5.6"Present ["123","2","3","5","6"] (Resplit (\.) ["123","2","3","5","6"] | 123.2.3.5.6)Val ["123","2","3","5","6"]pl @(Map' (ReadP Int Id) (Resplit "\\.") >> '(Id, '(Len == 4, All (0 <..> 0xff)))) "141.214.125.1.2.3333"Present ([141,214,125,1,2,3333],(False,False)) ((>>) ([141,214,125,1,2,3333],(False,False)) | {'([141,214,125,1,2,3333],(False,False))})*Val ([141,214,125,1,2,3333],(False,False))pl @(Map' (ReadP Int Id) (Resplit "\\.") >> Id &&& ((Len == 4) &&& All (0 <..> 0xff))) "141.214.125.1.2.6"Present ([141,214,125,1,2,6],(False,True)) ((>>) ([141,214,125,1,2,6],(False,True)) | {'([141,214,125,1,2,6],(False,True))})&Val ([141,214,125,1,2,6],(False,True))pl @(Resplit "\\." >> Map (ReadP Int Id) >> Id &&& ((Len == 4) &&& All (0 <..> 0xff))) "141.214.125."+Error ReadP Int () (Map(i=3, a="") excnt=1)Fail "ReadP Int ()" predicate-typed*splits a string on a regex delimiter: see 5pl @(Resplit' '[ 'Caseless ] "aBc" Id) "123AbC456abc"Present ["123","456",""] (Resplit' ['Caseless] (aBc) ["123","456",""] | 123AbC456abc)Val ["123","456",""]7pz @(Resplit' '[] (Singleton Fst) Snd) (':', "12:13:1")Val ["12","13","1"] predicate-typedsee ?pz @(RescanRanges "^(\\d{2}):(\\d{2}):(\\d{2})$" Id) "13:05:25"!Val [((0,8),[(0,2),(3,5),(6,8)])] predicate-typed similar to  # but also allows the regex options rs to be specified predicate-typedsee 6pz @(Rescan "^(\\d{2}):(\\d{2}):(\\d{2})$") "13:05:25"#Val [("13:05:25",["13","05","25"])]pz @(Rescan "^(\\d{2}):(\\d{2}):(\\d{2})$" >> L2 Head >> Map (ReadP Int Id)) "13:05:25" Val [13,5,25]pl @(Rescan "(\\d+)\\D?" >> Map (Second (ReadP Int (OneP)))) "123-444-987"Present [("123-",123),("444-",444),("987",987)] ((>>) [("123-",123),("444-",444),("987",987)] | {Map [("123-",123),("444-",444),("987",987)] | [("123-",["123"]),("444-",["444"]),("987",["987"])]})+Val [("123-",123),("444-",444),("987",987)]pl @(Rescan ".(.)") "aBcd"Present [("aB",["B"]),("cd",["d"])] (Rescan (.(.)) [("aB",["B"]),("cd",["d"])] | aBcd)Val [("aB",["B"]),("cd",["d"])]+pl @(Rescan "\\d{1,3}(\\.)?") "123.8.99.21"Present [("123.",["."]),("8.",["."]),("99.",["."]),("21",[])] (Rescan (\d{1,3}(\.)?) [("123.",["."]),("8.",["."]),("99.",["."]),("21",[])] | 123.8.99.21)9Val [("123.",["."]),("8.",["."]),("99.",["."]),("21",[])]pl @(Map' Fst (Rescan "." << ShowP Id) >> Filter (Same "2") Id) 12324Present ["2","2"] ((>>) ["2","2"] | {Fst ["2","2"] | (["2","2"],["1","3","4"])}) Val ["2","2"]pl @(Rescan "(\\d)+?") "1234"Present [("1",["1"]),("2",["2"]),("3",["3"]),("4",["4"])] (Rescan ((\d)+?) [("1",["1"]),("2",["2"]),("3",["3"]),("4",["4"])] | 1234)5Val [("1",["1"]),("2",["2"]),("3",["3"]),("4",["4"])]pl @(Rescan "(\\d)+") "1234"Present [("1234",["4"])] (Rescan ((\d)+) [("1234",["4"])] | 1234)Val [("1234",["4"])]pl @(Rescan "(\\d{1,3})(\\.(\\d{1,3}))+?") "1.2.3.4" -- overcapturingPresent [("1.2",["1",".2","2"]),("3.4",["3",".4","4"])] (Rescan ((\d{1,3})(\.(\d{1,3}))+?) [("1.2",["1",".2","2"]),("3.4",["3",".4","4"])] | 1.2.3.4)3Val [("1.2",["1",".2","2"]),("3.4",["3",".4","4"])]pl @(Rescan "^(\\d)+?$") "1234"Present [("1234",["4"])] (Rescan (^(\d)+?$) [("1234",["4"])] | 1234)Val [("1234",["4"])]4pl @(Rescan "(\\d{1,3})(\\.(\\d{1,3}))+?") "1.2.3.4"Present [("1.2",["1",".2","2"]),("3.4",["3",".4","4"])] (Rescan ((\d{1,3})(\.(\d{1,3}))+?) [("1.2",["1",".2","2"]),("3.4",["3",".4","4"])] | 1.2.3.4)3Val [("1.2",["1",".2","2"]),("3.4",["3",".4","4"])]pl @(Rescan "(\\d{1,3})(?:\\.(\\d{1,3}))+?") "1.2.3.4" -- bizzare!Present [("1.2",["1","2"]),("3.4",["3","4"])] (Rescan ((\d{1,3})(?:\.(\d{1,3}))+?) [("1.2",["1","2"]),("3.4",["3","4"])] | 1.2.3.4))Val [("1.2",["1","2"]),("3.4",["3","4"])]pl @(Rescan "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$") "1.2.3.4"Present [("1.2.3.4",["1","2","3","4"])] (Rescan (^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$) [("1.2.3.4",["1","2","3","4"])] | 1.2.3.4)#Val [("1.2.3.4",["1","2","3","4"])]+pl @(Rescan "([[:xdigit:]]{2})") "wfeb12az"Present [("fe",["fe"]),("b1",["b1"]),("2a",["2a"])] (Rescan (([[:xdigit:]]{2})) [("fe",["fe"]),("b1",["b1"]),("2a",["2a"])] | wfeb12az)/Val [("fe",["fe"]),("b1",["b1"]),("2a",["2a"])]pz @(Rescan "^Date\\((\\d+)(\\d{3}[+-]\\d{4})\\)" >> Head >> Snd >> (Id !! 0 <> "." <> Id !! 1) >> ParseTimeP ZonedTime "%s%Q%z") "Date(1593460089052+0800)"!Val 2020-06-30 03:48:09.052 +0800 predicate-typedruns a regex matcher returning the original values and optionally any groups: see >pl @(Rescan' '[ 'Anchored ] "([[:xdigit:]]{2})" Id) "wfeb12az"Error Regex no results (Rescan' ['Anchored] (([[:xdigit:]]{2})) | "wfeb12az")Fail "Regex no results"pz @(Rescan' '[] Snd "13:05:25") ('a',"^(\\d{2}):(\\d{2}):(\\d{2})$")#Val [("13:05:25",["13","05","25"])]pz @('(Id,Intercalate '["\\."] (Repeat 4 "([01]?\\d?\\d|2[0-4]\\d|25[0-5])") >> Concat) >> Rescan' '[] ("^" <> Snd <> "$") Fst) "1.2.3.255" -- have to use Rescan' here: Lift helps not!'Val [("1.2.3.255",["1","2","3","255"])]pz @('(Id,Intercalate '["\\."] (Repeat 4 "([01]?\\d?\\d|2[0-4]\\d|25[0-5])") >> Concat) >> Rescan' '[] ("^" <> Snd <> "$") Fst >> FMap (Second (FMap (ReadP Int Id)))) "1.2.3.255"Val [("1.2.3.255",[1,2,3,255])] predicate-typed5runs a regular expression and returns a boolean: see ,pz @(Re "^\\d{2}:\\d{2}:\\d{2}$") "13:05:25"Val True#pl @(Re "\\d{4}-\\d{3}") "1234-123""True (Re (\d{4}-\d{3}) | 1234-123)Val True#pl @(Re "\\d{4}-\\d{3}") "1234-1x3"#False (Re (\d{4}-\d{3}) | 1234-1x3) Val False9pl @(Re "(?i)ab") "aB" -- runtime [use 'Caseless instead]True (Re ((?i)ab) | aB)Val Truepl @(Re "ab") "aB"False (Re (ab) | aB) Val False4pl @(Re "^\\d{1,3}(?:\\.\\d{1,3}){3}$") "123.1.1.21"2True (Re (^\d{1,3}(?:\.\d{1,3}){3}$) | 123.1.1.21)Val Truepl @(Guard "regex failed" (Re "^\\d+(?:\\.\\d+)?$") >> ReadP Double Id) "13.345"4Present 13.345 ((>>) 13.345 | {ReadP Double 13.345}) Val 13.345pl @(Guard "regex failed" (Re "^\\d+(?:\\.\\d+)?$") >> ReadP Double Id) "13".Present 13.0 ((>>) 13.0 | {ReadP Double 13.0})Val 13.0pl @(ExitWhen "regex failed" (Not (Re "^\\d+(?:\\.\\d+)?$")) >> ReadP Double Id) "-13.4"$Error regex failed (Guard | "-13.4")Fail "regex failed"pl @(Re "\\d{4}\\") "ayx"Error Regex failed to compile (Re (\d{4}\) ([],[]):\ at end of pattern)Fail "Regex failed to compile"pl @(Re "^\\d+$") "123\nx"False (Re (^\d+$) | 123x) Val Falsepl @(Re "(?m)^\\d+$") "123\nx" -- (?m) anchors match beginning/end of line instead of whole stringTrue (Re ((?m)^\d+$) | 123x)Val True%pl @(Catch (Re "\\d+(") 'False) "123"7False (Catch caught exception[Regex failed to compile]) Val False$pl @(Catch (Re "\\d+") 'False) "123"True (Catch did not fire)Val True predicate-typedruns a regular expression with given regex options and returns a boolean: see .pl @(Re' '[ 'Caseless, 'Dotall ] "ab" Id) "aB")True (Re' ['Caseless, 'Dotall] (ab) | aB)Val True1pl @(Re' '[ 'Caseless, 'Dotall ] "ab." Id) "aB\n")True (Re' ['Caseless, 'Dotall] (ab.) | aB)Val True(pl @(Re' '[ 'Caseless ] "ab." Id) "aB\n"!False (Re' ['Caseless] (ab.) | aB) Val False  None '(-./>? predicate-typedprint for lists -- use   as it is safer than  pl @(PrintL 4 "%s %s %s %s" '[W "xyz", ShowP Fst, ShowP Snd, Thd]) (123,'x',"ab")Present "xyz 123 'x' ab" ((>>) "xyz 123 'x' ab" | {PrintI [xyz 123 'x' ab] | s=%s %s %s %s})Val "xyz 123 'x' ab"pz @(PrintL 1 "%05d" '[Id]) 123 -- tick is required for a one element lis) Val "00123"+pz @(PrintL 2 "%d %05d" [Fst,Snd]) (29,123)Val "29 00123":pl @(PrintL 3 "first=%d second=%d third=%d" Id) [10,11,12]Present "first=10 second=11 third=12" ((>>) "first=10 second=11 third=12" | {PrintI [first=10 second=11 third=12] | s=first=%d second=%d third=%d})!Val "first=10 second=11 third=12":pl @(PrintL 2 "first=%d second=%d third=%d" Id) [10,11,12]Error toITupleListC: expected exactly 2 values (ToITupleList(2) instead found 3)/Fail "toITupleListC: expected exactly 2 values":pl @(PrintL 4 "first=%d second=%d third=%d" Id) [10,11,12]Error toITupleListC: expected exactly 4 values (ToITupleList(4) instead found 3)/Fail "toITupleListC: expected exactly 4 values"1pl @(PrintL 4 "%03d.%03d.%03d.%03d" Id) [1,2,3,4]Present "001.002.003.004" ((>>) "001.002.003.004" | {PrintI [001.002.003.004] | s=%03d.%03d.%03d.%03d})Val "001.002.003.004"3pl @(PrintL 4 "%03d.%03d.%03d.%03d" Id) [1,2,3,4,5]Error toITupleListC: expected exactly 4 values (ToITupleList(4) instead found 5)/Fail "toITupleListC: expected exactly 4 values"/pl @(PrintL 4 "%03d.%03d.%03d.%03d" Id) [1,2,3]Error toITupleListC: expected exactly 4 values (ToITupleList(4) instead found 3)/Fail "toITupleListC: expected exactly 4 values"1pl @(PrintL 4 "%03d.%03d.%03d.%03d" Id) [1,2,3,4]Present "001.002.003.004" ((>>) "001.002.003.004" | {PrintI [001.002.003.004] | s=%03d.%03d.%03d.%03d})Val "001.002.003.004"*pl @(PrintL 4 "%d %4d %-d %03d" Id) [1..4]Present "1 2 3 004" ((>>) "1 2 3 004" | {PrintI [1 2 3 004] | s=%d %4d %-d %03d})Val "1 2 3 004" predicate-typed(prints inductive tuples in reverse order4pz @(PrintI "d=%d s=%s f=%f") (1.73,("abc",(12,())))Val "d=12 s=abc f=1.73"-pz @(PrintI "d=%d s=%s f=%f") ("abc",(12,()));Fail "PrintI(IO e=printf: argument list ended prematurely)")pz @(PrintI "d=%s s=%d") ("abc",('x',()))3Fail "PrintI(IO e=printf: bad formatting char 's')"/pz @(PrintI "%s %s %d") (123,("sss",("bb",())))Val "bb sss 123" predicate-typed-print for flat n-tuples of size two or larger;pl @(PrintT "%d %s %s %s" '(Fst, Snd, Snd,Snd)) (10,"Asdf")Present "10 Asdf Asdf Asdf" ((>>) "10 Asdf Asdf Asdf" | {PrintI [10 Asdf Asdf Asdf] | s=%d %s %s %s})Val "10 Asdf Asdf Asdf"+pl @(PrintT "%c %d %s" Id) ('x', 10,"Asdf")Present "x 10 Asdf" ((>>) "x 10 Asdf" | {PrintI [x 10 Asdf] | s=%c %d %s})Val "x 10 Asdf",pz @(PrintT "fst=%s snd=%03d" Id) ("ab",123)Val "fst=ab snd=123"8pz @(PrintT "fst=%s snd=%03d thd=%s" Id) ("ab",123,"xx")Val "fst=ab snd=123 thd=xx"pl @(PrintT "%s %d %c %s" '(W "xyz", Fst, Snd, Thd)) (123,'x',"ab")Present "xyz 123 x ab" ((>>) "xyz 123 x ab" | {PrintI [xyz 123 x ab] | s=%s %d %c %s})Val "xyz 123 x ab"$pl @(PrintT "%d %c %s" Id) (123,'x')Error PrintI(IO e=printf: argument list ended prematurely) (PrintI %d %c %s | ('x',(123,())));Fail "PrintI(IO e=printf: argument list ended prematurely)"-pl @(PrintT "%d %c %s" Id) (123,'x',"abc",11)Error PrintI(IO e=printf: formatting string ended prematurely) (PrintI %d %c %s | (11,("abc",('x',(123,())))))?Fail "PrintI(IO e=printf: formatting string ended prematurely)"0pl @(PrintT "lhs = %d rhs = %s" Id) (123,"asdf")Present "lhs = 123 rhs = asdf" ((>>) "lhs = 123 rhs = asdf" | {PrintI [lhs = 123 rhs = asdf] | s=lhs = %d rhs = %s})Val "lhs = 123 rhs = asdf"&pl @(PrintT "d=%03d s=%s" Id) (9,"ab")Present "d=009 s=ab" ((>>) "d=009 s=ab" | {PrintI [d=009 s=ab] | s=d=%03d s=%s})Val "d=009 s=ab">) "d=009 s=ab c=x f=1.54" | {PrintI [d=009 s=ab c=x f=1.54] | s=d=%03d s=%s c=%c f=%4.2f})Val "d=009 s=ab c=x f=1.54"0pl @(PrintT "d=%03d s=%s" Id) (9, "ab",'x',1.54)Error PrintI(IO e=printf: formatting string ended prematurely) (PrintI d=%03d s=%s | (1.54,('x',("ab",(9,())))))?Fail "PrintI(IO e=printf: formatting string ended prematurely)"9pl @(PrintT "lhs = %d rhs = %s c=%d" Id) (123,"asdf",'x')Present "lhs = 123 rhs = asdf c=120" ((>>) "lhs = 123 rhs = asdf c=120" | {PrintI [lhs = 123 rhs = asdf c=120] | s=lhs = %d rhs = %s c=%d}) Val "lhs = 123 rhs = asdf c=120":pl @(PrintT "hello d=%d %c %s" '(12, C "z", "someval")) ()Present "hello d=12 z someval" ((>>) "hello d=12 z someval" | {PrintI [hello d=12 z someval] | s=hello d=%d %c %s})Val "hello d=12 z someval":pl @(PrintT "ipaddress %03d.%03d.%03d.%03d" '(1,2,3,4)) ()Present "ipaddress 001.002.003.004" ((>>) "ipaddress 001.002.003.004" | {PrintI [ipaddress 001.002.003.004] | s=ipaddress %03d.%03d.%03d.%03d})Val "ipaddress 001.002.003.004" predicate-typed8uses PrintF (unsafe) to format output for a single valuepz @(PrintF "value=%03d" Id) 12Val "value=012"!pz @(PrintF "%s" Fst) ("abc",'x') Val "abc"!pz @(PrintF "%d" Fst) ("abc",'x')4Fail "PrintF (IO e=printf: bad formatting char 'd')""pl @(PrintF "someval %d" Id) "!23"Error PrintF (IO e=printf: bad formatting char 'd') ("!23" s=someval %d)4Fail "PrintF (IO e=printf: bad formatting char 'd')"pl @(PrintF "%-6s" Id) 1234Error PrintF (IO e=printf: bad formatting char 's') (1234 s=%-6s)4Fail "PrintF (IO e=printf: bad formatting char 's')"pl @(PrintF "%06x" Id) 12344Present "0004d2" (PrintF [0004d2] | p=1234 | s=%06x) Val "0004d2".pl @(Msg (PrintF "digits=%d" Len) Head) [1..4]'Present 1 (digits=4 Head 1 | [1,2,3,4])Val 1.pl @(PrintF "ask%%dfas%%kef%05d hey %%" Id) 35Present "ask%dfas%kef00035 hey %" (PrintF [ask%dfas%kef00035 hey %] | p=35 | s=ask%%dfas%%kef%05d hey %%)Val "ask%dfas%kef00035 hey %"-pl @(Fail () (PrintF "someval int=%d" Id)) 45Error someval int=45Fail "someval int=45" predicate-typedRead but returns the Maybe of the value and any remaining unparsed stringpz @(ReadMaybe Int Id) "123x"Val (Just (123,"x"))pz @(ReadMaybe Int Id) "123"Val (Just (123,""))pz @(ReadMaybe Int Id) "x123" Val Nothing predicate-typedsame as   except t is a pointer to the type predicate-typed uses the  of the given type t and p$ which points to the content to readpz @(ReadP Rational Id) "4 % 5" Val (4 % 5)pz @(Between (ReadP Day "2017-04-11") (ReadP Day "2018-12-30") (ReadP Day Id)) "2018-10-12"Val Truepz @(Between (ReadP Day "2017-04-11") (ReadP Day "2018-12-30") (ReadP Day Id)) "2016-10-12" Val False!pl @(ReadP Rational Id) "123 % 4"-Present 123 % 4 (ReadP Ratio Integer 123 % 4) Val (123 % 4)"pl @(ReadP Rational Id) "x123 % 4")Error ReadP Ratio Integer (x123 % 4) ([])%Fail "ReadP Ratio Integer (x123 % 4)"pl @(ReadP Day Id) "1999-11-30")Present 1999-11-30 (ReadP Day 1999-11-30)Val 1999-11-30pl @(ReadP Day Id) "1999-02-29"!Error ReadP Day (1999-02-29) ([])Fail "ReadP Day (1999-02-29)"#pl @(ReadP TimeOfDay Id) "14:59:20"+Present 14:59:20 (ReadP TimeOfDay 14:59:20) Val 14:59:20 predicate-typed uses the  of the given type t and p$ which points to the content to read predicate-typed similar to pz @(ShowP Id) [4,8,3,9]Val "[4,8,3,9]"pz @(ShowP Id) 'x' Val "'x'"pz @(ShowP (42 -% 10)) 'x'Val "(-21) % 5" None '(-./>? predicate-typedcreate a Proxy z from proxy z where z is the expression pointed to by p' : Proxify alway returns Val (Proxy @z)pz @(Proxify Fst) ([True],13) ^!? acts . _Val . only (Proxy @Bool)Just ()8pz @(Proxify (MkJust 1)) () ^!? acts . _Val . to typeRepJust Intpz @(Proxify (FailT [Double] "abc")) () ^!? acts . _Val . to typeRep Just Double3pz @(Proxify "abc") () ^!? acts . _Val . to typeRep Just Chareval (Proxy @(Proxify Id)) defOpts ([] @Double) ^!? acts . ttVal . _Val . to typeRep Just Doubleeval (Proxy @(Proxify Id)) defOpts ([] @Int) ^? _Id . ttVal . _Val == Just (Proxy @Int)Trueeval (Proxy @(Proxify Id)) defOpts ([] @Int) ^? _Wrapped @(Identity _) . ttVal . _Val == Just (Proxy @Int)Trueeval (Proxy @(Proxify Id)) defOpts ([] @Int) ^? folded @Identity . ttVal . _Val == Just (Proxy @Int)True predicate-typedapplies Proxy p to Proxy q and Proxy r/ and returns a Proxy: needs kind signatures on ppz @(PApp2 (Proxy '(,)) (Proxy 2) (Proxy 'True) >> Pop0 Id ()) () Val (2,True)pz @('(Snd, PApp2 (Proxy (+)) L11 L12) >> Pop0 Snd Fst) ((Proxy @Fst,Proxy @(Length Snd)),(5,"abcdef"))Val 11pz @(PApp2 (Proxy (+)) Fst Snd >> Pop0 Id ()) (Proxy @(W 3),Proxy @(W 7))Val 10pz @(PApp2 Fst Snd Thd >> Pop0 Id ()) (Proxy @(&&&), Proxy @(W "abc"), Proxy @(W 13))Val ("abc",13) predicate-typedapplies Proxy p to Proxy q/ and returns a Proxy: needs kind signatures on ppz @(PApp Fst Snd >> Pop0 Id '("abcdef",99)) (Proxy @('(,) (Fst >> Len)), Proxy @16) Val (6,16)pz @('(Id,PApp (Proxy ('(,) (Fst >> Len))) (Proxy 16)) >> Pop0 Snd Fst) ("abcdefg",101) Val (7,16)pz @('(Id,PApp (Proxy '(,)) (Proxy (Fst >> Len))) >> Second (PApp Id (Proxy 16)) >> Pop0 Snd Fst) ("abcdefg",101) -- or can call PApp2 Val (7,16)pz @(PApp (PApp (Proxy ('(,) :: GL.Nat -> GL.Symbol -> (GL.Nat,GL.Symbol))) (Proxy 1)) (Proxy "abc")) () ^!? acts . _Val . to typeRepJust ('(,) Nat Symbol 1 "abc")pz @(PApp (Proxy '(,)) (Proxy 4) >> PApp Id (Proxy Fst) >> Pop0 Id (W '(1,2))) () Val (4,1)pz @(PApp (Proxy '(,)) (Proxy 4) >> PApp Id (Proxy Fst) >> Pop0 Id '( 'True,"hello")) () Val (4,True)pan @(PApp (Proxy (MsgI "hello ")) Fst >> Pop0 Id '(1,2,3)) (Proxy @"there",())P (>>) "there"| +- P PApp|`- P Pop0 | hello '"there" | +- P '(,,) | | | +- P '1 | | | +- P '2 | | | `- P '3 | `- P hello '"there" Val "there"pz @(PApp (Proxy Proxy) (Proxy "abc") >> Pop0 Id () >> Pop0 Id () ) () Val "abc"pz @(PApp (Proxy '(,,)) (Proxy 10) >> PApp Id (Proxy "ss") >> PApp Id (Proxy Fst) >> Pop0 Id '(13 % 44,C "x")) ()Val (10,"ss",13 % 44)pz @('(Id,PApp (Proxy '(,,)) (Proxy 10) >> PApp Id (Proxy "ss") >> PApp Id (Proxy Fst)) >> Pop0 Snd Fst) (13 % 44,'x')Val (10,"ss",13 % 44) predicate-typedApplies Proxy p to Proxy q and Proxy r+ and runs in the environment pointed to by s : needs kind signatures on p6pz @(Pop2' (Proxy '(,)) (Proxy 1) (Proxy "sss") ()) () Val (1,"sss")pz @(Pop2' (Proxy '(,)) (Proxy L31) (Proxy (Fst % Snd)) '(11,99,'("ss",3))) ()Val ("ss",1 % 9)pz @(Pop2' Fst Snd Thd (L4 Id)) (Proxy @'(,), Proxy @L31, Proxy @(Fst % Snd), (11,99,("ss",3)))Val ("ss",1 % 9) predicate-typed apply Proxy p to q and r+ then run in the environment pointed to by s : needs kind signatures on p0pz @(Pop2 (Proxy '(,)) Fst 14 Id) ([1..4],'True)Val ([1,2,3,4],14)9pz @(Pop2' (Proxy Pure) (Proxy SG.Sum) (Proxy Id) Id) 123Val (Sum {getSum = 123}) predicate-typed apply Proxy p to Proxy q* and run in the environment pointed to by r : needs kind signatures on p;pz @(Pop1' (Proxy ((<>) Snd)) (Proxy Fst) Id) ("abc","def") Val "defabc"pz @(Pop1' (Proxy ((>>) Snd)) (Proxy (Resplit "\\." >> Map (ReadP Int Id))) Id) (1,"123.33.5")Val [123,33,5]pz @(Pop1' (Proxy (Lift Snd)) (Proxy Fst) Id) ((True,2),("abc",1 % 4))Val 2pz @(Pop1' Fst Snd Thd) (Proxy @(Lift Snd), Proxy @Fst,((True,2),("abc",1 % 4)))Val 2pz @(Pop1' Fst Snd '( '( 'True,2),'("abc",1 % 4))) (Proxy @(Lift Snd), Proxy @Fst)Val 24pz @(Pop1' (Proxy MEmptyT) (Proxy (SG.Sum _)) ()) ()Val (Sum {getSum = 0})pz @(Pop1' (Proxy MEmptyT) (PApp (Proxy SG.Sum) (Proxy Float)) ()) ()Val (Sum {getSum = 0.0})pz @(Pop1' (Proxy Proxy) (Proxy Fst) () >> Pop0 Id '("abc",1234)) () Val "abc")pz @(Pop1' (Proxy ToEnum) 'Proxy 100) 'a'Val 'd'9pz @(Pop1' (Proxy ToEnum) 'Proxy 120) (undefined :: Char)Val 'x' predicate-typedapplies Proxy p to q" in the environment pointed to by r : needs kind signatures on p=pz @(Pop1 Fst L22 Snd) (Proxy @Length,(False,('x',"abcdef")))Val 65pz @(Proxy Length >> Pop1 IdT Snd '(1,'[1,2,3,4])) ()Val 4pz @(LiftA2 (Pop1 Fst Snd Id) (MkJust (Proxy (Lift Succ))) (MkJust 1)) () Val (Just 2)pz @(LiftA2 (Pop1 Fst Snd Id) (MkJust (Proxy ((*) 4))) (MkJust 3)) () Val (Just 12)pz @(Pop1 Fst Snd Id <$> MkJust (Proxy ((*) 4)) <:> MkJust 3) () Val (Just 12)pz @(Pop1 Fst Snd Id <$> Fst <:> Snd) (Just (Proxy @((*) 4)), Just 3) Val (Just 12).pz @(Proxy (Lift "asdf") >> Pop1 Id 123 Id) () Val "asdf"&pz @(Pop1 Id "abc" ()) (Proxy @(K 99))Val 99+pz @(Pop1 Id "abc" ()) (Proxy @(Flip K 99)) Val "abc",pz @(Pop1 (Proxy ('(,) 'True)) Len "abc") () Val (True,3) predicate-typedrun the proxy p" in the environment pointed to by q*pl @(Pop0 (Proxy '(Head,Len)) "abcdef") ()!Present ('a',6) (Pop0 | '('a',6)) Val ('a',6)+pz @(Pop0 Id "abcdef") (Proxy @'(Head,Len)) Val ('a',6)+pl @(Pop0 Fst Snd) (Proxy @Snd,("dd","ee")),Present "ee" (Pop0 | Snd "ee" | ("dd","ee"))Val "ee";pz @(Pop0 Fst L22) (Proxy @(Fst <> Snd),(True,("dd","ee"))) Val "ddee"pz @(Pop0 Id () <> "def") (Proxy @"abc") -- Proxy works for any kind! Val "abcdef"pz @(Pop0 Id () <> "def") (Nothing @(W "abc")) -- Proxy works for any kind! Val "abcdef"#pz @(Pop0 Id (C "A")) (Proxy @Succ)Val 'B'3pz @(Pop0 Fst Snd) (Proxy @(All1 Even),[1,5,2,3,4]) Val Falsepz @(Pop0 Fst Snd) (Proxy @(Partition Even Snd),(True,[8,1,5,2,3,4,6]))Val ([8,2,4,6],[1,5,3]))pl @(Proxy Snd >> Pop0 Id '( 'True,2)) ().Present 2 ((>>) 2 | {Pop0 | Snd 2 | (True,2)})Val 23pl @(Proxy (Fst <> Snd) >> Pop0 Id '("aa","bb")) ()=Present "aabb" ((>>) "aabb" | {Pop0 | "aa" <> "bb" = "aabb"}) Val "aabb"#pz @(Pop0 Fst Snd) (Proxy @Succ,EQ)Val GT/pz @(Pop0 Fst Snd) (Proxy @(FMap Succ),Just 23) Val (Just 24)-pz @(Pop0 Id (1 ... 12)) (Proxy @(FMap Succ))!Val [2,3,4,5,6,7,8,9,10,11,12,13]>pz @(Pop0 Id '( 'True, MkJust 12)) (Proxy @(FMap $ FMap Succ))Val (True,Just 13)pz @('(Id, PApp (Proxy '(,)) (Proxy 4)) >> Second (PApp Id (Proxy Fst)) >> Pop0 Snd Fst) ("abc",True) Val (4,"abc")2pz @(Pop1 (Proxy Proxy) "abc" () >> Pop0 Id ()) () Val "abc"pz @(Proxy (Proxy (Proxy "asdff")) >> Pop0 Id () >> Pop0 Id () >> Pop0 Id ()) () Val "asdff" predicate-typed,makes a proxy from a two parameter container3pz @(Pop1' (Proxy EmptyT) Proxy2T 123) (Left "ASf") Val (Left "")0pz @(Pop1' (Proxy EmptyT) Proxy2T 123) (Right 1) Val (Left "")=pz @((Id $$ "asdf") >> Pop1' (Proxy EmptyT) Proxy2T 123) Left Val (Left "")>pz @((Id $$ "asdf") >> Pop1' (Proxy EmptyT) Proxy2T 123) Right Val (Left "")>pz @(Pop1' (Proxy EmptyT) ((Id $$ "ss") >> Proxy2T) 123) Right Val (Left "")=pz @(Pop1' (Proxy EmptyT) ((Id $$ "ss") >> Proxy2T) 123) Left Val (Left "") predicate-typed,makes a proxy from a one parameter container.pz @(Pop1' (Proxy EmptyT) Proxy1T 123) Nothing Val Nothing0pz @(Pop1' (Proxy EmptyT) Proxy1T 123) (Just 10) Val Nothing9pz @((Id $$ ()) >> Pop1' (Proxy EmptyT) Proxy1T 123) Just Val Nothing predicate-typedmakes a proxy from a simple type: similar to the P instance for 'Proxy but requires a show instance2pz @(Pop1' (Proxy FromInteger) ProxyT 123) (4 % 0) Val (123 % 1)4pz @(Pop1' (Proxy MEmptyT) ProxyT ()) (SG.Product 4)Val (Product {getProduct = 1})?pz @((Id $$ 44) >> Pop1' (Proxy MEmptyT) ProxyT ()) SG.ProductVal (Product {getProduct = 1})pz @((ProxyT << Fst) >> FMap Head) ([True],13) ^!? acts . _Val . to typeRep -- Proxify is easier Just Bool None '(-./>?* predicate-typed,a type level predicate for a negative number predicate-typed,a type level predicate for a positive number predicate-typed:a type level predicate for all negative elements in a list!pz @AllNegative [-1,-5,-10,-2,-3]Val True predicate-typed:a type level predicate for all positive elements in a listpz @AllPositive [1,5,10,2,3]Val Truepz @AllPositive [0,1,5,10,2,3] Val Falsepz @AllPositive [3,1,-5,10,2,3] Val False predicate-typed5a type level predicate for a strictly decreasing list predicate-typed6a type level predicate for a monotonic decreasing list predicate-typed5a type level predicate for a strictly increasing listpz @Asc' [1,2,3,4,5,5,7] Val False pz @Asc' []Val Truepz @Asc' [-10]Val True predicate-typed6a type level predicate for a monotonic increasing listpl @Asc "aaacdef"True ((>>) True | {All(6)})Val Truepz @Asc [1,2,3,4,5,5,7]Val Truepz @Asc "axacdef" Val False predicate-typed8compare two strings ignoring case and return an ordering pz @(Fst ===~ Snd) ("abC","aBc")Val EQ!pz @(Fst ===~ Snd) ("abC","DaBc")Val LT0pl @(Fst ===~ Snd &&& Fst ==! Snd) ("abc","abc")Present (EQ,EQ) ('(EQ,EQ)) Val (EQ,EQ) pl @(Fst ===~ Snd) ("aBc","AbC")Present EQ ((===~) aBc = AbC)Val EQpl @("Abc" ===~ Id) "abc"Present EQ ((===~) Abc = abc)Val EQ predicate-typed similar to RS for a tuple$pz @(Comparing Len) ("abc","123456")Val LT predicate-typed similar to  for a tuplepl @Compare ('b','A')Present GT ((==!) 'b' > 'A')Val GTpl @(Compare) (13,99)Present LT ((==!) 13 < 99)Val LT predicate-typed similar to pz @(Fst ==! Snd) (10,9)Val GT#pz @(14 % 3 ==! Fst -% Snd) (-10,7)Val GTpz @(Fst ==! Snd) (10,11)Val LT1pz @(Snd ==! (L12 >> Head)) (('x',[10,12,13]),10)Val EQpl @("aa" ==! Id) "aaaa" Present LT ((==!) "aa" < "aaaa")Val LTpl @(Pairs >> Map (First (Succ >> Succ) >> Fst ==! Snd)) [1,2,3,6,8]Present [GT,GT,LT,EQ] ((>>) [GT,GT,LT,EQ] | {Map [GT,GT,LT,EQ] | [(1,2),(2,3),(3,6),(6,8)]})Val [GT,GT,LT,EQ]> Map' (Fst ==! Snd) Pairs) 1234223Present [LT,LT,LT,GT,EQ,LT] ((>>) [LT,LT,LT,GT,EQ,LT] | {Map [LT,LT,LT,GT,EQ,LT] | [("1","2"),("2","3"),("3","4"),("4","2"),("2","2"),("2","3")]})Val [LT,LT,LT,GT,EQ,LT]pl @("Abc" ==! Id) "abc" Present LT ((==!) "Abc" < "abc")Val LTpl @(Fst ==! Snd) (3,12)Present LT ((==!) 3 < 12)Val LTpl @(Fst ==! Snd) ("aBc","AbC") Present GT ((==!) "aBc" > "AbC")Val GTpl @(Snd ==! Fst) ("aBc","AbC") Present LT ((==!) "AbC" < "aBc")Val LT predicate-typed.case-insensitive compare if string expression p is not equal to q predicate-typed.case-insensitive compare if string expression p is less than q predicate-typed.case-insensitive compare if string expression p is less than or equal to q predicate-typed.case-insensitive compare if string expression p is equal to qpl @("Abc" ==~ Id) "abc"True (Abc ==~ abc)Val Truepl @(Fst ==~ Snd) ("aBc","AbC")True (aBc ==~ AbC)Val True-pl @(Fst ==~ Snd && Fst == Snd) ("Abc","Abc")True (True && True)Val True predicate-typed.case-insensitive compare if string expression p is greater than or equal to q predicate-typed.case-insensitive compare if string expression p is greater than q predicate-typedcompare if expression p is not equal to q pl @(Fst /= Snd) ("ab","xyzabw")True ("ab" /= "xyzabw")Val True predicate-typedcompare if expression p is less than q predicate-typedcompare if expression p is less than or equal to q)pl @(Not (Fst >> Len <= 6)) ([2..7],True)"False (Not ((>>) True | {6 <= 6})) Val False#pl @(Fst >> Len <= 6) ([2..7],True)True ((>>) True | {6 <= 6})Val True#pl @(Length Fst <= 6) ([2..7],True) True (6 <= 6)Val True%pl @(Fst >> (Len <= 6)) ([2..7],True)True ((>>) True | {6 <= 6})Val True predicate-typedcompare if expression p is equal to q pl @(Fst == Snd) ("ab","xyzabw")False ("ab" == "xyzabw") Val Falsepl @(Fst == Snd) ("aBc","AbC")False ("aBc" == "AbC") Val Falsepz @(Fst == Snd) ("aBc","aBc")Val Truepl @(Id == "Abc") "abc"False ("abc" == "Abc") Val Falsepl @(Fst == Snd) (True,False)False (True == False) Val False.pl @(Not Id *** Id >> Fst == Snd) (True,False)#True ((>>) True | {False == False})Val True predicate-typedcompare if expression p is greater than or equal to q predicate-typedcompare if expression p is greater than qpl @(Id > "xx") "abc"False ("abc" > "xx") Val Falsepl @(Id > "aa") "abc"True ("abc" > "aa")Val Truepl @(Fst > Snd) (True,False)True (True > False)Val True predicate-typedcompare if expression p is not equal to q predicate-typedcompare if expression p is less than to qpl @(Lt 4) 123False (123 < 4) Val False pl @(Lt 4) 1 True (1 < 4)Val True predicate-typedcompare if expression p is less than or equal to q predicate-typedcompare if expression p is equal to q predicate-typedcompare if expression p is greater than or equal to q predicate-typedcompare if expression p is greater than q pl @(Gt 4) 5 True (5 > 4)Val True   4 4 4 4 4 4 4 4 4 4 4 4 4 4None &'(-./<>?U) predicate-typed,calculate the amount to roundup to the next npl @(RoundUp Fst Snd) (3,9)Present 0 (RoundUp 3 9 = 0)Val 0pl @(RoundUp Fst Snd) (3,10)Present 2 (RoundUp 3 10 = 2)Val 2pl @(RoundUp Fst Snd) (3,11)Present 1 (RoundUp 3 11 = 1)Val 1pl @(RoundUp Fst Snd) (3,12)Present 0 (RoundUp 3 12 = 0)Val 0pl @(RoundUp 3 0) ()Present 0 (RoundUp 3 0 = 0)Val 0pl @(RoundUp 0 10) () Error RoundUp 'n' cannot be zero!Fail "RoundUp 'n' cannot be zero" predicate-typedreverse  pz @(UnShowBaseN 2) [1,0,0,1,0]Val 18pz @(UnShowBaseN 2) [1,1,1]Val 7pz @(UnShowBaseN 16) [7,0,3,1] Val 28721pz @(UnShowBaseN 16) [0]Val 0pz @(UnShowBaseN 16) []Val 0 predicate-typedconvert to bits$pl @(ToBits 123 >> UnShowBaseN 2) ()>) 123 | {UnShowBaseN | 2 | [1,1,1,1,0,1,1]})Val 123 predicate-typedDisplay a number at base >= 2 but just show as a list of ints: ignores the sign0pl @(ShowBaseN 16 Id) (256*256*2+256*14+16*7+11)/Present [2,0,14,7,11] (ShowBaseN | 16 | 134779)Val [2,0,14,7,11] predicate-typed-Display a number at base 2 to 36, similar to  but passes the sign throughpz @(ShowBase 16) 4077 Val "fed"pz @(ShowBase 16) (-255) Val "-ff"pz @(ShowBase 2) 147Val "10010011"/pz @(Lift (ShowBase 2) (Negate 147)) "whatever"Val "-10010011"pl @(ShowBase 16) (-123)'Present "-7b" (ShowBase(16) -7b | -123) Val "-7b"pl @(ShowBase 16) 123$Present "7b" (ShowBase(16) 7b | 123)Val "7b"pl @(ShowBase 16) 65504*Present "ffe0" (ShowBase(16) ffe0 | 65504) Val "ffe0" predicate-typed2Read a number using base 2 through a maximum of 36pz @(ReadBase Int 16) "00feD"Val 4077pz @(ReadBase Int 16) "-ff" Val (-255)pz @(ReadBase Int 2) "10010011"Val 147pz @(ReadBase Int 8) "Abff"Fail "invalid base 8"pl @(ReadBase Int 16 >> GuardSimple (Id > 0xffff) >> ShowBase 16) "12344"=Present "12344" ((>>) "12344" | {ShowBase(16) 12344 | 74564}) Val "12344":set -XBinaryLiteralspz @(ReadBase Int 16 >> GuardSimple (Id > 0b10011111) >> ShowBase 16) "7f"Fail "(127 > 159)"pl @(ReadBase Int 16) "fFe0"/Present 65504 (ReadBase(Int,16) 65504 | "fFe0") Val 65504pl @(ReadBase Int 16) "-ff",Present -255 (ReadBase(Int,16) -255 | "-ff") Val (-255)pl @(ReadBase Int 16) "ff")Present 255 (ReadBase(Int,16) 255 | "ff")Val 255pl @(ReadBase Int 22) "zzz"6Error invalid base 22 (ReadBase(Int,22) as=zzz err=[])Fail "invalid base 22"> First (ShowBase 16)) "fFe0"Present ("ffe0","fFe0") ((>>) ("ffe0","fFe0") | {(***) ("ffe0","fFe0") | (65504,"fFe0")})Val ("ffe0","fFe0")pl @(ReadBase Int 2) "101111"*Present 47 (ReadBase(Int,2) 47 | "101111")Val 47 predicate-typed8Read a number using base 2 through a maximum of 36 with t a reference to a type predicate-typed similar to pz @(Signum Id) (-14)Val (-1)pz @(Signum Id) 14Val 1pz @(Signum Id) 0Val 0 predicate-typed similar to  predicate-typed similar to pz @(Map Even) [9,-4,12,1,2,3]&Val [False,True,True,False,True,False]%pz @(Map '(Even,Odd)) [9,-4,12,1,2,3]Val [(False,True),(True,False),(True,False),(False,True),(True,False),(False,True)] predicate-typed similar to  predicate-typed similar to  predicate-typed similar to pz @(QuotRem Fst Snd) (10,3) Val (3,1)pz @(QuotRem Fst Snd) (10,-3) Val (-3,1)pz @(QuotRem Fst Snd) (-10,-3) Val (3,-1)pz @(QuotRem Fst Snd) (-10,3) Val (-3,-1)pz @(QuotRem Fst Snd) (10,0)Fail "QuotRem zero denominator"pl @(QuotRem (Negate Id) 7) 23+Present (-3,-2) (-23 `quotRem` 7 = (-3,-2)) Val (-3,-2)pl @(QuotRem Fst Snd) (10,-3))Present (-3,1) (10 `quotRem` -3 = (-3,1)) Val (-3,1) predicate-typed similar to pz @(DivMod Fst Snd) (10,3) Val (3,1)pz @(DivMod Fst Snd) (10,-3) Val (-4,-2)pz @(DivMod Fst Snd) (-10,3) Val (-4,2)pz @(DivMod Fst Snd) (-10,-3) Val (3,-1)pz @(DivMod Fst Snd) (10,0)Fail "DivMod zero denominator"pl @(DivMod (Negate Id) 7) 23(Present (-4,5) (-23 `divMod` 7 = (-4,5)) Val (-4,5)pl @(DivMod Fst Snd) (10,-3)*Present (-4,-2) (10 `divMod` -3 = (-4,-2)) Val (-4,-2)pl @(DivMod Fst Snd) (10,0)Error DivMod zero denominatorFail "DivMod zero denominator"1pl @(DivMod (9 - Fst) (Snd >> Last)) (10,[12,13])*Present (-1,12) (-1 `divMod` 13 = (-1,12)) Val (-1,12) predicate-typed similar to TUpz @(Mod Fst Snd) (10,3)Val 1pz @(Mod Fst Snd) (10,0)Fail "Mod zero denominator" predicate-typed similar to pz @(Div Fst Snd) (10,4)Val 2pz @(Div Fst Snd) (10,0)Fail "Div zero denominator" predicate-typed similar to pz @(Abs Id) (-14)Val 14pz @(Abs Snd) ("xx",14)Val 14pz @(Abs Id) 0Val 0pz @(Abs (Negate 44)) "aaa"Val 44 predicate-typed similar to pz @(Negate Id) 14 Val (-14)pz @(Negate (Fst * Snd)) (14,3) Val (-42)pz @(Negate (15 -% 4)) "abc" Val (15 % 4)pz @(Negate (15 % 3)) ()Val ((-5) % 1)pz @(Negate (Fst % Snd)) (14,3)Val ((-14) % 3) predicate-typednegate a ratiopl @'[1 % 1 ,3 -% 2,3 -% 1] ()Present [1 % 1,(-3) % 2,(-3) % 1] ('[1 % 1,(-3) % 2,(-3) % 1] (1 % 1) | ())Val [1 % 1,(-3) % 2,(-3) % 1]pl @('[1 % 1 ,Negate (33 % 7), 21 % 4,Signum (7 -% 5)] >> Map (Floor _)) ()Present [1,-5,5,-1] ((>>) [1,-5,5,-1] | {Map [1,-5,5,-1] | [1 % 1,(-33) % 7,21 % 4,(-1) % 1]})Val [1,-5,5,-1]pl @('[1 % 1 ,Negate (33 % 7), 21 % 4,Signum (7 -% 5)] >> Map (Ceiling _)) ()Present [1,-4,6,-1] ((>>) [1,-4,6,-1] | {Map [1,-4,6,-1] | [1 % 1,(-33) % 7,21 % 4,(-1) % 1]})Val [1,-4,6,-1]pl @('[1 % 1 ,Negate (33 % 7), 21 % 4,Signum (7 -% 5)] >> Map (Truncate _)) ()Present [1,-4,5,-1] ((>>) [1,-4,5,-1] | {Map [1,-4,5,-1] | [1 % 1,(-33) % 7,21 % 4,(-1) % 1]})Val [1,-4,5,-1]pl @(5 % 1 / 3 -% 1) 'x'.Present (-5) % 3 (5 % 1 / (-3) % 1 = (-5) % 3)Val ((-5) % 3)pl @(5 -% 1 / Fst) (3,'x').Present (-5) % 3 ((-5) % 1 / 3 % 1 = (-5) % 3)Val ((-5) % 3) predicate-typed creates a  valuepz @(Id < 21 % 5) (-3.1)Val Truepz @(Id < 21 % 5) 4.5 Val Falsepz @(Fst % Snd) (13,2) Val (13 % 2)pz @(13 % Id) 0Fail "(%) zero denominator"pz @(4 % 3 + 5 % 7) "asfd" Val (43 % 21)pz @(4 -% 7 * 5 -% 3) "asfd" Val (20 % 21)pz @(Negate (14 % 3)) ()Val ((-14) % 3)pz @(14 % 3) () Val (14 % 3)=pz @(Negate (14 % 3) ==! Lift (FromIntegral _) (Negate 5)) ()Val GTpz @(14 -% 3 ==! 5 -% 1) "aa"Val GT)pz @(Negate (14 % 3) ==! Negate 5 % 2) ()Val LTpz @(14 -% 3 * 5 -% 1) () Val (70 % 3)pz @(14 % 3 ==! 5 % 1) ()Val LTpz @(15 % 3 / 4 % 2) () Val (5 % 2) predicate-typeddivide for integrals9pz @(On (+) (Id * Id) >> (Id ** (DivI Double 1 2))) (3,4)Val 5.0 predicate-typedfractional divisionpz @(Fst / Snd) (13,2)Val 6.5pz @(ToRational 13 / Id) 0Fail "(/) zero denominator"pz @(12 % 7 / 14 % 5 + Id) 12.4Val (3188 % 245) predicate-typed similar to 2pz @(Fst `LogBase` Snd >> Truncate Int) (10,12345)Val 4 predicate-typedsimilar to 'GHC.Float.(**)'pz @(Fst ** Snd) (10,4) Val 10000.0pz @'(IsPrime,Id ^ 3,(FromIntegral _) ** (Lift (FromRational _) (1 % 2))) 4Val (False,64,2.0) predicate-typedsimilar to 'GHC.Real.(^)'pz @(Fst ^ Snd) (10,4) Val 10000 predicate-typed+multiply two values together pointed to by p and q predicate-typed,subtracts two values together pointed to by p and q predicate-typed'adds two values together pointed to by p and q predicate-typed- function where you need to provide the type t of the resultpz @(Floor Int) (23 % 5)Val 4 predicate-typed< function where you need to provide a reference to the type t of the result predicate-typed- function where you need to provide the type t of the resultpz @(Ceiling Int) (23 % 5)Val 5 predicate-typed< function where you need to provide a reference to the type t of the result predicate-typed- function where you need to provide the type t of the resultpz @(Truncate Int) (23 % 5)Val 4 predicate-typed< function where you need to provide a reference to the type t of the result:pl @(Truncate' (Fst >> UnproxyT) Snd) (Proxy @Integer,2.3)Present 2 (Truncate 2 | 2.3)Val 2$pl @(Truncate' Fst Snd) (1::Int,2.3)Present 2 (Truncate 2 | 2.3)Val 2 predicate-typed- function where you need to provide the type t of the result pz @(FromRational Rational) 23.5 Val (47 % 2) pl @(FromRational Float) (4 % 5)&Present 0.8 (FromRational 0.8 | 4 % 5)Val 0.8 predicate-typed< function where you need to provide a reference to the type t of the result%pl @(FromRational' Fst Snd) (1,2 % 5)&Present 0.4 (FromRational 0.4 | 2 % 5)Val 0.4 predicate-typed functionpz @(ToRational Id) 23.5 Val (47 % 2).pl @((ToRational 123 &&& Id) >> Fst + Snd) 4.2=Present 636 % 5 ((>>) 636 % 5 | {123 % 1 + 21 % 5 = 636 % 5}) Val (636 % 5)pl @(Fst >= Snd || Snd > 23 || 12 -% 5 <= ToRational Fst) (12,13)True (False || True)Val Truepl @(ToRational 14) ()'Present 14 % 1 (ToRational 14 % 1 | 14) Val (14 % 1)%pl @(ToRational 5 / ToRational 3) 'x'%Present 5 % 3 (5 % 1 / 3 % 1 = 5 % 3) Val (5 % 3) predicate-typed- function where you need to provide the type t of the result pz @(FromIntegral (SG.Sum _)) 23Val (Sum {getSum = 23})2pz @(Pop1' (Proxy FromIntegral) 'Proxy 44) (1 % 0) Val (44 % 1) predicate-typed< function where you need to provide a reference to the type t of the result predicate-typed- function where you need to provide the type t of the resultpz @(FromInteger (SG.Sum _)) 23Val (Sum {getSum = 23})#pz @(44 >> FromInteger Rational) 12 Val (44 % 1)pz @(FromInteger Rational) 12 Val (12 % 1)>pl @((Lift (FromInteger _) 12 &&& Id) >> Fst + Snd) (SG.Min 7)Present Min {getMin = 19} ((>>) Min {getMin = 19} | {getMin = 19})Val (Min {getMin = 19})2pl @(Lift (FromInteger _) 12 <> Id) (SG.Product 7)Present Product {getProduct = 84} (Product {getProduct = 12} <> Product {getProduct = 7} = Product {getProduct = 84})Val (Product {getProduct = 84})+pl @(Fst >> FromInteger (SG.Sum _)) (3,"A")?Present Sum {getSum = 3} ((>>) Sum {getSum = 3} | {getSum = 3})Val (Sum {getSum = 3}))pl @(Lift (FromInteger DiffTime) 123) 'x'-Present 123s ((>>) 123s | {FromInteger 123s})Val 123s predicate-typed< function where you need to provide a reference to the type t of the result) )  8 8 7 8 8 7 6 6None &'(-./>?c predicate-typed similar to pz @(STimes 4 Id) (SG.Sum 3)Val (Sum {getSum = 12})pz @(STimes 4 Id) "ab"Val "abababab"pl @(STimes 4 Id) (SG.Sum 13)Present Sum {getSum = 52} (STimes 4 p=Sum {getSum = 13} Sum {getSum = 52} | n=4 | Sum {getSum = 13})Val (Sum {getSum = 52})"pl @(STimes Fst Snd) (4,['x','y'])> MEmptyP) "abc"#Present "" ((>>) "" | {MEmptyT ""})Val "" predicate-typed similar to pz @(MEmptyT (SG.Sum Int)) ()Val (Sum {getSum = 0})&pl @(MEmptyT _ ||| Ones) (Right "abc")9Present ["a","b","c"] ((|||) Right ["a","b","c"] | "abc")Val ["a","b","c"]&pl @(MEmptyT _ ||| Ones) (Left ["ab"])#Present [] ((|||) Left [] | ["ab"])Val []pl @(MEmptyT (Maybe ())) 'x'!Present Nothing (MEmptyT Nothing) Val Nothing/pl @(MEmptyT (SG.Sum _) >> Unwrap >> Id + 4) () Present 4 ((>>) 4 | {0 + 4 = 4})Val 4pz @(FMap (MEmptyT (SG.Product Int))) [Identity (-13), Identity 4, Identity 99]Val [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}])pl @(FMap (MEmptyT (SG.Sum _))) (Just ())?Present Just (Sum {getSum = 0}) (FMap MEmptyT Sum {getSum = 0})Val (Just (Sum {getSum = 0})) predicate-typed similar to $pl @(MEmptyT' Id) (Just (SG.Sum 12))!Present Nothing (MEmptyT Nothing) Val Nothing predicate-typed similar to =pz @(ToNEList >> SConcat Id) [SG.Sum 44, SG.Sum 12, SG.Sum 3]Val (Sum {getSum = 59})pz @(Map '(Pure SG.Sum Id, Pure SG.Max Id) >> ToNEList >> SConcat Id) [7,6,1,3,5](Val (Sum {getSum = 22},Max {getMax = 7}) predicate-typed similar to 1pz @(MConcat Id) [SG.Sum 44, SG.Sum 12, SG.Sum 3]Val (Sum {getSum = 59})pz @(Map '(Pure SG.Sum Id, Pure SG.Max Id) >> MConcat Id) [7 :: Int,6,1,3,5] -- monoid so need eg Int(Val (Sum {getSum = 22},Max {getMax = 7}) predicate-typed?semigroup append both sides of a tuple (ie uncurry (<>)) using " and then unwraps the final resultpz @(Sap (SG.Sum _)) (4,5)Val 9pz @(Sap (SG.Sum _)) (13,44)Val 57pz @(Sap SG.Any) (True,False)Val Truepz @(Sap SG.All) (True,False) Val Falsepz @(Sap (SG.Max _)) (10,12)Val 12pz @(Sap (SG.Sum _)) (10,12)Val 22pz @(Sap (S _)) ("abc","def") Val "abcdef"?pz @(Fst <> Snd) ("abc","def") -- same as above but more direct Val "abcdef" predicate-typedsynonym for wrapping a monoid predicate-typed similar to pz @(Fst <> Snd) ("abc","def") Val "abcdef" pz @("abcd" <> "ef" <> Id) "ghi"Val "abcdefghi" pz @("abcd" <> "ef" <> Id) "ghi"Val "abcdefghi"4pz @(Wrap (SG.Sum _) Id <> (10 >> FromInteger _)) 13Val (Sum {getSum = 23}):pz @(Wrap (SG.Product _) Id <> Lift (FromInteger _) 10) 13 Val (Product {getProduct = 130})> FromInteger _,"def") <> Id) (SG.Sum 12, "_XYZ")!Val (Sum {getSum = 22},"def_XYZ")  6None '(-./567>?0! predicate-typedadt for testing out possible outcomes of Bifoldable used in BiMap predicate-typed similar to VWpz @(BiMap Succ Head) (Left @_ @String 12) -- needs a type signature for Right Val (Left 13)#pz @(BiMap Succ Head) (Right "xyz")Val (Right 'x')pz @(FMap (BiMap Succ Head)) [Right "xyz",Left 'a',Right "ab",Left 'x']+Val [Right 'x',Left 'b',Right 'a',Left 'y']pz @(FMap (BiMap Succ Pred)) [These 12 'b', This 1, That 'd',That 'e']+Val [These 13 'a',This 2,That 'c',That 'd']#pz @(BiMap Succ Pred) (True,12,'b')Val (True,13,'a')pl @(FMap $ BiMap Succ (Not Id)) [This @Int @Bool 1, This 2,That True,These 4 False]Present [This 2,This 3,That False,These 5 True] (FMap BiMap(L) Succ 2 | 1 | BiMap(L) Succ 3 | 2 | BiMap(R) Not (Id True) | BiMap(B) Succ 5 | 4 | Not (Id False))+Val [This 2,This 3,That False,These 5 True]-pl @(BiMap Succ (Not Id)) (This @Int @Bool 1)$Present This 2 (BiMap(L) Succ 2 | 1) Val (This 2)0pl @(BiMap Succ (Not Id)) (That @Int @Bool True)+Present That False (BiMap(R) Not (Id True))Val (That False)3pl @(BiMap Succ (Not Id)) (These @Int @Bool 1 True);Present These 2 False (BiMap(B) Succ 2 | 1 | Not (Id True))Val (These 2 False)pan @(FMap $ BiMap Succ (Not Id)) [This @Int @Bool 1, This 2,That True,These 4 False]P FMap BiMap(L) Succ 2 | BiMap(L) Succ 3 | BiMap(R) Not | BiMap(B) Succ 5 | Not|+- P BiMap(L) Succ 2| || `- P Succ 2|+- P BiMap(L) Succ 3| || `- P Succ 3|+- P BiMap(R) Not| || `- False Not| || `- True Id True|`- P BiMap(B) Succ 5 | Not | +- P Succ 5 | `- True Not | `- False Id False+Val [This 2,This 3,That False,These 5 True]+pl @(BiMap Succ Head) (EEmpty @Int @String) Present EEmpty (BiMap ) Val EEmpty-pl @(BiMap Succ Head) (ELeft @Int @String 10)(Present ELeft 11 (BiMap(L) Succ 11 | 10)Val (ELeft 11)1pl @(BiMap Succ Head) (ERight @Int @String "xyz").Present ERight 'x' (BiMap(R) Head 'x' | "xyz")Val (ERight 'x')3pl @(BiMap Succ Head) (EBoth @Int @String 10 "xyz")?Present EBoth 11 'x' (BiMap(B) Succ 11 | 10 | Head 'x' | "xyz")Val (EBoth 11 'x')pan @(FMap $ BiMap Succ Head) [EEmpty,ELeft 10,ERight "abc",EBoth 10 "xyz"]P FMap BiMap | BiMap(L) Succ 11 | BiMap(R) Head 'a' | BiMap(B) Succ 11 | Head 'x'|+- P BiMap |+- P BiMap(L) Succ 11| || `- P Succ 11|+- P BiMap(R) Head 'a'| || `- P Head 'a'| `- P BiMap(B) Succ 11 | Head 'x' | +- P Succ 11 | `- P Head 'x'-Val [EEmpty,ELeft 11,ERight 'a',EBoth 11 'x'] predicate-typed similar to .pan @(LiftA2 Id (MkJust 12) (MkJust "abc")) () P LiftA2 Id (12,"abc")|+- P MkJust Just 12| | | `- P '12|+- P MkJust Just "abc"| || `- P '"abc"|`- P Id (12,"abc")Val (Just (12,"abc"))/pan @(LiftA2 Swap (MkJust 12) (MkNothing _)) ()P LiftA2 |+- P MkJust Just 12| | | `- P '12|`- P MkNothing Val Nothingpz @(LiftA2 (ShowP Fst <> "---" <> ShowP Snd) Fst Snd) (Just 10, Just True)Val (Just "10---True")3pz @(LiftA2 (Fst + Snd) Fst Snd) (Just 10, Just 13) Val (Just 23)'pz @(LiftA2 Fst '["x","y"] '[1,2,3]) ()Val ["x","x","x","y","y","y"]'pz @(LiftA2 Snd '["x","y"] '[1,2,3]) ()Val [1,2,3,1,2,3]pz @(LiftA2 (Pop0 Fst Snd) '[ Proxy Len ] '[ "abc", "def", "aaaaaaaaaaa"]) () Val [3,3,11]pz @(LiftA2 (Fst * Snd) (FromList (ZipList _) << (10...15)) (FromList (ZipList _) << (1...10))) ()0Val (ZipList {getZipList = [10,22,36,52,70,90]}) predicate-typed similar to  :see also fpz @(Flip Map' Id Succ) [1..5]Val [2,3,4,5,6]pz @(Flip '(,) 'True 2) () Val (2,True)pz @(Flip ('(,,) 1) 2 Id) "ab"Val (1,"ab",2) predicate-typedapplicative bind similar to  but functions have to be fully saturated: ie Len is ok but not Length can use Proxy to delay evaluation until Pop0(pz @(MkJust '("sdf",Id) <*> MkJust 4) ()Val (Just ("sdf",4))!pz @(MkJust Succ <*> MkJust 4) () Val (Just 5),pz @('[Succ,Id,Pred] <*> "abcdef") undefinedVal "ba`cbadcbedcfedgfe"pz @(MkJust "abc" <*> MkJust "def") () -- no function to apply so has to choose ie first oneVal (Just "abc")pz @('[1,2] <*> "abcdef") () -- [1,2] <* "abcdef" -- ie skips rhs "abcdef" but still runs the effectsVal [1,2,1,2,1,2,1,2,1,2,1,2]'pz @(MkJust ((*) 3 Id) <*> MkJust 4) () Val (Just 12)?pz @(MkJust ((*) 3 Len) <*> MkJust '["aa","bb","c","d","e"]) () Val (Just 15).pz @(ShowP Id <$> MkJust Succ <*> MkJust 4) ()Val (Just "5") pz @('["x","y"] <*> '[1,2,3]) ()Val ["x","y","x","y","x","y"] predicate-typedsimilar to monad bind operator XY$pz @(Id >>= HeadMay) (Just "abcdef")Val (Just 'a')*pz @(Uncons >>= (Snd >> HeadMay)) "abcdef"Val (Just 'b')2pz @((1 ... 10) >>= EmptyBool [] Even '[Id,Id]) ()%Val [[2,2],[4,4],[6,6],[8,8],[10,10]]4pz @((1 ... 10) >>= If Even '[Id,Id] (EmptyT [])) ()Val [2,2,4,4,6,6,8,8,10,10]+pz @(Lookup 0 Id >>= Lookup 1 Id) [[1,2,3]] Val (Just 2)+pz @(Lookup 4 Id >>= Lookup 1 Id) [[1,2,3]] Val Nothing+pz @(Lookup 0 Id >>= Lookup 5 Id) [[1,2,3]] Val Nothingpz @(Lookup 0 Id >>= Lookup 1 Id >>= MaybeBool Even '(Id,"is even!")) [[1,2,3]]Val (Just (2,"is even!"))pz @(Lookup 0 Id >>= Lookup 1 Id >>= MaybeBool Even '(Id,"is even!")) [[1,5,3]] Val Nothingpz @((48...55) >>= '[ '[ToEnum Char << Id,ToEnum Char << (Id+3),ToEnum Char << (Id+6)] ]) ()5Val ["036","147","258","369","47:","58;","69<","7:="]pz @((48...55) >>= '[ Map (ToEnum Char) << '[ Id, Id+3 ,Id+6 ] ]) ()5Val ["036","147","258","369","47:","58;","69<","7:="] predicate-typedsimilar to monad operator XZ.pz @(FFish Uncons (Snd >> Uncons) "abcdef") ()Val (Just ('b',"cdef")):m + Data.Timepz @(FFish (ReadMaybe Day Id >> FMap Fst) (MkJust Succ) "2020-02-02") ()Val (Just 2020-02-03)5pz @(FFish Uncons (Lookup Fst "abcdef") [3,14,12]) ()Val (Just 'd') predicate-typedsee  &pz @(Fst <:> Snd) (Just 10, Just True)Val (Just (10,True))$pz @(Fst <:> Snd) ("abc",[10,12,14])Val [('a',10),('a',12),('a',14),('b',10),('b',12),('b',14),('c',10),('c',12),('c',14)]pz @('[1,2] <:> "abcdef") ()Val [(1,'a'),(1,'b'),(1,'c'),(1,'d'),(1,'e'),(1,'f'),(2,'a'),(2,'b'),(2,'c'),(2,'d'),(2,'e'),(2,'f')]2pz @(EnumFromTo Fst Snd <:> ('LT ... 'GT)) (10,11)5Val [(10,LT),(10,EQ),(10,GT),(11,LT),(11,EQ),(11,GT)]pz @(MkJust Succ <:> MkJust 4) () -- uses Succ on (): instead use LiftA2 with Pop0 or <*> (see next 2 tests)3Fail "Succ IO e=Prelude.Enum.().succ: bad argument"?pz @(LiftA2 (Pop0 Fst Snd) (MkJust (Proxy Succ)) (MkJust 4)) () Val (Just 5)!pz @(MkJust Succ <*> MkJust 4) () Val (Just 5) predicate-typedruns  (,) against two values: LiftA2 is traversable and provides better debugging(pz @(FPair Fst Snd) (Just 10, Just True)Val (Just (10,True))pz @(FPair Fst Snd >> FMap (ShowP Fst <> "---" <> ShowP Snd)) (Just 10, Just True)Val (Just "10---True"):pz @(FPair Fst Snd >> FMap (Fst + Snd)) (Just 10, Just 13) Val (Just 23)7pz @(FPair (EnumFromTo Fst Snd) ('LT ... 'GT) ) (10,11)5Val [(10,LT),(10,EQ),(10,GT),(11,LT),(11,EQ),(11,GT)] predicate-typed similar to [\pz @('[1,2,3] <&> Succ) () Val [2,3,4] predicate-typed similar to []#pz @(Len <$> Snd) (1,Just "abcdef") Val (Just 6)=pz @(Len <$> (Id <> Id <> "extra" <$> Snd)) (1,Just "abcdef") Val (Just 17)>pz @(Len <$> (Id <> Id <> "extra" <$> Snd)) (1,Right "abcdef")Val (Right 17):pz @(FMap $ FMap (Succ <$> Id)) (True,Just (These 12 'c'))Val (True,Just (These 12 'd')):pz @(FMap (Second (Succ <$> Id))) [(True, (These 12 'c'))]Val [(True,These 12 'd')] predicate-typed similar to []pl @(FMap Succ) (Right 'a')'Present Right 'b' (FMap Succ 'b' | 'a')Val (Right 'b')pl @(FMap Succ) (Left "Sf")"Present Left "Sf" (FMap )Val (Left "Sf")1pz @(FMap (MkDay Id) >> Join) (Just (2020,01,01))Val (Just 2020-01-01)1pz @(FMap (MkDay Id) >> Join) (Just (2020,01,32)) Val Nothingpz @(FMap Succ) (Just LT) Val (Just EQ)pz @(FMap Pred) (Just LT)9Fail "Pred IO e=Prelude.Enum.Ordering.pred: bad argument"pz @(FMap (ShowP Id)) (Just 10)Val (Just "10")pan @(FMap $ FMap $ FMap Succ) [Just "abcdefG",Nothing,Just "X"]P FMap FMap FMap Succ 'b' | Succ 'c' | Succ 'd' | Succ 'e' | Succ 'f' | Succ 'g' | Succ 'H' | FMap | FMap FMap Succ 'Y'|+- P FMap FMap Succ 'b' | Succ 'c' | Succ 'd' | Succ 'e' | Succ 'f' | Succ 'g' | Succ 'H'| || `- P FMap Succ 'b' | Succ 'c' | Succ 'd' | Succ 'e' | Succ 'f' | Succ 'g' | Succ 'H'| || +- P Succ 'b'| || +- P Succ 'c'| || +- P Succ 'd'| || +- P Succ 'e'| || +- P Succ 'f'| || +- P Succ 'g'| || `- P Succ 'H'|+- P FMap |`- P FMap FMap Succ 'Y' | `- P FMap Succ 'Y' | `- P Succ 'Y'%Val [Just "bcdefgH",Nothing,Just "Y"]!pan @(FMap (FromEnum > 97)) "abc""P FMap 97 > 97 | 98 > 97 | 99 > 97|+- False 97 > 97| || +- P FromEnum 97| | | `- P '97|+- True 98 > 97| || +- P FromEnum 98| | | `- P '97|`- True 99 > 97 | +- P FromEnum 99 | `- P '97Val [False,True,True]'pan @(FMap (FromEnum > 97 >> Id)) "abc" )P FMap (>>) False | (>>) True | (>>) True|+- P (>>) False| || +- False 97 > 97| | || | +- P FromEnum 97| | || | `- P '97| || `- P Id False|+- P (>>) True| || +- True 98 > 97| | || | +- P FromEnum 98| | || | `- P '97| || `- P Id True|`- P (>>) True | +- True 99 > 97 | | | +- P FromEnum 99 | | | `- P '97 | `- P Id TrueVal [False,True,True]pan @(FMap IdBool) (Just True) P FMap IdBool|`- True IdBoolVal (Just True),pz @(FMap (Pure (Either String) Id)) [1,2,4]Val [Right 1,Right 2,Right 4]!pl @(FMap (Pure [] Id)) (Just 10)'Present Just [10] (FMap Pure [10] | 10)Val (Just [10])%pl @(FMap (Pure SG.Sum Id)) (Just 20)Present Just (Sum {getSum = 20}) (FMap Pure Sum {getSum = 20} | 20)Val (Just (Sum {getSum = 20}))pz @(FMap (Coerce (SG.Sum Integer))) [Identity (-13), Identity 4, Identity 99];Val [Sum {getSum = -13},Sum {getSum = 4},Sum {getSum = 99}]> FMap Succ) () ^!? acts . _Val . to typeRep Just Char predicate-typed>Lift a no arg Adt to a function of one argument (for use with   and  )"pl @(Lift Len Snd) (True,"abcdef")'Present 6 ((>>) 6 | {Len 6 | "abcdef"})Val 6 predicate-typed similar to !:types dont need to match on rhs!'pl @(RDot '[L1,L2,L3,K "xxx"] Id) 12345Present "xxx" (K '"xxx") Val "xxx"*pl @(RDot '[L1,L2,L3,K '("abc",Id)] Id) ()"Present ("abc",()) (K '("abc",()))Val ("abc",())1pl @(Dot '[K "skip",L6,Lift Dup,Lift Succ] Id) ()Present "skip" (K '"skip") Val "skip"7pl @(L3 $ L2 $ L1 $ K Id "dud") ((1,("X",9,'a')),(3,4))#Present 'a' (Thd 'a' | ("X",9,'a'))Val 'a'pl @((L3 $ L2 $ L1 $ K Id "dud") >> Pred) ((1,("X",9,'a')),(3,4)))Present '`' ((>>) '`' | {Pred '`' | 'a'})Val '`'pl @(K "ss" $ L3 $ L3 $ Fst) ()Present "ss" (K '"ss")Val "ss" predicate-typedreversed version of  .pl @(RDot '[L1,L2,L3] Id) ((1,(2,9,10)),(3,4))Present 10 (Thd 10 | (2,9,10))Val 10,pl @(RDot '[L1,L2] Id) (('a',2),(True,"zy"))Present 2 (Snd 2 | ('a',2))Val 2 predicate-typedcompose simple functions-pl @(Dot '[L3,L2,L1] Id) ((1,(2,9,10)),(3,4))Present 10 (Thd 10 | (2,9,10))Val 10 predicate-typedrun an expression p% and on failure print a custom error s+ using the error string and the input value=pz @(Catch' Succ (Second (ShowP Id) >> PrintT "%s %s" Id)) GT> PrintT "%s %s" Id)) LTVal EQpl @(Catch' (FailT Int "someval") (PrintT "msg=%s caught(%03d)" Id)) 44>Error msg=someval caught(044) (Catch default condition failed)Fail "msg=someval caught(044)"pl @(Catch' OneP (Second (ShowP Id) >> PrintT "msg=%s caught(%s)" Id)) [10,12,13]Error msg=OneP:expected one element(3) caught([10,12,13]) (Catch default condition failed):Fail "msg=OneP:expected one element(3) caught([10,12,13])"pl @(Catch' OneP (PrintT "msg=%s caught(%s)" (Second (ShowP Id)))) [10]Present 10 (Catch did not fire)Val 10pl @(Catch' OneP (PrintT "msg=%s err s=%s" (Second (ShowP Id)))) [10,11]Error msg=OneP:expected one element(2) err s=[10,11] (Catch default condition failed)5Fail "msg=OneP:expected one element(2) err s=[10,11]" predicate-typedrun an expression p and on failure run qpz @(Catch Succ (Fst >> Second (ShowP Id) >> PrintT "%s %s" Id >> 'LT)) GTVal LT3pz @(Len > 1 && Catch (Id !! 3 == 66) 'False) [1,2] Val False4pl @(Catch (Resplit "\\d+(") (Snd >> MEmptyP)) "123">) Nothing | {Sequence Nothing | [Nothing,Nothing,Nothing,Just 4,Just 5]}) Val Nothing+pl @(Traverse (MaybeBool (Le 3) Id)) [1..5]Present Nothing ((>>) Nothing | {Sequence Nothing | [Just 1,Just 2,Just 3,Nothing,Nothing]}) Val Nothingpl @(Traverse (If (Gt 0) (Pure Maybe Id) (EmptyT Maybe))) [1..5]Present Just [1,2,3,4,5] ((>>) Just [1,2,3,4,5] | {Sequence Just [1,2,3,4,5] | [Just 1,Just 2,Just 3,Just 4,Just 5]})Val (Just [1,2,3,4,5])?pl @(Traverse (If (Gt 0) (Pure Maybe Id) (MkNothing _))) [1..5]Present Just [1,2,3,4,5] ((>>) Just [1,2,3,4,5] | {Sequence Just [1,2,3,4,5] | [Just 1,Just 2,Just 3,Just 4,Just 5]})Val (Just [1,2,3,4,5]).pl @(Traverse (MaybeBool (Id >= 0) Id)) [1..5]Present Just [1,2,3,4,5] ((>>) Just [1,2,3,4,5] | {Sequence Just [1,2,3,4,5] | [Just 1,Just 2,Just 3,Just 4,Just 5]})Val (Just [1,2,3,4,5]).pl @(Traverse (MaybeBool (Id <= 3) Id)) [1..5]Present Nothing ((>>) Nothing | {Sequence Nothing | [Just 1,Just 2,Just 3,Nothing,Nothing]}) Val Nothing predicate-typed similar to (pz @Sequence [Just 10, Just 20, Just 30]Val (Just [10,20,30]):pz @Sequence [Just 10, Just 20, Just 30, Nothing, Just 40] Val Nothing predicate-typed9flipped function application for expressions: similar to :m + Text.Show.Functionspz @(Snd $& Fst) ((*16),4)Val 64pz @("def" $& Id) ("abc"<>) Val "abcdef"pz @('True $& 4 $& Id) (,) Val (4,True) predicate-typedfunction application for pure functions appearing on the rhs: similar to ./:m + Text.Show.Functionspz @(Fst $$ Snd) ((*16),4)Val 64pz @(Id $$ "def") ("abc"<>) Val "abcdef"pz @(Id $$ 12) (*13)Val 156pz @(Id $$ 7 $$ 3) (*)Val 21pz @(Id $$ 7 $$ 3) (,) Val (7,3)pz @(Id $$ "abc" $$ 'True) (,)Val ("abc",True)&pz @(Id $$ "asdf" $$ 99 $$ C "A") (,,)Val ("asdf",99,'A')#(fmap.fmap) ($ 9999) $ pz @Id (*33) Val 3299672(fmap.fmap) ($ 9999) $ pz @(Id $$ 1 $$ 'True) (,,)Val (1,True,9999).(fmap.fmap.fmap) ($ 8) $ pz @'("xxx",Id) (*33)Val ("xxx",264)#pz @('True $& 4 $& Id $$ "aa") (,,)Val (4,True,"aa");pz @((Id $$ "abc" $$ Wrap (SG.Sum _) 14) >> Id <> Id) These(Val (These "abcabc" (Sum {getSum = 28})) predicate-typed similar to pz @Join (Just (Just 20)) Val (Just 20)pz @Join ["ab","cd","","ef"] Val "abcdef" predicate-typed similar to pz @Duplicate (20,"abc")Val (20,(20,"abc")) predicate-typed similar to pz @Extract (Nothing,Just 20) Val (Just 20)pz @Extract (Identity 20)Val 20pl @Extract (10,"hello")0Present "hello" (Extract "hello" | (10,"hello")) Val "hello" predicate-typed similar to #pz @(Fst <|> Snd) (Nothing,Just 20) Val (Just 20)#pz @(Fst <|> Snd) (Just 10,Just 20) Val (Just 10)#pz @(Fst <|> Snd) (Nothing,Nothing) Val Nothing)pl @(Fst <|> Snd) (Just "cdef",Just "ab")Present Just "cdef" ((<|>) Just "cdef" | p=Just "cdef" | q=Just "ab")Val (Just "cdef")'pl @(Fst <|> Snd) ("cdef","ab"::String)5Present "cdefab" ((<|>) "cdefab" | p="cdef" | q="ab") Val "cdefab" predicate-typedsimilar to Applicative "pl @(Fst *> Snd) (Just 4,Just 'a')6Present Just 'a' ((*>) Just 4 | p=Just 4 | q=Just 'a')Val (Just 'a')pz @('["x","y"] *> '[1,2,3]) ()Val [1,2,3,1,2,3] predicate-typedsimilar to Applicative "pl @(Fst <* Snd) (Just 4,Just 'a')4Present Just 4 ((<*) Just 4 | p=Just 4 | q=Just 'a') Val (Just 4)%pz @(Fst <* Snd) (Just "abc",Just 20)Val (Just "abc")pz @('["x","y"] <* '[1,2,3]) ()Val ["x","x","x","y","y","y"] predicate-typed similar to  pz @(Fst <$ Snd) ("abc",Just 20)Val (Just "abc")$pl @(Fst <$ Snd) (4,These "xxx" 'a')Present These "xxx" 4 ((<$) 4)Val (These "xxx" 4)pl @(Fst <$ Snd) (4,This 'a')Present This 'a' ((<$) 4)Val (This 'a')pl @(Fst <$ Snd) (4,Just 'a')Present Just 4 ((<$) 4) Val (Just 4)!pl @(Fst <$ Snd) (4,Nothing @Int)Present Nothing ((<$) 4) Val Nothingpl @('True <$ Id) [1..4])Present [True,True,True,True] ((<$) True)Val [True,True,True,True]import Data.Functor.Compose*pl @(C "ab" <$ Id) (Compose $ Just [1..4])(Present Compose (Just "aaaa") ((<$) 'a')Val (Compose (Just "aaaa"))pl @(Snd <$ Fst) (Just 10,'x')Present Just 'x' ((<$) 'x')Val (Just 'x')% %  1 1 6 1 4 1 1 1 1 0 3 4 4 4None '(-./>? predicate-typed%encode a json file with pretty option predicate-typedencode json with pretty option%pl @(EncodeJson 'False Id) (10,"def").Present "[10,\"def\"]" (EncodeJson [10,"def"])Val "[10,\"def\"]">pl @(EncodeJson 'False Id >> ParseJson (Int,Bool) Id) (1,True)Present (1,True) ((>>) (1,True) | {ParseJson (Int,Bool) (1,True)}) Val (1,True) predicate-typedparse a json file p using the type t8pz @(ParseJsonFile [A.Value] "test1.json" >> Id !! 2) ()Val (Object (fromList [("lastName",String "Doe"),("age",Number 45.0),("firstName",String "John"),("likesPizza",Bool False)])) predicate-typedparse json file p using the type t predicate-typedparse json data using the type t.pl @(ParseJson (Int,String) Id) "[10,\"abc\"]"6Present (10,"abc") (ParseJson (Int,[Char]) (10,"abc"))Val (10,"abc")1pl @(ParseJson (Int,String) Id) "[10,\"abc\",99]"Error ParseJson (Int,[Char])([10,"abc",99]) Error in $: cannot unpack array of length 3 into a tuple of length 2 ([10,"abc",99])Fail "ParseJson (Int,[Char])([10,\"abc\",99]) Error in $: cannot unpack array of length 3 into a tuple of length 2"7pl @(ParseJson (Int,Bool) (FromString _ Id)) "[1,true]"0Present (1,True) (ParseJson (Int,Bool) (1,True)) Val (1,True)1pl @(ParseJson (Int,Bool) Id) (A.encode (1,True))0Present (1,True) (ParseJson (Int,Bool) (1,True)) Val (1,True) pl @(ParseJson () Id) "[1,true]"Error ParseJson ()([1,true]) Error in $: parsing () failed, expected an empty array ([1,true])Fail "ParseJson ()([1,true]) Error in $: parsing () failed, expected an empty array" predicate-typedparse json data using the type t  None &'(-./>?. predicate-typed similar to ^_pz @Ors [False,False,False] Val Falsepl @Ors [True,True,True,False]*True (Ors(4) i=0 | [True,True,True,False])Val True pl @Ors []False (Ors(0) | []) Val False predicate-typed similar to ^`pz @Ands [True,True,True]Val Truepl @Ands [True,True,True,False],False (Ands(4) i=3 | [True,True,True,False]) Val False pz @Ands []Val True predicate-typedwraps each item in the foldable container and then unwraps the mconcatenated result: uses ab'pz @(FoldMap (SG.Sum _) Id) [44, 12, 3]Val 59+pz @(FoldMap (SG.Product _) Id) [44, 12, 3]Val 1584type Ands' p = FoldMap SG.All p%pz @(Ands' Id) [True,False,True,True] Val Falsepz @(Ands' Id) [True,True,True]Val Truepz @(Ands' Id) []Val Truetype Ors' p = FoldMap SG.Any p!pz @(Ors' Id) [False,False,False] Val Falsepz @(Ors' Id) [] Val False&pz @(Ors' Id) [False,False,False,True]Val True1type AllPositive' = FoldMap SG.All (Map Positive) pz @AllPositive' [3,1,-5,10,2,3] Val False1type AllNegative' = FoldMap SG.All (Map Negative)"pz @AllNegative' [-1,-5,-10,-2,-3]Val True:set -XKindSignaturestype Max' (t :: Type) = FoldMap (SG.Max t) Id -- requires t be Bounded for monoid instancepz @(Max' Int) [10,4,5,12,3,4]Val 12(pl @(FoldMap (SG.Sum _) Id) [14,8,17,13]$Present 52 ((>>) 52 | {getSum = 52})Val 52pl @(FoldMap (SG.Max _) Id) [14 :: Int,8,17,13] -- allowed as the values are Bounded!$Present 17 ((>>) 17 | {getMax = 17})Val 17pl @((Len >> (Elem Id '[4,7,1] || (Mod Id 3 >> Same 0))) || (FoldMap (SG.Sum _) Id >> Gt 200)) [1..20]True (False || True)Val Truepl @((Len >> (Elem Id '[4,7,1] || (Mod Id 3 >> Same 0))) || (FoldMap (SG.Sum _) Id >> Gt 200)) [1..19]False (False || False | ((>>) False | {1 == 0}) || ((>>) False | {190 > 200})) Val Falsepl @((Len >> (Elem Id '[4,7,1] || (Mod Id 3 >> Same 0))) || (FoldMap (SG.Sum _) Id >> Gt 200)) []True (True || False)Val Truepl @((Len >> (Elem Id '[4,7,1] || (Mod Id 3 >> Same 0))) &&& FoldMap (SG.Sum _) Id) [1..20]"Present (False,210) ('(False,210))Val (False,210)0pl @(FoldMap SG.Any Id) [False,False,True,False]*Present True ((>>) True | {getAny = True})Val True0pl @(FoldMap SG.All Id) [False,False,True,False]-Present False ((>>) False | {getAll = False}) Val False%pl @(FoldMap (SG.Sum _) Id) (Just 13)$Present 13 ((>>) 13 | {getSum = 13})Val 13#pl @(FoldMap (SG.Sum _) Id) [1..10]$Present 55 ((>>) 55 | {getSum = 55})Val 55 predicate-typed similar to  using pz @Null [1,2,3,4] Val False pz @Null []Val Truepz @Null NothingVal True predicate-typedexplicit version of   with an extra parameter p to point to the value predicate-typed similar to pz @ToList "aBc" Val "aBc"pz @ToList (Just 14)Val [14]pz @ToList NothingVal []pz @ToList (Left "xx")Val []pz @ToList (These 12 "xx") Val ["xx"]*pl @ToList (M.fromList $ zip [0..] "abcd")Present "abcd" (ToList fromList [(0,'a'),(1,'b'),(2,'c'),(3,'d')]) Val "abcd"pl @ToList (Just 123)Present [123] (ToList Just 123) Val [123]/pl @ToList (M.fromList (zip ['a'..] [9,2,7,4]))Present [9,2,7,4] (ToList fromList [('a',9),('b',2),('c',7),('d',4)]) Val [9,2,7,4] predicate-typed similar to  but for a fixed number n1: for an empty list it just returns an empty listpz @(Cycle 5 Id) [1,2]Val [1,2,1,2,1]pz @(Cycle 5 Id) []Val [] predicate-typed similar to  predicate-typed similar to "pz @Concat ["abc","D","eF","","G"] Val "abcDeFG"1pz @(Snd >> Concat) ('x',["abc","D","eF","","G"]) Val "abcDeFG" predicate-typedinvokes &requires the OverloadedLists extension:set -XOverloadedLists0pz @(FromListExt (M.Map _ _)) [(4,"x"),(5,"dd")]!Val (fromList [(4,"x"),(5,"dd")]) predicate-typedinvokes run @('OMsg "Fred" ':# 'OLite ':# 'OColorOff) @(FromList (Set.Set Int) << '[2,1,5,5,2,5,2]) ()Fred >>> Present fromList [1,2,5] ((>>) fromList [1,2,5] | {FromList fromList [1,2,5]})Val (fromList [1,2,5])pl @(FromList (M.Map _ _) >> Id !! C "y") [('x',True),('y',False)]Present False ((>>) False | {IxL('y') False | p=fromList [('x',True),('y',False)] | q='y'}) Val Falsepl @(FromList (M.Map _ _) >> Id !! C "z") [('x',True),('y',False)]Error (!!) index not found (IxL('z') | fromList [('x',True),('y',False)])Fail "(!!) index not found"-pl @(FromList (M.Map _ _)) [(4,"x"),(5,"dd")]Present fromList [(4,"x"),(5,"dd")] (FromList fromList [(4,"x"),(5,"dd")])!Val (fromList [(4,"x"),(5,"dd")]) predicate-typedinvokes ,pz @ToListExt (M.fromList [(1,'x'),(4,'y')])Val [(1,'x'),(4,'y')]pz @ToListExt (T.pack "abc") Val "abc" predicate-typed similar to !pz @(IToList _) ("aBc" :: String)Val [(0,'a'),(1,'B'),(2,'c')]"pl @(IToList _) ("abcd" :: String)Present [(0,'a'),(1,'b'),(2,'c'),(3,'d')] (IToList(Int) [(0,'a'),(1,'b'),(2,'c'),(3,'d')] | "abcd")%Val [(0,'a'),(1,'b'),(2,'c'),(3,'d')]9pl @(IToList _) (M.fromList $ itoList ("abcd" :: String))Present [(0,'a'),(1,'b'),(2,'c'),(3,'d')] (IToList(Int) [(0,'a'),(1,'b'),(2,'c'),(3,'d')] | fromList [(0,'a'),(1,'b'),(2,'c'),(3,'d')])%Val [(0,'a'),(1,'b'),(2,'c'),(3,'d')]pl @(IToList _) [9,2,7,4]Present [(0,9),(1,2),(2,7),(3,4)] (IToList(Int) [(0,9),(1,2),(2,7),(3,4)] | [9,2,7,4])Val [(0,9),(1,2),(2,7),(3,4)]4pl @(IToList _) (M.fromList (zip ['a'..] [9,2,7,4]))Present [('a',9),('b',2),('c',7),('d',4)] (IToList(Char) [('a',9),('b',2),('c',7),('d',4)] | fromList [('a',9),('b',2),('c',7),('d',4)])%Val [('a',9),('b',2),('c',7),('d',4)]pl @(IToList _) (Just 234)6Present [((),234)] (IToList(()) [((),234)] | Just 234)Val [((),234)]!pl @(IToList _) (Nothing @Double)%Present [] (IToList(()) [] | Nothing)Val []pl @(IToList _) [1..5]Present [(0,1),(1,2),(2,3),(3,4),(4,5)] (IToList(Int) [(0,1),(1,2),(2,3),(3,4),(4,5)] | [1,2,3,4,5])#Val [(0,1),(1,2),(2,3),(3,4),(4,5)]pl @(IToList _) ['a','b','c']Present [(0,'a'),(1,'b'),(2,'c')] (IToList(Int) [(0,'a'),(1,'b'),(2,'c')] | "abc")Val [(0,'a'),(1,'b'),(2,'c')] predicate-typedexplicit version of   with an extra parameter p to point to the value2pz @(IToList' (Hole _) Snd) (True,"aBc" :: String)Val [(0,'a'),(1,'B'),(2,'c')] predicate-typed similar to  using pz @IsEmpty [1,2,3,4] Val Falsepz @IsEmpty []Val Truepz @IsEmpty LT Val Falsepz @IsEmpty EQVal True"pl @IsEmpty ("failed11" :: T.Text)False (IsEmpty | "failed11") Val Falsepl @IsEmpty ("" :: T.Text)True (IsEmpty | "")Val True predicate-typed create a  list from a pz @ToNEList []Fail "empty list"pz @ToNEList [1,2,3,4,5]Val (1 :| [2,3,4,5])  None '(-./>? predicate-typedextract the value from a  or fail with the given message"pz @(JustFail "nope" Id) (Just 99)Val 99 pz @(JustFail "nope" Id) Nothing Fail "nope"8pz @(JustFail (PrintF "oops=%d" Snd) Fst) (Nothing, 123)Fail "oops=123"9pz @(JustFail (PrintF "oops=%d" Snd) Fst) (Just 'x', 123)Val 'x' predicate-typedextract the value from a - otherwise use the default value: similar to 1c$pz @(JustDef (1 % 4) Id) (Just 20.4) Val (102 % 5) pz @(JustDef (1 % 4) Id) Nothing Val (1 % 4)(pz @(JustDef (MEmptyT _) Id) (Just "xy")Val "xy"$pz @(JustDef (MEmptyT _) Id) NothingVal ()-pz @(JustDef (MEmptyT (SG.Sum _)) Id) NothingVal (Sum {getSum = 0})pl @(JustDef 0 Id) (Just 123)Present 123 (JustDef Just)Val 123pl @(JustDef 0 Id) NothingPresent 0 (JustDef Nothing)Val 0pl @(JustDef 99 Id) (Just 12)Present 12 (JustDef Just)Val 12pl @(JustDef 99 Id) NothingPresent 99 (JustDef Nothing)Val 99"pl @(JustDef (99 -% 1) Id) Nothing#Present (-99) % 1 (JustDef Nothing)Val ((-99) % 1)0pl @(JustDef (MEmptyT _) Id) (Just (SG.Sum 123)))Present Sum {getSum = 123} (JustDef Just)Val (Sum {getSum = 123})2pl @(JustDef (MEmptyT _) Id) (Nothing @(SG.Sum _))*Present Sum {getSum = 0} (JustDef Nothing)Val (Sum {getSum = 0}) predicate-typed%Convenient method to convert a value p( to an Alternative based on a predicate bif b is True then pure p else empty$pz @(EmptyBool [] (Id > 4) 'True) 24 Val [True]#pz @(EmptyBool [] (Id > 4) 'True) 1Val [] predicate-typed%Convenient method to convert a value p to a  based on a predicate b if b then Just p else Nothingpz @(MaybeBool (Id > 4) Id) 24 Val (Just 24) pz @(MaybeBool (Id > 4) Id) (-5) Val Nothingpz @(MaybeBool 'True 10) () Val (Just 10) predicate-typed similar to 1d:pl @CatMaybes [Just 'a',Nothing,Just 'c',Just 'd',Nothing]Present "acd" ((>>) "acd" | {Concat "acd" | ["a","","c","d",""]}) Val "acd" predicate-typedlike 1e.pl @(MapMaybe (MaybeBool (Le 3) Id) Id) [1..5]Present [1,2,3] ((>>) [1,2,3] | {Concat [1,2,3] | [[1],[2],[3],[],[]]}) Val [1,2,3].pl @(MapMaybe (MaybeBool (Gt 3) Id) Id) [1..5]Present [4,5] ((>>) [4,5] | {Concat [4,5] | [[],[],[],[4],[5]]}) Val [4,5] predicate-typed similar to pz @IsNothing (Just 123) Val Falsepz @IsNothing NothingVal True6pl @(Not IsNothing &&& ('Just Id >> Id + 12)) (Just 1)Present (True,13) ('(True,13)) Val (True,13)5pl @(Not IsNothing &&& ('Just Id >> Id + 12)) NothingError 'Just(empty) ('(,))Fail "'Just(empty)" predicate-typed similar to pz @IsJust Nothing Val Falsepz @IsJust (Just 'a')Val True predicate-typed similar to 1f"provides a Proxy to the result of q- but does not provide the surrounding context3pz @(MaybeIn "foundnothing" (ShowP Pred)) (Just 20)Val "19"2pz @(MaybeIn "found nothing" (ShowP Pred)) NothingVal "found nothing">pl @(MaybeIn 'True Id) (Nothing @Bool) -- need @() else breaks$True (MaybeIn(Nothing) True | Proxy)Val True.pl @(MaybeIn (FailT _ "failed4") Id) (Just 10)"Present 10 (MaybeIn(Just) 10 | 10)Val 10;pl @(MaybeIn 'False Id) (Nothing @Bool) -- breaks otherwise&False (MaybeIn(Nothing) False | Proxy) Val False'pl @(MaybeIn MEmptyP Id) (Just [1,2,3])1Present [1,2,3] (MaybeIn(Just) [1,2,3] | [1,2,3]) Val [1,2,3])pl @(MaybeIn MEmptyP Id) (Nothing @[Int])(Present [] (MaybeIn(Nothing) [] | Proxy)Val []+pl @(MaybeIn (FailP "err") Succ) (Just 116)%Present 117 (MaybeIn(Just) 117 | 116)Val 117$pl @(MaybeIn 99 Succ) (Nothing @Int)(Present 99 (MaybeIn(Nothing) 99 | Proxy)Val 992pl @(MaybeIn (FailP "someval") Succ) (Nothing @()) Error someval (MaybeIn(Nothing))Fail "someval"(pl @(MaybeIn 'True 'False) (Nothing @())$True (MaybeIn(Nothing) True | Proxy)Val True&pl @(MaybeIn 'True 'False) (Just "aa")"False (MaybeIn(Just) False | "aa") Val False4pl @(MaybeIn MEmptyP (Fst ==! Snd)) (Just ('x','z')))Present LT (MaybeIn(Just) LT | ('x','z'))Val LT:pl @(MaybeIn MEmptyP (Fst ==! Snd)) (Nothing @(Char,Char))(Present EQ (MaybeIn(Nothing) EQ | Proxy)Val EQ6pl @(MaybeIn (FailP "failed20") 'False) (Nothing @Int)!Error failed20 (MaybeIn(Nothing))Fail "failed20"pl @(MaybeIn ('False >> FailS "failed21") 'False) (Nothing @Double))Error failed21 (False | MaybeIn(Nothing))Fail "failed21"-pl @(MaybeIn (FailP "err") Id) (Nothing @Int)Error err (MaybeIn(Nothing)) Fail "err",pl @(MaybeIn (FailP "err") Id) (Nothing @())Error err (MaybeIn(Nothing)) Fail "err"6pl @(MaybeIn MEmptyP Id) (Just (M.fromList [(1,'a')]))Present fromList [(1,'a')] (MaybeIn(Just) fromList [(1,'a')] | fromList [(1,'a')])Val (fromList [(1,'a')])1pl @(MaybeIn MEmptyP Id) (Nothing @(M.Map () ())):Present fromList [] (MaybeIn(Nothing) fromList [] | Proxy)Val (fromList [])/pl @(MaybeIn MEmptyP Ones) (Just @String "abc");Present ["a","b","c"] (MaybeIn(Just) ["a","b","c"] | "abc")Val ["a","b","c"]pl @(MaybeIn 99 Id) (Just 12)"Present 12 (MaybeIn(Just) 12 | 12)Val 12pl @(MaybeIn 99 Id) Nothing(Present 99 (MaybeIn(Nothing) 99 | Proxy)Val 99"pl @(MaybeIn (99 -% 1) Id) Nothing6Present (-99) % 1 (MaybeIn(Nothing) (-99) % 1 | Proxy)Val ((-99) % 1)#pl @(MaybeIn 123 Id) (Nothing @Int)*Present 123 (MaybeIn(Nothing) 123 | Proxy)Val 123pl @(MaybeIn 123 Id) (Just 9)Present 9 (MaybeIn(Just) 9 | 9)Val 9,pl @(Uncons >> MaybeIn '(1,MEmptyT _) Id) []Present (1,[]) ((>>) (1,[]) | {MaybeIn(Nothing) (1,[]) | Proxy}) Val (1,[])3pl @(MaybeIn MEmptyP (ShowP Id >> Ones)) (Just 123)9Present ["1","2","3"] (MaybeIn(Just) ["1","2","3"] | 123)Val ["1","2","3"]:pl @(MaybeIn MEmptyP (ShowP Id >> Ones)) (Nothing @String)(Present [] (MaybeIn(Nothing) [] | Proxy)Val [].pl @(MaybeIn MEmptyP Ones) (Just @String "ab")2Present ["a","b"] (MaybeIn(Just) ["a","b"] | "ab") Val ["a","b"],pl @(MaybeIn MEmptyP Ones) (Nothing @String)(Present [] (MaybeIn(Nothing) [] | Proxy)Val [] predicate-typedgh constructorpz @(MkJust Id) 44 Val (Just 44) predicate-typed%constructs a Nothing for a given type predicate-typed%constructs a Nothing for a given type predicate-typed similar to 12pz @(Just' >> Succ) (Just 20)Val 21pz @(Just' >> Succ) NothingFail "Just' found Nothing" None '(-./>?) predicate-typedtype operator version of  pl @((Id !!? C "d") > MkJust 99 || Length Id <= 3) (M.fromList $ zip "abcd" [1..])7False (False || False | (Just 4 > Just 99) || (4 <= 3)) Val Falsepz @((Id !!? C "d") > MkJust 2 || Length Id <= 3) (M.fromList $ zip "abcd" [1..])Val True predicate-typed leveraging : see  )pz @(Lookup 2 Id) ["abc","D","eF","","G"]Val (Just "eF")*pz @(Lookup 20 Id) ["abc","D","eF","","G"] Val Nothingpl @(FromList (M.Map _ _) >> Lookup (C "y") Id) [('x',True),('y',False)]Present Just False ((>>) Just False | {Lookup('y') False | q=fromList [('x',True),('y',False)] | p='y'})Val (Just False)pl @(FromList (M.Map _ _) >> Lookup (C "z") Id) [('x',True),('y',False)]8Present Nothing ((>>) Nothing | {Lookup('z') not found}) Val Nothing,pl @(Lookup 1 Id) [('x',14),('y',3),('z',5)]Present Just ('y',3) (Lookup(1) ('y',3) | q=[('x',14),('y',3),('z',5)] | p=1)Val (Just ('y',3))-pl @(Lookup 14 Id) [('x',14),('y',3),('z',5)]&Present Nothing (Lookup(14) not found) Val Nothingpl @(Lookup 3 "abcdef") ()3Present Just 'd' (Lookup(3) 'd' | q="abcdef" | p=3)Val (Just 'd') pl @(Lookup 4 '[1,2,3,4,5,6]) ()4Present Just 5 (Lookup(4) 5 | q=[1,2,3,4,5,6] | p=4) Val (Just 5) predicate-typed similar to Hi leveraging %pz @(Id !! 2) ["abc","D","eF","","G"]Val "eF"&pz @(Id !! 20) ["abc","D","eF","","G"]Fail "(!!) index not found"pz @(Id !! "eF") (M.fromList (flip zip [0..] ["abc","D","eF","","G"]))Val 2 pl @(Id !! 3) ("asfd" :: T.Text))Present 'd' (IxL(3) 'd' | p="asfd" | q=3)Val 'd' pl @(Id !! 4) ("asfd" :: T.Text)#Error (!!) index not found (IxL(4))Fail "(!!) index not found" pl @(Id !! MEmptyT _) (Just "a")-Present "a" (IxL(()) "a" | p=Just "a" | q=())Val "a"pl @(Id !! MEmptyT _) (Nothing @()) -- had to add @() to keep this happy: ghci is fine$Error (!!) index not found (IxL(()))Fail "(!!) index not found"pl @(Id !! 0) ('a','b','c')0Present 'a' (IxL(0) 'a' | p=('a','b','c') | q=0)Val 'a''pl @(Id !! FailT _ "err") ('a','b','c')Error err (IxL) Fail "err"> Snd !! Fst) "abcdef"8Present 'c' ((>>) 'c' | {IxL(2) 'c' | p="abcdef" | q=2})Val 'c'1pl @((Len >> Pred) &&& Id >> Snd !! Fst) "abcdef"8Present 'f' ((>>) 'f' | {IxL(5) 'f' | p="abcdef" | q=5})Val 'f'#pl @(Id !! 3) ('a','b','c','d','e')8Present 'd' (IxL(3) 'd' | p=('a','b','c','d','e') | q=3)Val 'd'> Gt 3 >> Coerce SG.Any) (IToList _) >> MConcat Id)) (M.fromList $ zip (map T.singleton "abcdefgh") [0 ..]):Present (3,Any {getAny = True}) ('(3,Any {getAny = True}))Val (3,Any {getAny = True})pl @(Id !! FromString _ "d" &&& (Map' (Snd >> Gt 3 >> Wrap SG.Any Id) (IToList _) >> MConcat Id >> Unwrap)) (M.fromList $ zip (map T.singleton "abcdefgh") [0 ..])Present (3,True) ('(3,True)) Val (3,True)pl @(Id !! FromString _ "d") (M.fromList $ zip (map T.singleton "abcd") [0 ..])Present 3 (IxL("d") 3 | p=fromList [("a",0),("b",1),("c",2),("d",3)] | q="d")Val 3pl @(Id !! FromString _ "d") (M.fromList $ zip (map T.singleton "abcd") [0 ..])Present 3 (IxL("d") 3 | p=fromList [("a",0),("b",1),("c",2),("d",3)] | q="d")Val 3/pl @(Id !! 2 !! 0) [[1..5],[10..14],[100..110]]Present 100 (IxL(0) 100 | p=[100,101,102,103,104,105,106,107,108,109,110] | q=0)Val 100/pl @(Id !! 1 !! 7) [[1..5],[10..14],[100..110]]#Error (!!) index not found (IxL(7))Fail "(!!) index not found"(pl @(Id !! 1) [('x',14),('y',3),('z',5)]Present ('y',3) (IxL(1) ('y',3) | p=[('x',14),('y',3),('z',5)] | q=1) Val ('y',3))pl @(Id !! 14) [('x',14),('y',3),('z',5)]$Error (!!) index not found (IxL(14))Fail "(!!) index not found" predicate-typed similar to Hi leveraging 1pz @(IxL Id 2 "notfound") ["abc","D","eF","","G"]Val "eF"2pz @(IxL Id 20 "notfound") ["abc","D","eF","","G"]Val "notfound"(pl @(IxL Id 1 (C "x")) ("123" :: T.Text)(Present '2' (IxL(1) '2' | p="123" | q=1)Val '2')pl @(IxL Id 15 (C "x")) ("123" :: T.Text)%Present 'x' (IxL(15) index not found)Val 'x' predicate-typed similar to Hi2 for lists with a default error message on failure predicate-typed similar to Hi for lists.pz @(Ix 4 "not found") ["abc","D","eF","","G"]Val "G"/pz @(Ix 40 "not found") ["abc","D","eF","","G"]Val "not found"pl @(Fst >> Dup >> (Ix 1 (FailP "failed5") *** Ix 3 (FailP "failed5")) >> Id) ([10,12,3,5],"ss")*Present (12,5) ((>>) (12,5) | {Id (12,5)}) Val (12,5)pl @(Fst >> Dup >> (Ix 1 (FailP "failed5") *** Ix 3 (FailP "failed5")) >> Fst < Snd) ([10,12,3,5],"ss")False ((>>) False | {12 < 5}) Val Falsepl @(Fst >> Dup >> (Ix 1 (FailP "failed5") *** Ix 3 (FailP "failed5")) >> Fst > Snd) ([10,12,3,5],"ss")True ((>>) True | {12 > 5})Val Truepl @(Snd >> Len &&& Ix 3 (FailP "someval1") >> Fst == Snd) ('x',[1..5])False ((>>) False | {5 == 4}) Val Falsepl @(Snd >> Len &&& Ix 3 (FailP "someval2") >> Fst < Snd) ('x',[1..5])False ((>>) False | {5 < 4}) Val Falsepl @(Snd >> Len &&& Ix 3 (FailP "someval3") >> Fst > Snd) ('x',[1..5])True ((>>) True | {5 > 4})Val Truepl @(Map Len >> Ix 3 (FailP "lhs") &&& Ix 0 5 >> Fst == Snd) [[1..4],[4..5]]"Error lhs (Ix(3) not found | '(,)) Fail "lhs"pl @(Map Len >> Ix 0 (FailP "lhs") &&& Ix 1 5 >> Fst == Snd) [[1..4],[4..5]]False ((>>) False | {4 == 2}) Val Falsepl @(Map Len >> Ix 1 (FailP "lhs") &&& Ix 3 (FailP "rhs") >> Fst == Snd) [[1..4],[4..5]]"Error rhs (Ix(3) not found | '(,)) Fail "rhs"pl @(Map Len >> Ix 10 (FailP "lhs") &&& Ix 1 (FailP "rhs") >> Fst == Snd) [[1..4],[4..5]]#Error lhs (Ix(10) not found | '(,)) Fail "lhs"pl @(Map Len >> Ix 0 (FailP "lhs") &&& Ix 10 (FailP "rhs") >> Fst == Snd) [[1..4],[4..5]]#Error rhs (Ix(10) not found | '(,)) Fail "rhs"pl @(Map Len >> Ix 10 3 &&& Ix 1 (FailP "rhs") >> Fst == Snd) [[1..4],[4..5]]False ((>>) False | {3 == 2}) Val Falsepl @(Map Len >> Ix 3 3 &&& Ix 1 4 >> Fst == Snd) [[1..4],[4..5]]False ((>>) False | {3 == 2}) Val Falsepl @(Map Len >> Ix 10 3 &&& Ix 1 4 >> Fst == Snd) [[1..4],[4..5]]False ((>>) False | {3 == 2}) Val Falsepl @(Map Len >> Ix 10 5 &&& Ix 1 4 >> Fst == Snd) [[1..4],[4..5]]False ((>>) False | {5 == 2}) Val Falsepl @(Map Len >> Ix 10 2 &&& Ix 1 4 >> Fst == Snd) [[1..4],[4..5]]True ((>>) True | {2 == 2})Val True predicate-typedindex a value in an 7 container and if not found fail with the given messagepl @(LookupFail "someval" 999 Fst) (map SG.Min [1::Int .. 10],'x') Error someval (JustFail Nothing)Fail "someval"pl @(LookupFail (PrintF "char=%c" Snd) 49 Fst) (map SG.Min [1::Int ..10],'x')Error char=x (JustFail Nothing) Fail "char=x" predicate-typedindex a value in an 7 container and if not found fail with the given message predicate-typedindex a value in an : container and if not found return the given default value&pl @(LookupDef 4 '[1,2,3,4,5,6] Id) 23Present 5 (JustDef Just)Val 5-pl @(LookupDef 4 '[1,2,3,4,5,6] Fst) (23,'x')Present 5 (JustDef Just)Val 5'pl @(LookupDef 99 '[1,2,3,4,5,6] Id) 23Present 23 (JustDef Nothing)Val 23pl @(LookupDef 4 Fst (MEmptyT _)) (map SG.Min [1::Int .. 10],'x')'Present Min {getMin = 5} (JustDef Just)Val (Min {getMin = 5})pl @(LookupDef 999 Fst (MEmptyT _)) (map SG.Min [1::Int .. 10],'x')?Mpredicate-typedread a value from stdinpredicate-typed similar to 1 but allow the user to specify the prompt string spredicate-typedread in a value of a given type from stdin with a prompt: similar to jkpredicate-typedwrite a string value to stderrpredicate-typedwrite a string value to stdoutpredicate-typed"write to file, without overwritingpredicate-typed$write to file, overwriting if neededpredicate-typedappend to a filepredicate-typedget the current time using predicate-typedget the current time using predicate-typedread all the environment variables as key value pairs: similar to predicate-typed)read an environment variable: similar to lm,pz @(ReadEnv "PATH" >> 'Just Id >> 'True) ()Val Truepredicate-typed similar to predicate-typed similar to pz @(DirExists ".") ()Val Truepz @(DirExists "xxy") () Val Falsepredicate-typed similar to predicate-typed similar to nopredicate-typed similar to jo2pz @(ReadFile "LICENSE" >> 'Just Id >> Len > 0) ()Val Truepz @(FileExists "xyzzy") () Val FalseNone &'(-./>?-predicate-typed get universe of an enum of type tpz @(Universe Ordering) ()Val [LT,EQ,GT]predicate-typed.universe of enum using the type pointed to by ppl @(Universe' Id) LT(Present [LT,EQ,GT] (Universe [LT .. GT])Val [LT,EQ,GT]predicate-typed similar to pz @(EnumFromThenTo (10 >> ToEnum Day) (20 >> ToEnum Day) (70 >> ToEnum Day)) ()Val [1858-11-27,1858-12-07,1858-12-17,1858-12-27,1859-01-06,1859-01-16,1859-01-26]pz @(EnumFromThenTo (ReadP Day "2020-01-12") (ReadP Day "2020-02-12") (ReadP Day "2020-08-12")) ()Val [2020-01-12,2020-02-12,2020-03-14,2020-04-14,2020-05-15,2020-06-15,2020-07-16]predicate-typed similar to pz @(2 ... 5) () Val [2,3,4,5]pz @('LT ... 'GT) ()Val [LT,EQ,GT]pz @('Just (MkDay '(2020, 1, 2)) ... 'Just (MkDay '(2020, 1, 7))) ()Val [2020-01-02,2020-01-03,2020-01-04,2020-01-05,2020-01-06,2020-01-07]predicate-typed similar to pz @(EnumFromTo 'GT 'LT) ()Val []&pz @(EnumFromTo Pred Succ) (SG.Max 10):Val [Max {getMax = 9},Max {getMax = 10},Max {getMax = 11}]pz @(EnumFromTo 1 20 >> Map '(Id, (If (Id `Mod` 3 == 0) "Fizz" "" <> If (Id `Mod` 5 == 0) "Buzz" ""))) 123Val [(1,""),(2,""),(3,"Fizz"),(4,""),(5,"Buzz"),(6,"Fizz"),(7,""),(8,""),(9,"Fizz"),(10,"Buzz"),(11,""),(12,"Fizz"),(13,""),(14,""),(15,"FizzBuzz"),(16,""),(17,""),(18,"Fizz"),(19,""),(20,"Buzz")]/pl @(EnumFromTo (Pure SG.Min 9) (Pure _ 13)) ()Present [Min {getMin = 9},Min {getMin = 10},Min {getMin = 11},Min {getMin = 12},Min {getMin = 13}] (Min {getMin = 9} ... Min {getMin = 13})Val [Min {getMin = 9},Min {getMin = 10},Min {getMin = 11},Min {getMin = 12},Min {getMin = 13}]3pl @(EnumFromTo (Wrap (SG.Min _) 9) (Wrap _ 13)) ()Present [Min {getMin = 9},Min {getMin = 10},Min {getMin = 11},Min {getMin = 12},Min {getMin = 13}] (Min {getMin = 9} ... Min {getMin = 13})Val [Min {getMin = 9},Min {getMin = 10},Min {getMin = 11},Min {getMin = 12},Min {getMin = 13}]predicate-typedbounded  functionpz @(ToEnumBFail Ordering) 6Fail "ToEnum bounded"pl @(ToEnumBFail Ordering) 1Present EQ (ToEnumBDef EQ | 1)Val EQpl @(ToEnumBFail Ordering) 44.Error ToEnum bounded (ToEnumBDef out of range)Fail "ToEnum bounded"predicate-typedbounded  functionpz @(ToEnumBDef Ordering LT) 2Val GTpz @(ToEnumBDef Ordering LT) 6Val LT!pl @(ToEnumBDef Ordering 'LT) 123$Present LT (ToEnumBDef out of range)Val LTpl @(ToEnumBDef Ordering 'GT) 1Present EQ (ToEnumBDef EQ | 1)Val EQpredicate-typedbounded  function where t$ refers to location of the type and p the location of the inputpredicate-typedunsafe  functionpz @(ToEnum Char) 120Val 'x'>pl @(Map FromEnum >> Map (Id - 97 >> ToEnum Ordering)) "abcde"Error ToEnum IO e=Prelude.Enum.Ordering.toEnum: bad argument(2) (Map(i=3, a=100) excnt=2)Fail "ToEnum IO e=Prelude.Enum.Ordering.toEnum: bad argument(2)"=pl @((ToEnum Day *** ToEnum Day) >> EnumFromTo Fst Snd) (0,5)Present [1858-11-17,1858-11-18,1858-11-19,1858-11-20,1858-11-21,1858-11-22] ((>>) [1858-11-17,1858-11-18,1858-11-19,1858-11-20,1858-11-21,1858-11-22] | {1858-11-17 ... 1858-11-22})Val [1858-11-17,1858-11-18,1858-11-19,1858-11-20,1858-11-21,1858-11-22]pz @(ToEnum (Proxy ())) 0 Val Proxypz @(ToEnum (Proxy ())) 1+Fail "ToEnum IO e=Proxy.toEnum: 0 expected"*pz @(ToEnum (Proxy "sss") >> Pop0 Id ()) 0 Val "sss"predicate-typedunsafe 0 function that allows you to specify the target p and a pointer to a type tpredicate-typed functionpz @FromEnum 'x'Val 120predicate-typed functionpz @(FromEnum' Id) 'x'Val 120.pl @(FromEnum' ("aa" ==! Id) >> Same 1) "aaaa"False ((>>) False | {0 == 1}) Val False8pl @(FromEnum' ("aa" ==! Id) >> ToEnum OrderingP) "aaaa")Present CGt ((>>) CGt | {ToEnum CGt | 0})Val CGt4pl @(Map (FromEnum' Id) >> Map (ToEnum Char)) "abcd">) "abcd" | {Map "abcd" | [97,98,99,100]}) Val "abcd"predicate-typedbounded  functionpl @(PredB 'GT Id) LTPresent GT (PredB out of range)Val GTpl @(PredB 'LT Id) GTPresent EQ (PredB EQ | GT)Val EQpredicate-typed unbounded  function pz @Pred 13Val 12 pz @Pred LT9Fail "Pred IO e=Prelude.Enum.Ordering.pred: bad argument"predicate-typed?SuccN n p (unsafe) increments an enum p by the given integral n4pz @(ReadP Day Id >> Id ... SuccN 5 Id) "2020-07-27"Val [2020-07-27,2020-07-28,2020-07-29,2020-07-30,2020-07-31,2020-08-01]6pz @(ReadP Day Id >> SuccN (Negate 5) Id) "2020-07-27"Val 2020-07-22pl @(SuccN 3 'LT) ()Error SuccN IO e=Prelude.Enum.Ordering.toEnum: bad argument (SuccN 3 LT)?npredicate-typedadd an index to listpz @IList "abcdef"5Val [(0,'a'),(1,'b'),(2,'c'),(3,'d'),(4,'e'),(5,'f')]predicate-typedadd an index to map#pz @(IMap (Second Succ) Id) "hello"-Val [(0,'i'),(1,'f'),(2,'m'),(3,'m'),(4,'p')]/pz @(IMap (10 ^ Fst * Snd) Id >> Sum) [3,2,7,9]Val 9723-pz @(IMap (2 ^ Fst * Snd) Id) [1,1,1,0,1,0,1]Val [1,2,4,0,16,0,64]pz @(Rescan "^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$" >> Map (Snd >> IMap (GuardBool (PrintT "bad value=%d %s" Id) (Snd >> ReadP Int Id < 255)) Id)) "123.222.999.3"Fail "bad value=2 999"pz @(Rescan "^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$" >> Map (Snd >> IMap (GuardBool (PrintT "bad value=%d %s" Id) (Snd >> ReadP Int Id < 255)) Id)) "123.222.99.3"Val [[True,True,True,True]]predicate-typedexperimental: sorts then partitions and then sorts each partitions based on the leftmost occurring value in the original list if the existing order of data is fine then use  as you do not need this=pz @(PartitionsBy (Fst ==! Snd) (L11 == L21) Id) [10,9,9,1,9]Val [[10],[9,9,9],[1]]5pz @(PartitionsBy Compare (L11 < L21) Id) "efaffabec"Val ["a","f","f","abce","ef"]+pz @(PartitionsBy 'GT 'True Id) "efaffabec"Val ["cebaffafe"],pz @(PartitionsBy 'GT 'False Id) "efaffabec")Val ["e","f","a","f","f","a","b","e","c"]>pz @(PartitionsBy (Fst ==! Snd) (L12 > L22) Id) [10,9,9,1,9,4]Val [[9],[1],[9,10],[4,9]]8pz @(PartitionsBy (L11 ==! L21) (L12 > L22) Id) "eddadc"Val ["d","a","de","cd"]>pz @(PartitionsBy (L11 ==! L21) (L11 < L21) Id) [10,9,9,1,9,4]Val [[9],[1,4,9],[9,10]]predicate-typed%zip cartesian product for lists: see p for Applicative version>pz @(ZipCartesian (EnumFromTo Fst Snd) ('LT ... 'GT) ) (10,11)5Val [(10,LT),(10,EQ),(10,GT),(11,LT),(11,EQ),(11,GT)]*pz @(ZipCartesian '[ '() ] (1 ... 5)) True(Val [((),1),((),2),((),3),((),4),((),5)]predicate-typed similar to Hqpz @Nub "abcdbc" Val "abcd" pz @Nub []Val []pz @Nub [1,4,1,1,1,1,1] Val [1,4]predicate-typed similar to HI pl @(IsSuffix '[2,3] Id) [1,2,3]True (IsSuffix | [2,3] [1,2,3])Val True pl @(IsSuffix '[2,3] Id) [2,3,4] False (IsSuffix | [2,3] [2,3,4]) Val Falsepredicate-typed similar to HJpl @(IsInfix '[2,3] Id) [1,2,3]True (IsInfix | [2,3] [1,2,3])Val True!pl @(IsInfix '[2,3] Id) [1,2,1,3]!False (IsInfix | [2,3] [1,2,1,3]) Val Falsepredicate-typed similar to HK pl @(IsPrefix '[2,3] Id) [2,3,4]True (IsPrefix | [2,3] [2,3,4])Val True pl @(IsPrefix '[2,3] Id) [1,2,3] False (IsPrefix | [2,3] [1,2,3]) Val Falsepredicate-typed similar to Hrpz @Max [10,4,5,12,3,4]Val 12 pz @Max []Fail "empty list"predicate-typed similar to Hspz @Min [10,4,5,12,3,4]Val 3 pz @Min []Fail "empty list"predicate-typed similar to Htpz @Product [10,4,5,12,3,4] Val 28800pz @Product []Val 1predicate-typed similar to Hupz @Sum [10,4,5,12,3,4]Val 38 pz @Sum []Val 0pz @(1 ... 10 >> Sum) ()Val 55predicate-typed similar to Hvpz @(EmptyT Maybe) () Val Nothingpz @(EmptyT []) ()Val []"pz @(C "x" >> EmptyT []) (13,True)Val ""-pz @(Fst >> EmptyT (Either String)) (13,True) Val (Left "")predicate-typed"zip two lists with the same lengthpl @(Zip '[1,2,3] "abc") ()Present [(1,'a'),(2,'b'),(3,'c')] (Zip [(1,'a'),(2,'b'),(3,'c')] | p=[1,2,3] | q="abc")Val [(1,'a'),(2,'b'),(3,'c')]pl @(Zip '[1,2,3] "ab") ()3Error Zip(3,2) length mismatch (p=[1,2,3] | q="ab")Fail "Zip(3,2) length mismatch"pl @(Zip '[1,2] "abc") ()2Error Zip(2,3) length mismatch (p=[1,2] | q="abc")Fail "Zip(2,3) length mismatch"pl @(Zip "abc" Id) [1..7] ShowP Snd) (1...5) (C "a" ... C "e")) ()(Val ["1'a'","2'b'","3'c'","4'd'","5'e'"]pl @(SortOn Snd Snd) ((),[('z',14),('a',10),('m',22),('a',1)])Present [('a',1),('a',10),('z',14),('m',22)] (SortBy [('a',1),('a',10),('z',14),('m',22)])(Val [('a',1),('a',10),('z',14),('m',22)]5pl @(SortOn Fst Snd) ((),[('z',1),('a',10),('m',22)])Present [('a',10),('m',22),('z',1)] (SortBy [('a',10),('m',22),('z',1)])Val [('a',10),('m',22),('z',1)]pl @(SortOn Fst Id) [('z',1),('a',10),('m',22),('a',9),('m',10)]Present [('a',10),('a',9),('m',22),('m',10),('z',1)] (SortBy [('a',10),('a',9),('m',22),('m',10),('z',1)])0Val [('a',10),('a',9),('m',22),('m',10),('z',1)]?pl @(SortOn Id Id) [('z',1),('a',10),('m',22),('a',9),('m',10)]Present [('a',9),('a',10),('m',10),('m',22),('z',1)] (SortBy [('a',9),('a',10),('m',10),('m',22),('z',1)])0Val [('a',9),('a',10),('m',10),('m',22),('z',1)]predicate-typedsort a list (stable) (L12 ==! L22)) Id) [(10,"ab"),(4,"x"),(20,"bbb"),(4,"a"),(4,"y")]2Val [(4,"a"),(4,"x"),(4,"y"),(10,"ab"),(20,"bbb")]pz @(SortBy ((L11 ==! L21) <> (L22 ==! L12)) Id) [(10,"ab"),(4,"x"),(20,"bbb"),(4,"a"),(4,"y")]2Val [(4,"y"),(4,"x"),(4,"a"),(10,"ab"),(20,"bbb")]pl @(SortBy (Swap >> Comparing Fst) Snd) ((),[('z',1),('a',10),('m',22)])Present [('z',1),('m',22),('a',10)] (SortBy [('z',1),('m',22),('a',10)])Val [('z',1),('m',22),('a',10)]9pl @(SortBy (Comparing Reverse) Id) ["az","by","cx","aa"]> Head >> Le 6) ([], True)Error Head(empty)Fail "Head(empty)"pl @Head [1,2,3]Present 1 (Head 1 | [1,2,3])Val 1predicate-typedfilters a list q removing those elements in p#pz @(Remove '[5] '[1,5,5,2,5,2]) () Val [1,2,2])pz @(Remove '[0,1,1,5] '[1,5,5,2,5,2]) () Val [2,2]$pz @(Remove '[99] '[1,5,5,2,5,2]) ()Val [1,5,5,2,5,2]'pz @(Remove '[99,91] '[1,5,5,2,5,2]) ()Val [1,5,5,2,5,2]!pz @(Remove Id '[1,5,5,2,5,2]) []Val [1,5,5,2,5,2]pz @(Remove '[] '[1,5,5,2,5,2]) 44 -- works if you make this a number!Val [1,5,5,2,5,2]predicate-typedfilters a list q keeping those elements in p!pz @(Keep '[5] '[1,5,5,2,5,2]) () Val [5,5,5]'pz @(Keep '[0,1,1,5] '[1,5,5,2,5,2]) () Val [1,5,5,5]predicate-typedsplits a list pointed to by p into lists of size n with a gap of ipz @(Unfoldr (If Null (MkNothing _) (MkJust '(Take 3 Id,Drop 2 Id))) Id) [1..10],Val [[1,2,3],[3,4,5],[5,6,7],[7,8,9],[9,10]]pz @(ChunksOf' 3 2 Id) [1..10],Val [[1,2,3],[3,4,5],[5,6,7],[7,8,9],[9,10]]predicate-typedsplits a list pointed to by p into lists of size npz @(ChunksOf 2) "abcdef"Val ["ab","cd","ef"]pz @(ChunksOf 2) "abcdefg"Val ["ab","cd","ef","g"]pz @(ChunksOf 2) ""Val []pz @(ChunksOf 2) "a" Val ["a"]=pz @(PadR (Len + RoundUp 5 Len) 999 Id >> ChunksOf 5) [1..17]Val [[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15],[16,17,999,999,999]]=pz @(PadR (Len + RoundUp 5 Len) 999 Id >> ChunksOf 5) [1..15]/Val [[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15]]predicate-typeddrop n values from a list p : similar to predicate-typedtake n values from a list p : similar to pz @(Take 3 Id) "abcdef" Val "abc"pz @(Take 3 Id) "ab"Val "ab"pz @(Take 10 Id) "abcdef" Val "abcdef"pz @(Take 0 Id) "abcdef"Val ""pz @(Take 10 Id) ""Val ""predicate-typed similar to H~ pz @(SplitAt 4 Id) "hello world"Val ("hell","o world")!pz @(SplitAt 20 Id) "hello world"Val ("hello world","") pz @(SplitAt 0 Id) "hello world"Val ("","hello world")'pz @(SplitAt Snd Fst) ("hello world",4)Val ("hell","o world"))pz @(SplitAt (Negate 2) Id) "hello world"Val ("hello wor","ld")pl @(Snd >> SplitAt 2 Id >> Len *** Len >> Fst > Snd) ('x',[1..5])False ((>>) False | {2 > 3}) Val Falsepredicate-typed split a list p5 into parts using the lengths in the type level list ns*pz @(SplitAts '[2,3,1,1] Id) "hello world"Val ["he","llo"," ","w","orld"]$pz @(SplitAts '[2] Id) "hello world"Val ["he","llo world"]+pz @(SplitAts '[10,1,1,5] Id) "hello world"Val ["hello worl","d","",""]"pl @(SplitAts '[1,3,4] Id) [1..12]Present [[1],[2,3,4],[5,6,7,8],[9,10,11,12]] (SplitAts [[1],[2,3,4],[5,6,7,8],[9,10,11,12]] | ns=[1,3,4] | [1,2,3,4,5,6,7,8,9,10,11,12])(Val [[1],[2,3,4],[5,6,7,8],[9,10,11,12]];pl @(SplitAts '[3,1,1,1] Id >> Filter (Not Null) Id) [1..4]Present [[1,2,3],[4]] ((>>) [[1,2,3],[4]] | {Fst [[1,2,3],[4]] | ([[1,2,3],[4]],[[],[]])})Val [[1,2,3],[4]]predicate-typed right pad q with n values from ppl @(PadR 5 8 Id) [1..3]8Present [1,2,3,8,8] (PadR 5 pad=8 [1,2,3,8,8] | [1,2,3])Val [1,2,3,8,8]pl @(PadR 5 0 Id) [1..5]> Intercalate Fst Snd) [12,13,14,15,16]Present [12,-5,13,-5,14,-5,15,-5,16] ((>>) [12,-5,13,-5,14,-5,15,-5,16] | {Intercalate [12,-5,13,-5,14,-5,15,-5,16] | [-5] | [12,13,14,15,16]}) Val [12,-5,13,-5,14,-5,15,-5,16]predicate-typed similar to Hpl @(Span (Lt 4) Id) [1..11]7Present ([1,2,3],[4,5,6,7,8,9,10,11]) (Break cnt=(3,8))!Val ([1,2,3],[4,5,6,7,8,9,10,11])predicate-typed similar to H(pz @(Break (Ge 3) Id) [10,4,1,7,3,1,3,5]Val ([],[10,4,1,7,3,1,3,5])(pz @(Break (Lt 3) Id) [10,4,1,7,3,1,3,5]Val ([10,4],[1,7,3,1,3,5])pl @(Break (Gt 2) Id) [1..11]7Present ([1,2],[3,4,5,6,7,8,9,10,11]) (Break cnt=(2,9))!Val ([1,2],[3,4,5,6,7,8,9,10,11])pl @(Break (If (Gt 2) 'True (If (Gt 4) (FailT _ "ASfd") 'False)) Id) [1..8]/Present ([1,2],[3,4,5,6,7,8]) (Break cnt=(2,6))Val ([1,2],[3,4,5,6,7,8])pl @(Break (Case 'False '[Gt 2,Gt 4] '[W 'True, FailT _ "ASfd"] Id) Id) [1..8] -- case version/Present ([1,2],[3,4,5,6,7,8]) (Break cnt=(2,6))Val ([1,2],[3,4,5,6,7,8])9pl @(Break (If (Gt 2) (FailT _ "ASfd") 'False) Id) [1..8]-Error ASfd (If True | Break predicate failed) Fail "ASfd"pl @(Break Snd Id) (zip [1..] [False,False,False,True,True,False])Present ([(1,False),(2,False),(3,False)],[(4,True),(5,True),(6,False)]) (Break cnt=(3,3))Val ([(1,False),(2,False),(3,False)],[(4,True),(5,True),(6,False)])8pl @(Break Snd Id) (zip [1..] [False,False,False,False])Present ([(1,False),(2,False),(3,False),(4,False)],[]) (Break cnt=(4,0))2Val ([(1,False),(2,False),(3,False),(4,False)],[])4pl @(Break Snd Id) (zip [1..] [True,True,True,True])Present ([],[(1,True),(2,True),(3,True),(4,True)]) (Break cnt=(0,4)).Val ([],[(1,True),(2,True),(3,True),(4,True)])predicate-typed similar to H*pz @(Filter (Gt 4) Id) [10,1,3,5,-10,12,1] Val [10,5,12]predicate-typed similar to  but returns the value and countpz @GroupCnt [1,3,4,5,1,5,5])Val [(1,1),(3,1),(4,1),(5,1),(1,1),(5,2)]&pz @(Sort >> GroupCnt) [1,3,4,5,1,5,5]Val [(1,2),(3,1),(4,1),(5,3)]"pz @(Sort >> GroupCnt) "xyabxaaaz"-Val [('a',4),('b',1),('x',2),('y',1),('z',1)]predicate-typed similar to Hpz @Group [1,3,4,5,1,5,5]Val [[1],[3],[4],[5],[1],[5,5]]#pz @(Sort >> Group) [1,3,4,5,1,5,5]Val [[1,1],[3],[4],[5,5,5]]predicate-typed version of # that retains the original orderingpz @GroupCntStable "bababab"Val [('b',4),('a',3)]pz @GroupCntStable "fedbfefa"-Val [('f',3),('e',2),('d',1),('b',1),('a',1)]pz @GroupCntStable "fedc"%Val [('f',1),('e',1),('d',1),('c',1)]pz @GroupCntStable "ffff" Val [('f',4)]pz @GroupCntStable ""Val []predicate-typed similar to H-pz @(GroupBy (Fst == Snd) Id) [1,3,4,5,1,5,5]Val [[1],[3],[4],[5],[1],[5,5]]1pz @(GroupBy (Fst == Snd) Id) [1,1,1,3,4,5,1,5,5]#Val [[1,1,1],[3],[4],[5],[1],[5,5]]#pz @(GroupBy (Fst == Snd) Id) [5,5] Val [[5,5]]#pz @(GroupBy (Fst == Snd) Id) [1,2] Val [[1],[2]]!pz @(GroupBy (Fst == Snd) Id) [1] Val [[1]] pz @(GroupBy (Fst == Snd) Id) []Val [],pz @(GroupBy (Fst < Snd) Id) [1,2,3,4,4,1,2]Val [[1,2,3,4],[4],[1,2]]-pz @(GroupBy (Fst /= Snd) Id) [1,2,3,4,4,4,1]Val [[1,2,3,4],[4],[4,1]]1pan @(GroupBy (Fst == Snd) Id) "hello goodbye""

> ShowBase 16 >> Head) Id) [-4,-2,5,0,15,12,-1,2,-3,4,0]Val (fromList [('0',[0,0]),('2',[2]),('4',[4]),('5',[5]),('c',[12,-4]),('d',[-3]),('e',[-2]),('f',[-1,15])])pl @(PartitionBy Ordering (Case (FailT _ "asdf") '[Id < 2, Id == 2, Id > 2] '[ 'LT, 'EQ, 'GT] Id) Id) [-4,2,5,6,7,1,2,3,4]Present fromList [(LT,[1,-4]),(EQ,[2,2]),(GT,[4,3,7,6,5])] (PartitionBy fromList [(LT,[1,-4]),(EQ,[2,2]),(GT,[4,3,7,6,5])] | s=[-4,2,5,6,7,1,2,3,4])8Val (fromList [(LT,[1,-4]),(EQ,[2,2]),(GT,[4,3,7,6,5])])pl @(PartitionBy Ordering (Case (FailT _ "xyzxyzxyzzyyysyfsyfydf") '[Id < 2, Id == 2, Id > 3] '[ 'LT, 'EQ, 'GT] Id) Id) [-4,2,5,6,7,1,2,3,4] 0] '[ 'LT, 'GT] Id) Id) [-4,-2,5,6,7,0,-1,2,-3,4,0]?Val (fromList [(LT,[-3,-1,-2,-4]),(EQ,[0,0]),(GT,[4,2,7,6,5])])predicate-typed similar to & for non-empty listspz @(All1 Even) [2,4,6]Val True#pz @(All1 Even) [2,3,3,7,2,8,1,5,9] Val Falsepz @(All1 Even) [] Val Falsepz @(All1 Even) [1] Val Falsepz @(All1 Even) [2]Val Truepredicate-typedcounts number on matches and non matches: ie All is length snd==0 and Any is length fst > 0$pz @(Quant Even) [2,3,3,7,2,8,1,5,9] Val (3,6)pz @(Quant (Gt 10)) [2,8,1,5,9] Val (0,5)pz @(Quant (Gt 10)) [] Val (0,0)pz @(Quant (Same 4)) [3] Val (0,1)pz @(Quant (Same 4)) [4] Val (1,0)predicate-typed similar to ,pz @(Partition (Ge 3) Id) [10,4,1,7,3,1,3,5]Val ([10,4,7,3,3,5],[1,1])-pz @(Partition IsPrime Id) [10,4,1,7,3,1,3,5]Val ([7,3,3,5],[10,4,1,1]).pz @(Partition (Ge 300) Id) [10,4,1,7,3,1,3,5]Val ([],[10,4,1,7,3,1,3,5])0pz @(Partition (Id < 300) Id) [10,4,1,7,3,1,3,5]Val ([10,4,1,7,3,1,3,5],[])+pl @(Partition (Lt 2) Id >> Id) [1,2,3,4,5]Present ([1],[2,3,4,5]) ((>>) ([1],[2,3,4,5]) | {Id ([1],[2,3,4,5])})Val ([1],[2,3,4,5])!pl @(Partition (Gt 3) Id) [1..10]Present ([4,5,6,7,8,9,10],[1,2,3]) (Partition ([4,5,6,7,8,9,10],[1,2,3]) | s=[1,2,3,4,5,6,7,8,9,10])Val ([4,5,6,7,8,9,10],[1,2,3])pl @(Partition Even Id) [1..6]Present ([2,4,6],[1,3,5]) (Partition ([2,4,6],[1,3,5]) | s=[1,2,3,4,5,6])Val ([2,4,6],[1,3,5])pl @(Partition Even Id >> Null *** (Len > 4) >> Fst == Snd) [1..6]#True ((>>) True | {False == False})Val Truepl @(Partition (ExitWhen "ExitWhen" (Gt 10) >> Gt 2) Id) [1..11].Error ExitWhen (Partition(i=10, a=11) excnt=1)Fail "ExitWhen""pl @(Partition IsPrime Id) [1..15]Present ([2,3,5,7,11,13],[1,4,6,8,9,10,12,14,15]) (Partition ([2,3,5,7,11,13],[1,4,6,8,9,10,12,14,15]) | s=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])-Val ([2,3,5,7,11,13],[1,4,6,8,9,10,12,14,15])predicate-typedrotate a list p n unitspz @(Rotate 0 Id) [1,2,3,4] Val [1,2,3,4]$pz @(Rotate (Negate 1) Id) [1,2,3,4] Val [4,1,2,3]pz @(Rotate 2 Id) [1,2,3,4] Val [3,4,1,2]$pz @(Map (Rotate Id "abcd")) [-3..7]Val ["bcda","cdab","dabc","abcd","bcda","cdab","dabc","abcd","bcda","cdab","dabc"]predicate-typed similar to pz @Unsnoc [1,2,3,4]Val (Just ([1,2,3],4)) pz @Unsnoc [] Val Nothingpz @Unsnoc ("xyz" :: T.Text)Val (Just ("xy",'z'))pl @Unsnoc ("asfd" :: T.Text);Present Just ("asf",'d') (Unsnoc Just ("asf",'d') | "asfd")Val (Just ("asf",'d'))pl @Unsnoc ("" :: T.Text)%Present Nothing (Unsnoc Nothing | "") Val Nothingpl @Unsnoc [1..5]Present Just ([1,2,3,4],5) (Unsnoc Just ([1,2,3,4],5) | [1,2,3,4,5])Val (Just ([1,2,3,4],5))predicate-typed similar to pz @Uncons [1,2,3,4]Val (Just (1,[2,3,4])) pz @Uncons [] Val Nothingpz @Uncons (Seq.fromList "abc")Val (Just ('a',fromList "bc"))pz @Uncons ("xyz" :: T.Text)Val (Just ('x',"yz"))pl @Uncons ("asfd" :: T.Text);Present Just ('a',"sfd") (Uncons Just ('a',"sfd") | "asfd")Val (Just ('a',"sfd"))pl @Uncons ("" :: T.Text)%Present Nothing (Uncons Nothing | "") Val Nothingpl @Uncons [1..5] -- with Typeable would need to specify the type of [1..5]Present Just (1,[2,3,4,5]) (Uncons Just (1,[2,3,4,5]) | [1,2,3,4,5])Val (Just (1,[2,3,4,5]))predicate-typedsimilar to snocpz @(Snd +: Fst) (99,[1,2,3,4])Val [1,2,3,4,99]pz @(Fst +: Snd) ([],5)Val [5]pz @(EmptyT [] +: 5) 5Val [5]pl @('[1,2,3] +: 4) ()4Present [1,2,3,4] ((+:) [1,2,3,4] | p=[1,2,3] | q=4) Val [1,2,3,4]pl @(Snd +: Fst) (4,[1,2,3])4Present [1,2,3,4] ((+:) [1,2,3,4] | p=[1,2,3] | q=4) Val [1,2,3,4]pl @("abc" +: C "x") ().Present "abcx" ((+:) "abcx" | p="abc" | q='x') Val "abcx"&pl @(Fst +: Snd) ("abc" :: T.Text,'x').Present "abcx" ((+:) "abcx" | p="abc" | q='x') Val "abcx"predicate-typedsimilar to conspz @(Fst :+ Snd) (99,[1,2,3,4])Val [99,1,2,3,4]pz @(Snd :+ Fst) ([],5)Val [5]$pz @(123 :+ EmptyList _) "somestuff" Val [123]#pl @(Flip (:+) Fst Snd) ([1..5],99)Present [99,1,2,3,4,5] ((:+) [99,1,2,3,4,5] | p=99 | q=[1,2,3,4,5])Val [99,1,2,3,4,5]pl @(Fst :+ Snd) (99,[1..5])Present [99,1,2,3,4,5] ((:+) [99,1,2,3,4,5] | p=99 | q=[1,2,3,4,5])Val [99,1,2,3,4,5]pl @(4 :+ '[1,2,3]) ()4Present [4,1,2,3] ((:+) [4,1,2,3] | p=4 | q=[1,2,3]) Val [4,1,2,3]pl @(Fst :+ Snd) (4,[1,2,3])4Present [4,1,2,3] ((:+) [4,1,2,3] | p=4 | q=[1,2,3]) Val [4,1,2,3]pl @(Flip (:+) '[1,2,3] 5) ()4Present [5,1,2,3] ((:+) [5,1,2,3] | p=5 | q=[1,2,3]) Val [5,1,2,3]predicate-typedsimilar to (++)&pz @(Fst ++ Snd) ([9,10,11],[1,2,3,4])Val [9,10,11,1,2,3,4]pz @(Snd ++ Fst) ([],[5])Val [5]'pz @(C "xyz" :+ W "ab" ++ W "cdefg") ()Val "xabcdefg"(pz @([1,2,3] ++ EmptyList _) "somestuff" Val [1,2,3]555None &'(-./>?ipredicate-typed$IsLuhn predicate check on last digitpz @IsLuhn [1,2,3,0]Val Truepz @IsLuhn [1,2,3,4] Val False&pz @(GuardSimple IsLuhn) [15,4,3,1,99]>Fail "(IsLuhn map=[90,2,3,8,6] sum=109 ret=9 | [15,4,3,1,99])"pl @IsLuhn [15,4,3,1,99]=False (IsLuhn map=[90,2,3,8,6] sum=109 ret=9 | [15,4,3,1,99]) Val Falsepredicate-typed'prime factorisation of positive numberspz @(PrimeFactors Id) 17Val [17]pz @(PrimeFactors Id) 1Val [1]pz @(PrimeFactors Id) 30 Val [2,3,5]pz @(PrimeFactors Id) 64Val [2,2,2,2,2,2]pz @(PrimeFactors Id) (-30)Fail "PrimeFactors number<=0"predicate-typed get list of n primespz @(Primes Id) 5Val [2,3,5,7,11]predicate-typedget the next prime numberpz @PrimePrev 6Val 5pz @PrimePrev 5Val 3pz @PrimePrev (-206)Val 2pz @(ScanN 6 PrimePrev Id) 11Val [11,7,5,3,2,2,2]predicate-typedget the next prime numberpz @PrimeNext 6Val 7pz @(ScanN 4 PrimeNext Id) 3Val [3,5,7,11,13]predicate-typeda predicate on prime numbers pz @IsPrime 2Val Truepz @(Map '(Id,IsPrime)) [0..12]Val [(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)]predicate-typed similar to pz @InitMay "hello"Val (Just "hell")predicate-typed similar to pz @TailMay "hello"Val (Just "ello")predicate-typed similar to pz @LastMay "hello"Val (Just 'o')predicate-typed similar to pl @HeadMay []1Present Nothing ((>>) Nothing | {FMap }) Val Nothingpl @HeadMay [99,7,3];Present Just 99 ((>>) Just 99 | {FMap Fst 99 | (99,[7,3])}) Val (Just 99)predicate-typedtakes the init of a list-like object or fails with the given messagepredicate-typedtakes the init of a list-like object or uses the given default value"pl @(InitDef '[9,7] Fst) ([],True)Present [9,7] (JustDef Nothing) Val [9,7]&pl @(InitDef '[9,7] Fst) ([1..5],True) Present [1,2,3,4] (JustDef Just) Val [1,2,3,4]&pl @(InitDef '[3] Fst) ([10..15],True)'Present [10,11,12,13,14] (JustDef Just)Val [10,11,12,13,14]predicate-typedtakes the init of a list-like object or fails with the given messagepredicate-typed=takes the last value of a list-like object or a default valuepl @(LastDef 9 Fst) ([],True)Present 9 (JustDef Nothing)Val 9!pl @(LastDef 9 Fst) ([1..5],True)Present 5 (JustDef Just)Val 5#pl @(LastDef 3 Fst) ([10..15],True)Present 15 (JustDef Just)Val 15pl @(LastDef 0 Id) [1..12]Present 12 (JustDef Just)Val 12pl @(LastDef 0 Id) []Present 0 (JustDef Nothing)Val 0predicate-typedtakes the tail of a list-like object or fails with the given messagepl @(TailFail (PrintT "a=%d b=%s" Snd) Fst) ([]::[()],(4,"someval"))&Error a=4 b=someval (JustFail Nothing)Fail "a=4 b=someval"predicate-typedtakes the tail of a list-like object or uses the given default value"pl @(TailDef '[9,7] Fst) ([],True)Present [9,7] (JustDef Nothing) Val [9,7]&pl @(TailDef '[9,7] Fst) ([1..5],True) Present [2,3,4,5] (JustDef Just) Val [2,3,4,5]&pl @(TailDef '[3] Fst) ([10..15],True)'Present [11,12,13,14,15] (JustDef Just)Val [11,12,13,14,15]predicate-typed8takes the head of a list or fails with the given messagesee b for other supported types eg 0pz @(HeadFail "oops" Id) ["abc","def","asdfadf"] Val "abc"!pz @(HeadFail "empty list" Id) []Fail "empty list")pl @(HeadFail "zz" Fst >> Le 6) ([],True)Error zz (JustFail Nothing) Fail "zz":pl @((HeadFail "failed1" Fst >> Le 6) || 'False) ([],True)%Error failed1 (JustFail Nothing | ||)Fail "failed1"pl @((Fst >> HeadFail "failed2" Id >> Le (6 -% 1)) || 'False) ([-9],True)True (True || False)Val True9pl @(HeadFail "Asdf" Id) ([] :: [()]) -- breaks otherwiseError Asdf (JustFail Nothing) Fail "Asdf"7pl @(HeadFail (PrintF "msg=%s def" Fst) Snd) ("Abc",[])$Error msg=Abc def (JustFail Nothing)Fail "msg=Abc def"predicate-typedtakes the head of a list-like object or uses the given default valuesee b for other supported types eg pz @(HeadDef 444 Id) []Val 444pz @(HeadDef 444 Id) [1..5]Val 1pz @(HeadDef 444 Id) [1..5]Val 10pz @(HeadDef (C "w") Id) (Seq.fromList "abcdef")Val 'a'"pz @(HeadDef (C "w") Id) Seq.emptyVal 'w'1pz @(HeadDef (MEmptyT _) Id) ([] :: [SG.Sum Int])Val (Sum {getSum = 0}):pz @(HeadDef (MEmptyT String) '["abc","def","asdfadf"]) () Val "abc";pz @(HeadDef (MEmptyT _) Snd) (123,["abc","def","asdfadf"]) Val "abc"&pz @(HeadDef (MEmptyT _) Snd) (123,[])Val ()pl @(HeadDef 9 Fst) ([],True)Present 9 (JustDef Nothing)Val 9$pl @(HeadDef 99 Fst) ([10..15],True)Present 10 (JustDef Just)Val 10&pl @(HeadDef 12 Fst >> Le 6) ([],True)False ((>>) False | {12 <= 6}) Val False%pl @(HeadDef 1 Fst >> Le 6) ([],True)True ((>>) True | {1 <= 6})Val True&pl @(HeadDef 10 Fst >> Le 6) ([],True)False ((>>) False | {10 <= 6}) Val False6pl @(HeadDef (MEmptyT _) Id) (map (:[]) ([] :: [Int]))Present [] (JustDef Nothing)Val []?lpredicate-typed leverages 8 for repeating predicates (passthrough method) same as DoN n p == FoldN n p Id but more efficientpz @(DoN 4 Succ) 'c'Val 'g'pz @(DoN 4 (Id <> " | ")) "abc"Val "abc | | | | "#pz @(DoN 4 (Id <> "|" <> Id)) "abc"Val "abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc"pl @(DoN 4 (Id + 4)) 1$Present 17 ((>>) 17 | {13 + 4 = 17})Val 17pl @(DoN 4 (Id + 7)) 3$Present 31 ((>>) 31 | {24 + 7 = 31})Val 31pl @(DoN 4 9) ()Present 9 ((>>) 9 | {'9})Val 9pl @(DoN 4 "xy") 3"Present "xy" ((>>) "xy" | {'"xy"})Val "xy"predicate-typedcreates a promoted list of predicates and then evaluates them into a list. see PP instance for '[k]pz @(Repeat 4 Succ) 'c' Val "dddd"pz @(Repeat 4 "abc") ()Val ["abc","abc","abc","abc"]pl @(Repeat 4 "xy") 3Present ["xy","xy","xy","xy"] ('["xy","xy","xy","xy"] ('"xy") | 3)Val ["xy","xy","xy","xy"]predicate-typed leverages / for repeating expressions (passthrough method)pz @(ParaN 4 Succ) [1..4] Val [2,3,4,5]pz @(ParaN 4 Succ) "azwxm"(Fail "Para:invalid length(5) expected 4"pz @(ParaN 4 Succ) "azwx" Val "b{xy"=pl @(ParaN 5 (Guard "0-255" (Between 0 255 Id))) [1,2,3,4,12]:Present [1,2,3,4,12] (Para(0) [1,2,3,4,12] | [1,2,3,4,12])Val [1,2,3,4,12]?pl @(ParaN 5 (Guard "0-255" (Between 0 255 Id))) [1,2,3,400,12](Error 0-255 (Guard | 400 | Para(3 of 4)) Fail "0-255"pz @(ParaN 5 (Guard (PrintF "bad value %d" Id) (Between 0 255 Id))) [1,2,3,400,12]Fail "bad value 400"-pl @(ParaN 4 (PrintF "%03d" Id)) [141,21,3,0]Present ["141","021","003","000"] (Para(0) ["141","021","003","000"] | [141,21,3,0])Val ["141","021","003","000"]predicate-typedruns values in parallel unlike  which is serial)pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30]Val [10,21,120],pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30,40](Fail "Para:invalid length(4) expected 3";pl @(Para '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99,-999]Present [True,False,False,True] (Para(0) [True,False,False,True] | [1,2,-99,-999])Val [True,False,False,True]6pl @(Para '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99]'Error Para:invalid length(3) expected 4(Fail "Para:invalid length(3) expected 4"pl @(Para '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99,-999,1,1,2]'Error Para:invalid length(7) expected 4(Fail "Para:invalid length(7) expected 4"predicate-typedunfolds a value applying f until the condition p is true or n times)pl @(IterateNUntil 10 (Id <= 90) Pred) 95Present [95,94,93,92,91] ((>>) [95,94,93,92,91] | {Map [95,94,93,92,91] | [(10,95),(9,94),(8,93),(7,92),(6,91)]})Val [95,94,93,92,91](pl @(IterateNUntil 3 (Id <= 90) Pred) 95Present [95,94,93] ((>>) [95,94,93] | {Map [95,94,93] | [(3,95),(2,94),(1,93)]})Val [95,94,93]$pl @(IterateNUntil 9999 'False Id) 1?Error Unfoldr (9999,1):recursion limit i=100 (Unfoldr (9999,1))-Fail "Unfoldr (9999,1):recursion limit i=100"predicate-typedunfolds a value applying f while the condition p is true or n times(pl @(IterateNWhile 10 (Id > 90) Pred) 95Present [95,94,93,92,91] ((>>) [95,94,93,92,91] | {Map [95,94,93,92,91] | [(10,95),(9,94),(8,93),(7,92),(6,91)]})Val [95,94,93,92,91]'pl @(IterateNWhile 3 (Id > 90) Pred) 95Present [95,94,93] ((>>) [95,94,93] | {Map [95,94,93] | [(3,95),(2,94),(1,93)]})Val [95,94,93]predicate-typedunfolds a value applying f while the condition p is true$pl @(IterateWhile (Id > 90) Pred) 947Present [94,93,92,91] (Unfoldr 94 [94,93,92,91] | s=94)Val [94,93,92,91]predicate-typedunfolds a value applying f until the condition p is true$pl @(IterateUntil (Id < 90) Pred) 94=Present [94,93,92,91,90] (Unfoldr 94 [94,93,92,91,90] | s=94)Val [94,93,92,91,90]predicate-typedrun p n times with state spredicate-typed similar to H=pz @(Unfoldr (MaybeBool (Not Null) (SplitAt 2 Id)) Id) [1..5]Val [[1,2],[3,4],[5]]pl @(Unfoldr (If Null (MkNothing _) ('(Take 3 Id, Drop 1 Id) >> MkJust Id)) Id) "abcdefghi"Present ["abc","bcd","cde","def","efg","fgh","ghi","hi","i"] (Unfoldr "abcdefghi" ["abc","bcd","cde","def","efg","fgh","ghi","hi","i"] | s="abcdefghi")8Val ["abc","bcd","cde","def","efg","fgh","ghi","hi","i"]pl @(Unfoldr (If Null (MkNothing _) (Pure _ (SplitAt 2 Id))) Id) [1..5]Present [[1,2],[3,4],[5]] (Unfoldr [1,2,3,4,5] [[1,2],[3,4],[5]] | s=[1,2,3,4,5])Val [[1,2],[3,4],[5]]=pl @(Unfoldr (MaybeBool (Not Null) (SplitAt 2 Id)) Id) [1..5]Present [[1,2],[3,4],[5]] (Unfoldr [1,2,3,4,5] [[1,2],[3,4],[5]] | s=[1,2,3,4,5])Val [[1,2],[3,4],[5]]pl @(Unfoldr (If Null (MkNothing _) (Guard "yy" (Len < 3) >> Pure _ (SplitAt 2 Id))) Id) [1..5]Error yy (Unfoldr [1,2,3,4,5]) Fail "yy"pl @(Unfoldr (MaybeBool (Not Null) (Guard "yy" (Len < 3) >> SplitAt 2 Id)) Id) [1..5]Error yy (Unfoldr [1,2,3,4,5]) Fail "yy"9pl @(Unfoldr (Guard "xx" (Len > 4) >> Uncons) Id) [1..10])Error xx (Unfoldr [1,2,3,4,5,6,7,8,9,10]) Fail "xx"pl @(Unfoldr Uncons Id) [1..10]Present [1,2,3,4,5,6,7,8,9,10] (Unfoldr [1,2,3,4,5,6,7,8,9,10] [1,2,3,4,5,6,7,8,9,10] | s=[1,2,3,4,5,6,7,8,9,10])Val [1,2,3,4,5,6,7,8,9,10]pan @(Unfoldr (If (Id < 1) (MkNothing _) (MkJust (DivMod Id 2 >> Swap))) Id) 8P Unfoldr 8 [0,0,0,1]| +- P Id 8|+- P i=1: If 'False Just (0,4)|+- P i=2: If 'False Just (0,2)|+- P i=3: If 'False Just (0,1)|+- P i=4: If 'False Just (1,0)|`- P i=5: If 'True Nothing Val [0,0,0,1]predicate-typedFoldl similar to 'pl @(Foldl (Fst + Snd) 0 (1 ... 10)) ()Present 55 ((>>) 55 | {Last 55 | [0,1,3,6,10,15,21,28,36,45,55]})Val 55,pz @(Foldl (Snd :+ Fst) '[99] (1 ... 10)) ()Val [10,9,8,7,6,5,4,3,2,1,99]*pl @(Foldl Fst '() (EnumFromTo 1 9999)) ()+Error Scanl list size exceeded (max is 100)Fail "Scanl list size exceeded"pl @(Foldl (Guard "someval" (Fst < Snd) >> Snd) Head Tail) [1,4,7,9,16]/Present 16 ((>>) 16 | {Last 16 | [1,4,7,9,16]})Val 16pl @(Foldl (Guard (PrintT "%d not less than %d" Id) (Fst < Snd) >> Snd) Head Tail) [1,4,7,6,16]Error 7 not less than 6 (Scanl)Fail "7 not less than 6"pl @(Foldl (If (L11 && (Snd > L12)) '( 'True, Snd) '( 'False, L12)) '( 'True, Head) Tail) [1,4,7,9,16]Present (True,16) ((>>) (True,16) | {Last (True,16) | [(True,1),(True,4),(True,7),(True,9),(True,16)]}) Val (True,16)pl @(Foldl (If (L11 && (Snd > L12)) '( 'True, Snd) '( 'False, L12)) '( 'True, Head) Tail) [1,4,7,9,16,2]Present (False,16) ((>>) (False,16) | {Last (False,16) | [(True,1),(True,4),(True,7),(True,9),(True,16),(False,16)]})Val (False,16)0pl @(Foldl (Snd :+ Fst) (MEmptyT [_]) Id) [1..5]Present [5,4,3,2,1] ((>>) [5,4,3,2,1] | {Last [5,4,3,2,1] | [[],[1],[2,1],[3,2,1],[4,3,2,1],[5,4,3,2,1]]})Val [5,4,3,2,1]pl @('Just Uncons >> Foldl (If L11 (If (L12 < Snd) '( 'True,Snd) '( 'False, Snd)) Fst) '( 'True,Fst) Snd) [-10,-2,2,3,4,10,9,11]Present (False,9) ((>>) (False,9) | {Last (False,9) | [(True,-10),(True,-2),(True,2),(True,3),(True,4),(True,10),(False,9),(False,9)]}) Val (False,9)pl @('Just Uncons >> Foldl (If L11 (If (L12 < Snd) '( 'True,Snd) '( 'False, Snd)) Fst) '( 'True,Fst) Snd) [-10,2,3,4,10,11]Present (True,11) ((>>) (True,11) | {Last (True,11) | [(True,-10),(True,2),(True,3),(True,4),(True,10),(True,11)]}) Val (True,11)predicate-typed-iterates n times keeping only the last resultpz @(FoldN 4 Succ Id) 'c'Val 'g'9pz @(ReadP Day Id >> Id ... FoldN 5 Succ Id) "2020-07-27"Val [2020-07-27,2020-07-28,2020-07-29,2020-07-30,2020-07-31,2020-08-01]pl @(FoldN 2 Succ Id) LT-Present GT ((>>) GT | {Last GT | [LT,EQ,GT]})Val GTpl @(FoldN 30 Succ Id) LTError Succ IO e=Prelude.Enum.Ordering.succ: bad argument (Scanl)9Fail "Succ IO e=Prelude.Enum.Ordering.succ: bad argument"pl @(FoldN 6 Succ Id) 'a'/Present 'g' ((>>) 'g' | {Last 'g' | "abcdefg"})Val 'g'pl @(FoldN 6 Pred Id) 'a'0Present '[' ((>>) '[' | {Last '[' | "a`_^]\\["})Val '['pl @(FoldN 0 Succ Id) LT'Present LT ((>>) LT | {Last LT | [LT]})Val LT+pl @(FoldN 2 Succ Id >> FoldN 2 Pred Id) LT-Present LT ((>>) LT | {Last LT | [GT,EQ,LT]})Val LT2pz @(FoldN 4 (Id <> Id) Id) "abc" -- same as above6Val "abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc"predicate-typedtuple version of pl @(ScanNA Succ) (4,'a')6Present "abcde" (Scanl "abcde" | b='a' | as=[1,2,3,4]) Val "abcde"pl @(ScanNA Tail) (4,"abcd")Present ["abcd","bcd","cd","d",""] (Scanl ["abcd","bcd","cd","d",""] | b="abcd" | as=[1,2,3,4])Val ["abcd","bcd","cd","d",""]&pl @(Len &&& Id >> ScanNA Tail) "abcd"Present ["abcd","bcd","cd","d",""] ((>>) ["abcd","bcd","cd","d",""] | {Scanl ["abcd","bcd","cd","d",""] | b="abcd" | as=[1,2,3,4]})Val ["abcd","bcd","cd","d",""]predicate-typed(iterates n times keeping all the resultspz @(ScanN 4 Succ Id) 'c' Val "cdefg"+pz @(Dup >> ScanN 4 (Pred *** Succ) Id) 'g'7Val [('g','g'),('f','h'),('e','i'),('d','j'),('c','k')]pz @(ScanN 4 Succ Id) 4Val [4,5,6,7,8]>pz @('(0,1) >> ScanN 20 '(Snd, Fst + Snd) Id >> Map Fst) "sdf"Val [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765]pl @(ScanN 2 Succ Id) 40Present [4,5,6] (Scanl [4,5,6] | b=4 | as=[1,2]) Val [4,5,6]pl @(ScanN 5 Id Id) 4Present [4,4,4,4,4,4] (Scanl [4,4,4,4,4,4] | b=4 | as=[1,2,3,4,5])Val [4,4,4,4,4,4]9pl @(ScanN 2 Succ Id >> PadR 10 (MEmptyT Ordering) Id) LTPresent [LT,EQ,GT,EQ,EQ,EQ,EQ,EQ,EQ,EQ] ((>>) [LT,EQ,GT,EQ,EQ,EQ,EQ,EQ,EQ,EQ] | {PadR 10 pad=EQ [LT,EQ,GT,EQ,EQ,EQ,EQ,EQ,EQ,EQ] | [LT,EQ,GT]})#Val [LT,EQ,GT,EQ,EQ,EQ,EQ,EQ,EQ,EQ]pl @(ScanN 4 Pred Id) 99Present [99,98,97,96,95] (Scanl [99,98,97,96,95] | b=99 | as=[1,2,3,4])Val [99,98,97,96,95]predicate-typed similar to .pz @(Scanl (Snd :+ Fst) Fst Snd) ([99],[1..5])Val [[99],[1,99],[2,1,99],[3,2,1,99],[4,3,2,1,99],[5,4,3,2,1,99]]*pl @(Scanl (Snd :+ Fst) Fst Snd) ([99],[]).Present [[99]] (Scanl [[99]] | b=[99] | as=[]) Val [[99]]None '(-./>?Wpredicate-typed extract the Right value from an  otherwise fail with a message if there is no Right value then p/ is passed the Left value and the whole context&pz @(RightFail "oops" Id) (Right 20.4)Val 20.4%pz @(RightFail "oops" Id) (Left "aa") Fail "oops"pz @(RightFail (PrintT "found left=%s fst=%d" '(Fst,L21)) Snd) (123,Left "xy")Fail "found left=xy fst=123")pz @(RightFail (MEmptyT _) Id) (Left 222)Fail ""predicate-typedextract the Left value from an  otherwise fail with a messageif there is no Left value then p0 is passed the Right value and the whole context$pz @(LeftFail "oops" Id) (Left 20.4)Val 20.4%pz @(LeftFail "oops" Id) (Right "aa") Fail "oops"pz @(LeftFail (PrintT "found right=%s fst=%d" '(Fst,L21)) Snd) (123,Right "xy")Fail "found right=xy fst=123")pz @(LeftFail (MEmptyT _) Id) (Right 222)Fail ""pl @(LeftFail (PrintF "someval=%d" L21) Snd) (13::Int,Right @(SG.Sum Int) "abc")!Error someval=13 (LeftFail Right)Fail "someval=13"pl @(LeftFail (PrintF "someval=%s" Fst) Id) (Right @(SG.Sum Int) "abc")"Error someval=abc (LeftFail Right)Fail "someval=abc"pl @(LeftFail (PrintF "found rhs=%d" Fst) Id) (Right @String @Int 10)#Error found rhs=10 (LeftFail Right)Fail "found rhs=10"pl @(LeftFail (PrintF "found rhs=%d" (Snd >> L22)) L21) ('x',(Right 10,23))#Error found rhs=23 (LeftFail Right)Fail "found rhs=23"pl @(LeftFail (PrintF "found rhs=%d" (L2 L22)) L21) ('x',(Left "abc",23))Present "abc" (Left) Val "abc"predicate-typed extract the Right value from an  : similar to  if there is no Right value then p/ is passed the Left value and the whole context&pz @(RightDef (1 % 4) Id) (Right 20.4) Val (102 % 5)%pz @(RightDef (1 % 4) Id) (Left "aa") Val (1 % 4)pz @(RightDef (PrintT "found left=%s fst=%d" '(Fst,L21)) Snd) (123,Left "xy")Val "found left=xy fst=123"(pz @(RightDef (MEmptyT _) Id) (Left 222)Val ()1pz @(RightDef (MEmptyT (SG.Sum _)) Id) (Left 222)Val (Sum {getSum = 0})predicate-typedextract the Left value from an - otherwise use the default value: similar to if there is no Left value then p0 is passed the Right value and the whole context$pz @(LeftDef (1 % 4) Id) (Left 20.4) Val (102 % 5)%pz @(LeftDef (1 % 4) Id) (Right "aa") Val (1 % 4)pz @(LeftDef (PrintT "found right=%s fst=%d" '(Fst,L21)) Snd) (123,Right "xy")Val "found right=xy fst=123"(pz @(LeftDef (MEmptyT _) Id) (Right 222)Val ()1pz @(LeftDef (MEmptyT (SG.Sum _)) Id) (Right 222)Val (Sum {getSum = 0})predicate-typed constructorpz @(MkRight _ Id) 44Val (Right 44)predicate-typed constructorpredicate-typed constructorpz @(MkLeft _ Id) 44 Val (Left 44)predicate-typed constructorpredicate-typed similar to 3 but additionally gives p and q the original input=pz @(EitherX (ShowP (L11 + Snd)) (ShowP Id) Snd) (9,Left 123) Val "132">pz @(EitherX (ShowP (L11 + Snd)) (ShowP Id) Snd) (9,Right 'x')Val "((9,Right 'x'),'x')"pz @(EitherX (ShowP Id) (ShowP (Second Succ)) Snd) (9,Right 'x')Val "((9,Right 'x'),'y')"predicate-typedConvenient method to convert a p or q to a  based on a predicate b if b then Right p else Left q0pz @(EitherBool (Fst > 4) L21 L22) (24,(-1,999))Val (Right 999)/pz @(EitherBool (Fst > 4) L21 L22) (1,(-1,999))Val (Left (-1))0pl @(EitherBool (Fst > 10) L21 L22) (7,('x',99))-Present Left 'x' (EitherBool(False) Left 'x')Val (Left 'x')1pl @(EitherBool (Fst > 10) L21 L22) (11,('x',99)),Present Right 99 (EitherBool(True) Right 99)Val (Right 99)+pl @(EitherBool (Gt 10) "found left" 99) 12,Present Right 99 (EitherBool(True) Right 99)Val (Right 99)*pl @(EitherBool (Gt 10) "found left" 99) 7?Present Left "found left" (EitherBool(False) Left "found left")Val (Left "found left")predicate-typed similar to pz @PartitionEithers [Left 'a',Right 2,Left 'c',Right 4,Right 99]Val ("ac",[2,4,99])/pz @PartitionEithers [Right 2,Right 4,Right 99]Val ([],[2,4,99])(pz @PartitionEithers [Left 'a',Left 'c'] Val ("ac",[]),pz @PartitionEithers ([] :: [Either () Int]) Val ([],[]);pl @PartitionEithers [Left 4, Right 'x', Right 'y',Left 99]Present ([4,99],"xy") (PartitionEithers ([4,99],"xy") | [Left 4,Right 'x',Right 'y',Left 99])Val ([4,99],"xy")pl @PartitionEithers [Left 'x', Right 1,Left 'a', Left 'b',Left 'z', Right 10]Present ("xabz",[1,10]) (PartitionEithers ("xabz",[1,10]) | [Left 'x',Right 1,Left 'a',Left 'b',Left 'z',Right 10])Val ("xabz",[1,10])predicate-typedsimilar 3pz @(Pred +++ Id) (Left 13) Val (Left 12)*pz @(ShowP Id +++ Reverse) (Right "hello")Val (Right "olleh")pl @(HeadDef 'False Id +++ Id) (Right @[Bool] 1) -- need @[Bool] to match with 'False#Present Right 1 ((+++) Right 1 | 1) Val (Right 1)pl @(HeadDef 'False Id +++ Id) (Left [True,False]) -- need @[Bool] to match with 'False!2Present Left True ((+++) Left True | [True,False])Val (Left True) pl @(Not Id +++ Id) (Right True),Present Right True ((+++) Right True | True)Val (Right True)pl @(Not Id +++ Id) (Right 12)&Present Right 12 ((+++) Right 12 | 12)Val (Right 12)pl @(HeadDef () Id +++ Id) (Right @[()] 1) -- breaks otherwise: Id says () -> () so has to be a list of [()]#Present Right 1 ((+++) Right 1 | 1) Val (Right 1)pl @(HeadDef () Id +++ Id) (Right @[()] 1) -- this breaks! as Left doesnt have a type#Present Right 1 ((+++) Right 1 | 1) Val (Right 1)$pl @(Not Id +++ Id) (Right @Bool 12)&Present Right 12 ((+++) Right 12 | 12)Val (Right 12)predicate-typed similar to pz @IsRight (Right 123)Val Truepz @IsRight (Left "aa") Val Falsepredicate-typed similar to pz @IsLeft (Right 123) Val Falsepz @IsLeft (Left 'a')Val Truepredicate-typedsimilar 3pz @(Pred ||| Id) (Left 13)Val 12%pz @(ShowP Id ||| Id) (Right "hello") Val "hello"'pl @('True ||| 'False) (Left "someval")"True ((|||) Left True | "someval")Val True(pl @('True ||| 'False) (Right "someval")%False ((|||) Right False | "someval") Val False(pl @(ShowP Succ ||| ShowP Id) (Left 123)&Present "124" ((|||) Left "124" | 123) Val "124"*pl @(ShowP Succ ||| ShowP Id) (Right True)*Present "True" ((|||) Right "True" | True) Val "True" pl @(Not Id ||| Id) (Right True)&Present True ((|||) Right True | True)Val Truepl @(Not Id ||| Id) (Left True)False ((|||) Left False | True) Val Falsepredicate-typed!extracts the right value from an pz @(Right' >> Succ) (Right 20)Val 21pz @(Right' >> Succ) (Left 'a')Fail "Right' found Left"predicate-typed extracts the left value from an pz @(Left' >> Succ) (Left 20)Val 21pz @(Left' >> Succ) (Right 'a')Fail "Left' found Right"22None &'(-./>?predicate-typed similar to predicate-typed similar to pz @(DiffLocalTime Fst Snd) (read "2020-11-08 12:12:03", read "2020-11-05 15:12:00") Val 248403spredicate-typed similar to pz @(DiffUTCTime Fst Snd) (read "2020-11-08 12:12:03Z", read "2020-11-08 11:12:00Z") Val 3603spredicate-typedconvert ) to posix time (seconds since 01-01-1970)pl @(ReadP UTCTime Id >> UTCTimeToPosix Id) "2020-06-28 22:45:12 UTC"Present 1593384312 % 1 ((>>) 1593384312 % 1 | {UTCTimeToPosix 1593384312 % 1 | 2020-06-28 22:45:12 UTC})Val (1593384312 % 1)pz @(Rescan "^Date\\((\\d+)([^\\)]+)\\)" >> Head >> Snd >> ((ReadP Integer (Id !! 0) >> PosixToUTCTime (Id % 1000)) &&& ReadP TimeZone (Id !! 1))) "Date(1530144000000+0530)"#Val (2018-06-28 00:00:00 UTC,+0530)predicate-typed1convert posix time (seconds since 01-01-1970) to "pl @(PosixToUTCTime Id) 1593384312Present 2020-06-28 22:45:12 UTC (PosixToUTCTime 2020-06-28 22:45:12 UTC | 1593384312 % 1)Val 2020-06-28 22:45:12 UTC7pl @(PosixToUTCTime Id >> UTCTimeToPosix Id) 1593384312Present 1593384312 % 1 ((>>) 1593384312 % 1 | {UTCTimeToPosix 1593384312 % 1 | 2020-06-28 22:45:12 UTC})Val (1593384312 % 1).pl @(PosixToUTCTime (Id % 1000)) 1593384312000Present 2020-06-28 22:45:12 UTC (PosixToUTCTime 2020-06-28 22:45:12 UTC | 1593384312 % 1)Val 2020-06-28 22:45:12 UTC(pl @(PosixToUTCTime Id) (3600*4+60*7+12)Present 1970-01-01 04:07:12 UTC (PosixToUTCTime 1970-01-01 04:07:12 UTC | 14832 % 1)Val 1970-01-01 04:07:12 UTCpz @(Rescan "^Date\\((\\d+)([^\\)]+)\\)" >> Head >> Snd >> ReadP Integer (Id !! 0) >> PosixToUTCTime (Id % 1000)) "Date(1530144000000+0530)"Val 2018-06-28 00:00:00 UTCpredicate-typed uncreate a * returning hour minute seconds picosecondspz @(ReadP UTCTime "2019-01-01 12:13:14.1234Z" >> ToTime >> UnMkTime Id) ()Val (12,13,70617 % 5000)pz @(ReadP UTCTime Id >> ToTime >> UnMkTime Id) "2020-07-22 08:01:14.127Z"Val (8,1,14127 % 1000)pz @(ReadP ZonedTime Id >> '(UnMkDay ToDay, UnMkTime ToTime)) "2020-07-11 11:41:12.333+0400"&Val ((2020,7,11),(11,41,12333 % 1000))predicate-typed create a ) from a three-tuple of year month and day pz @(MkTime '(1,2,3 % 12345)) ()Val 01:02:00.000243013365pz @(MkTime Id) (12,13,65) Val 12:13:65pz @(MkTime Id) (17,3,13) Val 17:03:13predicate-typed create a 6 from three int values passed in as year month and day'pz @(MkTime' Fst Snd Thd) (13,99,99999)Val 13:99:99999predicate-typedextract  from DateTime7pz @(ReadP UTCTime Id >> ToTime) "2020-07-06 12:11:13Z" Val 12:11:13predicate-typedextract  from a DateTime6pz @(ReadP UTCTime Id >> ToDay) "2020-07-06 12:11:13Z"Val 2020-07-06predicate-typedget week number of the year4pz @('Just (MkDay '(2020,7,11)) >> ToWeekYear Id) ()Val 28predicate-typedget the day of the weekpz @('Just (MkDay '(2020,7,11)) >> '(UnMkDay Id, ToWeekYear Id,ToWeekDate Id)) ()#Val ((2020,7,11),28,(6,"Saturday"))predicate-typed create a , week number, and the day of the week from three numbers passed in as year month and day/pz @(MkDayExtra '(1,2,3) >> 'Just Id >> Fst) ()Val 0001-02-03'pz @(L1 (Just (MkDayExtra '(1,2,3)))) 1Val 0001-02-03 pz @(MkDayExtra Id) (2019,12,30)Val (Just (2019-12-30,1,1))pz @(MkDayExtra Id) (1999,3,13)Val (Just (1999-03-13,10,6))predicate-typed create a , week number, and the day of the week from three numbers passed in as year month and day-pz @(MkDayExtra' Fst Snd Thd) (2019,99,99999) Val Nothingpredicate-typed uncreate a  returning year month and day6pz @(UnMkDay Id) (readNote "invalid day" "2019-12-30")Val (2019,12,30)predicate-typed create a 6 from three int values passed in as year month and day#pz @(MkDay '(1,2,3) >> 'Just Id) ()Val 0001-02-03pz @('Just (MkDay '(1,2,3))) 1Val 0001-02-03pz @(MkDay Id) (2019,12,30)Val (Just 2019-12-30)pz @(MkDay Id) (1999,3,13)Val (Just 1999-03-13)predicate-typed create a 6 from three int values passed in as year month and day(pz @(MkDay' Fst Snd Thd) (2019,99,99999) Val Nothingpredicate-typedA convenience method to match against many different datetime formats to find the first matchpz @(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") ()Val 2019-03-11 01:22:33pz @(ParseTimes LocalTime Fst Snd) (["%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")Val 2019-03-11 01:22:33pl @(Map (ParseTimes Day '["%Y-%m-%d", "%m/%d/%y", "%b %d %Y"] Id)) ["2001-01-01", "Jan 24 2009", "03/29/0x7"]?Error no match on (03/29/0x7) (Map(i=2, a="03/29/0x7") excnt=1)Fail "no match on (03/29/0x7)"pl @(Map (ParseTimes Day '["%Y-%m-%d", "%m/%d/%y", "%b %d %Y"] Id)) ["2001-01-01", "Jan 24 2009", "03/29/07"]Present [2001-01-01,2009-01-24,2007-03-29] (Map [2001-01-01,2009-01-24,2007-03-29] | ["2001-01-01","Jan 24 2009","03/29/07"])&Val [2001-01-01,2009-01-24,2007-03-29]predicate-typedA convenience method to match against many different datetime formats to find the first matchpredicate-typed similar to 8pz @(ParseTimeP LocalTime "%F %T") "2019-05-24 05:19:59"Val 2019-05-24 05:19:59pz @("2019-05-24 05:19:59" >> ParseTimeP LocalTime "%F %T") (Right "never used")Val 2019-05-24 05:19:59/pl @(ParseTimeP TimeOfDay "%H:%M%S") "14:04:61"4Error ParseTimeP TimeOfDay (%H:%M%S) failed to parse5Fail "ParseTimeP TimeOfDay (%H:%M%S) failed to parse"6pl @(ParseTimeP UTCTime "%F %T") "1999-01-01 12:12:12"Present 1999-01-01 12:12:12 UTC (ParseTimeP UTCTime (%F %T) 1999-01-01 12:12:12 UTC | fmt=%F %T | "1999-01-01 12:12:12")Val 1999-01-01 12:12:12 UTC9pz @(ParseTimeP ZonedTime "%s%Q%z") "153014400.000+0530"Val 1974-11-07 05:30:00 +0530predicate-typed similar to  where t is the  type, p is the datetime format and q) points to the content to parse keeping q) as we might want to extract from a tuplepredicate-typed3type level expression representing a formatted timepz @(FormatTimeP "%F %T") (readNote @LocalTime "invalid localtime" "2019-05-24 05:19:59")Val "2019-05-24 05:19:59"pl @(FormatTimeP "%Y-%m-%d") (readNote @Day "invalid day" "2019-08-17")Present "2019-08-17" (FormatTimeP (%Y-%m-%d) 2019-08-17 | 2019-08-17)Val "2019-08-17"predicate-typedtype level expression representing a formatted time similar to  using a type level  to get the formatting stringpz @(FormatTimeP' Fst Snd) ("the date is %d/%m/%Y", readNote @Day "invalid day" "2019-05-24")Val "the date is 24/05/2019"None '(-./>?Npredicate-typed similar to  but uses the root message of the False predicate case as the failure messagepz @(GuardSimple IsLuhn) [1..4]6Fail "(IsLuhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])"pl @IsLuhn [1..4]5False (IsLuhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4]) Val False"pz @(GuardSimple IsLuhn) [1,2,3,0] Val [1,2,3,0]&pz @(GuardSimple (Len > 30)) [1,2,3,0]Fail "(4 > 30)"1pl @(Map (GuardSimple (Lt 3) >> 'True)) [1 .. 10]Error (3 < 3) | (4 < 3) | (5 < 3) | (6 < 3) | (7 < 3) | (8 < 3) | (9 < 3) | (10 < 3) (Map(i=2, a=3) excnt=8)Fail "(3 < 3) | (4 < 3) | (5 < 3) | (6 < 3) | (7 < 3) | (8 < 3) | (9 < 3) | (10 < 3)"1pl @(Map (GuardSimple (Ge 1) >> 'True)) [1 .. 10]Present [True,True,True,True,True,True,True,True,True,True] (Map [True,True,True,True,True,True,True,True,True,True] | [1,2,3,4,5,6,7,8,9,10])7Val [True,True,True,True,True,True,True,True,True,True]1pl @(Map (GuardSimple (Lt 3) >> 'True)) [1 .. 10]Error (3 < 3) | (4 < 3) | (5 < 3) | (6 < 3) | (7 < 3) | (8 < 3) | (9 < 3) | (10 < 3) (Map(i=2, a=3) excnt=8)Fail "(3 < 3) | (4 < 3) | (5 < 3) | (6 < 3) | (7 < 3) | (8 < 3) | (9 < 3) | (10 < 3)"predicate-typeduses  but negates ppl @(HeadFail "failedn" Id &&& (Len == 1 >> ExitWhen "ExitWhen" Id) >> Fst) [3]+Error ExitWhen (Guard | True | True | '(,))Fail "ExitWhen"pl @(Head &&& (Len == 1 >> Not Id >> ExitWhen "ExitWhen" Id) >> Fst) [3](Present 3 ((>>) 3 | {Fst 3 | (3,False)})Val 3pl @(Head &&& (Len == 1 >> ExitWhen "ExitWhen" (Not Id)) >> Fst) [3]'Present 3 ((>>) 3 | {Fst 3 | (3,True)})Val 32pl @(ExitWhen "ExitWhen" (Len /= 1) >> Head) [3,1]Error ExitWhen (Guard | [3,1])Fail "ExitWhen"0pl @(ExitWhen "ExitWhen" (Len /= 1) >> Head) [3]#Present 3 ((>>) 3 | {Head 3 | [3]})Val 3pl @(ExitWhen "ExitWhen" (Len /= 1) >> Head >> Gt (20 -% 1)) [3]&True ((>>) True | {3 % 1 > (-20) % 1})Val Truepl @(ExitWhen "ExitWhen" (Len /= 1) >> Head >> Gt (20 -% 1)) [-23],False ((>>) False | {(-23) % 1 > (-20) % 1}) Val False6pl @(Map (ExitWhen "ExitWhen" (Gt 10) >> Gt 2)) [1..5]Present [False,False,True,True,True] (Map [False,False,True,True,True] | [1,2,3,4,5]) Val [False,False,True,True,True]5pl @(ExitWhen "err" (Len > 2) >> Map Succ) [12,15,16]Error err (Guard | [12,15,16]) Fail "err"/pl @(ExitWhen "err" (Len > 2) >> Map Succ) [12],Present [13] ((>>) [13] | {Map [13] | [12]})Val [13]predicate-typed boolean guard?pl @(GuardBool (PrintF "bad length = %d" Len) (Len > 9)) [3..8](Error bad length = 6 (GuardBool (6 > 9))Fail "bad length = 6"predicate-typedp7 is the predicate and on failure of the predicate runs prt$pz @(Guard "expected > 3" (Gt 3)) 17Val 17#pz @(Guard "expected > 3" (Gt 3)) 1Fail "expected > 3"1pz @(Guard (PrintF "%d not > 3" Id) (Gt 3)) (-99)Fail "-99 not > 3"4pl @(Map (Guard "someval" (Lt 3) >> 'True)) [1 ..10](Error someval(8) (Map(i=2, a=3) excnt=8)Fail "someval(8)"pl @(Guard "someval" (Len == 2) >> (ShowP Id &&& Id)) ([] :: [Int])Error someval (Guard | [])Fail "someval";pl @(Guard "someval" (Len == 2) >> (Id &&& ShowP Id)) [2,3]Present ([2,3],"[2,3]") ((>>) ([2,3],"[2,3]") | {'([2,3],"[2,3]")})Val ([2,3],"[2,3]")=pl @(Guard "someval" (Len == 2) >> (ShowP Id &&& Id)) [2,3,4]Error someval (Guard | [2,3,4])Fail "someval"4pl @(Map (Guard "someval" (Lt 3) >> 'True)) [1 ..10](Error someval(8) (Map(i=2, a=3) excnt=8)Fail "someval(8)"3pl @(Guard "oops" (Len > 2) >> Map Succ) [12,15,16]Present [13,16,17] ((>>) [13,16,17] | {Map [13,16,17] | [12,15,16]})Val [13,16,17],pl @(Guard "err" (Len > 2) >> Map Succ) [12]Error err (Guard | [12]) Fail "err"pl @(Guard (PrintF "err found len=%d" Len) (Len > 5) >> Map Succ) [12,15,16]*Error err found len=3 (Guard | [12,15,16])Fail "err found len=3"predicate-typed leverages x. for repeating predicates (passthrough method)pz @(GuardsN 4 (PrintT "id=%d must be between 0 and 255, found %d" Id) (0 <..> 0xff)) [121,33,7,256]0Fail "id=3 must be between 0 and 255, found 256"pz @(GuardsN 4 (PrintT "id=%d must be between 0 and 255, found %d" Id) (0 <..> 0xff)) [121,33,7,44]Val [121,33,7,44]pl @(GuardsN 4 (PrintT "guard(%d) %d is out of range" Id) (0 <..> 0xff)) [1,2,3,4]Present [1,2,3,4] (Guards(4)) Val [1,2,3,4]pl @(GuardsN 4 (PrintT "guard(%d) %d is out of range" Id) (0 <..> 0xff)) [1,2,3,4,5])Error Guards:invalid length(5) expected 4*Fail "Guards:invalid length(5) expected 4"pl @(GuardsN 4 (PrintT "guard(%d) %d is out of range" Id) (0 <..> 0xff)) [1,2,3])Error Guards:invalid length(3) expected 4*Fail "Guards:invalid length(3) expected 4"pl @(Resplit "\\." >> Map (ReadP Int Id) >> GuardsN 4 (PrintT "invalid pos=%d val=%d" Id) (0 <..> 0xff)) "13.22.44.1231">Error invalid pos=3 val=1231 (Guard(3) 1231 | [13,22,44,1231])Fail "invalid pos=3 val=1231"predicate-typedif a predicate fails then then the corresponding symbol and value will be passed to the print functionpz @(GuardsDetail "%s invalid: found %d" '[ '("hours", Between 0 23 Id),'("minutes",Between 0 59 Id),'("seconds",Between 0 59 Id)]) [13,59,61] Fail "seconds invalid: found 61"pz @(GuardsDetail "%s invalid: found %d" '[ '("hours", Between 0 23 Id),'("minutes",Between 0 59 Id),'("seconds",Between 0 59 Id)]) [27,59,12]Fail "hours invalid: found 27"pz @(GuardsDetail "%s invalid: found %d" '[ '("hours", Between 0 23 Id),'("minutes",Between 0 59 Id),'("seconds",Between 0 59 Id)]) [23,59,12]Val [23,59,12]predicate-typed leverages x. for repeating predicates (passthrough method)pl @(BoolsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (0 <..> 0xff)) [121,33,7,256]Error Bool(3) [id=3 must be between 0 and 255, found 256] (256 <= 255)Fail "Bool(3) [id=3 must be between 0 and 255, found 256] (256 <= 255)"pl @(BoolsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (0 <..> 0xff)) [121,33,7,44] True (Bools)Val Truepredicate-typedboolean guard which checks a given a list of predicates against the list of valuespl @(BoolsQuick "abc" '[Between 0 23 Id, Between 0 59 Id, Between 0 59 Id]) [12,13,14] True (Bools)Val Truepl @(BoolsQuick (PrintT "id=%d val=%d" Id) '[Between 0 23 Id, Between 0 59 Id, Between 0 59 Id]) [12,13,14] True (Bools)Val Truepl @(BoolsQuick (PrintT "id=%d val=%d" Id) '[Between 0 23 Id, Between 0 59 Id, Between 0 59 Id]) [12,13,99]&Error Bool(2) [id=2 val=99] (99 <= 59)'Fail "Bool(2) [id=2 val=99] (99 <= 59)"predicate-typedboolean guard which checks a given a list of predicates against the list of valuespl @(Bools '[ '(W "hh",Between 0 23 Id), '(W "mm",Between 0 59 Id), '(PrintT "<<<%d %d>>>" Id,Between 0 59 Id) ]) [12,93,14]Error Bool(1) [mm] (93 <= 59)Fail "Bool(1) [mm] (93 <= 59)"pl @(Bools '[ '(W "hh",Between 0 23 Id), '(W "mm",Between 0 59 Id), '(PrintT "<<<%d %d>>>" Id,Between 0 59 Id) ]) [12,13,94]%Error Bool(2) [<<<2 94>>>] (94 <= 59)&Fail "Bool(2) [<<<2 94>>>] (94 <= 59)"pl @(Bools '[ '(W "hh",Between 0 23 Id), '(W "mm",Between 0 59 Id), '(PrintT "<<<%d %d>>>" Id,Between 0 59 Id) ]) [12,13,14] True (Bools)Val Truepl @(Bools '[ '("hours",Between 0 23 Id), '("minutes",Between 0 59 Id), '("seconds",Between 0 59 Id)]) [12,13,14] True (Bools)Val Truepl @(Bools '[ '("hours",Between 0 23 Id), '("minutes",Between 0 59 Id), '("seconds",Between 0 59 Id)]) [12,60,14]"Error Bool(1) [minutes] (60 <= 59)#Fail "Bool(1) [minutes] (60 <= 59)"pl @(Bools '[ '("hours",Between 0 23 Id), '("minutes",Between 0 59 Id), '("seconds",Between 0 59 Id)]) [12,60,14,20](Error Bools:invalid length(4) expected 3)Fail "Bools:invalid length(4) expected 3"predicate-typedGuardsQuick contain a type level list of conditions and one of matching values: on no match will fail using the first parameterpz @(GuardsQuick (PrintT "arg %d failed with value %d" Id) '[Gt 4, Ge 3, Same 4]) [17,3,5] Fail "arg 2 failed with value 5"pz @(GuardsQuick (PrintT "arg %d failed with value %d" Id) '[Gt 4, Ge 3, Same 4]) [17,3,5,99]*Fail "Guards:invalid length(4) expected 3"pl @(GuardsQuick (PrintT "guard(%d) %d is out of range" Id) '[Between 0 11 Id, Between 1 4 Id,Between 3 5 Id]) [10,2,5]Present [10,2,5] (Guards(3)) Val [10,2,5]pl @(GuardsQuick (PrintT "guard(%d) %d is out of range" Id) '[Between 1 31 Id, Between 1 12 Id, Between 1990 2050 Id]) [31,11,1999] Present [31,11,1999] (Guards(3))Val [31,11,1999]pl @(GuardsQuick (PrintT "guard(%d) %d is out of range" Id) '[Between 1 31 Id, Between 1 12 Id, Between 1990 2050 Id]) [31,11])Error Guards:invalid length(2) expected 3*Fail "Guards:invalid length(2) expected 3"pl @(GuardsQuick (PrintT "guard(%d) %d is out of range" Id) '[Between 1 31 Id, Between 1 12 Id, Between 1990 2050 Id]) [31,13,1999]/Error guard(1) 13 is out of range (Guard(1) 13)"Fail "guard(1) 13 is out of range"pl @(GuardsQuick (PrintT "guard(%d) %d is out of range" Id) '[Between 1 31 Id, Between 1 12 Id, Between 1990 2050 Id]) [0,44,1999]-Error guard(0) 0 is out of range (Guard(0) 0)!Fail "guard(0) 0 is out of range"pl @(GuardsQuick (PrintT "guard(%d) %d is out of range" Id) '[Between 1 31 Id, Between 1 12 Id, Between 1990 2050 Id]) [31,11,2000,1,2])Error Guards:invalid length(5) expected 3*Fail "Guards:invalid length(5) expected 3"pl @(GuardsQuick (PrintT "guard(%d) err %03d" Id) '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99,-999]#Error guard(1) err 002 (Guard(1) 2)Fail "guard(1) err 002"pl @(GuardsQuick (PrintT "guard(%d) err %03d" Id) '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99])Error Guards:invalid length(3) expected 4*Fail "Guards:invalid length(3) expected 4"pl @(GuardsQuick (PrintT "guard(%d) err %03d" Id) '[W 'True, Ge 12, W 'True, Lt 2]) [1,22,-99,-999,1,1,2])Error Guards:invalid length(7) expected 4*Fail "Guards:invalid length(7) expected 4"predicate-typedGuards 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 listprt receives (Int,a) as input which is the position and value if there is a failurepz @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 4)]) [17,4] Val [17,4]pz @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 5)]) [17,4]Fail "arg2 failed"pz @(Guards '[ '("arg1 failed",Gt 99), '("arg2 failed", Same 4)]) [17,4]Fail "arg1 failed"pz @(Guards '[ '(PrintT "arg %d failed with value %d" Id,Gt 4), '(PrintT "%d %d" Id, Same 4)]) [17,3] Fail "1 3"pz @(Msg "isbn10" (Resplit "-") >> Concat >> 'Just Unsnoc >> Map (ReadP Int (Singleton Id)) *** If (Singleton Id ==~ "X") 10 (ReadP Int (Singleton Id)) >> ZipWith (Fst * Snd) (1...10 >> Reverse) (Fst +: Snd) >> Sum >> Guard ("mod 0 oops") (Id `Mod` 11 == 0)) "0-306-40614-X"Fail "mod 0 oops"pz @(Resplit "-" >> Concat >> 'Just Unsnoc >> Map (ReadP Int (Singleton Id)) *** If (Singleton Id ==~ "X") 10 (ReadP Int (Singleton Id)) >> ZipWith (Fst * Snd) (1...10 >> Reverse) (Fst +: Snd) >> Sum >> Guard ("mod 0 oops") (Id `Mod` 11 == 0)) "0-306-40611-X"Val 132pz @(Msg "isbn13" (Resplit "-") >> Concat >> Map (ReadP Int (Singleton Id)) >> ZipWith (Fst * Snd) (Cycle 13 [1,3] >> Reverse) Id >> Sum >> '(Id,Id `Mod` 10) >> Guard (PrintT "sum=%d mod 10=%d" Id) (Snd == 0)) "978-0-306-40615-7" Val (100,0)pz @(Resplit "-" >> Concat >> Map (ReadP Int (Singleton Id)) >> ZipWith (Fst * Snd) (Cycle 13 [1,3] >> Reverse) Id >> Sum >> '(Id,Id `Mod` 10) >> Guard (PrintT "sum=%d mod 10=%d" Id) (Snd == 0)) "978-0-306-40615-8"Fail "sum=101 mod 10=1"pz @(Do '[Resplit "-", Concat, ZipWith (Fst * Snd) (Cycle 13 [1,3]) (Map (ReadP Int (Singleton Id))), Sum, Guard (PrintF "%d is not evenly divisible by 10" Id) (Id `Mod` 10 == 0)]) "978-0-7167-0344-9"(Fail "109 is not evenly divisible by 10"pz @(Do '[Resplit "-", Concat, ZipWith (Fst * Snd) (Cycle 13 [1,3]) (Map (ReadP Int (Singleton Id))), Sum, Guard (PrintF "%d is not evenly divisible by 10" Id) (Id `Mod` 10 == 0)]) "978-0-7167-0344-0"Val 100predicate-typedlike 5 but allows you to use the value in the error messagepl @(Case'' (PrintF "no match for %03d" Id) '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15.Error no match for 015 (Case:otherwise failed)Fail "no match for 015"pl @(Case'' (PrintF "no match for %03d" Id) '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 2!Present "eq2" (Case(0) "eq2" | 2) Val "eq2"pl @(Case'' (PrintF "no match for %04d" Id) '[Between 0 5 Id, Same 6, Between 7 10 Id] '[ 'LT, 'EQ, 'GT] Id) (-12)/Error no match for -012 (Case:otherwise failed)Fail "no match for -012"predicate-typedlike - but uses a generic error message (skips the e parameter)pl @(Case' '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 151Error Case:no match (Case:otherwise failed:Proxy)Fail "Case:no match"predicate-typedtries to match the value r with a condition in ps. and if there is a match calls the associated qs entry else run epl @(Case (Snd >> FailP "xx") '[Gt 3, Lt 2, Same 3] '["gt3","lt2","eq3"] Id) 15'Present "gt3" (Case(0 of 2) "gt3" | 15) Val "gt3"pl @(Case (Snd >> FailP "xx") '[Gt 3, Lt 2, Same 3] '["gt3","lt2","eq3"] Id) 1!Present "lt2" (Case(0) "lt2" | 1) Val "lt2"pl @(Case (Snd >> FailP "xx") '[Gt 3, Lt 2, Same 3] '["gt3","lt2","eq3"] Id) 3!Present "eq3" (Case(0) "eq3" | 3) Val "eq3"pl @(Case (Snd >> FailP "no match") '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15,Error no match (Case:otherwise failed:Proxy)Fail "no match"pl @(Case (Fail (Snd >> UnproxyT) (PrintF "no match for %03d" Fst)) '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15.Error no match for 015 (Case:otherwise failed)Fail "no match for 015"pl @(Case "other" '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15&Present "other" (Case(0) "other" | 15) Val "other"pl @(Case (ShowP Fst >> Id <> Id <> Id) '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15(Present "151515" (Case(0) "151515" | 15) Val "151515"predicate-typedsimilar to an if statement: if p then run q else run r=pz @(If (Gt 4) "greater than 4" "less than or equal to 4") 10Val "greater than 4" 2) (Map Succ) (FailS "someval")) [12,15,16](Present [13,16,17] (If 'True [13,16,17])Val [13,16,17]3pl @(Map (If (Lt 3) 'True (FailT _ "err"))) [1..10]$Error err(8) (Map(i=2, a=3) excnt=8) Fail "err(8)"7pl @(Map (If (Lt 3) 'True (FailT _ "someval"))) [1..10](Error someval(8) (Map(i=2, a=3) excnt=8)Fail "someval(8)")pl @(Map (If (Lt 3) 'True 'False)) [1..5]Present [True,True,False,False,False] (Map [True,True,False,False,False] | [1,2,3,4,5])!Val [True,True,False,False,False]pl @(If (Gt 4) (Fail (Hole _) (PrintF "failing with %d" Id)) ()) 45Error failing with 45 (If True)Fail "failing with 45"pl @(If (Gt 4) (Fail (Hole _) (PrintF "failing with %d" Id)) (Id * 7)) 3Present 21 (If 'False 21)Val 21pl @(If (Gt 4) (Fail (Hole _) (PrintF "failing with %d" Id)) (Id * 7 >> ShowP Id >> Ones)) 3'Present ["2","1"] (If 'False ["2","1"]) Val ["2","1"]pl @(If (Gt 4) (Fail (Hole _) (PrintF "failing with %d" Id)) (ShowP (Id * 7) >> Ones)) 19Error failing with 19 (If True)Fail "failing with 19"None '(-./<>?Ytpredicate-typedconverts a string  value to title casepz @ToTitle "HeLlO wOrld!"Val "Hello world!"data Color = Red | White | Blue | Green | Black deriving (Show,Eq,Enum,Bounded,Read)%pz @(ToTitle >> ReadP Color Id) "red"Val Redpredicate-typedconverts a string  value to upper casepz @ToUpper "HeLlO wOrld!"Val "HELLO WORLD!"predicate-typedconverts a string  value to lower casepz @ToLower "HeLlO wOrld!"Val "hello world!"predicate-typed:predicate for determining if the string is all latin charspredicate-typed:predicate for determining if the string has all separatorspredicate-typed;predicate for determining if the string is all octal digitspredicate-typed9predicate for determining if the string is all hex digitspz @IsHexDigitAll "01efA"Val Truepz @IsHexDigitAll "01egfA" Val Falsepredicate-typed;predicate for determining if a string has all control charspredicate-typed9predicate for determining if a string has all punctuationpredicate-typed5predicate for determining if the string is all spacespz @IsSpaceAll "213G" Val Falsepz @IsSpaceAll " "Val Truepz @IsSpaceAll ""Val Truepredicate-typed5predicate for determining if the string is all digitspz @IsDigitAll "213G" Val Falsepz @IsDigitAll "929"Val Truepredicate-typed6predicate for determining if a string is all uppercasepredicate-typed6predicate for determining if a string is all lowercasepz @IsLowerAll "abc"Val Truepz @IsLowerAll "abcX" Val Falsepz @IsLowerAll (T.pack "abcX") Val Falsepz @IsLowerAll "abcdef213" Val Falsepz @IsLowerAll ""Val Truepredicate-typedpredicate similar to predicate-typedpredicate similar to predicate-typedpredicate similar to predicate-typedpredicate similar to pz @IsHexDigit 'A'Val Truepz @IsHexDigit 'g' Val Falsepredicate-typedpredicate similar to predicate-typedpredicate similar to predicate-typedpredicate similar to pz @IsSpace '\t'Val Truepz @IsSpace ' 'Val Truepz @IsSpace 'x' Val Falsepredicate-typedpredicate similar to pz @IsDigit 'g' Val Falsepz @IsDigit '9'Val Truepredicate-typedpredicate similar to predicate-typedpredicate similar to pz @IsLower 'X' Val Falsepz @IsLower '1' Val Falsepz @IsLower 'a'Val Truepredicate-typed.extracts the first character from a non empty pz @(C "aBc") ()Val 'a' None &'(-./<>?bpredicate-typed create a 3 for type @t with all bits set to zero: similar to pz @(ZeroBits Int) ()Val 0predicate-typed create a  for type t with the bit at .p@ and all the others set to zero: similar to pz @(Bit Int Id) 0Val 1pz @(Bit Int Id) 3Val 8predicate-typedcount number of bits at p : similar to pz @(PopCount Id) 7Val 3pz @(PopCount Id) 8Val 1pz @(PopCount Id) (-7)Val (-3)predicate-typedtest the bit at p using q : similar to flipped version of pz @(TestBit 2 Id) 7Val Truepz @(TestBit 2 Id) 8 Val Falsepredicate-typedcomplement the bit at p using q : similar to flipped version of pz @(BitComplement 1 Id) 7Val 5predicate-typedclear the bit at p using q : similar to flipped version of pz @(BitClear 2 Id) 7Val 3predicate-typedset the bit at p using q : similar to flipped version of pz @(BitSet 0 Id) 8Val 9predicate-typedrotate right by p using q : similar to flipped version of pz @(BitRotateR 2 Id) 7Val 1predicate-typedrotate left by p using q : similar to flipped version of pz @(BitRotateL 2 Id) 7Val 28predicate-typed rotate by p using q : similar to flipped version of pz @(BitRotate 2 Id) 7Val 28predicate-typedshift right by p using q : similar to flipped version of pz @(BitShiftR 1 Id) 123Val 61predicate-typedshift left by p using q : similar to flipped version of pz @(BitShiftL 1 Id) 123Val 246predicate-typed shift by p using q : similar to flipped version of pz @(BitShift 1 7) ()Val 14pz @(BitShift 1 Id) 123Val 246predicate-typedbitwise xor similar to pz @(344 .^. 123) ()Val 291predicate-typedbitwise or similar to pz @(344 .|. 123) ()Val 379pz @(Fst .|. Snd) (124,33)Val 125predicate-typedbitwise and similar to pz @(344 .&. 123) ()Val 88557Nonec  .-,+*)('&$#"! %/0123245657898:;<;=>?>@ABACDEDFGHGIJKJLMNOPQRSTUVWXYZ[\]^_`abcdefghijkjlmnmopqprstsuvwxyz{~|} !None-./>?qpredicate-typedip5 type for reading one of many date time formats from predicate-typedip0 type for reading one of many date formats from predicate-typedfmt# type for formatting an ip6 addresspredicate-typedop4 type for validating an ip6 address using predicatespredicate-typedip# type for reading in an ip6 addresspredicate-typed%regular expression for an ip4 addresspredicate-typedregular expression for an octetpredicate-typedfmt# type for formatting an ip4 addresspredicate-typedop1 type for validating an ip4 address using a guardpredicate-typedop5 type for validating an ip4 address using a predicatepredicate-typedip> type for reading in an ip4 address using a regular expressionpredicate-typedip# type for reading in an ip4 addresspredicate-typed%regular expression for an ip4 addresspredicate-typed'regular expression for a time componentpredicate-typedfmt type for formatting the timepredicate-typedop- type for validating the time using predicatepredicate-typedop+ type for validating the time using a guardpredicate-typedip type for reading in timepredicate-typedfmt- type for formatting the ssn compatible with predicate-typedop type for validating a ssnpredicate-typedip type for reading in a ssnpredicate-typedfmt2 type for formatting the date time compatible ith predicate-typedip type for reading in a date timepredicate-typedfmt) type for formatting a credit card using ns as the formatpredicate-typedop8 type for validating a credit card number by check digitpredicate-typedip type for converting a credit card number to a list of singleton digits(("None '(./?|predicate-typed creates a 66 refinement type8$$(refinedTH 123) :: Refined OL (Between 100 125 Id) Int Refined 123 :>$$(refinedTH 99) :: Refined OL (Between 100 125 Id) Int  interactive:8:4: error: * refinedTH: predicate failed with False (100 <= 99) * In the Template Haskell splice $$(refinedTH 99) In the expression: $$(refinedTH 99) :: Refined OL (Between 100 125 Id) Int 9$$(refinedTH 123) :: Refined OAN (Between 100 125 Id) Int Refined 123predicate-typed creates a 66 refinement type running in IOpredicate-typed creates a )) refinement type>$$(refined2TH 100) :: Refined2 OAN Id (Between 100 125 Id) IntRefined2 100 100 >$$(refined2TH 99) :: Refined2 OAN Id (Between 100 125 Id) Int  interactive:127:4: error: * Step 2. False Boolean Check(op) | {100 <= 99} *** Step 1. Success Initial Conversion(ip) (99) *** P Id 99 *** Step 2. False Boolean Check(op) *** Present False 100 <= 99 | +- P Id 99 | +- P '100 | `- P '125 * In the Template Haskell splice $$(refined2TH 99) In the expression: $$(refined2TH 99) :: Refined2 OAN Id (Between 100 125 Id) Int predicate-typed creates a )) refinement type using IOpredicate-typed creates a (( refinement type$$(refined3TH 100) :: Refined3 OAN Id (Between 100 125 Id) Id IntRefined3 100 100 >$$(refined3TH 99) :: Refined3 OAN Id (Between 100 125 Id) Id Int  interactive:127:4: error: * Step 2. False Boolean Check(op) | {100 <= 99} *** Step 1. Success Initial Conversion(ip) (99) *** P Id 99 *** Step 2. False Boolean Check(op) *** Present False 100 <= 99 | +- P Id 99 | +- P '100 | `- P '125 * In the Template Haskell splice $$(refined3TH 99) In the expression: $$(refined3TH 99) :: Refined3 OAN Id (Between 100 125 Id) Id Int $$(refined3TH @OL @(Resplit "\\." >> Map (ReadP Int Id)) @(All (0 <..> 0xff) && Len == 4) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "200.2.3.4")&Refined3 [200,2,3,4] "200.002.003.004"predicate-typed creates a (( refinement type using IOpredicate-typed creates a  refinement type>$$(refined5TH 100) :: Refined5 OAN Id (Between 100 125 Id) Int Refined5 100 >$$(refined5TH 99) :: Refined5 OAN Id (Between 100 125 Id) Int  interactive:127:4: error: * Step 2. False Boolean Check(op) | {100 <= 99} *** Step 1. Success Initial Conversion(ip) (99) *** P Id 99 *** Step 2. False Boolean Check(op) *** Present False 100 <= 99 | +- P Id 99 | +- P '100 | `- P '125 * In the Template Haskell splice $$(refined5TH 99) In the expression: $$(refined5TH 99) :: Refined5 OAN Id (Between 100 125 Id) Int predicate-typed creates a  refinement type using IO&None}  .-,+*)('&$#"! %/0123245657898:;<;=>?>@ABACDEDFGHGIJKJLMNOPQRSTUVWXYZ[\]^_`abcdefghijkjlmnmopqprstsuvwxyz{~|} #None-./>?predicate-typed;take any valid Read/Show instance and turn it into a valid :m + Data.Ratio.newRefined3P (readshow @OZ @Rational) "13 % 3""Right (Refined3 (13 % 3) "13 % 3")/newRefined3P (readshow @OZ @Rational) "13x % 3"Left Step 1. Failed Initial Conversion(ip) | ReadP Ratio Integer (13x % 3)newRefined3P (readshow' @OZ @Rational @(3 % 1 <..> 5 % 1)) "13 % 3""Right (Refined3 (13 % 3) "13 % 3")newRefined3P (Proxy @(ReadShow' OZ Rational (11 -% 2 <..> 3 -% 1))) "-13 % 3"(Right (Refined3 ((-13) % 3) "(-13) % 3")newRefined3P (Proxy @(ReadShow' OZ Rational (Id > (15 % 1)))) "13 % 3"-Left Step 2. False Boolean Check(op) | FalsePnewRefined3P (Proxy @(ReadShow' OL Rational (Msg (PrintF "invalid=%3.2f" (FromRational Double)) (Id > (15 % 1))))) "13 % 3"Left Step 2. False Boolean Check(op) | {invalid=4.33 13 % 3 > 15 % 1}newRefined3P (Proxy @(ReadShow' OZ Rational (Id > (11 % 1)))) "13 % 3"-Left Step 2. False Boolean Check(op) | FalsePnewRefined3P (readshow @OZ @UTCTime) "2018-10-19 14:53:11.5121359 UTC"Right (Refined3 2018-10-19 14:53:11.5121359 UTC "2018-10-19 14:53:11.5121359 UTC"):m + Data.Aeson:newRefined3P (readshow @OZ @Value) "String \"jsonstring\"">Right (Refined3 (String "jsonstring") "String \"jsonstring\"")1newRefined3P (readshow @OZ @Value) "Number 123.4".Right (Refined3 (Number 123.4) "Number 123.4")predicate-typedconvert a string from a given base 'i' and store it internally as a base 'j' string+newRefined3P (Proxy @(BaseIJ OZ 16 2)) "fe" Right (Refined3 "11111110" "fe"),newRefined3P (Proxy @(BaseIJ OZ 16 2)) "fge" 400)) "00fe"Right (Refined3 254 "fe")newRefined3P (basen' @OZ @16 @(GuardSimple (Id < 400) >> 'True)) "f0fe"5Left Step 2. Failed Boolean Check(op) | (61694 < 400)newRefined3P (basen' @OZ @16 @(GuardBool (PrintF "oops bad hex=%d" Id) (Id < 400))) "f0fe":Left Step 2. Failed Boolean Check(op) | oops bad hex=616940newRefined3P (basen' @OL @16 @(Id < 400)) "f0fe"4Left Step 2. False Boolean Check(op) | {61694 < 400}predicate-typedvalidate isbn13-newRefined3P (isbn13 @OZ) "978-0-306-40615-7"=Right (Refined3 [9,7,8,0,3,0,6,4,0,6,1,5,7] "978030640615-7")-newRefined3P (isbn13 @OZ) "978-0-306-40615-8"8Left Step 2. Failed Boolean Check(op) | sum=101 mod 10=1predicate-typedvalidate isbn10)newRefined3P (isbn10 @OZ) "0-306-40611-X"7Right (Refined3 ([0,3,0,6,4,0,6,1,1],10) "030640611-X"))newRefined3P (isbn10 @OZ) "0-306-40611-9"2Left Step 2. Failed Boolean Check(op) | mod 0 oopspredicate-typed'read in an ipv4 address and validate it%newRefined3P (ip4 @OZ) "001.223.14.1"/Right (Refined3 [1,223,14,1] "001.223.014.001")'newRefined3P (ip4 @OL) "001.223.14.999"Left Step 2. Failed Boolean Check(op) | octet 3 out of range 0-255 found 999)newRefined3P (ip4 @OZ) "001.223.14.999.1"Left Step 2. Failed Boolean Check(op) | Guards:invalid length(5) expected 4%newRefined3P (ip4 @OL) "001.257.14.1"Left Step 2. Failed Boolean Check(op) | octet 1 out of range 0-255 found 257predicate-typedread in an ssn$newRefined3P (ssn @OZ) "134-01-2211"+Right (Refined3 [134,1,2211] "134-01-2211")$newRefined3P (ssn @OL) "666-01-2211"Left Step 2. Failed Boolean Check(op) | Bool(0) [number for group 0 invalid: found 666] (True && False | (666 /= 666))$newRefined3P (ssn @OL) "667-00-2211"Left Step 2. Failed Boolean Check(op) | Bool(1) [number for group 1 invalid: found 0] (1 <= 0)predicate-typedcredit card with luhn algorithm)newRefined3P (luhn11 @OZ) "1234-5678-901":Left Step 2. Failed Boolean Check(op) | invalid checkdigit)newRefined3P (luhn11 @OZ) "1234-5678-903"8Right (Refined3 [1,2,3,4,5,6,7,8,9,0,3] "1234-5678-903")'pz @(Luhnip >> Luhnop 11) "79927398713"Val True'pz @(Luhnip >> Luhnop 10) "79927398713"&Fail "expected 10 digits but found 11"predicate-typedread in a valid datetime=newRefined3P (datetime1 @OL @LocalTime) "2018-09-14 02:57:04":Right (Refined3 2018-09-14 02:57:04 "2018-09-14 02:57:04")=newRefined3P (datetime1 @OL @LocalTime) "2018-09-99 12:12:12"Left Step 1. Failed Initial Conversion(ip) | ParseTimeP LocalTime (%F %T) failed to parsepredicate-typedread in a time and validate it!newRefined3P (hms @OL) "23:13:59"&Right (Refined3 [23,13,59] "23:13:59")!newRefined3P (hms @OL) "23:13:60"Left Step 2. Failed Boolean Check(op) | seconds invalid: found 60!newRefined3P (hms @OL) "26:13:59"?Left Step 2. Failed Boolean Check(op) | hours invalid: found 26predicate-typed8ensures that two numbers are in a given range (emulates 66)%newRefined3P (between @OZ @10 @16) 14Right (Refined3 14 14)%newRefined3P (between @OZ @10 @16) 17-Left Step 2. False Boolean Check(op) | FalseP&newRefined3P (between @OAN @10 @16) 17 1Left Step 2. False Boolean Check(op) | {17 <= 16}3*** Step 1. Success Initial Conversion(ip) (17) ***P Id 17'*** Step 2. False Boolean Check(op) ***False 17 <= 16| +- P Id 17|+- P '10|`- P '16==$None-./>?; predicate-typed Luhn check*newRefined2 @OZ @Luhnip @(Luhnop 4) "1230"!Right (Refined2 [1,2,3,0] "1230")*newRefined2 @OL @Luhnip @(Luhnop 4) "1234":Left Step 2. Failed Boolean Check(op) | invalid checkdigit| uses builtin convert a string from a given base 'i' and store it internally as a base 'j' string,newRefined2 @OZ @(BaseIJip 16 2) @'True "fe" Right (Refined2 "11111110" "fe")-newRefined2 @OZ @(BaseIJip 16 2) @'True "fge"> 'True) "f0fe"5Left Step 2. Failed Boolean Check(op) | (61694 < 400)newRefined2 @OL @(ReadBase Int 16) @(Id < 400) "f0fe" -- todo: why different parens vs braces4Left Step 2. False Boolean Check(op) | {61694 < 400}predicate-typedvalidate isbn13-newRefined2P (isbn13 @OZ) "978-0-306-40615-7"Right (Refined2 [9,7,8,0,3,0,6,4,0,6,1,5,7] "978-0-306-40615-7")-newRefined2P (isbn13 @OZ) "978-0-306-40615-8"8Left Step 2. Failed Boolean Check(op) | sum=101 mod 10=1predicate-typedvalidate isbn10)newRefined2P (isbn10 @OZ) "0-306-40611-X"9Right (Refined2 ([0,3,0,6,4,0,6,1,1],10) "0-306-40611-X"))newRefined2P (isbn10 @OZ) "0-306-40611-9"2Left Step 2. Failed Boolean Check(op) | mod 0 oopspredicate-typed'read in an ipv4 address and validate it-newRefined2 @OZ @Ip4ip @Ip4op' "001.223.14.1",Right (Refined2 [1,223,14,1] "001.223.14.1")/newRefined2 @OL @Ip4ip @Ip4op' "001.223.14.999"Left Step 2. Failed Boolean Check(op) | Bool(3) [octet 3 out of range 0-255 found 999] (999 <= 255)'newRefined2P (ip4 @OL) "001.223.14.999"Left Step 2. Failed Boolean Check(op) | octet 3 out of range 0-255 found 999)newRefined2P (ip4 @OL) "001.223.14.999.1"Left Step 2. Failed Boolean Check(op) | Guards:invalid length(5) expected 4%newRefined2P (ip4 @OL) "001.257.14.1"Left Step 2. Failed Boolean Check(op) | octet 1 out of range 0-255 found 257predicate-typedcredit card with luhn algorithm4newRefined2 @OZ @Luhnip @(Luhnop 11) "1234-5678-901":Left Step 2. Failed Boolean Check(op) | invalid checkdigit4newRefined2 @OZ @Luhnip @(Luhnop 11) "1234-5678-903"8Right (Refined2 [1,2,3,4,5,6,7,8,9,0,3] "1234-5678-903")'pz @(Luhnip >> Luhnop 11) "79927398713"Val True'pz @(Luhnip >> Luhnop 10) "79927398713"&Fail "expected 10 digits but found 11"predicate-typedread in a valid datetime>newRefined2 @OL @(Dtip LocalTime) @'True "2018-09-14 02:57:04":Right (Refined2 2018-09-14 02:57:04 "2018-09-14 02:57:04")>newRefined2 @OL @(Dtip LocalTime) @'True "2018-09-99 12:12:12"Left Step 1. Failed Initial Conversion(ip) | ParseTimeP LocalTime (%F %T) failed to parsepredicate-typedread in an ssn+newRefined2 @OZ @Ssnip @Ssnop "134-01-2211"+Right (Refined2 [134,1,2211] "134-01-2211")+newRefined2 @OL @Ssnip @Ssnop "666-01-2211"Left Step 2. Failed Boolean Check(op) | Bool(0) [number for group 0 invalid: found 666] (True && False | (666 /= 666))+newRefined2 @OL @Ssnip @Ssnop "667-00-2211"Left Step 2. Failed Boolean Check(op) | Bool(1) [number for group 1 invalid: found 0] (1 <= 0)predicate-typedread in a time and validate it)newRefined2 @OL @Hmsip @Hmsop' "23:13:59"&Right (Refined2 [23,13,59] "23:13:59"))newRefined2 @OL @Hmsip @Hmsop' "23:13:60"Left Step 2. Failed Boolean Check(op) | Bool(2) [seconds] (60 <= 59))newRefined2 @OL @Hmsip @Hmsop' "26:13:59"Left Step 2. Failed Boolean Check(op) | Bool(0) [hours] (26 <= 23)%%/0()76                < 4                                                                                                *  +                                                                                                                                                                                                                                                                                                        p  Y   \]                                                                                                      i                                                             !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""""""""#############################################################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%.^u.?^t.8^^.^^aa.?? ?TTTTTTTTTTTTTT..... .. .. . . . ^^^^.g11l^^.predicate-typed-0.7.4.2-2iPWzakmmTr69p8nYGa0TWPredicate.UtilPredicate.MiscPredicate.TH_OrphansPredicate.CorePredicate.Refined3Predicate.Refined2Predicate.RefinedPredicate.Refined5Predicate.Data.TuplePredicate.Data.ThesePredicate.Data.StringPredicate.Data.RegexPredicate.Data.ReadShowPredicate.Data.ProxyPredicate.Data.OrderingPredicate.Data.NumericPredicate.Data.MonoidPredicate.Data.LiftedPredicate.Data.JsonPredicate.Data.FoldablePredicate.Data.MaybePredicate.Data.IndexPredicate.Data.IOPredicate.Data.EnumPredicate.Data.ListPredicate.Data.ExtraPredicate.Data.IteratorPredicate.Data.EitherPredicate.Data.DateTimePredicate.Data.ConditionPredicate.Data.CharPredicate.Data.BitsPredicate.Examples.CommonPredicate.Util_THPredicate.Examples.Refined3Predicate.Examples.Refined2Paths_predicate_typed Predicate ReplaceImplRefined3Refined2PrintLPrintT Data.CoercecoerceGHC.Base$>> Data.MaybefromJust Control.Arrow&&&StringRefinedmkProxy2 Data.Functiononsecondfirst*** Data.Alignalign Data.ThesethesemergeTheseWithData.These.CombinatorscatTherecatHerecatThesecatThatcatThis Data.List isSuffixOf isInfixOf isPrefixOf Data.Text stripRight stripLeftstripstripEnd stripStartData.Ord comparingGHC.RealmodData.Bifunctorbimap Control.Monad>>=>=> Data.Functor<&><$> Data.FoldableorandControl.Lens.WrappedWrapped fromMaybe catMaybesmapMaybemaybe GHC.MaybeJust!! System.IOreadIOSystem.EnvironmentgetEnvData.ByteStringreadFileLiftA2nubmaximumminimumproductsumemptyreversePreludesortinitlasttailheadsplitAtspanbreakfiltergroupgroupByAllSafeinitMaytailMaylastMayheadMay Data.SequenceSequnfoldr Data.Either fromRightfromLeftRightLeft|||+++ Date.Time parseTimeM GHC.TypeLitsSymbolData.Text.LensIsTextPredicate.PreludeRefined5.pretty-terminal-0.1.0.0-5CxyTnYjPLM9LP9Hl2u91fSystem.Console.PrettyDefaultWhiteCyanMagentaBlueYellowGreenRedBlackColorSwapCswapCGetColorgetColorSColorRReplace RReplace1 RReplace2 RReplace3GetReplaceFnSubgetReplaceFnSub ReplaceFnSubRPrepend ROverWriteRAppendGetROptsgetROptsROptAnchored AutoCalloutCaseless DollarEndonlyDotallDupnamesExtendedExtra Firstline Multiline NewlineCr NewlineCrlf NewlineLf NoAutoCaptureUngreedyUtf8 NoUtf8CheckGetBoolgetBoolTupleCTupleT getTupleC ExtractL8C ExtractL8T extractL8C ExtractL7C ExtractL7T extractL7C ExtractL6C ExtractL6T extractL6C ExtractL5C ExtractL5T extractL5C ExtractL4C ExtractL4T extractL4C ExtractL3C ExtractL3T extractL3C ExtractL2C ExtractL2T extractL2C ExtractL1C ExtractL1T extractL1CCheckT ApplyConstTJoinTFnTTheseTThatTThisTRightTLeftTMaybeTExtractAFromListExtractTFromTAExtractAFromTAT5_5T5_4T5_3T5_2T5_1T4_4T4_3T4_2T4_1ConsTMapTSumTIfTFlipT%&%%ReverseITupleCReverseITupleTreverseITupleC ToITupleListC ToITupleListP toITupleListC FromITupleC FromITupleP fromITupleC ToITupleC ToITupleP toITupleCLenT IntersperseT<%>RepeatTGetOrdgetOrd OrderingPCGtCGeCEqCLeCLtCNe GetOrdering getOrderingGetThesegetTheseGetLengetLenNotTOrTAndT FailUnlessT FailWhenTBetweenT showTheseshowTerrorInProgram~>isPrime primeFactors primeStreamcycle' prettyOrdshowTKnatsymb compileRegex displayROpts unlessNull unlessNullM nullSpacenullIf pureTryTestpureTryTestPred drawTreeU removeAnsi_Idsum'product'cmpOf$fGetLenNonEmpty:|$fGetLenTheseThese$fGetLenTheseThat$fGetLenTheseThis$fGetLenEitherRight$fGetLenEitherLeft$fGetLenMaybeNothing$fGetLenMaybeJust $fGetLen[]: $fGetLen[][]$fGetTheseTheseThese$fGetTheseTheseThat$fGetTheseTheseThis$fGetOrderingGT$fGetOrderingEQ$fGetOrderingLT $fGetOrdCNe $fGetOrdCLt $fGetOrdCLe $fGetOrdCEq $fGetOrdCGe $fGetOrdCGt$fToITupleC(,,,,,,,,,,,)$fToITupleC(,,,,,,,,,,)$fToITupleC(,,,,,,,,,)$fToITupleC(,,,,,,,,)$fToITupleC(,,,,,,,)$fToITupleC(,,,,,,)$fToITupleC(,,,,,)$fToITupleC(,,,,)$fToITupleC(,,,)$fToITupleC(,,)$fToITupleC(,) $fToITupleC()$fFromITupleC(,)$fFromITupleC(,)0$fFromITupleC(,)1$fFromITupleC(,)2$fFromITupleC(,)3$fFromITupleC(,)4$fFromITupleC(,)5$fFromITupleC(,)6$fFromITupleC(,)7$fFromITupleC(,)8$fFromITupleC(,)9$fFromITupleC(,)10$fFromITupleC()$fToITupleListC12a$fToITupleListC11a$fToITupleListC10a$fToITupleListC9a$fToITupleListC8a$fToITupleListC7a$fToITupleListC6a$fToITupleListC5a$fToITupleListC4a$fToITupleListC3a$fToITupleListC2a$fToITupleListC1a$fToITupleListC0a$fReverseITupleCx(,)ys$fReverseITupleCx()ys$fExtractL1C(,,,,,,,)$fExtractL1C(,,,,,,)$fExtractL1C(,,,,,)$fExtractL1C(,,,,)$fExtractL1C(,,,)$fExtractL1C(,,)$fExtractL1C(,)$fExtractL2C(,,,,,,,)$fExtractL2C(,,,,,,)$fExtractL2C(,,,,,)$fExtractL2C(,,,,)$fExtractL2C(,,,)$fExtractL2C(,,)$fExtractL2C(,)$fExtractL3C(,,,,,,,)$fExtractL3C(,,,,,,)$fExtractL3C(,,,,,)$fExtractL3C(,,,,)$fExtractL3C(,,,)$fExtractL3C(,,)$fExtractL3C(,)$fExtractL4C(,,,,,,,)$fExtractL4C(,,,,,,)$fExtractL4C(,,,,,)$fExtractL4C(,,,,)$fExtractL4C(,,,)$fExtractL4C(,,)$fExtractL4C(,)$fExtractL5C(,,,,,,,)$fExtractL5C(,,,,,,)$fExtractL5C(,,,,,)$fExtractL5C(,,,,)$fExtractL5C(,,,)$fExtractL5C(,,)$fExtractL5C(,)$fExtractL6C(,,,,,,,)$fExtractL6C(,,,,,,)$fExtractL6C(,,,,,)$fExtractL6C(,,,,)$fExtractL6C(,,,)$fExtractL6C(,,)$fExtractL6C(,)$fExtractL7C(,,,,,,,)$fExtractL7C(,,,,,,)$fExtractL7C(,,,,,)$fExtractL7C(,,,,)$fExtractL7C(,,,)$fExtractL7C(,,)$fExtractL7C(,)$fExtractL8C(,,,,,,,)$fExtractL8C(,,,,,,)$fExtractL8C(,,,,,)$fExtractL8C(,,,,)$fExtractL8C(,,,)$fExtractL8C(,,)$fExtractL8C(,) $fTupleC12a $fTupleC11a $fTupleC10a $fTupleC9a $fTupleC8a $fTupleC7a $fTupleC6a $fTupleC5a $fTupleC4a $fTupleC3a $fTupleC2a $fGetNats[]: $fGetNats[][] $fGetSymbs[]:$fGetSymbs[][]$fGetBoolFalse $fGetBoolTrue $fGetROpts[]$fGetROptNoUtf8Check $fGetROptUtf8$fGetROptUngreedy$fGetROptNoAutoCapture$fGetROptNewlineLf$fGetROptNewlineCrlf$fGetROptNewlineCr$fGetROptMultiline$fGetROptFirstline$fGetROptExtra$fGetROptExtended$fGetROptDupnames$fGetROptDotall$fGetROptDollarEndonly$fGetROptCaseless$fGetROptAutoCallout$fGetROptAnchored $fGetROpts:$fGetReplaceFnSubRAppend$fGetReplaceFnSubROverWrite$fGetReplaceFnSubRPrepend$fShowRReplace $fShowSColor$fBoundedSColor$fGetColorDefault$fGetColorWhite$fGetColorCyan$fGetColorMagenta$fGetColorBlue$fGetColorYellow$fGetColorGreen $fGetColorRed$fGetColorBlack$fSwapC(,,,,,,)$fSwapC(,,,,,) $fSwapC(,,,,) $fSwapC(,,,) $fSwapC(,,) $fSwapC(,) $fSwapCArg $fSwapCThese $fSwapCEither $fEnumSColor$fReadReplaceFnSub$fShowReplaceFnSub$fEqReplaceFnSub$fBoundedReplaceFnSub$fEnumReplaceFnSub $fReadROpt $fShowROpt$fEqROpt $fOrdROpt $fEnumROpt $fBoundedROpt$fReadOrderingP$fShowOrderingP $fEqOrderingP$fEnumOrderingP$fBoundedOrderingP$fLiftLiftedRepFixed$fLiftLiftedRepTimeOfDay$fLiftLiftedRepTimeZone$fLiftLiftedRepZonedTime$fLiftLiftedRepLocalTime$fLiftLiftedRepDay$fLiftLiftedRepDiffTime$fLiftLiftedRepUTCTime$fLiftLiftedRepProxyValPFailPFalsePTrueP $fShowValP $fOrdValP$fEqValP $fReadValP $fGenericValP$fLiftLiftedRepValPPE_peValP _peString_FailP_FalseP_TrueP_ValP$fShowPE$fReadPE$fEqPE $fGenericPE$fLiftLiftedRepPEValFailpeStringpeValP $fMonoidValP$fSemigroupValP $fSemigroupPE $fMonoidPE $fShowVal$fEqVal$fOrdVal $fReadVal $fFunctorVal $fFoldableVal$fTraversableVal $fGenericVal$fGeneric1TYPEVal$fLiftLiftedRepValTT_Fail_Val $fMonoidVal$fSemigroupVal $fMonadVal$fApplicativeVal $fFunctorTT$fReadTT$fShowTT$fEqTT $fFoldableTT$fTraversableTT $fGenericTT$fGeneric1TYPETT$fLiftLiftedRepTTOptTOUNVOUVOUNOUBOUOANVOAVOANOABOAOLOZOptCOptOEmptyOWidthOMsg ORecursionOOther:#OColorOColorOn OColorOffOAnsiOUnicodeOZeroOLiteONormalOVerbose MonadEvalrunIOcatchit catchitNFliftEvalhasIOLongShortOther2Other1Color5Color4Color3Color2Color1DebugDZeroDLiteDNormalDVerboseDispAnsiUnicodeHOptsoWidthoDebugoDispoColoroMsg oRecursionoOtheroNoColorPOptsInlineNoInlinettForestttString mkNodeCopymkNode fixTTBoolmkNodeB getValAndPEgetValLRFromTThh getValueLRdefOpts isVerboseshow3show3'lit3 litVerbose showVerboseshowLlitLlitBLlitBS splitAndAlign hasNoTree colorValP colorValBool prtTreePure topMessageprefixNumberToTT prefixMsg_Debug _DVerbosegetOptchkSizechkSize2 formatOMsgsuboptssetOtherEffects badLengthprtTree verboseList _ValEither ttValBoolttVal $fMonadTT$fApplicativeTT $fMonoidTT $fSemigroupTT $fShowPColor$fSemigroupHOpts $fMonoidHOpts $fMonadEvalIO$fMonadEvalIdentity $fOptCOUNV $fOptCOUV $fOptCOUN $fOptCOUB$fOptCOU $fOptCOANV $fOptCOAV $fOptCOAN $fOptCOAB$fOptCOA$fOptCOL$fOptCOZ$fOptCOVerbose $fOptCONormal $fOptCOLite $fOptCOZero$fOptCOUnicode $fOptCOAnsi$fOptCOColorOff$fOptCOColorOn $fOptCOColor$fOptC:# $fOptCOEmpty $fOptCOOther$fOptCORecursion $fOptCOMsg $fOptCOWidth $fShowLong$fEqLong $fReadDebug $fOrdDebug $fShowDebug $fEqDebug $fEnumDebug$fBoundedDebug $fShowDisp$fEqDisp $fReadDisp $fBoundedDisp $fEnumDisp $fShowInline $fEqInline $fShowHOptsL33L32L31L23L22L21L13L12L11CoercePure&Swap||~||&&~&&DoLDoMapMap'L8L7L6L5L4ThdL3SndL2FstL1Any<..>BetweenOnePFailTFailSIdBoolNotLengthLenUnproxyTWrapWrap'Unwrap<<>>>WidthHoleHideMsgIMsgWIdTIdPPPevalevalBool evalQuickpzplpanpanvpapabpavpupubpuvrunrunsrunPrunPQ runPQBool evalBoolHideevalHide unsafeEval evalEither$fPProxyProxyt$fPTheseTheseThese $fPTheseThatx $fPTheseThisx$fPEitherRightx$fPEitherLeftx$fPMaybeNothingMaybe $fPMaybeJustx$fP[]:a$fP[]:a0$fP[][]a$fP()()a$fPNatna$fPOrderingcmpa$fP(,,,,,,,)(,,,,,,,)a$fP(,,,,,,)(,,,,,,)a$fP(,,,,,)(,,,,,)a$fP(,,,,)(,,,,)a$fP(,,,)(,,,)a $fP(,,)(,,)a $fP(,)(,)a $fPSymbolsa $fPBoolba $fPTYPEProxya$fP->[]a $fPTYPE()a $fPTYPEIda $fPTYPEIdTa $fPTYPEMsga $fPTYPEMsgIa $fPTYPEWa $fPTYPEHidex $fPTYPEHolea $fPTYPEWidtha $fPTYPE>>a $fPTYPE>>>x $fPTYPE<x $fPTYPEAllx $fPTYPEAnyx $fPTYPEL1x $fPTYPEFstx $fPTYPEL2x $fPTYPESndx $fPTYPEL3x $fPTYPEThdx $fPTYPEL4x $fPTYPEL5x $fPTYPEL6x $fPTYPEL7x $fPTYPEL8x $fPTYPEMap'x $fPTYPEMapx $fPTYPEDoa $fPTYPEDoLa $fPTYPE&&a $fPTYPE&&~a $fPTYPE||a $fPTYPE||~a $fPTYPE~>a $fPTYPESwapp $fPTYPE$a $fPTYPE&a $fPTYPEPurex$fPTYPECoercea $fPTYPEL11x $fPTYPEL12x $fPTYPEL13x $fPTYPEL21x $fPTYPEL22x $fPTYPEL23x $fPTYPEL31x $fPTYPEL32x $fPTYPEL33x $fShowL33 $fShowL32 $fShowL31 $fShowL23 $fShowL22 $fShowL21 $fShowL13 $fShowL12 $fShowL11 $fShowCoerce $fShowPure$fShow&$fShow$ $fShowSwap$fShow~> $fShow||~$fShow|| $fShow&&~$fShow&& $fShowDoL$fShowDo $fShowMap $fShowMap'$fShowL8$fShowL7$fShowL6$fShowL5$fShowL4 $fShowThd$fShowL3 $fShowSnd$fShowL2 $fShowFst$fShowL1 $fShowAny $fShowAll $fShow<..> $fShowBetween $fShowOneP $fShowFailP $fShowFailT $fShowFailS $fShowFail $fShowIdBool $fShowNot $fShowLength $fShowLen$fShowUnproxyT $fShowWrap $fShowWrap' $fShowUnwrap$fShow<< $fShow>>>$fShow>> $fShowWidth $fShowHole $fShowHide $fShowMsgI $fShowMsg$fShowW $fShowIdT$fShowIdMsg3m3Descm3Shortm3Longm3ValP RResults3RFRTFRTFalseRTTrueFRTTrueTMakeR3 Refined3Cr3Inr3OutunsafeRefined3'unsafeRefined3 genRefined3 genRefined3PmkProxy3 mkProxy3' newRefined3' newRefined3P' newRefined3 newRefined3Peval3Peval3M$fHashableRefined3$fBinaryRefined3$fArbitraryRefined3$fFromJSONRefined3$fToJSONRefined3$fReadRefined3$fIsStringRefined3$fNFDataRefined3 $fShowMsg3$fEqMsg3$fShowRResults3$fLiftLiftedRepRefined3 $fOrdRefined3 $fEqRefined3$fShowRefined3MakeR2Msg2m2Descm2Shortm2Longm2ValP RResults2RTTrue Refined2Cr2Inr2OutunsafeRefined2'unsafeRefined2 genRefined2 genRefined2P newRefined2' newRefined2P' newRefined2 newRefined2Peval2Peval2Mprt2Impl mkProxy2'$fHashableRefined2$fBinaryRefined2$fArbitraryRefined2$fFromJSONRefined2$fToJSONRefined2$fReadRefined2$fIsStringRefined2$fNFDataRefined2 $fShowMsg2$fEqMsg2$fShowRResults2$fLiftLiftedRepRefined2 $fOrdRefined2 $fEqRefined2$fShowRefined2Msg0m0BoolEm0Shortm0Longm0ValBoolColorRefinedC unRefined genRefinedshowMsg0 newRefined' newRefined unsafeRefinedunsafeRefined'$fToJSONRefined$fArbitraryRefined$fHashableRefined$fBinaryRefined$fFromJSONRefined $fReadRefined$fIsStringRefined $fShowMsg0$fEqMsg0 $fShowRefined$fLiftLiftedRepRefined $fEqRefined $fOrdRefined$fNFDataRefinedMakeR5 unRefined5unsafeRefined5'unsafeRefined5 genRefined5 genRefined5P newRefined5' newRefined5P' newRefined5 newRefined5Peval5Peval5M$fHashableRefined5$fBinaryRefined5$fArbitraryRefined5$fFromJSONRefined5$fToJSONRefined5$fReadRefined5$fIsStringRefined5$fLiftLiftedRepRefined5 $fOrdRefined5 $fEqRefined5$fShowRefined5$fNFDataRefined5 ToITupleList ReverseITuple FromITupleToITuple EachITupleTuple'TupleOnBoth|+OrA&*AndASecondFirstPairsDup $fPTYPEDupx $fPTYPEPairsx $fPTYPE&&&x $fPTYPE***(,) $fPTYPEFirstx$fPTYPESecondx $fPTYPEAndAx $fPTYPE&*x $fPTYPEOrAx $fPTYPE|+x$fPTYPEBoth(,) $fPTYPEOn(,) $fPTYPETuplex$fPTYPETuple'x$fPTYPEEachITuple()$fPTYPEEachITuple(,)$fPTYPEToITuplex$fPTYPEFromITuplex$fPTYPEReverseITuple(,)$fPTYPEReverseITuple()$fPTYPEToITupleListxs$fShowToITupleList$fShowReverseITuple$fShowFromITuple$fShowToITuple$fShowEachITuple $fShowTuple' $fShowTuple$fShowOn $fShowBoth$fShow|+ $fShowOrA$fShow&* $fShowAndA $fShowSecond $fShowFirst $fShow*** $fShow&&& $fShowPairs $fShowDupThese'That'This'UnassocAssoc TheseFailThatFailThisFailTheseDefThatDefThisDefZipTheseTheseIdTheseInIsTheseIsThatIsThisMkTheseMkThatMkThat'MkThisMkThis'TheseXTheresHeresThesesThatsThissPartitionThese$fPTYPEPartitionThese[] $fPTYPEThissx $fPTYPEThatsx$fPTYPEThesesx$fPTYPEHeres[]$fPTYPETheres[]$fPTYPETheseXx$fPTYPEMkThis'x$fPTYPEMkThisx$fPTYPEMkThat'x$fPTYPEMkThatx$fPTYPEMkThesea $fPTYPEIsThx$fPTYPEIsThisx$fPTYPEIsThatx$fPTYPEIsThesex$fPTYPETheseInThese$fPTYPETheseIdx$fPTYPEZipThesea$fPTYPEThisDefx$fPTYPEThatDefx$fPTYPETheseDefx$fPTYPEThisFailx$fPTYPEThatFailx$fPTYPETheseFailx $fPTYPEAssocp $fAssocC(,) $fAssocCThese$fAssocCEither$fPTYPEUnassocp$fPTYPEThis'These$fPTYPEThat'These$fPTYPEThese'These $fShowThese' $fShowThat' $fShowThis' $fShowUnassoc $fShowAssoc$fShowTheseFail$fShowThatFail$fShowThisFail$fShowTheseDef $fShowThatDef $fShowThisDef$fShowZipThese $fShowTheseId $fShowTheseIn $fShowIsThese $fShowIsThat $fShowIsThis $fShowIsTh $fShowMkThese $fShowMkThat $fShowMkThat' $fShowMkThis $fShowMkThis' $fShowTheseX $fShowTheres $fShowHeres $fShowTheses $fShowThats $fShowThiss$fShowPartitionThese FromString FromString'ToString IsSuffixCI IsInfixCI IsPrefixCI IsSuffixCIsInfixC IsPrefixCStripRStripLTrimBothTrimRTrimL$fPTYPETrimImplx $fPTYPETrimLx $fPTYPETrimRx$fPTYPETrimBothx$fPTYPEStripImplx$fPTYPEStripLx$fPTYPEStripRx$fPTYPEIsFixImplCx$fPTYPEIsPrefixCx$fPTYPEIsInfixCx$fPTYPEIsSuffixCx$fPTYPEIsPrefixCIx$fPTYPEIsInfixCIx$fPTYPEIsSuffixCIx$fToStringCByteString$fToStringCByteString0$fToStringCText$fToStringCText0 $fToStringC[]$fPTYPEToStringx$fPTYPEFromString'a$fPTYPEFromStringx$fShowFromString$fShowFromString'$fShowToString$fShowIsSuffixCI$fShowIsInfixCI$fShowIsPrefixCI$fShowIsSuffixC$fShowIsInfixC$fShowIsPrefixC$fShowIsFixImplC $fShowStripR $fShowStripL$fShowStripImpl$fShowTrimBoth $fShowTrimR $fShowTrimL$fShowTrimImpl ReplaceFn3 ReplaceFn2 ReplaceFn1 ReplaceFnReplaceOneStringReplaceOneString'ReplaceAllStringReplaceAllString' ReplaceOne ReplaceOne' ReplaceAll ReplaceAll'ResplitResplit' RescanRanges RescanRanges'RescanRescan'ReRe' $fPTYPERe'x $fPTYPERex$fPTYPERescan'x$fPTYPERescanx$fPTYPERescanRanges'x$fPTYPERescanRangesx$fPTYPEResplit'x$fPTYPEResplitx$fPTYPEReplaceImplx$fPTYPEReplaceAll'x$fPTYPEReplaceAllx$fPTYPEReplaceOne'x$fPTYPEReplaceOnex$fPTYPEReplaceAllStringx$fPTYPEReplaceOneStringx$fPTYPEReplaceFnx$fPTYPEReplaceOneString'x$fPTYPEReplaceAllString'x$fPTYPEReplaceFn1x$fPTYPEReplaceFn2x$fPTYPEReplaceFn3x$fShowReplaceFn3$fShowReplaceFn2$fShowReplaceFn1$fShowReplaceFn$fShowReplaceOneString$fShowReplaceOneString'$fShowReplaceAllString$fShowReplaceAllString'$fShowReplaceOne$fShowReplaceOne'$fShowReplaceAll$fShowReplaceAll'$fShowReplaceImpl $fShowResplit$fShowResplit'$fShowRescanRanges$fShowRescanRanges' $fShowRescan $fShowRescan'$fShowRe $fShowRe'PrintIPrintF ReadMaybe ReadMaybe'ReadPReadP'ShowP $fPTYPEShowPx$fPTYPEReadP'x $fPTYPEReadPx$fPTYPEReadMaybe'x$fPTYPEReadMaybex$fPTYPEPrintFx $fPrintC(,) $fPrintC()$fPTYPEPrintIx$fPTYPEPrintTx$fPTYPEPrintLx $fShowPrintL $fShowPrintI $fShowPrintT $fShowPrintF$fShowReadMaybe$fShowReadMaybe' $fShowReadP $fShowReadP' $fShowShowPProxifyPApp2PAppPop2'Pop2Pop1'Pop1Pop0Proxy2TProxy1TProxyT$fPTYPEProxyTx$fPTYPEProxy1Tx$fPTYPEProxy2Tx $fPTYPEPop0x $fPTYPEPop1x $fPTYPEPop1'x $fPTYPEPop2x $fPTYPEPop2'x $fPTYPEPAppx $fPTYPEPApp2x$fPTYPEProxifyx $fShowProxify $fShowPApp2 $fShowPApp $fShowPop2' $fShowPop2 $fShowPop1' $fShowPop1 $fShowPop0 $fShowProxy2T $fShowProxy1T $fShowProxyTNegativePositive AllNegative AllPositiveDesc'DescAsc'Asc===~ ComparingCompare==!/=~<~<=~==~>=~>~/=<<===>=>NeLtLeSameGeGt $fPTYPEGtx $fPTYPEGex $fPTYPESamex $fPTYPELex $fPTYPELtx $fPTYPENex $fPTYPE==!a$fPTYPEComparex$fPTYPEComparingx $fPTYPE===~a $fPTYPECmpa $fPTYPE/=x $fPTYPE=x $fPTYPE>x $fPTYPECmpIa $fPTYPE/=~x $fPTYPE<~x $fPTYPE<=~x $fPTYPE==~x $fPTYPE>=~x $fPTYPE>~x $fPTYPEAscx $fPTYPEAsc'x $fPTYPEDescx $fPTYPEDesc'x$fPTYPEAllPositivex$fPTYPEPositivex$fPTYPEAllNegativex$fPTYPENegativex$fShowNegative$fShowPositive$fShowAllNegative$fShowAllPositive $fShowDesc' $fShowDesc $fShowAsc' $fShowAsc $fShowCmpI $fShowCmp $fShow===~$fShowComparing $fShowCompare $fShow==! $fShow/=~$fShow<~ $fShow<=~ $fShow==~ $fShow>=~$fShow>~$fShow/=$fShow<$fShow<=$fShow==$fShow>=$fShow>$fShowNe$fShowLt$fShowLe $fShowSame$fShowGe$fShowGtRoundUp UnShowBaseNToBits ShowBaseNShowBaseReadBase ReadBase'SignumOddEvenRemQuotQuotRemDivModModDivAbsNegate-%%DivI/LogBase**^*-+FloorFloor'CeilingCeiling'Truncate Truncate' FromRational FromRational' ToRational FromIntegral FromIntegral' FromInteger FromInteger'$fPTYPEFromInteger'a$fPTYPEFromIntegerx$fPTYPEFromIntegral'a$fPTYPEFromIntegralx$fPTYPEToRationalx$fPTYPEFromRational'a$fPTYPEFromRationalx$fPTYPETruncate'x$fPTYPETruncatex$fPTYPECeiling'x$fPTYPECeilingx$fPTYPEFloor'x $fPTYPEFloorx $fPTYPE^a $fPTYPE**a$fPTYPELogBasea$fGetBinOpBAdd$fGetBinOpBSub$fGetBinOpBMult $fPTYPEBina $fPTYPE*x $fPTYPE-x $fPTYPE+x $fPTYPE/a $fPTYPEDivIx $fPTYPE%x$fPTYPENegatex $fPTYPE-%x $fPTYPEAbsx $fPTYPEDiva $fPTYPEModa$fPTYPEDivModa$fPTYPEQuotRema $fPTYPEQuotx $fPTYPERemx $fPTYPEEvenx $fPTYPEOddx$fPTYPESignumx$fPTYPEReadBase'x$fPTYPEReadBasex$fPTYPEShowBasex$fPTYPEShowBaseNx$fPTYPEToBitsx$fPTYPEUnShowBaseNx$fPTYPERoundUpx $fShowRoundUp$fShowUnShowBaseN $fShowToBits$fShowShowBaseN$fShowShowBase$fShowReadBase$fShowReadBase' $fShowSignum $fShowOdd $fShowEven $fShowRem $fShowQuot $fShowQuotRem $fShowDivMod $fShowMod $fShowDiv $fShowAbs $fShowNegate$fShow-%$fShow% $fShowDivI$fShow/ $fShowBin $fShowLogBase$fShow**$fShow^$fShow*$fShow-$fShow+ $fReadBinOp $fShowBinOp $fEqBinOp $fShowFloor $fShowFloor' $fShowCeiling$fShowCeiling'$fShowTruncate$fShowTruncate'$fShowFromRational$fShowFromRational'$fShowToRational$fShowFromIntegral$fShowFromIntegral'$fShowFromInteger$fShowFromInteger'STimesMEmptyPMEmptyTMEmptyT'SConcatMConcatSapS<> $fPTYPE<>x $fPTYPESapx$fPTYPEMConcatx$fPTYPESConcatx$fPTYPEMEmptyT'a$fPTYPEMEmptyTx$fPTYPEMEmptyPx$fPTYPESTimesa $fShowSTimes $fShowMEmptyP $fShowMEmptyT$fShowMEmptyT' $fShowSConcat $fShowMConcat $fShowSap$fShow<>ELREEmptyELeftERightEBothBiMapFlip<*>FFish<:>FPairFMapLiftKRDotDotCatch'Catch>|>>||>SkipTraverseSequence$&$$Join DuplicateExtract<|>*><*<$ $fPTYPE<$x $fPTYPE<*x $fPTYPE*>x $fPTYPE<|>x$fPTYPEExtractt$fPTYPEDuplicatet $fPTYPEJoint $fPTYPE$$x $fPTYPE$&x$fPTYPESequencet $fPTYPESkipa $fPTYPE|>x $fPTYPE>|x $fPTYPE>|>x $fPTYPECatchx$fPTYPECatch'x $fPTYPEDota $fPTYPERDota $fPTYPEKa $fPTYPELiftx $fPTYPEFMapn$fPTYPETraversex $fPTYPE<$>a $fPTYPE<&>x $fPTYPEFPaira $fPTYPE<:>x $fPTYPEFFishx $fPTYPE>>=x $fPTYPE<*>x $fPTYPEFlipx$fPTYPELiftA2x $fPTYPEBiMapn $fSwapCELR$fBitraversableELR$fBifoldableELR$fBifunctorELR $fShowELR$fEqELR$fOrdELR $fFoldableELR $fFunctorELR$fTraversableELR $fShowBiMap $fShowLiftA2 $fShowFlip $fShow<*> $fShow>>= $fShowFFish $fShow<:> $fShowFPair $fShow<&> $fShow<$> $fShowFMap $fShowLift$fShowK $fShowRDot $fShowDot $fShowCatch' $fShowCatch $fShow>|>$fShow>|$fShow|> $fShowSkip$fShowTraverse$fShowSequence$fShow$&$fShow$$ $fShowJoin$fShowDuplicate $fShowExtract $fShow<|>$fShow*>$fShow<*$fShow<$EncodeJsonFile EncodeJson ParseJsonFileParseJsonFile' ParseJson ParseJson'$fPTYPEParseJson'x$fPTYPEParseJsonx$fPTYPEParseJsonFile'x$fPTYPEParseJsonFilex$fPTYPEEncodeJsonx$fPTYPEEncodeJsonFilex$fShowEncodeJsonFile$fShowEncodeJson$fShowParseJsonFile$fShowParseJsonFile'$fShowParseJson$fShowParseJson'OrsAndsFoldMapNullNull'ToListCycle ConcatMapConcat FromListExtFromList ToListExtIToListIToList'IsEmptyToNEList$fPTYPEToNEListt$fPTYPEIsEmptyas$fPTYPEIToList'x$fPTYPEIToListx$fPTYPEToListExtl$fPTYPEFromListx$fPTYPEFromListExtl$fPTYPEConcatx$fPTYPEConcatMapx $fPTYPECyclex$fPTYPEToListt $fPTYPENull'x $fPTYPENulla$fPTYPEFoldMapx $fPTYPEAndsx $fPTYPEOrsx $fShowOrs $fShowAnds $fShowFoldMap $fShowNull $fShowNull' $fShowToList $fShowCycle$fShowConcatMap $fShowConcat$fShowFromListExt$fShowFromList$fShowToListExt $fShowIToList$fShowIToList' $fShowIsEmpty$fShowToNEListJustFailJustDef EmptyBool MaybeBool CatMaybesMapMaybe IsNothingIsJustMaybeInMkJust MkNothing MkNothing'Just'$fPTYPEJust'Maybe$fPTYPEMkNothing'a$fPTYPEMkNothingx$fPTYPEMkJustx$fPTYPEMaybeInMaybe$fPTYPEIsJustx$fPTYPEIsNothingx$fPTYPEMapMaybex$fPTYPECatMaybesx$fPTYPEEmptyBoola$fPTYPEMaybeBoolx$fPTYPEJustDefx$fPTYPEJustFailx$fShowJustFail $fShowJustDef$fShowEmptyBool$fShowMaybeBool$fShowCatMaybes$fShowMapMaybe$fShowIsNothing $fShowIsJust $fShowMaybeIn $fShowMkJust$fShowMkNothing$fShowMkNothing' $fShowJust'!!?LookupIxLIx'Ix LookupFail LookupFail' LookupDef LookupDef'$fPTYPELookupDefx$fPTYPELookupFailx $fPTYPEIxx $fPTYPEIx'x $fPTYPEIxLa $fPTYPE!!a$fPTYPELookupa$fPTYPELookupFail'x$fPTYPELookupDef'x $fPTYPE!!?a $fShow!!? $fShowLookup$fShow!! $fShowIxL $fShowIx'$fShowIx$fShowLookupFail$fShowLookupFail'$fShowLookupDef$fShowLookupDef'StdinReadIO'ReadIOStderrStdout WriteFile WriteFile' AppendFileTimeZtTimeUtc ReadEnvAllReadEnvReadDir DirExists FileExistsReadFileBinaryReadFile$fPTYPEReadFilex$fPTYPEReadFileBinaryx$fPTYPEFileExistsx$fPTYPEReadDirx$fPTYPEDirExistsx$fPTYPEReadEnvx$fPTYPEReadEnvAlla$fPTYPETimeUtca$fPTYPETimeZta$fGetFHandleFStderr$fGetFHandleFStdout$fGetModeWFWrite$fGetModeWFWriteForce$fGetModeWFAppend$fGetFHandleFOther$fPTYPEWriteFileImpla$fPTYPEAppendFilex$fPTYPEWriteFile'x$fPTYPEWriteFilex$fPTYPEStdoutx$fPTYPEStderrx $fPTYPEStdinx $fShowStdin $fShowStderr $fShowStdout$fShowWriteFile$fShowWriteFile'$fShowAppendFile$fShowWriteFileImpl $fReadFHandle $fShowFHandle $fEqFHandle $fReadWFMode $fShowWFMode $fEqWFMode $fShowTimeZt $fShowTimeUtc$fShowReadEnvAll $fShowReadEnv $fShowReadDir$fShowDirExists$fShowFileExists$fShowReadFileBinary$fShowReadFileUniverse Universe'EnumFromThenTo... EnumFromTo ToEnumBFail ToEnumBDef ToEnumBDef'ToEnumToEnum'FromEnum FromEnum'PredBPredSuccNSuccPredB'SuccB'SuccB $fPTYPESuccBx$fPTYPESuccB'x $fPTYPESuccx $fPTYPESuccNx $fPTYPEPredx $fPTYPEPredBx$fPTYPEPredB'x$fPTYPEFromEnum'x$fPTYPEFromEnumx$fPTYPEToEnum'x$fPTYPEToEnumx$fPTYPEToEnumBDef'a$fPTYPEToEnumBDefx$fPTYPEToEnumBFailx$fPTYPEEnumFromTox $fPTYPE...x$fPTYPEEnumFromThenTox$fPTYPEUniverse'x$fPTYPEUniversex$fShowUniverse$fShowUniverse'$fShowEnumFromThenTo $fShow...$fShowEnumFromTo$fShowToEnumBFail$fShowToEnumBDef$fShowToEnumBDef' $fShowToEnum $fShowToEnum'$fShowFromEnum$fShowFromEnum' $fShowPredB $fShowPred $fShowSuccN $fShowSucc $fShowPredB' $fShowSuccB' $fShowSuccBIListIMap PartitionsBy ZipCartesianNubIsSuffixIsInfixIsPrefixMaxMinProductSumEmptyTZipZipRZipLZipPadZipWith EmptyList EmptyList' SingletonReverseLReverseSort SortOnDescSortOnSortByUnzip3UnzipInitLastTailHeadRemoveKeep ChunksOf'ChunksOfDropTakeSplitAtSplitAtsPadRPadLOnesTailsInitsElem IntercalateSpanBreakFilterGroupCntGroupGroupCntStableGroupBy PartitionByAll1Quant PartitionRotateUnsnocUncons+::+++ $fPTYPE++x $fPTYPE:+x $fPTYPE+:x$fPTYPEUnconss$fPTYPEUnsnocs$fPTYPEPartitiona $fPTYPEQuantx $fPTYPEAll1x$fPTYPEPartitionBya$fPTYPEGroupBya$fPTYPEGroupCntStablea $fPTYPEGroupx$fPTYPEFilterx $fPTYPEBreaka $fPTYPESpanx$fPTYPEIntercalatex $fPTYPEElema $fPTYPEInitsx $fPTYPETailsx $fPTYPEOnesx$fPTYPEPadImpla $fPTYPEPadLx $fPTYPEPadRx$fPTYPESplitAtsx$fPTYPESplitAta$fPTYPERotatex $fPTYPETakex $fPTYPEDropx$fPTYPEChunksOf'a$fPTYPEChunksOfx$fPTYPEKeepImplx $fPTYPEKeepx$fPTYPERemovex $fPTYPEHeadx$fPTYPEGroupCntx $fPTYPETailx $fPTYPELastx $fPTYPEInitx $fPTYPEUnzipx$fPTYPEUnzip3x$fPTYPESortByx$fPTYPESortOnx$fPTYPESortOnDescx $fPTYPESortx$fPTYPEReversex$fPTYPEReverseLt$fPTYPESingletonx$fPTYPEEmptyList'x$fPTYPEEmptyListx$fPTYPEZipWitha$fPTYPEZipPada $fPTYPEZipLa $fPTYPEZipRa $fPTYPEZipa$fPTYPEEmptyTx $fPTYPESumx$fPTYPEProductx $fPTYPEMinx $fPTYPEMaxx$fPTYPEIsFixImplx$fPTYPEIsPrefixx$fPTYPEIsInfixx$fPTYPEIsSuffixx $fPTYPENubx$fPTYPEZipCartesianx$fPTYPEPartitionsByx $fPTYPEIMapx $fPTYPEIListx $fShowIList $fShowIMap$fShowPartitionsBy$fShowZipCartesian $fShowNub$fShowIsSuffix $fShowIsInfix$fShowIsPrefix$fShowIsFixImpl $fShowMax $fShowMin $fShowProduct $fShowSum $fShowEmptyT $fShowZip $fShowZipR $fShowZipL $fShowZipPad $fShowZipWith$fShowEmptyList$fShowEmptyList'$fShowSingleton$fShowReverseL $fShowReverse $fShowSort$fShowSortOnDesc $fShowSortOn $fShowSortBy $fShowUnzip3 $fShowUnzip $fShowInit $fShowLast $fShowTail $fShowHead $fShowRemove $fShowKeep$fShowKeepImpl$fShowChunksOf'$fShowChunksOf $fShowDrop $fShowTake $fShowSplitAt$fShowSplitAts $fShowPadR $fShowPadL $fShowPadImpl $fShowOnes $fShowTails $fShowInits $fShowElem$fShowIntercalate $fShowSpan $fShowBreak $fShowFilter$fShowGroupCnt $fShowGroup$fShowGroupCntStable $fShowGroupBy$fShowPartitionBy $fShowAll1 $fShowQuant$fShowPartition $fShowRotate $fShowUnsnoc $fShowUncons$fShow+:$fShow:+$fShow++IsLuhn PrimeFactorsPrimes PrimePrev PrimeNextIsPrimeInitMayTailMayLastMayHeadMayInitFailInitDefLastFailLastDefTailFailTailDefHeadFailHeadDef$fPTYPEHeadDefx$fPTYPEHeadFailx$fPTYPETailDefx$fPTYPETailFailx$fPTYPELastDefx$fPTYPELastFailx$fPTYPEInitDefx$fPTYPEInitFailx$fPTYPEHeadMayx$fPTYPELastMayx$fPTYPETailMayx$fPTYPEInitMayx$fPTYPEIsPrimex$fPTYPEPrimeNextx$fPTYPEPrimePrevx$fPTYPEPrimesx$fPTYPEPrimeFactorsx$fPTYPEIsLuhnx $fShowIsLuhn$fShowPrimeFactors $fShowPrimes$fShowPrimePrev$fShowPrimeNext $fShowIsPrime $fShowInitMay $fShowTailMay $fShowLastMay $fShowHeadMay$fShowInitFail $fShowInitDef$fShowLastFail $fShowLastDef$fShowTailFail $fShowTailDef$fShowHeadFail $fShowHeadDefDoNRepeatParaNPara IterateNUntil IterateNWhile IterateWhile IterateUntilUnfoldNUnfoldrFoldlFoldNScanNAScanNScanl $fPTYPEScanlx $fPTYPEScanNx$fPTYPEScanNAx $fPTYPEFoldNx $fPTYPEFoldlx$fPTYPEUnfoldra$fPTYPEUnfoldNx$fPTYPEIterateUntilx$fPTYPEIterateWhilex$fPTYPEIterateNWhilex$fPTYPEIterateNUntilx$fPTYPEParaImplx$fPTYPEParaImplx0$fPTYPEParaImplx1 $fPTYPEParax $fPTYPEParaNx$fPTYPERepeata $fPTYPEDoNa $fShowDoN $fShowRepeat $fShowParaN $fShowPara$fShowParaImpl$fShowIterateNUntil$fShowIterateNWhile$fShowIterateWhile$fShowIterateUntil $fShowUnfoldN $fShowUnfoldr $fShowFoldl $fShowFoldN $fShowScanNA $fShowScanN $fShowScanl RightFailLeftFailRightDefLeftDefMkRightMkRight'MkLeftMkLeft'EitherX EitherBoolPartitionEithersIsRightIsLeftRight'Left'$fPTYPELeft'Either$fPTYPERight'Either$fPTYPE|||Either$fPTYPEIsLeftx$fPTYPEIsRightx$fPTYPE+++Either$fPTYPEPartitionEithers[]$fPTYPEEitherBoola$fPTYPEEitherXx$fPTYPEMkLeft'x$fPTYPEMkLeftx$fPTYPEMkRight'x$fPTYPEMkRightx$fPTYPELeftDefx$fPTYPERightDefx$fPTYPELeftFailx$fPTYPERightFailx$fShowRightFail$fShowLeftFail$fShowRightDef $fShowLeftDef $fShowMkRight$fShowMkRight' $fShowMkLeft $fShowMkLeft' $fShowEitherX$fShowEitherBool$fShowPartitionEithers $fShow+++ $fShowIsRight $fShowIsLeft $fShow||| $fShowRight' $fShowLeft'LocalTimeToUTC DiffLocalTime DiffUTCTimeUTCTimeToPosixPosixToUTCTimeUnMkTimeMkTimeMkTime'ToTimeToDay ToWeekYear ToWeekDate MkDayExtra MkDayExtra'UnMkDayMkDayMkDay' ParseTimes ParseTimes' ParseTimeP ParseTimeP' FormatTimeP FormatTimeP'$fPTYPEFormatTimeP'x$fPTYPEFormatTimePx$fPTYPEParseTimeP'a$fPTYPEParseTimePx$fPTYPEParseTimes'a$fPTYPEParseTimesx$fPTYPEMkDay'x $fPTYPEMkDayx$fPTYPEUnMkDayx$fPTYPEMkDayExtra'x$fPTYPEMkDayExtrax$fPTYPEToWeekDatex$fPTYPEToWeekYearx$fToDayCSystemTime $fToDayCRatio $fToDayCDay$fToDayCLocalTime$fToDayCZonedTime$fToDayCUTCTime$fToTimeCSystemTime$fToTimeCRatio$fToTimeCDiffTime$fToTimeCTimeOfDay$fToTimeCLocalTime$fToTimeCZonedTime$fToTimeCUTCTime $fPTYPEToDayx$fPTYPEToTimex$fPTYPEMkTime'x$fPTYPEMkTimex$fPTYPEUnMkTimex$fPTYPEPosixToUTCTimex$fPTYPEUTCTimeToPosixx$fPTYPEDiffUTCTimex$fPTYPELocalTimeToUTCx$fPTYPEDiffLocalTimex$fShowLocalTimeToUTC$fShowDiffLocalTime$fShowDiffUTCTime$fShowUTCTimeToPosix$fShowPosixToUTCTime$fShowUnMkTime $fShowMkTime $fShowMkTime' $fShowToTime $fShowToDay$fShowToWeekYear$fShowToWeekDate$fShowMkDayExtra$fShowMkDayExtra' $fShowUnMkDay $fShowMkDay $fShowMkDay'$fShowParseTimes$fShowParseTimes'$fShowParseTimeP$fShowParseTimeP'$fShowFormatTimeP$fShowFormatTimeP' GuardSimpleExitWhen GuardBoolGuardGuardsN GuardsDetailBoolsN BoolsQuickBools GuardsQuickGuardsCase''Case'CaseIf $fPTYPEIfa$fPTYPECaseImplx$fPTYPECaseImplx0$fPTYPECaseImplx1$fPTYPECaseImplx2$fPTYPECaseImplx3 $fPTYPECase'x$fPTYPECase''x $fPTYPECasex$fPTYPEGuardsImplx$fPTYPEGuardsImplx0$fPTYPEGuardsx$fPTYPEGuardsQuickx$fPTYPEBoolsImplx$fPTYPEBoolsImplx0 $fPTYPEBoolsx$fPTYPEBoolsQuickx$fPTYPEBoolsNx$fPTYPEGuardsDetailImplx$fPTYPEGuardsDetailx$fPTYPEGuardsNx $fPTYPEGuarda$fPTYPEGuardBoola$fPTYPEExitWhenx$fPTYPEGuardSimplea$fShowGuardSimple$fShowExitWhen$fShowGuardBool $fShowGuard $fShowGuardsN$fShowGuardsDetail$fShowGuardsDetailImpl $fShowBoolsN$fShowBoolsQuick$fShowBoolsImpl $fShowBools$fShowGuardsQuick $fShowGuards$fShowGuardsImpl $fShowCase'' $fShowCase' $fShowCase$fShowCaseImpl$fShowIfToTitleToUpperToLower IsLatin1AllIsSeparatorAll IsOctDigitAll IsHexDigitAll IsControlAllIsPunctuationAll IsSpaceAll IsDigitAll IsUpperAll IsLowerAllIsLatin1 IsSeparator IsOctDigit IsHexDigit IsControl IsPunctuationIsSpaceIsDigitIsUpperIsLowerC $fPTYPECa$fPTYPEIsLatin1x$fPTYPEIsSeparatorx$fPTYPEIsOctDigitx$fPTYPEIsHexDigitx$fPTYPEIsControlx$fPTYPEIsPunctuationx$fPTYPEIsSpacex$fPTYPEIsDigitx$fPTYPEIsUpperx$fPTYPEIsLowerx$fGetCharSetCLatin1$fGetCharSetCSeparator$fGetCharSetCOctDigit$fGetCharSetCHexDigit$fGetCharSetCControl$fGetCharSetCPunctuation$fGetCharSetCSpace$fGetCharSetCNumber$fGetCharSetCUpper$fGetCharSetCLower$fPTYPEIsCharSetAlla$fPTYPEIsCharSetx$fPTYPEIsLowerAllx$fPTYPEIsUpperAllx$fPTYPEIsDigitAllx$fPTYPEIsSpaceAllx$fPTYPEIsPunctuationAllx$fPTYPEIsControlAllx$fPTYPEIsHexDigitAllx$fPTYPEIsOctDigitAllx$fPTYPEIsSeparatorAllx$fPTYPEIsLatin1Allx$fPTYPEToLowera$fPTYPEToUppera$fPTYPEToTitlea $fShowToTitle $fShowToUpper $fShowToLower$fShowIsLatin1All$fShowIsSeparatorAll$fShowIsOctDigitAll$fShowIsHexDigitAll$fShowIsControlAll$fShowIsPunctuationAll$fShowIsSpaceAll$fShowIsDigitAll$fShowIsUpperAll$fShowIsLowerAll$fShowIsCharSet$fShowIsCharSetAll$fBoundedCharSet $fEnumCharSet $fShowCharSet $fReadCharSet $fOrdCharSet $fEqCharSet$fShowIsLatin1$fShowIsSeparator$fShowIsOctDigit$fShowIsHexDigit$fShowIsControl$fShowIsPunctuation $fShowIsSpace $fShowIsDigit $fShowIsUpper $fShowIsLower$fShowCZeroBitsBitPopCountTestBit BitComplementBitClearBitSet BitRotateR BitRotateL BitRotate BitShiftR BitShiftLBitShift.^..|..&. $fPTYPE.&.a $fPTYPE.|.a $fPTYPE.^.a$fBitFunctionCBFComplement$fBitFunctionCBFClear$fBitFunctionCBFSet$fBitFunctionCBFRotateR$fBitFunctionCBFRotateL$fBitFunctionCBFRotate$fBitFunctionCBFShiftR$fBitFunctionCBFShiftL$fBitFunctionCBFShift$fPTYPEBitImpla$fPTYPEBitShiftx$fPTYPEBitShiftLx$fPTYPEBitShiftRx$fPTYPEBitRotatex$fPTYPEBitRotateLx$fPTYPEBitRotateRx$fPTYPEBitSetx$fPTYPEBitClearx$fPTYPEBitComplementx$fPTYPETestBita$fPTYPEPopCounta $fPTYPEBita$fPTYPEZeroBitsa$fShowZeroBits $fShowBit$fShowPopCount $fShowTestBit$fShowBitComplement$fShowBitClear $fShowBitSet$fShowBitRotateR$fShowBitRotateL$fShowBitRotate$fShowBitShiftR$fShowBitShiftL$fShowBitShift $fShowBitImpl$fShowBitFunction$fEqBitFunction $fShow.^. $fShow.|. $fShow.&.JsonMicrosoftDateTimeLuhn'Luhnop' Ddmmyyyyop' Ddmmyyyyop DdmmyyyyRE DateTimeNip DateTimeFmtsDateNipDateFmts Isbn13fmtIsbn13opIsbn13ip Isbn10fmtIsbn10opIsbn10ipIp6fmtIp6opIp6ip Ip4StrictREOctetREIp4fmtIp4opIp4op'Ip4ip'Ip4ipIp4REHmsREHmsfmtHmsop'HmsopHmsipSsnfmtSsnopSsnipDtfmtDtipLuhnfmtLuhnopLuhnip refinedTH refinedTHIO refined2TH refined2THIO refined3TH refined3THIO refined5TH refined5THIO ReadShowR' ReadShow' ReadShowRReadShowBaseIJ'BaseIJOkNotROkNotOkROkLuhnTLuhnRBetweenNBaseN'BaseNIsbn13Isbn13RIsbn10Isbn10RIp6Ip6RIp4'Ip4R'Ip4Ip4RHms'HmsR'HmsHmsRSsnRSsn DateTimeN DateTimeNRDateN DateTime1Luhn11Luhnluhnluhn'luhn11 datetime1ssnhmsip4ip4'ip6isbn10isbn13base16base16'base2base2'basenbasen'daten datetimenbetweenokoknotreadshow readshow'BaseIJipversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName)pcre-heavy-1.0.0.2-LIZVAwd9Rk9J1lVyg8tNqVText.Regex.PCRE.Heavysubgsubghc-prim GHC.TypesBoolbasemapNatflip$these-1.1.1.1-GCTKgZKO8KuKtity4kb9pPTheseGHC.ListcycleOrderingData.Functor.IdentityIdentityGHC.ReadRead showLitImplIOpure GHC.Classes Data.TuplesndfstanyallidnotlengthFoldable"lens-4.19.2-2vEmLnNyc2RGyOpS48h1FF _Wrapped' _Unwrapped'Type Data.ProxyProxyconst'hashable-1.3.0.0-1P2Y3eA5cTdB8Gcn7yS7qiData.Hashable.ClassHashablebinary-0.8.8.0Data.Binary.ClassBinary(QuickCheck-2.14.1-CrWiTqK3lSLG20mKeRp3MkTest.QuickCheck.Arbitrary Arbitrary$aeson-1.5.4.1-7y6KDmAbZkgAOQ44xTjKXWData.Aeson.Types.FromJSONFromJSONData.Aeson.Types.ToJSONToJSON Data.StringIsStringThatThisAssocCpartitionThese fromStringsplit scanRangesscan=~GHC.ShowshowcompareNumeric showIntAtBaseGHC.NumsignumoddevenremquotquotRemdivModdivabsnegateRational GHC.FloatlogBasefloorceilingtruncate fromRational toRational fromIntegral fromIntegerstimesmemptysconcatmconcatliftA2Data.Traversabletraverse sequenceAjoin$comonad-5.0.6-7mswaSxBWrS2pNVKzA0rqxControl.Comonad duplicateextractnulltoList concatMapconcatGHC.ExtsfromListControl.Lens.IndexeditoListControl.Lens.EmptyAsEmptyNonEmptyMaybe isNothingisJustlookupControl.Lens.AtIxed time-1.9.3&Data.Time.LocalTime.Internal.ZonedTime ZonedTime Data.Time.Clock.Internal.UTCTimeUTCTimegetEnvironmentdirectory-1.3.6.0System.Directory listDirectorydoesDirectoryExist doesFileExistGHC.EnumenumFromThenTo enumFromTotoEnumfromEnumpredsucczipWithControl.Lens.Internal.Iso reversing Data.OldListsortOnunzip3unzipdroptaketailsinitselem partitionControl.Lens.ConsunsnocunconsfoldlscanlEitherpartitionEithersisRightisLeft&Data.Time.LocalTime.Internal.LocalTimelocalTimeToUTC diffLocalTime Data.Time.Clock.Internal.UTCDiff diffUTCTime&Data.Time.LocalTime.Internal.TimeOfDay TimeOfDayData.Time.Calendar.DaysDayData.Time.Format.ParseData.Time.Format.Parse.Class ParseTimeData.Time.Format.Format.Class formatTime GHC.UnicodeisLatin1 Data.Char isSeparator isOctDigit isHexDigit isControl isPunctuationisSpaceisDigitisUpperisLower Data.BitsBitszeroBitsbitpopCounttestBit complementBitclearBitsetBitrotateRrotateLrotateshiftRshiftLshiftxor