!E7      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./01234567 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                                                                                      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                    ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 $!Safe^789:;<=>None1:^None&',-.1=>?@ACHSUVX_kpredicate-typed-type family to extract 'a' from a list of 'a'predicate-typed%type family to extract 'a' from 't a'predicate-typedmconcat 1 options at the type levelNx = getOptT @(OptTT '[ 'OMsg "test", 'ORecursion 123, OU, OL, 'OMsg "field2"])oMsg x["test","field2"] oRecursion x123predicate-typedrepresents any kindpredicate-typed=extract 'i' part of 5 tuple from the type level for use with "predicate-typed?extract 'fmt' part of 5 tuple from the type level for use with "predicate-typed>extract 'op' part of 5 tuple from the type level for use with "predicate-typed>extract 'ip' part of 5 tuple from the type level for use with " predicate-typed@extract 'opts' part of 5 tuple from the type level for use with "!predicate-typed=extract 'i' part of 4 tuple from the type level for use with #"predicate-typed>extract 'op' part of 4 tuple from the type level for use with ##predicate-typed>extract 'ip' part of 4 tuple from the type level for use with #$predicate-typed@extract 'opts' part of 4 tuple from the type level for use with #.predicate-typedcombinations of options/predicate-typed"extract options from the typelevel1predicate-typedDisplay options2predicate-typedset display width3predicate-typed>set text to add context to a failure message for refined types4predicate-typed set recursion limit eg for regex5predicate-typedset effects for messages6predicate-typedmempty7predicate-typedmappend8predicate-typedset color palette9predicate-typedturn on colors:predicate-typedturn off colors;predicate-typed ansi display<predicate-typedunicode display=predicate-typeddebug mode return nothing>predicate-typeddebug mode return one line?predicate-typeddebug mode normal@predicate-typeddebug mode verboseApredicate-typedcomposite: no messagesBpredicate-typedcomposite: lite versionCpredicate-typedcomposite: ansi + no colorsDpredicate-typed%composite: ansi + no colors + verboseEpredicate-typedcomposite: ansi + colorsFpredicate-typed"composite: ansi + colors + verboseGpredicate-typed%composite: ansi + colors + backgroundHpredicate-typedcomposite: unicode + colorsIpredicate-typed(composite: unicode + colors + backgroundJpredicate-typed%composite: unicode + colors + verboseKpredicate-typed.a typeclass for choosing which monad to run inPpredicate-typed&Extract 'a' from a list-like containerQpredicate-typed? at the type levelRpredicate-typed@! at the type level for a list of ASpredicate-typed'if' at the type levelTpredicate-typedB at the type levelWpredicate-typed=takes a list and converts to a reversed inductive tuple. see  $inductListC @4 [10,12,13,1](1,(13,(12,(10,()))))inductListC @2 ["ab","cc"]("cc",("ab",()))Zpredicate-typedAtakes a flat n-tuple and creates a reversed inductive tuple. see  %"inductTupleC (123,'x',False,"abc")("abc",(False,('x',(123,()))))inductTupleC (123,'x')('x',(123,()))]predicate-typedlength of a type level list^predicate-typed-Intersperse a symbol inside a list of symbols`predicate-typedRepeat an expression n timesapredicate-typedextract c from the typelevelcpredicate-typed"all the ways to compare two valuesCpredicate-typedget   from the typeleveljpredicate-typedget D from the typelevellpredicate-typedget ordering from the typelevelnpredicate-typedget E from typelevelppredicate-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)0rpredicate-typed(get a list of Symbols from the typelevelgetSymbs @'["abc","def","g"]["abc","def","g"]tpredicate-typed%get a list of Nats from the typelevelgetNats @'[10,12,1] [10,12,1]vpredicate-typedtypelevel boolean Notwpredicate-typedtypelevel boolean Orxpredicate-typedtypelevel boolean Andypredicate-typed,helper method that fails with msg when Falsezpredicate-typed-helper method that fails with a msg when True{predicate-typedtype level Between|predicate-typedused by &' and F and Gc to allow more flexible replacement These parallel the RegexReplacement (not exported) class in Text.Regex.PCRE.HeavyM 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 optionsHpredicate-typed2convert type level regex option to the value levelpredicate-typed2extract the regex options from the type level listpredicate-typed'Regex options for Rescan Resplit Re etcpredicate-typedForce pattern anchoringpredicate-typedCompile automatic callouts | Bsr_anycrlf -- R matches only CR, LF, or CrlF | Bsr_unicode -- ^ R matches all Unicode line endingspredicate-typedDo caseless matchingpredicate-typed"dollar not to match newline at endpredicate-typedmatches anything including NLpredicate-typed%Allow duplicate names for subpatternspredicate-typed Ignore whitespace and # commentspredicate-typed,PCRE extra features (not much use currently)predicate-typed#Force matching to be before newlinepredicate-typedcaret and dollar match newlines within data | Newline_any -- ^ Recognize any Unicode newline sequence | Newline_anycrlf -- ^ Recognize CR, LF, and CrlF as newline sequencespredicate-typedSet CR as the newline sequencepredicate-typed Set CrlF as the newline sequencepredicate-typedSet LF as the newline sequencepredicate-typed=Disable numbered capturing parentheses (named ones available)predicate-typed Invert greediness of quantifierspredicate-typedRun in UTF--8 modepredicate-typed+Do not check the pattern for UTF-8 validitypredicate-typedcolor palettespredicate-typed.how much detail to show in the expression treepredicate-typed(one line summary used mainly for testingpredicate-typedMone line summary with additional context from the head 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-typed monoid optspredicate-typed7customizable options for running a typelevel expressionpredicate-typedlength of data to display for Ipredicate-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 IdentityJpredicate-typed elide the K% wrapper so it acts like a normal adtLpredicate-typed4the color palette for displaying the expression treeMpredicate-typed#wrapper for a show instance around  predicate-typed a monomorphic container of treespredicate-typed8represents the untyped evaluation tree for final displayNpredicate-typed)holds the result of running the predicateOpredicate-typed*optional strings to include in the resultsPpredicate-typed?contains the untyped result from evaluating the expression treeQpredicate-typedfails the entire evaluationRpredicate-typedFalse predicateSpredicate-typedTrue predicateTpredicate-typed Any valuepredicate-typed6extracts the 'BoolT a' constructors from the typelevelpredicate-typed=contains the typed result from evaluating the expression treepredicate-typed-represents the evaluation tree for predicatespredicate-typedthe value at this root nodepredicate-typed1detailed information eg input and output and textpredicate-typedthe child nodespredicate-typedlens for accessing  in predicate-typed$lens for accessing the message from predicate-typed$lens for accessing the subtree from Upredicate-typeda lens from typed  to the untyped PVpredicate-typedlens for accessing Npredicate-typedlens for accessing predicate-typed&creates a Node for the evaluation treepredicate-typed+creates a Boolean node for a predicate typeWpredicate-typed get the value from BoolT or failpredicate-typed2converts a typed tree to an untyped on for displayXpredicate-typed)converts a typed tree into an untyped onepredicate-typed'convenience method to wrap a typed treepredicate-typed/add more detail to the tree if there are errorsYpredicate-typedcombine options ala monoidZpredicate-typed(set maximum display width of expressions[predicate-typed&set title message for the display tree\predicate-typed+set maximum recursion eg when running regex]predicate-typedset color of title message^predicate-typedturn on/off colors_predicate-typeddisplay type eg  or `predicate-typed,create color palette for the expression treeapredicate-typedset debug modebpredicate-typeddefault optionscpredicate-typedLdefault title message color and boundaries between multipart refine messagespredicate-typedverbose debug flagpredicate-typed$fix PresentT Bool to TrueT or FalseTpredicate-typed9more restrictive: only display data in verbose debug modepredicate-typed+compile a regex using the type level symbolpredicate-typedOextract values from the trees or if there are errors return a tree with contextdpredicate-typedprism from BoolT to Boolpredicate-typed prismpredicate-typed prismpredicate-typed prismpredicate-typed prismpredicate-typedboolean implication True ~> FalseFalse True ~> TrueTrueFalse ~> FalseTrue False ~> TrueTruepredicate-typedget a Nat from the typelevelnat @1414predicate-typed"gets the Symbol from the typelevel symb @"abc""abc"predicate-typeddisplay constructor name for Eepredicate-typedpretty print a treefpredicate-typed render the P value with colorspredicate-typed render the  value with colorsgpredicate-typedEcolors the result of the predicate based on the current color palettepredicate-typed?override PresentP case if there is no tree ie lite or zero modehpredicate-typed%override PresentP case with long namepredicate-typed display treepredicate-typedextract message part from treepredicate-typedrender numbered treepredicate-typedprefix text in front of tStringpredicate-typedshow the type as a stringpredicate-typedshow the kind as a stringpredicate-typed pretty print ipredicate-typed?strip ansi characters from a string and print it (for doctests)predicate-typedread a field and value using j parserpredicate-typedconvert typelevel options to u(oDisp &&& fst . oColor &&& oWidth) (getOptT @(OA ':# OU ':# OA ':# 'OWidth 321 ':# Color4 ':# 'OMsg "test message"))(Ansi,("color4",321))-oMsg (getOptT @('OMsg "abc" ':# 'OMsg "def")) ["abc","def"]LoOther (getOptT @('OOther 'False 'Red 'White ':# 'OOther 'True 'Red 'Black))(True,Red,Black)$a = show (getOptT @('OEmpty ':# OU))%b = show (getOptT @(OU ':# 'OEmpty));c = show (getOptT @OU) a==b && b==cTruepredicate-typed&deal with possible recursion on a listpredicate-typedpretty print a messagepredicate-typedoverride options for " so we dont lose error informationpredicate-typed?render a string for messages using optional color and underlinepredicate-typedprime predicate isPrime 7True isPrime 6Falsepredicate-typed'convenience method for optional displaypredicate-typed<message to display when the length of a foldable is exceededpredicate-typedsemigroup instance for `predicate-typedk' instance for evaluating the expressionapredicate-typedK' instance for evaluating the expression5predicate-typed set underlinepredicate-typedset foreground colorpredicate-typedset background color8 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  !"#$%&'()*+,-./01ABCDEGHIJF85234679:;<=>?@KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ .-,+*)'&%(1ABCDEGHIJF85234679:;<=>?@/0|}~{zyxwv`^]Z[\WXYTSRQPVU_turspqnolmjkcdefghiab$#"! KLMNO76U9 V9 _71None-.=>?@AHPUVXkM-Xpredicate-typed similar to l.pz @(Coerce (SG.Sum Integer)) (Identity (-13))PresentT (Sum {getSum = -13})pl @(Coerce SG.Any) True?Present Any {getAny = True} (Coerce Any {getAny = True} | True)PresentT (Any {getAny = True})pl @(Coerce Bool) (SG.Any True)0Present True (Coerce True | Any {getAny = True}) PresentT Truepredicate-typed similar to mpz @(Pure Maybe Id) 4PresentT (Just 4)pz @(Pure [] Id) 4 PresentT [4]-pz @(Pure (Either String) (Fst Id)) (13,True)PresentT (Right 13)pl @(Pure Maybe Id) 'x'&Present Just 'x' (Pure Just 'x' | 'x')PresentT (Just 'x')pl @(Pure (Either _) Id) 'x'(Present Right 'x' (Pure Right 'x' | 'x')PresentT (Right 'x')$pl @(Pure (Either _) Id >> Swap) 'x'>Present Left 'x' ((>>) Left 'x' | {Swap Left 'x' | Right 'x'})PresentT (Left 'x')%pl @(Pure (Either ()) Id >> Swap) 'x'>Present Left 'x' ((>>) Left 'x' | {Swap Left 'x' | Right 'x'})PresentT (Left 'x'))pl @(Pure (Either String) Id >> Swap) 123>Present Left 123 ((>>) Left 123 | {Swap Left 123 | Right 123})PresentT (Left 123)predicate-typed similar to n/pl @(Id & Fst & Singleton & Length) (13,"xyzw")Present 1 (Length 1 | [13]) PresentT 1pl @(2 & (&&&) "abc") () Present ("abc",2) (W '("abc",2))PresentT ("abc",2)pl @(2 & '(,) "abc") ()Present ("abc",2) ('("abc",2))PresentT ("abc",2)pl @('(,) 4 $ '(,) 7 $ "aa") ()$Present (4,(7,"aa")) ('(4,(7,"aa")))PresentT (4,(7,"aa"))0pl @(Thd $ Snd $ Fst Id) ((1,("W",9,'a')),(3,4))#Present 'a' (Thd 'a' | ("W",9,'a')) PresentT 'a'predicate-typedlike () for expressions"pl @(Fst $ Snd $ Id) ((1,2),(3,4))Present 3 (Fst 3 | (3,4)) PresentT 3+pl @((<=) 4 $ Fst $ Snd $ Id) ((1,2),(3,4))False (4 <= 3)FalseTpredicate-typed swaps using pz @Swap (Left 123)PresentT (Right 123)pz @Swap (Right 123)PresentT (Left 123)pz @Swap (These 'x' 123)PresentT (These 123 'x')pz @Swap (This 'x')PresentT (That 'x')pz @Swap (That 123)PresentT (This 123)pz @Swap (123,'x')PresentT ('x',123)pz @Swap (Left "abc")PresentT (Right "abc")pz @Swap (Right 123)PresentT (Left 123)pl @Swap (Right "asfd")5Present Left "asfd" (Swap Left "asfd" | Right "asfd")PresentT (Left "asfd")pl @Swap (12,"asfd")4Present ("asfd",12) (Swap ("asfd",12) | (12,"asfd"))PresentT ("asfd",12)predicate-typedboolean implication;pz @(Fst Id ~> (Length (Snd Id) >= 4)) (True,[11,12,13,14])TrueT>pz @(Fst Id ~> (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseT?pz @(Fst Id ~> (Length (Snd Id) == 4)) (False,[12,11,12,13,14])TrueT<pz @(Fst Id ~> (Length (Snd Id) >= 4)) (False,[11,12,13,14])TrueTpredicate-typed#short circuit version of boolean Or!pl @(Id > 10 ||~ Failt _ "ss") 11True (True ||~ _ | (11 > 10))TrueTpz @(Id > 10 ||~ Id == 9) 9TrueTpl @(Id > 10 ||~ Id > 9) 9.False (False ||~ False | (9 > 10) ||~ (9 > 9))FalseTpredicate-typed similar to o<pz @(Fst Id || (Length (Snd Id) >= 4)) (False,[11,12,13,14])TrueTDpz @(Not (Fst Id) || (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseTpredicate-typed$short circuit version of boolean And pl @(Id > 10 &&~ Failt _ "ss") 9False (False &&~ _ | (9 > 10))FalseTpl @(Id > 10 &&~ Id == 12) 11#False (True &&~ False | (11 == 12))FalseTpl @(Id > 10 &&~ Id == 11) 11True (True &&~ True)TrueTpredicate-typed similar to p#pz @(Fst Id && Snd Id) (True, True)TrueTpz @(Id > 15 && Id < 17) 16TrueTpz @(Id > 15 && Id < 17) 30FalseT;pz @(Fst Id && (Length (Snd Id) >= 4)) (True,[11,12,13,14])TrueT>pz @(Fst Id && (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseTpredicate-typedEprocesses a type level list predicates running each in sequence: see &*0pz @(Do [Pred Id, ShowP Id, Id &&& Len]) 9876543PresentT ("9876542",7)=pz @(Do '[W 123, W "xyz", Len &&& Id, Pred Id *** Id<>Id]) ()PresentT (2,"xyzxyz")Gpl @(Do '[Succ Id,Id,ShowP Id,Ones Id,Map (ReadBase Int 8 Id) Id]) 1239HPresent [1,2,4,0] ((>>) [1,2,4,0] | {Map [1,2,4,0] | ["1","2","4","0"]})PresentT [1,2,4,0]Gpl @(Do '[Pred Id,Id,ShowP Id,Ones Id,Map (ReadBase Int 8 Id) Id]) 1239+Error invalid base 8 (1238 (>>) rhs failed)FailT "invalid base 8"pl @(Do '[4,5,6]) ()Present 6 ((>>) 6 | {'6}) PresentT 6+pl @(Do '["abc", "Def", "ggg", "hhhhh"]) ()+Present "hhhhh" ((>>) "hhhhh" | {'"hhhhh"})PresentT "hhhhh"pl @(Do '[ 'LT, 'EQ, 'GT ]) ()Present GT ((>>) GT | {'GT}) PresentT GT$pl @(Do '[4 % 4,22 % 1 ,12 -% 4]) ()<Present (-3) % 1 ((>>) (-3) % 1 | {Negate (-3) % 1 | 3 % 1})PresentT ((-3) % 1)5pl @(Do '[ W ('PresentT I), W 'FalseT, Not Id]) False#True ((>>) True | {Not (Id False)})TrueTnpl @(Do '[W ('PresentT Id), W 'FalseT]) True -- have to wrap them cos BoolT a vs BoolT Bool ie different types False ((>>) False | {W 'FalseT})FalseTpl @(Do '[1,2,3]) ()Present 3 ((>>) 3 | {'3}) PresentT 3predicate-typed similar to ?pz @(Map (Pred Id) Id) [1..5]PresentT [0,1,2,3,4]qpredicate-typed6applies 'p' to the first and second slot of an n-tuple5pl @(Both Len (Fst Id)) (("abc",[10..17],1,2,3),True)Present (3,8) (Both)PresentT (3,8)6pl @(Both (Pred Id) $ Fst Id) ((12,'z',[10..17]),True)Present (11,'y') (Both)PresentT (11,'y')pl @(Both (Succ Id) Id) (4,'a')Present (5,'b') (Both)PresentT (5,'b')/pl @(Both Len (Fst Id)) (("abc",[10..17]),True)Present (3,8) (Both)PresentT (3,8)8pl @(Both (ReadP Day Id) Id) ("1999-01-01","2001-02-12")&Present (1999-01-01,2001-02-12) (Both) PresentT (1999-01-01,2001-02-12)predicate-typed#similar to 6th element in a n-tuple$pz @(L6 Id) (10,"Abc",'x',True,1,99) PresentT 99predicate-typed#similar to 5th element in a n-tuple!pz @(L5 Id) (10,"Abc",'x',True,1) PresentT 1predicate-typed#similar to 4th element in a n-tuplepz @(L4 Id) (10,"Abc",'x',True) PresentT True;pz @(L4 (Fst (Snd Id))) ('x',((10,"Abc",'x',999),"aa",1),9) PresentT 999$pl @(L4 Id) (99,'a',False,"someval");Present "someval" (L4 "someval" | (99,'a',False,"someval"))PresentT "someval"predicate-typed#similar to 3rd element in a n-tuplepz @(Thd Id) (10,"Abc",133) PresentT 133 pz @(Thd Id) (10,"Abc",133,True) PresentT 133pl @(Thd Id) (99,'a',False,1.3).Present False (Thd False | (99,'a',False,1.3))PresentT Falsepredicate-typed similar to rpz @(Snd Id) (10,"Abc")PresentT "Abc"pz @(Snd Id) (10,"Abc",True)PresentT "Abc"pl @(Snd Id) (99,'a',False,1.3)*Present 'a' (Snd 'a' | (99,'a',False,1.3)) PresentT 'a'predicate-typed similar to spz @(Fst Id) (10,"Abc") PresentT 10pz @(Fst Id) (10,"Abc",'x') PresentT 10!pz @(Fst Id) (10,"Abc",'x',False) PresentT 10pl @(Fst Id) (99,'a',False,1.3)(Present 99 (Fst 99 | (99,'a',False,1.3)) PresentT 99predicate-typed similar to tpl @(Any Even Id) [1,5,11,5,3]False (Any(5))FalseTpl @(Any Even Id) [1,5,112,5,3]True (Any(5) i=2 (0 == 0))TrueTpz @(Any Even Id) []FalseT,pl @(Any (Gt 3) (Fst Id)) ([10,12,3,5],"ss")True (Any(4) i=0 (10 > 3))TrueTpl @(Any (Same 2) Id) [1,4,5]False (Any(3))FalseT!pl @(Any (Same 2) Id) [1,4,5,2,1]True (Any(5) i=3 (2 == 2))TrueTpredicate-typed similar to u/pl @(All (Between 1 8 Id) Id) [7,3,4,1,2,9,0,1]False (All(8) i=5 (9 <= 8))FalseTpz @(All Odd Id) [1,5,11,5,3]TrueTpz @(All Odd Id) []TrueT&run @'OANV @(All Even Id) [1,5,11,5,3]6False All(5) i=0 (1 == 0)|+- P Id [1,5,11,5,3]|+- False i=0: 1 == 0| || +- P 1 `mod` 2 = 1| | | | | +- P I| | | | | `- P '2| | | `- P '0|+- False i=1: 1 == 0| || +- P 5 `mod` 2 = 1| | | | | +- P I| | | | | `- P '2| | | `- P '0|+- False i=2: 1 == 0| || +- P 11 `mod` 2 = 1| | | | | +- P I| | | | | `- P '2| | | `- P '0|+- False i=3: 1 == 0| || +- P 5 `mod` 2 = 1| | | | | +- P I| | | | | `- P '2| | | `- P '0|`- False i=4: 1 == 0 | +- P 3 `mod` 2 = 1 | | | +- P I | | | `- P '2 | `- P '0FalseT,pl @(All (Gt 3) (Fst Id)) ([10,12,3,5],"ss")False (All(4) i=2 (3 > 3))FalseT"pl @(All (Lt 3) Id) [1::Int .. 10]False (All(10) i=2 (3 < 3))FalseTpredicate-typedHA operator predicate that determines if the value is between 'p' and 'q'pz @(5 <..> 8) 6TrueTpz @(10 % 4 <..> 40 % 5) 4TrueTpz @(10 % 4 <..> 40 % 5) 33FalseTpredicate-typed?A predicate that determines if the value is between 'p' and 'q'%pz @(Between 5 8 Len) [1,2,3,4,5,5,7]TrueTpl @(Between 5 8 Id) 9False (9 <= 8)FalseTFpl @(Between (Fst Id >> Fst Id) (Fst Id >> Snd Id) (Snd Id)) ((1,4),3)True (1 <= 3 <= 4)TrueTGpl @(Between (Fst Id >> Fst Id) (Fst Id >> Snd Id) (Snd Id)) ((1,4),10)False (10 <= 4)FalseTpredicate-typed(gets the singleton value from a foldablepl @(OneP Id) [10..15],Error OneP 6 elements (expected one element)FailT "OneP 6 elements"pl @(OneP Id) [10]Present 10 (OneP) PresentT 10pl @(OneP Id) []'Error OneP empty (expected one element)FailT "OneP empty"pl @(OneP Id) (Just 10)Present 10 (OneP) PresentT 10pl @(OneP Id) Nothing'Error OneP empty (expected one element)FailT "OneP empty"pl @(OneP Id) [12]Present 12 (OneP) PresentT 12pl @(OneP Id) [1..5],Error OneP 5 elements (expected one element)FailT "OneP 5 elements"pl @(OneP Id) ([] ::[()])'Error OneP empty (expected one element)FailT "OneP empty"predicate-typedEFails the computation with a message where the input value is a Proxy pz @(Ix 3 (Failp "oops")) "abcd" PresentT 'd'pz @(Ix 3 (Failp "oops")) "abc" FailT "oops"predicate-typed8Fails the computation with a message (wraps the type in )+pz @(Failt Int (PrintF "value=%03d" Id)) 99FailT "value=099"predicate-typedOFails the computation with a message for simple failures: doesnt preserve types>pz @(FailS (PrintT "value=%03d string=%s" Id)) (99,"somedata")!FailT "value=099 string=somedata"predicate-typedJFails the computation with a message but allows you to set the output type+pz @(Failt Int (PrintF "value=%03d" Id)) 99FailT "value=099"5pz @('False || (Fail 'True "failed")) (99,"somedata")FailT "failed";pz @('False || (Fail (Hole Bool) "failed")) (99,"somedata")FailT "failed"8pz @('False || (Fail (Hole _) "failed")) (99,"somedata")FailT "failed"predicate-typedv function on a booleanpz @(IdBool Id) FalseFalseTpz @(IdBool Id) TrueTrueTpz @(IdBool (Fst Id)) (True,22)TrueTpl @(IdBool (Lt 3)) 13False (IdBool (13 < 3))FalseTpredicate-typedw functionpz @(Not Id) FalseTrueTpz @(Not Id) TrueFalseTpz @(Not (Fst Id)) (True,22)FalseTpl @(Not (Lt 3)) 13True (Not (13 < 3))TrueTpl @(Not 'True) ()False (Not ('True))FalseTpredicate-typed similar to x for y instancespz @(Length Id) (Left "aa") PresentT 0pz @(Length Id) (Right "aa") PresentT 1"pz @(Length Right') (Right "abcd") PresentT 4:pz @(Length (Thd (Snd Id))) (True,(23,'x',[10,9,1,3,4,2])) PresentT 6predicate-typed similar to xpz @Len [10,4,5,12,3,4] PresentT 6 pz @Len [] PresentT 0predicate-typedused for type inferencepredicate-typedwraps a value (see z and {)pz @(Wrap (SG.Sum _) Id) (-13)PresentT (Sum {getSum = -13})pz @(Wrap SG.Any (Ge 4)) 13PresentT (Any {getAny = True})(import Data.List.NonEmpty (NonEmpty(..))3pz @(Wrap (NonEmpty _) (Uncons >> 'Just Id)) "abcd"PresentT ('a' :| "bcd")pl @(Wrap (SG.Sum _) Id) 137Present Sum {getSum = 13} (Wrap Sum {getSum = 13} | 13)PresentT (Sum {getSum = 13})*pl @(Wrap (SG.Sum _) Id >> STimes 4 Id) 13BPresent Sum {getSum = 52} ((>>) Sum {getSum = 52} | {getSum = 13})PresentT (Sum {getSum = 52})&pl @(Wrap _ 13 <> Id) (SG.Sum @Int 12)VPresent Sum {getSum = 25} (Sum {getSum = 13} <> Sum {getSum = 12} = Sum {getSum = 25})PresentT (Sum {getSum = 25})predicate-typedunwraps a value (see z)pz @(Unwrap Id) (SG.Sum (-13))PresentT (-13)+pl @(Unwrap Id >> '(Id, 'True)) (SG.Sum 13)1Present (13,True) ((>>) (13,True) | {'(13,True)})PresentT (13,True)predicate-typedflipped version of predicate-typedcompose expressions$pz @(Fst Id >> Snd Id) ((11,12),'x') PresentT 12predicate-typed1override the display width for the expression 'p'predicate-typed.run 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 999 PresentT 999"pan @(MsgI Id 999) "info message:"P info message:'999 PresentT 999predicate-typed9add a message to give more context to the evaluation tree!pan @(Msg "[somemessage]" Id) 999P [somemessage] Id 999 PresentT 999!pan @(Msg Id 999) "info message:"P info message: '999 PresentT 999predicate-typed0transparent predicate wrapper to make k of kind |6 so it can be in a promoted list (cant mix kinds) see pz @'[W 123, Id] 99PresentT [123,99]%pz @'[W "abc", W "def", Id, Id] "ghi""PresentT ["abc","def","ghi","ghi"]predicate-typedGidentity function that also displays the type information for debugging pz @IdT 23 PresentT 23predicate-typedidentity function pz @Id 23 PresentT 23predicate-typed+identity function without show instance of pz @I 23 PresentT 23predicate-typedUThis 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-typed:skips the evaluation tree and just displays the end resultpredicate-typedsame as # but adds context to the end resultpredicate-typed9displays the evaluation tree in plain text without colorspredicate-typedEdisplays the evaluation tree in plain text without colors and verbosepredicate-typedCdisplays the evaluation tree using colors without background colorspredicate-typed4displays the evaluation tree using background colorspredicate-typed and verbosepredicate-typed6display the evaluation tree using unicode and colors  pu '(Id, "abc", 123) [1..4] @predicate-typedLdisplays the evaluation tree using unicode and colors with background colorspredicate-typed and verbosepredicate-typedaevaluate a typelevel expression (use type applications to pass in the options and the expression)run @OZ @Id 123 PresentT 1234run @('OMsg "field1" ':# OL) @('Left Id) (Right 123)"field1 >>> Error 'Left found RightFailT "'Left found Right"Orun @(OptTT '[ 'OMsg "test", OU, 'OEmpty, OL, 'OMsg "field2"]) @('FailT '[]) ()(test | field2 >>> Error 'FailT _ (BoolT)FailT "'FailT _"predicate-typed.run expression with multiple options in a list2runs @'[ OL, 'OMsg "field2"] @'( 'True, 'False) ()/field2 >>> Present (True,False) ('(True,False))PresentT (True,False)Hruns @'[ 'OMsg "test", OU, 'OEmpty, OL, 'OMsg "field2"] @('FailT '[]) ()(test | field2 >>> Error 'FailT _ (BoolT)FailT "'FailT _"predicate-typedZconvenience method to evaluate two expressions using the same input and return the resultspredicate-typedbconvenience method to evaluate two boolean expressions using the same input and return the resultspredicate-typedBevaluate a boolean expressions but hide the results unless verbosepredicate-typed:evaluate a expressions but hide the results unless verbosepredicate-typed typelevel  pz @'TrueT ()TrueTpz @'FalseT ()FalseTpz @('PresentT 123) ()PresentT Falsepz @('FailT '[]) ()FailT "'FailT _"predicate-typed(converts the value to the corresponding }pz @'Proxy 'x'PresentT Proxypredicate-typedBextracts the (a,b) from type level 'These a b' if the value exists$pz @('These Id Id) (These 123 "abc")PresentT (123,"abc")%pz @('These Id 5) (These 123 "abcde")PresentT (123,5)pz @('These Id Id) (This "aaa")FailT "'These found This"pz @('These Id Id) (That "aaa")FailT "'These found That"predicate-typed@extracts the 'b' from type level 'These a b' if the value existspz @('That Id) (That 123) PresentT 123pz @('That Id) (This "aaa")FailT "'That found This"pz @('That Id) (These 44 "aaa")FailT "'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) PresentT 12pz @('This Id) (That "aaa")FailT "'This found That" pz @('This Id) (These 999 "aaa")FailT "'This found These"pl @('This Id) (That 12)Error 'This found ThatFailT "'This found That"predicate-typedAextracts the 'b' from type level 'Either a b' if the value existspl @('Right Id) (Right 123)Present 123 (Right) PresentT 123+pz @('Right Id >> Snd Id) (Right ('x',123)) PresentT 123pz @('Right Id) (Left "aaa")FailT "'Right found Left"pl @('Right Id) (Left 123)Error 'Right found LeftFailT "'Right found Left"predicate-typedAextracts the 'a' from type level 'Either a b' if the value existspz @('Left Id) (Left 123) PresentT 123$pz @('Left (Snd Id)) ('x', Left 123) PresentT 123pz @('Left Id) (Right "aaa")FailT "'Left found Right"pl @('Left Id) (Left 123)Present 123 (Left) PresentT 123pl @('Left Id) (Right 123)Error 'Left found RightFailT "'Left found Right"predicate-typedyexpects Nothing otherwise it fails if the value is Nothing then it returns 'Proxy a' as this provides type informationpz @'Nothing NothingPresentT Proxypz @'Nothing (Just True)FailT "'Nothing found Just"predicate-typedtries to extract a from Maybe a otherwise it fails: similar to +,pz @('Just Id) (Just "abc")PresentT "abc"pl @('Just Id >> Id) (Just 123)!Present 123 ((>>) 123 | {Id 123}) PresentT 123pl @('Just Id) (Just [1,2,3]).Present [1,2,3] ('Just [1,2,3] | Just [1,2,3])PresentT [1,2,3]pl @('Just Id) (Just 10)Present 10 ('Just 10 | Just 10) PresentT 10pl @('Just Id) NothingError 'Just(empty)FailT "'Just(empty)"#pz @('Just (Fst Id)) (Just 123,'x') PresentT 123predicate-typed2runs each predicate in turn from the promoted listpz @'[1, 2, 3] 999PresentT [1,2,3]pz @'[W 1, W 2, W 3, Id] 999PresentT [1,2,3,999]predicate-typed=extracts the value level representation of the type level '[] pz @'[] False PresentT []predicate-typed=extracts the value level representation of the type level '() pz @'() () PresentT ()predicate-typed:extracts the value level representation of the type level A pz @123 () PresentT 123predicate-typed8extracts the value level representation of the promoted ipz @'LT "not used" PresentT LT pz @'EQ () PresentT EQpredicate-typed(run the predicates in a promoted 8-tuple.pz @'(4, Id, "inj", 999, 'LT, 1, 2, 3) "hello"'PresentT (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"%PresentT (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"#PresentT (4,"hello","inj",999,LT,1)predicate-typed(run the predicates in a promoted 5-tuple%pz @'(4, Id, "inj", 999, 'LT) "hello"!PresentT (4,"hello","inj",999,LT)predicate-typed(run the predicates in a promoted 4-tuple pz @'(4, Id, "inj", 999) "hello"PresentT (4,"hello","inj",999)predicate-typed(run the predicates in a promoted 3-tuplepz @'(4, Id, "goodbye") "hello"PresentT (4,"hello","goodbye") pan @'( 'True, 'False, 123) TrueP '(,,)| +- True 'True|+- False 'False| `- P '123PresentT (True,False,123)predicate-typed5run the predicates in a promoted 2-tuple; similar to -.pz @'(Id, 4) "hello"PresentT ("hello",4)predicate-typedpulls the type level ~ to the value level as a (/pz @"hello world" ()PresentT "hello world"predicate-typedpulls the type level D to the value levelpz @'True "not used"TrueT pz @'False ()FalseTpredicate-typed () function pz @() "Asf" PresentT ()predicate-typedBActs as a proxy in this dsl where you can explicitly set the Type.HIt is passed around as an argument to help the type checker when needed.predicate-typedproxy for the expressionpredicate-typeddisplay optionspredicate-typedvaluepredicate-typedreturns a tree of resultsHH 1012233411None,-.7:=>?@AHIMPSUVXkLpredicate-typed'effect wrapper for the refinement valueOpredicate-typedthe constraints that P must adhere toPpredicate-typedNa simple refinement type that ensures the predicate 'p' holds for the type 'a''prtRefinedIO @OZ @(Between 10 14 Id) 13Right (Refined 13)'prtRefinedIO @OZ @(Between 10 14 Id) 99 Left FalseTDprtRefinedIO @OZ @(Last Id >> Len == 4) ["one","two","three","four"],Right (Refined ["one","two","three","four"])VprtRefinedIO @OZ @(Re "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$" Id) "141.213.1.99"Right (Refined "141.213.1.99")SprtRefinedIO @OZ @(Re "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$" Id) "141.213.1" Left FalseTprtRefinedIO @OZ @(Map (ReadP Int Id) (Resplit "\\." Id) >> Guard (PrintF "bad length: found %d" Len) (Len == 4) >> 'True) "141.213.1""Left (FailT "bad length: found 3")prtRefinedIO @OZ @(Map (ReadP Int Id) (Resplit "\\." Id) >> Guard (PrintF "bad length: found %d" Len) (Len == 4) >> GuardsN (PrintT "octet %d out of range %d" Id) 4 (Between 0 255 Id) >> 'True) "141.213.1.444"'Left (FailT "octet 3 out of range 444")prtRefinedIO @OZ @(Map (ReadP Int Id) (Resplit "\\." Id) >> Guard (PrintF "bad length: found %d" Len) (Len == 4) >> GuardsN (PrintT "octet %d out of range %d" Id) 4 (Between 0 255 Id) >> 'True) "141.213.1x34.444"Left (FailT "ReadP Int (1x34)")EprtRefinedIO @OZ @(Map ('[Id] >> ReadP Int Id) Id >> Luhn Id) "12344"Right (Refined "12344")EprtRefinedIO @OZ @(Map ('[Id] >> ReadP Int Id) Id >> Luhn Id) "12340" Left FalseT3prtRefinedIO @OZ @(Any (Prime Id) Id) [11,13,17,18]Right (Refined [11,13,17,18])3prtRefinedIO @OZ @(All (Prime Id) Id) [11,13,17,18] Left FalseTRprtRefinedIO @OZ @(Snd Id !! Fst Id >> Len > 5) (2,["abc","defghij","xyzxyazsfd"])2Right (Refined (2,["abc","defghij","xyzxyazsfd"]))SprtRefinedIO @OZ @(Snd Id !! Fst Id >> Len > 5) (27,["abc","defghij","xyzxyazsfd"])#Left (FailT "(!!) index not found")SprtRefinedIO @OZ @(Snd Id !! Fst Id >> Len <= 5) (2,["abc","defghij","xyzxyazsfd"]) Left FalseTQpredicate-typedextract the value from RefinedRpredicate-typedcreate P3 generator using a generator to restrict the valuesSpredicate-typed binary operation applied to two L values)x = newRefinedT @OAN @(Between 4 12 Id) 4)y = newRefinedT @OAN @(Between 4 12 Id) 5prtRefinedTIO (rapply (+) x y) === a ===True 4 <= 4 <= 12| +- P Id 4|+- P '4|`- P '12 === b ===True 4 <= 5 <= 12| +- P Id 5|+- P '4|`- P '12=== a `op` b ===True 4 <= 9 <= 12| +- P Id 9|+- P '4|`- P '12 Refined 9,x = newRefinedT @OAN @(Prime Id || Id < 3) 3,y = newRefinedT @OAN @(Prime Id || Id < 3) 5prtRefinedTIO (rapply (+) x y)( === a ===True True || False| +- True Prime| | | `- P Id 3|`- False 3 < 3 | +- P Id 3 | `- P '3 === b ===True True || False| +- True Prime| | | `- P Id 5|`- False 5 < 3 | +- P Id 5 | `- P '3=== a `op` b ===)False False || False | (Prime) || (8 < 3)|+- False Prime| | | `- P Id 8|`- False 8 < 3 | +- P Id 8 | `- P '3failure msg[FalseT]Tpredicate-typedsame as S except we already have valid P values as inputUpredicate-typedattempts to lift a refinement type to another refinement type by way of transformation function you can control both the predicate and the typeVpredicate-typedinvokes the callback with the P, value if 'a' is valid for the predicate 'p'Wpredicate-typedIO version of VXpredicate-typedsame as Y but prints the resultsYpredicate-typed returns a P, value if 'a' is valid for the predicate 'p')newRefined @OL @(ReadP Int Id > 99) "123"Right (Refined "123")(newRefined @OL @(ReadP Int Id > 99) "12"Left "FalseT (12 > 99)"[predicate-typedreturns a wrapper L around a possible P, value if 'a' is valid for the predicate 'p'\predicate-typedIO version of []predicate-typed unwrap the L value_predicate-typedcreate an unsafe P$ value without running the predicate`predicate-typedcreate an unsafe P! value and also run the predicateapredicate-typed instance for Pbpredicate-typed instance for PDxs <- generate (vectorOf 10 (arbitrary @(Refined OU (Id /= 0) Int)))all ((/=0) . unRefined) xsTrueExs <- generate (vectorOf 10 (arbitrary @(Refined OU (Prime Id) Int)))all (isPrime . unRefined) xsTruecpredicate-typed instance for Pdpredicate-typed instance for Pimport Data.Timeimport Control.Lensimport Control.Arrow ((+++))3type K1 = Refined OZ (ReadP Day Id >> 'True) Stringgtype K2 = Refined OAN (Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") (ReadP Day Id)) String)r = unsafeRefined' @OZ "2019-04-23" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)Refined "2019-04-23"DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)5Refined(Binary:get):FalseT (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"epredicate-typed instance for P import qualified Data.Aeson as A9A.eitherDecode' @(Refined OZ (Between 10 14 Id) Int) "13"Right (Refined 13)GremoveAnsi $ A.eitherDecode' @(Refined OAN (Between 10 14 Id) Int) "16" 9Error in $: Refined(FromJSON:parseJSON):FalseT (16 <= 14)False 16 <= 14| +- P Id 16|+- P '10|`- P '14fpredicate-typed instance for P8reads @(Refined OZ (Between 0 255 Id) Int) "Refined 254"[(Refined 254,"")]8reads @(Refined OZ (Between 0 255 Id) Int) "Refined 300"[]1reads @(Refined OZ 'True Int) "Refined (-123)xyz"[(Refined (-123),"xyz")]gpredicate-typed instance for RefinedNpureTryTest $ fromString @(Refined OL (ReadP Int Id >> Id > 244) String) "523"Right (Refined "523")MpureTryTest $ fromString @(Refined OL (ReadP Int Id >> Id > 244) String) "52"Left ()JKLMNOPQRSTUVWXYZ[\]^_`PQOLMNX^YZVW[\RU]ST_`KJNone&',-.1:=>?@AHISUVXklJ%upredicate-typedchange the opts typevpredicate-typedreplace the opts typewpredicate-typed emulates P using ? by setting the input conversion and output formatting as noops}predicate-typedZAn ADT that summarises the results of evaluating Refined3 representing all possible statespredicate-typedCtype family for converting from a 5-tuple '(opts,ip,op,fmt,i) to a  typepredicate-typed$Provides the constraints on Refined3predicate-typedLike &#H 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 00: see wSetting the input type i to (/c 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 likeHnewRefined3 @OZ @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})HnewRefined3 @OZ @(ReadBase Int 16 Id) @(Lt 253) @(PrintF "%x" Id) "00fe"/Left "Step 2. False Boolean Check(op) | FalseP"HnewRefined3 @OZ @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) "00fg">Left "Step 1. Initial Conversion(ip) Failed | invalid base 16"newRefined3 @OL @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Msg "length invalid:" (Len == 4)) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1.5"ALeft "Step 2. False Boolean Check(op) | {length invalid: 5 == 4}"newRefined3 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1.5"8Left "Step 2. Failed Boolean Check(op) | found length=5"newRefined3 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1"BRight (Refined3 {r3In = [198,162,3,1], r3Out = "198.162.003.001"}) :m + Data.Time.Calendar.WeekDatenewRefined3 @OZ @(MkDayExtra Id >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) (2019,10,13)ARight (Refined3 {r3In = (2019-10-13,41,7), r3Out = (2019,10,13)})wnewRefined3 @OL @(MkDayExtra Id >> 'Just Id) @(Msg "expected a Sunday:" (Thd Id == 7)) @(UnMkDay (Fst Id)) (2019,10,12)DLeft "Step 2. False Boolean Check(op) | {expected a Sunday: 6 == 7}"newRefined3 @OZ @(MkDayExtra' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) (2019,10,12);Left "Step 2. Failed Boolean Check(op) | expected a Sunday"ttype T4 k = '( OZ, MkDayExtra Id >> 'Just Id, Guard "expected a Sunday" (Thd Id == 7) >> 'True, UnMkDay (Fst Id), k))newRefined3P (Proxy @(T4 _)) (2019,10,12);Left "Step 2. Failed Boolean Check(op) | expected a Sunday")newRefined3P (Proxy @(T4 _)) (2019,10,13)ARight (Refined3 {r3In = (2019-10-13,41,7), r3Out = (2019,10,13)})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 E generator using a generator to restrict the values (so it completes)^g = genRefined3 @OU @(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    )Quse type application to set the 5-tuple or set the individual parameters directlyset the 5-tuple directly=eg1 = mkProxy3 @'( OL, ReadP Int Id, Gt 10, ShowP Id, String)newRefined3P eg1 "24"*Right (Refined3 {r3In = 24, r3Out = "24"})Kskip the 5-tuple and set each parameter individually using type application:eg2 = mkProxy3 @_ @OL @(ReadP Int Id) @(Gt 10) @(ShowP Id)newRefined3P eg2 "24"*Right (Refined3 {r3In = 24, r3Out = "24"})predicate-typedsame as : but checks to make sure the proxy is consistent with the  constraintpredicate-typed create a  value using a continuationThis first example reads a hex string and makes sure it is between 100 and 200 and then reads a binary string and adds the values together:set -XPolyKinds:set -XRankNTypespb16 :: forall opts . Proxy '( opts, ReadBase Int 16 Id, Between 100 200 Id, ShowBase 16 Id, String); b16 = Proxy_b2 :: forall opts . Proxy '( opts, ReadBase Int 2 Id, 'True, ShowBase 2 Id, String); b2 = ProxyyprtRefinedTIO $ withRefined3TP (b16 @OZ) "a3" $ \x -> withRefined3TP (b2 @OZ) "1001110111" $ \y -> pure (r3In x + r3In y)7947this example fails as the the hex value is out of rangeqprtRefinedTIO $ withRefined3TP (b16 @OAN) "a388" $ \x -> withRefined3TP (b2 @OAN) "1001110111" $ \y -> pure (x,y)6*** Step 1. Success Initial Conversion(ip) (41864) ***P ReadBase(Int,16) 41864|`- P Id "a388"'*** Step 2. False Boolean Check(op) ***False 41864 <= 200| +- P Id 41864| +- P '100| `- P '200=failure msg[Step 2. False Boolean Check(op) | {41864 <= 200}]predicate-typed$pure version for extracting Refined3enewRefined3 @OL @(ParseTimeP TimeOfDay "%-H:%-M:%-S" Id) @'True @(FormatTimeP "%H:%M:%S" Id) "1:15:7"6Right (Refined3 {r3In = 01:15:07, r3Out = "01:15:07"})dnewRefined3 @OL @(ParseTimeP TimeOfDay "%-H:%-M:%-S" Id) @'True @(FormatTimeP "%H:%M:%S" Id) "1:2:x"aLeft "Step 1. Initial Conversion(ip) Failed | ParseTimeP TimeOfDay (%-H:%-M:%-S) failed to parse"newRefined3 @OL @(Rescan "^(\\d{1,2}):(\\d{1,2}):(\\d{1,2})$" Id >> Snd (Head Id) >> Map (ReadP Int Id) Id) @(All (0 <..> 59) Id && Len == 3) @(PrintL 3 "%02d:%02d:%02d" Id) "1:2:3"5Right (Refined3 {r3In = [1,2,3], r3Out = "01:02:03"})predicate-typedcreate a wrapped  typeprtRefinedTIO $ newRefined3T @OZ @(MkDayExtra Id >> 'Just Id) @(GuardSimple (Thd Id == 5) >> 'True) @(UnMkDay (Fst Id)) (2019,11,1)8Refined3 {r3In = (2019-11-01,44,5), r3Out = (2019,11,1)}lprtRefinedTIO $ newRefined3T @OL @(MkDayExtra Id >> 'Just Id) @(Thd Id == 5) @(UnMkDay (Fst Id)) (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]prtRefinedTIO $ newRefined3T @OL @(MkDayExtra Id >> 'Just Id) @(Msg "wrong day:" (Thd Id == 5)) @(UnMkDay (Fst Id)) (2019,11,2)Bfailure msg[Step 2. False Boolean Check(op) | {wrong day: 6 == 5}]predicate-typedcreate a wrapped  typeprtRefinedTIO $ newRefined3TP (Proxy @'( OZ, MkDayExtra Id >> 'Just Id, GuardSimple (Thd Id == 5) >> 'True, UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,1)8Refined3 {r3In = (2019-11-01,44,5), r3Out = (2019,11,1)}prtRefinedTIO $ newRefined3TP (Proxy @'( OL, MkDayExtra Id >> 'Just Id, Thd Id == 5, UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]prtRefinedTIO $ newRefined3TP (Proxy @'( OL, MkDayExtra Id >> 'Just Id, Msg "wrong day:" (Thd Id == 5), UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,2)Bfailure msg[Step 2. False Boolean Check(op) | {wrong day: 6 == 5}]predicate-typed*wrap a Refined3 type using RefinedT and IOprtRefinedTIO $ newRefined3TIO @OL @(Hide (Rescan "(\\d+)" Id >> ConcatMap (Snd Id) Id) >> Map (ReadP Int Id) Id) @(Len > 0 && All (0 <..> 0xff) Id) @(ShowP Id) "|23|99|255|254.911."Zfailure msg[Step 2. False Boolean Check(op) | {True && False | (All(5) i=4 (911 <= 255))}]unRavelT $ newRefined3TIO @OL @(Hide (Rescan "(\\d+)" Id >> ConcatMap (Snd Id) Id) >> Map (ReadP Int Id) Id) @(Len > 0 && All (0 <..> 0xff) Id) @(ShowP Id) "|23|99|255|254.911."[(Left "Step 2. False Boolean Check(op) | {True && False | (All(5) i=4 (911 <= 255))}",[""])predicate-typedattempts to cast a wrapped  to another  with different predicatespredicate-typed*applies a binary operation to two wrapped  parameterspredicate-typedsame as ! but uses a 5-tuple proxy insteadpredicate-typedsame as  but passes in the proxypredicate-typedsame as  but runs in IOpredicate-typedsame as ] but skips the proxy and allows you to set each parameter individually using type applicationpredicate-typedLcreate a Refined3 using a 5-tuple proxy and aggregate the results on failurepredicate-typedsame as @ but can pass the parameters individually using type applicationpredicate-typed3create a Refined3 value using a 5-tuple proxy (see )use / to package all the types together as a 5-tuplepredicate-typed7creates Refined3 value but skips the initial conversionpredicate-typed similar to  but it emulates  using PVtakes a 5-tuple proxy as input but outputs the Refined value and the result separately1initial conversion using 'ip' and stores that in PTruns the boolean predicate 'op' to make sure to validate the converted value from 1..runs 'fmt' against the converted value from 1.returns both the P and the output from 3.Bif any of the above steps fail the process stops it and dumps out }predicate-typedsame as I but allows you to set the parameters individually using type applicationpredicate-typed instance for  import qualified Data.Aeson as AbA.encode (unsafeRefined3 @OZ @(ReadBase Int 16 Id) @(Between 0 255 Id) @(ShowBase 16 Id) 254 "fe")"\"fe\""4A.encode (unsafeRefined3 @OZ @Id @'True @Id 123 123)"123"predicate-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)vtype 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" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)2Refined3 {r3In = 2019-04-23, r3Out = "2019-04-23"}DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)ERefined3: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 mxs <- generate (vectorOf 10 (arbitrary @(Refined3 OU (ReadP Int Id) (1 <..> 120 && Even) (ShowP Id) String)))<all (\x -> let y = r3In x in y /= 0 && r3Out x == show y) xsTruepredicate-typed instance for  import qualified Data.Aeson as AlA.eitherDecode' @(Refined3 OZ (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe\""+Right (Refined3 {r3In = 254, r3Out = "fe"})~removeAnsi $ A.eitherDecode' @(Refined3 OAN (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe443a\""YError in $: Refined3: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 |reads @(Refined3 OZ (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined3 {r3In = 254, r3Out = \"fe\"}"*[(Refined3 {r3In = 254, r3Out = "fe"},"")]}reads @(Refined3 OZ (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined3 {r3In = 300, r3Out = \"12c\"}"[]vreads @(Refined3 OZ (ReadBase Int 16 Id) (Id < 0) (ShowBase 16 Id) String) "Refined3 {r3In = -1234, r3Out = \"-4d2\"}".[(Refined3 {r3In = -1234, r3Out = "-4d2"},"")]reads @(Refined3 OZ (Map (ReadP Int Id) (Resplit "\\." Id)) (Guard "len/=4" (Len == 4) >> 'True) (PrintL 4 "%d.%d.%d.%d" Id) String) "Refined3 {r3In = [192,168,0,1], r3Out = \"192.168.0.1\"}"=[(Refined3 {r3In = [192,168,0,1], r3Out = "192.168.0.1"},"")]predicate-typed instance for Refined3XpureTryTest $ fromString @(Refined3 OL (ReadP Int Id) (Id > 12) (ShowP Id) String) "523",Right (Refined3 {r3In = 523, r3Out = "523"})VpureTryTest $ fromString @(Refined3 OL (ReadP Int Id) (Id > 12) (ShowP Id) String) "2"Left ()1uvwxy|z{}~1xy|z{}~wvuNone&',-.1:=>?@AHISUVXkpredicate-typed?type family for converting from a 4-tuple '(opts,ip,op,i) to a  typepredicate-typedZAn ADT that summarises the results of evaluating Refined2 representing all possible statespredicate-typed$Provides the constraints on Refined2predicate-typedSRefinement 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 like6newRefined2 @OZ @(ReadBase Int 16 Id) @(Lt 255) "00fe"-Right (Refined2 {r2In = 254, r2Out = "00fe"})6newRefined2 @OZ @(ReadBase Int 16 Id) @(Lt 253) "00fe"/Left "Step 2. False Boolean Check(op) | FalseP"6newRefined2 @OZ @(ReadBase Int 16 Id) @(Lt 255) "00fg">Left "Step 1. Initial Conversion(ip) Failed | invalid base 16"lnewRefined2 @OL @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Msg "length invalid:" (Len == 4)) "198.162.3.1.5"ALeft "Step 2. False Boolean Check(op) | {length invalid: 5 == 4}"newRefined2 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) "198.162.3.1.5"8Left "Step 2. Failed Boolean Check(op) | found length=5"newRefined2 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) "198.162.3.1">Right (Refined2 {r2In = [198,162,3,1], r2Out = "198.162.3.1"}) :m + Data.Time.Calendar.WeekDatemnewRefined2 @OZ @(MkDayExtra Id >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) (2019,10,13)ARight (Refined2 {r2In = (2019-10-13,41,7), r2Out = (2019,10,13)})cnewRefined2 @OL @(MkDayExtra Id >> 'Just Id) @(Msg "expected a Sunday:" (Thd Id == 7)) (2019,10,12)DLeft "Step 2. False Boolean Check(op) | {expected a Sunday: 6 == 7}"newRefined2 @OZ @(MkDayExtra' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) (2019,10,12);Left "Step 2. Failed Boolean Check(op) | expected a Sunday"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 E generator using a generator to restrict the values (so it completes)Lg = genRefined2 @OU @(ToEnum Day Id) @(UnMkDay Id >> Snd Id == 10) arbitraryxs <- generate (vectorOf 10 g)kall (\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-typedsame as  for IOpredicate-typed create a  value using a continuationThis first example reads a hex string and makes sure it is between 100 and 200 and then reads a binary string and adds the values together:set -XPolyKindsprtRefinedTIO $ withRefined2T @OZ @(ReadBase Int 16 Id) @(Between 100 200 Id) "a3" $ \x -> withRefined2T @OZ @(ReadBase Int 2 Id) @'True "1001110111" $ \y -> pure (r2In x + r2In y)7947this example fails as the the hex value is out of rangeprtRefinedTIO $ withRefined2T @OAN @(ReadBase Int 16 Id) @(Between 100 200 Id) "a388" $ \x -> withRefined2T @OAN @(ReadBase Int 2 Id) @'True "1001110111" $ \y -> pure (x,y)6*** Step 1. Success Initial Conversion(ip) (41864) ***P ReadBase(Int,16) 41864|`- P Id "a388"'*** Step 2. False Boolean Check(op) ***False 41864 <= 200| +- P Id 41864| +- P '100| `- P '200=failure msg[Step 2. False Boolean Check(op) | {41864 <= 200}]predicate-typed$pure version for extracting Refined2newRefined2 @OL @Id @'True 22(Right (Refined2 {r2In = 22, r2Out = 22})newRefined2 @OL @(ReadP UTCTime Id) @(Between (MkDay '(2020,5,2)) (MkDay '(2020,5,7)) (MkJust (ToDay Id))) "2020-05-04 12:13:14Z"QRight (Refined2 {r2In = 2020-05-04 12:13:14 UTC, r2Out = "2020-05-04 12:13:14Z"})newRefined2 @OL @(ReadP UTCTime Id) @(Between (MkDay '(2020,5,2)) (MkDay '(2020,5,7)) (MkJust (ToDay Id))) "2020-05-08 12:13:14Z"MLeft "Step 2. False Boolean Check(op) | {Just 2020-05-08 <= Just 2020-05-07}"predicate-typedcreate a wrapped  typeXprtRefinedTIO $ newRefined2T @OL @(MkDayExtra Id >> 'Just Id) @(Thd Id == 5) (2019,11,1)8Refined2 {r2In = (2019-11-01,44,5), r2Out = (2019,11,1)}XprtRefinedTIO $ newRefined2T @OL @(MkDayExtra Id >> 'Just Id) @(Thd Id == 5) (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]kprtRefinedTIO $ newRefined2T @OL @(MkDayExtra Id >> 'Just Id) @(Msg "wrong day:" (Thd Id == 5)) (2019,11,2)Bfailure msg[Step 2. False Boolean Check(op) | {wrong day: 6 == 5}]prtRefinedTIO $ newRefined2TIO @OL @(Hide (Rescan "(\\d+)" Id >> ConcatMap (Snd Id) Id) >> Map (ReadP Int Id) Id) @(Len > 0 && All (0 <..> 0xff) Id) "|23|99|255|254.911."Zfailure msg[Step 2. False Boolean Check(op) | {True && False | (All(5) i=4 (911 <= 255))}]predicate-typedcreate a wrapped  type with an explicit proxypredicate-typedcreate a wrapped  type in IOpredicate-typedsame as / without a proxy for used with TypeApplicationspredicate-typedsame as  but runs in IOpredicate-typedcreates a 4-tuple proxy (see    )Quse type application to set the 4-tuple or set the individual parameters directlyset the 4-tuple directly3eg1 = mkProxy2 @'( OL, ReadP Int Id, Gt 10, String)newRefined2P eg1 "24"*Right (Refined2 {r2In = 24, r2Out = "24"})Kskip the 4-tuple and set each parameter individually using type application.eg2 = mkProxy2 @_ @OL @(ReadP Int Id) @(Gt 10)newRefined2P eg2 "24"*Right (Refined2 {r2In = 24, r2Out = "24"})predicate-typedsame as : but checks to make sure the proxy is consistent with the  constraintpredicate-typed instance for  import qualified Data.Aeson as APA.encode (unsafeRefined2 @OZ @(ReadBase Int 16 Id) @(Between 0 255 Id) 254 "fe")"\"fe\""5A.encode (unsafeRefined2 @OZ @Id @'True @Int 123 123)"123"predicate-typed instance for predicate-typed instance for import Control.Arrow ((+++))import Data.Time2type K1 = Refined2 OAN (ReadP Day Id) 'True Stringktype K2 = Refined2 OAN (ReadP Day Id) (Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") Id) String&r = unsafeRefined2' "2019-04-23" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)2Refined2 {r2In = 2019-04-23, r2Out = "2019-04-23"}DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)ERefined2: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.WeekDatenxs <- generate (vectorOf 10 (arbitrary @(Refined2 OU (ToEnum Day Id) (Snd (ToWeekDate Id) == "Tuesday") Int)))Zall (\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 A[A.eitherDecode' @(Refined2 OZ (ReadBase Int 16 Id) (Id > 10 && Id < 256) String) "\"00fe\""-Right (Refined2 {r2In = 254, r2Out = "00fe"})mremoveAnsi $ A.eitherDecode' @(Refined2 OAN (ReadBase Int 16 Id) (Id > 10 && Id < 256) String) "\"00fe443a\""YError in $: Refined2: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 kreads @(Refined2 OZ (ReadBase Int 16 Id) (Between 0 255 Id) String) "Refined2 {r2In = 254, r2Out = \"fe\"}"*[(Refined2 {r2In = 254, r2Out = "fe"},"")]lreads @(Refined2 OZ (ReadBase Int 16 Id) (Between 0 255 Id) String) "Refined2 {r2In = 300, r2Out = \"12c\"}"[]ereads @(Refined2 OZ (ReadBase Int 16 Id) (Id < 0) String) "Refined2 {r2In = -1234, r2Out = \"-4d2\"}".[(Refined2 {r2In = -1234, r2Out = "-4d2"},"")]reads @(Refined2 OZ (Map (ReadP Int Id) (Resplit "\\." Id)) (Guard "len/=4" (Len == 4) >> 'True) String) "Refined2 {r2In = [192,168,0,1], r2Out = \"192.168.0.1\"}"=[(Refined2 {r2In = [192,168,0,1], r2Out = "192.168.0.1"},"")]predicate-typed instance for Refined2MpureTryTest $ fromString @(Refined2 OL (ReadP Int Id) (Id > 12) String) "523",Right (Refined2 {r2In = 523, r2Out = "523"})KpureTryTest $ fromString @(Refined2 OL (ReadP Int Id) (Id > 12) String) "2"Left ()((None&',-.1:=>?@AHISUVXk#predicate-typedchange the opts typepredicate-typedreplace the opts typepredicate-typed emulates P using ? by setting the input conversion and output formatting as noopspredicate-typedZAn ADT that summarises the results of evaluating Refined1 representing all possible statespredicate-typed>type family for converting from a 5-tuple '(ip,op,fmt,i) to a  typepredicate-typed$Provides the constraints on Refined1predicate-typedFRefinement type that differentiates the input from output: similar to "- but only creates the output value as needed.opts 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, (not stored anywhere but created on demand)i is the input typePP fmt (PP ip i)& should be valid as input for Refined1Setting ip to Id and fmt to Id makes it equivalent to 00: see Setting the input type i to (/c 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- (does not store the formatted result unlike ")]Although a common scenario is String as input, you are free to choose any input type you likeHnewRefined1 @OZ @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) "00fe"Right (Refined1 254)HnewRefined1 @OZ @(ReadBase Int 16 Id) @(Lt 253) @(PrintF "%x" Id) "00fe"/Left "Step 2. False Boolean Check(op) | FalseP"HnewRefined1 @OZ @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) "00fg">Left "Step 1. Initial Conversion(ip) Failed | invalid base 16"newRefined1 @OL @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Msg "length invalid:" (Len == 4)) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1.5"ALeft "Step 2. False Boolean Check(op) | {length invalid: 5 == 4}"newRefined1 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1.5"8Left "Step 2. Failed Boolean Check(op) | found length=5"newRefined1 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1"Right (Refined1 [198,162,3,1]) :m + Data.Time.Calendar.WeekDatenewRefined1 @OZ @(MkDayExtra Id >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) (2019,10,13)"Right (Refined1 (2019-10-13,41,7))wnewRefined1 @OL @(MkDayExtra Id >> 'Just Id) @(Msg "expected a Sunday:" (Thd Id == 7)) @(UnMkDay (Fst Id)) (2019,10,12)DLeft "Step 2. False Boolean Check(op) | {expected a Sunday: 6 == 7}"newRefined1 @OZ @(MkDayExtra' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) (2019,10,12);Left "Step 2. Failed Boolean Check(op) | expected a Sunday"ttype T4 k = '( OZ, MkDayExtra Id >> 'Just Id, Guard "expected a Sunday" (Thd Id == 7) >> 'True, UnMkDay (Fst Id), k))newRefined1P (Proxy @(T4 _)) (2019,10,12);Left "Step 2. Failed Boolean Check(op) | expected a Sunday")newRefined1P (Proxy @(T4 _)) (2019,10,13)"Right (Refined1 (2019-10-13,41,7))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^g = genRefined1 @OU @(ReadP Int Id) @(Between 10 100 Id && Even) @(ShowP Id) (choose (10,100))xs <- generate (vectorOf 10 g)Call (\x -> let y = unRefined1 x in y >= 0 && y <= 100 && even y) xsTruepredicate-typed create a  generator with a Proxypredicate-typedcreates a 5-tuple proxy (see    )Quse type application to set the 5-tuple or set the individual parameters directlyset the 5-tuple directly=eg1 = mkProxy1 @'( OL, ReadP Int Id, Gt 10, ShowP Id, String)newRefined1P eg1 "24"Right (Refined1 24)Kskip the 5-tuple and set each parameter individually using type application:eg2 = mkProxy1 @_ @OL @(ReadP Int Id) @(Gt 10) @(ShowP Id)newRefined1P eg2 "24"Right (Refined1 24)predicate-typedsame as : but checks to make sure the proxy is consistent with the  constraintpredicate-typed create a  value using a continuationThis first example reads a hex string and makes sure it is between 100 and 200 and then reads a binary string and adds the values together:set -XPolyKinds:set -XRankNTypespb16 :: forall opts . Proxy '( opts, ReadBase Int 16 Id, Between 100 200 Id, ShowBase 16 Id, String); b16 = Proxy_b2 :: forall opts . Proxy '( opts, ReadBase Int 2 Id, 'True, ShowBase 2 Id, String); b2 = ProxyprtRefinedTIO $ withRefined1TP (b16 @OZ) "a3" $ \x -> withRefined1TP (b2 @OZ) "1001110111" $ \y -> pure (unRefined1 x + unRefined1 y)7947this example fails as the the hex value is out of rangeqprtRefinedTIO $ withRefined1TP (b16 @OAN) "a388" $ \x -> withRefined1TP (b2 @OAN) "1001110111" $ \y -> pure (x,y)6*** Step 1. Success Initial Conversion(ip) (41864) ***P ReadBase(Int,16) 41864|`- P Id "a388"'*** Step 2. False Boolean Check(op) ***False 41864 <= 200| +- P Id 41864| +- P '100| `- P '200=failure msg[Step 2. False Boolean Check(op) | {41864 <= 200}]predicate-typed$pure version for extracting Refined1enewRefined1 @OL @(ParseTimeP TimeOfDay "%-H:%-M:%-S" Id) @'True @(FormatTimeP "%H:%M:%S" Id) "1:15:7"Right (Refined1 01:15:07)dnewRefined1 @OL @(ParseTimeP TimeOfDay "%-H:%-M:%-S" Id) @'True @(FormatTimeP "%H:%M:%S" Id) "1:2:x"aLeft "Step 1. Initial Conversion(ip) Failed | ParseTimeP TimeOfDay (%-H:%-M:%-S) failed to parse"newRefined1 @OL @(Rescan "^(\\d{1,2}):(\\d{1,2}):(\\d{1,2})$" Id >> Snd (Head Id) >> Map (ReadP Int Id) Id) @(All (0 <..> 59) Id && Len == 3) @(PrintL 3 "%02d:%02d:%02d" Id) "1:2:3"Right (Refined1 [1,2,3])predicate-typedcreate a wrapped  typeprtRefinedTIO $ newRefined1TP (Proxy @'( OZ, MkDayExtra Id >> 'Just Id, GuardSimple (Thd Id == 5) >> 'True, UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,1)Refined1 (2019-11-01,44,5)prtRefinedTIO $ newRefined1TP (Proxy @'( OL, MkDayExtra Id >> 'Just Id, Thd Id == 5, UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]prtRefinedTIO $ newRefined1TP (Proxy @'( OL, MkDayExtra Id >> 'Just Id, Msg "wrong day:" (Thd Id == 5), UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,2)Bfailure msg[Step 2. False Boolean Check(op) | {wrong day: 6 == 5}]predicate-typedattempts to cast a wrapped  to another  with different predicates predicate-typed*applies a binary operation to two wrapped  parameters predicate-typedsame as  ! but uses a 5-tuple proxy instead predicate-typedsame as   but passes in the proxy predicate-typedsame as  but runs in IO predicate-typedsame as ] but skips the proxy and allows you to set each parameter individually using type applicationpredicate-typedLcreate a Refined1 using a 5-tuple proxy and aggregate the results on failurepredicate-typed3create a Refined1 value using a 5-tuple proxy (see )use / to package all the types together as a 5-tuplepredicate-typedsame as @ but can pass the parameters individually using type applicationpredicate-typed7creates Refined1 value but skips the initial conversionpredicate-typed similar to  but it emulates  but using PVtakes a 5-tuple proxy as input but outputs the Refined value and the result separately1initial conversion using 'ip' and stores that in PTruns the boolean predicate 'op' to make sure to validate the converted value from 1..runs 'fmt' against the converted value from 1.returns both the P and the output from 3.Bif any of the above steps fail the process stops it and dumps out predicate-typedsame as I but allows you to set the parameters individually using type applicationpredicate-typed instance for  import qualified Data.Aeson as A]A.encode (unsafeRefined1 @OZ @(ReadBase Int 16 Id) @(Between 0 255 Id) @(ShowBase 16 Id) 254)"\"fe\""0A.encode (unsafeRefined1 @OZ @Id @'True @Id 123)"123"predicate-typed instance for predicate-typed instance for import Control.Arrow ((+++))import Control.Lensimport Data.Time?type K1 = MakeR1 '( OAN, ReadP Day Id, 'True, ShowP Id, String)vtype K2 = MakeR1 '( OAN, ReadP Day Id, Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") Id, ShowP Id, String)&r = unsafeRefined1' "2019-04-23" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)Refined1 2019-04-23DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)ERefined1: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 mxs <- generate (vectorOf 10 (arbitrary @(Refined1 OU (ReadP Int Id) (1 <..> 120 && Even) (ShowP Id) String)))all ((/=0) . unRefined1) xsTrueLxs <- generate (vectorOf 10 (arbitrary @(Refined1 OU Id (Prime Id) Id Int)))all (isPrime . unRefined1) xsTruepredicate-typed instance for  import qualified Data.Aeson as AlA.eitherDecode' @(Refined1 OZ (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe\""Right (Refined1 254)~removeAnsi $ A.eitherDecode' @(Refined1 OAN (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe443a\""YError in $: Refined1: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 creads @(Refined1 OZ (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined1 254"[(Refined1 254,"")]creads @(Refined1 OZ (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined1 300"[]]reads @(Refined1 OZ (ReadBase Int 16 Id) (Id < 0) (ShowBase 16 Id) String) "Refined1 (-1234)"[(Refined1 (-1234),"")]reads @(Refined1 OZ (Map (ReadP Int Id) (Resplit "\\." Id)) (Guard "len/=4" (Len == 4) >> 'True) (PrintL 4 "%d.%d.%d.%d" Id) String) "Refined1 [192,168,0,1]"[(Refined1 [192,168,0,1],"")]9reads @(Refined1 OZ Id 'True Id Int) "Refined1 (-123)xyz"[(Refined1 (-123),"xyz")]predicate-typed instance for Refined1XpureTryTest $ fromString @(Refined1 OL (ReadP Int Id) (Id > 12) (ShowP Id) String) "523"Right (Refined1 523)VpureTryTest $ fromString @(Refined1 OL (ReadP Int Id) (Id > 12) (ShowP Id) String) "2"Left ().     .     None&',-.=>?@AHSUVXk؁ #predicate-typedOapplies '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)TrueT'pl @(Sum > 44 |+ Id < 2) ([5,6,7,14],9)1False (False (|+) False | (32 > 44) (|+) (9 < 2))FalseT'pl @(Sum > 44 |+ Id < 2) ([5,6,7,14],1)True (False (|+) True)TrueT$predicate-typedOapplies 'p' to lhs of the tuple and 'q' to the rhs and then 'Ors' them together!pl @(OrA (Gt 3) (Lt 10) Id) (1,2)True (False (|+) True)TrueT%predicate-typedPapplies '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)})FalseT&predicate-typedPapplies 'p' to lhs of the tuple and 'q' to the rhs and then 'Ands' them together"pl @(AndA (Gt 3) (Lt 10) Id) (1,2)!False (False (&*) True | (1 > 3))FalseT'predicate-typedBapplies a function against the second part of a tuple: similar to -1!pz @(Second (Succ Id)) (12,False)PresentT (12,True)(predicate-typedAapplies a function against the first part of a tuple: similar to -2pz @(First (Succ Id)) (12,True)PresentT (13,True))predicate-typed similar to -3%pz @(Pred Id *** ShowP Id) (13, True)PresentT (12,"True")+pl @(FlipT (***) Len (Id * 12)) (99,"cdef")/Present (1188,4) ((***) (1188,4) | (99,"cdef"))PresentT (1188,4),pl @(4 *** "sadf" *** 'LT) ('x',("abv",[1]))CPresent (4,("sadf",LT)) ((***) (4,("sadf",LT)) | ('x',("abv",[1])))PresentT (4,("sadf",LT))*predicate-typed similar to -.9pl @(Min &&& Max >> Id >> Fst Id < Snd Id) [10,4,2,12,14]True ((>>) True | {2 < 14})TrueT'pl @((123 &&& Id) >> Fst Id + Snd Id) 4(Present 127 ((>>) 127 | {123 + 4 = 127}) PresentT 127pl @(4 &&& "sadf" &&& 'LT) (),Present (4,("sadf",LT)) (W '(4,("sadf",LT)))PresentT (4,("sadf",LT))!pl @(Id &&& '() &&& ()) (Just 10)0Present (Just 10,((),())) (W '(Just 10,((),())))PresentT (Just 10,((),()))6pl @(Fst Id &&& Snd Id &&& Thd Id &&& ()) (1,'x',True)4Present (1,('x',(True,()))) (W '(1,('x',(True,()))))PresentT (1,('x',(True,())))6pl @(Fst Id &&& Snd Id &&& Thd Id &&& ()) (1,'x',True)4Present (1,('x',(True,()))) (W '(1,('x',(True,()))))PresentT (1,('x',(True,())))7pl @(Fst Id &&& Snd Id &&& Thd Id &&& ()) (1,1.4,"aaa")6Present (1,(1.4,("aaa",()))) (W '(1,(1.4,("aaa",()))))PresentT (1,(1.4,("aaa",())))+predicate-typedNcreates a list of overlapping pairs of elements. requires two or more elementspz @Pairs [1,2,3,4]PresentT [(1,2),(2,3),(3,4)] pz @Pairs []FailT "Pairs no data found" pz @Pairs [1]$FailT "Pairs only one element found"pl @Pairs ([] :: [()])/Error Pairs no data found (Pairs no data found)FailT "Pairs no data found" pl @Pairs [1]AError Pairs only one element found (Pairs only one element found)$FailT "Pairs only one element found"pl @Pairs [1,2]'Present [(1,2)] (Pairs [(1,2)] | [1,2])PresentT [(1,2)]pl @Pairs [1,2,3]5Present [(1,2),(2,3)] (Pairs [(1,2),(2,3)] | [1,2,3])PresentT [(1,2),(2,3)]pl @Pairs [1,2,3,4]CPresent [(1,2),(2,3),(3,4)] (Pairs [(1,2),(2,3),(3,4)] | [1,2,3,4])PresentT [(1,2),(2,3),(3,4)],predicate-typedduplicate a value into a tuple pl @Dup 4Present (4,4) (W '(4,4))PresentT (4,4)pl @(Dup >> Id) 4'Present (4,4) ((>>) (4,4) | {Id (4,4)})PresentT (4,4)"pl @(Dup << Fst Id * Snd Id) (4,5)-Present (20,20) ((>>) (20,20) | {W '(20,20)})PresentT (20,20)"pl @(Fst Id * Snd Id >> Dup) (4,5)-Present (20,20) ((>>) (20,20) | {W '(20,20)})PresentT (20,20) #$%&'()*+, ,('*)+&%$##3%3)3*3 None&',-.=>?@AHSUVXk7predicate-typed%tries to extract the values from the E constructor.pz @(These' >> Second (Succ Id)) (These 1 'a')PresentT (1,'b')!pz @(That' >> Succ Id) (This 'a')FailT "That' found This")pz @(These' >> Second (Succ Id)) (That 8)FailT "These' found That"8predicate-typed"tries to extract a value from the  constructor pz @(That' >> Succ Id) (That 20) PresentT 21!pz @(That' >> Succ Id) (This 'a')FailT "That' found This"9predicate-typed"tries to extract a value from the  constructor pz @(This' >> Succ Id) (This 20) PresentT 21!pz @(This' >> Succ Id) (That 'a')FailT "This' found That":predicate-typedunassoc using "pz @Unassoc (These 123 (This 'x'))PresentT (This (These 123 'x'))pz @Unassoc (99,('a',True))PresentT ((99,'a'),True)2pz @Unassoc (This 10 :: These Int (These Bool ()))PresentT (This (This 10))pz @Unassoc (Right (Right 123))PresentT (Right 123):pz @Unassoc (Left 'x' :: Either Char (Either Bool Double))PresentT (Left (Left 'x'))pl @Unassoc (10,('c',True))CPresent ((10,'c'),True) (Unassoc ((10,'c'),True) | (10,('c',True)))PresentT ((10,'c'),True);predicate-typed assoc using  pz @Assoc (This (These 123 'x'))PresentT (These 123 (This 'x'))pz @Assoc ((99,'a'),True)PresentT (99,('a',True))pz @Assoc ((99,'a'),True)PresentT (99,('a',True))7pz @Assoc (Right "Abc" :: Either (Either () ()) String)PresentT (Right (Right "Abc"))pz @Assoc (Left (Left 'x'))PresentT (Left 'x')pl @Assoc ((10,'c'),True)APresent (10,('c',True)) (Assoc (10,('c',True)) | ((10,'c'),True))PresentT (10,('c',True))&pl @(Assoc >> Unassoc) ((10,'c'),True)\Present ((10,'c'),True) ((>>) ((10,'c'),True) | {Unassoc ((10,'c'),True) | (10,('c',True))})PresentT ((10,'c'),True)<predicate-typedextract the These value from a E otherwise fail with a messageBif there is no These value then p is passed the whole context only,pz @(TheseFail "oops" Id) (These "abc" 20.4)PresentT ("abc",20.4)%pz @(TheseFail "oops" Id) (That "aa") FailT "oops"\pz @(TheseFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,That "xy")!FailT "found That \"xy\" fst=123")pz @(TheseFail (MEmptyT _) Id) (That 222)FailT ""=predicate-typedextract the That value from a E otherwise fail with a messageAif there is no That value then p is passed the whole context only$pz @(ThatFail "oops" Id) (That 20.4) PresentT 20.4$pz @(ThatFail "oops" Id) (This "aa") FailT "oops"[pz @(ThatFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,This "xy")!FailT "found This \"xy\" fst=123"(pz @(ThatFail (MEmptyT _) Id) (This 222)FailT "">predicate-typedextract the This value from a E otherwise fail with a messageAif there is no This value then p is passed the whole context only$pz @(ThisFail "oops" Id) (This 20.4) PresentT 20.4$pz @(ThisFail "oops" Id) (That "aa") FailT "oops"[pz @(ThisFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,That "xy")!FailT "found That \"xy\" fst=123"(pz @(ThisFail (MEmptyT _) Id) (That 222)FailT ""*pl @(ThisFail "sdf" Id) (This (SG.Sum 12)) Present Sum {getSum = 12} (This)PresentT (Sum {getSum = 12})*pl @(ThisFail "sdf" Id) (That (SG.Sum 12))Error sdf (ThisFail That) FailT "sdf"!pl @(ThisFail "sdf" Id) (That 12)Error sdf (ThisFail That) FailT "sdf"?predicate-typed extract the These value from an E otherwise use the default valueBif there is no These value then p is passed the whole context only0pz @(TheseDef '(1 % 4,"zz") Id) (These 20.4 "x")PresentT (102 % 5,"x")+pz @(TheseDef '(1 % 4,"zz") Id) (This 20.4)PresentT (1 % 4,"zz")*pz @(TheseDef '(1 % 4,"zz") Id) (That "x")PresentT (1 % 4,"zz")apz @(TheseDef '(PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id),999) (Snd Id)) (123,This "xy")*PresentT ("found This \"xy\" fst=123",999)9pz @(TheseDef (MEmptyT (SG.Sum _, String)) Id) (This 222)PresentT (Sum {getSum = 0},"")>pz @(TheseDef (MEmptyT _) Id) (These (222 :: SG.Sum Int) "aa")"PresentT (Sum {getSum = 222},"aa")-pl @(TheseDef '("xyz",'True) Id) (This "abc")$Present ("xyz",True) (TheseDef This)PresentT ("xyz",True)-pl @(TheseDef '("xyz",'True) Id) (That False)$Present ("xyz",True) (TheseDef That)PresentT ("xyz",True)4pl @(TheseDef '("xyz",'True) Id) (These "abc" False)&Present ("abc",False) (TheseDef These)PresentT ("abc",False)@predicate-typedextract the That value from an E otherwise use the default valueAif there is no That value then p is passed the whole context only$pz @(ThatDef (1 % 4) Id) (That 20.4)PresentT (102 % 5)$pz @(ThatDef (1 % 4) Id) (This "aa")PresentT (1 % 4))pz @(ThatDef (1 % 4) Id) (These "aa" 2.3)PresentT (1 % 4)[pz @(ThatDef (PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id)) (Snd Id)) (123,This "xy")$PresentT "found This \"xy\" fst=123"'pz @(ThatDef (MEmptyT _) Id) (This 222) PresentT ()6pz @(ThatDef (MEmptyT (SG.Sum _)) Id) (These 'x' 1120)PresentT (Sum {getSum = 0})Apredicate-typedextract the This value from an E otherwise use the default valueAif there is no This value then p is passed the whole context only$pz @(ThisDef (1 % 4) Id) (This 20.4)PresentT (102 % 5)$pz @(ThisDef (1 % 4) Id) (That "aa")PresentT (1 % 4))pz @(ThisDef (1 % 4) Id) (These 2.3 "aa")PresentT (1 % 4)[pz @(ThisDef (PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id)) (Snd Id)) (123,That "xy")$PresentT "found That \"xy\" fst=123"'pz @(ThisDef (MEmptyT _) Id) (That 222) PresentT ()5pz @(ThisDef (MEmptyT (SG.Sum _)) Id) (These 222 'x')PresentT (Sum {getSum = 0})/pl @(ThisDef (MEmptyT _) Id) (This (SG.Sum 12))(Present Sum {getSum = 12} (ThisDef This)PresentT (Sum {getSum = 12})&pl @(ThisDef (MEmptyT _) Id) (That 12)Present () (ThisDef That) PresentT ()Bpredicate-typed similar to 45 thats pads with  or & if one list is shorter than the other>the key is that all information about both lists are preserved0pz @(ZipThese (Fst Id) (Snd Id)) ("aBc", [1..5])<PresentT [These 'a' 1,These 'B' 2,These 'c' 3,That 4,That 5]3pz @(ZipThese (Fst Id) (Snd Id)) ("aBcDeF", [1..3])IPresentT [These 'a' 1,These 'B' 2,These 'c' 3,This 'D',This 'e',This 'F']"pz @(ZipThese Id Reverse) "aBcDeF"^PresentT [These 'a' 'F',These 'B' 'e',These 'c' 'D',These 'D' 'c',These 'e' 'B',These 'F' 'a']pz @(ZipThese Id '[]) "aBcDeF"@PresentT [This 'a',This 'B',This 'c',This 'D',This 'e',This 'F']pz @(ZipThese '[] Id) "aBcDeF"@PresentT [That 'a',That 'B',That 'c',That 'D',That 'e',That 'F']pz @(ZipThese '[] '[]) "aBcDeF" PresentT [][pl @(ZipThese (Fst Id) (Snd Id) >> Map (TheseIn Id Id (Fst Id)) Id) (['w'..'y'],['a'..'f'])zPresent "wxydef" ((>>) "wxydef" | {Map "wxydef" | [These 'w' 'a',These 'x' 'b',These 'y' 'c',That 'd',That 'e',That 'f']})PresentT "wxydef"mpl @(("sdf" &&& Id) >> ZipThese (Fst Id) (Snd Id) >> Map (TheseIn (Id &&& 0) (Head "x" &&& Id) 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]})2PresentT [('s',1),('d',2),('f',3),('x',4),('x',5)]Cpredicate-typedjTheseId: returns a tuple so you need to provide a value for rhs in the This case and lhs for the That case&pl @(TheseId 'True "xyz") (This "abc")8Present ("abc",True) (TheseIn ("abc",True) | This "abc")PresentT ("abc",True)&pl @(TheseId 'True "xyz") (That False):Present ("xyz",False) (TheseIn ("xyz",False) | That False)PresentT ("xyz",False)-pl @(TheseId 'True "xyz") (These "abc" False)APresent ("abc",False) (TheseIn ("abc",False) | These "abc" False)PresentT ("abc",False)Dpredicate-typed similar to 679pz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (This 13) PresentT 13Npz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (That "this is a long string") PresentT 21Epz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (These 20 "somedata") PresentT 28pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (That "this is a long string")(PresentT (Right "this is a long string")pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (These 1 "this is a long string")(PresentT (Right "this is a long string")pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (These 100 "this is a long string")PresentT (Left 100)6pl @(TheseIn "this" "that" "these") (This (SG.Sum 12))8Present "this" (TheseIn "this" | This Sum {getSum = 12})PresentT "this"Apl @(TheseIn (Id &&& 999) ("no value" &&& Id) Id) (These "Ab" 13)5Present ("Ab",13) (TheseIn ("Ab",13) | These "Ab" 13)PresentT ("Ab",13)=pl @(TheseIn (Id &&& 999) ("no value" &&& Id) Id) (This "Ab")3Present ("Ab",999) (TheseIn ("Ab",999) | This "Ab")PresentT ("Ab",999);pl @(TheseIn (Id &&& 999) ("no value" &&& Id) Id) (That 13);Present ("no value",13) (TheseIn ("no value",13) | That 13)PresentT ("no value",13)predicate-typed predicate on Epz @(IsThis Id) (This "aBc")TrueTpz @(IsThis Id) (These 1 'a')FalseTpz @(IsThese Id) (These 1 'a')TrueTpl @(IsThat Id) (This 12)False (IsThat | This 12)FalseTpl @(IsThis Id) (This 12)True (IsThis | This 12)TrueTpl @(IsThese Id) (This 12)False (IsThese | This 12)FalseTpl @(IsThese Id) (These 'x' 12)True (IsThese | These 'x' 12)TrueT#pl @(IsThese Id) (That (SG.Sum 12))*False (IsThese | That (Sum {getSum = 12}))FalseT&pl @(IsThese Id) (These 1 (SG.Sum 12)),True (IsThese | These 1 (Sum {getSum = 12}))TrueTHpredicate-typedE constructor(pz @(MkThese (Fst Id) (Snd Id)) (44,'x')PresentT (These 44 'x')pl @(MkThese Id 'True) 'x'/Present These 'x' True (MkThese These 'x' True)PresentT (These 'x' True)Jpredicate-typed constructorpz @(MkThat _ Id) 44PresentT (That 44)Apz @(MkThat _ "Abc" <> MkThis _ '[1,2] <> MkThese [3,4] "def") ()#PresentT (These [1,2,3,4] "Abcdef")pl @(MkThat () Id) 'x'"Present That 'x' (MkThat That 'x')PresentT (That 'x')Kpredicate-typed constructorpl @(MkThis () Id) 'x'"Present This 'x' (MkThis This 'x')PresentT (This 'x')#pl @(MkThis () (Fst Id)) ('x',True)"Present This 'x' (MkThis This 'x')PresentT (This 'x')Lpredicate-typed constructorpz @(MkThis _ Id) 44PresentT (This 44)(pz @(Proxy Int >> MkThis' Unproxy 10) []PresentT (This 10)Mpredicate-typed similar to 68` but additionally provides 'p', 'q' and 'r' the original input as the first element in the tuplebpz @(TheseX ((Fst (Fst Id) + Snd Id) >> ShowP Id) (ShowP Id) (Snd (Snd Id)) (Snd Id)) (9,This 123)PresentT "132"Lpz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (This 123)PresentT (123,"fromthis")Spz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (That "fromthat")PresentT (-99,"fromthat")Ypz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (These 123 "fromthese")PresentT (123,"fromthese")spl @(TheseX (PrintF "a=%d" (Succ (Snd Id))) ("b=" <> Snd Id) (PrintT "a=%d b=%s" (Snd Id)) Id) (These @Int 9 "rhs")#Present "a=9 b=rhs" (TheseX(These))PresentT "a=9 b=rhs"lpl @(TheseX (PrintF "a=%d" (Succ (Snd Id))) ("b=" <> Snd Id) (PrintT "a=%d b=%s" (Snd Id)) Id) (This @Int 9)Present "a=10" (TheseX(This))PresentT "a=10"ppl @(TheseX (PrintF "a=%d" (Succ (Snd Id))) ("b=" <> Snd Id) (PrintT "a=%d b=%s" (Snd Id)) Id) (That @Int "rhs")Present "b=rhs" (TheseX(That))PresentT "b=rhs"Npredicate-typed similar to -pz @(ZipThese Id (Tail Id) >> Theres) [1..10]PresentT [2,3,4,5,6,7,8,9,10]Opredicate-typed similar to ,pz @(ZipThese Id (Tail Id) >> Heres) [1..10]PresentT [1,2,3,4,5,6,7,8,9,10]Ppredicate-typed similar to -pz @(ZipThese Id (Tail Id) >> Theses) [1..10]APresentT [(1,2),(2,3),(3,4),(4,5),(5,6),(6,7),(7,8),(8,9),(9,10)]Qpredicate-typed similar to 7pl @Thats [This 1, This 10,That 'x', This 99, That 'y']-Present "xy" (Snd "xy" | ([1,10,99],"xy",[])) PresentT "xy"Rpredicate-typed similar to >pz @(Thiss) [That 1, This 'a', These 'b' 33, This 'd', That 4] PresentT "ad",pz @(Thiss) [That 1, This 'a', These 'b' 33] PresentT "a"(pz @(Thiss) [That 1, That 9, These 1 33] PresentT []Spredicate-typed similar to ,. returns a 3-tuple with the results so use    to extractZpz @PartitionThese [This 'a', That 2, This 'c', These 'z' 1, That 4, These 'a' 2, That 99]*PresentT ("ac",[2,4,99],[('z',1),('a',2)])Qpl @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'])(PresentT ([4,99],"xy",[(3,'b'),(5,'x')])Tpl @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'])*PresentT ([1,4,10],"xy",[(9,'z'),(8,'y')])789:;<=>?@ABCDEFGHIJKLMNOPQRSGFEKLIJH987A>@=?<RQPNODCSMB;: None%&',-.=>?@AHSUVXkupredicate-typed> function where you need to provide the type 't' of the result&pz @(FromString (Identity _) Id) "abc"PresentT (Identity "abc")(pz @(FromString (Seq.Seq Char) Id) "abc"PresentT (fromList "abc")vpredicate-typed> function where you need to provide the type 't' of the resultwpredicate-typed"very simple conversion to a stringxpredicate-typedsimilar to case insensitive  for stringsypredicate-typedsimilar to case insensitive  for stringspl @(IsInfixI "aB" Id) "xyzAbw"True (IsInfixI(aB) xyzAbw)TrueTzpredicate-typedsimilar to case insensitive  for strings{predicate-typed similar to  for stringspl @(IsSuffix "bw" Id) "xyzabw"True (IsSuffix(bw) xyzabw)TrueTpl @(IsSuffix "bw" Id) "xyzbaw"False (IsSuffix(bw) xyzbaw)FalseT|predicate-typed similar to  for stringspl @(IsInfix "ab" Id) "xyzabw"True (IsInfix(ab) xyzabw)TrueTpl @(IsInfix "aB" Id) "xyzAbw"False (IsInfix(aB) xyzAbw)FalseTpl @(IsInfix "ab" Id) "xyzbaw"False (IsInfix(ab) xyzbaw)FalseT/pl @(IsInfix (Fst Id) (Snd Id)) ("ab","xyzabw")True (IsInfix(ab) xyzabw)TrueT}predicate-typed similar to  for stringspl @(IsPrefix "xy" Id) "xyzabw"True (IsPrefix(xy) xyzabw)TrueTpl @(IsPrefix "ab" Id) "xyzbaw"False (IsPrefix(ab) xyzbaw)FalseTpredicate-typed similar to    for strings only.4The 'I' suffixed versions work are case insensitive. pz @(IsInfixI "abc" "axAbCd") ()TrueT!pz @(IsPrefixI "abc" "aBcbCd") ()TrueT pz @(IsPrefix "abc" "aBcbCd") ()FalseT pz @(IsSuffix "bCd" "aBcbCd") ()TrueT~predicate-typed similar to 9:!pz @(StripR "xyz" Id) "Hello xyz"PresentT (Just "Hello ")#pz @(StripR "xyz" Id) "xyzHelloxyw"PresentT Nothingpz @(StripR "xyz" Id) ""PresentT Nothingpz @(StripR "xyz" "xyz") ()PresentT (Just "")predicate-typed similar to 9;,pz @(StripL "xyz" Id) ("xyzHello" :: String)PresentT (Just "Hello"))pz @(StripL "xyz" Id) (T.pack "xyzHello")PresentT (Just "Hello") pz @(StripL "xyz" Id) "xywHello"PresentT Nothingpredicate-typed similar to 0pz @(TrimBoth (Snd Id)) (20," abc " :: String)PresentT "abc"-pz @(TrimBoth (Snd Id)) (20,T.pack " abc ")PresentT "abc"pz @(TrimBoth " ") () PresentT ""pz @(TrimBoth "") () PresentT ""predicate-typed similar to #pz @(TrimR (Snd Id)) (20," abc ")PresentT " abc"pz @(TrimR " abc ") ()PresentT " abc"pz @(TrimR "") () PresentT ""predicate-typed similar to #pz @(TrimL (Snd Id)) (20," abc ")PresentT "abc "predicate-typed similar to   0pz @(TrimBoth (Snd Id)) (20," abc " :: String)PresentT "abc"-pz @(TrimBoth (Snd Id)) (20,T.pack " abc ")PresentT "abc"#pz @(TrimL (Snd Id)) (20," abc ")PresentT "abc "#pz @(TrimR (Snd Id)) (20," abc ")PresentT " abc"pz @(TrimR " abc ") ()PresentT " abc"pz @(TrimR "") () PresentT ""pz @(TrimBoth " ") () PresentT ""pz @(TrimBoth "") () PresentT ""uvwxyz{|}~~}|{zyxwuv None&',-.=>?@AHSUVXkfepredicate-typedA replacement function ([String] -> String)" which yields the groups Used by F and G Requires Text.Show.Functions:m + Text.Show.Functionsimport Data.List (intercalate)pz @(ReplaceAll "^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$" (ReplaceFn3 (Fst Id)) (Snd Id)) (\ys -> intercalate " | " $ map (show . succ . readNote @Int "invalid int") ys, "141.201.1.22")PresentT "142 | 202 | 2 | 23"predicate-typedA replacement function (String -> String)& that yields the whole match Used by F and G Requires Text.Show.Functions:m + Text.Show.Functions[pz @(ReplaceAll "\\." (ReplaceFn2 (Fst Id)) (Snd Id)) (\x -> x <> ":" <> x, "141.201.1.22")PresentT "141.:.201.:.1.:.22"predicate-typedA replacement function (String -> [String] -> String)7 which returns the whole match and the groups Used by F and G Requires Text.Show.Functionspredicate-typedSimple replacement string: see  and predicate-typed5replace all occurrences of string 'p' with 'q' in 'r'@pl @(ReplaceAllString 'ROverWrite "abc" "def" Id) "123abc456abc"EPresent "123def456def" (ReplaceAll (abc) 123abc456abc | 123def456def)PresentT "123def456def"Epl @(ReplaceAllString' '[] 'ROverWrite "abc" "def" Id) "123AbC456abc"EPresent "123AbC456def" (ReplaceAll (abc) 123AbC456abc | 123AbC456def)PresentT "123AbC456def"Ppl @(ReplaceAllString' '[ 'Caseless ] 'ROverWrite "abc" "def" Id) "123AbC456abc"RPresent "123def456def" (ReplaceAll' ['Caseless] (abc) 123AbC456abc | 123def456def)PresentT "123def456def">pl @(ReplaceAllString 'RPrepend "abc" "def" Id) "123AbC456abc"KPresent "123AbC456defabc" (ReplaceAll (abc) 123AbC456abc | 123AbC456defabc)PresentT "123AbC456defabc"@pl @(ReplaceAllString 'ROverWrite "abc" "def" Id) "123AbC456abc"EPresent "123AbC456def" (ReplaceAll (abc) 123AbC456abc | 123AbC456def)PresentT "123AbC456def"=pl @(ReplaceAllString 'RAppend "abc" "def" Id) "123AbC456abc"KPresent "123AbC456abcdef" (ReplaceAll (abc) 123AbC456abc | 123AbC456abcdef)PresentT "123AbC456abcdef"predicate-typed6replace first occurrence of string 'p' with 'q' in 'r'@pl @(ReplaceOneString 'ROverWrite "abc" "def" Id) "123abc456abc"EPresent "123def456abc" (ReplaceOne (abc) 123abc456abc | 123def456abc)PresentT "123def456abc"pz @(Rescan "^Date\\((\\d+[+-]\\d{4})\\)" Id >> Head Id >> Snd Id >> Id !! 0 >> ReplaceOneString 'RPrepend "\\d{3}[+-]" "." Id >> ParseTimeP ZonedTime "%s%Q%z" Id) "Date(1530144000123+0530)"&PresentT 2018-06-28 05:30:00.123 +0530pz @(Rescan "^Date\\((\\d+[+-]\\d{4})\\)" Id >> Head Id >> Snd Id >> Id !! 0 >> ReplaceOneString 'RPrepend "\\d{3}[+-]" "." Id >> ParseTimeP ZonedTime "%s%Q%z" Id) "Date(1593460089052+0800)"&PresentT 2020-06-30 03:48:09.052 +0800pz @(Rescan "^Date\\((\\d+)(\\d{3}[+-]\\d{4})\\)" Id >> Head Id >> Snd Id >> (Id !! 0 <> "." <> Id !! 1) >> ParseTimeP ZonedTime "%s%Q%z" Id) "Date(1593460089052+0800)"&PresentT 2020-06-30 03:48:09.052 +0800predicate-typed<replaces regex 's' with a string 's1' inside the value: see F and G>pz @(ReplaceAllString 'ROverWrite "\\." ":" Id) "141.201.1.22"PresentT "141:201:1:22"predicate-typed*splits a string on a regex delimiter: see %pz @(Resplit "\\." Id) "141.201.1.22"PresentT ["141","201","1","22"]<pz @(Resplit (Singleton (Fst Id)) (Snd Id)) (':', "12:13:1")PresentT ["12","13","1"]$pl @(Resplit "\\." Id) "123.2.3.5.6"TPresent ["123","2","3","5","6"] (Resplit (\.) ["123","2","3","5","6"] | 123.2.3.5.6) PresentT ["123","2","3","5","6"]spl @(Map (ReadP Int Id) (Resplit "\\." Id) >> '(Id, '(Len == 4, All (Between 0 255 Id) Id))) "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))})/PresentT ([141,214,125,1,2,3333],(False,False))tpl @(Map (ReadP Int Id) (Resplit "\\." Id) >> Id &&& ((Len == 4) &&& All (Between 0 255 Id) Id)) "141.214.125.1.2.6"~Present ([141,214,125,1,2,6],(False,True)) ((>>) ([141,214,125,1,2,6],(False,True)) | {W '([141,214,125,1,2,6],(False,True))})+PresentT ([141,214,125,1,2,6],(False,True))spl @(Resplit "\\." Id >> Map (ReadP Int Id) Id >> Id &&& ((Len == 4) &&& All (Between 0 255 Id) Id)) "141.214.125.";Error ReadP Int () (["141","214","125",""] (>>) rhs failed)FailT "ReadP Int ()"predicate-typed*splits a string on a regex delimiter: see 5pl @(Resplit' '[ 'Caseless ] "aBc" Id) "123AbC456abc"UPresent ["123","456",""] (Resplit' ['Caseless] (aBc) ["123","456",""] | 123AbC456abc)PresentT ["123","456",""]predicate-typedsee ?pz @(RescanRanges "^(\\d{2}):(\\d{2}):(\\d{2})$" Id) "13:05:25"&PresentT [((0,8),[(0,2),(3,5),(6,8)])]predicate-typedsee 9pz @(Rescan "^(\\d{2}):(\\d{2}):(\\d{2})$" Id) "13:05:25"(PresentT [("13:05:25",["13","05","25"])]Epz @(Rescan (Snd Id) "13:05:25") ('a',"^(\\d{2}):(\\d{2}):(\\d{2})$")(PresentT [("13:05:25",["13","05","25"])]cpz @(Rescan "^(\\d{2}):(\\d{2}):(\\d{2})$" Id >> Snd (Head Id) >> Map (ReadP Int Id) Id) "13:05:25"PresentT [13,5,25]Spl @(Rescan "(\\d+)\\D?" Id >> Map (Second (ReadP Int (OneP Id))) Id) "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"])]})0PresentT [("123-",123),("444-",444),("987",987)]pl @(Rescan ".(.)" Id) "aBcd"VPresent [("aB",["B"]),("cd",["d"])] (Rescan (.(.)) [("aB",["B"]),("cd",["d"])] | aBcd)$PresentT [("aB",["B"]),("cd",["d"])].pl @(Rescan "\\d{1,3}(\\.)?" Id) "123.8.99.21"Present [("123.",["."]),("8.",["."]),("99.",["."]),("21",[])] (Rescan (\d{1,3}(\.)?) [("123.",["."]),("8.",["."]),("99.",["."]),("21",[])] | 123.8.99.21)>PresentT [("123.",["."]),("8.",["."]),("99.",["."]),("21",[])]Hpl @(Map (Fst Id) (Rescan "." (ShowP Id)) >> Filter (Same "2") Id) 12324PPresent ["2","2"] ((>>) ["2","2"] | {Fst ["2","2"] | (["2","2"],["1","3","4"])})PresentT ["2","2"] pl @(Rescan "(\\d)+?" Id) "1234"Present [("1",["1"]),("2",["2"]),("3",["3"]),("4",["4"])] (Rescan ((\d)+?) [("1",["1"]),("2",["2"]),("3",["3"]),("4",["4"])] | 1234):PresentT [("1",["1"]),("2",["2"]),("3",["3"]),("4",["4"])]pl @(Rescan "(\\d)+" Id) "1234"APresent [("1234",["4"])] (Rescan ((\d)+) [("1234",["4"])] | 1234)PresentT [("1234",["4"])]Hpl @(Rescan "(\\d{1,3})(\\.(\\d{1,3}))+?" Id) "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)8PresentT [("1.2",["1",".2","2"]),("3.4",["3",".4","4"])]"pl @(Rescan "^(\\d)+?$" Id) "1234"DPresent [("1234",["4"])] (Rescan (^(\d)+?$) [("1234",["4"])] | 1234)PresentT [("1234",["4"])]7pl @(Rescan "(\\d{1,3})(\\.(\\d{1,3}))+?" Id) "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)8PresentT [("1.2",["1",".2","2"]),("3.4",["3",".4","4"])]Epl @(Rescan "(\\d{1,3})(?:\\.(\\d{1,3}))+?" Id) "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).PresentT [("1.2",["1","2"]),("3.4",["3","4"])]Opl @(Rescan "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$" Id) "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)(PresentT [("1.2.3.4",["1","2","3","4"])].pl @(Rescan "([[:xdigit:]]{2})" Id) "wfeb12az"Present [("fe",["fe"]),("b1",["b1"]),("2a",["2a"])] (Rescan (([[:xdigit:]]{2})) [("fe",["fe"]),("b1",["b1"]),("2a",["2a"])] | wfeb12az)4PresentT [("fe",["fe"]),("b1",["b1"]),("2a",["2a"])]predicate-typedRruns a regex matcher returning the original values and optionally any groups: see >pl @(Rescan' '[ 'Anchored ] "([[:xdigit:]]{2})" Id) "wfeb12az"MError Regex no results (Rescan' ['Anchored] (([[:xdigit:]]{2})) | "wfeb12az")FailT "Regex no results"predicate-typed5runs a regular expression and returns a boolean: see /pz @(Re "^\\d{2}:\\d{2}:\\d{2}$" Id) "13:05:25"TrueT&pl @(Re "\\d{4}-\\d{3}" Id) "1234-123""True (Re (\d{4}-\d{3}) | 1234-123)TrueT&pl @(Re "\\d{4}-\\d{3}" Id) "1234-1x3"#False (Re (\d{4}-\d{3}) | 1234-1x3)FalseT<pl @(Re "(?i)ab" Id) "aB" -- runtime [use 'Caseless instead]True (Re ((?i)ab) | aB)TrueTpl @(Re "ab" Id) "aB"False (Re (ab) | aB)FalseT7pl @(Re "^\\d{1,3}(?:\\.\\d{1,3}){3}$" Id) "123.1.1.21"2True (Re (^\d{1,3}(?:\.\d{1,3}){3}$) | 123.1.1.21)TrueTSpl @(Guard "regex failed" (Re "^\\d+(?:\\.\\d+)?$" Id) >> ReadP Double Id) "13.345"4Present 13.345 ((>>) 13.345 | {ReadP Double 13.345})PresentT 13.345Opl @(Guard "regex failed" (Re "^\\d+(?:\\.\\d+)?$" Id) >> ReadP Double Id) "13".Present 13.0 ((>>) 13.0 | {ReadP Double 13.0}) PresentT 13.0[pl @(ExitWhen "regex failed" (Not (Re "^\\d+(?:\\.\\d+)?$" Id)) >> ReadP Double Id) "-13.4"$Error regex failed ((>>) lhs failed)FailT "regex failed"pl @(Re "\\d{4}\\" Id) "ayx"GError Regex failed to compile (Re (\d{4}\) ([],[]):\ at end of pattern)FailT "Regex failed to compile"pl @(Re "^\\d+$" Id) "123\nx"False (Re (^\d+$) | 123x)FalseTepl @(Re "(?m)^\\d+$" Id) "123\nx" -- (?m) anchors match beginning/end of line instead of whole stringTrue (Re ((?m)^\d+$) | 123x)TrueT(pl @(Catch (Re "\\d+(" Id) 'False) "123"7False (Catch caught exception[Regex failed to compile])FalseT'pl @(Catch (Re "\\d+" Id) 'False) "123"True (Catch did not fire)TrueTpredicate-typedNruns 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)TrueT1pl @(Re' '[ 'Caseless, 'Dotall ] "ab." Id) "aB\n")True (Re' ['Caseless, 'Dotall] (ab.) | aB)TrueT(pl @(Re' '[ 'Caseless ] "ab." Id) "aB\n"!False (Re' ['Caseless] (ab.) | aB)FalseT None&',-.=>?@AHSUVXkͶpredicate-typedprint for lists -- use  as it is safer than ^pl @(PrintL 4 "%s %s %s %s" '[W "xyz", ShowP (Fst Id), ShowP (Snd Id), Thd Id]) (123,'x',"ab")EPresent "xyz 123 'x' ab" (PrintL(4) [xyz 123 'x' ab] | s=%s %s %s %s)PresentT "xyz 123 'x' ab"Zpz @(PrintL 1 "%05d" '[Id]) 123 -- tick is required for a one element list (use 'PrintF')PresentT "00123"1pz @(PrintL 2 "%d %05d" [Fst Id,Snd Id]) (29,123)PresentT "29 00123":pl @(PrintL 3 "first=%d second=%d third=%d" Id) [10,11,12]oPresent "first=10 second=11 third=12" (PrintL(3) [first=10 second=11 third=12] | s=first=%d second=%d third=%d)&PresentT "first=10 second=11 third=12":pl @(PrintL 2 "first=%d second=%d third=%d" Id) [10,11,12],Error PrintL(2) arg count=3 (wrong length 3)FailT "PrintL(2) arg count=3":pl @(PrintL 4 "first=%d second=%d third=%d" Id) [10,11,12],Error PrintL(4) arg count=3 (wrong length 3)FailT "PrintL(4) arg count=3"6pl @(PrintL 4 "%03d.%03d.%03d.%03d" Id) [1,2,3,4::Int]OPresent "001.002.003.004" (PrintL(4) [001.002.003.004] | s=%03d.%03d.%03d.%03d)PresentT "001.002.003.004"8pl @(PrintL 4 "%03d.%03d.%03d.%03d" Id) [1,2,3,4,5::Int],Error PrintL(4) arg count=5 (wrong length 5)FailT "PrintL(4) arg count=5"4pl @(PrintL 4 "%03d.%03d.%03d.%03d" Id) [1,2,3::Int],Error PrintL(4) arg count=3 (wrong length 3)FailT "PrintL(4) arg count=3"6pl @(PrintL 4 "%03d.%03d.%03d.%03d" Id) [1,2,3,4::Int]OPresent "001.002.003.004" (PrintL(4) [001.002.003.004] | s=%03d.%03d.%03d.%03d)PresentT "001.002.003.004"/pl @(PrintL 4 "%d %4d %-d %03d" Id) [1..4::Int]EPresent "1 2 3 004" (PrintL(4) [1 2 3 004] | s=%d %4d %-d %03d)PresentT "1 2 3 004"predicate-typed-print for flat n-tuples of size two or largerGpl @(PrintT "%d %s %s %s" '(Fst Id, Snd Id, Snd Id,Snd Id)) (10,"Asdf")HPresent "10 Asdf Asdf Asdf" (PrintT [10 Asdf Asdf Asdf] | s=%d %s %s %s)PresentT "10 Asdf Asdf Asdf"+pl @(PrintT "%c %d %s" Id) ('x', 10,"Asdf")5Present "x 10 Asdf" (PrintT [x 10 Asdf] | s=%c %d %s)PresentT "x 10 Asdf",pz @(PrintT "fst=%s snd=%03d" Id) ("ab",123)PresentT "fst=ab snd=123"8pz @(PrintT "fst=%s snd=%03d thd=%s" Id) ("ab",123,"xx") PresentT "fst=ab snd=123 thd=xx"Lpl @(PrintT "%s %d %c %s" '(W "xyz", Fst Id, Snd Id, Thd Id)) (123,'x',"ab")>Present "xyz 123 x ab" (PrintT [xyz 123 x ab] | s=%s %d %c %s)PresentT "xyz 123 x ab"$pl @(PrintT "%d %c %s" Id) (123,'x')LError PrintT(IO e=printf: argument list ended prematurely) (PrintT %d %c %s)<FailT "PrintT(IO e=printf: argument list ended prematurely)"-pl @(PrintT "%d %c %s" Id) (123,'x',"abc",11)PError PrintT(IO e=printf: formatting string ended prematurely) (PrintT %d %c %s)@FailT "PrintT(IO e=printf: formatting string ended prematurely)"=pl @(PrintT "lhs = %d rhs = %s" Id) (123::Int,"asdf"::String)TPresent "lhs = 123 rhs = asdf" (PrintT [lhs = 123 rhs = asdf] | s=lhs = %d rhs = %s)PresentT "lhs = 123 rhs = asdf"3pl @(PrintT "d=%03d s=%s" Id) (9::Int,"ab"::String):Present "d=009 s=ab" (PrintT [d=009 s=ab] | s=d=%03d s=%s)PresentT "d=009 s=ab"Ppl @(PrintT "d=%03d s=%s c=%c f=%4.2f" Id) (9::Int,"ab"::String,'x',1.54::Float)]Present "d=009 s=ab c=x f=1.54" (PrintT [d=009 s=ab c=x f=1.54] | s=d=%03d s=%s c=%c f=%4.2f) PresentT "d=009 s=ab c=x f=1.54"Dpl @(PrintT "d=%03d s=%s" Id) (9::Int, "ab"::String,'x',1.54::Float)SError PrintT(IO e=printf: formatting string ended prematurely) (PrintT d=%03d s=%s)@FailT "PrintT(IO e=printf: formatting string ended prematurely)"Fpl @(PrintT "lhs = %d rhs = %s c=%d" Id) (123::Int,"asdf"::String,'x')ePresent "lhs = 123 rhs = asdf c=120" (PrintT [lhs = 123 rhs = asdf c=120] | s=lhs = %d rhs = %s c=%d)%PresentT "lhs = 123 rhs = asdf c=120">pl @(PrintT "hello d=%d %c %s" '(12, Char1 "z", "someval")) ()SPresent "hello d=12 z someval" (PrintT [hello d=12 z someval] | s=hello d=%d %c %s)PresentT "hello d=12 z someval":pl @(PrintT "ipaddress %03d.%03d.%03d.%03d" '(1,2,3,4)) ()jPresent "ipaddress 001.002.003.004" (PrintT [ipaddress 001.002.003.004] | s=ipaddress %03d.%03d.%03d.%03d)$PresentT "ipaddress 001.002.003.004"predicate-typed3uses inductive tuples to replace variable argumentspredicate-typed8uses PrintF (unsafe) to format output for a single valuepz @(PrintF "value=%03d" Id) 12PresentT "value=012"&pz @(PrintF "%s" (Fst Id)) ("abc",'x')PresentT "abc"&pz @(PrintF "%d" (Fst Id)) ("abc",'x')5FailT "PrintF (IO e=printf: bad formatting char 'd')",pl @(PrintF "someval %d" Id) ("!23"::String)HError PrintF (IO e=printf: bad formatting char 'd') ("!23" s=someval %d)5FailT "PrintF (IO e=printf: bad formatting char 'd')"$pl @(PrintF "%-6s" Id) (1234 :: Int)AError PrintF (IO e=printf: bad formatting char 's') (1234 s=%-6s)5FailT "PrintF (IO e=printf: bad formatting char 's')"$pl @(PrintF "%06x" Id) (1234 :: Int)4Present "0004d2" (PrintF [0004d2] | p=1234 | s=%06x)PresentT "0004d2"3pl @(Msg (PrintF "digits=%d" Len) (Head Id)) [1..4]'Present 1 (digits=4 Head 1 | [1,2,3,4]) PresentT 17pl @(PrintF "ask%%dfas%%kef%05d hey %%" Id) (35 :: Int)iPresent "ask%dfas%kef00035 hey %" (PrintF [ask%dfas%kef00035 hey %] | p=35 | s=ask%%dfas%%kef%05d hey %%)"PresentT "ask%dfas%kef00035 hey %"6pl @(Fail () (PrintF "someval int=%d" Id)) (45 :: Int)*Error someval int=45 (Fail someval int=45)FailT "someval int=45"predicate-typedIRead but returns the Maybe of the value and any remaining unparsed stringpz @(ReadMaybe Int Id) "123x"PresentT (Just (123,"x"))pz @(ReadMaybe Int Id) "123"PresentT (Just (123,""))pz @(ReadMaybe Int Id) "x123"PresentT Nothingpredicate-typed uses the B of the given type 't' and 'p' which points to the content to readpz @(ReadP Rational Id) "4 % 5"PresentT (4 % 5)[pz @(Between (ReadP Day "2017-04-11") (ReadP Day "2018-12-30") (ReadP Day Id)) "2018-10-12"TrueT[pz @(Between (ReadP Day "2017-04-11") (ReadP Day "2018-12-30") (ReadP Day Id)) "2016-10-12"FalseT!pl @(ReadP Rational Id) "123 % 4"-Present 123 % 4 (ReadP Ratio Integer 123 % 4)PresentT (123 % 4)"pl @(ReadP Rational Id) "x123 % 4")Error ReadP Ratio Integer (x123 % 4) ([])&FailT "ReadP Ratio Integer (x123 % 4)"pl @(ReadP Day Id) "1999-11-30")Present 1999-11-30 (ReadP Day 1999-11-30)PresentT 1999-11-30pl @(ReadP Day Id) "1999-02-29"!Error ReadP Day (1999-02-29) ([])FailT "ReadP Day (1999-02-29)"#pl @(ReadP TimeOfDay Id) "14:59:20"+Present 14:59:20 (ReadP TimeOfDay 14:59:20)PresentT 14:59:20predicate-typed uses the B of the given type 't' and 'p' which points to the content to readpredicate-typed similar to pz @(ShowP Id) [4,8,3,9]PresentT "[4,8,3,9]"pz @(ShowP Id) 'x'PresentT "'x'"pz @(ShowP (42 -% 10)) 'x'PresentT "(-21) % 5"   None&',-.=>?@AHSUVXkpredicate-typed similar to <= pz @(Ors Id) [False,False,False]FalseT#pl @(Ors Id) [True,True,True,False]*True (Ors(4) i=0 | [True,True,True,False])TrueTpl @(Ors Id) []False (Ors(0) | [])FalseTpredicate-typed similar to <>pz @(Ands Id) [True,True,True]TrueT$pl @(Ands Id) [True,True,True,False],False (Ands(4) i=3 | [True,True,True,False])FalseTpz @(Ands Id) []TrueTpredicate-typed:a type level predicate for all negative elements in a list!pz @AllNegative [-1,-5,-10,-2,-3]TrueTpredicate-typed:a type level predicate for all positive elements in a listpz @AllPositive [1,5,10,2,3]TrueTpz @AllPositive [0,1,5,10,2,3]FalseTpz @AllPositive [3,1,-5,10,2,3]FalseTpredicate-typed5a type level predicate for a strictly decreasing listpredicate-typed6a type level predicate for a monotonic decreasing listpredicate-typed5a type level predicate for a strictly increasing listpz @Asc' [1,2,3,4,5,5,7]FalseTpredicate-typed6a type level predicate for a monotonic increasing listpl @Asc "aaacdef" True (All(6))TrueTpz @Asc [1,2,3,4,5,5,7]TrueTpz @Asc "axacdef"FalseTpredicate-typed>compare two strings ignoring case using the given ordering 'o'predicate-typed/compare two values using the given ordering 'o'pl @(Lt 4) 123False (123 < 4)FalseT pl @(Lt 4) 1 True (1 < 4)TrueTpl @(Negate 7 <..> 20) (-4)True (-7 <= -4 <= 20)TrueTpl @(Negate 7 <..> 20) 21False (21 <= 20)FalseTpredicate-typed8compare two strings ignoring case and return an ordering&pz @(Fst Id ===~ Snd Id) ("abC","aBc") PresentT EQ'pz @(Fst Id ===~ Snd Id) ("abC","DaBc") PresentT LT<pl @(Fst Id ===~ Snd Id &&& Fst Id ==! Snd Id) ("abc","abc")Present (EQ,EQ) (W '(EQ,EQ))PresentT (EQ,EQ)&pl @(Fst Id ===~ Snd Id) ("aBc","AbC")Present EQ ((===~) aBc = AbC) PresentT EQpl @("Abc" ===~ Id) "abc"Present EQ ((===~) Abc = abc) PresentT EQpl @("Abc" ==~ Id) "abc"True (Abc ==~ abc)TrueT%pl @(Fst Id ==~ Snd Id) ("aBc","AbC")True (aBc ==~ AbC)TrueT9pl @(Fst Id ==~ Snd Id && Fst Id == Snd Id) ("Abc","Abc")True (True && True)TrueTpredicate-typed similar to  but using a tuple as inputpredicate-typed similar to pz @(Fst Id ==! Snd Id) (10,9) PresentT GT)pz @(14 % 3 ==! Fst Id -% Snd Id) (-10,7) PresentT GTpz @(Fst Id ==! Snd Id) (10,11) PresentT LTDpz @(Snd Id ==! (Fst Id >> Snd Id >> Head Id)) (('x',[10,12,13]),10) PresentT EQ:pz @(Snd Id ==! Head (Snd (Fst Id))) (('x',[10,12,13]),10) PresentT EQpl @("aa" ==! Id) "aaaa" Present LT ((==!) "aa" < "aaaa") PresentT LTSpl @(Pairs >> Map (First (Succ Id >> Succ Id) >> Fst Id ==! Snd Id) Id) [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)]})PresentT [GT,GT,LT,EQ]Dpl @((Ones Id << ShowP Id) >> Map (Fst Id ==! Snd Id) 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")]})PresentT [LT,LT,LT,GT,EQ,LT]pl @("Abc" ==! Id) "abc" Present LT ((==!) "Abc" < "abc") PresentT LTpl @(Fst Id ==! Snd Id) (3,12)Present LT ((==!) 3 < 12) PresentT LT%pl @(Fst Id ==! Snd Id) ("aBc","AbC") Present GT ((==!) "aBc" > "AbC") PresentT GT%pl @(Snd Id ==! Fst Id) ("aBc","AbC") Present LT ((==!) "AbC" < "aBc") PresentT LTpredicate-typedEcase-insensitive compare if string expression 'p' is not equal to 'q'predicate-typedBcase-insensitive compare if string expression 'p' is less than 'q'predicate-typedNcase-insensitive compare if string expression 'p' is less than or equal to 'q'predicate-typedAcase-insensitive compare if string expression 'p' is equal to 'q'predicate-typedQcase-insensitive compare if string expression 'p' is greater than or equal to 'q'predicate-typedEcase-insensitive compare if string expression 'p' is greater than 'q'predicate-typed-compare if expression 'p' is not equal to 'q'&pl @(Fst Id /= Snd Id) ("ab","xyzabw")True ("ab" /= "xyzabw")TrueTpredicate-typed*compare if expression 'p' is less than 'q'predicate-typed6compare if expression 'p' is less than or equal to 'q',pl @(Not (Fst Id >> Len <= 6)) ([2..7],True)"False (Not ((>>) True | {6 <= 6}))FalseT&pl @(Fst Id >> Len <= 6) ([2..7],True)True ((>>) True | {6 <= 6})TrueT(pl @(Length (Fst Id) <= 6) ([2..7],True) True (6 <= 6)TrueT(pl @(Fst Id >> (Len <= 6)) ([2..7],True)True ((>>) True | {6 <= 6})TrueTpredicate-typed)compare if expression 'p' is equal to 'q'&pl @(Fst Id == Snd Id) ("ab","xyzabw")False ("ab" == "xyzabw")FalseT$pl @(Fst Id == Snd Id) ("aBc","AbC")False ("aBc" == "AbC")FalseT$pz @(Fst Id == Snd Id) ("aBc","aBc")TrueTpl @(Id == "Abc") "abc"False ("abc" == "Abc")FalseT#pl @(Fst Id == Snd Id) (True,False)False (True == False)FalseT4pl @(Not Id *** Id >> Fst Id == Snd Id) (True,False)#True ((>>) True | {False == False})TrueTpredicate-typed9compare if expression 'p' is greater than or equal to 'q'predicate-typed-compare if expression 'p' is greater than 'q'pl @(Id > "xx") "abc"False ("abc" > "xx")FalseTpl @(Id > "aa") "abc"True ("abc" > "aa")TrueT"pl @(Fst Id > Snd Id) (True,False)True (True > False)TrueTpredicate-typed-compare if expression 'p' is greater than 'q' pl @(Gt 4) 5 True (5 > 4)TrueT$$44444444444444None&',-.=>?@AHSUVXkpredicate-typed-Display a number at base 2 to 36, similar to  but supports signed numberspz @(ShowBase 16 Id) 4077PresentT "fed"pz @(ShowBase 16 Id) (-255)PresentT "-ff"pz @(ShowBase 2 Id) 147PresentT "10010011"(pz @(ShowBase 2 (Negate 147)) "whatever"PresentT "-10010011"pl @(ShowBase 16 Id) (-123)'Present "-7b" (ShowBase(16) -7b | -123)PresentT "-7b"pl @(ShowBase 16 Id) 123$Present "7b" (ShowBase(16) 7b | 123) PresentT "7b"pl @(ShowBase 16 Id) 65504*Present "ffe0" (ShowBase(16) ffe0 | 65504)PresentT "ffe0"predicate-typed2Read a number using base 2 through a maximum of 36 pz @(ReadBase Int 16 Id) "00feD" PresentT 4077pz @(ReadBase Int 16 Id) "-ff"PresentT (-255)"pz @(ReadBase Int 2 Id) "10010011" PresentT 147pz @(ReadBase Int 8 Id) "Abff"FailT "invalid base 8"Opl @(ReadBase Int 16 Id >> GuardSimple (Id > 0xffff) >> ShowBase 16 Id) "12344"=Present "12344" ((>>) "12344" | {ShowBase(16) 12344 | 74564})PresentT "12344":set -XBinaryLiteralsPpz @(ReadBase Int 16 Id >> GuardSimple (Id > 0b10011111) >> ShowBase 16 Id) "7f"FailT "(127 > 159)"pl @(ReadBase Int 16 Id) "fFe0"/Present 65504 (ReadBase(Int,16) 65504 | "fFe0")PresentT 65504pl @(ReadBase Int 16 Id) "-ff",Present -255 (ReadBase(Int,16) -255 | "-ff")PresentT (-255)pl @(ReadBase Int 16 Id) "ff")Present 255 (ReadBase(Int,16) 255 | "ff") PresentT 255pl @(ReadBase Int 22 Id) "zzz"6Error invalid base 22 (ReadBase(Int,22) as=zzz err=[])FailT "invalid base 22"Bpl @((ReadBase Int 16 Id &&& Id) >> First (ShowBase 16 Id)) "fFe0"YPresent ("ffe0","fFe0") ((>>) ("ffe0","fFe0") | {(***) ("ffe0","fFe0") | (65504,"fFe0")})PresentT ("ffe0","fFe0") pl @(ReadBase Int 2 Id) "101111"*Present 47 (ReadBase(Int,2) 47 | "101111") PresentT 47predicate-typed similar to pz @(Signum Id) (-14) PresentT (-1)pz @(Signum Id) 14 PresentT 1pz @(Signum Id) 0 PresentT 0predicate-typed similar to !pz @(Map Even Id) [9,-4,12,1,2,3]+PresentT [False,True,True,False,True,False](pz @(Map '(Even,Odd) Id) [9,-4,12,1,2,3]XPresentT [(False,True),(True,False),(True,False),(False,True),(True,False),(False,True)]predicate-typed similar to &pz @(QuotRem (Fst Id) (Snd Id)) (10,3)PresentT (3,1)'pz @(QuotRem (Fst Id) (Snd Id)) (10,-3)PresentT (-3,1)(pz @(QuotRem (Fst Id) (Snd Id)) (-10,-3)PresentT (3,-1)'pz @(QuotRem (Fst Id) (Snd Id)) (-10,3)PresentT (-3,-1)&pz @(QuotRem (Fst Id) (Snd Id)) (10,0) FailT "QuotRem zero denominator"pl @(QuotRem (Negate Id) 7) 23+Present (-3,-2) (-23 `quotRem` 7 = (-3,-2))PresentT (-3,-2)'pl @(QuotRem (Fst Id) (Snd Id)) (10,-3))Present (-3,1) (10 `quotRem` -3 = (-3,1))PresentT (-3,1)predicate-typed similar to %pz @(DivMod (Fst Id) (Snd Id)) (10,3)PresentT (3,1)&pz @(DivMod (Fst Id) (Snd Id)) (10,-3)PresentT (-4,-2)&pz @(DivMod (Fst Id) (Snd Id)) (-10,3)PresentT (-4,2)'pz @(DivMod (Fst Id) (Snd Id)) (-10,-3)PresentT (3,-1)%pz @(DivMod (Fst Id) (Snd Id)) (10,0)FailT "DivMod zero denominator"pl @(DivMod (Negate Id) 7) 23(Present (-4,5) (-23 `divMod` 7 = (-4,5))PresentT (-4,5)&pl @(DivMod (Fst Id) (Snd Id)) (10,-3)*Present (-4,-2) (10 `divMod` -3 = (-4,-2))PresentT (-4,-2)%pl @(DivMod (Fst Id) (Snd Id)) (10,0)Error DivMod zero denominatorFailT "DivMod zero denominator"6pl @(DivMod (9 - Fst Id) (Last (Snd Id))) (10,[12,13])*Present (-1,12) (-1 `divMod` 13 = (-1,12))PresentT (-1,12)predicate-typed similar to ?@"pz @(Mod (Fst Id) (Snd Id)) (10,3) PresentT 1"pz @(Mod (Fst Id) (Snd Id)) (10,0)FailT "Mod zero denominator"predicate-typed similar to "pz @(Div (Fst Id) (Snd Id)) (10,4) PresentT 2"pz @(Div (Fst Id) (Snd Id)) (10,0)FailT "Div zero denominator"predicate-typed similar to pz @(Abs Id) (-14) PresentT 14pz @(Abs (Snd Id)) ("xx",14) PresentT 14pz @(Abs Id) 0 PresentT 0pz @(Abs (Negate 44)) "aaa" PresentT 44 predicate-typed similar to pz @(Negate Id) 14PresentT (-14)%pz @(Negate (Fst Id * Snd Id)) (14,3)PresentT (-42)pz @(Negate (15 -% 4)) "abc"PresentT (15 % 4)pz @(Negate (15 % 3)) ()PresentT ((-5) % 1)%pz @(Negate (Fst Id % Snd Id)) (14,3)PresentT ((-14) % 3)!predicate-typednegate a ratiopl @'[1 % 1 ,3 -% 2,3 -% 1] ()KPresent [1 % 1,(-3) % 2,(-3) % 1] ('[1 % 1,(-3) % 2,(-3) % 1] (1 % 1) | ())"PresentT [1 % 1,(-3) % 2,(-3) % 1]Qpl @('[1 % 1 ,Negate (33 % 7), 21 % 4,Signum (7 -% 5)] >> Map (Floor _ Id) Id) ()^Present [1,-5,5,-1] ((>>) [1,-5,5,-1] | {Map [1,-5,5,-1] | [1 % 1,(-33) % 7,21 % 4,(-1) % 1]})PresentT [1,-5,5,-1]Spl @('[1 % 1 ,Negate (33 % 7), 21 % 4,Signum (7 -% 5)] >> Map (Ceiling _ Id) Id) ()^Present [1,-4,6,-1] ((>>) [1,-4,6,-1] | {Map [1,-4,6,-1] | [1 % 1,(-33) % 7,21 % 4,(-1) % 1]})PresentT [1,-4,6,-1]Tpl @('[1 % 1 ,Negate (33 % 7), 21 % 4,Signum (7 -% 5)] >> Map (Truncate _ Id) Id) ()^Present [1,-4,5,-1] ((>>) [1,-4,5,-1] | {Map [1,-4,5,-1] | [1 % 1,(-33) % 7,21 % 4,(-1) % 1]})PresentT [1,-4,5,-1]pl @(5 % 1 / 3 -% 1) 'x'.Present (-5) % 3 (5 % 1 / (-3) % 1 = (-5) % 3)PresentT ((-5) % 3)pl @(5 -% 1 / Fst Id) (3,'x').Present (-5) % 3 ((-5) % 1 / 3 % 1 = (-5) % 3)PresentT ((-5) % 3)"predicate-typed creates a  valuepz @(Id < 21 % 5) (-3.1)TrueTpz @(Id < 21 % 5) 4.5FalseTpz @(Fst Id % Snd Id) (13,2)PresentT (13 % 2)pz @(13 % Id) 0FailT "(%) zero denominator"pz @(4 % 3 + 5 % 7) "asfd"PresentT (43 % 21)pz @(4 -% 7 * 5 -% 3) "asfd"PresentT (20 % 21)pz @(Negate (14 % 3)) ()PresentT ((-14) % 3)pz @(14 % 3) ()PresentT (14 % 3)6pz @(Negate (14 % 3) ==! FromIntegral _ (Negate 5)) () PresentT GTpz @(14 -% 3 ==! 5 -% 1) "aa" PresentT GT)pz @(Negate (14 % 3) ==! Negate 5 % 2) () PresentT LTpz @(14 -% 3 * 5 -% 1) ()PresentT (70 % 3)pz @(14 % 3 ==! 5 % 1) () PresentT LTpz @(15 % 3 / 4 % 2) ()PresentT (5 % 2)#predicate-typedfractional divisionpz @(Fst Id / Snd Id) (13,2) PresentT 6.5pz @(ToRational 13 / Id) 0FailT "(/) zero denominator"pz @(12 % 7 / 14 % 5 + Id) 12.4PresentT (3188 % 245)predicate-typed(addition, multiplication and subtractionpz @(Fst Id * Snd Id) (13,5) PresentT 652pz @(Fst Id + 4 * Length (Snd Id) - 4) (3,"hello") PresentT 19$predicate-typed similar to ;pz @(Fst Id `LogBase` Snd Id >> Truncate Int Id) (10,12345) PresentT 4%predicate-typedsimilar to 'GHC.Float.(**)'pz @(Fst Id ** Snd Id) (10,4)PresentT 10000.0Hpz @'(Prime Id,Id ^ 3,(FromIntegral _ Id) ** (FromRational _ (1 % 2))) 4PresentT (False,64,2.0)&predicate-typedsimilar to 'GHC.Real.(^)'pz @(Fst Id ^ Snd Id) (10,4)PresentT 10000+predicate-typed> function where you need to provide the type 't' of the resultpz @(Floor Int Id) (23 % 5) PresentT 4-predicate-typed> function where you need to provide the type 't' of the resultpz @(Ceiling Int Id) (23 % 5) PresentT 5/predicate-typed> function where you need to provide the type 't' of the resultpz @(Truncate Int Id) (23 % 5) PresentT 4Apl @(Truncate' (Fst Id >> Unproxy) (Snd Id)) (Proxy @Integer,2.3)Present 2 (Truncate 2 | 2.3) PresentT 2.pl @(Truncate' (Fst Id) (Snd Id)) (1::Int,2.3)Present 2 (Truncate 2 | 2.3) PresentT 20predicate-typed> function where you need to provide the type 't' of the result#pz @(FromRational Rational Id) 23.5PresentT (47 % 2)#pl @(FromRational Float (4 % 5)) ()&Present 0.8 (FromRational 0.8 | 4 % 5) PresentT 0.81predicate-typed> function where you need to provide the type 't' of the result6pl @(FromRational' (Fst Id) (Snd Id)) (1::Float,2 % 5)&Present 0.4 (FromRational 0.4 | 2 % 5) PresentT 0.42predicate-typed functionpz @(ToRational Id) 23.5PresentT (47 % 2)4pl @((ToRational 123 &&& Id) >> Fst Id + Snd Id) 4.2=Present 636 % 5 ((>>) 636 % 5 | {123 % 1 + 21 % 5 = 636 % 5})PresentT (636 % 5)Opl @(Fst Id >= Snd Id || Snd Id > 23 || 12 -% 5 <= ToRational (Fst Id)) (12,13)True (False || True)TrueTpl @(ToRational 14) ()'Present 14 % 1 (ToRational 14 % 1 | 14)PresentT (14 % 1)%pl @(ToRational 5 / ToRational 3) 'x'%Present 5 % 3 (5 % 1 / 3 % 1 = 5 % 3)PresentT (5 % 3)4predicate-typed> function where you need to provide the type 't' of the result#pz @(FromIntegral (SG.Sum _) Id) 23PresentT (Sum {getSum = 23})5predicate-typed> function where you need to provide the type 't' of the result"pz @(FromInteger (SG.Sum _) Id) 23PresentT (Sum {getSum = 23}) pz @(FromInteger Rational 44) 12PresentT (44 % 1) pz @(FromInteger Rational Id) 12PresentT (12 % 1)=pl @((FromInteger _ 12 &&& Id) >> Fst Id + Snd Id) (SG.Min 7)BPresent Min {getMin = 19} ((>>) Min {getMin = 19} | {getMin = 19})PresentT (Min {getMin = 19})6pl @((FromInteger _ 12 &&& Id) >> SapA) (SG.Product 7)VPresent Product {getProduct = 84} ((>>) Product {getProduct = 84} | {getProduct = 84})$PresentT (Product {getProduct = 84})-pl @(FromInteger (SG.Sum _) (Fst Id)) (3,"A")7Present Sum {getSum = 3} (FromInteger Sum {getSum = 3})PresentT (Sum {getSum = 3})"pl @(FromInteger DiffTime 123) 'x'Present 123s (FromInteger 123s) PresentT 123s$ !"#$%&'()*+,-./0123456$)('# 5634./,-*+$&%"!201!8"8#7%8&8'7(6)6None%&',-.=>?@AHSUVXk> apredicate-typed similar to pz @(STimes 4 Id) (SG.Sum 3)PresentT (Sum {getSum = 12})pz @(STimes 4 Id) "ab"PresentT "abababab"pl @(STimes 4 Id) (SG.Sum 13)dPresent Sum {getSum = 52} (STimes 4 p=Sum {getSum = 13} Sum {getSum = 52} | n=4 | Sum {getSum = 13})PresentT (Sum {getSum = 52}),pl @(STimes (Fst Id) (Snd Id)) (4,['x','y'])<Present "xyxyxyxy" (STimes 4 p="xy" "xyxyxyxy" | n=4 | "xy")PresentT "xyxyxyxy"(pl @(STimes (Fst Id) (Snd Id)) (4,"abc")FPresent "abcabcabcabc" (STimes 4 p="abc" "abcabcabcabc" | n=4 | "abc")PresentT "abcabcabcabc"pl @(STimes 4 Id) "abc"FPresent "abcabcabcabc" (STimes 4 p="abc" "abcabcabcabc" | n=4 | "abc")PresentT "abcabcabcabc"bpredicate-typed$creates a mempty value for the proxypl @('Proxy >> MEmptyP) "abc"#Present "" ((>>) "" | {MEmptyT ""}) PresentT ""cpredicate-typed similar to pz @(MEmptyT (SG.Sum Int)) ()PresentT (Sum {getSum = 0}))pl @(MEmptyT _ ||| Ones Id) (Right "abc")9Present ["a","b","c"] ((|||) Right ["a","b","c"] | "abc")PresentT ["a","b","c"])pl @(MEmptyT _ ||| Ones Id) (Left ["ab"])#Present [] ((|||) Left [] | ["ab"]) PresentT []pl @(MEmptyT (Maybe ())) 'x'!Present Nothing (MEmptyT Nothing)PresentT Nothingdpredicate-typed similar to $pl @(MEmptyT' Id) (Just (SG.Sum 12))!Present Nothing (MEmptyT Nothing)PresentT Nothing2pl @(MEmptyT (SG.Sum _) >> Unwrap Id >> Id + 4) () Present 4 ((>>) 4 | {0 + 4 = 4}) PresentT 4epredicate-typedlift mempty over a FunctorHpz @(MEmpty2 (SG.Product Int)) [Identity (-13), Identity 4, Identity 99]UPresentT [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}]"pl @(MEmpty2 (SG.Sum _)) (Just ())KPresent Just (Sum {getSum = 0}) (MEmpty2 Just (Sum {getSum = 0}) | Just ())"PresentT (Just (Sum {getSum = 0}))fpredicate-typedlift mempty over a Functorgpredicate-typed similar to =pz @(ToNEList >> SConcat Id) [SG.Sum 44, SG.Sum 12, SG.Sum 3]PresentT (Sum {getSum = 59})Tpz @(Map '(Pure SG.Sum Id, Pure SG.Max Id) Id >> ToNEList >> SConcat Id) [7,6,1,3,5]-PresentT (Sum {getSum = 22},Max {getMax = 7})hpredicate-typed similar to 1pz @(MConcat Id) [SG.Sum 44, SG.Sum 12, SG.Sum 3]PresentT (Sum {getSum = 59})hpz @(Map '(Pure SG.Sum Id, Pure SG.Max Id) Id >> MConcat Id) [7 :: Int,6,1,3,5] -- monoid so need eg Int-PresentT (Sum {getSum = 22},Max {getMax = 7})ipredicate-typed8semigroup append both sides of a tuple (ie uncurry (<>))&pz @(Snd Id >> SapA) (4,("abc","def"))PresentT "abcdef"jpredicate-typed?semigroup append both sides of a tuple (ie uncurry (<>)) using )pl @(SapA' (SG.Sum _) >> Unwrap Id) (4,5)!Present 9 ((>>) 9 | {getSum = 9}) PresentT 9kpredicate-typed similar to $pz @(Fst Id <> Snd Id) ("abc","def")PresentT "abcdef" pz @("abcd" <> "ef" <> Id) "ghi"PresentT "abcdefghi" pz @("abcd" <> "ef" <> Id) "ghi"PresentT "abcdefghi"/pz @(Wrap (SG.Sum _) Id <> FromInteger _ 10) 13PresentT (Sum {getSum = 23})3pz @(Wrap (SG.Product _) Id <> FromInteger _ 10) 13%PresentT (Product {getProduct = 130})9pz @('(FromInteger _ 10,"def") <> Id) (SG.Sum 12, "_XYZ")&PresentT (Sum {getSum = 22},"def_XYZ")pz @(SapA' (SG.Max _)) (10,12)PresentT (Max {getMax = 12})pz @(SapA' (SG.Sum _)) (10,12)PresentT (Sum {getSum = 22}))pl @((Id <> Id) >> Unwrap Id) (SG.Sum 12)$Present 24 ((>>) 24 | {getSum = 24}) PresentT 24 abcdefghijk khgaijcdbefk6None%&',-.=>?@AHPSUVX_k ?.wpredicate-typed similar to pz @Max [10,4,5,12,3,4] PresentT 12 pz @Max []FailT "empty list"xpredicate-typed similar to pz @Min [10,4,5,12,3,4] PresentT 3 pz @Min []FailT "empty list"ypredicate-typed similar to pz @Product [10,4,5,12,3,4]PresentT 28800pz @Product [] PresentT 1zpredicate-typed similar to @pz @Sum [10,4,5,12,3,4] PresentT 38 pz @Sum [] PresentT 0{predicate-typed similar to pz @(EmptyT Maybe Id) ()PresentT Nothingpz @(EmptyT [] Id) () PresentT []%pz @(EmptyT [] (Char1 "x")) (13,True) PresentT ""/pz @(EmptyT (Either String) (Fst Id)) (13,True)PresentT (Left "")|predicate-typed"zip two lists with the same lengthpl @(Zip '[1,2,3] "abc") ()WPresent [(1,'a'),(2,'b'),(3,'c')] (Zip [(1,'a'),(2,'b'),(3,'c')] | p=[1,2,3] | q="abc")"PresentT [(1,'a'),(2,'b'),(3,'c')]pl @(Zip '[1,2,3] "ab") ()3Error Zip(3,2) length mismatch (p=[1,2,3] | q="ab") FailT "Zip(3,2) length mismatch"pl @(Zip '[1,2] "abc") ()2Error Zip(2,3) length mismatch (p=[1,2] | q="abc") FailT "Zip(2,3) length mismatch"pl @(Zip "abc" Id) [1..7]<Error Zip(3,7) length mismatch (p="abc" | q=[1,2,3,4,5,6,7]) FailT "Zip(3,7) length mismatch"}predicate-typed4zip two lists optionally padding the right hand side(pl @(ZipR (Char1 "Z") '[1,2,3] "abc") ()XPresent [(1,'a'),(2,'b'),(3,'c')] (ZipR [(1,'a'),(2,'b'),(3,'c')] | p=[1,2,3] | q="abc")"PresentT [(1,'a'),(2,'b'),(3,'c')]'pl @(ZipR (Char1 "Z") '[1,2,3] "ab") ()WPresent [(1,'a'),(2,'b'),(3,'Z')] (ZipR [(1,'a'),(2,'b'),(3,'Z')] | p=[1,2,3] | q="ab")"PresentT [(1,'a'),(2,'b'),(3,'Z')]&pl @(ZipR (Char1 "Z") '[1,2,3] "a") ()VPresent [(1,'a'),(2,'Z'),(3,'Z')] (ZipR [(1,'a'),(2,'Z'),(3,'Z')] | p=[1,2,3] | q="a")"PresentT [(1,'a'),(2,'Z'),(3,'Z')]&pl @(ZipR (Char1 "Z") '[1,2] "abc") ():Error ZipR(2,3) rhs would be truncated (p=[1,2] | q="abc")(FailT "ZipR(2,3) rhs would be truncated".pl @(ZipR (Char1 "Y") (EmptyT _ Id) Id) "abcd"8Error ZipR(0,4) rhs would be truncated (p=[] | q="abcd")(FailT "ZipR(0,4) rhs would be truncated"~predicate-typed3zip two lists optionally padding the left hand sidepl @(ZipL 99 '[1,2,3] "abc") ()XPresent [(1,'a'),(2,'b'),(3,'c')] (ZipL [(1,'a'),(2,'b'),(3,'c')] | p=[1,2,3] | q="abc")"PresentT [(1,'a'),(2,'b'),(3,'c')]pl @(ZipL 99 '[1,2] "abc") ()XPresent [(1,'a'),(2,'b'),(99,'c')] (ZipL [(1,'a'),(2,'b'),(99,'c')] | p=[1,2] | q="abc")#PresentT [(1,'a'),(2,'b'),(99,'c')]pl @(ZipL 99 '[1] "abc") ()XPresent [(1,'a'),(99,'b'),(99,'c')] (ZipL [(1,'a'),(99,'b'),(99,'c')] | p=[1] | q="abc")$PresentT [(1,'a'),(99,'b'),(99,'c')]pl @(ZipL 99 '[1,2,3] "ab") ();Error ZipL(3,2) rhs would be truncated (p=[1,2,3] | q="ab")(FailT "ZipL(3,2) rhs would be truncated"!pl @(ZipL 99 Id "abcdefg") [1..4]Present [(1,'a'),(2,'b'),(3,'c'),(4,'d'),(99,'e'),(99,'f'),(99,'g')] (ZipL [(1,'a'),(2,'b'),(3,'c'),(4,'d'),(99,'e'),(99,'f'),(99,'g')] | p=[1,2,3,4] | q="abcdefg")EPresentT [(1,'a'),(2,'b'),(3,'c'),(4,'d'),(99,'e'),(99,'f'),(99,'g')]7pl @(ZipL (99 % 4) '[1 % 1 , 2 % 1 , 3 % 1] Id) "abcde"Present [(1 % 1,'a'),(2 % 1,'b'),(3 % 1,'c'),(99 % 4,'d'),(99 % 4,'e')] (ZipL [(1 % 1,'a'),(2 % 1,'b'),(3 % 1,'c'),(99 % 4,'d'),(99 % 4,'e')] | p=[1 % 1,2 % 1,3 % 1] | q="abcde")HPresentT [(1 % 1,'a'),(2 % 1,'b'),(3 % 1,'c'),(99 % 4,'d'),(99 % 4,'e')]2pl @(ZipL "X" (EmptyT _ Id) Id) ("abcd" :: String)tPresent [("X",'a'),("X",'b'),("X",'c'),("X",'d')] (ZipL [("X",'a'),("X",'b'),("X",'c'),("X",'d')] | p=[] | q="abcd")2PresentT [("X",'a'),("X",'b'),("X",'c'),("X",'d')]predicate-typed<Zip two lists to their maximum length using optional padding=pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abc", [1..5])2PresentT [('a',1),('b',2),('c',3),('Z',4),('Z',5)]Apz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcdefg", [1..5])DPresentT [('a',1),('b',2),('c',3),('d',4),('e',5),('f',99),('g',99)]?pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcde", [1..5])2PresentT [('a',1),('b',2),('c',3),('d',4),('e',5)]:pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("", [1..5])2PresentT [('Z',1),('Z',2),('Z',3),('Z',4),('Z',5)];pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcde", [])7PresentT [('a',99),('b',99),('c',99),('d',99),('e',99)]predicate-typedlike 5pz @(ZipWith Id (1...5) (Char1 "a" ... Char1 "e")) ()2PresentT [(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e')]Upz @(ZipWith (ShowP (Fst Id) <> ShowP (Snd Id)) (1...5) (Char1 "a" ... Char1 "e")) ()-PresentT ["1'a'","2'b'","3'c'","4'd'","5'e'"]Npz @(ZipWith (MkThese (Fst Id) (Snd Id)) (1...6) (Char1 "a" ... Char1 "f")) ()RPresentT [These 1 'a',These 2 'b',These 3 'c',These 4 'd',These 5 'e',These 6 'f']Jpz @(ZipWith (MkThese (Fst Id) (Snd Id)) '[] (Char1 "a" ... Char1 "f")) ()$FailT "ZipWith(0,6) length mismatch"Npz @(ZipWith (MkThese (Fst Id) (Snd Id)) (1...3) (Char1 "a" ... Char1 "f")) ()$FailT "ZipWith(3,6) length mismatch"predicate-typed(creates an empty list for the given typepz @(Id :+ EmptyList _) 99 PresentT [99]predicate-typed creates a singleton from a value pz @(Singleton (Char1 "aBc")) () PresentT "a"pz @(Singleton Id) FalsePresentT [False](pz @(Singleton (Snd Id)) (False,"hello")PresentT ["hello"]predicate-typedreverses using pz @ReverseL (T.pack "AbcDeF")PresentT "FeDcbA"!pz @ReverseL ("AbcDeF" :: String)PresentT "FeDcbA"pl @ReverseL ("asfd" :: T.Text))Present "dfsa" (ReverseL "dfsa" | "asfd")PresentT "dfsa"predicate-typed similar to pz @Reverse [1,2,4]PresentT [4,2,1]pz @Reverse "AbcDeF"PresentT "FeDcbA"predicate-typed but descending order%pl @(SortOnDesc Id Id) [10,4,2,12,14].Present [14,12,10,4,2] (SortBy [14,12,10,4,2])PresentT [14,12,10,4,2]Cpl @(SortOnDesc (Fst Id) (Snd Id)) ((),[('z',1),('a',10),('m',22)])HPresent [('z',1),('m',22),('a',10)] (SortBy [('z',1),('m',22),('a',10)])$PresentT [('z',1),('m',22),('a',10)]predicate-typed similar to !pl @(SortOn Id Id) [10,4,2,12,14].Present [2,4,10,12,14] (SortBy [2,4,10,12,14])PresentT [2,4,10,12,14]*pl @(SortOn (Negate Id) Id) [10,4,2,12,14].Present [14,12,10,4,2] (SortBy [14,12,10,4,2])PresentT [14,12,10,4,2]8pl @(SortOn (Fst Id) Id) (zip "cabdaz" [10,4,2,12,14,1])zPresent [('a',4),('a',14),('b',2),('c',10),('d',12),('z',1)] (SortBy [('a',4),('a',14),('b',2),('c',10),('d',12),('z',1)])=PresentT [('a',4),('a',14),('b',2),('c',10),('d',12),('z',1)]-pl @(SortOn (FailS "asdf") Id) [10,4,2,12,14]Error asdf(4) (SortBy)FailT "asdf(4)"Hpl @(SortOn (Snd Id) (Snd Id)) ((),[('z',14),('a',10),('m',22),('a',1)])ZPresent [('a',1),('a',10),('z',14),('m',22)] (SortBy [('a',1),('a',10),('z',14),('m',22)])-PresentT [('a',1),('a',10),('z',14),('m',22)]?pl @(SortOn (Fst Id) (Snd Id)) ((),[('z',1),('a',10),('m',22)])HPresent [('a',10),('m',22),('z',1)] (SortBy [('a',10),('m',22),('z',1)])$PresentT [('a',10),('m',22),('z',1)]Epl @(SortOn (Fst Id) Id) [('z',1),('a',10),('m',22),('a',9),('m',10)]jPresent [('a',10),('a',9),('m',22),('m',10),('z',1)] (SortBy [('a',10),('a',9),('m',22),('m',10),('z',1)])5PresentT [('a',10),('a',9),('m',22),('m',10),('z',1)]?pl @(SortOn Id Id) [('z',1),('a',10),('m',22),('a',9),('m',10)]jPresent [('a',9),('a',10),('m',10),('m',22),('z',1)] (SortBy [('a',9),('a',10),('m',10),('m',22),('z',1)])5PresentT [('a',9),('a',10),('m',10),('m',22),('z',1)]predicate-typed sort a listOpz @(SortOn (Fst Id) Id) [(10,"abc"), (3,"def"), (4,"gg"), (10,"xyz"), (1,"z")];PresentT [(1,"z"),(3,"def"),(4,"gg"),(10,"abc"),(10,"xyz")]Gpz @(SortBy (OrdP (Snd Id) (Fst Id)) Id) [(10,"ab"),(4,"x"),(20,"bbb")]'PresentT [(20,"bbb"),(10,"ab"),(4,"x")]!pz @(SortBy 'LT Id) [1,5,2,4,7,0]PresentT [1,5,2,4,7,0]!pz @(SortBy 'GT Id) [1,5,2,4,7,0]PresentT [0,7,4,2,5,1]pz @(SortBy ((Fst (Fst Id) ==! Fst (Snd Id)) <> (Snd (Fst Id) ==! Snd (Snd Id))) Id) [(10,"ab"),(4,"x"),(20,"bbb"),(4,"a"),(4,"y")]7PresentT [(4,"a"),(4,"x"),(4,"y"),(10,"ab"),(20,"bbb")]pz @(SortBy ((Fst (Fst Id) ==! Fst (Snd Id)) <> (Snd (Snd Id) ==! Snd (Fst Id))) Id) [(10,"ab"),(4,"x"),(20,"bbb"),(4,"a"),(4,"y")]7PresentT [(4,"y"),(4,"x"),(4,"a"),(10,"ab"),(20,"bbb")]Npl @(SortBy (Swap >> OrdA (Fst Id)) (Snd Id)) ((),[('z',1),('a',10),('m',22)])HPresent [('z',1),('m',22),('a',10)] (SortBy [('z',1),('m',22),('a',10)])$PresentT [('z',1),('m',22),('a',10)]4pl @(SortBy (OrdA Reverse) Id) ["az","by","cx","aa"]<Present ["aa","cx","by","az"] (SortBy ["aa","cx","by","az"])PresentT ["aa","cx","by","az"]ypl @(SortBy (If (Fst Id==5 && Snd Id==3) (Failt _ (PrintT "pivot=%d value=%d" Id)) 'GT) (Snd Id)) ((), [5,7,3,1,6,2,1,3])!Error pivot=5 value=3(2) (SortBy)FailT "pivot=5 value=3(2)"pl @(SortBy (If (Fst Id==50 && Snd Id==3) (Failt _ (PrintT "pivot=%d value=%d" Id)) (OrdA Id)) (Snd Id)) ((), [5,7,3,1,6,2,1,3])4Present [1,1,2,3,3,5,6,7] (SortBy [1,1,2,3,3,5,6,7])PresentT [1,1,2,3,3,5,6,7]predicate-typed equivalent4pz @Unzip3 (zip3 [1..5] "abcd" (cycle [True,False]))3PresentT ([1,2,3,4],"abcd",[True,False,True,False])predicate-typed equivalentpz @Unzip (zip [1..5] "abcd")PresentT ([1,2,3,4],"abcd")predicate-typed4takes the init of a list-like container: similar to pz @(Init Id) "abcd"PresentT "abc"pz @(Init Id) (T.pack "abcd")PresentT "abc"pz @(Init Id) []FailT "Init(empty)"pl @(Init Id) [1..5]0Present [1,2,3,4] (Init [1,2,3,4] | [1,2,3,4,5])PresentT [1,2,3,4]pl @(Init Id) ([] :: [()])Error Init(empty)FailT "Init(empty)"predicate-typed4takes the last of a list-like container: similar to pz @(Last Id) "abcd" PresentT 'd'pz @(Last Id) []FailT "Last(empty)"pl @(Last Id) [1,2,3]Present 3 (Last 3 | [1,2,3]) PresentT 3predicate-typed4takes the tail of a list-like container: similar to pz @(Tail Id) "abcd"PresentT "bcd"pl @(Tail Id) [1..5]0Present [2,3,4,5] (Tail [2,3,4,5] | [1,2,3,4,5])PresentT [2,3,4,5]pl @(Tail Id) ([] :: [()])Error Tail(empty)FailT "Tail(empty)"predicate-typed4takes the head of a list-like container: similar to pz @(Head Id) "abcd" PresentT 'a'pz @(Head Id) []FailT "Head(empty)"pl @(Head Id) ([] :: [Int])Error Head(empty)FailT "Head(empty)"pl @(Head Id) ([] :: [Double])Error Head(empty)FailT "Head(empty)"-pl @(Head (Fst Id) >> Le 6) ([]::[Int], True)#Error Head(empty) ((>>) lhs failed)FailT "Head(empty)"pl @(Head Id) [1,2,3]Present 1 (Head 1 | [1,2,3]) PresentT 1predicate-typed1filters a list 'q' removing those elements in 'p'#pz @(Remove '[5] '[1,5,5,2,5,2]) ()PresentT [1,2,2])pz @(Remove '[0,1,1,5] '[1,5,5,2,5,2]) ()PresentT [2,2]$pz @(Remove '[99] '[1,5,5,2,5,2]) ()PresentT [1,5,5,2,5,2]'pz @(Remove '[99,91] '[1,5,5,2,5,2]) ()PresentT [1,5,5,2,5,2]!pz @(Remove Id '[1,5,5,2,5,2]) []PresentT [1,5,5,2,5,2]Fpz @(Remove '[] '[1,5,5,2,5,2]) 44 -- works if you make this a number!PresentT [1,5,5,2,5,2]predicate-typed0filters a list 'q' keeping those elements in 'p'!pz @(Keep '[5] '[1,5,5,2,5,2]) ()PresentT [5,5,5]'pz @(Keep '[0,1,1,5] '[1,5,5,2,5,2]) ()PresentT [1,5,5,5]predicate-typed6splits a list pointed to by 'p' into lists of size 'n'pz @(ChunksOf 2 Id) "abcdef"PresentT ["ab","cd","ef"]pz @(ChunksOf 2 Id) "abcdefg"PresentT ["ab","cd","ef","g"]pz @(ChunksOf 2 Id) "" PresentT []pz @(ChunksOf 2 Id) "a"PresentT ["a"]predicate-typed similar to  pz @(SplitAt 4 Id) "hello world"PresentT ("hell","o world")!pz @(SplitAt 20 Id) "hello world"PresentT ("hello world","") pz @(SplitAt 0 Id) "hello world"PresentT ("","hello world")1pz @(SplitAt (Snd Id) (Fst Id)) ("hello world",4)PresentT ("hell","o world"))pz @(SplitAt (Negate 2) Id) "hello world"PresentT ("hello wor","ld")Kpl @(Snd Id >> SplitAt 2 Id >> Len *** Len >> Fst Id > Snd Id) ('x',[1..5])False ((>>) False | {2 > 3})FalseTpredicate-typedIsplit a list 'p' into parts using the lengths in the type level list 'ns'*pz @(SplitAts '[2,3,1,1] Id) "hello world"$PresentT ["he","llo"," ","w","orld"]$pz @(SplitAts '[2] Id) "hello world"PresentT ["he","llo world"]+pz @(SplitAts '[10,1,1,5] Id) "hello world"!PresentT ["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])-PresentT [[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]ZPresent [[1,2,3],[4]] ((>>) [[1,2,3],[4]] | {Fst [[1,2,3],[4]] | ([[1,2,3],[4]],[[],[]])})PresentT [[1,2,3],[4]]predicate-typed&right pad 'q' with 'n' values from 'p'pl @(PadR 5 8 Id) [1..3]8Present [1,2,3,8,8] (PadR 5 pad=8 [1,2,3,8,8] | [1,2,3])PresentT [1,2,3,8,8]pl @(PadR 5 0 Id) [1..5]<Present [1,2,3,4,5] (PadR 5 pad=0 [1,2,3,4,5] | [1,2,3,4,5])PresentT [1,2,3,4,5]pl @(PadR 5 0 Id) [1..6]BPresent [1,2,3,4,5,6] (PadR 5 pad=0 [1,2,3,4,5,6] | [1,2,3,4,5,6])PresentT [1,2,3,4,5,6]predicate-typed%left pad 'q' with 'n' values from 'p'pl @(PadL 5 0 Id) [1..3]8Present [0,0,1,2,3] (PadL 5 pad=0 [0,0,1,2,3] | [1,2,3])PresentT [0,0,1,2,3]pz @(PadL 5 999 Id) [12,13]PresentT [999,999,999,12,13](pz @(PadR 5 (Fst Id) '[12,13]) (999,'x')PresentT [12,13,999,999,999]+pz @(PadR 2 (Fst Id) '[12,13,14]) (999,'x')PresentT [12,13,14]pl @(PadL 10 0 Id) [1..3]MPresent [0,0,0,0,0,0,0,1,2,3] (PadL 10 pad=0 [0,0,0,0,0,0,0,1,2,3] | [1,2,3])PresentT [0,0,0,0,0,0,0,1,2,3]predicate-typedsplit a list into single valuespz @(Ones Id) [4,8,3,9]PresentT [[4],[8],[3],[9]]pz @(Ones Id) [] PresentT []predicate-typed similar to pz @Tails [4,8,3,9])PresentT [[4,8,3,9],[8,3,9],[3,9],[9],[]] pz @Tails [] PresentT [[]]pl @Tails "abcd"NPresent ["abcd","bcd","cd","d",""] (Tails ["abcd","bcd","cd","d",""] | "abcd")#PresentT ["abcd","bcd","cd","d",""]predicate-typed similar to pz @Inits [4,8,3,9])PresentT [[],[4],[4,8],[4,8,3],[4,8,3,9]] pz @Inits [] PresentT [[]]predicate-typed function+pz @(Elem (Fst Id) (Snd Id)) ('x',"abcdxy")TrueT+pz @(Elem (Fst Id) (Snd Id)) ('z',"abcdxy")FalseTpl @(Elem Id '[2,3,4]) 2True (2 `elem` [2,3,4])TrueTpl @(Elem Id '[2,3,4]) 6False (6 `elem` [2,3,4])FalseTpl @(Elem Id '[13 % 2]) 6.5True (13 % 2 `elem` [13 % 2])TrueT#pl @(Elem Id '[13 % 2, 12 % 1]) 6.5$True (13 % 2 `elem` [13 % 2,12 % 1])TrueT!pl @(Elem Id '[13 % 2, 12 % 1]) 6$False (6 % 1 `elem` [13 % 2,12 % 1])FalseTpredicate-typedintercalate two lists;pz @(Intercalate '["aB"] '["xxxx","yz","z","www","xyz"]) ():PresentT ["xxxx","aB","yz","aB","z","aB","www","aB","xyz"]-pz @(Intercalate '[W 99,Negate 98] Id) [1..5]0PresentT [1,99,-98,2,99,-98,3,99,-98,4,99,-98,5]%pz @(Intercalate '[99,100] Id) [1..5]0PresentT [1,99,100,2,99,100,3,99,100,4,99,100,5]=pl @(Intercalate (Fst Id) (Snd Id)) ([0,1], [12,13,14,15,16])rPresent [12,0,1,13,0,1,14,0,1,15,0,1,16] (Intercalate [12,0,1,13,0,1,14,0,1,15,0,1,16] | [0,1] | [12,13,14,15,16]))PresentT [12,0,1,13,0,1,14,0,1,15,0,1,16]Upl @((Pure [] (Negate Len) &&& Id) >> Intercalate (Fst Id) (Snd Id)) [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]})%PresentT [12,-5,13,-5,14,-5,15,-5,16]predicate-typed similar to pl @(Span (Lt 4) Id) [1..11]7Present ([1,2,3],[4,5,6,7,8,9,10,11]) (Break cnt=(3,8))&PresentT ([1,2,3],[4,5,6,7,8,9,10,11])predicate-typed similar to (pz @(Break (Ge 3) Id) [10,4,1,7,3,1,3,5] PresentT ([],[10,4,1,7,3,1,3,5])(pz @(Break (Lt 3) Id) [10,4,1,7,3,1,3,5]PresentT ([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))&PresentT ([1,2],[3,4,5,6,7,8,9,10,11])Kpl @(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))PresentT ([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))PresentT ([1,2],[3,4,5,6,7,8])9pl @(Break (If (Gt 2) (Failt _ "ASfd") 'False) Id) [1..8]#Error ASfd (Break predicate failed) FailT "ASfd"Gpl @(Break (Snd Id) Id) (zip [1..] [False,False,False,True,True,False])YPresent ([(1,False),(2,False),(3,False)],[(4,True),(5,True),(6,False)]) (Break cnt=(3,3))HPresentT ([(1,False),(2,False),(3,False)],[(4,True),(5,True),(6,False)])=pl @(Break (Snd Id) Id) (zip [1..] [False,False,False,False])HPresent ([(1,False),(2,False),(3,False),(4,False)],[]) (Break cnt=(4,0))7PresentT ([(1,False),(2,False),(3,False),(4,False)],[])9pl @(Break (Snd Id) Id) (zip [1..] [True,True,True,True])DPresent ([],[(1,True),(2,True),(3,True),(4,True)]) (Break cnt=(0,4))3PresentT ([],[(1,True),(2,True),(3,True),(4,True)])predicate-typed similar to 3pz @(GroupBy (Fst Id == Snd Id) Id) [1,3,4,5,1,5,5]$PresentT [[1],[3],[4],[5],[1],[5,5]]7pz @(GroupBy (Fst Id == Snd Id) Id) [1,1,1,3,4,5,1,5,5](PresentT [[1,1,1],[3],[4],[5],[1],[5,5]])pz @(GroupBy (Fst Id == Snd Id) Id) [5,5]PresentT [[5,5]])pz @(GroupBy (Fst Id == Snd Id) Id) [1,2]PresentT [[1],[2]]'pz @(GroupBy (Fst Id == Snd Id) Id) [1]PresentT [[1]]&pz @(GroupBy (Fst Id == Snd Id) Id) [] PresentT []2pz @(GroupBy (Fst Id < Snd Id) Id) [1,2,3,4,4,1,2]PresentT [[1,2,3,4],[4],[1,2]]3pz @(GroupBy (Fst Id /= Snd Id) Id) [1,2,3,4,4,4,1]PresentT [[1,2,3,4],[4],[4,1]]7pan @(GroupBy (Fst Id == Snd Id) Id) "hello goodbye""<P GroupBy ["h","e","ll","o"," ","g","oo","d","b","y","e"]|+- P Id "hello goodbye"|+- False i=0: 'h' == 'e'|+- False i=1: 'e' == 'l'|+- True i=2: 'l' == 'l'|+- False i=3: 'l' == 'o'|+- False i=4: 'o' == ' '|+- True i=5: ' ' == ' '|+- True i=6: ' ' == ' '|+- True i=7: ' ' == ' '|+- False i=8: ' ' == 'g'|+- False i=9: 'g' == 'o'|+- True i=10: 'o' == 'o'|+- False i=11: 'o' == 'd'|+- False i=12: 'd' == 'b'|+- False i=13: 'b' == 'y'|`- False i=14: 'y' == 'e';PresentT ["h","e","ll","o"," ","g","oo","d","b","y","e"]predicate-typed$partition values based on a functionfpz @(PartitionBy Ordering (Case 'EQ '[Id < 0, Id > 0] '[ 'LT, 'GT] Id) Id) [-4,-2,5,6,7,0,-1,2,-3,4,0]DPresentT (fromList [(LT,[-3,-1,-2,-4]),(EQ,[0,0]),(GT,[4,2,7,6,5])])zpl @(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])=PresentT (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]<Error xyzxyzxyzzyyysyfsyfydf (PartitionBy(i=7, a=3) excnt=1)FailT "xyzxyzxyzzyyysyfsyfydf"predicate-typed similar to ,pz @(Partition (Ge 3) Id) [10,4,1,7,3,1,3,5]PresentT ([10,4,7,3,3,5],[1,1])0pz @(Partition (Prime Id) Id) [10,4,1,7,3,1,3,5]PresentT ([7,3,3,5],[10,4,1,1]).pz @(Partition (Ge 300) Id) [10,4,1,7,3,1,3,5] PresentT ([],[10,4,1,7,3,1,3,5])0pz @(Partition (Id < 300) Id) [10,4,1,7,3,1,3,5] PresentT ([10,4,1,7,3,1,3,5],[])+pl @(Partition (Lt 2) Id >> Id) [1,2,3,4,5]EPresent ([1],[2,3,4,5]) ((>>) ([1],[2,3,4,5]) | {Id ([1],[2,3,4,5])})PresentT ([1],[2,3,4,5])!pl @(Partition (Gt 3) Id) [1..10]dPresent ([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])#PresentT ([4,5,6,7,8,9,10],[1,2,3])pl @(Partition Even Id) [1..6]IPresent ([2,4,6],[1,3,5]) (Partition ([2,4,6],[1,3,5]) | s=[1,2,3,4,5,6])PresentT ([2,4,6],[1,3,5])Hpl @(Partition Even Id >> Null *** (Len > 4) >> Fst Id == Snd Id) [1..6]#True ((>>) True | {False == False})TrueT@pl @(Partition (ExitWhen "ExitWhen" (Gt 10) >> Gt 2) Id) [1..11].Error ExitWhen (Partition(i=10, a=11) excnt=1)FailT "ExitWhen"%pl @(Partition (Prime Id) 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])2PresentT ([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]PresentT [1,2,3,4]$pz @(Rotate (Negate 1) Id) [1,2,3,4]PresentT [4,1,2,3]pz @(Rotate 2 Id) [1,2,3,4]PresentT [3,4,1,2]'pz @(Map (Rotate Id "abcd") Id) [-3..7]WPresentT ["bcda","cdab","dabc","abcd","bcda","cdab","dabc","abcd","bcda","cdab","dabc"]predicate-typed similar to pz @Unsnoc [1,2,3,4]PresentT (Just ([1,2,3],4)) pz @Unsnoc []PresentT Nothingpz @Unsnoc ("xyz" :: T.Text)PresentT (Just ("xy",'z'))pl @Unsnoc ("asfd" :: T.Text);Present Just ("asf",'d') (Unsnoc Just ("asf",'d') | "asfd")PresentT (Just ("asf",'d'))pl @Unsnoc ("" :: T.Text)%Present Nothing (Unsnoc Nothing | "")PresentT Nothingpl @Unsnoc [1..5]DPresent Just ([1,2,3,4],5) (Unsnoc Just ([1,2,3,4],5) | [1,2,3,4,5])PresentT (Just ([1,2,3,4],5))predicate-typed similar to pz @Uncons [1,2,3,4]PresentT (Just (1,[2,3,4])) pz @Uncons []PresentT Nothingpz @Uncons (Seq.fromList "abc")#PresentT (Just ('a',fromList "bc"))pz @Uncons ("xyz" :: T.Text)PresentT (Just ('x',"yz"))pl @Uncons ("asfd" :: T.Text);Present Just ('a',"sfd") (Uncons Just ('a',"sfd") | "asfd")PresentT (Just ('a',"sfd"))pl @Uncons ("" :: T.Text)%Present Nothing (Uncons Nothing | "")PresentT NothingKpl @Uncons [1..5] -- with Typeable would need to specify the type of [1..5]DPresent Just (1,[2,3,4,5]) (Uncons Just (1,[2,3,4,5]) | [1,2,3,4,5])PresentT (Just (1,[2,3,4,5]))predicate-typedsimilar to snoc%pz @(Snd Id +: Fst Id) (99,[1,2,3,4])PresentT [1,2,3,4,99]pz @(Fst Id +: Snd Id) ([],5) PresentT [5]pz @(EmptyT [] Id +: 5) 5 PresentT [5]pl @('[1,2,3] +: 4) ()4Present [1,2,3,4] ((+:) [1,2,3,4] | p=[1,2,3] | q=4)PresentT [1,2,3,4]"pl @(Snd Id +: Fst Id) (4,[1,2,3])4Present [1,2,3,4] ((+:) [1,2,3,4] | p=[1,2,3] | q=4)PresentT [1,2,3,4]pl @("abc" +: Char1 "x") ().Present "abcx" ((+:) "abcx" | p="abc" | q='x')PresentT "abcx",pl @(Fst Id +: Snd Id) ("abc" :: T.Text,'x').Present "abcx" ((+:) "abcx" | p="abc" | q='x')PresentT "abcx"predicate-typedsimilar to cons%pz @(Fst Id :+ Snd Id) (99,[1,2,3,4])PresentT [99,1,2,3,4]pz @(Snd Id :+ Fst Id) ([],5) PresentT [5]$pz @(123 :+ EmptyList _) "somestuff"PresentT [123].pl @(FlipT (:+) (Fst Id) (Snd Id)) ([1..5],99)CPresent [99,1,2,3,4,5] ((:+) [99,1,2,3,4,5] | p=99 | q=[1,2,3,4,5])PresentT [99,1,2,3,4,5]"pl @(Fst Id :+ Snd Id) (99,[1..5])CPresent [99,1,2,3,4,5] ((:+) [99,1,2,3,4,5] | p=99 | q=[1,2,3,4,5])PresentT [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])PresentT [4,1,2,3]"pl @(Fst Id :+ Snd Id) (4,[1,2,3])4Present [4,1,2,3] ((:+) [4,1,2,3] | p=4 | q=[1,2,3])PresentT [4,1,2,3]pl @(FlipT (:+) '[1,2,3] 5) ()4Present [5,1,2,3] ((:+) [5,1,2,3] | p=5 | q=[1,2,3])PresentT [5,1,2,3]predicate-typedsimilar to (++),pz @(Fst Id ++ Snd Id) ([9,10,11],[1,2,3,4])PresentT [9,10,11,1,2,3,4]pz @(Snd Id ++ Fst Id) ([],[5]) PresentT [5]+pz @(Char1 "xyz" :+ W "ab" ++ W "cdefg") ()PresentT "xabcdefg"(pz @([1,2,3] ++ EmptyList _) "somestuff"PresentT [1,2,3]3wxyz{|}~3{~}|zyxw555None&',-.=>?@AHSUVXk Z9predicate-typed%encode a json file with pretty optionpredicate-typedencode json with pretty option%pl @(EncodeJson 'False Id) (10,"def").Present "[10,\"def\"]" (EncodeJson [10,"def"])PresentT "[10,\"def\"]">pl @(EncodeJson 'False Id >> ParseJson (Int,Bool) Id) (1,True)BPresent (1,True) ((>>) (1,True) | {ParseJson (Int,Bool) (1,True)})PresentT (1,True)predicate-typed(parse a json file 'p' using the type 't'8pz @(ParseJsonFile [A.Value] "test1.json" >> Id !! 2) ()PresentT (Object (fromList [("lastName",String "Doe"),("age",Number 45.0),("firstName",String "John"),("likesPizza",Bool False)]))predicate-typed&parse json file 'p' using the type 't'predicate-typed"parse json data using the type 't'.pl @(ParseJson (Int,String) Id) "[10,\"abc\"]"6Present (10,"abc") (ParseJson (Int,[Char]) (10,"abc"))PresentT (10,"abc")1pl @(ParseJson (Int,String) Id) "[10,\"abc\",99]"Error ParseJson (Int,[Char])([10,"abc",...) Error in $ (Error in $: cannot unpack array of length 3 into a tuple of length 2 | [10,"abc",99]):FailT "ParseJson (Int,[Char])([10,\"abc\",...) Error in $"Cpl @(ParseJson (Int,Bool) (FromString _ Id)) ("[1,true]" :: String)0Present (1,True) (ParseJson (Int,Bool) (1,True))PresentT (1,True)1pl @(ParseJson (Int,Bool) Id) (A.encode (1,True))0Present (1,True) (ParseJson (Int,Bool) (1,True))PresentT (1,True) pl @(ParseJson () Id) "[1,true]"kError ParseJson ()([1,true]) Error in $ (Error in $: parsing () failed, expected an empty array | [1,true]))FailT "ParseJson ()([1,true]) Error in $"predicate-typed"parse json data using the type 't'None%&',-.=>?@AHSUVXk predicate-typedsimilar to a limited form of 'pz @(FoldMap (SG.Sum _) Id) [44, 12, 3] PresentT 59+pz @(FoldMap (SG.Product _) Id) [44, 12, 3] PresentT 1584type Ands' p = FoldMap SG.All p%pz @(Ands' Id) [True,False,True,True]PresentT Falsepz @(Ands' Id) [True,True,True] PresentT Truepz @(Ands' Id) [] PresentT Truetype Ors' p = FoldMap SG.Any p!pz @(Ors' Id) [False,False,False]PresentT Falsepz @(Ors' Id) []PresentT False&pz @(Ors' Id) [False,False,False,True] PresentT True4type AllPositive' = FoldMap SG.All (Map Positive Id) pz @AllPositive' [3,1,-5,10,2,3]PresentT False4type AllNegative' = FoldMap SG.All (Map Negative Id)"pz @AllNegative' [-1,-5,-10,-2,-3] PresentT True:set -XKindSignaturesZtype Max' (t :: Type) = FoldMap (SG.Max t) Id -- requires t be Bounded for monoid instancepz @(Max' Int) [10,4,5,12,3,4] PresentT 12(pl @(FoldMap (SG.Sum _) Id) [14,8,17,13]$Present 52 ((>>) 52 | {getSum = 52}) PresentT 52?pl @(FoldMap (SG.Max _) Id) [14 :: Int,8,17,13] -- cos Bounded!$Present 17 ((>>) 17 | {getMax = 17}) PresentT 17fpl @((Len >> (Elem Id '[4,7,1] || (Mod Id 3 >> Same 0))) || (FoldMap (SG.Sum _) Id >> Gt 200)) [1..20]True (False || True)TrueTfpl @((Len >> (Elem Id '[4,7,1] || (Mod Id 3 >> Same 0))) || (FoldMap (SG.Sum _) Id >> Gt 200)) [1..19]PFalse (False || False | ((>>) False | {1 == 0})}) || ((>>) False | {190 > 200}))FalseTapl @((Len >> (Elem Id '[4,7,1] || (Mod Id 3 >> Same 0))) || (FoldMap (SG.Sum _) Id >> Gt 200)) []True (True || False)TrueT[pl @((Len >> (Elem Id '[4,7,1] || (Mod Id 3 >> Same 0))) &&& FoldMap (SG.Sum _) Id) [1..20]$Present (False,210) (W '(False,210))PresentT (False,210)0pl @(FoldMap SG.Any Id) [False,False,True,False]*Present True ((>>) True | {getAny = True}) PresentT True0pl @(FoldMap SG.All Id) [False,False,True,False]-Present False ((>>) False | {getAll = False})PresentT False%pl @(FoldMap (SG.Sum _) Id) (Just 13)$Present 13 ((>>) 13 | {getSum = 13}) PresentT 13#pl @(FoldMap (SG.Sum _) Id) [1..10]$Present 55 ((>>) 55 | {getSum = 55}) PresentT 55predicate-typed similar to  using ypz @Null [1,2,3,4]FalseT pz @Null []TrueTpz @Null NothingTrueTpredicate-typed similar to "pz @(ToList' Id) ("aBc" :: String)PresentT "aBc"pz @(ToList' Id) (Just 14) PresentT [14]pz @(ToList' Id) Nothing PresentT [](pz @(ToList' Id) (Left ("xx" :: String)) PresentT [],pz @(ToList' Id) (These 12 ("xx" :: String))PresentT ["xx"]predicate-typed similar to pz @ToList "aBc"PresentT "aBc"pz @ToList (Just 14) PresentT [14]pz @ToList Nothing PresentT []pz @ToList (Left "xx") PresentT []pz @ToList (These 12 "xx")PresentT ["xx"]*pl @ToList (M.fromList $ zip [0..] "abcd")BPresent "abcd" (ToList fromList [(0,'a'),(1,'b'),(2,'c'),(3,'d')])PresentT "abcd"pl @ToList (Just 123)Present [123] (ToList Just 123)PresentT [123]/pl @ToList (M.fromList (zip ['a'..] [9,2,7,4]))EPresent [9,2,7,4] (ToList fromList [('a',9),('b',2),('c',7),('d',4)])PresentT [9,2,7,4]predicate-typed similar to  but for a fixed number 'n'pz @(Cycle 5 Id) [1,2]PresentT [1,2,1,2,1]predicate-typed similar to predicate-typed similar to 'pz @(Concat Id) ["abc","D","eF","","G"]PresentT "abcDeFG"3pz @(Concat (Snd Id)) ('x',["abc","D","eF","","G"])PresentT "abcDeFG"predicate-typedinvokes &requires the OverloadedLists extension:set -XOverloadedLists0pz @(FromListExt (M.Map _ _)) [(4,"x"),(5,"dd")]&PresentT (fromList [(4,"x"),(5,"dd")])predicate-typedinvokes ^run @('OMsg "Fred" ':# 'OLite ':# 'OColorOff) @(FromList (Set.Set Int) << '[2,1,5,5,2,5,2]) ()WFred >>> Present fromList [1,2,5] ((>>) fromList [1,2,5] | {FromList fromList [1,2,5]})PresentT (fromList [1,2,5])Epl @(FromList (M.Map _ _) >> I !! Char1 "y") [('x',True),('y',False)][Present False ((>>) False | {IxL('y') False | p=fromList [('x',True),('y',False)] | q='y'})PresentT FalseFpl @(FromList (M.Map _ _) >> Id !! Char1 "z") [('x',True),('y',False)]NError (!!) index not found (fromList [('x',True),('y',False)] (>>) rhs failed)FailT "(!!) index not found"predicate-typedinvokes ,pz @ToListExt (M.fromList [(1,'x'),(4,'y')])PresentT [(1,'x'),(4,'y')]pz @ToListExt (T.pack "abc")PresentT "abc"predicate-typed similar to $pz @(IToList _ Id) ("aBc" :: String)"PresentT [(0,'a'),(1,'B'),(2,'c')]%pl @(IToList _ Id) ("abcd" :: String)cPresent [(0,'a'),(1,'b'),(2,'c'),(3,'d')] (IToList(Int) [(0,'a'),(1,'b'),(2,'c'),(3,'d')] | "abcd")*PresentT [(0,'a'),(1,'b'),(2,'c'),(3,'d')]<pl @(IToList _ Id) (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')])*PresentT [(0,'a'),(1,'b'),(2,'c'),(3,'d')]pl @(IToList _ Id) [9,2,7,4]VPresent [(0,9),(1,2),(2,7),(3,4)] (IToList(Int) [(0,9),(1,2),(2,7),(3,4)] | [9,2,7,4])"PresentT [(0,9),(1,2),(2,7),(3,4)]7pl @(IToList _ Id) (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)])*PresentT [('a',9),('b',2),('c',7),('d',4)]pl @(IToList _ Id) (Just 234)6Present [((),234)] (IToList(()) [((),234)] | Just 234)PresentT [((),234)]$pl @(IToList _ Id) (Nothing @Double)%Present [] (IToList(()) [] | Nothing) PresentT []pl @(IToList _ Id) [1..5]dPresent [(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])(PresentT [(0,1),(1,2),(2,3),(3,4),(4,5)] pl @(IToList _ Id) ['a','b','c']RPresent [(0,'a'),(1,'b'),(2,'c')] (IToList(Int) [(0,'a'),(1,'b'),(2,'c')] | "abc")"PresentT [(0,'a'),(1,'b'),(2,'c')]predicate-typed similar to  using pz @IsEmpty [1,2,3,4]FalseTpz @IsEmpty []TrueTpz @IsEmpty LTFalseTpz @IsEmpty EQTrueT"pl @IsEmpty ("failed11" :: T.Text)False (IsEmpty | "failed11")FalseTpl @IsEmpty ("" :: T.Text)True (IsEmpty | "")TrueTpredicate-typed create a  list from a ypz @ToNEList []FailT "empty list"pz @ToNEList [1,2,3,4,5]PresentT (1 :| [2,3,4,5])None&',-.=>?@AHSUVXk + predicate-typedextract the value from a  or fail with the given message"pz @(JustFail "nope" Id) (Just 99) PresentT 99 pz @(JustFail "nope" Id) Nothing FailT "nope"Bpz @(JustFail (PrintF "oops=%d" (Snd Id)) (Fst Id)) (Nothing, 123)FailT "oops=123"Cpz @(JustFail (PrintF "oops=%d" (Snd Id)) (Fst Id)) (Just 'x', 123) PresentT 'x'predicate-typedextract the value from a - otherwise use the default value: similar to +A$pz @(JustDef (1 % 4) Id) (Just 20.4)PresentT (102 % 5) pz @(JustDef (1 % 4) Id) NothingPresentT (1 % 4)(pz @(JustDef (MEmptyT _) Id) (Just "xy") PresentT "xy"$pz @(JustDef (MEmptyT _) Id) Nothing PresentT ()-pz @(JustDef (MEmptyT (SG.Sum _)) Id) NothingPresentT (Sum {getSum = 0})pl @(JustDef 0 Id) (Just 123)Present 123 (JustDef Just) PresentT 123pl @(JustDef 0 Id) NothingPresent 0 (JustDef Nothing) PresentT 0pl @(JustDef 99 Id) (Just 12)Present 12 (JustDef Just) PresentT 12pl @(JustDef 99 Id) NothingPresent 99 (JustDef Nothing) PresentT 99"pl @(JustDef (99 -% 1) Id) Nothing#Present (-99) % 1 (JustDef Nothing)PresentT ((-99) % 1)0pl @(JustDef (MEmptyT _) Id) (Just (SG.Sum 123)))Present Sum {getSum = 123} (JustDef Just)PresentT (Sum {getSum = 123})2pl @(JustDef (MEmptyT _) Id) (Nothing @(SG.Sum _))*Present Sum {getSum = 0} (JustDef Nothing)PresentT (Sum {getSum = 0})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) 24PresentT (Just 24) pz @(MaybeBool (Id > 4) Id) (-5)PresentT Nothing predicate-typed similar to +B?pl @(CatMaybes Id) [Just 'a',Nothing,Just 'c',Just 'd',Nothing]2Present "acd" (Concat "acd" | ["a","","c","d",""])PresentT "acd" predicate-typedlike +C.pl @(MapMaybe (MaybeBool (Le 3) Id) Id) [1..5]6Present [1,2,3] (Concat [1,2,3] | [[1],[2],[3],[],[]])PresentT [1,2,3].pl @(MapMaybe (MaybeBool (Gt 3) Id) Id) [1..5]1Present [4,5] (Concat [4,5] | [[],[],[],[4],[5]])PresentT [4,5] predicate-typed similar to +Dpz @(IsNothing Id) (Just 123)FalseTpz @(IsNothing Id) NothingTrueT;pl @(Not (IsNothing Id) &&& ('Just Id >> Id + 12)) (Just 1) Present (True,13) (W '(True,13))PresentT (True,13):pl @(Not (IsNothing Id) &&& ('Just Id >> Id + 12)) NothingError 'Just(empty) (W '(,))FailT "'Just(empty)" predicate-typed similar to +Epz @(IsJust Id) NothingFalseTpz @(IsJust Id) (Just 'a')TrueT predicate-typed similar to +FRprovides a Proxy to the result of 'q' but does not provide the surrounding context8pz @(MaybeIn "foundnothing" (ShowP (Pred Id))) (Just 20) PresentT "19"7pz @(MaybeIn "found nothing" (ShowP (Pred Id))) NothingPresentT "found nothing">pl @(MaybeIn 'True Id) (Nothing @Bool) -- need @() else breaks$True (MaybeIn(Nothing) True | Proxy)TrueT.pl @(MaybeIn (Failt _ "failed4") Id) (Just 10)"Present 10 (MaybeIn(Just) 10 | 10) PresentT 10;pl @(MaybeIn 'False Id) (Nothing @Bool) -- breaks otherwise&False (MaybeIn(Nothing) False | Proxy)FalseT'pl @(MaybeIn MEmptyP Id) (Just [1,2,3])1Present [1,2,3] (MaybeIn(Just) [1,2,3] | [1,2,3])PresentT [1,2,3])pl @(MaybeIn MEmptyP Id) (Nothing @[Int])(Present [] (MaybeIn(Nothing) [] | Proxy) PresentT []0pl @(MaybeIn (Failp "err") (Succ Id)) (Just 116)%Present 117 (MaybeIn(Just) 117 | 116) PresentT 117)pl @(MaybeIn 99 (Succ Id)) (Nothing @Int)(Present 99 (MaybeIn(Nothing) 99 | Proxy) PresentT 997pl @(MaybeIn (Failp "someval") (Succ Id)) (Nothing @()) Error someval (MaybeIn(Nothing))FailT "someval"(pl @(MaybeIn 'True 'False) (Nothing @())$True (MaybeIn(Nothing) True | Proxy)TrueT&pl @(MaybeIn 'True 'False) (Just "aa")"False (MaybeIn(Just) False | "aa")FalseT:pl @(MaybeIn MEmptyP (Fst Id ==! Snd Id)) (Just ('x','z')))Present LT (MaybeIn(Just) LT | ('x','z')) PresentT LT@pl @(MaybeIn MEmptyP (Fst Id ==! Snd Id)) (Nothing @(Char,Char))(Present EQ (MaybeIn(Nothing) EQ | Proxy) PresentT EQ6pl @(MaybeIn (Failp "failed20") 'False) (Nothing @Int)!Error failed20 (MaybeIn(Nothing))FailT "failed20"Cpl @(MaybeIn ('False >> FailS "failed21") 'False) (Nothing @Double)!Error failed21 (MaybeIn(Nothing))FailT "failed21"-pl @(MaybeIn (Failp "err") Id) (Nothing @Int)Error err (MaybeIn(Nothing)) FailT "err",pl @(MaybeIn (Failp "err") Id) (Nothing @())Error err (MaybeIn(Nothing)) FailT "err"6pl @(MaybeIn MEmptyP Id) (Just (M.fromList [(1,'a')]))RPresent fromList [(1,'a')] (MaybeIn(Just) fromList [(1,'a')] | fromList [(1,'a')])PresentT (fromList [(1,'a')])1pl @(MaybeIn MEmptyP Id) (Nothing @(M.Map () ())):Present fromList [] (MaybeIn(Nothing) fromList [] | Proxy)PresentT (fromList [])4pl @(MaybeIn MEmptyP (Ones Id)) (Just @String "abc");Present ["a","b","c"] (MaybeIn(Just) ["a","b","c"] | "abc")PresentT ["a","b","c"]pl @(MaybeIn 99 Id) (Just 12)"Present 12 (MaybeIn(Just) 12 | 12) PresentT 12pl @(MaybeIn 99 Id) Nothing(Present 99 (MaybeIn(Nothing) 99 | Proxy) PresentT 99"pl @(MaybeIn (99 -% 1) Id) Nothing6Present (-99) % 1 (MaybeIn(Nothing) (-99) % 1 | Proxy)PresentT ((-99) % 1)#pl @(MaybeIn 123 Id) (Nothing @Int)*Present 123 (MaybeIn(Nothing) 123 | Proxy) PresentT 123pl @(MaybeIn 123 Id) (Just 9)Present 9 (MaybeIn(Just) 9 | 9) PresentT 9,pl @(Uncons >> MaybeIn '(1,MEmptyT _) Id) []@Present (1,[]) ((>>) (1,[]) | {MaybeIn(Nothing) (1,[]) | Proxy})PresentT (1,[])2pl @(MaybeIn MEmptyP (Ones (ShowP Id))) (Just 123)9Present ["1","2","3"] (MaybeIn(Just) ["1","2","3"] | 123)PresentT ["1","2","3"]9pl @(MaybeIn MEmptyP (Ones (ShowP Id))) (Nothing @String)(Present [] (MaybeIn(Nothing) [] | Proxy) PresentT []3pl @(MaybeIn MEmptyP (Ones Id)) (Just @String "ab")2Present ["a","b"] (MaybeIn(Just) ["a","b"] | "ab")PresentT ["a","b"]1pl @(MaybeIn MEmptyP (Ones Id)) (Nothing @String)(Present [] (MaybeIn(Nothing) [] | Proxy) PresentT []predicate-typedGH constructorpz @(MkJust Id) 44PresentT (Just 44)predicate-typed%constructs a Nothing for a given typepredicate-typed%constructs a Nothing for a given typepredicate-typed similar to +, pz @(Just' >> Succ Id) (Just 20) PresentT 21pz @(Just' >> Succ Id) NothingFailT "Just' found Nothing"            None&',-.=>?@AHSUVXk predicate-typedconvert a list to a 6-tuplepredicate-typedconvert a list to a 5-tuple predicate-typedconvert a list to a 4-tuple!predicate-typedconvert a list to a 3-tuple"predicate-typedconvert a list to a 2-tuple#predicate-typedtype operator version of $Vpl @((Id !!? Char1 "d") > MkJust 99 || Length Id <= 3) (M.fromList $ zip "abcd" [1..])7False (False || False | (Just 4 > Just 99) || (4 <= 3))FalseTUpz @((Id !!? Char1 "d") > MkJust 2 || Length Id <= 3) (M.fromList $ zip "abcd" [1..])TrueT$predicate-typed leveraging )pz @(Lookup Id 2) ["abc","D","eF","","G"]PresentT (Just "eF")*pz @(Lookup Id 20) ["abc","D","eF","","G"]PresentT NothingLpl @(FromList (M.Map _ _) >> Lookup Id (Char1 "y")) [('x',True),('y',False)]hPresent Just False ((>>) Just False | {Lookup('y') False | p=fromList [('x',True),('y',False)] | q='y'})PresentT (Just False)Lpl @(FromList (M.Map _ _) >> Lookup Id (Char1 "z")) [('x',True),('y',False)]8Present Nothing ((>>) Nothing | {Lookup('z') not found})PresentT NothingMpl @(FromList (M.Map _ _) >> Lookup Id %% Char1 "y") [('x',True),('y',False)]hPresent Just False ((>>) Just False | {Lookup('y') False | p=fromList [('x',True),('y',False)] | q='y'})PresentT (Just False),pl @(Lookup Id 1) [('x',14),('y',3),('z',5)]MPresent Just ('y',3) (Lookup(1) ('y',3) | p=[('x',14),('y',3),('z',5)] | q=1)PresentT (Just ('y',3))-pl @(Lookup Id 14) [('x',14),('y',3),('z',5)]&Present Nothing (Lookup(14) not found)PresentT Nothingpl @(Lookup "abcdef" 3) ()3Present Just 'd' (Lookup(3) 'd' | p="abcdef" | q=3)PresentT (Just 'd') pl @(Lookup '[1,2,3,4,5,6] 4) ()4Present Just 5 (Lookup(4) 5 | p=[1,2,3,4,5,6] | q=4)PresentT (Just 5)-pl @(FromList (M.Map _ _)) [(4,"x"),(5,"dd")]JPresent fromList [(4,"x"),(5,"dd")] (FromList fromList [(4,"x"),(5,"dd")])&PresentT (fromList [(4,"x"),(5,"dd")])%predicate-typed similar to IJ leveraging %pz @(Id !! 2) ["abc","D","eF","","G"] PresentT "eF"&pz @(Id !! 20) ["abc","D","eF","","G"]FailT "(!!) index not found"Fpz @(Id !! "eF") (M.fromList (flip zip [0..] ["abc","D","eF","","G"])) PresentT 2 pl @(Id !! 3) ("asfd" :: T.Text))Present 'd' (IxL(3) 'd' | p="asfd" | q=3) PresentT 'd' pl @(Id !! 4) ("asfd" :: T.Text)#Error (!!) index not found (IxL(4))FailT "(!!) index not found" pl @(Id !! MEmptyT _) (Just "a")-Present "a" (IxL(()) "a" | p=Just "a" | q=()) PresentT "a"Vpl @(Id !! MEmptyT _) (Nothing @()) -- had to add @() to keep this happy: ghci is fine$Error (!!) index not found (IxL(()))FailT "(!!) index not found"pl @(Id !! 0) ('a','b','c')0Present 'a' (IxL(0) 'a' | p=('a','b','c') | q=0) PresentT 'a''pl @(Id !! Failt _ "err") ('a','b','c')Error err (IxL) FailT "err"<pl @(Id !! "d") (M.fromList $ zip (map (:[]) "abcd") [0 ..])MPresent 3 (IxL("d") 3 | p=fromList [("a",0),("b",1),("c",2),("d",3)] | q="d") PresentT 3vpl @(Id !! Head "d") (M.fromList $ zip "abcd" [0 ..]) -- had to String (instead of _) to keep this happy: ghci is fineMPresent 3 (IxL('d') 3 | p=fromList [('a',0),('b',1),('c',2),('d',3)] | q='d') PresentT 3kpl @(Id !! Head "d") (Set.fromList "abcd") -- had to String (instead of _) to keep this happy: ghci is fine4Present () (IxL('d') () | p=fromList "abcd" | q='d') PresentT ()ypl @(Id !! HeadFail "failedn" "e") (Set.fromList "abcd") -- had to String (instead of _) to keep this happy: ghci is fine%Error (!!) index not found (IxL('e'))FailT "(!!) index not found"_pl @(Id !! Head "d") (M.fromList $ zip "abcd" [0 ..]) -- use Char1 "d" instead of "d" >> HeadMPresent 3 (IxL('d') 3 | p=fromList [('a',0),('b',1),('c',2),('d',3)] | q='d') PresentT 3pl @(Id !! MEmptyT _) (Just 10)*Present 10 (IxL(()) 10 | p=Just 10 | q=()) PresentT 10#pl @(Id !! MEmptyT _) (Nothing @())$Error (!!) index not found (IxL(()))FailT "(!!) index not found"pl @(Id !! 6) ['a'..'z']?Present 'g' (IxL(6) 'g' | p="abcdefghijklmnopqrstuvwxyz" | q=6) PresentT 'g',pl @(Snd Id !! Fst Id) (3,"abcde" :: String)*Present 'd' (IxL(3) 'd' | p="abcde" | q=3) PresentT 'd' pl @(Snd Id !! Fst Id) (4,[9,8])#Error (!!) index not found (IxL(4))FailT "(!!) index not found"7pl @(2 &&& Id >> Snd Id !! Fst Id) ("abcdef" :: String)8Present 'c' ((>>) 'c' | {IxL(2) 'c' | p="abcdef" | q=2}) PresentT 'c':pl @((Len >> Pred Id) &&& Id >> Snd Id !! Fst Id) "abcdef"8Present 'f' ((>>) 'f' | {IxL(5) 'f' | p="abcdef" | q=5}) PresentT 'f'#pl @(Id !! 3) ('a','b','c','d','e')8Present 'd' (IxL(3) 'd' | p=('a','b','c','d','e') | q=3) PresentT 'd'<pl @(Id !! "s") $ M.fromList [("t",1), ("s", 20), ("s", 99)]@Present 99 (IxL("s") 99 | p=fromList [("s",99),("t",1)] | q="s") PresentT 996pl @(Id !! Char1 "d") (M.fromList $ zip "abcd" [0 ..])MPresent 3 (IxL('d') 3 | p=fromList [('a',0),('b',1),('c',2),('d',3)] | q='d') PresentT 3pl @(Id !! FromString _ "d" &&& (Map (Snd Id >> Gt 3 >> Coerce SG.Any) (IToList _ Id) >> MConcat Id)) (M.fromList $ zip (map T.singleton "abcdefgh") [0 ..])<Present (3,Any {getAny = True}) (W '(3,Any {getAny = True})) PresentT (3,Any {getAny = True})pl @(Id !! FromString _ "d" &&& (Map (Snd Id >> Gt 3 >> Wrap SG.Any Id) (IToList _ Id) >> MConcat Id >> Unwrap Id)) (M.fromList $ zip (map T.singleton "abcdefgh") [0 ..])Present (3,True) (W '(3,True))PresentT (3,True)Opl @(Id !! FromString _ "d") (M.fromList $ zip (map T.singleton "abcd") [0 ..])MPresent 3 (IxL("d") 3 | p=fromList [("a",0),("b",1),("c",2),("d",3)] | q="d") PresentT 3Opl @(Id !! FromString _ "d") (M.fromList $ zip (map T.singleton "abcd") [0 ..])MPresent 3 (IxL("d") 3 | p=fromList [("a",0),("b",1),("c",2),("d",3)] | q="d") PresentT 3/pl @(Id !! 2 !! 0) [[1..5],[10..14],[100..110]]PPresent 100 (IxL(0) 100 | p=[100,101,102,103,104,105,106,107,108,109,110] | q=0) PresentT 100/pl @(Id !! 1 !! 7) [[1..5],[10..14],[100..110]]#Error (!!) index not found (IxL(7))FailT "(!!) index not found"(pl @(Id !! 1) [('x',14),('y',3),('z',5)]EPresent ('y',3) (IxL(1) ('y',3) | p=[('x',14),('y',3),('z',5)] | q=1)PresentT ('y',3))pl @(Id !! 14) [('x',14),('y',3),('z',5)]$Error (!!) index not found (IxL(14))FailT "(!!) index not found"&predicate-typed similar to IJ leveraging 1pz @(IxL Id 2 "notfound") ["abc","D","eF","","G"] PresentT "eF"2pz @(IxL Id 20 "notfound") ["abc","D","eF","","G"]PresentT "notfound",pl @(IxL Id 1 (Char1 "x")) ("123" :: T.Text)(Present '2' (IxL(1) '2' | p="123" | q=1) PresentT '2'-pl @(IxL Id 15 (Char1 "x")) ("123" :: T.Text)%Present 'x' (IxL(15) index not found) PresentT 'x'(predicate-typed similar to IJ using an  container.pz @(Ix 4 "not found") ["abc","D","eF","","G"] PresentT "G"/pz @(Ix 40 "not found") ["abc","D","eF","","G"]PresentT "not found"cpl @(Fst Id >> Dup >> (Ix 1 (Failp "failed5") *** Ix 3 (Failp "failed5")) >> Id) ([10,12,3,5],"ss")*Present (12,5) ((>>) (12,5) | {Id (12,5)})PresentT (12,5)ppl @(Fst Id >> Dup >> (Ix 1 (Failp "failed5") *** Ix 3 (Failp "failed5")) >> Fst Id < Snd Id) ([10,12,3,5],"ss")False ((>>) False | {12 < 5})FalseTppl @(Fst Id >> Dup >> (Ix 1 (Failp "failed5") *** Ix 3 (Failp "failed5")) >> Fst Id > Snd Id) ([10,12,3,5],"ss")True ((>>) True | {12 > 5})TrueTPpl @(Snd Id >> Len &&& Ix 3 (Failp "someval1") >> Fst Id == Snd Id) ('x',[1..5])False ((>>) False | {5 == 4})FalseTOpl @(Snd Id >> Len &&& Ix 3 (Failp "someval2") >> Fst Id < Snd Id) ('x',[1..5])False ((>>) False | {5 < 4})FalseTOpl @(Snd Id >> Len &&& Ix 3 (Failp "someval3") >> Fst Id > Snd Id) ('x',[1..5])True ((>>) True | {5 > 4})TrueTUpl @(Map Len Id >> Ix 3 (Failp "lhs") &&& Ix 0 5 >> Fst Id == Snd Id) [[1..4],[4..5]]!Error lhs ([4,2] (>>) rhs failed) FailT "lhs"Upl @(Map Len Id >> Ix 0 (Failp "lhs") &&& Ix 1 5 >> Fst Id == Snd Id) [[1..4],[4..5]]False ((>>) False | {4 == 2})FalseTapl @(Map Len Id >> Ix 1 (Failp "lhs") &&& Ix 3 (Failp "rhs") >> Fst Id == Snd Id) [[1..4],[4..5]]!Error rhs ([4,2] (>>) rhs failed) FailT "rhs"bpl @(Map Len Id >> Ix 10 (Failp "lhs") &&& Ix 1 (Failp "rhs") >> Fst Id == Snd Id) [[1..4],[4..5]]!Error lhs ([4,2] (>>) rhs failed) FailT "lhs"bpl @(Map Len Id >> Ix 0 (Failp "lhs") &&& Ix 10 (Failp "rhs") >> Fst Id == Snd Id) [[1..4],[4..5]]!Error rhs ([4,2] (>>) rhs failed) FailT "rhs"Vpl @(Map Len Id >> Ix 10 3 &&& Ix 1 (Failp "rhs") >> Fst Id == Snd Id) [[1..4],[4..5]]False ((>>) False | {3 == 2})FalseTIpl @(Map Len Id >> Ix 3 3 &&& Ix 1 4 >> Fst Id == Snd Id) [[1..4],[4..5]]False ((>>) False | {3 == 2})FalseTJpl @(Map Len Id >> Ix 10 3 &&& Ix 1 4 >> Fst Id == Snd Id) [[1..4],[4..5]]False ((>>) False | {3 == 2})FalseTJpl @(Map Len Id >> Ix 10 5 &&& Ix 1 4 >> Fst Id == Snd Id) [[1..4],[4..5]]False ((>>) False | {5 == 2})FalseTJpl @(Map Len Id >> Ix 10 2 &&& Ix 1 4 >> Fst Id == Snd Id) [[1..4],[4..5]]True ((>>) True | {2 == 2})TrueT)predicate-typedindex a value in an 7 container and if not found fail with the given messageGpl @(LookupFail "someval" (Fst Id) 999) (map SG.Min [1::Int .. 10],'x') Error someval (JustFail Nothing)FailT "someval"Wpl @(LookupFail (PrintF "char=%c" (Snd Id)) (Fst Id) 49) (map SG.Min [1::Int ..10],'x')Error char=x (JustFail Nothing)FailT "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 '[1,2,3,4,5,6] 4 Id) 23Present 5 (JustDef Just) PresentT 52pl @(LookupDef '[1,2,3,4,5,6] 4 (Fst Id)) (23,'x')Present 5 (JustDef Just) PresentT 5'pl @(LookupDef '[1,2,3,4,5,6] 99 Id) 23Present 23 (JustDef Nothing) PresentT 233pl @(LookupDef '[1,2,3,4,5,6] 99 (Fst Id)) (23,'x')Present 23 (JustDef Nothing) PresentT 23-pl @(LookupDef '[1,2,3,4,5,6] 4 999) (23,'x')Present 5 (JustDef Just) PresentT 5.pl @(LookupDef '[1,2,3,4,5,6] 40 999) (23,'x')Present 999 (JustDef Nothing) PresentT 999Fpl @(LookupDef (Fst Id) 4 (MEmptyT _)) (map SG.Min [1::Int .. 10],'x')'Present Min {getMin = 5} (JustDef Just)PresentT (Min {getMin = 5})Hpl @(LookupDef (Fst Id) 999 (MEmptyT _)) (map SG.Min [1::Int .. 10],'x')<Present Min {getMin = 9223372036854775807} (JustDef Nothing)-PresentT (Min {getMin = 9223372036854775807}),predicate-typedindex a value in an : container and if not found return the given default valueApl @(LookupDef' (Fst Id) (Snd Id) (Char1 "xx") Id) (['a'..'e'],2)Present 'c' (JustDef Just) PresentT 'c'Cpl @(LookupDef' (Fst Id) (Snd Id) (Char1 "xx") Id) (['a'..'e'],999)Present 'x' (JustDef Nothing) PresentT 'x'9pl @(LookupDef' (Fst Id) (Snd Id) (Char1 "xx") Id) ([],2)Present 'x' (JustDef Nothing) PresentT 'x'Epl @(LookupDef' (Fst Id) (Snd Id) (Char1 "xx") (Snd Id)) ('w',([],2))Present 'x' (JustDef Nothing) PresentT 'x'Ipl @(LookupDef' (Fst Id) (Snd Id) (Fst Id) (Snd Id)) ('x',(['a'..'e'],2))Present 'c' (JustDef Just) PresentT 'c'[pl @(LookupDef' (Fst Id) (Snd Id) (MEmptyT _) (Snd Id)) ('x',(map SG.Min [10..15::Int], 3))(Present Min {getMin = 13} (JustDef Just)PresentT (Min {getMin = 13}) !"#$%&'()*+,('&%#$+,)*"! None&',-.=>?@AHSUVXk %7predicate-typedread a value from stdin9predicate-typedEread in a value of a given type from stdin with a prompt: similar to :predicate-typedwrite a string value to stderr;predicate-typedwrite a string value to stdout<predicate-typed"write to file, without overwriting=predicate-typed$write to file, overwriting if needed>predicate-typedappend to a file?predicate-typedget the current time using @predicate-typedget the current time using Apredicate-typedBread all the environment variables as key value pairs: similar to Bpredicate-typed)read an environment variable: similar to ,pz @(ReadEnv "PATH" >> 'Just Id >> 'True) ()TrueTCpredicate-typed similar to Dpredicate-typed similar to pz @(DirExists ".") ()TrueTpl @(DirExists ".") () True (IsJust)TrueTpl @(DirExists "xxy") ()False (IsJust)FalseTEpredicate-typed similar to Fpredicate-typed similar to 2pz @(ReadFile "LICENSE" >> 'Just Id >> Len > 0) ()TrueTpz @(FileExists "xyzzy") ()FalseTpl @(FileExists "xxy") ()False (IsJust)FalseT789:;<=>?@ABCDEFFECDBA@?><=;:798None&',-.=>?@AHSUVXk #_predicate-typed:creates a constant expression ignoring the second argument9pl @(RDot '[Fst,Snd,Thd,K "xxx"] Id) ((1,(2,9,10)),(3,4))Present "xxx" (K '"xxx")PresentT "xxx"?pl @(RDot '[Fst,Snd,Thd,K '("abc",Id)] Id) ((1,(2,9,10)),(3,4))FPresent ("abc",((1,(2,9,10)),(3,4))) (K '("abc",((1,(2,9,10)),(3,4))))%PresentT ("abc",((1,(2,9,10)),(3,4))):pl @(Thd $ Snd $ Fst $ K Id "dud") ((1,("W",9,'a')),(3,4))#Present 'a' (Thd 'a' | ("W",9,'a')) PresentT 'a'Gpl @((Thd $ Snd $ Fst $ K Id "dud") >> Pred Id) ((1,("W",9,'a')),(3,4)))Present '`' ((>>) '`' | {Pred '`' | 'a'}) PresentT '`'`predicate-typedreversed version of a1pl @(RDot '[Fst,Snd,Thd] Id) ((1,(2,9,10)),(3,4))Present 10 (Thd 10 | (2,9,10)) PresentT 10.pl @(RDot '[Fst,Snd] Id) (('a',2),(True,"zy"))Present 2 (Snd 2 | ('a',2)) PresentT 2apredicate-typedcompose simple functions0pl @(Dot '[Thd,Snd,Fst] Id) ((1,(2,9,10)),(3,4))Present 10 (Thd 10 | (2,9,10)) PresentT 10bpredicate-typedhrun an expression 'p' and on failure print a custom error 's' using the error string and the input valueBpz @(Catch' (Succ Id) (Second (ShowP Id) >> PrintT "%s %s" Id)) GT=FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument GT"Bpz @(Catch' (Succ Id) (Second (ShowP Id) >> PrintT "%s %s" Id)) LT PresentT EQPpl @(Catch' (Failt Int "someval") (PrintT "msg=%s caught(%03d)" Id)) (44 :: Int)>Error msg=someval caught(044) (Catch default condition failed)FailT "msg=someval caught(044)"Vpl @(Catch' (OneP Id) (Second (ShowP Id) >> PrintT "msg=%s caught(%s)" Id)) [10,12,13]MError msg=OneP 3 elements caught([10,12,13]) (Catch default condition failed).FailT "msg=OneP 3 elements caught([10,12,13])"Lpl @(Catch' (OneP Id) (PrintT "msg=%s caught(%s)" (Second (ShowP Id)))) [10]Present 10 (Catch did not fire) PresentT 10Mpl @(Catch' (OneP Id) (PrintT "msg=%s err s=%s" (Second (ShowP Id)))) [10,11]HError msg=OneP 2 elements err s=[10,11] (Catch default condition failed))FailT "msg=OneP 2 elements err s=[10,11]"cpredicate-typed,run an expression 'p' and on failure run 'q'Rpz @(Catch (Succ Id) (Fst Id >> Second (ShowP Id) >> PrintT "%s %s" Id >> 'LT)) GT PresentT LT3pz @(Len > 1 && Catch (Id !! 3 == 66) 'False) [1,2]FalseT:pl @(Catch (Resplit "\\d+(" Id) (Snd Id >> MEmptyP)) "123"<Present [] (Catch caught exception[Regex failed to compile]) PresentT [] pl @(Catch (OneP Id) 99) [10,11]4Present 99 (Catch caught exception[OneP 2 elements]) PresentT 99pl @(Catch (OneP Id) 99) [10]Present 10 (Catch did not fire) PresentT 10zpl @(Catch (OneP Id) 'True) [False] -- cant know that this is FalseT cos is driven by type of the list not the 'True part"Present False (Catch did not fire)PresentT False.pl @(Catch (OneP Id) 'False) [True,True,False]/False (Catch caught exception[OneP 3 elements])FalseTpl @(Catch (OneP Id) 'True) [])True (Catch caught exception[OneP empty])TrueTfpredicate-typedcoerce over a functorHpz @(Coerce2 (SG.Sum Integer)) [Identity (-13), Identity 4, Identity 99]@PresentT [Sum {getSum = -13},Sum {getSum = 4},Sum {getSum = 99}]6pz @(Coerce2 (SG.Sum Integer)) (Just (Identity (-13)))$PresentT (Just (Sum {getSum = -13}))4pz @(Coerce2 (SG.Sum Int)) (Nothing @(Identity Int))PresentT Nothing-pl @(Coerce2 (SG.Sum Int)) (Just (10 :: Int))MPresent Just (Sum {getSum = 10}) (Coerce2 Just (Sum {getSum = 10}) | Just 10)#PresentT (Just (Sum {getSum = 10}))gpredicate-typed"Luhn predicate check on last digitpz @(Luhn Id) [1,2,3,0]TrueTpz @(Luhn Id) [1,2,3,4]FalseT)pz @(GuardSimple (Luhn Id)) [15,4,3,1,99]=FailT "(Luhn map=[90,2,3,8,6] sum=109 ret=9 | [15,4,3,1,99])"pl @(Luhn Id) [15,4,3,1,99];False (Luhn map=[90,2,3,8,6] sum=109 ret=9 | [15,4,3,1,99])FalseThpredicate-typedget the next prime numberpz @(PrimeNext Id) 6 PresentT 7!pz @(ScanN 4 (PrimeNext Id) Id) 3PresentT [3,5,7,11,13]ipredicate-typeda predicate on prime numberspz @(Prime Id) 2TrueT#pz @(Map '(Id,Prime Id) Id) [0..12]PresentT [(0,False),(1,False),(2,True),(3,True),(4,False),(5,True),(6,False),(7,True),(8,False),(9,False),(10,False),(11,True),(12,False)]jpredicate-typedDtakes the init of a list-like object or fails with the given messagekpredicate-typedDtakes the init of a list-like object or uses the given default value'pl @(InitDef '[9,7] (Fst Id)) ([],True)Present [9,7] (JustDef Nothing)PresentT [9,7]+pl @(InitDef '[9,7] (Fst Id)) ([1..5],True) Present [1,2,3,4] (JustDef Just)PresentT [1,2,3,4]+pl @(InitDef '[3] (Fst Id)) ([10..15],True)'Present [10,11,12,13,14] (JustDef Just)PresentT [10,11,12,13,14]lpredicate-typedDtakes the init of a list-like object or fails with the given messagempredicate-typed=takes the last value of a list-like object or a default value"pl @(LastDef 9 (Fst Id)) ([],True)Present 9 (JustDef Nothing) PresentT 9&pl @(LastDef 9 (Fst Id)) ([1..5],True)Present 5 (JustDef Just) PresentT 5(pl @(LastDef 3 (Fst Id)) ([10..15],True)Present 15 (JustDef Just) PresentT 15pl @(LastDef 0 Id) [1..12]Present 12 (JustDef Just) PresentT 12pl @(LastDef 0 Id) []Present 0 (JustDef Nothing) PresentT 0npredicate-typedDtakes the tail of a list-like object or fails with the given message]pl @(TailFail (PrintT "a=%d b=%s" (Snd Id)) (Fst Id)) ([]::[()],(4::Int,"someval" :: String))&Error a=4 b=someval (JustFail Nothing)FailT "a=4 b=someval"opredicate-typedDtakes the tail of a list-like object or uses the given default value'pl @(TailDef '[9,7] (Fst Id)) ([],True)Present [9,7] (JustDef Nothing)PresentT [9,7]+pl @(TailDef '[9,7] (Fst Id)) ([1..5],True) Present [2,3,4,5] (JustDef Just)PresentT [2,3,4,5]+pl @(TailDef '[3] (Fst Id)) ([10..15],True)'Present [11,12,13,14,15] (JustDef Just)PresentT [11,12,13,14,15]ppredicate-typed8takes the head of a list or fails with the given messagesee P for other supported types eg KK0pz @(HeadFail "dude" Id) ["abc","def","asdfadf"]PresentT "abc"!pz @(HeadFail "empty list" Id) []FailT "empty list".pl @(HeadFail "zz" (Fst Id) >> Le 6) ([],True)Error zz ((>>) lhs failed) FailT "zz"?pl @((HeadFail "failed1" (Fst Id) >> Le 6) || 'False) ([],True)Error failed1 (||)FailT "failed1"Lpl @((Fst Id >> HeadFail "failed2" Id >> Le (6 -% 1)) || 'False) ([-9],True)True (True || False)TrueT9pl @(HeadFail "Asdf" Id) ([] :: [()]) -- breaks otherwiseError Asdf (JustFail Nothing) FailT "Asdf"Rpl @(HeadFail (PrintF "msg=%s def" (Fst Id)) (Snd Id)) ("Abc" :: String,[]::[Int])$Error msg=Abc def (JustFail Nothing)FailT "msg=Abc def"qpredicate-typedDtakes the head of a list-like object or uses the given default valuesee P for other supported types eg KKpz @(HeadDef 444 Id) [] PresentT 444pz @(HeadDef 444 Id) [1..5] PresentT 1pz @(HeadDef 444 Id) [1..5] PresentT 14pz @(HeadDef (Char1 "w") Id) (Seq.fromList "abcdef") PresentT 'a'&pz @(HeadDef (Char1 "w") Id) Seq.empty PresentT 'w'1pz @(HeadDef (MEmptyT _) Id) ([] :: [SG.Sum Int])PresentT (Sum {getSum = 0}):pz @(HeadDef (MEmptyT String) '["abc","def","asdfadf"]) ()PresentT "abc"@pz @(HeadDef (MEmptyT _) (Snd Id)) (123,["abc","def","asdfadf"])PresentT "abc"+pz @(HeadDef (MEmptyT _) (Snd Id)) (123,[]) PresentT ()"pl @(HeadDef 9 (Fst Id)) ([],True)Present 9 (JustDef Nothing) PresentT 9&pl @(HeadDef 9 (Fst Id)) ([1..5],True)Present 1 (JustDef Just) PresentT 1(pl @(HeadDef 3 (Fst Id)) ([10..15],True)Present 10 (JustDef Just) PresentT 10+pl @(HeadDef 12 (Fst Id) >> Le 6) ([],True)False ((>>) False | {12 <= 6})FalseT*pl @(HeadDef 1 (Fst Id) >> Le 6) ([],True)True ((>>) True | {1 <= 6})TrueT+pl @(HeadDef 10 (Fst Id) >> Le 6) ([],True)False ((>>) False | {10 <= 6})FalseT6pl @(HeadDef (MEmptyT _) Id) (map (:[]) ([] :: [Int]))Present [] (JustDef Nothing) PresentT []<pl @(HeadDef (MEmptyT _) Id) (map (:[]) ([10..14] :: [Int]))Present [10] (JustDef Just) PresentT [10]-pl @(HeadDef (Fst Id) (Snd Id)) (99,[10..14])Present 10 (JustDef Just) PresentT 100pl @(HeadDef (Fst Id) (Snd Id)) (99,[] :: [Int])Present 99 (JustDef Nothing) PresentT 99*pl @(HeadDef 43 (Snd Id)) (99,[] :: [Int])Present 43 (JustDef Nothing) PresentT 43rpredicate-typed?run both 'p' and 'q' for their effects but ignoring the resultsspredicate-typedErun run 'p' and then 'q' for the effect but using the result from 'p'tpredicate-typedArun 'p' for the effect and then run 'q' using that original valueupredicate-typedjust run the effect ignoring the result passing the original value through for example for use with Stdout so it doesnt interfere with the 'a' on the rhs unless there is an failurevpredicate-typedsimilar to fmap sndpz @FMapSnd (Just ("asf",13))PresentT (Just 13)pl @FMapSnd (Just (1,'x'))Present Just 'x' (FMapSnd)PresentT (Just 'x')!pl @FMapSnd (Nothing @(Char,Int))Present Nothing (FMapSnd)PresentT Nothingpl @FMapSnd (Right (1,'x'))Present Right 'x' (FMapSnd)PresentT (Right 'x')'pl @FMapSnd (Left @_ @(Int,Double) "x")Present Left "x" (FMapSnd)PresentT (Left "x")wpredicate-typedsimilar to fmap fstpz @FMapFst (Just (13,"Asf"))PresentT (Just 13)pl @FMapFst (Just (1,'x'))Present Just 1 (FMapFst)PresentT (Just 1)'pl @FMapFst [(1,'x'), (2,'y'), (3,'z')]Present [1,2,3] (FMapFst)PresentT [1,2,3]xpredicate-typedlike Fpl @(Traverse (If (Gt 3) (Pure Maybe Id) (EmptyT Maybe Id)) Id) [1..5]]Present Nothing ((>>) Nothing | {Sequence Nothing | [Nothing,Nothing,Nothing,Just 4,Just 5]})PresentT Nothing.pl @(Traverse (MaybeBool (Le 3) Id) Id) [1..5]\Present Nothing ((>>) Nothing | {Sequence Nothing | [Just 1,Just 2,Just 3,Nothing,Nothing]})PresentT NothingFpl @(Traverse (If (Gt 0) (Pure Maybe Id) (EmptyT Maybe Id)) Id) [1..5]uPresent 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]})PresentT (Just [1,2,3,4,5])Bpl @(Traverse (If (Gt 0) (Pure Maybe Id) (MkNothing _)) Id) [1..5]uPresent 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]})PresentT (Just [1,2,3,4,5])1pl @(Traverse (MaybeBool (Id >= 0) Id) Id) [1..5]uPresent 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]})PresentT (Just [1,2,3,4,5])1pl @(Traverse (MaybeBool (Id <= 3) Id) Id) [1..5]\Present Nothing ((>>) Nothing | {Sequence Nothing | [Just 1,Just 2,Just 3,Nothing,Nothing]})PresentT Nothingypredicate-typed similar to (pz @Sequence [Just 10, Just 20, Just 30]PresentT (Just [10,20,30]):pz @Sequence [Just 10, Just 20, Just 30, Nothing, Just 40]PresentT Nothingzpredicate-typed9flipped function application for expressions: similar to n:m + Text.Show.Functions pz @(Snd Id $& Fst Id) ((*16),4) PresentT 64pz @("def" $& Id) ("abc"<>)PresentT "abcdef"{predicate-typed1function application for expressions: similar to ():m + Text.Show.Functions pz @(Fst Id $$ Snd Id) ((*16),4) PresentT 64pz @(Id $$ "def") ("abc"<>)PresentT "abcdef"|predicate-typed similar to pz @Join (Just (Just 20))PresentT (Just 20)pz @Join ["ab","cd","","ef"]PresentT "abcdef"}predicate-typed similar to pz @Duplicate (20,"abc")PresentT (20,(20,"abc"))~predicate-typed similar to pz @Extract (Nothing,Just 20)PresentT (Just 20)pz @Extract (Identity 20) PresentT 20pl @Extract (10,"hello")0Present "hello" (Extract "hello" | (10,"hello"))PresentT "hello"predicate-typed similar to )pz @(Fst Id <|> Snd Id) (Nothing,Just 20)PresentT (Just 20))pz @(Fst Id <|> Snd Id) (Just 10,Just 20)PresentT (Just 10))pz @(Fst Id <|> Snd Id) (Nothing,Nothing)PresentT Nothing/pl @(Fst Id <|> Snd Id) (Just "cdef",Just "ab")EPresent Just "cdef" ((<|>) Just "cdef" | p=Just "cdef" | q=Just "ab")PresentT (Just "cdef")-pl @(Fst Id <|> Snd Id) ("cdef","ab"::String)5Present "cdefab" ((<|>) "cdefab" | p="cdef" | q="ab")PresentT "cdefab"predicate-typedsimilar to Applicative (pl @(Fst Id *> Snd Id) (Just 4,Just 'a')8Present Just 'a' ((<*) Just 'a' | p=Just 'a' | q=Just 4)PresentT (Just 'a')predicate-typedsimilar to Applicative (pl @(Fst Id <* Snd Id) (Just 4,Just 'a')4Present Just 4 ((<*) Just 4 | p=Just 4 | q=Just 'a')PresentT (Just 4)+pz @(Fst Id <* Snd Id) (Just "abc",Just 20)PresentT (Just "abc")predicate-typed similar to &pz @(Fst Id <$ Snd Id) ("abc",Just 20)PresentT (Just "abc")*pl @(Fst Id <$ Snd Id) (4,These "xxx" 'a')Present These "xxx" 4 ((<$) 4)PresentT (These "xxx" 4)#pl @(Fst Id <$ Snd Id) (4,This 'a')Present This 'a' ((<$) 4)PresentT (This 'a')#pl @(Fst Id <$ Snd Id) (4,Just 'a')Present Just 4 ((<$) 4)PresentT (Just 4)'pl @(Fst Id <$ Snd Id) (4,Nothing @Int)Present Nothing ((<$) 4)PresentT Nothingpl @('True <$ Id) [1..4])Present [True,True,True,True] ((<$) True)PresentT [True,True,True,True]import Data.Functor.Compose.pl @(Char1 "ab" <$ Id) (Compose $ Just [1..4])(Present Compose (Just "aaaa") ((<$) 'a') PresentT (Compose (Just "aaaa"))$pl @(Snd Id <$ Fst Id) (Just 10,'x')Present Just 'x' ((<$) 'x')PresentT (Just 'x')predicate-typedlift pure over a Functor#pz @(Pure2 (Either String)) [1,2,4]"PresentT [Right 1,Right 2,Right 4]pl @(Pure2 []) (Just 10)-Present Just [10] (Pure2 Just [10] | Just 10)PresentT (Just [10])pl @(Pure2 SG.Sum) (Just 20)KPresent Just (Sum {getSum = 20}) (Pure2 Just (Sum {getSum = 20}) | Just 20)#PresentT (Just (Sum {getSum = 20}))%_`abcdefghijklmnopqrstuvwxyz{|}~%wvyx|~}{zutsrqponmlkjfdeihgcba`_ r1s1t1z1{03444None&',-.=>?@AHSUVXk ipredicate-typed similar to Gpz @(EnumFromThenTo (ToEnum Day 10) (ToEnum Day 20) (ToEnum Day 70)) ()WPresentT [1858-11-27,1858-12-07,1858-12-17,1858-12-27,1859-01-06,1859-01-16,1859-01-26]bpz @(EnumFromThenTo (ReadP Day "2020-01-12") (ReadP Day "2020-02-12") (ReadP Day "2020-08-12")) ()WPresentT [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) ()PresentT [2,3,4,5]pz @('LT ... 'GT) ()PresentT [LT,EQ,GT]Dpz @('Just (MkDay '(2020, 1, 2)) ... 'Just (MkDay '(2020, 1, 7))) ()LPresentT [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) () PresentT []0pz @(EnumFromTo (Pred Id) (Succ Id)) (SG.Max 10)?PresentT [Max {getMax = 9},Max {getMax = 10},Max {getMax = 11}]mpz @(EnumFromTo 1 20 >> Map '(Id, (If (Id `Mod` 3 == 0) "Fizz" "" <> If (Id `Mod` 5 == 0) "Buzz" "")) Id) 123PresentT [(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})cPresentT [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})cPresentT [Min {getMin = 9},Min {getMin = 10},Min {getMin = 11},Min {getMin = 12},Min {getMin = 13}]predicate-typedbounded  functionpz @(ToEnumBFail Ordering) 6FailT "ToEnum bounded"pl @(ToEnumBFail Ordering) 1Present EQ (ToEnumBDef EQ | 1) PresentT EQpl @(ToEnumBFail Ordering) 44.Error ToEnum bounded (ToEnumBDef out of range)FailT "ToEnum bounded"predicate-typedbounded  functionpz @(ToEnumBDef Ordering LT) 2 PresentT GTpz @(ToEnumBDef Ordering LT) 6 PresentT LT!pl @(ToEnumBDef Ordering 'LT) 123$Present LT (ToEnumBDef out of range) PresentT LTpl @(ToEnumBDef Ordering 'GT) 1Present EQ (ToEnumBDef EQ | 1) PresentT EQpredicate-typedunsafe  functionpz @(ToEnum Char Id) 120 PresentT 'x'Xpl @(Map (FromEnum Id) Id >> Map (Id - 97 >> ToEnum Ordering Id) Id) ("abcde" :: String)dError ToEnum IO e=Prelude.Enum.Ordering.toEnum: bad argument(2) ([97,98,99,100,101] (>>) rhs failed)AFailT "ToEnum IO e=Prelude.Enum.Ordering.toEnum: bad argument(2)"Mpl @((ToEnum Day Id *** ToEnum Day Id) >> EnumFromTo (Fst Id) (Snd Id)) (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})LPresentT [1858-11-17,1858-11-18,1858-11-19,1858-11-20,1858-11-21,1858-11-22]predicate-typed functionpz @(FromEnum Id) 'x' PresentT 120-pl @(FromEnum ("aa" ==! Id) >> Same 1) "aaaa"False ((>>) False | {0 == 1})FalseT:pl @(FromEnum ("aa" ==! Id) >> ToEnum OrderingP Id) "aaaa")Present CGt ((>>) CGt | {ToEnum CGt | 0}) PresentT CGtHpl @(Map (FromEnum Id) Id >> Map (ToEnum Char Id) Id) ("abcd" :: String)<Present "abcd" ((>>) "abcd" | {Map "abcd" | [97,98,99,100]})PresentT "abcd"predicate-typedbounded  functionpl @(PredB 'GT Id) LTPresent GT (PredB out of range) PresentT GTpl @(PredB 'LT Id) GTPresent EQ (PredB EQ | GT) PresentT EQpredicate-typed unbounded  functionpz @(Pred Id) 13 PresentT 12pz @(Pred Id) LT:FailT "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"LPresentT [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"PresentT 2020-07-22pl @(SuccN 3 'LT) ()HError SuccN IO e=Prelude.Enum.Ordering.toEnum: bad argument (SuccN 3 LT)=FailT "SuccN IO e=Prelude.Enum.Ordering.toEnum: bad argument"pz @(SuccN 2 'LT) () PresentT GTpredicate-typed unbounded  functionpz @(Succ Id) 13 PresentT 14pz @(Succ Id) LT PresentT EQpz @(Succ Id) GT:FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument"pl @(Succ Id) 10Present 11 (Succ 11 | 10) PresentT 11,pl @(Succ Id) True -- captures the exception;Error Succ IO e=Prelude.Enum.Bool.succ: bad argument (True)6FailT "Succ IO e=Prelude.Enum.Bool.succ: bad argument"predicate-typedbounded  functionpz @(PredB' Id) (13 :: Int) PresentT 12pz @(PredB' Id) LTFailT "Pred bounded"pl @(PredB' Id) GTPresent EQ (PredB EQ | GT) PresentT EQpl @(PredB' Id) LT'Error Pred bounded (PredB out of range)FailT "Pred bounded"predicate-typedbounded  functionpz @(SuccB' Id) GTFailT "Succ bounded"pz @(SuccB' Id) (13 :: Int) PresentT 14pz @(SuccB' Id) LT PresentT EQpredicate-typedbounded  functionpz @(SuccB 'LT Id) GT PresentT LT4None&',-.=>?@AHSUVXk predicate-typed leverages 8 for repeating predicates (passthrough method) same as DoN n p == FoldN n p Id but more efficientpz @(DoN 4 (Succ Id)) 'c' PresentT 'g'pz @(DoN 4 (Id <> " | ")) "abc"PresentT "abc | | | | "#pz @(DoN 4 (Id <> "|" <> Id)) "abc"JPresentT "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}) PresentT 17pl @(DoN 4 (Id + 7)) 3$Present 31 ((>>) 31 | {24 + 7 = 31}) PresentT 31pl @(DoN 4 9) ()Present 9 ((>>) 9 | {'9}) PresentT 9pl @(DoN 4 "xy") 3"Present "xy" ((>>) "xy" | {'"xy"}) PresentT "xy"predicate-typedccreates a promoted list of predicates and then evaluates them into a list. see PP instance for '[k]pz @(Repeat 4 (Succ Id)) 'c'PresentT "dddd"pz @(Repeat 4 "abc") ()"PresentT ["abc","abc","abc","abc"]pl @(Repeat 4 "xy") 3BPresent ["xy","xy","xy","xy"] ('["xy","xy","xy","xy"] ('"xy") | 3)PresentT ["xy","xy","xy","xy"]predicate-typed leverages / for repeating expressions (passthrough method)pz @(ParaN 4 (Succ Id)) [1..4]PresentT [2,3,4,5]pz @(ParaN 4 (Succ Id)) "azwxm")FailT "Para:invalid length(5) expected 4"pz @(ParaN 4 (Succ Id)) "azwx"PresentT "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])PresentT [1,2,3,4,12]?pl @(ParaN 5 (Guard "0-255" (Between 0 255 Id))) [1,2,3,400,12]"Error 0-255 (Para(0) rhs failed 1) FailT "0-255"2pl @(ParaN 4 (PrintF "%03d" Id)) [141,21,3,0::Int]TPresent ["141","021","003","000"] (Para(0) ["141","021","003","000"] | [141,21,3,0])"PresentT ["141","021","003","000"]predicate-typedruns values in parallel unlike  which is serial)pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30]PresentT [10,21,120],pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30,40])FailT "Para:invalid length(4) expected 3";pl @(Para '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99,-999]RPresent [True,False,False,True] (Para(0) [True,False,False,True] | [1,2,-99,-999]) PresentT [True,False,False,True]6pl @(Para '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99]'Error Para:invalid length(3) expected 4)FailT "Para:invalid length(3) expected 4"Apl @(Para '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99,-999,1,1,2]'Error Para:invalid length(7) expected 4)FailT "Para:invalid length(7) expected 4"predicate-typedIunfolds a value applying 'f' until the condition 'p' is true or 'n' times.pl @(IterateNUntil 10 (Id <= 90) (Pred Id)) 95qPresent [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)]})PresentT [95,94,93,92,91]-pl @(IterateNUntil 3 (Id <= 90) (Pred Id)) 95PPresent [95,94,93] ((>>) [95,94,93] | {Map [95,94,93] | [(3,95),(2,94),(1,93)]})PresentT [95,94,93]#pl @(IterateNUntil 9999 'False I) 1GError Unfoldr (9999,1):recursion limit i=100 ((9999,1) (>>) rhs failed).FailT "Unfoldr (9999,1):recursion limit i=100"predicate-typedIunfolds a value applying 'f' while the condition 'p' is true or 'n' times-pl @(IterateNWhile 10 (Id > 90) (Pred Id)) 95qPresent [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)]})PresentT [95,94,93,92,91],pl @(IterateNWhile 3 (Id > 90) (Pred Id)) 95PPresent [95,94,93] ((>>) [95,94,93] | {Map [95,94,93] | [(3,95),(2,94),(1,93)]})PresentT [95,94,93]predicate-typed<unfolds a value applying 'f' while the condition 'p' is true)pl @(IterateWhile (Id > 90) (Pred Id)) 947Present [94,93,92,91] (Unfoldr 94 [94,93,92,91] | s=94)PresentT [94,93,92,91]predicate-typed<unfolds a value applying 'f' until the condition 'p' is true)pl @(IterateUntil (Id < 90) (Pred Id)) 94=Present [94,93,92,91,90] (Unfoldr 94 [94,93,92,91,90] | s=94)PresentT [94,93,92,91,90]predicate-typed similar to IL=pz @(Unfoldr (MaybeBool (Not Null) (SplitAt 2 Id)) Id) [1..5]PresentT [[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")=PresentT ["abc","bcd","cde","def","efg","fgh","ghi","hi","i"]Gpl @(Unfoldr (If Null (MkNothing _) (Pure _ (SplitAt 2 Id))) Id) [1..5]QPresent [[1,2],[3,4],[5]] (Unfoldr [1,2,3,4,5] [[1,2],[3,4],[5]] | s=[1,2,3,4,5])PresentT [[1,2],[3,4],[5]]=pl @(Unfoldr (MaybeBool (Not Null) (SplitAt 2 Id)) Id) [1..5]QPresent [[1,2],[3,4],[5]] (Unfoldr [1,2,3,4,5] [[1,2],[3,4],[5]] | s=[1,2,3,4,5])PresentT [[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]) FailT "yy"Upl @(Unfoldr (MaybeBool (Not Null) (Guard "yy" (Len < 3) >> SplitAt 2 Id)) Id) [1..5]Error yy (Unfoldr [1,2,3,4,5]) FailT "yy"9pl @(Unfoldr (Guard "xx" (Len > 4) >> Uncons) Id) [1..10])Error xx (Unfoldr [1,2,3,4,5,6,7,8,9,10]) FailT "xx"pl @(Unfoldr Uncons Id) [1..10]qPresent [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])PresentT [1,2,3,4,5,6,7,8,9,10]predicate-typedFoldl similar to -pl @(Foldl (Fst Id + Snd Id) 0 (1 ... 10)) ()5Present 55 (Last 55 | [0,1,3,6,10,15,21,28,36,45,55]) PresentT 552pz @(Foldl (Snd Id :+ Fst Id) '[99] (1 ... 10)) ()"PresentT [10,9,8,7,6,5,4,3,2,1,99]/pl @(Foldl (Fst Id) '() (EnumFromTo 1 9999)) ()%Error Scanl list size exceeded (Last) FailT "Scanl list size exceeded"Zpl @(Foldl (Guard "someval" (Fst Id < Snd Id) >> Snd Id) (Head Id) (Tail Id)) [1,4,7,9,16]#Present 16 (Last 16 | [1,4,7,9,16]) PresentT 16wpl @(Foldl (Guard (PrintT "%d not less than %d" Id) (Fst Id < Snd Id) >> Snd Id) (Head Id) (Tail Id)) [1,4,7,6,16::Int]Error 7 not less than 6 (Last)FailT "7 not less than 6"pl @(Foldl (If ((Fst Id >> Fst Id) && (Snd Id > Snd (Fst Id))) '( 'True, Snd Id) '( 'False, Snd (Fst Id))) '( 'True, Head Id) (Tail Id)) [1,4,7,9,16]TPresent (True,16) (Last (True,16) | [(True,1),(True,4),(True,7),(True,9),(True,16)])PresentT (True,16)pl @(Foldl (If ((Fst Id >> Fst Id) && (Snd Id > Snd (Fst Id))) '( 'True, Snd Id) '( 'False, Snd (Fst Id))) '( 'True, Head Id) (Tail Id)) [1,4,7,9,16,2]aPresent (False,16) (Last (False,16) | [(True,1),(True,4),(True,7),(True,9),(True,16),(False,16)])PresentT (False,16)6pl @(Foldl (Snd Id :+ Fst Id) (MEmptyT [_]) Id) [1..5]UPresent [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]])PresentT [5,4,3,2,1]pl @('Just Uncons >> Foldl (If (Fst (Fst Id)) (If (Snd (Fst Id) < Snd Id) '( 'True,Snd Id) '( 'False, Snd Id)) (Fst Id)) '( 'True,Fst Id) (Snd Id)) [-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)]})PresentT (False,9)pl @('Just Uncons >> Foldl (If (Fst (Fst Id)) (If (Snd (Fst Id) < Snd Id) '( 'True,Snd Id) '( 'False, Snd Id)) (Fst Id)) '( 'True,Fst Id) (Snd Id)) [-10,2,3,4,10,11]sPresent (True,11) ((>>) (True,11) | {Last (True,11) | [(True,-10),(True,2),(True,3),(True,4),(True,10),(True,11)]})PresentT (True,11)predicate-typed-iterates n times keeping only the last resultpz @(FoldN 4 (Succ Id) Id) 'c' PresentT 'g'>pz @(ReadP Day Id >> Id ... FoldN 5 (Succ Id) Id) "2020-07-27"LPresentT [2020-07-27,2020-07-28,2020-07-29,2020-07-30,2020-07-31,2020-08-01]pl @(FoldN 2 (Succ Id) Id) LT!Present GT (Last GT | [LT,EQ,GT]) PresentT GTpl @(FoldN 30 (Succ Id) Id) LT?Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument (Last):FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument"pl @(FoldN 6 (Succ Id) Id) 'a'"Present 'g' (Last 'g' | "abcdefg") PresentT 'g'pl @(FoldN 6 (Pred Id) Id) 'a'#Present '[' (Last '[' | "a`_^]\\[") PresentT '['pl @(FoldN 0 (Succ Id) Id) LTPresent LT (Last LT | [LT]) PresentT LT5pl @(FoldN 2 (Succ Id) Id >> FoldN 2 (Pred Id) Id) LT-Present LT ((>>) LT | {Last LT | [GT,EQ,LT]}) PresentT LT,pl @(FoldN 4 ((Id &&& Id) >> SapA) Id) "abc"Present "abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc" (Last "abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc" | ["abc","abcabc","abcabcabcabc","abcabcabcabcabcabcabcabc","abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc"]);PresentT "abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc"predicate-typedtuple version of pl @(ScanNA (Succ Id)) (4,'a')6Present "abcde" (Scanl "abcde" | b='a' | as=[1,2,3,4])PresentT "abcde"+pl @(ScanNA (Tail Id)) (4,"abcd" :: String)_Present ["abcd","bcd","cd","d",""] (Scanl ["abcd","bcd","cd","d",""] | b="abcd" | as=[1,2,3,4])#PresentT ["abcd","bcd","cd","d",""]+pl @(Len &&& Id >> ScanNA (Tail Id)) "abcd"Present ["abcd","bcd","cd","d",""] ((>>) ["abcd","bcd","cd","d",""] | {Scanl ["abcd","bcd","cd","d",""] | b="abcd" | as=[1,2,3,4]})#PresentT ["abcd","bcd","cd","d",""]predicate-typed(iterates n times keeping all the resultspz @(ScanN 4 (Succ Id) Id) 'c'PresentT "cdefg"1pz @(Dup >> ScanN 4 (Pred Id *** Succ Id) Id) 'g'<PresentT [('g','g'),('f','h'),('e','i'),('d','j'),('c','k')]pz @(ScanN 4 (Succ Id) Id) 4PresentT [4,5,6,7,8]Opz @('(0,1) >> ScanN 20 '(Snd Id, Fst Id + Snd Id) Id >> Map (Fst Id) Id) "sdf"OPresentT [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) Id) 40Present [4,5,6] (Scanl [4,5,6] | b=4 | as=[1,2])PresentT [4,5,6]pl @(ScanN 5 Id Id) 4BPresent [4,4,4,4,4,4] (Scanl [4,4,4,4,4,4] | b=4 | as=[1,2,3,4,5])PresentT [4,4,4,4,4,4]>pl @(ScanN 2 (Succ Id) 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]})(PresentT [LT,EQ,GT,EQ,EQ,EQ,EQ,EQ,EQ,EQ]pl @(ScanN 4 (Pred Id) Id) 99GPresent [99,98,97,96,95] (Scanl [99,98,97,96,95] | b=99 | as=[1,2,3,4])PresentT [99,98,97,96,95]predicate-typed similar to >pz @(Scanl (Snd Id :+ Fst Id) (Fst Id) (Snd Id)) ([99],[1..5])FPresentT [[99],[1,99],[2,1,99],[3,2,1,99],[4,3,2,1,99],[5,4,3,2,1,99]]:pl @(Scanl (Snd Id :+ Fst Id) (Fst Id) (Snd Id)) ([99],[]).Present [[99]] (Scanl [[99]] | b=[99] | as=[])PresentT [[99]]None&',-.=>?@AHSUVXk [predicate-typed extract the Right value from an  otherwise fail with a messagePif there is no Right value then p is passed the Left value and the whole context&pz @(RightFail "oops" Id) (Right 20.4) PresentT 20.4%pz @(RightFail "oops" Id) (Left "aa") FailT "oops"_pz @(RightFail (PrintT "found left=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Left "xy")FailT "found left=xy fst=123")pz @(RightFail (MEmptyT _) Id) (Left 222)FailT ""predicate-typedextract the Left value from an  otherwise fail with a messagePif there is no Left value then p is passed the Right value and the whole context$pz @(LeftFail "oops" Id) (Left 20.4) PresentT 20.4%pz @(LeftFail "oops" Id) (Right "aa") FailT "oops"`pz @(LeftFail (PrintT "found right=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Right "xy")FailT "found right=xy fst=123")pz @(LeftFail (MEmptyT _) Id) (Right 222)FailT ""`pl @(LeftFail (PrintF "someval=%d" (Fst (Snd Id))) (Snd Id)) (13::Int,Right @(SG.Sum Int) "abc")!Error someval=13 (LeftFail Right)FailT "someval=13"Xpl @(LeftFail (PrintF "someval=%s" (Fst Id)) Id) (Right @(SG.Sum Int) ("abc" :: String))"Error someval=abc (LeftFail Right)FailT "someval=abc"Jpl @(LeftFail (PrintF "found rhs=%d" (Fst Id)) Id) (Right @String @Int 10)#Error found rhs=10 (LeftFail Right)FailT "found rhs=10"opl @(LeftFail (PrintF "found rhs=%d" (Snd Id >> Snd Id >> Snd Id)) (Snd Id >> Fst Id)) ('x',(Right 10,23::Int))#Error found rhs=23 (LeftFail Right)FailT "found rhs=23"epl @(LeftFail (PrintF "found rhs=%d" (Snd (Snd (Snd Id)))) (Fst (Snd Id))) ('x',(Left "abc",23::Int))Present "abc" (Left)PresentT "abc"predicate-typed extract the Right value from an  : similar to Pif there is no Right value then p is passed the Left value and the whole context&pz @(RightDef (1 % 4) Id) (Right 20.4)PresentT (102 % 5)%pz @(RightDef (1 % 4) Id) (Left "aa")PresentT (1 % 4)^pz @(RightDef (PrintT "found left=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Left "xy") PresentT "found left=xy fst=123"(pz @(RightDef (MEmptyT _) Id) (Left 222) PresentT ()1pz @(RightDef (MEmptyT (SG.Sum _)) Id) (Left 222)PresentT (Sum {getSum = 0})predicate-typedextract the Left value from an - otherwise use the default value: similar to Pif there is no Left value then p is passed the Right value and the whole context$pz @(LeftDef (1 % 4) Id) (Left 20.4)PresentT (102 % 5)%pz @(LeftDef (1 % 4) Id) (Right "aa")PresentT (1 % 4)_pz @(LeftDef (PrintT "found right=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Right "xy")!PresentT "found right=xy fst=123"(pz @(LeftDef (MEmptyT _) Id) (Right 222) PresentT ()1pz @(LeftDef (MEmptyT (SG.Sum _)) Id) (Right 222)PresentT (Sum {getSum = 0})predicate-typed constructorpz @(MkRight _ Id) 44PresentT (Right 44)predicate-typed constructorpredicate-typed constructorpz @(MkLeft _ Id) 44PresentT (Left 44)predicate-typed constructorpredicate-typed similar to -M6 but additionally gives 'p' and 'q' the original inputNpz @(EitherX (ShowP (Fst (Fst Id) + Snd Id)) (ShowP Id) (Snd Id)) (9,Left 123)PresentT "132"Opz @(EitherX (ShowP (Fst (Fst Id) + Snd Id)) (ShowP Id) (Snd Id)) (9,Right 'x')PresentT "((9,Right 'x'),'x')"Jpz @(EitherX (ShowP Id) (ShowP (Second (Succ Id))) (Snd Id)) (9,Right 'x')PresentT "((9,Right 'x'),'y')"predicate-typed/Convenient method to convert a 'p' or 'q' to a @ based on a predicate 'b' if 'b' then Right 'p' else Left 'q'Qpz @(EitherBool (Fst Id > 4) (Snd Id >> Fst Id) (Snd Id >> Snd Id)) (24,(-1,999))PresentT (Right 999)Hpz @(EitherBool (Fst Id > 4) (Fst (Snd Id)) (Snd (Snd Id))) (1,(-1,999))PresentT (Left (-1))Qpl @(EitherBool (Fst Id > 10) (Snd Id >> Fst Id) (Snd Id >> Snd Id)) (7,('x',99))-Present Left 'x' (EitherBool(False) Left 'x')PresentT (Left 'x')Rpl @(EitherBool (Fst Id > 10) (Snd Id >> Fst Id) (Snd Id >> Snd Id)) (11,('x',99)),Present Right 99 (EitherBool(True) Right 99)PresentT (Right 99)+pl @(EitherBool (Gt 10) "found left" 99) 12,Present Right 99 (EitherBool(True) Right 99)PresentT (Right 99)*pl @(EitherBool (Gt 10) "found left" 99) 7?Present Left "found left" (EitherBool(False) Left "found left")PresentT (Left "found left")predicate-typed similar to Apz @PartitionEithers [Left 'a',Right 2,Left 'c',Right 4,Right 99]PresentT ("ac",[2,4,99])/pz @PartitionEithers [Right 2,Right 4,Right 99]PresentT ([],[2,4,99])(pz @PartitionEithers [Left 'a',Left 'c']PresentT ("ac",[]),pz @PartitionEithers ([] :: [Either () Int])PresentT ([],[]);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])PresentT ([4,99],"xy")Npl @PartitionEithers [Left 'x', Right 1,Left 'a', Left 'b',Left 'z', Right 10]sPresent ("xabz",[1,10]) (PartitionEithers ("xabz",[1,10]) | [Left 'x',Right 1,Left 'a',Left 'b',Left 'z',Right 10])PresentT ("xabz",[1,10])predicate-typedsimilar -Npz @(Pred Id +++ Id) (Left 13)PresentT (Left 12)*pz @(ShowP Id +++ Reverse) (Right "hello")PresentT (Right "olleh")Tpl @(HeadDef 'False Id +++ Id) (Right @[Bool] 1) -- need @[Bool] cos we said 'False!#Present Right 1 ((+++) Right 1 | 1)PresentT (Right 1)Vpl @(HeadDef 'False Id +++ Id) (Left [True,False]) -- need @[Bool] cos we said 'False!2Present Left True ((+++) Left True | [True,False])PresentT (Left True) pl @(Not Id +++ Id) (Right True),Present Right True ((+++) Right True | True)PresentT (Right True)pl @(Not Id +++ Id) (Right 12)&Present Right 12 ((+++) Right 12 | 12)PresentT (Right 12)lpl @(HeadDef () Id +++ Id) (Right @[()] 1) -- breaks otherwise: Id says () -> () so has to be a list of [()]#Present Right 1 ((+++) Right 1 | 1)PresentT (Right 1)Vpl @(HeadDef () Id +++ Id) (Right @[()] 1) -- this breaks! cos Left doesnt have a type#Present Right 1 ((+++) Right 1 | 1)PresentT (Right 1)$pl @(Not Id +++ Id) (Right @Bool 12)&Present Right 12 ((+++) Right 12 | 12)PresentT (Right 12)predicate-typed similar to pz @(IsRight Id) (Right 123)TrueTpz @(IsRight Id) (Left "aa")FalseTpredicate-typed similar to pz @(IsLeft Id) (Right 123)FalseTpz @(IsLeft Id) (Left 'a')TrueTpredicate-typedsimilar -Mpz @(Pred Id ||| Id) (Left 13) PresentT 12%pz @(ShowP Id ||| Id) (Right "hello")PresentT "hello"'pl @('True ||| 'False) (Left "someval")"True ((|||) Left True | "someval")TrueT(pl @('True ||| 'False) (Right "someval")%False ((|||) Right False | "someval")FalseT-pl @(ShowP (Succ Id) ||| ShowP Id) (Left 123)&Present "124" ((|||) Left "124" | 123)PresentT "124"/pl @(ShowP (Succ Id) ||| ShowP Id) (Right True)*Present "True" ((|||) Right "True" | True)PresentT "True"'pl @(EitherIn (Not Id) Id) (Right True)&Present True ((|||) Right True | True) PresentT True&pl @(EitherIn (Not Id) Id) (Left True)False ((|||) Left False | True)FalseTpredicate-typed!extracts the right value from an "pz @(Right' >> Succ Id) (Right 20) PresentT 21"pz @(Right' >> Succ Id) (Left 'a')FailT "Right' found Left"predicate-typed extracts the left value from an  pz @(Left' >> Succ Id) (Left 20) PresentT 21"pz @(Left' >> Succ Id) (Right 'a')FailT "Left' found Right"22None%&',-.=>?@AHPSUVXk ^ predicate-typedconvert ) to posix time (seconds since 01-01-1970)Epl @(ReadP UTCTime Id >> UTCTimeToPosix Id) "2020-06-28 22:45:12 UTC"hPresent 1593384312 % 1 ((>>) 1593384312 % 1 | {UTCTimeToPosix 1593384312 % 1 | 2020-06-28 22:45:12 UTC})PresentT (1593384312 % 1)pz @(Rescan "^Date\\((\\d+)([^\\)]+)\\)" Id >> Head Id >> Snd Id >> ((ReadP Integer (Id !! 0) >> PosixToUTCTime (Id % 1000)) &&& ReadP TimeZone (Id !! 1))) "Date(1530144000000+0530)"(PresentT (2018-06-28 00:00:00 UTC,+0530)Cnot so useful: instead use ParseTimeP FormatTimeP with %s %q %z etc<pz @(ParseTimeP ZonedTime "%s%Q%z" Id) "153014400.000+0530""PresentT 1974-11-07 05:30:00 +0530 predicate-typed1convert posix time (seconds since 01-01-1970) to "pl @(PosixToUTCTime Id) 1593384312YPresent 2020-06-28 22:45:12 UTC (PosixToUTCTime 2020-06-28 22:45:12 UTC | 1593384312 % 1) PresentT 2020-06-28 22:45:12 UTC7pl @(PosixToUTCTime Id >> UTCTimeToPosix Id) 1593384312hPresent 1593384312 % 1 ((>>) 1593384312 % 1 | {UTCTimeToPosix 1593384312 % 1 | 2020-06-28 22:45:12 UTC})PresentT (1593384312 % 1).pl @(PosixToUTCTime (Id % 1000)) 1593384312000YPresent 2020-06-28 22:45:12 UTC (PosixToUTCTime 2020-06-28 22:45:12 UTC | 1593384312 % 1) PresentT 2020-06-28 22:45:12 UTC(pl @(PosixToUTCTime Id) (3600*4+60*7+12)TPresent 1970-01-01 04:07:12 UTC (PosixToUTCTime 1970-01-01 04:07:12 UTC | 14832 % 1) PresentT 1970-01-01 04:07:12 UTCpz @(Rescan "^Date\\((\\d+)([^\\)]+)\\)" Id >> Head Id >> Snd Id >> ReadP Integer (Id !! 0) >> PosixToUTCTime (Id % 1000)) "Date(1530144000000+0530)" PresentT 2018-06-28 00:00:00 UTC predicate-typed uncreate a * returning hour minute seconds picosecondsNpz @(ReadP UTCTime "2019-01-01 12:13:14.1234Z" >> ToTime Id >> UnMkTime Id) ()PresentT (12,13,70617 % 5000)Mpz @(ReadP UTCTime Id >> ToTime Id >> UnMkTime Id) "2020-07-22 08:01:14.127Z"PresentT (8,1,14127 % 1000)epz @(ReadP ZonedTime Id >> '(UnMkDay (ToDay Id), UnMkTime (ToTime Id))) "2020-07-11 11:41:12.333 CET"+PresentT ((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)) ()PresentT 01:02:00.000243013365pz @(MkTime Id) (12,13,65)PresentT 12:13:65pz @(MkTime Id) (17,3,13)PresentT 17:03:13predicate-typed create a 6 from three int values passed in as year month and day6pz @(MkTime' (Fst Id) (Snd Id) (Thd Id)) (13,99,99999)PresentT 13:99:99999predicate-typedextract  from DateTime9pz @(ReadP UTCTime Id >> ToDay Id) "2020-07-06 12:11:13Z"PresentT 2020-07-06predicate-typedextract  from a DateTime9pz @(ReadP UTCTime Id >> ToDay Id) "2020-07-06 12:11:13Z"PresentT 2020-07-06predicate-typedget week number of the year3pz @(Just (MkDay '(2020,7,11)) >> ToWeekYear Id) () PresentT 28predicate-typedget the day of the weekPpz @(Just (MkDay '(2020,7,11)) >> '(UnMkDay Id, ToWeekYear Id,ToWeekDate Id)) ()(PresentT ((2020,7,11),28,(6,"Saturday"))predicate-typed create a Y, week number, and the day of the week from three numbers passed in as year month and day2pz @(MkDayExtra '(1,2,3) >> 'Just Id >> Fst Id) ()PresentT 0001-02-03(pz @(Fst (Just (MkDayExtra '(1,2,3)))) 1PresentT 0001-02-03 pz @(MkDayExtra Id) (2019,12,30) PresentT (Just (2019-12-30,1,1))pz @(MkDayExtra Id) (1999,3,13)!PresentT (Just (1999-03-13,10,6))predicate-typed create a Y, week number, and the day of the week from three numbers passed in as year month and day<pz @(MkDayExtra' (Fst Id) (Snd Id) (Thd Id)) (2019,99,99999)PresentT Nothingpredicate-typed uncreate a  returning year month and day6pz @(UnMkDay Id) (readNote "invalid day" "2019-12-30")PresentT (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) ()PresentT 0001-02-03pz @(Just (MkDay '(1,2,3))) 1PresentT 0001-02-03pz @(MkDay Id) (2019,12,30)PresentT (Just 2019-12-30)pz @(MkDay Id) (1999,3,13)PresentT (Just 1999-03-13)predicate-typed create a 6 from three int values passed in as year month and day7pz @(MkDay' (Fst Id) (Snd Id) (Thd Id)) (2019,99,99999)PresentT Nothingpredicate-typed]A 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") ()PresentT 2019-03-11 01:22:33pz @(ParseTimes LocalTime (Fst Id) (Snd Id)) (["%Y-%m-%d %H:%M:%S", "%m/%d/%y %H:%M:%S", "%B %d %Y %H:%M:%S", "%Y-%m-%dT%H:%M:%S"], "03/11/19 01:22:33")PresentT 2019-03-11 01:22:33qpl @(Map (ParseTimes Day '["%Y-%m-%d", "%m/%d/%y", "%b %d %Y"] Id) 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)FailT "no match on (03/29/0x7)"ppl @(Map (ParseTimes Day '["%Y-%m-%d", "%m/%d/%y", "%b %d %Y"] Id) 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"])+PresentT [2001-01-01,2009-01-24,2007-03-29]predicate-typed]A convenience method to match against many different datetime formats to find the first matchpredicate-typed similar to OP2pl @(ParseTimeP TimeOfDay "%H:%M%S" Id) "14:04:61"4Error ParseTimeP TimeOfDay (%H:%M%S) failed to parse6FailT "ParseTimeP TimeOfDay (%H:%M%S) failed to parse"9pl @(ParseTimeP UTCTime "%F %T" Id) "1999-01-01 12:12:12"xPresent 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") PresentT 1999-01-01 12:12:12 UTCpredicate-typed similar to  where 't' is the H type, 'p' is the datetime format and 'q' points to the content to parse;pz @(ParseTimeP LocalTime "%F %T" Id) "2019-05-24 05:19:59"PresentT 2019-05-24 05:19:59Mpz @(ParseTimeP LocalTime "%F %T" "2019-05-24 05:19:59") (Right "never used")PresentT 2019-05-24 05:19:594keeping 'q' as we might want to extract from a tuplepredicate-typed@type level expression representing a formatted time similar to  using a type level QR to get the formatting string\pz @(FormatTimeP "%F %T" Id) (readNote @LocalTime "invalid localtime" "2019-05-24 05:19:59")PresentT "2019-05-24 05:19:59"fpz @(FormatTimeP (Fst Id) (Snd Id)) ("the date is %d/%m/%Y", readNote @Day "invalid day" "2019-05-24")!PresentT "the date is 24/05/2019"Jpl @(FormatTimeP "%Y-%m-%d" Id) (readNote @Day "invalid day" "2019-08-17")EPresent "2019-08-17" (FormatTimeP (%Y-%m-%d) 2019-08-17 | 2019-08-17)PresentT "2019-08-17"        None&',-.=>?@AHSUVXka=predicate-typed similar to ?M but uses the root message of the False predicate case as the failure messagezmost uses of GuardSimple can be replaced by a boolean predicate unless you require a failure message instead of true/false"pz @(GuardSimple (Luhn Id)) [1..4]5FailT "(Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])"pl @(Luhn Id) [1..4]3False (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])FalseT%pz @(GuardSimple (Luhn Id)) [1,2,3,0]PresentT [1,2,3,0]&pz @(GuardSimple (Len > 30)) [1,2,3,0]FailT "(4 > 30)"9pl @(Map (GuardSimple (Lt 3) >> 'True) Id) [1::Int .. 10]lError (3 < 3) | (4 < 3) | (5 < 3) | (6 < 3) | (7 < 3) | (8 < 3) | (9 < 3) | (10 < 3) (Map(i=2, a=3) excnt=8)VFailT "(3 < 3) | (4 < 3) | (5 < 3) | (6 < 3) | (7 < 3) | (8 < 3) | (9 < 3) | (10 < 3)"9pl @(Map (GuardSimple (Ge 1) >> 'True) Id) [1::Int .. 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])<PresentT [True,True,True,True,True,True,True,True,True,True]9pl @(Map (GuardSimple (Lt 3) >> 'True) Id) [1::Int .. 10]lError (3 < 3) | (4 < 3) | (5 < 3) | (6 < 3) | (7 < 3) | (8 < 3) | (9 < 3) | (10 < 3) (Map(i=2, a=3) excnt=8)VFailT "(3 < 3) | (4 < 3) | (5 < 3) | (6 < 3) | (7 < 3) | (8 < 3) | (9 < 3) | (10 < 3)"9pl @(Map (GuardSimple (Ge 1) >> 'True) Id) [1::Int .. 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])<PresentT [True,True,True,True,True,True,True,True,True,True]>predicate-typeduses ? but negates 'p'Rpl @(HeadFail "failedn" Id &&& (Len == 1 >> ExitWhen "ExitWhen" Id) >> Fst Id) [3] Error ExitWhen ((>>) lhs failed)FailT "ExitWhen"Npl @(Head Id &&& (Len == 1 >> Not Id >> ExitWhen "ExitWhen" Id) >> Fst Id) [3](Present 3 ((>>) 3 | {Fst 3 | (3,False)}) PresentT 3Jpl @(Head Id &&& (Len == 1 >> ExitWhen "ExitWhen" (Not Id)) >> Fst Id) [3]'Present 3 ((>>) 3 | {Fst 3 | (3,True)}) PresentT 35pl @(ExitWhen "ExitWhen" (Len /= 1) >> Head Id) [3,1] Error ExitWhen ((>>) lhs failed)FailT "ExitWhen"3pl @(ExitWhen "ExitWhen" (Len /= 1) >> Head Id) [3]#Present 3 ((>>) 3 | {Head 3 | [3]}) PresentT 3Cpl @(ExitWhen "ExitWhen" (Len /= 1) >> Head Id >> Gt (20 -% 1)) [3]&True ((>>) True | {3 % 1 > (-20) % 1})TrueTEpl @(ExitWhen "ExitWhen" (Len /= 1) >> Head Id >> Gt (20 -% 1)) [-23],False ((>>) False | {(-23) % 1 > (-20) % 1})FalseT9pl @(Map (ExitWhen "ExitWhen" (Gt 10) >> Gt 2) Id) [1..5]UPresent [False,False,True,True,True] (Map [False,False,True,True,True] | [1,2,3,4,5])%PresentT [False,False,True,True,True]=pl @(ExitWhen "err" (Len > 2) >> Map (Succ Id) Id) [12,15,16]Error err ((>>) lhs failed) FailT "err"7pl @(ExitWhen "err" (Len > 2) >> Map (Succ Id) Id) [12],Present [13] ((>>) [13] | {Map [13] | [12]}) PresentT [13]?predicate-typed?'p' is the predicate and on failure of the predicate runs 'prt'$pz @(Guard "expected > 3" (Gt 3)) 17 PresentT 17#pz @(Guard "expected > 3" (Gt 3)) 1FailT "expected > 3"1pz @(Guard (PrintF "%d not > 3" Id) (Gt 3)) (-99)FailT "-99 not > 3"<pl @(Map (Guard "someval" (Lt 3) >> 'True) Id) [1::Int ..10](Error someval(8) (Map(i=2, a=3) excnt=8)FailT "someval(8)"Cpl @(Guard "someval" (Len == 2) >> (ShowP Id &&& Id)) ([] :: [Int])Error someval ((>>) lhs failed)FailT "someval";pl @(Guard "someval" (Len == 2) >> (Id &&& ShowP Id)) [2,3]EPresent ([2,3],"[2,3]") ((>>) ([2,3],"[2,3]") | {W '([2,3],"[2,3]")})PresentT ([2,3],"[2,3]")=pl @(Guard "someval" (Len == 2) >> (ShowP Id &&& Id)) [2,3,4]Error someval ((>>) lhs failed)FailT "someval"<pl @(Map (Guard "someval" (Lt 3) >> 'True) Id) [1::Int ..10](Error someval(8) (Map(i=2, a=3) excnt=8)FailT "someval(8)";pl @(Guard "oops" (Len > 2) >> Map (Succ Id) Id) [12,15,16]DPresent [13,16,17] ((>>) [13,16,17] | {Map [13,16,17] | [12,15,16]})PresentT [13,16,17]4pl @(Guard "err" (Len > 2) >> Map (Succ Id) Id) [12]Error err ((>>) lhs failed) FailT "err"Tpl @(Guard (PrintF "err found len=%d" Len) (Len > 5) >> Map (Succ Id) Id) [12,15,16]'Error err found len=3 ((>>) lhs failed)FailT "err found len=3"@predicate-typed leverages `. for repeating predicates (passthrough method)ipz @(GuardsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,256]1FailT "id=3 must be between 0 and 255, found 256"hpz @(GuardsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,44]PresentT [121,33,7,44]\pl @(GuardsN (PrintT "guard(%d) %d is out of range" Id) 4 (Between 0 255 Id)) [1,2,3,4::Int]Present [1,2,3,4] (Guards)PresentT [1,2,3,4]^pl @(GuardsN (PrintT "guard(%d) %d is out of range" Id) 4 (Between 0 255 Id)) [1,2,3,4,5::Int])Error Guards:invalid length(5) expected 4+FailT "Guards:invalid length(5) expected 4"Zpl @(GuardsN (PrintT "guard(%d) %d is out of range" Id) 4 (Between 0 255 Id)) [1,2,3::Int])Error Guards:invalid length(3) expected 4+FailT "Guards:invalid length(3) expected 4" predicate-typedfif 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]!FailT "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]FailT "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]PresentT [23,59,12]Bpredicate-typed leverages `. for repeating predicates (passthrough method)hpl @(BoolsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,256]HFalse (Bool(3) [id=3 must be between 0 and 255, found 256] (256 <= 255))FalseTgpl @(BoolsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,44] True (Bools)TrueTDpredicate-typedRboolean guard which checks a given a list of predicates against the list of values|pl @(Bools '[ '(W "hh",Between 0 23 Id), '(W "mm",Between 0 59 Id), '(PrintT "<<<%d %d>>>" Id,Between 0 59 Id) ]) [12,93,14]False (Bool(1) [mm] (93 <= 59))FalseT|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]'False (Bool(2) [<<<2 94>>>] (94 <= 59))FalseT|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)TrueTVpl @(BoolsQuick "abc" '[Between 0 23 Id, Between 0 59 Id, Between 0 59 Id]) [12,13,14] True (Bools)TrueTkpl @(BoolsQuick (PrintT "id=%d val=%d" Id) '[Between 0 23 Id, Between 0 59 Id, Between 0 59 Id]) [12,13,14] True (Bools)TrueTkpl @(BoolsQuick (PrintT "id=%d val=%d" Id) '[Between 0 23 Id, Between 0 59 Id, Between 0 59 Id]) [12,13,99](False (Bool(2) [id=2 val=99] (99 <= 59))FalseTqpl @(Bools '[ '("hours",Between 0 23 Id), '("minutes",Between 0 59 Id), '("seconds",Between 0 59 Id)]) [12,13,14] True (Bools)TrueTqpl @(Bools '[ '("hours",Between 0 23 Id), '("minutes",Between 0 59 Id), '("seconds",Between 0 59 Id)]) [12,60,14]$False (Bool(1) [minutes] (60 <= 59))FalseTtpl @(Bools '[ '("hours",Between 0 23 Id), '("minutes",Between 0 59 Id), '("seconds",Between 0 59 Id)]) [12,60,14,20]*False (Bools:invalid length(4) expected 3)FalseTEpredicate-typedGuardsQuick contain a type level list of conditions and one of matching values: on no match will fail using the first parameterZpz @(GuardsQuick (PrintT "arg %d failed with value %d" Id) '[Gt 4, Ge 3, Same 4]) [17,3,5]!FailT "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]+FailT "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::Int,2,5]Present [10,2,5] (Guards)PresentT [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::Int]Present [31,11,1999] (Guards)PresentT [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::Int])Error Guards:invalid length(2) expected 3+FailT "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::Int]<Error guard(1) 13 is out of range (Guard(0) ok | rhs failed)#FailT "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::Int]QError guard(0) 0 is out of range (Guard(0) failed [guard(0) 0 is out of range] 0)"FailT "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::Int])Error Guards:invalid length(5) expected 3+FailT "Guards:invalid length(5) expected 3"cpl @(GuardsQuick (PrintT "guard(%d) err %03d" Id) '[W 'True, Ge 12, W 'False, Lt 2]) [1,2,-99,-999]1Error guard(1) err 002 (Guard(0) ok | rhs failed)FailT "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+FailT "Guards:invalid length(3) expected 4"ipl @(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+FailT "Guards:invalid length(7) expected 4"Fpredicate-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 listU'prt' receives (Int,a) as input which is the position and value if there is a failureGpz @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 4)]) [17,4]PresentT [17,4]Gpz @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 5)]) [17,4]FailT "arg2 failed"Hpz @(Guards '[ '("arg1 failed",Gt 99), '("arg2 failed", Same 4)]) [17,4]FailT "arg1 failed"epz @(Guards '[ '(PrintT "arg %d failed with value %d" Id,Gt 4), '(PrintT "%d %d" Id, Same 4)]) [17,3] FailT "1 3"-pz @(Msg "isbn10" (Resplit "-" Id) >> Concat Id >> 'Just Unsnoc >> Map (ReadP Int (Singleton Id)) Id *** If (Singleton Id ==~ "X") 10 (ReadP Int (Singleton Id)) >> Zip (1...10 >> Reverse) (Fst Id +: Snd Id) >> Map (Fst Id * Snd Id) Id >> Sum >> Guard ("mod 0 oops") (Id `Mod` 11 == 0)) "0-306-40614-X"FailT "mod 0 oops"pz @(Resplit "-" Id >> Concat Id >> 'Just Unsnoc >> Map (ReadP Int (Singleton Id)) Id *** If (Singleton Id ==~ "X") 10 (ReadP Int (Singleton Id)) >> Zip (1...10 >> Reverse) (Fst Id +: Snd Id) >> Map (Fst Id * Snd Id) Id >> Sum >> Guard ("mod 0 oops") (Id `Mod` 11 == 0)) "0-306-40611-X" PresentT 132pz @(Msg "isbn13" (Resplit "-" Id) >> Concat Id >> Map (ReadP Int (Singleton Id)) Id >> Zip (Cycle 13 [1,3] >> Reverse) Id >> Map (Fst Id * Snd Id) Id >> Sum >> '(Id,Id `Mod` 10) >> Guard (PrintT "sum=%d mod 10=%d" Id) (Snd Id == 0)) "978-0-306-40615-7"PresentT (100,0)pz @(Resplit "-" Id >> Concat Id >> Map (ReadP Int (Singleton Id)) Id >> Zip (Cycle 13 [1,3] >> Reverse) Id >> Map (Fst Id * Snd Id) Id >> Sum >> '(Id,Id `Mod` 10) >> Guard (PrintT "sum=%d mod 10=%d" Id) (Snd Id == 0)) "978-0-306-40615-8"FailT "sum=101 mod 10=1"pz @(Do '[Resplit "-" Id, Concat Id, Zip (Cycle 13 [1,3]) (Map (ReadP Int (Singleton Id)) Id), Map (Fst Id * Snd Id) Id, Sum, Guard (PrintF "%d is not evenly divisible by 10" Id) (Id `Mod` 10 == 0)]) "978-0-7167-0344-9")FailT "109 is not evenly divisible by 10"pz @(Do '[Resplit "-" Id, Concat Id, Zip (Cycle 13 [1,3]) (Map (ReadP Int (Singleton Id)) Id), Map (Fst Id * Snd Id) Id, Sum, Guard (PrintF "%d is not evenly divisible by 10" Id) (Id `Mod` 10 == 0)]) "978-0-7167-0344-0" PresentT 100Gpredicate-typedlike I5 but allows you to use the value in the error messageapl @(Case'' (PrintF "no match for %03d" Id) '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15+Error no match for 015 (Case(0) failed rhs)FailT "no match for 015"apl @(Case'' (PrintF "no match for %03d" Id) '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15+Error no match for 015 (Case(0) failed rhs)FailT "no match for 015"rpl @(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(0) failed rhs)FailT "no match for -012"Hpredicate-typedlike I; but uses a generic error message (skips the 'e' parameter)@pl @(Case' '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15(Error Case:no match (Case(0) failed rhs)FailT "Case:no match"Ipredicate-typedztries to match the value 'r' with a condition in 'ps' and if there is a match calls the associated 'qs' entry else run 'e'Rpl @(Case (Snd Id >> Failp "xx") '[Gt 3, Lt 2, Same 3] '["gt3","lt2","eq3"] Id) 15'Present "gt3" (Case(0 of 3) "gt3" | 15)PresentT "gt3"Qpl @(Case (Snd Id >> Failp "xx") '[Gt 3, Lt 2, Same 3] '["gt3","lt2","eq3"] Id) 1!Present "lt2" (Case(0) "lt2" | 1)PresentT "lt2"Qpl @(Case (Snd Id >> Failp "xx") '[Gt 3, Lt 2, Same 3] '["gt3","lt2","eq3"] Id) 3!Present "eq3" (Case(0) "eq3" | 3)PresentT "eq3"\pl @(Case (Snd Id >> Failp "no match") '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15#Error no match (Case(0) failed rhs)FailT "no match"pl @(Case (Fail (Snd Id >> Unproxy) (PrintF "no match for %03d" (Fst Id))) '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15+Error no match for 015 (Case(0) failed rhs)FailT "no match for 015"Gpl @(Case "other" '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15&Present "other" (Case(0) "other" | 15)PresentT "other"bpl @(Case (ShowP (Fst Id) >> Id <> Id <> Id) '[Same 1, Same 2, Same 3] '["eq1","eq2","eq3"] Id) 15(Present "151515" (Case(0) "151515" | 15)PresentT "151515" predicate-typedtries each predicate ps and on the first match runs the corresponding qs but if there is no match on ps then runs the fail case epz @(Case (Failt _ "asdf") '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 50PresentT "50 is same50"pz @(Case (Failt _ "asdf") '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 9PresentT "9 is lt10"pz @(Case (Failt _ "asdf") '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 3PresentT "3 is lt4"pz @(Case (Failt _ "asdf") '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 99 FailT "asdf"pz @(Case (FailS "asdf" >> Snd Id >> Unproxy) '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 99 FailT "asdf"Epz @(Case (Failt _ "x") '[Same "a",Same "b"] '["hey","there"] Id) "b"PresentT "there"Gpz @(Case (Failt _ "x") '[Id == "a",Id == "b"] '["hey","there"] Id) "a"PresentT "hey"Epz @(Case (Failt _ "x") '[Same "a",Same "b"] '["hey","there"] Id) "c" FailT "x"Jpredicate-typed<similar 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") 10PresentT "greater than 4"<pz @(If (Gt 4) "greater than 4" "less than or equal to 4") 0"PresentT "less than or equal to 4"ppz @(If (Snd Id == "a") '("xxx",Fst Id + 13) (If (Snd Id == "b") '("yyy",Fst Id + 7) (Failt _ "oops"))) (99,"b")PresentT ("yyy",106)Bpl @(If (Len > 2) (Map (Succ Id) Id) (FailS "someval")) [12,15,16]#Present [13,16,17] (If (true cond))PresentT [13,16,17]6pl @(Map (If (Lt 3) 'True (Failt _ "err")) Id) [1..10]$Error err(8) (Map(i=2, a=3) excnt=8)FailT "err(8)":pl @(Map (If (Lt 3) 'True (Failt _ "someval")) Id) [1..10](Error someval(8) (Map(i=2, a=3) excnt=8)FailT "someval(8)",pl @(Map (If (Lt 3) 'True 'False) Id) [1..5]WPresent [True,True,False,False,False] (Map [True,True,False,False,False] | [1,2,3,4,5])&PresentT [True,True,False,False,False]Cpl @(If (Gt 4) (Fail (Hole _) (PrintF "failing with %d" Id)) ()) 45!Error failing with 45 (If [True])FailT "failing with 45"Hpl @(If (Gt 4) (Fail (Hole _) (PrintF "failing with %d" Id)) (Id * 7)) 3Present 21 (If (false cond) 21) PresentT 21_pl @(If (Gt 4) (Fail (Hole _) (PrintF "failing with %d" Id)) (Id * 7 >> ShowP Id >> Ones Id)) 3-Present ["2","1"] (If (false cond) ["2","1"])PresentT ["2","1"]\pl @(If (Gt 4) (Fail (Hole _) (PrintF "failing with %d" Id)) (ShowP (Id * 7) >> Ones Id)) 19!Error failing with 19 (If [True])FailT "failing with 19"=>?@ABCDEFGHIJJIHGFE?>=@ADCBNone&',-.=>?@AHSUVXkepredicate-typedconverts a string ST value to title casepz @ToTitle "HeLlO wOrld!"PresentT "Hello world!"Tdata Color = Red | White | Blue | Green | Black deriving (Show,Eq,Enum,Bounded,Read)%pz @(ToTitle >> ReadP Color Id) "red" PresentT Redfpredicate-typedconverts a string ST value to upper casepz @ToUpper "HeLlO wOrld!"PresentT "HELLO WORLD!"gpredicate-typedconverts a string ST value to lower casepz @ToLower "HeLlO wOrld!"PresentT "hello world!"kpredicate-typed9predicate for determining if the string is all hex digitspz @IsHexDigitAll "01efA"TrueTpz @IsHexDigitAll "01egfA"FalseTnpredicate-typed5predicate for determining if the string is all spacespz @IsSpaceAll "213G"FalseTpz @IsSpaceAll " "TrueTpz @IsSpaceAll ""TrueTopredicate-typed5predicate for determining if the string is all digitspz @IsDigitAll "213G"FalseTpz @IsDigitAll "929"TrueTqpredicate-typed6predicate for determining if a string is all lowercasepz @IsLowerAll "abc"TrueTpz @IsLowerAll "abcX"FalseTpz @IsLowerAll (T.pack "abcX")FalseTpz @IsLowerAll "abcdef213"FalseTpz @IsLowerAll ""TrueT predicate-typed(a predicate for determining if a string UT# belongs to the given character set3pl @('Just Uncons >> IsUpper &* IsLowerAll) "AbcdE">False ((>>) False | {True (&*) False | (IsLowerAll | "bcdE")})FalseT3pl @('Just Uncons >> IsUpper &* IsLowerAll) "Abcde"#True ((>>) True | {True (&*) True})TrueT3pl @('Just Uncons >> IsUpper &* IsLowerAll) "xbcde"8False ((>>) False | {False (&*) True | (IsUpper | "x")})FalseT/pl @('Just Uncons >> IsUpper &* IsLowerAll) "X"#True ((>>) True | {True (&*) True})TrueTpz @( '(IsControlAll, IsLatin1All , IsHexDigitAll , IsOctDigitAll , IsDigitAll , IsPunctuationAll , IsSeparatorAll , IsSpaceAll)) "abc134"8PresentT (False,True,True,False,False,False,False,False)Spl @(SplitAts [1,2,10] Id >> Para '[IsLowerAll, IsDigitAll, IsUpperAll]) "abdefghi"hPresent [True,False,False] ((>>) [True,False,False] | {Para(0) [True,False,False] | ["a","bd","efghi"]})PresentT [True,False,False]\pl @(SplitAts [1,2,10] Id >> BoolsQuick "" '[IsLowerAll, IsDigitAll, IsUpperAll]) "a98efghi"8False ((>>) False | {Bool(2) [] (IsUpperAll | "efghi")})FalseTjpl @(SplitAts [1,2,10] Id >> BoolsQuick "" '[IsLowerAll, IsDigitAll, IsUpperAll || IsLowerAll]) "a98efghi"True ((>>) True | {Bools})TrueTjpl @(SplitAts [1,2,10] Id >> BoolsQuick "" '[IsLowerAll, IsDigitAll, IsUpperAll || IsLowerAll]) "a98efgHi"eFalse ((>>) False | {Bool(2) [] (False || False | (IsUpperAll | "efgHi") || (IsLowerAll | "efgHi"))})FalseTrpredicate-typedpredicate similar to  spredicate-typedpredicate similar to  tpredicate-typedpredicate similar to upredicate-typedpredicate similar to pz @IsHexDigit 'A'TrueTpz @IsHexDigit 'g'FalseTvpredicate-typedpredicate similar to wpredicate-typedpredicate similar to xpredicate-typedpredicate similar to pz @IsSpace '\t'TrueTpz @IsSpace ' 'TrueTpz @IsSpace 'x'FalseTypredicate-typedpredicate similar to pz @IsDigit 'g'FalseTpz @IsDigit '9'TrueTzpredicate-typedpredicate similar to {predicate-typedpredicate similar to pz @IsLower 'X'FalseTpz @IsLower '1'FalseTpz @IsLower 'a'TrueTpredicate-typedMa predicate for determining if a character belongs to the given character setrpz @(Map '(IsControl, IsLatin1, IsHexDigit, IsOctDigit, IsDigit, IsPunctuation, IsSeparator, IsSpace) Id) "abc134"$PresentT [(False,True,True,False,False,False,False,False),(False,True,True,False,False,False,False,False),(False,True,True,False,False,False,False,False),(False,True,True,True,True,False,False,False),(False,True,True,True,True,False,False,False),(False,True,True,True,True,False,False,False)]|predicate-typed.extracts the first character from a non empty ~pz @(Char1 "aBc") () PresentT 'a'efghijklmnopqrstuvwxyz{||{zyxwvutsrqponmlkjihefgVNone  !"#$%&'()*+,-./01ABCDEGHIJF85234679:;<=>?@KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~#$%&'()*+,789:;<=>?@ABCDEFGHIJKLMNOPQRSuvwxyz{|}~ !"#$%&'()*+,-./0123456abcdefghijkwxyz{|}~      !"#$%&'()*+,789:;<=>?@ABCDEF_`abcdefghijklmnopqrstuvwxyz{|}~    =>?@ABCDEFGHIJefghijklmnopqrstuvwxyz{|None,-.=>?HSUVXŅpredicate-typed9'ip' type for reading one of many date time formats from predicate-typed4'ip' type for reading one of many date formats from predicate-typed('fmt' type for formatting an ip6 addresspredicate-typed8'op' type for validating an ip6 address using predicatespredicate-typed''ip' type for reading in an ip6 addresspredicate-typed%regular expression for an ip4 addresspredicate-typedregular expression for an octetpredicate-typed('fmt' type for formatting an ip4 addresspredicate-typed5'op' type for validating an ip4 address using a guardpredicate-typed9'op' type for validating an ip4 address using a predicatepredicate-typedB'ip' type for reading in an ip4 address using a regular expressionpredicate-typed''ip' type for reading in an ip4 addresspredicate-typed%regular expression for an ip4 addresspredicate-typed'regular expression for a time componentpredicate-typed"'fmt' type for formatting the timepredicate-typed1'op' type for validating the time using predicatepredicate-typed/'op' type for validating the time using a guardpredicate-typed'ip' type for reading in timepredicate-typed2'fmt' type for formatting the ssn compatible with predicate-typed'op' type for validating a ssnpredicate-typed'ip' type for reading in a ssnpredicate-typed7'fmt' type for formatting the date time compatible ith predicate-typed$'ip' type for reading in a date timepredicate-typed uses builtin gpredicate-typed@'fmt' type for formatting a credit card using 'ns' as the formatpredicate-typed<'op' type for validating a credit card number by check digitpredicate-typedK'ip' type for converting a credit card number to a list of singleton digits++None &'-.>HXknpredicate-typed creates a 00 refinement type8$$(refinedTH 123) :: Refined OZ (Between 100 125 Id) Int Refined 123 :>$$(refinedTH 99) :: Refined OZ (Between 100 125 Id) Int  interactive8:8:4: error: * refinedTH: predicate failed with FalseP (100 <= 99) * In the Template Haskell splice $$(refinedTH 99) In the expression: $$(refinedTH 99) :: Refined (Between 100 125 Id) Int In an equation for 'it': it = $$(refinedTH 99) :: Refined (Between 100 125 Id) Int 9$$(refinedTH 123) :: Refined OAN (Between 100 125 Id) Int Refined 123 K>$$(refinedTH 99) :: Refined OAN (FailS "asdf" >> Between 100 125 Id) Int  interactiveL:116:4: error: * [Error asdf] lhs failed >> | `- [Error asdf] Fail asdf | `- P '"asdf" refinedTH: predicate failed with FailP "asdf" ((>>) lhs failed) * In the Template Haskell splice $$(refinedTH 99) In the expression: $$(refinedTH 99) :: Refined (FailS "asdf" >> Between 100 125 Id) Int predicate-typed creates a WW refinement type@$$(refined1TH 100) :: Refined1 OZ Id (Between 100 125 Id) Id Int Refined1 100@$$(refined1TH 100) :: Refined1 OZ Id (Between 100 125 Id) Id Int Refined1 100@$$(refined1TH 100) :: Refined1 OZ Id (Between 100 125 Id) Id Int Refined1 100 B>$$(refined1TH 99) :: Refined1 OZ Id (Between 100 125 Id) Id Int  interactive :127:4: error: * *** Step 1. Success Initial Conversion(ip) (99) *** P Id 99 *** Step 2. False Boolean Check(op) *** False 100 <= 99 | +- P Id 99 | +- P '100 | `- P '125 refined1TH: predicate failed with Step 2. False Boolean Check(op) | {100 <= 99} * In the Template Haskell splice $$(refined1TH 99) In the expression: $$(refined1TH 99) :: Refined1 OZ Id (Between 100 125 Id) Id Int In an equation for 'it': it = $$(refined1TH 99) :: Refined1 OZ Id (Between 100 125 Id) Id Int predicate-typed creates a ## refinement type=$$(refined2TH 100) :: Refined2 OA Id (Between 100 125 Id) Int"Refined2 {r2In = 100, r2Out = 100}>$$(refined2TH 100) :: Refined2 OAN Id (Between 100 125 Id) Int"Refined2 {r2In = 100, r2Out = 100} @>$$(refined2TH 99) :: Refined2 OAN Id (Between 100 125 Id) Int  interactive :127:4: error: * *** Step 1. Success Initial Conversion(ip) (99) *** P Id 99 *** Step 2. False Boolean Check(op) *** False 100 <= 99 | +- P Id 99 | +- P '100 | `- P '125 refined2TH: predicate failed with Step 2. False Boolean Check(op) | {100 <= 99} * In the Template Haskell splice $$(refined2TH 99) In the expression: $$(refined2TH 99) :: Refined2 OZ Id (Between 100 125 Id) Id Int In an equation for 'it': it = $$(refined2TH 99) :: Refined2 OZ Id (Between 100 125 Id) Id Int predicate-typed creates a "" refinement type@$$(refined3TH 100) :: Refined3 OZ Id (Between 100 125 Id) Id Int"Refined3 {r3In = 100, r3Out = 100}A$$(refined3TH 100) :: Refined3 OAN Id (Between 100 125 Id) Id Int"Refined3 {r3In = 100, r3Out = 100} C>$$(refined3TH 99) :: Refined3 OAN Id (Between 100 125 Id) Id Int  interactive :127:4: error: * *** Step 1. Success Initial Conversion(ip) (99) *** P Id 99 *** Step 2. False Boolean Check(op) *** False 100 <= 99 | +- P Id 99 | +- P '100 | `- P '125 refined3TH: predicate failed with Step 2. False Boolean Check(op) | {100 <= 99} * In the Template Haskell splice $$(refined3TH 99) In the expression: $$(refined3TH 99) :: Refined3 OAN Id (Between 100 125 Id) Id Int In an equation for 'it': it = $$(refined3TH 99) :: Refined3 OAN Id (Between 100 125 Id) Id Int $$(refined3TH @OZ @(Resplit "\\." Id >> Map (ReadP Int Id) Id) @(All (0 <..> 0xff) Id && Len == 4) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "200.2.3.4")8Refined3 {r3In = [200,2,3,4], r3Out = "200.002.003.004"}None,-.=>?HSUVX\predicate-typed;take any valid Read/Show instance and turn it into a valid :m + Data.Ratio.newRefined3P (readshow @OZ @Rational) "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})/newRefined3P (readshow @OZ @Rational) "13x % 3"LLeft "Step 1. Initial Conversion(ip) Failed | ReadP Ratio Integer (13x % 3)"CnewRefined3P (readshow' @OZ @Rational @(3 % 1 <..> 5 % 1)) "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})MnewRefined3P (Proxy @(ReadShow' OZ Rational (11 -% 2 <..> 3 -% 1))) "-13 % 3"8Right (Refined3 {r3In = (-13) % 3, r3Out = "(-13) % 3"})FnewRefined3P (Proxy @(ReadShow' OZ Rational (Id > (15 % 1)))) "13 % 3"/Left "Step 2. False Boolean Check(op) | FalseP"~newRefined3P (Proxy @(ReadShow' OL Rational (Msg (PrintF "invalid=%3.2f" (FromRational Double Id)) (Id > (15 % 1))))) "13 % 3"GLeft "Step 2. False Boolean Check(op) | {invalid=4.33 13 % 3 > 15 % 1}"FnewRefined3P (Proxy @(ReadShow' OZ Rational (Id > (11 % 1)))) "13 % 3"/Left "Step 2. False Boolean Check(op) | FalseP"FnewRefined3P (readshow @OZ @UTCTime) "2018-10-19 14:53:11.5121359 UTC"dRight (Refined3 {r3In = 2018-10-19 14:53:11.5121359 UTC, r3Out = "2018-10-19 14:53:11.5121359 UTC"}):m + Data.Aeson:newRefined3P (readshow @OZ @Value) "String \"jsonstring\""NRight (Refined3 {r3In = String "jsonstring", r3Out = "String \"jsonstring\""})1newRefined3P (readshow @OZ @Value) "Number 123.4">Right (Refined3 {r3In = Number 123.4, r3Out = "Number 123.4"})predicate-typedSconvert a string from a given base 'i' and store it internally as a base 'j' string+newRefined3P (Proxy @(BaseIJ OZ 16 2)) "fe"2Right (Refined3 {r3In = "11111110", r3Out = "fe"}),newRefined3P (Proxy @(BaseIJ OZ 16 2)) "fge">Left "Step 1. Initial Conversion(ip) Failed | invalid base 16"HnewRefined3P (Proxy @(BaseIJ' OL 16 2 (ReadBase Int 2 Id < 1000))) "ffe"6Left "Step 2. False Boolean Check(op) | {4094 < 1000}"predicate-typed noop falsepredicate-typed noop truepredicate-typed Luhn check)newRefined3P (Proxy @(LuhnT OZ 4)) "1230"3Right (Refined3 {r3In = [1,2,3,0], r3Out = "1230"}))newRefined3P (Proxy @(LuhnT OL 4)) "1234"hLeft "Step 2. False Boolean Check(op) | {True && False | (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])}"| uses builtin gpredicate-typedTconvert a string from a given base 'i' and store it internally as an base 10 integer newRefined3P (base16 @OZ) "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})4newRefined3P (basen' @OZ @16 @(100 <..> 400)) "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})GnewRefined3P (basen' @OZ @16 @(GuardSimple (Id < 400) >> 'True)) "f0fe"7Left "Step 2. Failed Boolean Check(op) | (61694 < 400)"XnewRefined3P (basen' @OL @16 @(Id < 400)) "f0fe" -- todo: why different parens vs braces6Left "Step 2. False Boolean Check(op) | {61694 < 400}"predicate-typedvalidate isbn13-newRefined3P (isbn13 @OZ) "978-0-306-40615-7"ORight (Refined3 {r3In = [9,7,8,0,3,0,6,4,0,6,1,5,7], r3Out = "978030640615-7"})-newRefined3P (isbn13 @OZ) "978-0-306-40615-8":Left "Step 2. Failed Boolean Check(op) | sum=101 mod 10=1"predicate-typedvalidate isbn10)newRefined3P (isbn10 @OZ) "0-306-40611-X"IRight (Refined3 {r3In = ([0,3,0,6,4,0,6,1,1],10), r3Out = "030640611-X"}))newRefined3P (isbn10 @OZ) "0-306-40611-9"4Left "Step 2. Failed Boolean Check(op) | mod 0 oops"predicate-typed'read in an ipv4 address and validate it%newRefined3P (ip4 @OZ) "001.223.14.1"ARight (Refined3 {r3In = [1,223,14,1], r3Out = "001.223.014.001"})'newRefined3P (ip4 @OL) "001.223.14.999"NLeft "Step 2. Failed Boolean Check(op) | octet 3 out of range 0-255 found 999")newRefined3P (ip4 @OZ) "001.223.14.999.1"MLeft "Step 2. Failed Boolean Check(op) | Guards:invalid length(5) expected 4"%newRefined3P (ip4 @OL) "001.257.14.1"NLeft "Step 2. Failed Boolean Check(op) | octet 1 out of range 0-255 found 257"predicate-typedread in an ssn$newRefined3P (ssn @OZ) "134-01-2211"=Right (Refined3 {r3In = [134,1,2211], r3Out = "134-01-2211"})$newRefined3P (ssn @OL) "666-01-2211"yLeft "Step 2. False Boolean Check(op) | {Bool(0) [number for group 0 invalid: found 666] (True && False | (666 /= 666))}"$newRefined3P (ssn @OL) "667-00-2211"aLeft "Step 2. False Boolean Check(op) | {Bool(1) [number for group 1 invalid: found 0] (1 <= 0)}"predicate-typedcredit card with luhn algorithm'newRefined3P (cc11 @OZ) "1234-5678-901"/Left "Step 2. False Boolean Check(op) | FalseP"'newRefined3P (cc11 @OZ) "1234-5678-903"JRight (Refined3 {r3In = [1,2,3,4,5,6,7,8,9,0,3], r3Out = "1234-5678-903"})#pz @(Ccip >> Ccop 11) "79927398713"TrueT#pz @(Ccip >> Ccop 10) "79927398713"'FailT "expected 10 digits but found 11"predicate-typedread in a valid datetime=newRefined3P (datetime1 @OL @LocalTime) "2018-09-14 02:57:04"LRight (Refined3 {r3In = 2018-09-14 02:57:04, r3Out = "2018-09-14 02:57:04"})=newRefined3P (datetime1 @OL @LocalTime) "2018-09-99 12:12:12"[Left "Step 1. Initial Conversion(ip) Failed | ParseTimeP LocalTime (%F %T) failed to parse"predicate-typedread in a time and validate it!newRefined3P (hms @OL) "23:13:59"8Right (Refined3 {r3In = [23,13,59], r3Out = "23:13:59"})!newRefined3P (hms @OL) "23:13:60"CLeft "Step 2. Failed Boolean Check(op) | seconds invalid: found 60"!newRefined3P (hms @OL) "26:13:59"ALeft "Step 2. Failed Boolean Check(op) | hours invalid: found 26" predicate-typed8ensures that two numbers are in a given range (emulates 00)%newRefined3P (between @OZ @10 @16) 14(Right (Refined3 {r3In = 14, r3Out = 14})%newRefined3P (between @OZ @10 @16) 17/Left "Step 2. False Boolean Check(op) | FalseP"#prtEval3P (between @OAN @10 @16) 171Left 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,-.=>?HSUVX predicate-typed Luhn check*newRefined2 @OZ @Luhnip @(Luhnop 4) "1230"3Right (Refined2 {r2In = [1,2,3,0], r2Out = "1230"})*newRefined2 @OL @Luhnip @(Luhnop 4) "1234"hLeft "Step 2. False Boolean Check(op) | {True && False | (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])}"| uses builtin gSconvert a string from a given base 'i' and store it internally as a base 'j' string,newRefined2 @OZ @(BaseIJip 16 2) @'True "fe"2Right (Refined2 {r2In = "11111110", r2Out = "fe"})-newRefined2 @OZ @(BaseIJip 16 2) @'True "fge">Left "Step 1. Initial Conversion(ip) Failed | invalid base 16"BnewRefined2 @OL @(BaseIJip 16 2) @(ReadBase Int 2 Id < 1000) "ffe"6Left "Step 2. False Boolean Check(op) | {4094 < 1000}"predicate-typedTconvert a string from a given base 'i' and store it internally as an base 10 integer3newRefined2 @OZ @(ReadBase Int 16 Id) @'True "00fe"-Right (Refined2 {r2In = 254, r2Out = "00fe"})BnewRefined2 @OZ @(ReadBase Int 16 Id) @(Between 100 400 Id) "00fe"-Right (Refined2 {r2In = 254, r2Out = "00fe"})OnewRefined2 @OZ @(ReadBase Int 16 Id) @(GuardSimple (Id < 400) >> 'True) "f0fe"7Left "Step 2. Failed Boolean Check(op) | (61694 < 400)"`newRefined2 @OL @(ReadBase Int 16 Id) @(Id < 400) "f0fe" -- todo: why different parens vs braces6Left "Step 2. False Boolean Check(op) | {61694 < 400}"predicate-typedvalidate isbn13-newRefined2P (isbn13 @OZ) "978-0-306-40615-7"RRight (Refined2 {r2In = [9,7,8,0,3,0,6,4,0,6,1,5,7], r2Out = "978-0-306-40615-7"})-newRefined2P (isbn13 @OZ) "978-0-306-40615-8":Left "Step 2. Failed Boolean Check(op) | sum=101 mod 10=1"predicate-typedvalidate isbn10)newRefined2P (isbn10 @OZ) "0-306-40611-X"KRight (Refined2 {r2In = ([0,3,0,6,4,0,6,1,1],10), r2Out = "0-306-40611-X"}))newRefined2P (isbn10 @OZ) "0-306-40611-9"4Left "Step 2. Failed Boolean Check(op) | mod 0 oops" predicate-typed'read in an ipv4 address and validate it-newRefined2 @OZ @Ip4ip @Ip4op' "001.223.14.1">Right (Refined2 {r2In = [1,223,14,1], r2Out = "001.223.14.1"})/newRefined2 @OL @Ip4ip @Ip4op' "001.223.14.999"fLeft "Step 2. False Boolean Check(op) | {Bool(3) [octet 3 out of range 0-255 found 999] (999 <= 255)}"'newRefined2P (ip4 @OL) "001.223.14.999"NLeft "Step 2. Failed Boolean Check(op) | octet 3 out of range 0-255 found 999")newRefined2P (ip4 @OL) "001.223.14.999.1"MLeft "Step 2. Failed Boolean Check(op) | Guards:invalid length(5) expected 4"%newRefined2P (ip4 @OL) "001.257.14.1"NLeft "Step 2. Failed Boolean Check(op) | octet 1 out of range 0-255 found 257"+predicate-typedcredit card with luhn algorithm0newRefined2 @OZ @Ccip @(Ccop 11) "1234-5678-901"/Left "Step 2. False Boolean Check(op) | FalseP"0newRefined2 @OZ @Ccip @(Ccop 11) "1234-5678-903"JRight (Refined2 {r2In = [1,2,3,4,5,6,7,8,9,0,3], r2Out = "1234-5678-903"})#pz @(Ccip >> Ccop 11) "79927398713"TrueT#pz @(Ccip >> Ccop 10) "79927398713"'FailT "expected 10 digits but found 11",predicate-typedread in a valid datetime>newRefined2 @OL @(Dtip LocalTime) @'True "2018-09-14 02:57:04"LRight (Refined2 {r2In = 2018-09-14 02:57:04, r2Out = "2018-09-14 02:57:04"})>newRefined2 @OL @(Dtip LocalTime) @'True "2018-09-99 12:12:12"[Left "Step 1. Initial Conversion(ip) Failed | ParseTimeP LocalTime (%F %T) failed to parse"/predicate-typedread in an ssn+newRefined2 @OZ @Ssnip @Ssnop "134-01-2211"=Right (Refined2 {r2In = [134,1,2211], r2Out = "134-01-2211"})+newRefined2 @OL @Ssnip @Ssnop "666-01-2211"yLeft "Step 2. False Boolean Check(op) | {Bool(0) [number for group 0 invalid: found 666] (True && False | (666 /= 666))}"+newRefined2 @OL @Ssnip @Ssnop "667-00-2211"aLeft "Step 2. False Boolean Check(op) | {Bool(1) [number for group 1 invalid: found 0] (1 <= 0)}"0predicate-typedread in a time and validate it)newRefined2 @OL @Hmsip @Hmsop' "23:13:59"8Right (Refined2 {r2In = [23,13,59], r2Out = "23:13:59"}))newRefined2 @OL @Hmsip @Hmsop' "23:13:60"GLeft "Step 2. False Boolean Check(op) | {Bool(2) [seconds] (60 <= 59)}")newRefined2 @OL @Hmsip @Hmsop' "26:13:59"ELeft "Step 2. False Boolean Check(op) | {Bool(0) [hours] (26 <= 23)}"% !"#$%&'()*+,-./0123456%*,.)-'(0#$!"+6/%&1 2345XNone,-.=>?HSVX&None  !"#$%&'()*+,-./01ABCDEGHIJF85234679:;<=>?@KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~JKLMNOPQRSTUVWXYZ[\]^_`#$%&'()*+,789:;<=>?@ABCDEFGHIJKLMNOPQRSuvwxyz{|}~ !"#$%&'()*+,-./0123456abcdefghijkwxyz{|}~      !"#$%&'()*+,789:;<=>?@ABCDEF_`abcdefghijklmnopqrstuvwxyz{|}~    =>?@ABCDEFGHIJefghijklmnopqrstuvwxyz{|YZ[YZ\YZ]YZ^YZ_YZ`YZaYZbYZcYZdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~)0 *     !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~0"#      !"#$%&'()*+,,-./012W3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab3.cdefghijklmn o p q r s t u v w x y z { | } ~                                                                                                                            $ %                                        ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G HIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZJ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&N'()M*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCD   E             ! " # $ & % ' ( ) * , 0 ? > 1 2 3 4 5 6 7 /!F!G!H!I!J!K!L!MN(ON<PQRSN(TUQRVW6XYZ[YZ\]^_N`abcdefghijklmnopqrstuvwxyz{|}~QRNQRQN(NQQNNN<N<N(QN<N<QRNQRRN(NNW6W6  WWWWWW6NNNN UUU  'YZYZYZYZNQNNN?N?N?N?NNN?NN?N?N?N?N?N?NN(N(N(N(N(N<N<N<N(NNNNNNNNNNNNN<NNNNN<N<N<NN<N<NN   N( NG NNNNN N!"N!#N($%&'%&(N(N(N(N(N)*N)+N),N)-N).N)/N<0N1N23N24N25N26N278N29N2:N2;<=>?@P@ABCDEFNGHNIJNGKNGLNGMNGNNGONGPNGQNGRST.predicate-typed-0.7.3.0-6mqUDXsNsMzKu9EqNohHewPredicate.UtilPredicate.TH_OrphansPredicate.CorePredicate.RefinedPredicate.Refined3Predicate.Refined2Predicate.Refined1Predicate.Data.TuplePredicate.Data.ThesePredicate.Data.StringPredicate.Data.RegexPredicate.Data.ReadShowPredicate.Data.OrderingPredicate.Data.NumericPredicate.Data.MonoidPredicate.Data.ListPredicate.Data.JsonPredicate.Data.FoldablePredicate.Data.MaybePredicate.Data.IndexPredicate.Data.IOPredicate.Data.ExtraPredicate.Data.EnumPredicate.Data.IteratorPredicate.Data.EitherPredicate.Data.DateTimePredicate.Data.ConditionPredicate.Data.CharPredicate.Examples.CommonPredicate.Util_THPredicate.Examples.Refined3Predicate.Examples.Refined2Paths_predicate_typedRefined3Refined2PrintLPrintT Predicate ReplaceImplGHC.Base$>> Data.MaybefromJust Control.Arrow&&&StringRefinedsecondfirst*** Data.Alignalign Data.ThesethesemergeTheseWithT stripRight stripLeft Data.FoldableorandGHC.Realmod fromMaybe catMaybesmapMaybe isNothingisJustmaybe GHC.MaybeJust Data.List!!Sequnfoldr|||+++ Date.Time parseTimeM GHC.TypeLitsSymbolData.Text.LensIsText Data.TextPredicate.PreludeRefined1Predicate.Examples.Refined1.pretty-terminal-0.1.0.0-5h8HGBvScbYFgk2HEq8jrWSystem.Console.PrettyDefaultWhiteCyanMagentaBlueYellowGreenRedBlackColor $fLiftFixed$fLiftTimeOfDay$fLiftTimeZone$fLiftZonedTime$fLiftLocalTime $fLiftDay$fLiftDiffTime $fLiftUTCTimeTheseTThatTThisTRightTLeftTMaybeTExtractAFromListExtractAFromTAOptTTAnyTT5_5T5_4T5_3T5_2T5_1T4_4T4_3T4_2T4_1OUVOUBOUOAVOABOAOANVOANOLOZOptTCgetOptT'OptTOWidthOMsg ORecursionOOtherOEmpty:#OColorOColorOn OColorOffOAnsiOUnicodeOZeroOLiteONormalOVerbose MonadEvalrunIOcatchit catchitNFliftEvalConsTMapTSumTIfTFlipT%&%% InductListC InductListP inductListC InductTupleC InductTupleP inductTupleCLenT IntersperseT<%>RepeatTGetOrdgetOrd OrderingPCGtCGeCEqCLeCLtCNeGetBoolgetBool GetOrdering getOrderingGetThesegetTheseGetLengetLenGetSymbsgetSymbsGetNatsgetNatsNotTOrTAndT FailUnlessT FailWhenT ZwischenTRReplace RReplace1 RReplace2 RReplace3GetReplaceFnSubgetReplaceFnSub ReplaceFnSubRPrepend ROverWriteRAppendGetROptsgetROptsROptAnchored Auto_calloutCaselessDollar_endonlyDotallDupnamesExtendedExtra Firstline Multiline Newline_cr Newline_crlf Newline_lfNo_auto_captureUngreedyUtf8 No_utf8_checkOther2Other1Color5Color4Color3Color2Color1DebugDZeroDLiteDNormalDVerboseDispAnsiUnicodePOptsLHOptsoWidthoDebugoDispoColoroMsg oRecursionoOtheroNoColorPOptsHolderPEGetBoolTgetBoolTBoolTFailTFalseTTrueTPresentTTT_tBool_tString_tForesttBooltStringtForestpStringmkNodemkNodeB mkNodeSkipP getValAndPEgetValLRFromTTfromTThh getValueLR isVerbosefixBoolTshow01show01'lit01 litVerbose showVerboseshowLlitLlitBLlitBS compileRegex displayROpts splitAndAlign_FailT _PresentT_FalseT_TrueT~>natsymb showThese hasNoTree colorBoolT colorBoolT'fixLite prtTreePure topMessagefixit prefixMsgshowTshowTK prettyOrd removeAnsierrorInProgram readFieldgetOptTchkSize formatOMsgsuboptssetOtherEffects pureTryTestpureTryTestPredisPrime unlessNull badLengthprtTree showIndex$fFoldableBoolT$fSemigroupBoolT$fGetBoolTaFailT$fGetBoolTaPresentT$fGetBoolTBoolFalseT$fGetBoolTBoolTrueT $fFoldableTT $fShowSColor $fShowPColor$fSemigroupHOpts $fMonoidHOpts $fGetROpts[]$fGetROptNo_utf8_check $fGetROptUtf8$fGetROptUngreedy$fGetROptNo_auto_capture$fGetROptNewline_lf$fGetROptNewline_crlf$fGetROptNewline_cr$fGetROptMultiline$fGetROptFirstline$fGetROptExtra$fGetROptExtended$fGetROptDupnames$fGetROptDotall$fGetROptDollar_endonly$fGetROptCaseless$fGetROptAuto_callout$fGetROptAnchored $fGetROpts:$fGetReplaceFnSubRAppend$fGetReplaceFnSubROverWrite$fGetReplaceFnSubRPrepend$fShowRReplace $fGetNats[]: $fGetNats[][] $fGetSymbs[]:$fGetSymbs[][]$fGetLenNonEmpty:|$fGetLenTheseThese$fGetLenTheseThat$fGetLenTheseThis$fGetLenEitherRight$fGetLenEitherLeft$fGetLenMaybeNothing$fGetLenMaybeJust $fGetLen[]: $fGetLen[][]$fGetTheseTheseThese$fGetTheseTheseThat$fGetTheseTheseThis$fGetOrderingGT$fGetOrderingEQ$fGetOrderingLT$fGetBoolFalse $fGetBoolTrue$fGetColorDefault$fGetColorWhite$fGetColorCyan$fGetColorMagenta$fGetColorBlue$fGetColorYellow$fGetColorGreen $fGetColorRed$fGetColorBlack $fGetOrdCNe $fGetOrdCLt $fGetOrdCLe $fGetOrdCEq $fGetOrdCGe $fGetOrdCGt$fInductTupleC(,,,,,,,,,,,)$fInductTupleC(,,,,,,,,,,)$fInductTupleC(,,,,,,,,,)$fInductTupleC(,,,,,,,,)$fInductTupleC(,,,,,,,)$fInductTupleC(,,,,,,)$fInductTupleC(,,,,,)$fInductTupleC(,,,,)$fInductTupleC(,,,)$fInductTupleC(,,)$fInductTupleC(,)$fInductTupleC()$fInductListC12a$fInductListC11a$fInductListC10a$fInductListC9a$fInductListC8a$fInductListC7a$fInductListC6a$fInductListC5a$fInductListC4a$fInductListC3a$fInductListC2a$fInductListC1a$fInductListC0a $fMonadEvalIO$fMonadEvalIdentity $fShowOptT $fOptTCOUV $fOptTCOUB $fOptTCOU $fOptTCOAV $fOptTCOAB $fOptTCOA $fOptTCOANV $fOptTCOAN $fOptTCOL $fOptTCOZ$fOptTCOVerbose$fOptTCONormal $fOptTCOLite $fOptTCOZero$fOptTCOUnicode $fOptTCOAnsi$fOptTCOColorOff$fOptTCOColorOn $fOptTCOColor $fOptTC:# $fOptTCOEmpty $fOptTCOOther$fOptTCORecursion $fOptTCOMsg $fOptTCOWidth $fShowBoolP $fEqBoolP$fShowPE$fShowTT $fShowDisp$fEqDisp $fOrdDebug $fShowDebug $fEqDebug $fEnumDebug$fBoundedDebug $fShowROpt$fEqROpt $fOrdROpt $fEnumROpt $fBoundedROpt$fShowReplaceFnSub$fEqReplaceFnSub$fShowOrderingP $fEqOrderingP$fEnumOrderingP$fBoundedOrderingP $fShowHOpts $fEqBoolT $fShowBoolTCoercePure&SwapCswapCSwap||~||&&~&&DoMapL6L5L4L3ThdL2SndL1FstAnyAll<..>BetweenOnePFailpFailtFailSFailIdBoolNotLengthLenUnproxyWrapWrap'Unwrap<<WidthHoleHideMsgIMsgWIdTIdIPPPevalevalBool evalQuickpzplpanpanvpapabpavpupubpuvrunrunsrunPQ runPQBool evalBoolHideevalHide $fPBoolTba$fPProxyProxya$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 $fPTYPE()a $fPTYPEIa $fPTYPEIda $fPTYPEIdTa $fPTYPEMsga $fPTYPEMsgIa $fPTYPEWa $fPTYPEHidex $fPTYPEHolea $fPTYPEWidtha $fPTYPE>>a $fPTYPE<x $fPTYPEAllx $fPTYPEAnyx $fPTYPEL1x$fExtractL1C(,,,,,)$fExtractL1C(,,,,)$fExtractL1C(,,,)$fExtractL1C(,,)$fExtractL1C(,) $fPTYPEFstx $fPTYPEL2x$fExtractL2C(,,,,,)$fExtractL2C(,,,,)$fExtractL2C(,,,)$fExtractL2C(,,)$fExtractL2C(,) $fPTYPESndx $fPTYPEL3x$fExtractL3C(,,,,,)$fExtractL3C(,,,,)$fExtractL3C(,,,)$fExtractL3C(,,)$fExtractL3C(,) $fPTYPEThdx$fExtractL4C(,,,,,)$fExtractL4C(,,,,)$fExtractL4C(,,,)$fExtractL4C(,,)$fExtractL4C(,) $fPTYPEL4x$fExtractL5C(,,,,,)$fExtractL5C(,,,,)$fExtractL5C(,,,)$fExtractL5C(,,)$fExtractL5C(,) $fPTYPEL5x$fExtractL6C(,,,,,)$fExtractL6C(,,,,)$fExtractL6C(,,,)$fExtractL6C(,,)$fExtractL6C(,) $fPTYPEL6x $fPTYPEBothx $fPTYPEMapx $fPTYPEDoa $fPTYPE&&a $fPTYPE&&~a $fPTYPE||a $fPTYPE||~a $fPTYPE~>a $fPTYPESwapp $fSwapC(,) $fSwapCThese $fSwapCEither $fPTYPE$a $fPTYPE&a $fPTYPEPurex$fPTYPECoercea AppendOptT ReplaceOptTRefinedT unRefinedTRefinedC unRefined genRefinedrapply rapplyLiftconvertRefinedT withRefinedTwithRefinedTIO prtRefinedIO newRefined newRefinedM newRefinedT newRefinedTIOunRavelT prtRefinedTIO unsafeRefinedunsafeRefined'$fToJSONRefined$fArbitraryRefined$fHashableRefined$fBinaryRefined$fFromJSONRefined $fReadRefined$fIsStringRefined$fMonadError[]RefinedT$fMonadTransRefinedT $fShowRefined $fEqRefined$fGenericRefined $fLiftRefined$fFunctorRefinedT$fApplicativeRefinedT$fMonadRefinedT$fMonadContRefinedT$fMonadWriterRefinedT$fShowRefinedT$fMonadIORefinedT AppendOptT3 ReplaceOptT3RefinedEmulateMsg3m3Descm3Shortm3Long RResults3RFRTFRTFalseRTTrueFRTTrueTMakeR3'MakeR3 Refined3Cr3Inr3OutunsafeRefined3'unsafeRefined3 genRefined3 genRefined3PmkProxy3 mkProxy3'withRefined3TIO withRefined3TwithRefined3TP newRefined3 newRefined3P newRefined3T newRefined3TPnewRefined3TIOnewRefined3TPIOconvertRefined3TPrapply3rapply3P prtEval3IO prtEval3PIOprtEval3 prtEval3Peval3eval3Peval3Mprt3IOprt3Impleval3PXeval3X$fToJSONRefined3$fHashableRefined3$fBinaryRefined3$fArbitraryRefined3$fFromJSONRefined3$fReadRefined3$fIsStringRefined3 $fShowMsg3$fShowRResults3$fEqMsg3$fLiftRefined3 $fEqRefined3$fShowRefined3 AppendOptT2 ReplaceOptT2MakeR2Msg2m2Descm2Shortm2Long RResults2RTTrue Refined2Cr2Inr2OutunsafeRefined2'unsafeRefined2 genRefined2 genRefined2PwithRefined2TIO withRefined2TwithRefined2TP newRefined2 newRefined2P newRefined2T newRefined2TPnewRefined2TIO prtEval2IO prtEval2PIOprtEval2 prtEval2Peval2Peval2eval2Mprt2IOprt2ImplmkProxy2 mkProxy2'$fToJSONRefined2$fHashableRefined2$fBinaryRefined2$fArbitraryRefined2$fFromJSONRefined2$fReadRefined2$fIsStringRefined2 $fShowMsg2$fShowRResults2$fEqMsg2$fLiftRefined2 $fEqRefined2$fShowRefined2 AppendOptT1 ReplaceOptT1Msg1m1Descm1Shortm1Long RResults1MakeR1 Refined1C unRefined1unsafeRefined1'unsafeRefined1 genRefined1 genRefined1PmkProxy1 mkProxy1'withRefined1TIO withRefined1TwithRefined1TP newRefined1 newRefined1P newRefined1T newRefined1TPnewRefined1TPIOconvertRefined1TPrapply1rapply1P prtEval1IO prtEval1PIOprtEval1 prtEval1Peval1Peval1eval1Mprt1IOprt1Impleval1PXeval1X$fToJSONRefined1$fHashableRefined1$fBinaryRefined1$fArbitraryRefined1$fFromJSONRefined1$fReadRefined1$fIsStringRefined1 $fShowMsg1$fShowRResults1$fEqMsg1$fLiftRefined1 $fEqRefined1$fShowRefined1|+OrA&*AndASecondFirstPairsDup $fPTYPEDupx$fPTYPEPairs[] $fPTYPE&&&x $fPTYPE***(,) $fPTYPEFirstx$fPTYPESecondx $fPTYPEAndAx $fPTYPE&*x $fPTYPEOrAx $fPTYPE|+xThese'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 FromString FromString'ToString IsSuffixIIsInfixI IsPrefixIIsSuffixIsInfixIsPrefixStripRStripLTrimBothTrimRTrimL$fPTYPETrimImplx $fPTYPETrimLx $fPTYPETrimRx$fPTYPETrimBothx$fPTYPEStripImplx$fPTYPEStripLx$fPTYPEStripRx$fPTYPEIsFixImplx$fPTYPEIsPrefixx$fPTYPEIsInfixx$fPTYPEIsSuffixx$fPTYPEIsPrefixIx$fPTYPEIsInfixIx$fPTYPEIsSuffixIx$fToStringCByteString$fToStringCByteString0$fToStringCText$fToStringCText0 $fToStringC[]$fPTYPEToStringx$fPTYPEFromString'a$fPTYPEFromStringx 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$fPTYPEReplaceFn3xPrintCPrintF ReadMaybe ReadMaybe'ReadPReadP'ShowP $fPTYPEShowPx$fPTYPEReadP'x $fPTYPEReadPx$fPTYPEReadMaybe'x$fPTYPEReadMaybex$fPTYPEPrintFx $fPrintC(,) $fPrintC()$fPTYPEPrintTx$fPTYPEPrintLxOrsAndsNegativePositive AllNegative AllPositiveDesc'DescAsc'AscCmpICmp===~OrdIOrdA'OrdAOrdP==!/=~<~<=~==~>=~>~/=<<===>=>NeLtLeSameGeGt $fPTYPE==!a $fPTYPEOrdAx $fPTYPEOrdA'x $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$fPTYPEAllNegativex $fPTYPEAndsx $fPTYPEOrsxShowBaseReadBase ReadBase'SignumOddEvenRemQuotQuotRemDivModModDivAbsNegate-%%/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 $fPTYPE%x$fPTYPENegatex $fPTYPE-%x $fPTYPEAbsx $fPTYPEDiva $fPTYPEModa$fPTYPEDivModa$fPTYPEQuotRema $fPTYPEQuotx $fPTYPERemx $fPTYPEEvenx $fPTYPEOddx$fPTYPESignumx$fPTYPEReadBase'x$fPTYPEReadBasex$fPTYPEShowBasex $fShowBinOp $fEqBinOpSTimesMEmptyPMEmptyTMEmptyT'MEmpty2MEmpty2'SConcatMConcatSapASapA'<> $fPTYPE<>x $fPTYPESapA'x $fPTYPESapAx$fPTYPEMConcatx$fPTYPESConcatx$fPTYPEMEmpty2'f$fPTYPEMEmpty2x$fPTYPEMEmptyT'a$fPTYPEMEmptyTx$fPTYPEMEmptyPx$fPTYPESTimesaMaxMinProductSumEmptyTZipZipRZipLZipWith EmptyList EmptyList' SingletonReverseLReverse SortOnDescSortOnSortByUnzip3UnzipInitLastTailHeadRemoveKeepChunksOfDropTakeSplitAtSplitAtsPadRPadLOnesTailsInitsElem IntercalateSpanBreakFilterGroupBy PartitionBy PartitionRotateUnsnocUncons+::+++ $fPTYPE++x $fPTYPE:+x $fPTYPE+:x$fPTYPEUnconss$fPTYPEUnsnocs$fPTYPEPartitiona$fPTYPEPartitionBya$fPTYPEGroupBya$fPTYPEFilterx $fPTYPEBreaka $fPTYPESpanx$fPTYPEIntercalatex $fPTYPEElema $fPTYPEInitsx $fPTYPETailsx $fPTYPEOnesx$fPTYPEPadImpla $fPTYPEPadLx $fPTYPEPadRx$fPTYPESplitAtsx$fPTYPESplitAta$fPTYPERotatex $fPTYPETakex $fPTYPEDropx$fPTYPEChunksOfa$fPTYPEKeepImplx $fPTYPEKeepx$fPTYPERemovex $fPTYPEHeadx $fPTYPETailx $fPTYPELastx $fPTYPEInitx $fPTYPEUnzipx$fPTYPEUnzip3x$fPTYPESortByx$fPTYPESortOnx$fPTYPESortOnDescx$fPTYPEReverseas$fPTYPEReverseLt$fPTYPESingletonx$fPTYPEEmptyList'x$fPTYPEEmptyListx$fPTYPEZipWitha$fPTYPEZipPada $fPTYPEZipLa $fPTYPEZipRa $fPTYPEZipa$fPTYPEEmptyTx $fPTYPESum[]$fPTYPEProduct[] $fPTYPEMin[] $fPTYPEMax[]EncodeJsonFile EncodeJson ParseJsonFileParseJsonFile' ParseJson ParseJson'$fPTYPEParseJson'x$fPTYPEParseJsonx$fPTYPEParseJsonFile'x$fPTYPEParseJsonFilex$fPTYPEEncodeJsonx$fPTYPEEncodeJsonFilexFoldMapNullNull'ToList'ToListCycle ConcatMapConcat FromListExtFromList ToListExtIToListIToList'IsEmptyToNEList$fPTYPEToNEListt$fPTYPEIsEmptyas$fPTYPEIToList'x$fPTYPEIToListx$fPTYPEToListExtl$fPTYPEFromListx$fPTYPEFromListExtl$fPTYPEConcatx$fPTYPEConcatMapx $fPTYPECyclex$fPTYPEToListt$fPTYPEToList'x $fPTYPENull'x $fPTYPENulla$fPTYPEFoldMapxJustFailJustDef MaybeBool CatMaybesMapMaybe IsNothingIsJustMaybeInMkJust MkNothing MkNothing'Just'$fPTYPEJust'Maybe$fPTYPEMkNothing'a$fPTYPEMkNothingx$fPTYPEMkJustx$fPTYPEMaybeInMaybe$fPTYPEIsJustx$fPTYPEIsNothingx$fPTYPEMapMaybex$fPTYPECatMaybesx$fPTYPEMaybeBoola$fPTYPEJustDefx$fPTYPEJustFailxTuple6Tuple5Tuple4Tuple3Tuple2!!?LookupIxLIx'Ix LookupFail LookupFail' LookupDef LookupDef'$fPTYPELookupDefx$fPTYPELookupFailx $fPTYPEIx[] $fPTYPEIx'x $fPTYPEIxLa $fPTYPE!!a$fPTYPELookupa$fPTYPELookupFail'x$fPTYPELookupDef'x $fPTYPE!!?aStdinReadIO'ReadIOStderrStdout WriteFile WriteFile' AppendFileTimeZtTimeUtc ReadEnvAllReadEnvReadDir DirExists FileExistsReadFile$fPTYPEReadFilex$fPTYPEFileExistsx$fPTYPEReadDirx$fPTYPEDirExistsx$fPTYPEReadEnvx$fPTYPEReadEnvAlla$fPTYPETimeUtca$fPTYPETimeZta$fGetFHandleFStderr$fGetFHandleFStdout$fGetModeWFWrite$fGetModeWFWriteForce$fGetModeWFAppend$fGetFHandleFOther$fPTYPEWriteFileImpla$fPTYPEAppendFilex$fPTYPEWriteFile'x$fPTYPEWriteFilex$fPTYPEStdoutx$fPTYPEStderrx $fPTYPEStdinx $fShowWFMode $fEqWFMode $fShowFHandleKRDotDotCatch'CatchProxyTProxyT'Coerce2Luhn PrimeNextPrimeInitFailInitDefLastFailLastDefTailFailTailDefHeadFailHeadDef>|>>||>SkipFMapSndFMapFstTraverseSequence$&$$Join DuplicateExtract<|>*><*<$Pure2 $fPTYPEPure2f $fPTYPE<*x $fPTYPE*>x $fPTYPE<|>x$fPTYPEExtractt$fPTYPEDuplicatet $fPTYPEJoint $fPTYPE$&x $fPTYPE$$x$fPTYPESequencet$fPTYPETraversex$fPTYPEFMapFstf$fPTYPEFMapSndf $fPTYPESkipa $fPTYPE|>x $fPTYPE>|x $fPTYPE>|>x$fPTYPEHeadDefx$fPTYPEHeadFailx$fPTYPETailDefx$fPTYPETailFailx$fPTYPELastDefx$fPTYPELastFailx$fPTYPEInitDefx$fPTYPEInitFailx $fPTYPE<$x $fPTYPEPrimex$fPTYPEPrimeNextx $fPTYPELuhnx$fPTYPECoerce2f$fPTYPEProxyT'x$fPTYPEProxyTx $fPTYPECatchx$fPTYPECatch'x $fPTYPEDota $fPTYPERDota $fPTYPEKaEnumFromThenTo... EnumFromTo ToEnumBFail ToEnumBDef ToEnumBDef'ToEnumToEnum'FromEnumPredBPredSuccNSuccPredB'SuccB'SuccB $fPTYPESuccBx$fPTYPESuccB'x $fPTYPESuccx $fPTYPESuccNx $fPTYPEPredx $fPTYPEPredBx$fPTYPEPredB'x$fPTYPEFromEnumx$fPTYPEToEnum'x$fPTYPEToEnumx$fPTYPEToEnumBDef'a$fPTYPEToEnumBDefx$fPTYPEToEnumBFailx$fPTYPEEnumFromTox $fPTYPE...x$fPTYPEEnumFromThenToxDoNRepeatParaNPara IterateNUntil IterateNWhile IterateWhile IterateUntilUnfoldrFoldlFoldNScanNAScanNScanl $fPTYPEScanlx $fPTYPEScanNx$fPTYPEScanNAx $fPTYPEFoldNx $fPTYPEFoldlx$fPTYPEUnfoldra$fPTYPEIterateUntilx$fPTYPEIterateWhilex$fPTYPEIterateNWhilex$fPTYPEIterateNUntilx$fPTYPEParaImpl[]$fPTYPEParaImpl[]0$fPTYPEParaImplx $fPTYPEParax $fPTYPEParaNx$fPTYPERepeata $fPTYPEDoNa RightFailLeftFailRightDefLeftDefMkRightMkRight'MkLeftMkLeft' EitherBoolPartitionEithersIsRightIsLeftEitherInRight'Left'$fPTYPELeft'Either$fPTYPERight'Either$fPTYPE|||Either$fPTYPEIsLeftx$fPTYPEIsRightx$fPTYPE+++Either$fPTYPEPartitionEithers[]$fPTYPEEitherBoola$fPTYPEEitherXx$fPTYPEMkLeft'x$fPTYPEMkLeftx$fPTYPEMkRight'x$fPTYPEMkRightx$fPTYPELeftDefx$fPTYPERightDefx$fPTYPELeftFailx$fPTYPERightFailxUTCTimeToPosixPosixToUTCTimeUnMkTimeMkTimeMkTime'ToTimeToDay ToWeekYear ToWeekDate MkDayExtra MkDayExtra'UnMkDayMkDayMkDay' ParseTimes ParseTimes' ParseTimeP ParseTimeP' FormatTimeP$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 GuardSimpleExitWhenGuardGuardsN 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$fPTYPEGuardsImplXx$fPTYPEGuardsImplXx0$fPTYPEGuardsDetailImplx$fPTYPEGuardsDetailx$fPTYPEGuardsNx $fPTYPEGuarda$fPTYPEExitWhenx$fPTYPEGuardSimpleaToTitleToUpperToLower IsLatin1AllIsSeparatorAll IsOctDigitAll IsHexDigitAll IsControlAllIsPunctuationAll IsSpaceAll IsDigitAll IsUpperAll IsLowerAllIsLatin1 IsSeparator IsOctDigit IsHexDigit IsControl IsPunctuationIsSpaceIsDigitIsUpperIsLowerChar1 $fPTYPEChar1a$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 $fShowCharSetJsonMicrosoftDateTimeLuhn'Luhn''Luhnop' Ddmmyyyyop' Ddmmyyyyop DdmmyyyyRE DateTimeNip DateTimeFmtsDateNipDateFmts Isbn13fmtIsbn13opIsbn13ip Isbn10fmtIsbn10opIsbn10ipIp6fmtIp6opIp6ip Ip4StrictREOctetREIp4fmtIp4opIp4op'Ip4ip'Ip4ipIp4REHmsREHmsfmtHmsop'HmsopHmsipSsnfmtSsnopSsnipDtfmtDtipLuhnopLuhnipCcfmtCcopCcip refinedTH refinedTHIO refined1TH refined2TH refined2THIO refined3TH refined3THIO ReadShowR' ReadShow' ReadShowRReadShowBaseIJ'BaseIJOkNotROkNotOkROkLuhnTLuhnRBetweenRBetweenNBaseN'BaseNIsbn13Isbn13RIsbn10Isbn10RIp6Ip6RIp4'Ip4R'Ip4Ip4RHms'HmsR'HmsHmsRSsnRSsn DateTimeN DateTimeNRDateN DateTime1Cc11Ccnccnccn'cc11 datetime1ssnhmsip4ip4'ip6isbn10isbn13base16base16'base2base2'basenbasen'daten datetimenbetweenokoknotreadshow readshow'BaseIJipversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileNamebasemapsumghc-prim GHC.TypesNatflipGetColorBool$these-1.1.1.1-7fp3Gb5JuCxEjNjnp6x24YThese(pcre-heavy-1.0.0.2-Ilbciq7LEhJTCtv8ROywWText.Regex.PCRE.HeavysubgsubGetROpt showLitImplHKDData.Functor.IdentityIdentityPColorSColor_pBool_pStringBoolPFailPFalsePTruePPresentPboolT2PpBoolgetValLRfromTTH reifyOptssetWidth setMessage setRecursionsetOther setNoColorsetDispsetCreateColorsetDebugdefOptsotherDef_boolT toNodeString colorBoolPcolorMe fixPresentPOrderingText.ParserCombinators.ReadPrecReadPrecIOGHC.Primcoercepure Data.Function GHC.ClassesBoth Data.TuplesndfstanyallidnotlengthFoldable"lens-4.19.2-KXfjtCwCOd3KUikLJUQm86Control.Lens.Wrapped _Wrapped' _Unwrapped'Type Data.ProxyProxyconst$aeson-1.5.3.0-C0atVWm6U8ACelOzw2UBBCData.Aeson.Types.ToJSONToJSON(QuickCheck-2.14.1-JI5IDAaJDsyC9IXdPbXOk0Test.QuickCheck.Arbitrary Arbitrary'hashable-1.3.0.0-1RsrIcitxVDKffGN1TuMlmData.Hashable.ClassHashablebinary-0.8.6.0Data.Binary.ClassBinaryData.Aeson.Types.FromJSONFromJSONGHC.ReadRead Data.StringIsString eval3MSkip eval1MSkipThatThisAssocCIsThData.These.CombinatorscatTherecatHerecatThesecatThatcatThispartitionThese fromString Data.OldList isSuffixOf isInfixOf isPrefixOf IsFixImpl text-1.2.3.1stripstripEnd stripStartTrimImplsplit scanRangesscan=~GHC.ShowshowcompareNumeric showIntAtBaseGHC.NumsignumevenquotRemdivModdivabsnegateRationalBin GHC.FloatlogBasefloorceilingtruncate fromRational toRational fromIntegral fromIntegerstimesmemptysconcatmconcatmaximumminimumproductemptyZipPadGHC.ListzipWithControl.Lens.Internal.Iso reversingreversesortOnunzip3unzipinitlasttailheadsplitAttailsinitselemspanbreakgroupBy partitionControl.Lens.ConsunsnocunconsfoldMapnulltoListcycle concatMapconcatGHC.ExtsfromListControl.Lens.IndexeditoListControl.Lens.EmptyAsEmptyNonEmptyMaybelookupControl.Lens.AtIxed System.IOreadIO time-1.8.0.2&Data.Time.LocalTime.Internal.ZonedTime ZonedTime Data.Time.Clock.Internal.UTCTimeUTCTimeSystem.EnvironmentgetEnvironmentgetEnvdirectory-1.3.3.0System.Directory listDirectorydoesDirectoryExist doesFileExistreadFileData.Traversabletraverse sequenceAjoin$comonad-5.0.6-JfcN6iPhxp7Eeulcp61Z8tControl.Comonad duplicateextractGHC.EnumenumFromThenTo enumFromTotoEnumfromEnumpredsuccfoldlscanl Data.EitherEither fromRightfromLeftRightLeftEitherXpartitionEithersisRightisLeft&Data.Time.LocalTime.Internal.TimeOfDay TimeOfDayData.Time.Calendar.DaysDayData.Time.Format.Parse ParseTimeData.Time.Format formatTimeGuardsDetailImplCaseImpl IsCharSetAll GHC.UnicodeisLatin1 Data.Char isSeparator isOctDigit isHexDigit isControl isPunctuationisSpaceisDigitisUpperisLower IsCharSet