!޻      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe;None1:W?@ACHMPSUVX_`kppredicate-typed.a typeclass for choosing which monad to run in predicate-typedused by Predicate.Refined31 for extracting the input type 'i' from a 4-tuple predicate-typedused by Predicate.Refined3$ for extracting 'fmt' from a 4-tuple predicate-typedused by Predicate.Refined39 for extracting the boolean predicate 'op' from a 4-tuplepredicate-typedused by Predicate.Refined3# for extracting 'ip' from a 4-tuplepredicate-typed&Extract 'a' from a list like containerpredicate-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",()))predicate-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-typedget bool from the typelevel*predicate-typedget ordering from the typelevel.predicate-typedgets length of a typelevel list0predicate-typed(get a list of Symbols from the typelevelgetSymbs @'["abc","def","g"]["abc","def","g"]2predicate-typed%get a list of Nats from the typelevelgetNats @'[10,12,1] [10,12,1]4predicate-typed typelevel Not5predicate-typed typelevel Or6predicate-typed typelevel And7predicate-typed.helper method to fail with an error when False8predicate-typed-helper method to fail with an error when True9predicate-typedtypelevel Null on Symbol:predicate-typedtype level Between;predicate-typedused by    and  and c 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-typed2convert type level regex option to the value level@predicate-typed2extract the regex options from the type level listBpredicate-typed'Regex options for Rescan Resplit Re etcCpredicate-typedForce pattern anchoringDpredicate-typedCompile automatic callouts | Bsr_anycrlf -- R matches only CR, LF, or CrlF | Bsr_unicode -- ^ R matches all Unicode line endingsEpredicate-typedDo caseless matchingFpredicate-typed"dollar not to match newline at endGpredicate-typedmatches anything including NLHpredicate-typed%Allow duplicate names for subpatternsIpredicate-typed Ignore whitespace and # commentsJpredicate-typed,PCRE extra features (not much use currently)Kpredicate-typed#Force matching to be before newlineLpredicate-typedcaret and dollar match newlines within data | Newline_any -- ^ Recognize any Unicode newline sequence | Newline_anycrlf -- ^ Recognize CR, LF, and CrlF as newline sequencesMpredicate-typedSet CR as the newline sequenceNpredicate-typed Set CrlF as the newline sequenceOpredicate-typedSet LF as the newline sequencePpredicate-typed=Disable numbered capturing parentheses (named ones available)Qpredicate-typed Invert greediness of quantifiersRpredicate-typedRun in UTF--8 modeSpredicate-typed+Do not check the pattern for UTF-8 validitypredicate-typeddisplay format for the treepredicate-typeddraw normal treepredicate-typed use unicodeZpredicate-typedcustomizable options\predicate-typedlength of data to display for ]predicate-typed debug level^predicate-typed1display the tree using the normal tree or unicode_predicate-typedcolor palette usedpredicate-typed4the color palette for displaying the expression tree`predicate-typed a monomorphic container of treespredicate-typed)holds the result of running the predicatepredicate-typed*optional strings to include in the resultscpredicate-typed?contains the untyped result from evaluating the expression treepredicate-typedfails the entire evaluationpredicate-typedFalse predicatepredicate-typedTrue predicatepredicate-typed Any valuedpredicate-typed=contains the typed result from evaluating the expression treeipredicate-typed-represents the evaluation tree for predicatesjpredicate-typedthe child nodeskpredicate-typedthe value at this root nodelpredicate-typed1detailed information eg input and output and textnpredicate-typedlens for accessing d in iqpredicate-typeda lens from typed d to the untyped ctpredicate-typed&creates a Node for the evaluation treeupredicate-typed+creates a Boolean node for a predicate typexpredicate-typed get the value from BoolT or failypredicate-typed2converts a typed tree to an untyped on for displaypredicate-typed)converts a typed tree into an untyped onezpredicate-typed'convenience method to wrap a typed tree{predicate-typedsee 2 : add more detail to the tree if there are errors|predicate-typedsee 2 : add less detail to the tree if there are errorspredicate-typedha helper method to add extra context on failure to the tree or extract the value at the root of the tree~predicate-typed'skip colors and just return the summarypredicate-typed'skip colors and just return the summarypredicate-typed?skip the detail and just return the summary but keep the colorspredicate-typed5displays the detailed evaluation tree without colors.predicate-typed3displays the detailed evaluation tree using colors.predicate-typedsame as  but for a narrow displaypredicate-typedsame as 3 for a wider display and verbose debug mode settingpredicate-typedAdisplays the detailed evaluation tree using unicode and colors. ( works better on Windows)predicate-typedsame as 3 for a wider display and verbose debug mode settingpredicate-typedsame as  but for a narrow displaypredicate-typed$helper method to set the debug levelpredicate-typed,helper method to limit the width of the treepredicate-typed$helper method to set the debug levelpredicate-typed$helper method to set the debug levelpredicate-typed$helper method to set the debug levelpredicate-typed!set display to unicode and colorspredicate-typedset a color palettepredicate-typedno colors are displayedcolor palettes$italics dont work but underline doespredicate-typeddefault color palettecolor palettes$italics dont work but underline doespredicate-typedcolor palettes$italics dont work but underline doespredicate-typedcolor palettes$italics dont work but underline doespredicate-typedcolor palettes$italics dont work but underline doespredicate-typed$fix PresentT Bool to TrueT or FalseTpredicate-typed*display all data regardless of debug levelpredicate-typed<more restrictive: only display data at debug level 1 or lesspredicate-typed+compile a regex using the type level symbolpredicate-typedWextract values from the trees or if there are errors returned a tree with added contextpredicate-typed,extract all root values from a list of treespredicate-typedprism from BoolT to Boolpredicate-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-typed"get the length of a typelevel listgetLen @'["abc","def","g"]3predicate-typedEcolors the result of the predicate based on the current color palettepredicate-typed3skip displaying the tree and just output the resultpredicate-typed display in unicode (non-Windows)predicate-typednormal displaypredicate-typed#strip ansi characters from a stringepredicate-typedfailure with stringfpredicate-typedfalse predicategpredicate-typedtrue predicatehpredicate-typednon predicate value   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXWYZ[]\^_`abcdefghijklmnopqrstuvwxyz{|}~ijklmnopdefghqcabsrtuvwxy{|Z[]\^_TUVXWY}~BCDEFGHIJKLMNOPQRS@A;<=>?:987654 2301./,-*+()!"#$%&' `z  9 9 None-.=>?@AHUVXk#predicate-typed9add a message to give more context to the evaluation tree!pe @(Msg "[somemessage] " Id) 999P [somemessage] Id 999 PresentT 999 pe @(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] 99Present [123,99]PresentT [123,99]%pz @'[W "abc", W "def", Id, Id] "ghi"!Present ["abc","def","ghi","ghi"]"PresentT ["abc","def","ghi","ghi"]predicate-typedGidentity function that also displays the type information for debugging pz @IdT 23 Present 23 PresentT 23predicate-typed1identity function that displays the input unlike even more constraints than 1 so we might need to add explicit type signatures pz @Id 23 Present 23 PresentT 23predicate-typedidentity functionpz @I 23 Present 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 predicates$predicate-typed9displays the evaluation tree in plain text without colors%predicate-typed)displays the evaluation tree using colors&predicate-typedsame as %+ but truncates the display tree width: see 'predicate-typedsame as % but allows for wider data(predicate-typed:skips the evaluation tree and just displays the end result)predicate-typedsame as (# but adds context to the end result*predicate-typedsame as ( but with colors+predicate-typed6display the evaluation tree using unicode and colors  pu '(Id, "abc", 123) [1..4] @,predicate-typedsame as ++ but truncates the display tree width: see .predicate-typed(converts the value to the corresponding pz @'Proxy 'x' Present ProxyPresentT Proxy/predicate-typedBextracts the (a,b) from type level 'These a b' if the value exists$pz @('These Id Id) (These 123 "abc")Present (123,"abc")PresentT (123,"abc")%pz @('These Id 5) (These 123 "abcde")Present (123,5)PresentT (123,5)pz @('These Id Id) (This "aaa")Error 'These found ThisFailT "'These found This"pz @('These Id Id) (That "aaa")Error 'These found ThatFailT "'These found That"0predicate-typed@extracts the 'b' from type level 'These a b' if the value existspz @('That Id) (That 123) Present 123 PresentT 123pz @('That Id) (This "aaa")Error 'That found ThisFailT "'That found This"pz @('That Id) (These 44 "aaa")Error 'That found TheseFailT "'That found These"1predicate-typed@extracts the 'a' from type level 'These a b' if the value existspz @('This Id) (This 123) Present 123 PresentT 123pz @('This Id) (That "aaa")Error 'This found ThatFailT "'This found That" pz @('This Id) (These 999 "aaa")Error 'This found TheseFailT "'This found These"2predicate-typedAextracts the 'b' from type level 'Either a b' if the value existspz @('Right Id) (Right 123) Present 123 PresentT 123pz @('Right Id) (Left "aaa")Error 'Right found LeftFailT "'Right found Left"3predicate-typedAextracts the 'a' from type level 'Either a b' if the value existspz @('Left Id) (Left 123) Present 123 PresentT 123pz @('Left Id) (Right "aaa")Error 'Left found RightFailT "'Left found Right"4predicate-typedexpects Nothing otherwise it fails if the value is Nothing then it returns 'Proxy a' as this provides more information than '()'pz @'Nothing Nothing Present ProxyPresentT Proxypz @'Nothing (Just True)Error 'Nothing found JustFailT "'Nothing found Just"5predicate-typed>extracts the 'a' from type level 'Maybe a' if the value existspz @('Just Id) (Just 123) Present 123 PresentT 123pz @('Just Id) (Just True) Present True PresentT Truepz @('Just Id) NothingError 'Just found NothingFailT "'Just found Nothing"7predicate-typed2runs each predicate in turn from the promoted listpz @'[1, 2, 3] 999Present [1,2,3]PresentT [1,2,3]pz @'[W 1, W 2, W 3, Id] 999Present [1,2,3,999]PresentT [1,2,3,999]8predicate-typed=extracts the value level representation of the type level '[] pz @'[] False Present [] PresentT []9predicate-typed=extracts the value level representation of the type level '() pz @'() () Present () PresentT ():predicate-typed:extracts the value level representation of the type level  pz @123 () Present 123 PresentT 123;predicate-typed8extracts the value level representation of the promoted pz @'LT "not used" Present LT PresentT LT pz @'EQ () Present EQ PresentT EQ<predicate-typed(run the predicates in a promoted 4-tuple pz @'(4, Id, "inj", 999) "hello"Present (4,"hello","inj",999)PresentT (4,"hello","inj",999)=predicate-typed(run the predicates in a promoted 3-tuplepz @'(4, Id, "goodbye") "hello"Present (4,"hello","goodbye")PresentT (4,"hello","goodbye")>predicate-typed5run the predicates in a promoted 2-tuple; similar to pz @'(Id, 4) "hello"Present ("hello",4)PresentT ("hello",4)?predicate-typedpulls the type level  to the value level as a pz @"hello world" ()Present "hello world"PresentT "hello world"@predicate-typedpulls the type level  to the value levelpz @'True "not used"TrueTrueT pz @'False ()FalseFalseTBpredicate-typed () function pz @() "Asf" Present () PresentT ()!predicate-typedreturns a tree of results !"#$%&'()*+,-$%&+,')*( !-"#None,-.7:;<=>?@AHMPSVXkOKpredicate-typedthe constraints that L must adhere toLpredicate-typedNa simple refinement type that ensures the predicate 'p' holds for the type 'a'#prtRefinedIO @(Between 10 14) oz 13 Right (Refined {unRefined = 13})#prtRefinedIO @(Between 10 14) oz 99 Left FalsePCprtRefinedIO @(Last Id >> Len == 4) oz ["one","two","three","four"]:Right (Refined {unRefined = ["one","two","three","four"]})UprtRefinedIO @(Re "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$" Id) oz "141.213.1.99",Right (Refined {unRefined = "141.213.1.99"})RprtRefinedIO @(Re "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$" Id) oz "141.213.1" Left FalsePprtRefinedIO @(Map (ReadP Int Id) (Resplit "\\." Id) >> Guard (PrintF "bad length: found %d" Len) (Len == 4) >> 'True) oz "141.213.1""Left (FailP "bad length: found 3")prtRefinedIO @(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) >> 'True) oz "141.213.1.444"'Left (FailP "octet 4 out of range 444")prtRefinedIO @(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) >> 'True) oz "141.213.1x34.444"&Left (FailP "ReadP Int (1x34) failed")DprtRefinedIO @(Map ('[Id] >> ReadP Int Id) Id >> Luhn Id) oz "12344"%Right (Refined {unRefined = "12344"})DprtRefinedIO @(Map ('[Id] >> ReadP Int Id) Id >> Luhn Id) oz "12340" Left FalseP2prtRefinedIO @(Any (Prime Id) Id) oz [11,13,17,18]+Right (Refined {unRefined = [11,13,17,18]})2prtRefinedIO @(All (Prime Id) Id) oz [11,13,17,18] Left FalsePQprtRefinedIO @(Snd Id !! Fst Id >> Len > 5) oz (2,["abc","defghij","xyzxyazsfd"])@Right (Refined {unRefined = (2,["abc","defghij","xyzxyazsfd"])})RprtRefinedIO @(Snd Id !! Fst Id >> Len > 5) oz (27,["abc","defghij","xyzxyazsfd"])#Left (FailP "(!!) index not found")RprtRefinedIO @(Snd Id !! Fst Id >> Len <= 5) oz (2,["abc","defghij","xyzxyazsfd"]) Left FalsePNpredicate-typed value for LOpredicate-typed binary operation applied to two H valuesPpredicate-typed%takes two values and lifts them into H& and then applies the binary operationQpredicate-typedsame as O except we already have valid L values as inputRpredicate-typedattempts to lift a refinement type to another refinement type by way of transformation function you can control both the predicate and the typeSpredicate-typedinvokes the callback with the L, value if 'a' is valid for the predicate 'p'Upredicate-typedsame as V but prints the resultsVpredicate-typed returns a L, value if 'a' is valid for the predicate 'p'Wpredicate-typedreturns a wrapper H around a possible L, value if 'a' is valid for the predicate 'p']predicate-typeda way to unsafely create a L value^predicate-typeda way to unsafely create a L value but run the predicate_predicate-typed instance for L`predicate-typed instance for Limport Data.Timeimport Control.Lensimport Control.Arrow ((+++))0type K1 = Refined (ReadP Day Id >> 'True) Stringdtype K2 = Refined (ReadP Day Id >> Between (ReadP Day "2019-03-30") (ReadP Day "2019-06-01")) Stringdtype K3 = Refined (ReadP Day Id >> Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01")) String(r = unsafeRefined' oz "2019-04-23" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)"Refined {unRefined = "2019-04-23"}DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)"Refined {unRefined = "2019-04-23"}DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K3 (B.encode r)Refined:FalseP-False (>>) False | {2019-05-30 <= 2019-04-23}|3+- P ReadP Day (2019-04-23) 2019-04-23 | 2019-04-23| || `- P Id "2019-04-23"|!`- False 2019-05-30 <= 2019-04-23 | +- P Id 2019-04-23 |6 +- P ReadP Day (2019-05-30) 2019-05-30 | 2019-05-30 | | | `- P '2019-05-30 |6 `- P ReadP Day (2019-06-01) 2019-06-01 | 2019-06-01 | `- P '2019-06-01apredicate-typed instance for L:set -XOverloadedStrings import qualified Data.Aeson as A3A.eitherDecode' @(Refined (Between 10 14) Int) "13" Right (Refined {unRefined = 13})@removeAnsi $ A.eitherDecode' @(Refined (Between 10 14) Int) "16" Error in $: Refined:FalsePFalse 16 <= 14| +- P Id 16|+- P '10|`- P '14bpredicate-typed instance for L@reads @(Refined (Between 0 255) Int) "Refined {unRefined = 254}" [(Refined {unRefined = 254},"")]@reads @(Refined (Between 0 255) Int) "Refined {unRefined = 300}"[]HIJKLMNOPQRSTUVWXYZ[\]^LMKVHIJU[\STWXNRYZOPQ]^None%&',-.1:=>?@AHSUVXkppredicate-typed emulates L using ? by setting the input conversion and output formatting as noopsvpredicate-typedZAn ADT that summarises the results of evaluating Refined3 representing all possible statespredicate-typedJconvenience type family for converting from a 4-tuple '(ip,op,fmt,i) to a  signaturepredicate-typed$Provides the constraints on Refined3predicate-typed9Refinement type that differentiates the input from outputi is the input typeip converts i to PP ip i which is the internal typeop$ validates that internal type using PP op (PP ip i) ~ Boolfmt outputs the internal type PP fmt (PP ip i) ~ iPP fmt (PP ip i)& should be valid as input for Refined3Setting ip to Id and fmt to Id makes it equivalent to : see pSetting 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 likeDprtEval3 @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) oz "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})DprtEval3 @(ReadBase Int 16 Id) @(Lt 253) @(PrintF "%x" Id) oz "00fe"-Left Step 2. False Boolean Check(op) | FalsePDprtEval3 @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) oz "00fg"<Left Step 1. Initial Conversion(ip) Failed | invalid base 16prtEval3 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Msg "length invalid:" (Len == 4)) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) ol "198.162.3.1.5">Left Step 2. False Boolean Check(op) | {length invalid:5 == 4}prtEval3 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) oz "198.162.3.1.5"6Left Step 2. Failed Boolean Check(op) | found length=5prtEval3 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) oz "198.162.3.1"BRight (Refined3 {r3In = [198,162,3,1], r3Out = "198.162.003.001"}) :m + Data.Time.Calendar.WeekDateuprtEval3 @(MkDay >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) oz (2019,10,13)ARight (Refined3 {r3In = (2019-10-13,41,7), r3Out = (2019,10,13)})kprtEval3 @(MkDay >> 'Just Id) @(Msg "expected a Sunday:" (Thd Id == 7)) @(UnMkDay (Fst Id)) ol (2019,10,12)ALeft Step 2. False Boolean Check(op) | {expected a Sunday:6 == 7}prtEval3 @(MkDay' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) oz (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a Sundaygtype T4 k = '(MkDay >> 'Just Id, Guard "expected a Sunday" (Thd Id == 7) >> 'True, UnMkDay (Fst Id), k))prtEval3P (Proxy @(T4 _)) oz (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a Sunday)prtEval3P (Proxy @(T4 _)) oz (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-typedcreates a 4-tuple proxy (see    )_use type application to set the 4-tuple or skip that and set the individual parameters directlyset the 4-tuple directly8eg1 = mkProxy3 @'(ReadP Int Id, Gt 10, ShowP Id, String)prtEval3P eg1 ol "24"*Right (Refined3 {r3In = 24, r3Out = "24"})Kskip the 4-tuple and set each parameter individually using type application6eg2 = mkProxy3 @_ @(ReadP Int Id) @(Gt 10) @(ShowP Id)prtEval3P eg2 ol "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 4 value and pass it to a continuation to be processedThis 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 -XPolyKindsKb16 = Proxy @'(ReadBase Int 16 Id, Between 100 200, ShowBase 16 Id, String)>b2 = Proxy @'(ReadBase Int 2 Id, 'True, ShowBase 2 Id, String)sprtRefinedTIO $ 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 rangeiprtRefinedTIO $ withRefined3TP b16 o0 "a388" $ \x -> withRefined3TP b2 o0 "1001110111" $ \y -> pure (x,y)6*** Step 1. Success Initial Conversion(ip) [41864] ***!P ReadBase(Int,16) 41864 | "a388"|`- 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-typedcreate a wrapped  typeprtRefinedTIO $ newRefined3TP (Proxy @'(MkDay >> Just Id, GuardSimple (Thd Id == 5) >> 'True, UnMkDay (Fst Id), (Int,Int,Int))) oz (2019,11,1)8Refined3 {r3In = (2019-11-01,44,5), r3Out = (2019,11,1)}wprtRefinedTIO $ newRefined3TP (Proxy @'(MkDay >> Just Id, Thd Id == 5, UnMkDay (Fst Id), (Int,Int,Int))) ol (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]prtRefinedTIO $ newRefined3TP (Proxy @'(MkDay >> Just Id, Msg "wrong day:" (Thd Id == 5), UnMkDay (Fst Id), (Int,Int,Int))) ol (2019,11,2)Afailure msg[Step 2. False Boolean Check(op) | {wrong day:6 == 5}]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 4-tuple proxy insteadpredicate-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 4-tuple proxy and aggregate the results on failurepredicate-typed3create a Refined3 value using a 4-tuple proxy (see )use / to package all the types together as a 4-tuplepredicate-typedsame as @ but can pass the parameters individually using type applicationpredicate-typed7creates Refined3 value but skips the initial conversionpredicate-typedcalculates from internal valuepredicate-typed similar to  but it emulates  but using LVtakes a 4-tuple proxy as input but outputs the Refined value and the result separately1initial conversion using 'ip' and stores that in LTruns 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 L and the output from 3.Bif any of the above steps fail the process stops it and dumps out vpredicate-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 (unsafeRefined3 @(ReadBase Int 16 Id) @(Between 0 255) @(ShowBase 16 Id) 254 "fe")"\"fe\""0A.encode (unsafeRefined3 @Id @'True @Id 123 123)"123"predicate-typed instance for import Control.Arrow ((+++))import Control.Lensimport Data.Time9type K1 = MakeR3 '(ReadP Day Id, 'True, ShowP Id, String)mtype K2 = MakeR3 '(ReadP Day Id, Between (ReadP Day "2019-03-30") (ReadP Day "2019-06-01"), ShowP Id, String)mtype K3 = MakeR3 '(ReadP Day Id, Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01"), ShowP Id, String))r = unsafeRefined3' oz "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)2Refined3 {r3In = 2019-04-23, r3Out = "2019-04-23"}DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K3 (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] ***0P ReadP Day (2019-04-23) 2019-04-23 | 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|3+- P ReadP Day (2019-05-30) 2019-05-30 | 2019-05-30| || `- P '2019-05-30|3`- P ReadP Day (2019-06-01) 2019-06-01 | 2019-06-01 | `- P '2019-06-01predicate-typed instance for  import qualified Data.Aeson as AiA.eitherDecode' @(Refined3 (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe\""+Right (Refined3 {r3In = 254, r3Out = "fe"})zremoveAnsi $ A.eitherDecode' @(Refined3 (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 | "00fe443a"|`- 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 vreads @(Refined3 (ReadBase Int 16 Id) (Between 0 255) (ShowBase 16 Id) String) "Refined3 {r3In = 254, r3Out = \"fe\"}"*[(Refined3 {r3In = 254, r3Out = "fe"},"")]wreads @(Refined3 (ReadBase Int 16 Id) (Between 0 255) (ShowBase 16 Id) String) "Refined3 {r3In = 300, r3Out = \"12c\"}"[]sreads @(Refined3 (ReadBase Int 16 Id) (Id < 0) (ShowBase 16 Id) String) "Refined3 {r3In = -1234, r3Out = \"-4d2\"}".[(Refined3 {r3In = -1234, r3Out = "-4d2"},"")]reads @(Refined3 (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"},"")]0pqrustvwxyz{|}~0qrust|}~vwxyz{pNone%&',-.=>?@AHPSUVX_kpredicate-typedtries to extract a from Maybe a otherwise it failspz @(Just Id) (Just "abc") Present "abc"PresentT "abc"pz @(Just Id) NothingError Just(empty)FailT "Just(empty)"predicate-typed'takes the init of a list like containerpz @(Init Id) "abcd" Present "abc"PresentT "abc"pz @(Init Id) (T.pack "abcd") Present "abc"PresentT "abc"pz @(Init Id) []Error Init(empty)FailT "Init(empty)"predicate-typed'takes the last of a list like containerpz @(Last Id) "abcd" Present 'd' PresentT 'd'pz @(Last Id) []Error Last(empty)FailT "Last(empty)"predicate-typed'takes the tail of a list like containerpz @(Tail Id) "abcd" Present "bcd"PresentT "bcd"pz @(Tail Id) []Error Tail(empty)FailT "Tail(empty)"predicate-typed'takes the head of a list like containerpz @(Head Id) "abcd" Present 'a' PresentT 'a'pz @(Head Id) []Error Head(empty)FailT "Head(empty)"predicate-typedextract the These value from a % otherwise fail with an error messageBif there is no These value then p is passed the whole context only,pz @(TheseFail "oops" Id) (These "abc" 20.4)Present ("abc",20.4)PresentT ("abc",20.4)%pz @(TheseFail "oops" Id) (That "aa") Error oops FailT "oops"\pz @(TheseFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,That "xy")Error found That "xy" fst=123!FailT "found That \"xy\" fst=123")pz @(TheseFail (MEmptyT _) Id) (That 222)ErrorFailT ""predicate-typedextract the That value from a % otherwise fail with an error messageAif there is no That value then p is passed the whole context only$pz @(ThatFail "oops" Id) (That 20.4) Present 20.4 PresentT 20.4$pz @(ThatFail "oops" Id) (This "aa") Error oops FailT "oops"[pz @(ThatFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,This "xy")Error found This "xy" fst=123!FailT "found This \"xy\" fst=123"(pz @(ThatFail (MEmptyT _) Id) (This 222)ErrorFailT ""predicate-typedextract the This value from a % otherwise fail with an error messageAif there is no This value then p is passed the whole context only$pz @(ThisFail "oops" Id) (This 20.4) Present 20.4 PresentT 20.4$pz @(ThisFail "oops" Id) (That "aa") Error oops FailT "oops"[pz @(ThisFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,That "xy")Error found That "xy" fst=123!FailT "found That \"xy\" fst=123"(pz @(ThisFail (MEmptyT _) Id) (That 222)ErrorFailT ""predicate-typed extract the These value from an  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")Present (102 % 5,"x")PresentT (102 % 5,"x")+pz @(TheseDef '(1 % 4,"zz") Id) (This 20.4)Present (1 % 4,"zz")PresentT (1 % 4,"zz")*pz @(TheseDef '(1 % 4,"zz") Id) (That "x")Present (1 % 4,"zz")PresentT (1 % 4,"zz")apz @(TheseDef '(PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id),999) (Snd Id)) (123,This "xy"))Present ("found This \"xy\" fst=123",999)*PresentT ("found This \"xy\" fst=123",999)9pz @(TheseDef (MEmptyT (SG.Sum _, String)) Id) (This 222)Present (Sum {getSum = 0},"")PresentT (Sum {getSum = 0},"")>pz @(TheseDef (MEmptyT _) Id) (These (222 :: SG.Sum Int) "aa")!Present (Sum {getSum = 222},"aa")"PresentT (Sum {getSum = 222},"aa")predicate-typedextract the That value from an  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)Present 102 % 5PresentT (102 % 5)$pz @(ThatDef (1 % 4) Id) (This "aa") Present 1 % 4PresentT (1 % 4))pz @(ThatDef (1 % 4) Id) (These "aa" 2.3) Present 1 % 4PresentT (1 % 4)[pz @(ThatDef (PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id)) (Snd Id)) (123,This "xy")#Present "found This \"xy\" fst=123"$PresentT "found This \"xy\" fst=123"'pz @(ThatDef (MEmptyT _) Id) (This 222) Present () PresentT ()6pz @(ThatDef (MEmptyT (SG.Sum _)) Id) (These 'x' 1120)Present Sum {getSum = 0}PresentT (Sum {getSum = 0})predicate-typedextract the This value from an  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)Present 102 % 5PresentT (102 % 5)$pz @(ThisDef (1 % 4) Id) (That "aa") Present 1 % 4PresentT (1 % 4))pz @(ThisDef (1 % 4) Id) (These 2.3 "aa") Present 1 % 4PresentT (1 % 4)[pz @(ThisDef (PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id)) (Snd Id)) (123,That "xy")#Present "found That \"xy\" fst=123"$PresentT "found That \"xy\" fst=123"'pz @(ThisDef (MEmptyT _) Id) (That 222) Present () PresentT ()5pz @(ThisDef (MEmptyT (SG.Sum _)) Id) (These 222 'x')Present Sum {getSum = 0}PresentT (Sum {getSum = 0})predicate-typed extract the Right value from an % otherwise fail with an error messagePif there is no Right value then p is passed the Left value and the whole context&pz @(RightFail "oops" Id) (Right 20.4) Present 20.4 PresentT 20.4%pz @(RightFail "oops" Id) (Left "aa") Error oops FailT "oops"_pz @(RightFail (PrintT "found left=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Left "xy")Error found left=xy fst=123FailT "found left=xy fst=123")pz @(RightFail (MEmptyT _) Id) (Left 222)ErrorFailT ""predicate-typedextract the Left value from an % otherwise fail with an error messagePif there is no Left value then p is passed the Right value and the whole context$pz @(LeftFail "oops" Id) (Left 20.4) Present 20.4 PresentT 20.4%pz @(LeftFail "oops" Id) (Right "aa") Error oops FailT "oops"`pz @(LeftFail (PrintT "found right=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Right "xy")Error found right=xy fst=123FailT "found right=xy fst=123")pz @(LeftFail (MEmptyT _) Id) (Right 222)ErrorFailT ""predicate-typed extract the Right value from an 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)Present 102 % 5PresentT (102 % 5)%pz @(RightDef (1 % 4) Id) (Left "aa") Present 1 % 4PresentT (1 % 4)^pz @(RightDef (PrintT "found left=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Left "xy")Present "found left=xy fst=123" PresentT "found left=xy fst=123"(pz @(RightDef (MEmptyT _) Id) (Left 222) Present () PresentT ()1pz @(RightDef (MEmptyT (SG.Sum _)) Id) (Left 222)Present Sum {getSum = 0}PresentT (Sum {getSum = 0})predicate-typedextract the Left value from an  otherwise use the default valuePif there is no Left value then p is passed the Right value and the whole context$pz @(LeftDef (1 % 4) Id) (Left 20.4)Present 102 % 5PresentT (102 % 5)%pz @(LeftDef (1 % 4) Id) (Right "aa") Present 1 % 4PresentT (1 % 4)_pz @(LeftDef (PrintT "found right=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Right "xy") Present "found right=xy fst=123"!PresentT "found right=xy fst=123"(pz @(LeftDef (MEmptyT _) Id) (Right 222) Present () PresentT ()1pz @(LeftDef (MEmptyT (SG.Sum _)) Id) (Right 222)Present Sum {getSum = 0}PresentT (Sum {getSum = 0})predicate-typedextract the value from a  or fail"pz @(JustFail "nope" Id) (Just 99) Present 99 PresentT 99 pz @(JustFail "nope" Id) Nothing Error nope FailT "nope"Bpz @(JustFail (PrintF "oops=%d" (Snd Id)) (Fst Id)) (Nothing, 123)Error oops=123FailT "oops=123"Cpz @(JustFail (PrintF "oops=%d" (Snd Id)) (Fst Id)) (Just 'x', 123) Present 'x' PresentT 'x'predicate-typedextract the value from a  otherwise use the default value$pz @(JustDef (1 % 4) Id) (Just 20.4)Present 102 % 5PresentT (102 % 5) pz @(JustDef (1 % 4) Id) Nothing Present 1 % 4PresentT (1 % 4)(pz @(JustDef (MEmptyT _) Id) (Just "xy") Present "xy" PresentT "xy"$pz @(JustDef (MEmptyT _) Id) Nothing Present () PresentT ()-pz @(JustDef (MEmptyT (SG.Sum _)) Id) NothingPresent Sum {getSum = 0}PresentT (Sum {getSum = 0})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' Present 'g' PresentT 'g'pz @(DoN 4 (Id <> " | ")) "abc"Present "abc | | | | "PresentT "abc | | | | "#pz @(DoN 4 (Id <> "|" <> Id)) "abc"IPresent "abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc"JPresentT "abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc"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'Present "dddd"PresentT "dddd"pz @(Repeat 4 "abc") ()!Present ["abc","abc","abc","abc"]"PresentT ["abc","abc","abc","abc"]predicate-typed similar to  /pz @(StripLeft "xyz" Id) ("xyzHello" :: String)Present Just "Hello"PresentT (Just "Hello"),pz @(StripLeft "xyz" Id) (T.pack "xyzHello")Present Just "Hello"PresentT (Just "Hello")#pz @(StripLeft "xyz" Id) "xywHello"Present NothingPresentT Nothing%pz @(StripRight "xyz" Id) "Hello xyz"Present Just "Hello "PresentT (Just "Hello ")'pz @(StripRight "xyz" Id) "xyzHelloxyw"Present NothingPresentT Nothingpz @(StripRight "xyz" Id) ""Present NothingPresentT Nothingpz @(StripRight "xyz" "xyz") ()Present Just ""PresentT (Just "")predicate-typed similar to   ,pz @(Trim (Snd Id)) (20," abc " :: String) Present "abc"PresentT "abc")pz @(Trim (Snd Id)) (20,T.pack " abc ") Present "abc"PresentT "abc"'pz @(TrimStart (Snd Id)) (20," abc ")Present "abc "PresentT "abc "%pz @(TrimEnd (Snd Id)) (20," abc ")Present " abc"PresentT " abc"pz @(TrimEnd " abc ") ()Present " abc"PresentT " abc"pz @(TrimEnd "") () Present "" PresentT ""pz @(Trim " ") () Present "" PresentT ""pz @(Trim "") () Present "" PresentT ""predicate-typed9flipped function application for expressions: similar to 8pz @(Snd Id & Fst Id) ((*16),4) Present 64 PresentT 64?pz @("def" & Id) ("abc"<>) Present "abcdef" PresentT "abcdef"predicate-typed1function application for expressions: similar to 8pz @(Fst Id $ Snd Id) ((*16),4) Present 64 PresentT 64?pz @(Id $ "def") ("abc"<>) Present "abcdef" PresentT "abcdef"predicate-typed similar to pz @Join (Just (Just 20))Present Just 20PresentT (Just 20)pz @Join ["ab","cd","","ef"]Present "abcdef"PresentT "abcdef"predicate-typed similar to pz @Duplicate (20,"abc")Present (20,(20,"abc"))PresentT (20,(20,"abc"))predicate-typed similar to pz @Extract (Nothing,Just 20)Present Just 20PresentT (Just 20)pz @Extract (Identity 20) Present 20 PresentT 20predicate-typed similar to )pz @(Fst Id <|> Snd Id) (Nothing,Just 20)Present Just 20PresentT (Just 20))pz @(Fst Id <|> Snd Id) (Just 10,Just 20)Present Just 10PresentT (Just 10))pz @(Fst Id <|> Snd Id) (Nothing,Nothing)Present NothingPresentT Nothingpredicate-typed similar to +pz @(Fst Id <* Snd Id) (Just "abc",Just 20)Present Just "abc"PresentT (Just "abc")predicate-typed similar to &pz @(Fst Id <$ Snd Id) ("abc",Just 20)Present Just "abc"PresentT (Just "abc")predicate-typed#print for lists -- if you can use ^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":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=3FailT "PrintL(2) arg count=3":pl @(PrintL 4 "first=%d second=%d third=%d" Id) [10,11,12]Error PrintL(4) arg count=3FailT "PrintL(4) arg count=3"predicate-typedprint for flat n-tuplesGpl @(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)Present "fst=ab snd=123"PresentT "fst=ab snd=123"8pz @(PrintT "fst=%s snd=%03d thd=%s" Id) ("ab",123,"xx")Present "fst=ab snd=123 thd=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'):Error PrintT(IO e=printf: argument list ended prematurely)<FailT "PrintT(IO e=printf: argument list ended prematurely)"-pl @(PrintT "%d %c %s" Id) (123,'x',"abc",11)>Error PrintT(IO e=printf: formatting string ended prematurely)@FailT "PrintT(IO e=printf: formatting string ended prematurely)"predicate-typed3uses inductive tuples to replace variable argumentspredicate-typed similar to $pz @(Fst Id <> Snd Id) ("abc","def")Present "abcdef"PresentT "abcdef" pz @("abcd" <> "ef" <> Id) "ghi"Present "abcdefghi"PresentT "abcdefghi" pz @("abcd" <> "ef" <> Id) "ghi"Present "abcdefghi"PresentT "abcdefghi"/pz @(Wrap (SG.Sum _) Id <> FromInteger _ 10) 13Present Sum {getSum = 23}PresentT (Sum {getSum = 23})3pz @(Wrap (SG.Product _) Id <> FromInteger _ 10) 13"Present Product {getProduct = 130}%PresentT (Product {getProduct = 130})9pz @('(FromInteger _ 10,"def") <> Id) (SG.Sum 12, "_XYZ")%Present (Sum {getSum = 22},"def_XYZ")&PresentT (Sum {getSum = 22},"def_XYZ")pz @(Sapa' (SG.Max _)) (10,12)Present Max {getMax = 12}PresentT (Max {getMax = 12})pz @(Sapa' (SG.Sum _)) (10,12)Present Sum {getSum = 22}PresentT (Sum {getSum = 22})predicate-typed similar to    for strings only.4The 'I' suffixed versions work are case insensitive. pz @(IsInfixI "abc" "axAbCd") ()TrueTrueT!pz @(IsPrefixI "abc" "aBcbCd") ()TrueTrueT pz @(IsPrefix "abc" "aBcbCd") ()FalseFalseT pz @(IsSuffix "bCd" "aBcbCd") ()TrueTrueTpredicate-typeddoes the directory exists,pz @(ReadEnv "PATH" >> 'Just Id >> 'True) ()TrueTrueTpredicate-typeddoes the directory existspz @(DirExists ".") ()TrueTrueTpredicate-typed similar to 0pz @(ReadFile ".ghci" >> 'Just Id >> Len > 0) ()TrueTrueTpz @(FileExists "xyzzy") ()FalseFalseTpredicate-typed.run the expression 'p' but remove the subtreespredicate-typed similar to (pz @Sequence [Just 10, Just 20, Just 30]Present Just [10,20,30]PresentT (Just [10,20,30]):pz @Sequence [Just 10, Just 20, Just 30, Nothing, Just 40]Present NothingPresentT Nothingpredicate-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 (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) 50Present "50 is same50"PresentT "50 is same50"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) 9Present "9 is lt10"PresentT "9 is lt10"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) 3Present "3 is lt4"PresentT "3 is lt4"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 Error asdf FailT "asdf"predicate-typed leverages . for repeating predicates (passthrough method)pz @(ParaN 4 (Succ Id)) [1..4]Present [2,3,4,5]PresentT [2,3,4,5]pz @(ParaN 4 (Succ Id)) "azwxm"-Error Para: data elements(5) /= predicates(4)/FailT "Para: data elements(5) /= predicates(4)"pz @(ParaN 4 (Succ Id)) "azwx"Present "b{xy"PresentT "b{xy"predicate-typedruns values in parallel unlike  which is serial)pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30]Present [10,21,120]PresentT [10,21,120],pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30,40]-Error Para: data elements(4) /= predicates(3)/FailT "Para: data elements(4) /= predicates(3)"predicate-typeduses PrintF to format outputpz @(PrintF "value=%03d" Id) 12Present "value=012"PresentT "value=012"&pz @(PrintF "%s" (Fst Id)) ("abc",'x') Present "abc"PresentT "abc"&pz @(PrintF "%d" (Fst Id)) ("abc",'x')3Error PrintF (IO e=printf: bad formatting char 'd')5FailT "PrintF (IO e=printf: bad formatting char 'd')"predicate-typedintercalate two lists;pz @(Intercalate '["aB"] '["xxxx","yz","z","www","xyz"]) ()9Present ["xxxx","aB","yz","aB","z","aB","www","aB","xyz"]:PresentT ["xxxx","aB","yz","aB","z","aB","www","aB","xyz"]-pz @(Intercalate '[W 99,Negate 98] Id) [1..5]/Present [1,99,-98,2,99,-98,3,99,-98,4,99,-98,5]0PresentT [1,99,-98,2,99,-98,3,99,-98,4,99,-98,5]%pz @(Intercalate '[99,100] Id) [1..5]/Present [1,99,100,2,99,100,3,99,100,4,99,100,5]0PresentT [1,99,100,2,99,100,3,99,100,4,99,100,5]predicate-typed-Display a number at base 2 to 36, similar to  but supports signed numberspz @(ShowBase 16 Id) 4077 Present "fed"PresentT "fed"pz @(ShowBase 16 Id) (-255) Present "-ff"PresentT "-ff"pz @(ShowBase 2 Id) 147Present "10010011"PresentT "10010011"(pz @(ShowBase 2 (Negate 147)) "whatever"Present "-10010011"PresentT "-10010011"predicate-typed2Read a number using base 2 through a maximum of 36 pz @(ReadBase Int 16 Id) "00feD" Present 4077 PresentT 4077pz @(ReadBase Int 16 Id) "-ff" Present -255PresentT (-255)"pz @(ReadBase Int 2 Id) "10010011" Present 147 PresentT 147pz @(ReadBase Int 8 Id) "Abff"Error invalid base 8FailT "invalid base 8"(supports negative numbers unlike readIntpredicate-typed"Luhn predicate check on last digitpz @(Luhn Id) [1,2,3,0]TrueTrueTpz @(Luhn Id) [1,2,3,4]FalseFalseT)pz @(GuardSimple (Luhn Id)) [15,4,3,1,99];Error (Luhn map=[90,2,3,8,6] sum=109 ret=9 | [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])FalseTpredicate-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") ()Error Zip(3,2) length mismatch FailT "Zip(3,2) length mismatch"pl @(Zip '[1,2] "abc") ()Error Zip(2,3) length mismatch FailT "Zip(2,3) length mismatch"predicate-typed3zip two lists padding the right hand side if needed(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(FailT "ZipR(2,3) rhs would be truncated"predicate-typed2zip two lists padding the left hand side if neededpl @(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(FailT "ZipL(3,2) rhs would be truncated"predicate-typed=Zip two lists to their maximum length using padding if needed=pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abc", [1..5])1Present [('a',1),('b',2),('c',3),('Z',4),('Z',5)]2PresentT [('a',1),('b',2),('c',3),('Z',4),('Z',5)]Apz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcdefg", [1..5])CPresent [('a',1),('b',2),('c',3),('d',4),('e',5),('f',99),('g',99)]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])1Present [('a',1),('b',2),('c',3),('d',4),('e',5)]2PresentT [('a',1),('b',2),('c',3),('d',4),('e',5)]:pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("", [1..5])1Present [('Z',1),('Z',2),('Z',3),('Z',4),('Z',5)]2PresentT [('Z',1),('Z',2),('Z',3),('Z',4),('Z',5)];pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcde", [])6Present [('a',99),('b',99),('c',99),('d',99),('e',99)]7PresentT [('a',99),('b',99),('c',99),('d',99),('e',99)]predicate-typed/extract 'a' from '[a]' which I need for type PPpredicate-typed similar to  thats pads with  or & if one list is shorter than the other>the key is that all information about both lists are preserved0pz @(ZipThese (Fst Id) (Snd Id)) ("aBc", [1..5]);Present [These 'a' 1,These 'B' 2,These 'c' 3,That 4,That 5]<PresentT [These 'a' 1,These 'B' 2,These 'c' 3,That 4,That 5]3pz @(ZipThese (Fst Id) (Snd Id)) ("aBcDeF", [1..3])HPresent [These 'a' 1,These 'B' 2,These 'c' 3,This 'D',This 'e',This 'F']IPresentT [These 'a' 1,These 'B' 2,These 'c' 3,This 'D',This 'e',This 'F']"pz @(ZipThese Id Reverse) "aBcDeF"]Present [These 'a' 'F',These 'B' 'e',These 'c' 'D',These 'D' 'c',These 'e' 'B',These 'F' 'a']^PresentT [These 'a' 'F',These 'B' 'e',These 'c' 'D',These 'D' 'c',These 'e' 'B',These 'F' 'a']pz @(ZipThese Id '[]) "aBcDeF"?Present [This 'a',This 'B',This 'c',This 'D',This 'e',This 'F']@PresentT [This 'a',This 'B',This 'c',This 'D',This 'e',This 'F']pz @(ZipThese '[] Id) "aBcDeF"?Present [That 'a',That 'B',That 'c',That 'D',That 'e',That 'F']@PresentT [That 'a',That 'B',That 'c',That 'D',That 'e',That 'F']predicate-typed.extracts the first character from a non empty pz @(Char1 "aBc") () Present 'a' PresentT 'a'predicate-typed creates a singleton from a value pz @(Singleton (Char1 "aBc")) () Present "a" PresentT "a"pz @(Singleton Id) FalsePresent [False]PresentT [False](pz @(Singleton (Snd Id)) (False,"hello")Present ["hello"]PresentT ["hello"]predicate-typed'creates an empty list of the given typepz @(Id :+ EmptyList _) 99 Present [99] PresentT [99]predicate-typed similar to  !9pz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (This 13) Present 13 PresentT 13Npz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (That "this is a long string") Present 21 PresentT 21Epz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (These 20 "somedata") Present 28 PresentT 28pz @(TheseIn (MkLeftAlt _ Id) (MkRightAlt _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (That "this is a long string")%Present Right "this is a long string"(PresentT (Right "this is a long string")pz @(TheseIn (MkLeftAlt _ Id) (MkRightAlt _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (These 1 "this is a long string")%Present Right "this is a long string"(PresentT (Right "this is a long string")pz @(TheseIn (MkLeftAlt _ Id) (MkRightAlt _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (These 100 "this is a long string")Present Left 100PresentT (Left 100)predicate-typed predicate on pz @(IsThis Id) (This "aBc")TrueTrueTpz @(IsThis Id) (These 1 'a')FalseFalseTpz @(IsThese Id) (These 1 'a')TrueTrueTpredicate-typedinvokes &requires the OverloadedLists extension:set -XOverloadedLists0pz @(FromListExt (M.Map _ _)) [(4,"x"),(5,"dd")]#Present fromList [(4,"x"),(5,"dd")]&PresentT (fromList [(4,"x"),(5,"dd")])predicate-typedinvokes ,pz @ToListExt (M.fromList [(1,'x'),(4,'y')])Present [(1,'x'),(4,'y')]PresentT [(1,'x'),(4,'y')]pz @ToListExt (T.pack "abc") Present "abc"PresentT "abc"predicate-typed similar to "pz @(ToList' Id) ("aBc" :: String) Present "aBc"PresentT "aBc"pz @(ToList' Id) (Just 14) Present [14] PresentT [14]pz @(ToList' Id) Nothing Present [] PresentT []pz @(ToList' Id) (Left "xx") Present [] PresentT [] pz @(ToList' Id) (These 12 "xx")Present ["xx"]PresentT ["xx"]predicate-typed similar to pz @ToList ("aBc" :: String) Present "aBc"PresentT "aBc"pz @ToList (Just 14) Present [14] PresentT [14]pz @ToList Nothing Present [] PresentT []pz @ToList (Left "xx") Present [] PresentT []pz @ToList (These 12 "xx")Present ["xx"]PresentT ["xx"] predicate-typed similar to !pz @(IToList _) ("aBc" :: String)!Present [(0,'a'),(1,'B'),(2,'c')]"PresentT [(0,'a'),(1,'B'),(2,'c')] predicate-typed>compare two strings ignoring case using the given ordering 'o' predicate-typed/compare two values using the given ordering 'o' predicate-typed!compare two strings ignoring case&pz @(Fst Id ===~ Snd Id) ("abC","aBc") Present EQ PresentT EQ'pz @(Fst Id ===~ Snd Id) ("abC","DaBc") Present LT PresentT LTpredicate-typed similar to pz @(Fst Id ==! Snd Id) (10,9) Present GT PresentT GT)pz @(14 % 3 ==! Fst Id %- Snd Id) (-10,7) Present GT PresentT GTpz @(Fst Id ==! Snd Id) (10,11) Present LT PresentT LTDpz @(Snd Id ==! (Fst Id >> Snd Id >> Head Id)) (('x',[10,12,13]),10) Present EQ PresentT EQ:pz @(Snd Id ==! Head (Snd (Fst Id))) (('x',[10,12,13]),10) Present EQ PresentT EQpredicate-typed functionpz @(Not Id) FalseTrueTrueTpz @(Not Id) TrueFalseFalseTpz @(Not (Fst Id)) (True,22)FalseFalseTpl @(Not (Lt 3)) 13True (Not (13 < 3))TrueTpredicate-typed implication;pz @(Fst Id ~> (Length (Snd Id) >= 4)) (True,[11,12,13,14])TrueTrueT>pz @(Fst Id ~> (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseFalseT?pz @(Fst Id ~> (Length (Snd Id) == 4)) (False,[12,11,12,13,14])TrueTrueT<pz @(Fst Id ~> (Length (Snd Id) >= 4)) (False,[11,12,13,14])TrueTrueTpredicate-typed similar to <pz @(Fst Id || (Length (Snd Id) >= 4)) (False,[11,12,13,14])TrueTrueTDpz @(Not (Fst Id) || (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseFalseTpredicate-typed similar to #pz @(Fst Id && Snd Id) (True, True)TrueTrueTpz @(Id > 15 && Id < 17) 16TrueTrueTpz @(Id > 15 && Id < 17) 30FalseFalseT;pz @(Fst Id && (Length (Snd Id) >= 4)) (True,[11,12,13,14])TrueTrueT>pz @(Fst Id && (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseFalseTpredicate-typed"This is composition for predicates,pz @(Fst Id >> Succ (Id !! 0)) ([11,12],'x') Present 12 PresentT 12>pz @(Len *** Succ Id >> ShowP (First (Pred Id))) ([11,12],'x')Present "(1,'y')"PresentT "(1,'y')"predicate-typedjust run the effect but skip the value for example for use with Stdout so it doesnt interfere with the 'a' on the rhs unless there is an errorpredicate-typed similar to M but uses the root message of the False predicate case as the failure message2most uses of GuardSimple can be replaced by using < and a boolean predicate unless you require failure on error"pz @(GuardSimple (Luhn Id)) [1..4]3Error (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,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]Present [1,2,3,0]PresentT [1,2,3,0]&pz @(GuardSimple (Len > 30)) [1,2,3,0]Error (4 > 30)FailT "(4 > 30)"predicate-typed?'p' is the predicate and on failure of the predicate runs 'prt'$pz @(Guard "expected > 3" (Gt 3)) 17 Present 17 PresentT 17#pz @(Guard "expected > 3" (Gt 3)) 1Error expected > 3FailT "expected > 3"1pz @(Guard (PrintF "%d not > 3" Id) (Gt 3)) (-99)Error -99 not > 3FailT "-99 not > 3" predicate-typed leverages . for repeating predicates (passthrough method)fpz @(GuardsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255)) [121,33,7,256]/Error id=4 must be between 0 and 255, found 2561FailT "id=4 must be between 0 and 255, found 256"epz @(GuardsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255)) [121,33,7,44]Present [121,33,7,44]PresentT [121,33,7,44]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),'("minutes",Between 0 59),'("seconds",Between 0 59)]) [13,59,61]Error seconds invalid: found 61!FailT "seconds invalid: found 61"pz @(GuardsDetail "%s invalid: found %d" '[ '("hours", Between 0 23),'("minutes",Between 0 59),'("seconds",Between 0 59)]) [27,59,12]Error hours invalid: found 27FailT "hours invalid: found 27"pz @(GuardsDetail "%s invalid: found %d" '[ '("hours", Between 0 23),'("minutes",Between 0 59),'("seconds",Between 0 59)]) [23,59,12]Present [23,59,12]PresentT [23,59,12]"predicate-typed leverages . for repeating predicates (passthrough method)epl @(BoolsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255)) [121,33,7,256]MFalse (GuardBool(3) [id=3 must be between 0 and 255, found 256] (256 <= 255))FalseTepz @(GuardsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255)) [121,33,7,44]Present [121,33,7,44]PresentT [121,33,7,44]$predicate-typedRboolean guard which checks a given a list of predicates against the list of values;pulls the top message from the tree if a predicate is falsetpl @(Bools '[ '(W "hh",Between 0 23), '(W "mm",Between 0 59), '(PrintT "<<<%d %d>>>" Id,Between 0 59) ] ) [12,93,14]$False (GuardBool(1) [mm] (93 <= 59))FalseTtpl @(Bools '[ '(W "hh",Between 0 23), '(W "mm",Between 0 59), '(PrintT "<<<%d %d>>>" Id,Between 0 59) ] ) [12,13,94],False (GuardBool(2) [<<<2 94>>>] (94 <= 59))FalseTtpl @(Bools '[ '(W "hh",Between 0 23), '(W "mm",Between 0 59), '(PrintT "<<<%d %d>>>" Id,Between 0 59) ] ) [12,13,14]True (GuardBool(0) 12)TrueTMpl @(BoolsQuick "abc" '[Between 0 23, Between 0 59, Between 0 59]) [12,13,14]True (GuardBool(0) 12)TrueTbpl @(BoolsQuick (PrintT "id=%d val=%d" Id) '[Between 0 23, Between 0 59, Between 0 59]) [12,13,14]True (GuardBool(0) 12)TrueTbpl @(BoolsQuick (PrintT "id=%d val=%d" Id) '[Between 0 23, Between 0 59, Between 0 59]) [12,13,99]-False (GuardBool(2) [id=2 val=99] (99 <= 59))FalseTpredicate-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]Present [17,4]PresentT [17,4]Gpz @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 5)]) [17,4]Error arg2 failedFailT "arg2 failed"Hpz @(Guards '[ '("arg1 failed",Gt 99), '("arg2 failed", Same 4)]) [17,4]Error arg1 failedFailT "arg1 failed"epz @(Guards '[ '(PrintT "arg %d failed with value %d" Id,Gt 4), '(PrintT "%d %d" Id, Same 4)]) [17,3] Error 2 3 FailT "2 3"Zpz @(GuardsQuick (PrintT "arg %d failed with value %d" Id) '[Gt 4, Ge 3, Same 4]) [17,3,5]Error arg 3 failed with value 5!FailT "arg 3 failed with value 5"]pz @(GuardsQuick (PrintT "arg %d failed with value %d" Id) '[Gt 4, Ge 3, Same 4]) [17,3,5,99]/Error Guards: data elements(4) /= predicates(3)1FailT "Guards: data elements(4) /= predicates(3)"*predicate-typed similar to &pz @(QuotRem (Fst Id) (Snd Id)) (10,3) Present (3,1)PresentT (3,1)'pz @(QuotRem (Fst Id) (Snd Id)) (10,-3)Present (-3,1)PresentT (-3,1)(pz @(QuotRem (Fst Id) (Snd Id)) (-10,-3)Present (3,-1)PresentT (3,-1)'pz @(QuotRem (Fst Id) (Snd Id)) (-10,3)Present (-3,-1)PresentT (-3,-1)&pz @(QuotRem (Fst Id) (Snd Id)) (10,0)Error QuotRem zero denominator FailT "QuotRem zero denominator"+predicate-typed similar to %pz @(DivMod (Fst Id) (Snd Id)) (10,3) Present (3,1)PresentT (3,1)&pz @(DivMod (Fst Id) (Snd Id)) (10,-3)Present (-4,-2)PresentT (-4,-2)&pz @(DivMod (Fst Id) (Snd Id)) (-10,3)Present (-4,2)PresentT (-4,2)'pz @(DivMod (Fst Id) (Snd Id)) (-10,-3)Present (3,-1)PresentT (3,-1)%pz @(DivMod (Fst Id) (Snd Id)) (10,0)Error DivMod zero denominatorFailT "DivMod zero denominator",predicate-typed similar to "pz @(Mod (Fst Id) (Snd Id)) (10,3) Present 1 PresentT 1"pz @(Mod (Fst Id) (Snd Id)) (10,0)Error Mod zero denominatorFailT "Mod zero denominator"-predicate-typed similar to "pz @(Div (Fst Id) (Snd Id)) (10,4) Present 2 PresentT 2"pz @(Div (Fst Id) (Snd Id)) (10,0)Error Div zero denominatorFailT "Div zero denominator"/predicate-typed similar to !pz @(Map Even Id) [9,-4,12,1,2,3]*Present [False,True,True,False,True,False]+PresentT [False,True,True,False,True,False](pz @(Map '(Even,Odd) Id) [9,-4,12,1,2,3]WPresent [(False,True),(True,False),(True,False),(False,True),(True,False),(False,True)]XPresentT [(False,True),(True,False),(True,False),(False,True),(True,False),(False,True)]1predicate-typedcatch a failureRpz @(Catch (Succ Id) (Fst Id >> Second (ShowP Id) >> PrintT "%s %s" Id >> 'LT)) GT Present LT PresentT LTBpz @(Catch' (Succ Id) (Second (ShowP Id) >> PrintT "%s %s" Id)) GT;Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument GT=FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument GT"Bpz @(Catch' (Succ Id) (Second (ShowP Id) >> PrintT "%s %s" Id)) LT Present EQ PresentT EQmore flexible: takes a (String,x) and a proxy so we can still call 'False 'True now takes the FailT string and x so you can print more detail if you want need the proxy so we can fail without having to explicitly specify a type7predicate-typed$Fails the computation with a message+pz @(Failt Int (PrintF "value=%03d" Id)) 99Error value=099FailT "value=099">pz @(FailS (PrintT "value=%03d string=%s" Id)) (99,"somedata")Error value=099 string=somedata!FailT "value=099 string=somedata"9predicate-typed similar to (pz @(Break (Ge 3) Id) [10,4,1,7,3,1,3,5]Present ([],[10,4,1,7,3,1,3,5]) PresentT ([],[10,4,1,7,3,1,3,5])(pz @(Break (Lt 3) Id) [10,4,1,7,3,1,3,5]Present ([10,4],[1,7,3,1,3,5])PresentT ([10,4],[1,7,3,1,3,5]);predicate-typed similar to ,pz @(Partition (Ge 3) Id) [10,4,1,7,3,1,3,5]Present ([10,4,7,3,3,5],[1,1])PresentT ([10,4,7,3,3,5],[1,1])0pz @(Partition (Prime Id) Id) [10,4,1,7,3,1,3,5]Present ([7,3,3,5],[10,4,1,1])PresentT ([7,3,3,5],[10,4,1,1]).pz @(Partition (Ge 300) Id) [10,4,1,7,3,1,3,5]Present ([],[10,4,1,7,3,1,3,5]) PresentT ([],[10,4,1,7,3,1,3,5])0pz @(Partition (Id < 300) Id) [10,4,1,7,3,1,3,5]Present ([10,4,1,7,3,1,3,5],[]) PresentT ([10,4,1,7,3,1,3,5],[])<predicate-typedNcreates a list of overlapping pairs of elements. requires two or more elementspz @Pairs [1,2,3,4]Present [(1,2),(2,3),(3,4)]PresentT [(1,2),(2,3),(3,4)] pz @Pairs []Error Pairs no data foundFailT "Pairs no data found" pz @Pairs [1]"Error Pairs only one element found$FailT "Pairs only one element found"=predicate-typedif p then run q else run r>pz @(If (Gt 4) "greater than 4" "less than or equal to 4" ) 10Present "greater than 4"PresentT "greater than 4"<pz @(If (Gt 4) "greater than 4" "less than or equal to 4") 0!Present "less than or equal to 4""PresentT "less than or equal to 4"?predicate-typed similar to pz @(Map (Pred Id) Id) [1..5]Present [0,1,2,3,4]PresentT [0,1,2,3,4]Epredicate-typed similar to =pz @(Unfoldr (MaybeBool (Not Null) (SplitAt 2 Id)) Id) [1..5]Present [[1,2],[3,4],[5]]PresentT [[1,2],[3,4],[5]]pz @(IterateN 4 (Succ Id)) 4Present [4,5,6,7]PresentT [4,5,6,7]Jpredicate-typed similar to >pz @(Scanl (Snd Id :+ Fst Id) (Fst Id) (Snd Id)) ([99],[1..5])EPresent [[99],[1,99],[2,1,99],[3,2,1,99],[4,3,2,1,99],[5,4,3,2,1,99]]FPresentT [[99],[1,99],[2,1,99],[3,2,1,99],[4,3,2,1,99],[5,4,3,2,1,99]]pz @(ScanN 4 Id (Succ Id)) 'c'Present "cdefg"PresentT "cdefg"pz @(FoldN 4 Id (Succ Id)) 'c' Present 'g' PresentT 'g'Npredicate-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])Present ("ac",[2,4,99],[('z',1),('a',2)])*PresentT ("ac",[2,4,99],[('z',1),('a',2)])Opredicate-typed similar to Apz @PartitionEithers [Left 'a',Right 2,Left 'c',Right 4,Right 99]Present ("ac",[2,4,99])PresentT ("ac",[2,4,99])/pz @PartitionEithers [Right 2,Right 4,Right 99]Present ([],[2,4,99])PresentT ([],[2,4,99])(pz @PartitionEithers [Left 'a',Left 'c']Present ("ac",[])PresentT ("ac",[])'pz @PartitionEithers ([] @(Either _ _))Present ([],[])PresentT ([],[])Rpredicate-typed similar to pz @(EnumFromTo 2 5) ()Present [2,3,4,5]PresentT [2,3,4,5]pz @(EnumFromTo 'LT 'GT) ()Present [LT,EQ,GT]PresentT [LT,EQ,GT]pz @(EnumFromTo 'GT 'LT) () Present [] PresentT []0pz @(EnumFromTo (Pred Id) (Succ Id)) (SG.Max 10)>Present [Max {getMax = 9},Max {getMax = 10},Max {getMax = 11}]?PresentT [Max {getMax = 9},Max {getMax = 10},Max {getMax = 11}]Spredicate-typed similar to  using pz @Null [1,2,3,4]FalseFalseT pz @Null []TrueTrueTpz @Null NothingTrueTrueTTpredicate-typed similar to  using pz @IsEmpty [1,2,3,4]FalseFalseTpz @IsEmpty []TrueTrueTpz @IsEmpty LTFalseFalseTpz @IsEmpty EQTrueTrueTUpredicate-typedpz @Unsnoc [1,2,3,4]Present Just ([1,2,3],4)PresentT (Just ([1,2,3],4)) pz @Unsnoc []Present NothingPresentT Nothingpz @Unsnoc ("xyz" :: T.Text)Present Just ("xy",'z')PresentT (Just ("xy",'z'))Vpredicate-typedpz @Uncons [1,2,3,4]Present Just (1,[2,3,4])PresentT (Just (1,[2,3,4])) pz @Uncons []Present NothingPresentT Nothingpz @Uncons (Seq.fromList "abc") Present Just ('a',fromList "bc")#PresentT (Just ('a',fromList "bc"))pz @Uncons ("xyz" :: T.Text)Present Just ('x',"yz")PresentT (Just ('x',"yz"))Wpredicate-typedsimilar to snoc%pz @(Snd Id +: Fst Id) (99,[1,2,3,4])Present [1,2,3,4,99]PresentT [1,2,3,4,99]pz @(Fst Id +: Snd Id) ([],5) Present [5] PresentT [5]pz @(EmptyT [] Id +: 5) 5 Present [5] PresentT [5]Xpredicate-typedsimilar to cons%pz @(Fst Id :+ Snd Id) (99,[1,2,3,4])Present [99,1,2,3,4]PresentT [99,1,2,3,4]pz @(Snd Id :+ Fst Id) ([],5) Present [5] PresentT [5]$pz @(123 :+ EmptyList _) "somestuff" Present [123]PresentT [123]Ypredicate-typed"# pz @(Ors Id) [False,False,False]FalseFalseT#pl @(Ors Id) [True,True,True,False]*True (Ors(4) i=0 | [True,True,True,False])TrueTpl @(Ors Id) []False (Ors(0) | [])FalseTZpredicate-typed"$pz @(Ands Id) [True,True,True]TrueTrueT$pl @(Ands Id) [True,True,True,False],False (Ands(4) i=3 | [True,True,True,False])FalseTpz @(Ands Id) []TrueTrueT[predicate-typed leveraging )pz @(Lookup Id 2) ["abc","D","eF","","G"]Present Just "eF"PresentT (Just "eF")*pz @(Lookup Id 20) ["abc","D","eF","","G"]Present NothingPresentT Nothing]predicate-typed similar to  leveraging %import qualified Data.Map.Strict as M%pz @(Id !! 2) ["abc","D","eF","","G"] Present "eF" PresentT "eF"&pz @(Id !! 20) ["abc","D","eF","","G"]Error (!!) index not foundFailT "(!!) index not found"Fpz @(Id !! "eF") (M.fromList (flip zip [0..] ["abc","D","eF","","G"])) Present 2 PresentT 2_predicate-typed similar to .pz @(Ix 4 "not found") ["abc","D","eF","","G"] Present "G" PresentT "G"/pz @(Ix 40 "not found") ["abc","D","eF","","G"]Present "not found"PresentT "not found"bpredicate-typed similar to  but for a fixed number 'n'pz @(Cycle 5 Id) [1,2]Present [1,2,1,2,1]PresentT [1,2,1,2,1]cpredicate-typed similar to 'pz @(Concat Id) ["abc","D","eF","","G"]Present "abcDeFG"PresentT "abcDeFG"3pz @(Concat (Snd Id)) ('x',["abc","D","eF","","G"])Present "abcDeFG"PresentT "abcDeFG"dpredicate-typedsimilar to a limited form of 'pz @(FoldMap (SG.Sum _) Id) [44, 12, 3] Present 59 PresentT 59+pz @(FoldMap (SG.Product _) Id) [44, 12, 3] Present 1584 PresentT 1584type Ands' p = FoldMap SG.All p%pz @(Ands' Id) [True,False,True,True] Present FalsePresentT Falsepz @(Ands' Id) [True,True,True] Present True PresentT Truepz @(Ands' Id) [] Present True PresentT Truetype Ors' p = FoldMap SG.Any p!pz @(Ors' Id) [False,False,False] Present FalsePresentT Falsepz @(Ors' Id) [] Present FalsePresentT False&pz @(Ors' Id) [False,False,False,True] Present True PresentT True4type AllPositive' = FoldMap SG.All (Map Positive Id) pz @AllPositive' [3,1,-5,10,2,3] Present FalsePresentT False4type AllNegative' = FoldMap SG.All (Map Negative Id)"pz @AllNegative' [-1,-5,-10,-2,-3] Present True 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] Present 12 PresentT 12epredicate-typed similar to 1pz @(MConcat Id) [SG.Sum 44, SG.Sum 12, SG.Sum 3]Present Sum {getSum = 59}PresentT (Sum {getSum = 59})fpredicate-typed constructor(pz @(MkThese (Fst Id) (Snd Id)) (44,'x')Present These 44 'x'PresentT (These 44 'x')hpredicate-typed constructorpz @(MkThat _ Id) 44Present That 44PresentT (That 44)jpredicate-typed constructorpz @(MkThis _ Id) 44Present This 44PresentT (This 44)(pz @(Proxy Int >> MkThis' Unproxy 10) []Present This 10PresentT (This 10)lpredicate-typed constructorpz @(MkRight _ Id) 44Present Right 44PresentT (Right 44)npredicate-typed constructorpz @(MkLeft _ Id) 44Present Left 44PresentT (Left 44)opredicate-typed%& constructorpz @(MkJust Id) 44Present Just 44PresentT (Just 44)rpredicate-typed similar to pz @(EmptyT Maybe Id) ()Present NothingPresentT Nothingpz @(EmptyT [] Id) () Present [] PresentT []%pz @(EmptyT [] (Char1 "x")) (13,True) Present "" PresentT ""/pz @(EmptyT (Either String) (Fst Id)) (13,True)Present Left ""PresentT (Left "")upredicate-typed similar to pz @(MEmptyT (SG.Sum Int)) ()Present Sum {getSum = 0}PresentT (Sum {getSum = 0})Bno Monoid for Maybe a unless a is also a monoid but can use empty!vpredicate-typed similar to pz @(Pure Maybe Id) 4Present Just 4PresentT (Just 4)pz @(Pure [] Id) 4 Present [4] PresentT [4]-pz @(Pure (Either String) (Fst Id)) (13,True)Present Right 13PresentT (Right 13)wpredicate-typed similar to pz @(STimes 4 Id) (SG.Sum 3)Present Sum {getSum = 12}PresentT (Sum {getSum = 12})pz @(STimes 4 Id) "ab"Present "abababab"PresentT "abababab"zpredicate-typed similar to Rprovides a Proxy to the result of 'q' but does not provide the surrounding context8pz @(MaybeIn "foundnothing" (ShowP (Pred Id))) (Just 20) Present "19" PresentT "19"7pz @(MaybeIn "found nothing" (ShowP (Pred Id))) NothingPresent "found nothing"PresentT "found nothing"{predicate-typed similar to  ' 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) Present "132"PresentT "132"Lpz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (This 123)Present (123,"fromthis")PresentT (123,"fromthis")Spz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (That "fromthat")Present (-99,"fromthat")PresentT (-99,"fromthat")Ypz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (These 123 "fromthese")Present (123,"fromthese")PresentT (123,"fromthese")predicate-typed similar to 6 but additionally gives 'p' and 'q' the original inputNpz @(EitherX (ShowP (Fst (Fst Id) + Snd Id)) (ShowP Id) (Snd Id)) (9,Left 123) Present "132"PresentT "132"Opz @(EitherX (ShowP (Fst (Fst Id) + Snd Id)) (ShowP Id) (Snd Id)) (9,Right 'x')Present "((9,Right 'x'),'x')"PresentT "((9,Right 'x'),'x')"Jpz @(EitherX (ShowP Id) (ShowP (Second (Succ Id))) (Snd Id)) (9,Right 'x')Present "((9,Right 'x'),'y')"PresentT "((9,Right 'x'),'y')"predicate-typed takes the head of a list or failsee  for other supported types eg 2pz @(HeadFail "dude" Id) [ "abc","def","asdfadf" ] Present "abc"PresentT "abc"!pz @(HeadFail "empty list" Id) []Error empty listFailT "empty list"predicate-typed/takes the head or default of a list-like objectsee  for other supported types eg pz @(HeadDef 444 Id) [] Present 444 PresentT 444pz @(HeadDef 444 Id) [1..5] Present 1 PresentT 1pz @(HeadDef 444 Id) [1..5] Present 1 PresentT 14pz @(HeadDef (Char1 "w") Id) (Seq.fromList "abcdef") Present 'a' PresentT 'a'&pz @(HeadDef (Char1 "w") Id) Seq.empty Present 'w' PresentT 'w'-pz @(HeadDef (MEmptyT _) Id) ([] @(SG.Sum _))Present Sum {getSum = 0}PresentT (Sum {getSum = 0})7pz @(HeadDef (MEmptyT _) '[ "abc","def","asdfadf" ]) () Present "abc"PresentT "abc"Bpz @(HeadDef (MEmptyT _) (Snd Id)) (123,[ "abc","def","asdfadf" ]) Present "abc"PresentT "abc"+pz @(HeadDef (MEmptyT _) (Snd Id)) (123,[]) Present () PresentT ()predicate-typedsimilar to fmap sndpz @FMapSnd (Just ("asf",13))Present Just 13PresentT (Just 13)predicate-typedsimilar to fmap fstpz @FMapFst (Just (13,"Asf"))Present Just 13PresentT (Just 13)to make this work we grab the fst or snd out of the Maybe so it is a head or not/ is a tail or not etc! we still have access to the whole original list so we dont lose anything!predicate-typed function+pz @(Elem (Fst Id) (Snd Id)) ('x',"abcdxy")TrueTrueT+pz @(Elem (Fst Id) (Snd Id)) ('z',"abcdxy")FalseFalseTpredicate-typed<filters a list 'q' keeping or removing those elements in 'p'!pz @(Keep '[5] '[1,5,5,2,5,2]) ()Present [5,5,5]PresentT [5,5,5]'pz @(Keep '[0,1,1,5] '[1,5,5,2,5,2]) ()Present [1,5,5,5]PresentT [1,5,5,5]#pz @(Remove '[5] '[1,5,5,2,5,2]) ()Present [1,2,2]PresentT [1,2,2])pz @(Remove '[0,1,1,5] '[1,5,5,2,5,2]) () Present [2,2]PresentT [2,2]$pz @(Remove '[99] '[1,5,5,2,5,2]) ()Present [1,5,5,2,5,2]PresentT [1,5,5,2,5,2]'pz @(Remove '[99,91] '[1,5,5,2,5,2]) ()Present [1,5,5,2,5,2]PresentT [1,5,5,2,5,2]!pz @(Remove Id '[1,5,5,2,5,2]) []Present [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!Present [1,5,5,2,5,2]PresentT [1,5,5,2,5,2]predicate-typeda predicate on prime numberspz @(Prime Id) 2TrueTrueT#pz @(Map '(Id,Prime Id) Id) [0..12]Present [(0,False),(1,False),(2,True),(3,True),(4,False),(5,True),(6,False),(7,True),(8,False),(9,False),(10,False),(11,True),(12,False)]PresentT [(0,False),(1,False),(2,True),(3,True),(4,False),(5,True),(6,False),(7,True),(8,False),(9,False),(10,False),(11,True),(12,False)]predicate-typedbounded  functionpz @(ToEnumBDef Ordering LT) 2 Present GT PresentT GTpz @(ToEnumBDef Ordering LT) 6 Present LT PresentT LTpz @(ToEnumBFail Ordering) 6Error ToEnum bounded failedFailT "ToEnum bounded failed"predicate-typedunsafe  functionpz @(ToEnum Char Id) 120 Present 'x' PresentT 'x'predicate-typed  functionpz @(FromEnum Id) 'x' Present 120 PresentT 120predicate-typed unbounded   functionpz @(Pred Id) 13 Present 12 PresentT 12pz @(Pred Id) LT8Error Pred IO e=Prelude.Enum.Ordering.pred: bad argument:FailT "Pred IO e=Prelude.Enum.Ordering.pred: bad argument"predicate-typed unbounded   functionpz @(Succ Id) 13 Present 14 PresentT 14pz @(Succ Id) LT Present EQ PresentT EQpz @(Succ Id) GT8Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument:FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument"predicate-typedbounded   functionpz @(PredB' Id) (13 :: Int) Present 12 PresentT 12pz @(PredB' Id) LTError Pred bounded failedFailT "Pred bounded failed"predicate-typedbounded   functionpz @(SuccB' Id) (13 :: Int) Present 14 PresentT 14pz @(SuccB' Id) LT Present EQ PresentT EQpz @(SuccB 'LT Id) GT Present LT PresentT LTpz @(SuccB' Id) GTError Succ bounded failedFailT "Succ bounded failed"predicate-typedunassoc using  "pz @Unassoc (These 123 (This 'x'))Present This (These 123 'x')PresentT (This (These 123 'x'))pz @Unassoc (99,('a',True))Present ((99,'a'),True)PresentT ((99,'a'),True)2pz @Unassoc (This 10 :: These Int (These Bool ()))Present This (This 10)PresentT (This (This 10))pz @Unassoc (Right (Right 123))Present Right 123PresentT (Right 123):pz @Unassoc (Left 'x' :: Either Char (Either Bool Double))Present Left (Left 'x')PresentT (Left (Left 'x'))predicate-typed assoc using   pz @Assoc (This (These 123 'x'))Present These 123 (This 'x')PresentT (These 123 (This 'x'))pz @Assoc ((99,'a'),True)Present (99,('a',True))PresentT (99,('a',True))pz @Assoc ((99,'a'),True)Present (99,('a',True))PresentT (99,('a',True))7pz @Assoc (Right "Abc" :: Either (Either () ()) String)Present Right (Right "Abc")PresentT (Right (Right "Abc"))pz @Assoc (Left (Left 'x'))Present Left 'x'PresentT (Left 'x')predicate-typed swaps using pz @Swap (Left 123)Present Right 123PresentT (Right 123)pz @Swap (Right 123)Present Left 123PresentT (Left 123)pz @Swap (These 'x' 123)Present These 123 'x'PresentT (These 123 'x')pz @Swap (This 'x')Present That 'x'PresentT (That 'x')pz @Swap (That 123)Present This 123PresentT (This 123)pz @Swap (123,'x')Present ('x',123)PresentT ('x',123)pz @Swap (Left "abc")Present Right "abc"PresentT (Right "abc")pz @Swap (Right 123)Present Left 123PresentT (Left 123)predicate-typedreverses using pz @ReverseL (T.pack "AbcDeF")Present "FeDcbA"PresentT "FeDcbA"!pz @ReverseL ("AbcDeF" :: String)Present "FeDcbA"PresentT "FeDcbA"predicate-typed similar to pz @Reverse [1,2,4]Present [4,2,1]PresentT [4,2,1]pz @Reverse "AbcDeF"Present "FeDcbA"PresentT "FeDcbA"predicate-typedlift pure over a Functor#pz @(Pure2 (Either String)) [1,2,4]!Present [Right 1,Right 2,Right 4]"PresentT [Right 1,Right 2,Right 4]predicate-typedlift mempty over a FunctorIpz @(MEmptyT2 (SG.Product Int)) [Identity (-13), Identity 4, Identity 99]TPresent [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}]UPresentT [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}]predicate-typedsee : coerce over a functorHpz @(Coerce2 (SG.Sum Integer)) [Identity (-13), Identity 4, Identity 99]?Present [Sum {getSum = -13},Sum {getSum = 4},Sum {getSum = 99}]@PresentT [Sum {getSum = -13},Sum {getSum = 4},Sum {getSum = 99}]6pz @(Coerce2 (SG.Sum Integer)) (Just (Identity (-13)))!Present Just (Sum {getSum = -13})$PresentT (Just (Sum {getSum = -13}))4pz @(Coerce2 (SG.Sum Int)) (Nothing @(Identity Int))Present NothingPresentT Nothingpredicate-typed similar to .pz @(Coerce (SG.Sum Integer)) (Identity (-13))Present Sum {getSum = -13}PresentT (Sum {getSum = -13})predicate-typedwraps a value (see  and ):m + Data.List.NonEmptypz @(Wrap (SG.Sum _) Id) (-13)Present Sum {getSum = -13}PresentT (Sum {getSum = -13})pz @(Wrap SG.Any (Ge 4)) 13Present Any {getAny = True}PresentT (Any {getAny = True})3pz @(Wrap (NonEmpty _) (Uncons >> 'Just Id)) "abcd"Present 'a' :| "bcd"PresentT ('a' :| "bcd")predicate-typedunwraps a value (see )pz @(Unwrap Id) (SG.Sum (-13)) Present -13PresentT (-13)predicate-typed similar to pz @(Signum Id) (-14) Present -1 PresentT (-1)pz @(Signum Id) 14 Present 1 PresentT 1pz @(Signum Id) 0 Present 0 PresentT 0predicate-typed similar to pz @(Abs Id) (-14) Present 14 PresentT 14pz @(Abs (Snd Id)) ("xx",14) Present 14 PresentT 14pz @(Abs Id) 0 Present 0 PresentT 0pz @(Abs (Negate 44)) "aaa" Present 44 PresentT 44predicate-typed similar to pz @(Negate Id) 14 Present -14PresentT (-14)%pz @(Negate (Fst Id * Snd Id)) (14,3) Present -42PresentT (-42)pz @(Negate (15 %- 4)) "abc"Present 15 % 4PresentT (15 % 4)pz @(Negate (15 % 3)) ()Present (-5) % 1PresentT ((-5) % 1)%pz @(Negate (Fst Id % Snd Id)) (14,3)Present (-14) % 3PresentT ((-14) % 3)predicate-typed creates a  valuepz @(Id < 21 % 5) (-3.1)TrueTrueTpz @(Id < 21 % 5) 4.5FalseFalseTpz @(Fst Id % Snd Id) (13,2)Present 13 % 2PresentT (13 % 2)pz @(13 % Id) 0Error MkRatio zero denominator FailT "MkRatio zero denominator"pz @(4 % 3 + 5 % 7) "asfd"Present 43 % 21PresentT (43 % 21)pz @(4 %- 7 * 5 %- 3) "asfd"Present 20 % 21PresentT (20 % 21)pz @(Negate (14 % 3)) ()Present (-14) % 3PresentT ((-14) % 3)pz @(14 % 3) ()Present 14 % 3PresentT (14 % 3)6pz @(Negate (14 % 3) ==! FromIntegral _ (Negate 5)) () Present GT PresentT GTpz @(14 -% 3 ==! 5 %- 1) "aa" Present GT PresentT GT)pz @(Negate (14 % 3) ==! Negate 5 % 2) () Present LT PresentT LTpz @(14 -% 3 * 5 -% 1) ()Present 70 % 3PresentT (70 % 3)pz @(14 % 3 ==! 5 % 1) () Present LT PresentT LTpz @(15 % 3 / 4 % 2) () Present 5 % 2PresentT (5 % 2)predicate-typedfractional divisionpz @(Fst Id / Snd Id) (13,2) Present 6.5 PresentT 6.5pz @(ToRational 13 / Id) 0Error (/) zero denominatorFailT "(/) zero denominator"pz @(12 % 7 / 14 % 5 + Id) 12.4Present 3188 % 245PresentT (3188 % 245)predicate-typed(addition, multiplication and subtractionpz @(Fst Id * Snd Id) (13,5) Present 65 PresentT 652pz @(Fst Id + 4 * Length (Snd Id) - 4) (3,"hello") Present 19 PresentT 19predicate-typedsimilar pz @(Pred Id +++ Id) (Left 13)Present Left 12PresentT (Left 12)*pz @(ShowP Id +++ Reverse) (Right "hello")Present Right "olleh"PresentT (Right "olleh")predicate-typedsimilar pz @(Pred Id ||| Id) (Left 13) Present 12 PresentT 12%pz @(ShowP Id ||| Id) (Right "hello")Present "hello"PresentT "hello"predicate-typed similar to %pz @(Pred Id *** ShowP Id) (13, True)Present (12,"True")PresentT (12,"True")predicate-typed similar to predicate-typed similar to  pz @(SplitAt 4 Id) "hello world"Present ("hell","o world")PresentT ("hell","o world")!pz @(SplitAt 20 Id) "hello world"Present ("hello world","")PresentT ("hello world","") pz @(SplitAt 0 Id) "hello world"Present ("","hello world")PresentT ("","hello world")1pz @(SplitAt (Snd Id) (Fst Id)) ("hello world",4)Present ("hell","o world")PresentT ("hell","o world")predicate-typedIsplit a list 'p' into parts using the lengths in the type level list 'ns'*pz @(SplitAts '[2,3,1,1] Id) "hello world"#Present ["he","llo"," ","w","orld"]$PresentT ["he","llo"," ","w","orld"]$pz @(SplitAts '[2] Id) "hello world"Present ["he","llo world"]PresentT ["he","llo world"]+pz @(SplitAts '[10,1,1,5] Id) "hello world" Present ["hello worl","d","",""]!PresentT ["hello worl","d","",""]predicate-typed pad 'q' with '\n' values from '\p'\pz @(PadL 5 999 Id) [12,13]Present [999,999,999,12,13]PresentT [999,999,999,12,13](pz @(PadR 5 (Fst Id) '[12,13]) (999,'x')Present [12,13,999,999,999]PresentT [12,13,999,999,999]+pz @(PadR 2 (Fst Id) '[12,13,14]) (999,'x')Present [12,13,14]PresentT [12,13,14]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))Present Right 999PresentT (Right 999)Hpz @(EitherBool (Fst Id > 4) (Fst (Snd Id)) (Snd (Snd Id))) (1,(-1,999))Present Left (-1)PresentT (Left (-1))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) 24Present Just 24PresentT (Just 24) pz @(MaybeBool (Id > 4) Id) (-5)Present NothingPresentT Nothingpredicate-typedEprocesses a type level list predicates running each in sequence: see  0pz @(Do [Pred Id, ShowP Id, Id &&& Len]) 9876543Present ("9876542",7)PresentT ("9876542",7)=pz @(Do '[W 123, W "xyz", Len &&& Id, Pred Id *** Id<>Id]) ()Present (2,"xyzxyz")PresentT (2,"xyzxyz")predicate-typedconverts a value to a : the same as  '\'Proxy'pz @MkProxy 'x' Present ProxyPresentT Proxypredicate-typed> function where you need to provide the type 't' of the resultpz @(Floor Int Id) (23 % 5) Present 4 PresentT 4predicate-typed> function where you need to provide the type 't' of the resultpz @(Ceiling Int Id) (23 % 5) Present 5 PresentT 5predicate-typed > function where you need to provide the type 't' of the resultpz @(Truncate Int Id) (23 % 5) Present 4 PresentT 4predicate-typed!> function where you need to provide the type 't' of the result#pz @(FromRational Rational Id) 23.5Present 47 % 2PresentT (47 % 2)predicate-typed" functionpz @(ToRational Id) 23.5Present 47 % 2PresentT (47 % 2)predicate-typed#> function where you need to provide the type 't' of the result#pz @(FromIntegral (SG.Sum _) Id) 23Present Sum {getSum = 23}PresentT (Sum {getSum = 23})predicate-typed$> function where you need to provide the type 't' of the result"pz @(FromInteger (SG.Sum _) Id) 23Present Sum {getSum = 23}PresentT (Sum {getSum = 23}) pz @(FromInteger Rational 44) 12Present 44 % 1PresentT (44 % 1) pz @(FromInteger Rational Id) 12Present 12 % 1PresentT (12 % 1)predicate-typed%> function where you need to provide the type 't' of the result'pz @(FromStringP (Identity _) Id) "abc"Present Identity "abc"PresentT (Identity "abc")&pz @(FromStringP (Seq.Seq _) Id) "abc"Present fromList "abc"PresentT (fromList "abc")predicate-typed#similar to 6th element in a n-tuple$pz @(L6 Id) (10,"Abc",'x',True,1,99) Present 99 PresentT 99predicate-typed#similar to 5th element in a n-tuple!pz @(L5 Id) (10,"Abc",'x',True,1) Present 1 PresentT 1predicate-typed#similar to 4th element in a n-tuplepz @(L4 Id) (10,"Abc",'x',True) Present True PresentT True;pz @(L4 (Fst (Snd Id))) ('x',((10,"Abc",'x',999),"aa",1),9) Present 999 PresentT 999predicate-typed#similar to 3rd element in a n-tuplepz @(Thd Id) (10,"Abc",133) Present 133 PresentT 133 pz @(Thd Id) (10,"Abc",133,True) Present 133 PresentT 133predicate-typed similar to &pz @(Snd Id) (10,"Abc") Present "Abc"PresentT "Abc"pz @(Snd Id) (10,"Abc",True) Present "Abc"PresentT "Abc"predicate-typed similar to 'pz @(Fst Id) (10,"Abc") Present 10 PresentT 10pz @(Fst Id) (10,"Abc",'x') Present 10 PresentT 10!pz @(Fst Id) (10,"Abc",'x',False) Present 10 PresentT 10predicate-typed similar to ( for  instancespz @(Length Id) (Left "aa") Present 0 PresentT 0pz @(Length Id) (Right "aa") Present 1 PresentT 1'pz @(Length (Right' Id)) (Right "abcd") Present 4 PresentT 4:pz @(Length (Thd (Snd Id))) (True,(23,'x',[10,9,1,3,4,2])) Present 6 PresentT 6predicate-typed similar to (pz @Len [10,4,5,12,3,4] Present 6 PresentT 6 pz @Len [] Present 0 PresentT 0predicate-typed sort a listOpz @(SortOn (Fst Id) Id) [(10,"abc"), (3,"def"), (4,"gg"), (10,"xyz"), (1,"z")]:Present [(1,"z"),(3,"def"),(4,"gg"),(10,"abc"),(10,"xyz")];PresentT [(1,"z"),(3,"def"),(4,"gg"),(10,"abc"),(10,"xyz")]Gpz @(SortBy (OrdP (Snd Id) (Fst Id)) Id) [(10,"ab"),(4,"x"),(20,"bbb")]&Present [(20,"bbb"),(10,"ab"),(4,"x")]'PresentT [(20,"bbb"),(10,"ab"),(4,"x")]!pz @(SortBy 'LT Id) [1,5,2,4,7,0]Present [1,5,2,4,7,0]PresentT [1,5,2,4,7,0]!pz @(SortBy 'GT Id) [1,5,2,4,7,0]Present [0,7,4,2,5,1]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")]6Present [(4,"a"),(4,"x"),(4,"y"),(10,"ab"),(20,"bbb")]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")]6Present [(4,"y"),(4,"x"),(4,"a"),(10,"ab"),(20,"bbb")]7PresentT [(4,"y"),(4,"x"),(4,"a"),(10,"ab"),(20,"bbb")]predicate-typed similar to )pz @Max [10,4,5,12,3,4] Present 12 PresentT 12 pz @Max []Error empty listFailT "empty list"predicate-typed similar to *pz @Min [10,4,5,12,3,4] Present 3 PresentT 3 pz @Min []Error empty listFailT "empty list"predicate-typed similar to +pz @Sum [10,4,5,12,3,4] Present 38 PresentT 38 pz @Sum [] Present 0 PresentT 0predicate-typedemulates ReadPpredicate-typedIRead but returns the Maybe of the value and any remaining unparsed stringpz @(ReadMaybe Int Id) "123x"Present Just (123,"x")PresentT (Just (123,"x"))pz @(ReadMaybe Int Id) "123"Present Just (123,"")PresentT (Just (123,""))pz @(ReadMaybe Int Id) "x123"Present NothingPresentT Nothingpredicate-typed uses the B of the given type 't' and 'p' which points to the content to readpz @(ReadP Rational Id) "4 % 5" Present 4 % 5PresentT (4 % 5)\pz @(ReadP Day Id >> Between (ReadP Day "2017-04-11") (ReadP Day "2018-12-30")) "2018-10-12"TrueTrueT\pz @(ReadP Day Id >> Between (ReadP Day "2017-04-11") (ReadP Day "2018-12-30")) "2016-10-12"FalseFalseTpredicate-typed uncreate a , returning year month and day$pz @(UnMkDay Id) (read "2019-12-30")Present (2019,12,30)PresentT (2019,12,30)predicate-typed create a ,6 from three int values passed in as year month and daypz @MkDay (2019,12,30)Present Just (2019-12-30,1,1) PresentT (Just (2019-12-30,1,1))7pz @(MkDay' (Fst Id) (Snd Id) (Thd Id)) (2019,99,99999)Present NothingPresentT Nothingpz @MkDay (1999,3,13)Present Just (1999-03-13,10,6)!PresentT (Just (1999-03-13,10,6))predicate-typedUA convenience method to match against many different datetime formats to find a 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") ()Present 2019-03-11 01:22:33PresentT 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")Present 2019-03-11 01:22:33PresentT 2019-03-11 01:22:33 predicate-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"Present 2019-05-24 05:19:59PresentT 2019-05-24 05:19:59Mpz @(ParseTimeP LocalTime "%F %T" "2019-05-24 05:19:59") (Right "never used")Present 2019-05-24 05:19:59PresentT 2019-05-24 05:19:594keeping 'q' as we might want to extract from a tuple predicate-typed@type level expression representing a formatted time similar to / using a type level  to get the formatting stringFpz @(FormatTimeP "%F %T" Id) (read "2019-05-24 05:19:59" :: LocalTime)Present "2019-05-24 05:19:59"PresentT "2019-05-24 05:19:59"Vpz @(FormatTimeP (Fst Id) (Snd Id)) ("the date is %d/%m/%Y", read "2019-05-24" :: Day) Present "the date is 24/05/2019"!PresentT "the date is 24/05/2019" predicate-typed similar to 0pz @(ShowP Id) [4,8,3,9]Present "[4,8,3,9]"PresentT "[4,8,3,9]"pz @(ShowP Id) 'x' Present "'x'"PresentT "'x'"pz @(ShowP (42 %- 10)) 'x'Present "(-21) % 5"PresentT "(-21) % 5" predicate-typedsplit a list into single valuespz @(Ones Id) [4,8,3,9]Present [[4],[8],[3],[9]]PresentT [[4],[8],[3],[9]]pz @(Ones Id) [] Present [] PresentT []predicate-typed similar to 1pz @Tails [4,8,3,9](Present [[4,8,3,9],[8,3,9],[3,9],[9],[]])PresentT [[4,8,3,9],[8,3,9],[3,9],[9],[]] pz @Tails [] Present [[]] PresentT [[]]predicate-typed similar to 2pz @Inits [4,8,3,9](Present [[],[4],[4,8],[4,8,3],[4,8,3,9]])PresentT [[],[4],[4,8],[4,8,3],[4,8,3,9]] pz @Inits [] Present [[]] PresentT [[]]predicate-typedconverts a string () value to upper casepz @ToUpper "HeLlO wOrld!"Present "HELLO WORLD!"PresentT "HELLO WORLD!"predicate-typedconverts a string () value to lower casepz @ToLower "HeLlO wOrld!"Present "hello world!"PresentT "hello world!"predicate-typed5predicate for determining if the string is all digitspz @IsNumber "213G"FalseFalseTpz @IsNumber "929"TrueTrueTpredicate-typed6predicate for determining if a string is all lowercasepz @IsLower "abcdef213"FalseFalseTpz @IsLower "abcdef"TrueTrueTpz @IsLower ""TrueTrueTpz @IsLower "abcdefG"FalseFalseT3predicate-typed(a predicate for determining if a string *)# belongs to the given character setpz @IsLower "abc"TrueTrueTpz @IsLower "abcX"FalseFalseTpz @IsLower (T.pack "abcX")FalseFalseTpz @IsHexDigit "01efA"TrueTrueTpz @IsHexDigit "01egfA"FalseFalseTpredicate-typedA replacement function ([String] -> String)" which yields the groups Used by  and  Requires Text.Show.Functions:m + Text.Show.Functionspz @(ReplaceAll "^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$" (MakeRR3 (Fst Id)) (Snd Id)) (\ys -> intercalate " | " $ map (show . succ . read @Int) ys, "141.201.1.22")Present "142 | 202 | 2 | 23"PresentT "142 | 202 | 2 | 23"predicate-typedA replacement function (String -> String)& that yields the whole match Used by  and  Requires Text.Show.Functions:m + Text.Show.FunctionsXpz @(ReplaceAll "\\." (MakeRR2 (Fst Id)) (Snd Id)) (\x -> x <> ":" <> x, "141.201.1.22")Present "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  and  Requires Text.Show.Functionspredicate-typedSimple replacement string: see " and  4predicate-typed6replaces regex 's' with a string 's1' inside the value2pz @(ReplaceAllString "\\." ":" Id) "141.201.1.22"Present "141:201:1:22"PresentT "141:201:1:22")predicate-typed$splits a string on a regex delimiter%pz @(Resplit "\\." Id) "141.201.1.22"Present ["141","201","1","22"]PresentT ["141","201","1","22"]<pz @(Resplit (Singleton (Fst Id)) (Snd Id)) (':', "12:13:1")Present ["12","13","1"]PresentT ["12","13","1"]+predicate-typed similar to ,B but gives the column start and ending positions instead of values?pz @(RescanRanges "^(\\d{2}):(\\d{2}):(\\d{2})$" Id) "13:05:25"%Present [((0,8),[(0,2),(3,5),(6,8)])]&PresentT [((0,8),[(0,2),(3,5),(6,8)])]-predicate-typedLruns a regex matcher returning the original values and optionally any groups9pz @(Rescan "^(\\d{2}):(\\d{2}):(\\d{2})$" Id) "13:05:25"'Present [("13:05:25",["13","05","25"])](PresentT [("13:05:25",["13","05","25"])]Epz @(Rescan (Snd Id) "13:05:25") ('a',"^(\\d{2}):(\\d{2}):(\\d{2})$")'Present [("13:05:25",["13","05","25"])](PresentT [("13:05:25",["13","05","25"])]/predicate-typedrepresents a predicate using a $ as a regular expression evaluates .% and returns True if there is a match/pz @(Re "^\\d{2}:\\d{2}:\\d{2}$" Id) "13:05:25"TrueTrueT0predicate-typed5 equivalent4pz @Unzip3 (zip3 [1..5] "abcd" (cycle [True,False]))2Present ([1,2,3,4],"abcd",[True,False,True,False])3PresentT ([1,2,3,4],"abcd",[True,False,True,False])1predicate-typed6 equivalentpz @Unzip (zip [1..5] "abcd")Present ([1,2,3,4],"abcd")PresentT ([1,2,3,4],"abcd")4predicate-typed:a type level predicate for all negative elements in a list5predicate-typed:a type level predicate for all positive elements in a listpz @AllPositive [1,5,10,2,3]TrueTrueTpz @AllPositive [0,1,5,10,2,3]FalseFalseTpz @AllPositive [3,1,-5,10,2,3]FalseFalseT!pz @AllNegative [-1,-5,-10,-2,-3]TrueTrueT6predicate-typed similar to 7pz @(Any Even Id) [1,5,11,5,3]FalseFalseTpz @(Any Even Id) [1,5,112,5,3]TrueTrueTpz @(Any Even Id) []FalseFalseT7predicate-typed similar to 8pl @(All Even Id) [1,5,11,5,3] False (All i=0 (1 == 0) 5 false)FalseTpz @(All Odd Id) [1,5,11,5,3]TrueTrueTpz @(All Odd Id) []TrueTrueTpe @(All Even Id) [1,5,11,5,3]6False All i=0 (1 == 0) 5 false|+- 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:predicate-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]TrueTrueTpz @(Between 5 8) 6TrueTrueTpz @(Between 5 8) 9FalseFalseTpz @(10 % 4 <..> 40 % 5) 4TrueTrueTpz @(10 % 4 <..> 40 % 5) 33FalseFalseT;predicate-typed5a type level predicate for a strictly decreasing list<predicate-typed6a type level predicate for a monotonic decreasing list=predicate-typed5a type level predicate for a strictly increasing list>predicate-typed6a type level predicate for a monotonic increasing listpl @Asc "aaacdef" True (All(6))TrueTpz @Asc [1,2,3,4,5,5,7]TrueTrueTpz @Asc' [1,2,3,4,5,5,7]FalseFalseTpz @Asc "axacdef"FalseFalseT6a type level predicate for a monotonic increasing listpredicate-typedBActs as a proxy in this dsl where you can explicitly set the Type.WIt is passed around as an argument to help the type checker when needed. see 'ReadP,  ,        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>ZY>=<;98:765342./,-*+()&'$%"# !<   /.-,+*)(`a2     R?c>;:98 'bTS pqoyxQPzOmnklewtus_^]\[XWVUNMLK~}|ijghf{JIHGFEDCBA@76541010=%& !$#"vdr3,1034446 44123111111W5X58887444444444444766223384None,-.=>?HSUVXkg _predicate-typed;take any valid Read/Show instance and turn it into a valid :m + Data.Ratio*prtEval3P (readshow @Rational) oz "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})+prtEval3P (readshow @Rational) oz "13x % 3"QLeft Step 1. Initial Conversion(ip) Failed | ReadP Ratio Integer (13x % 3) failedFprtEval3P (readshow' @Rational @(Between (3 % 1) (5 % 1))) oz "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})QprtEval3P (Proxy @(ReadShow' Rational (Between (11 %- 2) (3 %- 1)))) oz "-13 % 3"8Right (Refined3 {r3In = (-13) % 3, r3Out = "(-13) % 3"})CprtEval3P (Proxy @(ReadShow' Rational (Id > (15 % 1)))) oz "13 % 3"-Left Step 2. False Boolean Check(op) | FalseP{prtEval3P (Proxy @(ReadShow' Rational (Msg (PrintF "invalid=%3.2f" (FromRational Double Id)) (Id > (15 % 1))))) ol "13 % 3"DLeft Step 2. False Boolean Check(op) | {invalid=4.3313 % 3 > 15 % 1}CprtEval3P (Proxy @(ReadShow' Rational (Id > (11 % 1)))) oz "13 % 3"-Left Step 2. False Boolean Check(op) | FalseP0let tmString = "2018-10-19 14:53:11.5121359 UTC"!let tm = read tmString :: UTCTime)prtEval3P (readshow @UTCTime) oz tmStringdRight (Refined3 {r3In = 2018-10-19 14:53:11.5121359 UTC, r3Out = "2018-10-19 14:53:11.5121359 UTC"}):m + Data.Aeson6prtEval3P (readshow @Value) oz "String \"jsonstring\""NRight (Refined3 {r3In = String "jsonstring", r3Out = "String \"jsonstring\""})-prtEval3P (readshow @Value) oz "Number 123.4">Right (Refined3 {r3In = Number 123.4, r3Out = "Number 123.4"})apredicate-typedSconvert a string from a given base 'i' and store it internally as a base 'j' string(prtEval3P (Proxy @(BaseIJ 16 2)) oz "fe"2Right (Refined3 {r3In = "11111110", r3Out = "fe"}))prtEval3P (Proxy @(BaseIJ 16 2)) oz "fge"<Left Step 1. Initial Conversion(ip) Failed | invalid base 16EprtEval3P (Proxy @(BaseIJ' 16 2 (ReadBase Int 2 Id < 1000))) ol "ffe"4Left Step 2. False Boolean Check(op) | {4094 < 1000}cpredicate-typed noop falseepredicate-typed noop truefpredicate-typed Luhn check&prtEval3P (Proxy @(LuhnT 4)) oz "1230"3Right (Refined3 {r3In = [1,2,3,0], r3Out = "1230"})&prtEval3P (Proxy @(LuhnT 4)) ol "1234"fLeft Step 2. False Boolean Check(op) | {True && False | (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])}| uses builtin kpredicate-typedTconvert a string from a given base 'i' and store it internally as an base 10 integerprtEval3P base16 oz "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})3prtEval3P (basen' @16 @(Between 100 400)) oz "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})CprtEval3P (basen' @16 @(GuardSimple (Id < 400) >> 'True)) oz "f0fe"5Left Step 2. Failed Boolean Check(op) | (61694 < 400)TprtEval3P (basen' @16 @(Id < 400)) ol "f0fe" -- todo: why different parens vs braces4Left Step 2. False Boolean Check(op) | {61694 < 400}tpredicate-typed'read in an ipv4 address and validate itprtEval3P ip oz "001.223.14.1"ARight (Refined3 {r3In = [1,223,14,1], r3Out = "001.223.014.001"}) prtEval3P ip ol "001.223.14.999"pLeft Step 2. False Boolean Check(op) | {GuardBool(3) [guard(3) octet out of range 0-255 found 999] (999 <= 255)}"prtEval3P ip oz "001.223.14.999.1"=Left Step 1. Initial Conversion(ip) Failed | Regex no resultsprtEval3P ip ol "001.257.14.1"pLeft Step 2. False Boolean Check(op) | {GuardBool(1) [guard(1) octet out of range 0-255 found 257] (257 <= 255)}ypredicate-typedread in an ssnprtEval3P ssn oz "134-01-2211"=Right (Refined3 {r3In = [134,1,2211], r3Out = "134-01-2211"})prtEval3P ssn ol "666-01-2211"|Left Step 2. False Boolean Check(op) | {GuardBool(0) [number for group 0 invalid: found 666] (True && False | (666 /= 666))}prtEval3P ssn ol "667-00-2211"dLeft Step 2. False Boolean Check(op) | {GuardBool(1) [number for group 1 invalid: found 0] (1 <= 0)}9predicate-typedcredit card with luhn algorithm!prtEval3P cc11 oz "1234-5678-901"-Left Step 2. False Boolean Check(op) | FalseP!prtEval3P 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"TrueTrueT#pz @(Ccip >> Ccop 10) "79927398713"%Error expected 10 digits but found 11'FailT "expected 10 digits but found 11"predicate-typedread in a valid datetime9prtEval3P (datetime1 @LocalTime) oz "2018-09-14 02:57:04"LRight (Refined3 {r3In = 2018-09-14 02:57:04, r3Out = "2018-09-14 02:57:04"}):prtEval3P (datetime1' @LocalTime) oz "2018-09-14 99:98:97"8Left Step 2. Failed Boolean Check(op) | invalid hours 999prtEval3P (datetime1 @LocalTime) ol "2018-09-14 99:98:97"WLeft Step 2. False Boolean Check(op) | {(>>) False | {GuardBool(0) [hours] (99 <= 23)}}:prtEval3P (datetime1' @LocalTime) oz "2018-09-14 23:01:97":Left Step 2. Failed Boolean Check(op) | invalid seconds 979prtEval3P (datetime1 @LocalTime) ol "2018-09-14 23:01:97"YLeft Step 2. False Boolean Check(op) | {(>>) False | {GuardBool(2) [seconds] (97 <= 59)}}?prtEval3P (Proxy @(DateTime1 UTCTime)) oz "2018-09-14 99:98:97"PRight (Refined3 {r3In = 2018-09-18 04:39:37 UTC, r3Out = "2018-09-18 04:39:37"})predicate-typedread in a time and validate itprtEval3P hms ol "23:13:59"8Right (Refined3 {r3In = [23,13,59], r3Out = "23:13:59"})prtEval3P hms ol "23:13:60"JLeft Step 2. False Boolean Check(op) | {GuardBool(2) [seconds] (60 <= 59)}prtEval3P hms ol "26:13:59"HLeft Step 2. False Boolean Check(op) | {GuardBool(0) [hours] (26 <= 23)}predicate-typed8ensures that two numbers are in a given range (emulates )!prtEval3P (between @10 @16) oz 14(Right (Refined3 {r3In = 14, r3Out = 14})!prtEval3P (between @10 @16) oz 17-Left Step 2. False Boolean Check(op) | FalseP!prtEval3P (between @10 @16) o0 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 '167\]^_`abcdefghijklmnopqrstuvwxyz{|}~7{zolmpnxwvus~}|gfytrqkja`_^]\hiedcb Nonei _   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXWYZ[]\^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>None &'->HXkcpredicate-typed creates a " refinement type with terse output r>$$(refinedTH 123) :: Refined (Between 100 125) Int Refined {unRefined = 123} it :: Refined (Between 100 125) Int 4>$$(refinedTH 99) :: Refined (Between 100 125) Int  interactive2: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) Int In an equation for 'it': it = $$(refinedTH 99) :: Refined (Between 100 125) Int predicate-typed creates a  refinement type*allows you to specify display options (eg  for unicode /  for ansi) v>$$(refinedTH' o2 123) :: Refined (Between 100 125) Int Refined {unRefined = 123} it :: Refined (Between 100 125) Int H>$$(refinedTH' o2 99) :: Refined (FailS "asdf" >> Between 100 125) Int  interactiveO: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' o0 99) In the expression: $$(refinedTH' o2 99) :: Refined (FailS "asdf" >> Between 100 125) Int predicate-typed creates a ++" refinement type with terse output _>$$(refined3TH 100) :: Refined3 Id (Between 100 125) Id Int Refined3 {r3In = 100, r3Out = 100} predicate-typed creates a ++ refinement type*allows you to specify display options (eg  for unicode /  for ansi) c>$$(refined3TH' o2 100) :: Refined3 Id (Between 100 125) Id Int Refined3 {r3In = 100, r3Out = 100} @>$$(refined3TH' o2 99) :: Refined3 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 refined3TH: predicate failed with Step 2. False Boolean Check(op) | {100 <= 99} * In the Template Haskell splice $$(refined3TH' o2 99) In the expression: $$(refined3TH' o2 99) :: Refined3 Id (Between 100 125) Id Int In an equation for 'it': it = $$(refined3TH' o2 99) :: Refined3 Id (Between 100 125) Id Int :,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnoppqrstuvwxyz{|}~+&        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~         %        34  !" # $ %& '( ')* +,z- . /0123456789:;< =>!?!@!A!BCDECDFCGH IJKLM NO NPQRQSQTUVWXYZ[\]^Q_`abcbd e f g hijkilmilniopqrstu vw x yz{-predicate-typed-0.3.0.0-geQjIDbtqJHKdprTWSswwPredicate.TH_OrphansPredicate.UtilPredicate.CorePredicate.RefinedPredicate.Refined3Predicate.PreludePredicate.Refined3HelperPredicate.Util_THPaths_predicate_typedPrintLPrintT Predicate ReplaceImplDo>> Control.Arrow&&&GHC.BaseStringRefinedT stripLeft stripRightstrip stripStartstripEnd$ Control.Monadjoin Data.Alignalign Data.Thesethese Data.Listorsands GHC.MaybeJustmergeTheseWithData.Text.LensIsText Data.TextRefined3 $fLiftUTCTime $fLiftFixed$fLiftTimeOfDay$fLiftLocalTime $fLiftDay$fLiftDiffTime MonadEvalrunIOcatchit catchitNFliftEvalT_4T_3T_2T_1ConsTMapTSumTIfTFlipT%&%% InductListC InductListP inductListC InductTupleC InductTupleP inductTupleCLenT IntersperseTRepeatTGetOrdgetOrd OrderingPCgtCgeCeqCleCltCneGetBoolgetBool GetOrdering getOrderingGetThesegetTheseGetLengetLenPGetSymbsgetSymbsGetNatsgetNatsNotTOrTAndT FailUnlessT FailWhenTNullTBetweenTRRRR1RR2RR3GetROptsgetROptsROptAnchored Auto_calloutCaselessDollar_endonlyDotallDupnamesExtendedExtra Firstline Multiline Newline_cr Newline_crlf Newline_lfNo_auto_captureUngreedyUtf8 No_utf8_checkODebugOZeroOLite OSubNormalONormalOVerbosePOptsoWidthoDebugoDispoColorHolderPEBoolPBoolTFailTFalseTTrueTPresentTTT_tBool _tStrings_tForesttBooltStringstForestboolT2PpBoolpStringsmkNodemkNodeB mkNodeSkipPgetValLRFromTTgetValLRfromTThh getValueLRgetValueLRHidedefOptsozololco0o2o2no3ouou3oun isVerbosesetwverbosenormal subnormalsetusetccolor0color1color2color3color4fixBoolTshow01lit01show01'lit01'showLit0showLit1show0show3show1 compileRegex splitAndAlign_FailT _PresentT_FalseT_TrueT~>natsymbgetLen showThese hasNoTree showBoolPcolorMeprtTTIOprtTTprtTreeprtImplfixLite prtTreePure topMessage' topMessagelitezerounicodeansiprettyRationalfixit prefixMsgshowT prettyOrd removeAnsi$fFoldableBoolT $fFoldableTT $fShowPOpts $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:$fShowRR $fGetNats[]: $fGetNats[][] $fGetSymbs[]:$fGetSymbs[][] $fGetLenk: $fGetLenk[]$fGetThesexyThese$fGetThesexyThat$fGetThesexyThis$fGetOrderingGT$fGetOrderingEQ$fGetOrderingLT$fGetBoolFalse $fGetBoolTrue $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 $fShowBoolP $fEqBoolP$fShowPE$fShowTT $fShowDisp$fEqDisp $fOrdODebug $fShowODebug $fEqODebug $fEnumODebug$fBoundedODebug $fShowROpt$fEqROpt $fOrdROpt $fEnumROpt $fBoundedROpt$fShowOrderingP $fEqOrderingP$fEnumOrderingP$fBoundedOrderingP $fEqBoolT $fShowBoolTMsgWIdTIdIPPPevalevalBool evalQuickpepe2pe2npe3pzplplcpupunrunPQ$fPProxyProxya$fPTheseTheseThese$fPTheseThatThese$fPTheseThisThese$fPEitherRightEither$fPEitherLeftEither$fPMaybeNothingMaybe$fPMaybeJustMaybe$fP[]:a$fP[]:a0$fP[][]a$fP()()a$fPNatna$fPOrderingcmpa$fP(,,,)(,,,)a $fP(,,)(,,)a $fP(,)(,)a $fPSymbolsa $fPBoolba $fPTYPEProxya $fPTYPE()a $fPTYPEIa $fPTYPEIda $fPTYPEIdTa $fPTYPEMsga $fPTYPEWaRefinedT unRefinedTRefinedC unRefined arbRefinedrapplyrapply0rapply1convertRefinedT withRefinedTwithRefinedTIO prtRefinedIO newRefined newRefinedT newRefinedTIOunRavelT unRavelTIO prtRefinedTIO prtRefinedT unsafeRefinedunsafeRefined'$fToJSONRefined$fBinaryRefined$fFromJSONRefined $fReadRefined$fMonadError[]RefinedT $fShowRefined $fEqRefined$fGenericRefined $fLiftRefined$fFunctorRefinedT$fApplicativeRefinedT$fMonadRefinedT$fMonadContRefinedT$fMonadWriterRefinedT$fShowRefinedT$fMonadIORefinedT$fMonadTransRefinedTRefinedEmulateMsg3m3Descm3Shortm3LongRResultsRFRTFRTFalseRTTrueFRTTrueTResultsXFXTFXTFalseXTTrueFXTTrueTMakeR3 Refined3Cr3Inr3OutunsafeRefined3'unsafeRefined3 arbRefined3arbRefined3WithmkProxy3 mkProxy3'withRefined3TIO withRefined3TwithRefined3TP newRefined3T newRefined3TPnewRefined3TPIOconvertRefined3TPrapply3rapply3P prtEval3PIOprtEval3 prtEval3Peval3Peval3prt3IOprt3prt3Impleval3PXeval3X$fToJSONRefined3$fBinaryRefined3$fFromJSONRefined3$fReadRefined3 $fShowMsg3 $fShowResults $fEqResults$fShowRResults$fEqMsg3$fLiftRefined3 $fEqRefined3$fShowRefined3InitLastTailHead TheseFailThatFailThisFailTheseDefThatDefThisDef RightFailLeftFailRightDefLeftDefJustFailJustDefDoNRepeat StripLeft StripRightStripLRTrimEnd TrimStartTrim&Join DuplicateExtract<|>*><*<$SapaSapa'<> IsSuffixIIsInfixI IsPrefixIIsSuffixIsInfixIsPrefixStdinStderrStdout WriteFile WriteFile' AppendFileTimeZtTimeUtc ReadEnvAllReadEnv DirExistsReadDir FileExistsReadFileHideTraverseSequenceCase''Case'CaseParaNParaPrintF IntercalateShowBase ReadBaseIntReadBase ReadBase'LuhnZipZipRZipLZipTheseChar1 Singleton EmptyList EmptyList'TheseIdTheseInIsTheseIsThatIsThis FromListExtFromList ToListExtToList'ToListIToListIToList'CmpICmp===~OrdIOrdAOrdA'==!OrdPNot||&&>>><<>|>>||>Skip GuardSimpleExitWhenGuardGuardsN GuardsDetailBoolsN BoolsQuickBoolsGuards GuardsQuickOnePRemQuotQuotRemDivModModDivOddEvenCatch'CatchUnproxyHoleFailSFailtFailpFailSpanBreakFilter PartitionPairsIf ConcatMapMap IterateNUntil IterateNWhile IterateWhile IterateUntilIterateNUnfoldrFoldlFoldNScanNAScanNScanlThesesThatsThissPartitionThesePartitionEithers CatMaybesMapMaybe EnumFromToNullIsEmptyUnsnocUncons+::+OrsAndsLookup!!IxLIx'IxProxyTProxyT'CycleConcatFoldMapMConcatMkTheseMkThatMkThat'MkThisMkThis'MkRightMkRight'MkLeftMkLeft'MkJust MkNothing MkNothing'EmptyTMEmptyPMEmptyTMEmptyT'PureSTimesIsJust IsNothingMaybeInTheseXThese'That'This'Right'Left' LookupFail LookupDef LookupFail' LookupDef'InitFailInitDefLastFailLastDefTailFailTailDefHeadFailHeadDefFMapSndFMapFstElemKeepRemovePrime ToEnumBFail ToEnumBDef ToEnumBDef'ToEnumToEnum'FromEnumPredSuccPredB'PredBSuccB'SuccBUnassocAssocSwapReverseLReverse MkLeftAlt MkRightAltPure2MEmptyT2 MEmptyT2'Coerce2CoerceWrapWrap'UnwrapSignumAbsNegate-%%-%/<~<=~/=~==~>=~>~NeLtLeSameGeGt<<=/===>=>*-+Dup+++IsRightIsLeftEitherIn|||SecondFirst***DropTakeSplitAtSplitAtsPadRPadL EitherBool MaybeBoolMkProxyFloorFloor'CeilingCeiling'Truncate Truncate' FromRational FromRational' ToRational FromIntegral FromIntegral' FromInteger FromInteger' FromStringP FromStringP'L6L5L4L3ThdL2SndL1FstLengthLen SortOnDescSortOnSortByMaxMinSumReadQReadQ' ReadMaybe ReadMaybe'ReadPReadP'UnMkDayMkDayMkDay' ParseTimes ParseTimes' ParseTimeP ParseTimeP' FormatTimePShowPOnesTailsInitsToUpperToLowerIsLatin1 IsSeparator IsOctDigit IsHexDigit IsControl IsPunctuationIsSpaceIsNumberIsUpperIsLowerMakeRR3MakeRR2MakeRR1MakeRRReplaceOneStringReplaceOneString'ReplaceAllStringReplaceAllString' ReplaceOne ReplaceOne' ReplaceAll ReplaceAll'ResplitResplit' RescanRanges RescanRanges'RescanRescan'ReRe'Unzip3UnzipNegativePositive AllNegative AllPositiveAnyAll<..>BetweenBetween'Desc'DescAsc'Asc$fPTYPEBetween'x $fPTYPEAllx $fPTYPEAnyx $fPTYPERe'x$fPTYPERescan'x$fPTYPERescanRanges'x$fPTYPEResplit'x$fPTYPEReplaceImplx$fPTYPEMakeRRx$fPTYPEMakeRR1x$fPTYPEMakeRR2x$fPTYPEMakeRR3x$fPTYPEIsCharSeta$fGetCharSetCLatin1$fGetCharSetCSeparator$fGetCharSetCOctDigit$fGetCharSetCHexDigit$fGetCharSetCControl$fGetCharSetCPunctuation$fGetCharSetCNumber$fGetCharSetCUpper$fGetCharSetCLower$fPTYPEToLowera$fPTYPEToUppera$fPTYPEInits[]$fPTYPETails[] $fPTYPEOnesx $fPTYPEShowPx$fPTYPEFormatTimePx$fPTYPEParseTimeP'a$fPTYPEParseTimes'a$fPTYPEMkDay'x$fPTYPEUnMkDayx$fPTYPEReadP'x$fPTYPEReadMaybe'x $fPTYPESum[] $fPTYPEMin[] $fPTYPEMax[] $fPTYPELenas$fPTYPELengthx$fExtractL1C(,,,,,)$fExtractL1C(,,,,)$fExtractL1C(,,,)$fExtractL1C(,,)$fExtractL1C(,) $fPTYPEFstx$fExtractL2C(,,,,,)$fExtractL2C(,,,,)$fExtractL2C(,,,)$fExtractL2C(,,)$fExtractL2C(,) $fPTYPESndx$fExtractL3C(,,,,,)$fExtractL3C(,,,,)$fExtractL3C(,,,)$fExtractL3C(,,)$fExtractL3C(,) $fPTYPEThdx$fExtractL4C(,,,,,)$fExtractL4C(,,,,)$fExtractL4C(,,,)$fExtractL4C(,,)$fExtractL4C(,) $fPTYPEL4x$fExtractL5C(,,,,,)$fExtractL5C(,,,,)$fExtractL5C(,,,)$fExtractL5C(,,)$fExtractL5C(,) $fPTYPEL5x$fExtractL6C(,,,,,)$fExtractL6C(,,,,)$fExtractL6C(,,,)$fExtractL6C(,,)$fExtractL6C(,) $fPTYPEL6x$fPTYPEFromStringP'a$fPTYPEFromInteger'a$fPTYPEFromIntegral'a$fPTYPEToRationalx$fPTYPEFromRational'a$fPTYPETruncate'x$fPTYPECeiling'x$fPTYPEFloor'x$fPTYPEMkProxya$fPTYPEMaybeBoola$fPTYPEEitherBoola $fPTYPEPada$fPTYPESplitAtsx$fPTYPESplitAta $fPTYPE***(,)$fPTYPE|||Either$fPTYPE+++Either$fGetBinOpBAdd$fGetBinOpBSub$fGetBinOpBMult $fPTYPEBina $fPTYPE/a $fPTYPE%x$fPTYPENegatex $fPTYPEAbsx$fPTYPESignumx$fPTYPEUnwrapx $fPTYPEWrap'x$fPTYPECoercea$fPTYPECoerce2f$fPTYPEMEmptyT2'f $fPTYPEPure2f$fPTYPEReverseas$fPTYPEReverseLt $fPTYPESwapp $fPTYPEAssocp$fPTYPEUnassocp $fPTYPESuccBx $fPTYPEPredBx $fPTYPESuccx $fPTYPEPredx$fPTYPEFromEnumx$fPTYPEToEnum'x$fPTYPEToEnumBDef'a $fPTYPEPrimex$fPTYPEKeepImplx $fPTYPEElema$fPTYPEFMapFstf$fPTYPEFMapSndf$fPTYPEEitherXx$fPTYPETheseXx$fPTYPEMaybeInMaybe$fPTYPESTimesa $fPTYPEPurex$fPTYPEMEmptyT'a$fPTYPEEmptyTx$fPTYPEMkNothing'a$fPTYPEMkJustx$fPTYPEMkLeft'x$fPTYPEMkRight'x$fPTYPEMkThis'x$fPTYPEMkThat'x$fPTYPEMkThesea$fPTYPEProxyT'a $fPTYPEIx[] $fPTYPEIxLa$fPTYPELookupa $fPTYPEAndsx $fPTYPEOrsx $fPTYPE:+x $fPTYPE+:x$fPTYPEUnconss$fPTYPEUnsnocs$fPTYPEIsEmptyas $fPTYPENullas$fPTYPEEnumFromTox$fPTYPEPartitionEithers[]$fPTYPEPartitionThese[] $fPTYPEScanlx$fPTYPEUnfoldra $fPTYPEIfa$fPTYPEPairs[]$fPTYPEPartitiona $fPTYPEBreaka $fPTYPEFaila $fPTYPEHolea$fPTYPEUnproxyProxy $fPTYPECatchx $fPTYPEDiva $fPTYPEModa$fPTYPEDivModa$fPTYPEQuotRema$fPTYPEGuardsImpl[]$fPTYPEGuardsImpl[]0$fPTYPEGuards[]$fPTYPEBoolsImpl[]$fPTYPEBoolsImpl[]0$fPTYPEBools[]$fPTYPEGuardsImplX[]$fPTYPEGuardsImplX[]0$fPTYPEGuardsImplXX[] $fPTYPEGuarda$fPTYPEGuardSimplea $fPTYPESkipa $fPTYPE>>a $fPTYPEDoa $fPTYPE&&a $fPTYPE||a $fPTYPE~>a $fPTYPENotx $fPTYPEOrdPa $fPTYPEOrdIa $fPTYPECmpa $fPTYPECmpIa$fPTYPEToListt$fPTYPEToListExtl$fPTYPEFromList[]$fPTYPEFromListExtl $fPTYPEIsThx$fPTYPETheseInThese$fPTYPEEmptyList'x $fPTYPEChar1a$fPTYPEToList'x$fPTYPEIToList'x $fPTYPEMapx $fPTYPECyclex$fPTYPEConcatx$fPTYPEMConcatx$fPTYPEZipThesea$fPTYPEZipPada $fPTYPEZipLa $fPTYPEZipRa $fPTYPEZipa $fPTYPELuhnx$fPTYPEReadBase'x$fPTYPEShowBasex$fPTYPEIntercalatex$fPTYPEPrintFx$fPTYPEGuardsN[]$fPTYPEBoolsN[]$fPTYPEParaImpl[]$fPTYPEParaImpl[]0$fPTYPEParaImpl[]1 $fPTYPEPara[]$fPTYPEParaN[]$fPTYPECaseImplx$fPTYPECaseImplx0$fPTYPECaseImplx1$fPTYPECaseImplx2$fPTYPECaseImplx3 $fPTYPECasex$fPTYPESequencet $fPTYPEHidex$fPTYPESortByx$fPTYPEReadFilex$fPTYPEReadDirx$fPTYPEReadEnvx$fPTYPEReadEnvAlla$fPTYPETimeUtca$fPTYPETimeZta$fGetFHandleFStderr$fGetFHandleFStdout$fGetModeWFWrite$fGetModeWFWriteForce$fGetModeWFAppend$fGetFHandleFOther$fPTYPEWriteFileImpla $fPTYPEStdina$fPTYPEIsFixImplx $fPTYPE<>x $fPrintC(,) $fPrintC()$fPTYPEPrintLx$fPTYPEPrintTx $fPTYPE<$x $fPTYPE<*x $fPTYPE<|>x$fPTYPEExtractt$fPTYPEDuplicatet $fPTYPEJoint $fPTYPE&x $fPTYPE$x $fPTYPETrim'x$fPTYPEStripLRx$fPTYPERepeata $fPTYPEDoNa$fPTYPEJustDefx$fPTYPEJustFailx$fPTYPELeftDefx$fPTYPERightDefx$fPTYPELeftFailx$fPTYPERightFailx$fPTYPEThisDefx$fPTYPEThatDefx$fPTYPETheseDefx$fPTYPEThisFailx$fPTYPEThatFailx$fPTYPETheseFailx $fPTYPEHeadx $fPTYPETailx $fPTYPELastx $fPTYPEInitx $fPTYPEJustx $fShowCharSet $fShowBinOp $fEqBinOp $fShowWFMode $fEqWFMode $fShowFHandle ReadShowR' ReadShow' ReadShowRReadShowBaseIJ'BaseIJOkNotROkNotOkROkLuhnTLuhnRBetweenRBetweenNBaseN'BaseN DateTimeN DateTimeNR DateTimeFmtsDateNDateFmts Ip4StrictREOctetREHmsREIpHmsfmtHmsopHmsipHmsSsn DateTime1' DateTime1CC11Ccnccnccn'cc11 datetime1 datetime1'ssnhmsipbase16base16'base2base2'basenbasen'daten datetimenbetweenokoknotreadshow readshow' refinedTH refinedTH' refined3TH refined3TH'version getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName)pcre-heavy-1.0.0.2-1rN9F2WyVKx9VHFJqpcO24Text.Regex.PCRE.HeavysubgsubGetROptDispAnsiUnicode showLitImplPColor_pBool _pStringsFailPFalsePTruePPresentPfromTTHgetValueLRImpl valsFromTTs_boolTghc-prim GHC.TypesTypebase Data.ProxyProxyNatOrderingSymbolBoolconst(QuickCheck-2.13.2-8nV7osDGiuU4p27xQv2fwBTest.QuickCheck.Arbitrary arbitrary$aeson-1.4.5.0-36mBXjfsHvfDHOxMEoZc6oData.Aeson.Types.ToJSONToJSONbinary-0.8.6.0Data.Binary.ClassBinaryData.Aeson.Types.FromJSONFromJSONGHC.ReadRead eval3MSkipeval3MQuickIdentity"these-1.0.1-5oUWp8dUzepKo9d8w7Bh09These Data.EitherEitherMaybeTrim' Data.Function$comonad-5.0.5-5F1giUaUd8bHELpBYPA3h3Control.Comonad duplicateextractPrintC IsFixImpl Data.OldList isInfixOf isPrefixOf isSuffixOf System.IOreadFileData.Traversable sequenceACaseImplParaImplNumeric showIntAtBaseZipPadExtractAFromListThisThatIsThGHC.ExtsfromListtoList Data.Foldable"lens-4.17.1-I91pwvtGK51FAHQjK6rMJAControl.Lens.IndexeditoList GHC.Classescomparenot GuardsImplX GuardsImplGHC.RealquotRemdivModmoddivevenGHC.Listbreak partitionmapunfoldrscanlpartitionThesepartitionEithersGHC.Enum enumFromTonullFoldableControl.Lens.EmptyAsEmptyControl.Lens.ConsunsnocunconslookupControl.Lens.AtIxedcycleconcatfoldMapmconcatRightLeftemptymemptypurestimes Data.MaybemaybeEitherXcontainers-0.6.0.1Data.Sequence.InternalSeqelemKeepImpltoEnumfromEnumpredsuccassoc-1-C3gSRfWgVFgn0jyLSEt3SData.Bifunctor.AssocunassocassocData.Bifunctor.SwapswapControl.Lens.Internal.Iso reversingreverseGHC.PrimcoerceControl.Lens.Wrapped _Wrapped' _Unwrapped'GHC.NumsignumabsnegateRationalBinsplitAtPadfloorceilingtruncate fromRational toRational fromIntegral fromInteger Data.String fromString Data.Tuplesndfstlengthmaximumminimumsum time-1.8.0.2Data.Time.Calendar.DaysDayData.Time.Format.Parse parseTimeM ParseTimeData.Time.Format formatTimeGHC.Showshowtailsinits IsCharSetunzip3unzipanyallCcip