!       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                                                                    Safe\ !"#None1:]1None%&',-.1=>?@ACHSUVX_`kpredicate-typed"mconcat options at the type levelNx = getOptT @(OptTT '[ 'OMsg "test", 'ORecursion 123, OU, OL, 'OMsg "field2"])oMsg x["test","field2"] oRecursion x123)predicate-typedDisplay options*predicate-typedset display width+predicate-typed>set text to add context to a failure message for refined types,predicate-typed set recursion limit eg for regex-predicate-typedset effects for messages.predicate-typedmempty/predicate-typedmappend0predicate-typedset color palette1predicate-typedturn on colors2predicate-typedturn off colors3predicate-typed ansi display4predicate-typedunicode display5predicate-typeddebug mode return nothing6predicate-typeddebug mode return one line7predicate-typeddebug mode normal8predicate-typeddebug mode verbose9predicate-typedcomposite: no messages:predicate-typedcomposite: lite version;predicate-typedcomposite: ansi + no colors<predicate-typed%composite: ansi + no colors + verbose=predicate-typedcomposite: ansi + colors>predicate-typed"composite: ansi + colors + verbose?predicate-typed%composite: ansi + colors + background@predicate-typedcomposite: unicode + colorsApredicate-typed(composite: unicode + colors + backgroundBpredicate-typed%composite: unicode + colors + verboseCpredicate-typed.a typeclass for choosing which monad to run inHpredicate-typed&Extract 'a' from a list like containerOpredicate-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",()))Rpredicate-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,()))Ypredicate-typedextract [ from the typelevel[predicate-typed"all the ways to compare two values$predicate-typedget   from the typelevelbpredicate-typedget % from the typeleveldpredicate-typedget ordering from the typelevelfpredicate-typedget & from typelevelhpredicate-typed'get the length of a typelevel containergetLen @'["abc","def","g"]3 getLen @'[]0getLen @(9 ':| '[1,2,3])4getLen @('These 9 "Asfs")1getLen @('This 1)0jpredicate-typed(get a list of Symbols from the typelevelgetSymbs @'["abc","def","g"]["abc","def","g"]lpredicate-typed%get a list of Nats from the typelevelgetNats @'[10,12,1] [10,12,1]npredicate-typedtypelevel boolean Notopredicate-typedtypelevel boolean Orppredicate-typedtypelevel boolean Andqpredicate-typed,helper method that fails with msg when Falserpredicate-typed-helper method that fails with a msg when Truespredicate-typedtype level Betweentpredicate-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 typredicate-typed*extract replacement options from typelevel{predicate-typed'simple regex string replacement options)predicate-typed2convert type level regex option to the value levelpredicate-typed2extract the regex options from the type level listpredicate-typed'Regex options for Rescan Resplit Re etcpredicate-typedForce pattern anchoringpredicate-typedCompile automatic callouts | Bsr_anycrlf -- R matches only CR, LF, or CrlF | Bsr_unicode -- ^ R matches all Unicode line endingspredicate-typedDo caseless matchingpredicate-typed"dollar not to match newline at endpredicate-typedmatches anything including NLpredicate-typed%Allow duplicate names for subpatternspredicate-typed Ignore whitespace and # commentspredicate-typed,PCRE extra features (not much use currently)predicate-typed#Force matching to be before newlinepredicate-typedcaret and dollar match newlines within data | Newline_any -- ^ Recognize any Unicode newline sequence | Newline_anycrlf -- ^ Recognize CR, LF, and CrlF as newline sequencespredicate-typedSet CR as the newline sequencepredicate-typed Set CrlF as the newline sequencepredicate-typedSet LF as the newline sequencepredicate-typed=Disable numbered capturing parentheses (named ones available)predicate-typed Invert greediness of quantifierspredicate-typedRun in UTF--8 modepredicate-typed+Do not check the pattern for UTF-8 validitypredicate-typedcolor palettespredicate-typed.how much detail to show in the expression treepredicate-typed(one line summary used mainly for testingpredicate-typedMone line summary with additional context from the head of the evaluation treepredicate-typed4outputs the evaluation tree but skips noisy subtreespredicate-typed"outputs the entire evaluation treepredicate-typeddisplay format for the treepredicate-typeddraw normal treepredicate-typed use unicodepredicate-typed monoid optspredicate-typed7customizable options for running a typelevel expressionpredicate-typedlength of data to display for *predicate-typed debug levelpredicate-typed1display the tree using the normal tree or unicodepredicate-typedcolor palette usedpredicate-typedmessages associated with typepredicate-typed max recursionpredicate-typedother message effectspredicate-typed no colors+predicate-typed elide the ,% wrapper so it acts like a normal adt-predicate-typed4the color palette for displaying the expression tree.predicate-typed#wrapper for a show instance around  predicate-typed a monomorphic container of treespredicate-typed8represents the untyped evaluation tree for final display/predicate-typed)holds the result of running the predicate0predicate-typed*optional strings to include in the results1predicate-typed?contains the untyped result from evaluating the expression tree2predicate-typedfails the entire evaluation3predicate-typedFalse predicate4predicate-typedTrue predicate5predicate-typed Any valuepredicate-typed6extracts the 'BoolT a' constructors from the typelevelpredicate-typed=contains the typed result from evaluating the expression treepredicate-typed-represents the evaluation tree for predicatespredicate-typedthe value at this root nodepredicate-typed1detailed information eg input and output and textpredicate-typedthe child nodespredicate-typedlens for accessing  in predicate-typed$lens for accessing the message from predicate-typed$lens for accessing the subtree from 6predicate-typeda lens from typed  to the untyped 17predicate-typedlens for accessing /predicate-typedlens for accessing predicate-typed&creates a Node for the evaluation treepredicate-typed+creates a Boolean node for a predicate type8predicate-typed get the value from BoolT or failpredicate-typed2converts a typed tree to an untyped on for display9predicate-typed)converts a typed tree into an untyped onepredicate-typed'convenience method to wrap a typed treepredicate-typedsee getValueLRImpl2 : add more detail to the tree if there are errors:predicate-typedcombine options ala monoid;predicate-typed(set maximum display width of expressions<predicate-typed&set title message for the display tree=predicate-typed+set maximum recursion eg when running regex>predicate-typedset color of title message?predicate-typedturn on/off colors@predicate-typeddisplay type eg  or Apredicate-typed,create color palette for the expression treeBpredicate-typedset debug modeCpredicate-typeddefault optionsDpredicate-typedLdefault title message color and boundaries between multipart refine messagespredicate-typedverbose debug flagpredicate-typed$fix PresentT Bool to TrueT or FalseTpredicate-typed9more restrictive: only display data in verbose debug modepredicate-typed+compile a regex using the type level symbolpredicate-typedOextract values from the trees or if there are errors return a tree with contextEpredicate-typedprism from BoolT to Boolpredicate-typed prismpredicate-typed prismpredicate-typed prismpredicate-typed prismpredicate-typedboolean implication True ~> FalseFalse True ~> TrueTrueFalse ~> FalseTrue False ~> TrueTruepredicate-typedget a Nat from the typelevelnat @1414predicate-typed"gets the Symbol from the typelevel symb @"abc""abc"predicate-typeddisplay constructor name for &Fpredicate-typedpretty print a treeGpredicate-typed render the 1 value with colorspredicate-typed render the  value with colorsHpredicate-typedEcolors the result of the predicate based on the current color palettepredicate-typedshow the type as a stringpredicate-typedshow the kind as a stringpredicate-typed?strip ansi characters from a string and print it (for doctests)predicate-typedconvert typelevel options to u(oDisp &&& fst . oColor &&& oWidth) (getOptT @(OA ':# OU ':# OA ':# 'OWidth 321 ':# Color4 ':# 'OMsg "test message"))(Ansi,("color4",321))-oMsg (getOptT @('OMsg "abc" ':# 'OMsg "def")) ["abc","def"]LoOther (getOptT @('OOther 'False 'Red 'White ':# 'OOther 'True 'Red 'Black))(True,Red,Black)$a = show (getOptT @('OEmpty ':# OU))%b = show (getOptT @(OU ':# 'OEmpty));c = show (getOptT @OU) a==b && b==cTruepredicate-typedprime predicate isPrime 7True isPrime 6Falsepredicate-typedsemigroup instance for -predicate-typed set underlinepredicate-typedset foreground colorpredicate-typedset background color0 predicate-typedname of color palettepredicate-typedFail foreground colorpredicate-typedFail background colorpredicate-typedFalse foreground colorpredicate-typedFalse background colorpredicate-typedTrue foreground colorpredicate-typedTrue background colorpredicate-typedPresent foreground colorpredicate-typedPresent background color  !"#$%&'()9:;<=?@AB>0-*+,./12345678CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ &%$#"! )9:;<=?@AB>0-*+,./12345678'(tuvwxyz{|}~srqponXVURSTOPQLKJIHNMWlmjkhifgdebc[\]^_`aYZCDEFG/6M9 N9 W71None-.=>?@AHUVXk^,predicate-typed.run the expression 'p' but remove the subtreespredicate-typed9add a message to give more context to the evaluation tree"pan @(Msg "[somemessage] " Id) 999P [somemessage] Id 999 PresentT 999!pan @(Msg Id 999) "info message:"P info message:'999 PresentT 999predicate-typed0transparent predicate wrapper to make k of kind I6 so it can be in a promoted list (cant mix kinds) see pz @'[W 123, Id] 99PresentT [123,99]%pz @'[W "abc", W "def", Id, Id] "ghi""PresentT ["abc","def","ghi","ghi"]predicate-typedGidentity function that also displays the type information for debugging pz @IdT 23 PresentT 23predicate-typed1identity function that displays the input unlike even more constraints than 1 so we might need to add explicit type signatures pz @Id 23 PresentT 23predicate-typedidentity functionpz @I 23 PresentT 23predicate-typedUThis is the core class. Each instance of this class can be combined into a dsl using predicate-typedA specialised form of  that works only on predicatespredicate-typed:skips the evaluation tree and just displays the end resultpredicate-typedsame as # but adds context to the end resultpredicate-typed9displays the evaluation tree in plain text without colorspredicate-typedEdisplays the evaluation tree in plain text without colors and verbosepredicate-typedCdisplays the evaluation tree using colors without background colorspredicate-typed4displays the evaluation tree using background colorspredicate-typed and verbosepredicate-typed6display the evaluation tree using unicode and colors  pu '(Id, "abc", 123) [1..4] @predicate-typedLdisplays the evaluation tree using unicode and colors with background colorspredicate-typed and verbosepredicate-typedaevaluate a typelevel expression (use type applications to pass in the options and the expression)run @OZ @Id 123 PresentT 1234run @('OMsg "field1" ':# OL) @('Left Id) (Right 123)"field1 >>> Error 'Left found RightFailT "'Left found Right"Orun @(OptTT '[ 'OMsg "test", OU, 'OEmpty, OL, 'OMsg "field2"]) @('FailT '[]) ()(test | field2 >>> Error 'FailT _ (BoolT)FailT "'FailT _"predicate-typed.run expression with multiple options in a list2runs @'[ OL, 'OMsg "field2"] @'( 'True, 'False) ()&field2 >>> Present (True,False) ('(,))PresentT (True,False)Hruns @'[ 'OMsg "test", OU, 'OEmpty, OL, 'OMsg "field2"] @('FailT '[]) ()(test | field2 >>> Error 'FailT _ (BoolT)FailT "'FailT _"predicate-typed typelevel  pz @'TrueT ()TrueTpz @'FalseT ()FalseTpz @('PresentT 123) ()PresentT Falsepz @('FailT '[]) ()FailT "'FailT _"predicate-typed(converts the value to the corresponding Jpz @'Proxy 'x'PresentT Proxypredicate-typedBextracts the (a,b) from type level 'These a b' if the value exists$pz @('These Id Id) (These 123 "abc")PresentT (123,"abc")%pz @('These Id 5) (These 123 "abcde")PresentT (123,5)pz @('These Id Id) (This "aaa")FailT "'These found This"pz @('These Id Id) (That "aaa")FailT "'These found That"predicate-typed@extracts the 'b' from type level 'These a b' if the value existspz @('That Id) (That 123) PresentT 123pz @('That Id) (This "aaa")FailT "'That found This"pz @('That Id) (These 44 "aaa")FailT "'That found These"predicate-typed@extracts the 'a' from type level 'These a b' if the value existspz @('This Id) (This 123) PresentT 123pz @('This Id) (That "aaa")FailT "'This found That" pz @('This Id) (These 999 "aaa")FailT "'This found These"predicate-typedAextracts the 'b' from type level 'Either a b' if the value existspz @('Right Id) (Right 123) PresentT 123pz @('Right Id) (Left "aaa")FailT "'Right found Left"predicate-typedAextracts the 'a' from type level 'Either a b' if the value existspz @('Left Id) (Left 123) PresentT 123pz @('Left Id) (Right "aaa")FailT "'Left found Right"predicate-typedwexpects Nothing otherwise it fails if the value is Nothing then it returns 'Proxy a' as this provides type informationpz @'Nothing NothingPresentT Proxypz @'Nothing (Just True)FailT "'Nothing found Just"predicate-typed>extracts the 'a' from type level 'Maybe a' if the value existspz @('Just Id) (Just 123) PresentT 123pz @('Just Id) (Just True) PresentT Truepz @('Just Id) NothingFailT "'Just found Nothing"predicate-typed2runs each predicate in turn from the promoted listpz @'[1, 2, 3] 999PresentT [1,2,3]pz @'[W 1, W 2, W 3, Id] 999PresentT [1,2,3,999]predicate-typed=extracts the value level representation of the type level '[] pz @'[] False PresentT []predicate-typed=extracts the value level representation of the type level '() pz @'() () PresentT ()predicate-typed:extracts the value level representation of the type level K pz @123 () PresentT 123predicate-typed8extracts the value level representation of the promoted Lpz @'LT "not used" PresentT LT pz @'EQ () PresentT EQpredicate-typed(run the predicates in a promoted 8-tuple.pz @'(4, Id, "inj", 999, 'LT, 1, 2, 3) "hello"'PresentT (4,"hello","inj",999,LT,1,2,3)predicate-typed(run the predicates in a promoted 7-tuple+pz @'(4, Id, "inj", 999, 'LT, 1, 2) "hello"%PresentT (4,"hello","inj",999,LT,1,2)predicate-typed(run the predicates in a promoted 6-tuple(pz @'(4, Id, "inj", 999, 'LT, 1) "hello"#PresentT (4,"hello","inj",999,LT,1)predicate-typed(run the predicates in a promoted 5-tuple%pz @'(4, Id, "inj", 999, 'LT) "hello"!PresentT (4,"hello","inj",999,LT)predicate-typed(run the predicates in a promoted 4-tuple pz @'(4, Id, "inj", 999) "hello"PresentT (4,"hello","inj",999)predicate-typed(run the predicates in a promoted 3-tuplepz @'(4, Id, "goodbye") "hello"PresentT (4,"hello","goodbye") pan @'( 'True, 'False, 123) TrueP '(,,)| +- True 'True|+- False 'False| `- P '123PresentT (True,False,123)predicate-typed5run the predicates in a promoted 2-tuple; similar to pz @'(Id, 4) "hello"PresentT ("hello",4)predicate-typedpulls the type level M to the value level as a pz @"hello world" ()PresentT "hello world"predicate-typedpulls the type level % to the value levelpz @'True "not used"TrueT pz @'False ()FalseTpredicate-typedN () function pz @() "Asf" PresentT ()predicate-typedproxy for the expressionpredicate-typeddisplay optionspredicate-typedvaluepredicate-typedreturns a tree of resultsNone,-.7:=>?@AHIMPSUVXkpredicate-typed'effect wrapper for the refinement valuepredicate-typedthe constraints that  must adhere topredicate-typedNa simple refinement type that ensures the predicate 'p' holds for the type 'a''prtRefinedIO @OZ @(Between 10 14 Id) 13Right (Refined 13)'prtRefinedIO @OZ @(Between 10 14 Id) 99 Left FalseTDprtRefinedIO @OZ @(Last Id >> Len == 4) ["one","two","three","four"],Right (Refined ["one","two","three","four"])VprtRefinedIO @OZ @(Re "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$" Id) "141.213.1.99"Right (Refined "141.213.1.99")SprtRefinedIO @OZ @(Re "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$" Id) "141.213.1" Left FalseTprtRefinedIO @OZ @(Map (ReadP Int Id) (Resplit "\\." Id) >> Guard (PrintF "bad length: found %d" Len) (Len == 4) >> 'True) "141.213.1""Left (FailT "bad length: found 3")prtRefinedIO @OZ @(Map (ReadP Int Id) (Resplit "\\." Id) >> Guard (PrintF "bad length: found %d" Len) (Len == 4) >> GuardsN (PrintT "octet %d out of range %d" Id) 4 (Between 0 255 Id) >> 'True) "141.213.1.444"'Left (FailT "octet 3 out of range 444")prtRefinedIO @OZ @(Map (ReadP Int Id) (Resplit "\\." Id) >> Guard (PrintF "bad length: found %d" Len) (Len == 4) >> GuardsN (PrintT "octet %d out of range %d" Id) 4 (Between 0 255 Id) >> 'True) "141.213.1x34.444"Left (FailT "ReadP Int (1x34)")EprtRefinedIO @OZ @(Map ('[Id] >> ReadP Int Id) Id >> Luhn Id) "12344"Right (Refined "12344")EprtRefinedIO @OZ @(Map ('[Id] >> ReadP Int Id) Id >> Luhn Id) "12340" Left FalseT3prtRefinedIO @OZ @(Any (Prime Id) Id) [11,13,17,18]Right (Refined [11,13,17,18])3prtRefinedIO @OZ @(All (Prime Id) Id) [11,13,17,18] Left FalseTRprtRefinedIO @OZ @(Snd Id !! Fst Id >> Len > 5) (2,["abc","defghij","xyzxyazsfd"])2Right (Refined (2,["abc","defghij","xyzxyazsfd"]))SprtRefinedIO @OZ @(Snd Id !! Fst Id >> Len > 5) (27,["abc","defghij","xyzxyazsfd"])#Left (FailT "(!!) index not found")SprtRefinedIO @OZ @(Snd Id !! Fst Id >> Len <= 5) (2,["abc","defghij","xyzxyazsfd"]) Left FalseTpredicate-typedextract the value from Refinedpredicate-typedcreate 3 generator using a generator to restrict the valuespredicate-typed binary operation applied to two  values,x = newRefinedT @_ @OAN @(Between 4 12 Id) 4,y = newRefinedT @_ @OAN @(Between 4 12 Id) 5prtRefinedTIO (rapply (+) x y) === a ===True 4 <= 4 <= 12| +- P Id 4|+- P '4|`- P '12 === b ===True 4 <= 5 <= 12| +- P Id 5|+- P '4|`- P '12=== a `op` b ===True 4 <= 9 <= 12| +- P Id 9|+- P '4|`- P '12 Refined 9/x = newRefinedT @_ @OAN @(Prime Id || Id < 3) 3/y = newRefinedT @_ @OAN @(Prime Id || Id < 3) 5prtRefinedTIO (rapply (+) x y)( === a ===True True || False| +- True Prime| | | `- P Id 3|`- False 3 < 3 | +- P Id 3 | `- P '3 === b ===True True || False| +- True Prime| | | `- P Id 5|`- False 5 < 3 | +- P Id 5 | `- P '3=== a `op` b ===)False False || False | (Prime) || (8 < 3)|+- False Prime| | | `- P Id 8|`- False 8 < 3 | +- P Id 8 | `- P '3failure msg[FalseT]predicate-typedsame as  except we already have valid  values as inputpredicate-typedattempts to lift a refinement type to another refinement type by way of transformation function you can control both the predicate and the typepredicate-typedinvokes the callback with the , value if 'a' is valid for the predicate 'p'predicate-typedIO version of predicate-typedsame as  but prints the resultspredicate-typed returns a , value if 'a' is valid for the predicate 'p')newRefined @OL @(ReadP Int Id > 99) "123"Right (Refined "123")(newRefined @OL @(ReadP Int Id > 99) "12"Left "FalseT (12 > 99)"predicate-typedreturns a wrapper  around a possible , value if 'a' is valid for the predicate 'p'predicate-typedIO version of predicate-typed unwrap the  valuepredicate-typedcreate an unsafe $ value without running the predicatepredicate-typedcreate an unsafe ! value and also run the predicatepredicate-typedO instance for predicate-typedP instance for Dxs <- generate (vectorOf 10 (arbitrary @(Refined OU (Id /= 0) Int)))all ((/=0) . unRefined) xsTrueExs <- generate (vectorOf 10 (arbitrary @(Refined OU (Prime Id) Int)))all (isPrime . unRefined) xsTruepredicate-typedQ instance for predicate-typedR instance for import Data.Timeimport Control.Lensimport Control.Arrow ((+++))3type K1 = Refined OZ (ReadP Day Id >> 'True) Stringgtype K2 = Refined OAN (Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") (ReadP Day Id)) String)r = unsafeRefined' @OZ "2019-04-23" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)Refined "2019-04-23"DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)5Refined(Binary:get):FalseT (2019-05-30 <= 2019-04-23)False 2019-05-30 <= 2019-04-23|+- P ReadP Day 2019-04-23| || `- P Id "2019-04-23"|+- P ReadP Day 2019-05-30| || `- P '"2019-05-30"|`- P ReadP Day 2019-06-01 | `- P '"2019-06-01"predicate-typedS instance for :set -XOverloadedStrings import qualified Data.Aeson as A9A.eitherDecode' @(Refined OZ (Between 10 14 Id) Int) "13"Right (Refined 13)GremoveAnsi $ A.eitherDecode' @(Refined OAN (Between 10 14 Id) Int) "16" 9Error in $: Refined(FromJSON:parseJSON):FalseT (16 <= 14)False 16 <= 14| +- P Id 16|+- P '10|`- P '14predicate-typedT instance for 8reads @(Refined OZ (Between 0 255 Id) Int) "Refined 254"[(Refined 254,"")]8reads @(Refined OZ (Between 0 255 Id) Int) "Refined 300"[]1reads @(Refined OZ 'True Int) "Refined (-123)xyz"[(Refined (-123),"xyz")]predicate-typedU instance for RefinedNpureTryTest $ fromString @(Refined OL (ReadP Int Id >> Id > 244) String) "523"Right (Refined "523")MpureTryTest $ fromString @(Refined OL (ReadP Int Id >> Id > 244) String) "52"Left ()None&',-.1:=>?@AHISUVXks$predicate-typedchange the opts typepredicate-typedreplace the opts typepredicate-typed emulates  using ? by setting the input conversion and output formatting as noopspredicate-typedZAn ADT that summarises the results of evaluating Refined3 representing all possible statespredicate-typedCtype family for converting from a 5-tuple '(opts,ip,op,fmt,i) to a  typepredicate-typed$Provides the constraints on Refined3predicate-typedLike H but additionally reconstructs the output value to a standardized formatopts are the display optionsip converts i to PP ip i* which is the internal type and stored in op$ validates that internal type using PP op (PP ip i) ~ Boolfmt outputs the internal type PP fmt (PP ip i) ~ i and stored in i is the input typePP fmt (PP ip i)& should be valid as input for Refined3Setting ip to Id and fmt to Id is equivalent to : see Setting the input type i to c resembles the corresponding Read/Show instances but with an additional predicate on the read valueread a string using ip$ into an internal type and store in validate  using the predicate opshow  using fmt$ and store that formatted result in ]Although a common scenario is String as input, you are free to choose any input type you likeHnewRefined3 @OZ @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})HnewRefined3 @OZ @(ReadBase Int 16 Id) @(Lt 253) @(PrintF "%x" Id) "00fe"/Left "Step 2. False Boolean Check(op) | FalseP"HnewRefined3 @OZ @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) "00fg">Left "Step 1. Initial Conversion(ip) Failed | invalid base 16"newRefined3 @OL @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Msg "length invalid:" (Len == 4)) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1.5"@Left "Step 2. False Boolean Check(op) | {length invalid:5 == 4}"newRefined3 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1.5"8Left "Step 2. Failed Boolean Check(op) | found length=5"newRefined3 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1"BRight (Refined3 {r3In = [198,162,3,1], r3Out = "198.162.003.001"}) :m + Data.Time.Calendar.WeekDatenewRefined3 @OZ @(MkDayExtra Id >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) (2019,10,13)ARight (Refined3 {r3In = (2019-10-13,41,7), r3Out = (2019,10,13)})wnewRefined3 @OL @(MkDayExtra Id >> 'Just Id) @(Msg "expected a Sunday:" (Thd Id == 7)) @(UnMkDay (Fst Id)) (2019,10,12)CLeft "Step 2. False Boolean Check(op) | {expected a Sunday:6 == 7}"newRefined3 @OZ @(MkDayExtra' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) (2019,10,12);Left "Step 2. Failed Boolean Check(op) | expected a Sunday"ttype T4 k = '( OZ, MkDayExtra Id >> 'Just Id, Guard "expected a Sunday" (Thd Id == 7) >> 'True, UnMkDay (Fst Id), k))newRefined3P (Proxy @(T4 _)) (2019,10,12);Left "Step 2. Failed Boolean Check(op) | expected a Sunday")newRefined3P (Proxy @(T4 _)) (2019,10,13)ARight (Refined3 {r3In = (2019-10-13,41,7), r3Out = (2019,10,13)})predicate-typeddirectly load values into 4. It still checks to see that those values are validpredicate-typeddirectly load values into  without any checkingpredicate-typed create a E generator using a generator to restrict the values (so it completes)^g = genRefined3 @OU @(ReadP Int Id) @(Between 10 100 Id && Even) @(ShowP Id) (choose (10,100))xs <- generate (vectorOf 10 g)=all (\x -> let y = r3In x in y >= 0 && y <= 100 && even y) xsTrue predicate-typed create a  generator using a proxy predicate-typedcreates a 5-tuple proxy (see    )Quse type application to set the 5-tuple or set the individual parameters directlyset the 5-tuple directly=eg1 = mkProxy3 @'( OL, ReadP Int Id, Gt 10, ShowP Id, String)newRefined3P eg1 "24"*Right (Refined3 {r3In = 24, r3Out = "24"})Kskip the 5-tuple and set each parameter individually using type application:eg2 = mkProxy3 @_ @OL @(ReadP Int Id) @(Gt 10) @(ShowP Id)newRefined3P eg2 "24"*Right (Refined3 {r3In = 24, r3Out = "24"}) predicate-typedsame as  : but checks to make sure the proxy is consistent with the  constraint predicate-typed create a  value using a continuationThis first example reads a hex string and makes sure it is between 100 and 200 and then reads a binary string and adds the values together:set -XPolyKinds:set -XRankNTypespb16 :: forall opts . Proxy '( opts, ReadBase Int 16 Id, Between 100 200 Id, ShowBase 16 Id, String); b16 = Proxy_b2 :: forall opts . Proxy '( opts, ReadBase Int 2 Id, 'True, ShowBase 2 Id, String); b2 = ProxyyprtRefinedTIO $ withRefined3TP (b16 @OZ) "a3" $ \x -> withRefined3TP (b2 @OZ) "1001110111" $ \y -> pure (r3In x + r3In y)7947this example fails as the the hex value is out of rangeqprtRefinedTIO $ withRefined3TP (b16 @OAN) "a388" $ \x -> withRefined3TP (b2 @OAN) "1001110111" $ \y -> pure (x,y)6*** Step 1. Success Initial Conversion(ip) (41864) ***P ReadBase(Int,16) 41864|`- P Id "a388"'*** Step 2. False Boolean Check(op) ***False 41864 <= 200| +- P Id 41864| +- P '100| `- P '200=failure msg[Step 2. False Boolean Check(op) | {41864 <= 200}]predicate-typed$pure version for extracting Refined3enewRefined3 @OL @(ParseTimeP TimeOfDay "%-H:%-M:%-S" Id) @'True @(FormatTimeP "%H:%M:%S" Id) "1:15:7"6Right (Refined3 {r3In = 01:15:07, r3Out = "01:15:07"})dnewRefined3 @OL @(ParseTimeP TimeOfDay "%-H:%-M:%-S" Id) @'True @(FormatTimeP "%H:%M:%S" Id) "1:2:x"aLeft "Step 1. Initial Conversion(ip) Failed | ParseTimeP TimeOfDay (%-H:%-M:%-S) failed to parse"newRefined3 @OL @(Rescan "^(\\d{1,2}):(\\d{1,2}):(\\d{1,2})$" Id >> Snd (Head Id) >> Map (ReadP Int Id) Id) @(All (0 <..> 59) Id && Len == 3) @(PrintL 3 "%02d:%02d:%02d" Id) "1:2:3"5Right (Refined3 {r3In = [1,2,3], r3Out = "01:02:03"})predicate-typedcreate a wrapped  typeprtRefinedTIO $ newRefined3T @_ @OZ @(MkDayExtra Id >> Just Id) @(GuardSimple (Thd Id == 5) >> 'True) @(UnMkDay (Fst Id)) (2019,11,1)8Refined3 {r3In = (2019-11-01,44,5), r3Out = (2019,11,1)}nprtRefinedTIO $ newRefined3T @_ @OL @(MkDayExtra Id >> Just Id) @(Thd Id == 5) @(UnMkDay (Fst Id)) (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]prtRefinedTIO $ newRefined3T @_ @OL @(MkDayExtra Id >> Just Id) @(Msg "wrong day:" (Thd Id == 5)) @(UnMkDay (Fst Id)) (2019,11,2)Afailure msg[Step 2. False Boolean Check(op) | {wrong day:6 == 5}]predicate-typedcreate a wrapped  typeprtRefinedTIO $ newRefined3TP (Proxy @'( OZ, MkDayExtra Id >> Just Id, GuardSimple (Thd Id == 5) >> 'True, UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,1)8Refined3 {r3In = (2019-11-01,44,5), r3Out = (2019,11,1)}prtRefinedTIO $ newRefined3TP (Proxy @'( OL, MkDayExtra Id >> Just Id, Thd Id == 5, UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]prtRefinedTIO $ newRefined3TP (Proxy @'( OL, MkDayExtra Id >> Just Id, Msg "wrong day:" (Thd Id == 5), UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,2)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 5-tuple proxy insteadpredicate-typedsame as  but passes in the proxypredicate-typedsame as  but runs in IOpredicate-typedsame as ] but skips the proxy and allows you to set each parameter individually using type applicationpredicate-typedLcreate a Refined3 using a 5-tuple proxy and aggregate the results on failurepredicate-typedsame as @ but can pass the parameters individually using type applicationpredicate-typed3create a Refined3 value using a 5-tuple proxy (see  )use  / to package all the types together as a 5-tupleVpredicate-typed7creates Refined3 value but skips the initial conversion predicate-typed similar to  but it emulates  using Vtakes a 5-tuple proxy as input but outputs the Refined value and the result separately1initial conversion using 'ip' and stores that in Truns 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  and the output from 3.Bif any of the above steps fail the process stops it and dumps out !predicate-typedsame as  I but allows you to set the parameters individually using type application"predicate-typedO instance for  import qualified Data.Aeson as AbA.encode (unsafeRefined3 @OZ @(ReadBase Int 16 Id) @(Between 0 255 Id) @(ShowBase 16 Id) 254 "fe")"\"fe\""4A.encode (unsafeRefined3 @OZ @Id @'True @Id 123 123)"123"#predicate-typedQ instance for $predicate-typedR instance for import Control.Arrow ((+++))import Control.Lensimport Data.Time?type K1 = MakeR3 '( OAN, ReadP Day Id, 'True, ShowP Id, String)vtype K2 = MakeR3 '( OAN, ReadP Day Id, Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") Id, ShowP Id, String)&r = unsafeRefined3' "2019-04-23" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)2Refined3 {r3In = 2019-04-23, r3Out = "2019-04-23"}DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)ERefined3:Step 2. False Boolean Check(op) | {2019-05-30 <= 2019-04-23};*** Step 1. Success Initial Conversion(ip) (2019-04-23) ***P ReadP Day 2019-04-23|`- P Id "2019-04-23"'*** Step 2. False Boolean Check(op) ***False 2019-05-30 <= 2019-04-23|+- P Id 2019-04-23|+- P ReadP Day 2019-05-30| || `- P '"2019-05-30"|`- P ReadP Day 2019-06-01 | `- P '"2019-06-01"%predicate-typedP instance for mxs <- generate (vectorOf 10 (arbitrary @(Refined3 OU (ReadP Int Id) (1 <..> 120 && Even) (ShowP Id) String)))<all (\x -> let y = r3In x in y /= 0 && r3Out x == show y) xsTrue&predicate-typedS instance for  import qualified Data.Aeson as AlA.eitherDecode' @(Refined3 OZ (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe\""+Right (Refined3 {r3In = 254, r3Out = "fe"})~removeAnsi $ A.eitherDecode' @(Refined3 OAN (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe443a\""YError in $: Refined3:Step 2. False Boolean Check(op) | {True && False | (16663610 < 256)}9*** Step 1. Success Initial Conversion(ip) (16663610) ***P ReadBase(Int,16) 16663610|`- P Id "00fe443a"'*** Step 2. False Boolean Check(op) ***&False True && False | (16663610 < 256)|+- True 16663610 > 10| || +- P Id 16663610| | | `- P '10|`- False 16663610 < 256 | +- P Id 16663610 | `- P '256'predicate-typedT instance for |reads @(Refined3 OZ (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined3 {r3In = 254, r3Out = \"fe\"}"*[(Refined3 {r3In = 254, r3Out = "fe"},"")]}reads @(Refined3 OZ (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined3 {r3In = 300, r3Out = \"12c\"}"[]vreads @(Refined3 OZ (ReadBase Int 16 Id) (Id < 0) (ShowBase 16 Id) String) "Refined3 {r3In = -1234, r3Out = \"-4d2\"}".[(Refined3 {r3In = -1234, r3Out = "-4d2"},"")]reads @(Refined3 OZ (Map (ReadP Int Id) (Resplit "\\." Id)) (Guard "len/=4" (Len == 4) >> 'True) (PrintL 4 "%d.%d.%d.%d" Id) String) "Refined3 {r3In = [192,168,0,1], r3Out = \"192.168.0.1\"}"=[(Refined3 {r3In = [192,168,0,1], r3Out = "192.168.0.1"},"")](predicate-typedU instance for Refined3XpureTryTest $ fromString @(Refined3 OL (ReadP Int Id) (Id > 12) (ShowP Id) String) "523",Right (Refined3 {r3In = 523, r3Out = "523"})VpureTryTest $ fromString @(Refined3 OL (ReadP Int Id) (Id > 12) (ShowP Id) String) "2"Left ()0      !0      !None&',-.1:=>?@AHISUVXk^1predicate-typed?type family for converting from a 4-tuple '(opts,ip,op,i) to a = type7predicate-typedZAn ADT that summarises the results of evaluating Refined2 representing all possible states<predicate-typed$Provides the constraints on Refined2=predicate-typedSRefinement type for specifying an input type that is different from the output typeopts are the display optionsip converts i to PP ip i which is the internal type in >op$ validates that internal type using PP op (PP ip i) ~ Booli& is the input type which is stored in ?]Although a common scenario is String as input, you are free to choose any input type you like6newRefined2 @OZ @(ReadBase Int 16 Id) @(Lt 255) "00fe"-Right (Refined2 {r2In = 254, r2Out = "00fe"})6newRefined2 @OZ @(ReadBase Int 16 Id) @(Lt 253) "00fe"/Left "Step 2. False Boolean Check(op) | FalseP"6newRefined2 @OZ @(ReadBase Int 16 Id) @(Lt 255) "00fg">Left "Step 1. Initial Conversion(ip) Failed | invalid base 16"lnewRefined2 @OL @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Msg "length invalid:" (Len == 4)) "198.162.3.1.5"@Left "Step 2. False Boolean Check(op) | {length invalid:5 == 4}"newRefined2 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) "198.162.3.1.5"8Left "Step 2. Failed Boolean Check(op) | found length=5"newRefined2 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) "198.162.3.1">Right (Refined2 {r2In = [198,162,3,1], r2Out = "198.162.3.1"}) :m + Data.Time.Calendar.WeekDatemnewRefined2 @OZ @(MkDayExtra Id >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) (2019,10,13)ARight (Refined2 {r2In = (2019-10-13,41,7), r2Out = (2019,10,13)})cnewRefined2 @OL @(MkDayExtra Id >> 'Just Id) @(Msg "expected a Sunday:" (Thd Id == 7)) (2019,10,12)CLeft "Step 2. False Boolean Check(op) | {expected a Sunday:6 == 7}"newRefined2 @OZ @(MkDayExtra' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) (2019,10,12);Left "Step 2. Failed Boolean Check(op) | expected a Sunday"@predicate-typeddirectly load values into =4. It still checks to see that those values are validApredicate-typeddirectly load values into = without any checkingBpredicate-typed create a =E generator using a generator to restrict the values (so it completes)Lg = genRefined2 @OU @(ToEnum Day Id) @(UnMkDay Id >> Snd Id == 10) arbitraryxs <- generate (vectorOf 10 g)kall (\x -> let y = toEnum @Day (fromIntegral (r2Out x)) in view _2 (toGregorian y) == 10 && y == r2In x) xsTrueCpredicate-typed create a = generator using a proxyDpredicate-typedsame as E for IOEpredicate-typed create a = value using a continuationThis first example reads a hex string and makes sure it is between 100 and 200 and then reads a binary string and adds the values together:set -XPolyKindsprtRefinedTIO $ withRefined2T @OZ @(ReadBase Int 16 Id) @(Between 100 200 Id) "a3" $ \x -> withRefined2T @OZ @(ReadBase Int 2 Id) @'True "1001110111" $ \y -> pure (r2In x + r2In y)7947this example fails as the the hex value is out of rangeprtRefinedTIO $ withRefined2T @OAN @(ReadBase Int 16 Id) @(Between 100 200 Id) "a388" $ \x -> withRefined2T @OAN @(ReadBase Int 2 Id) @'True "1001110111" $ \y -> pure (x,y)6*** Step 1. Success Initial Conversion(ip) (41864) ***P ReadBase(Int,16) 41864|`- P Id "a388"'*** Step 2. False Boolean Check(op) ***False 41864 <= 200| +- P Id 41864| +- P '100| `- P '200=failure msg[Step 2. False Boolean Check(op) | {41864 <= 200}]Gpredicate-typed$pure version for extracting Refined2newRefined2 @OL @Id @'True 22(Right (Refined2 {r2In = 22, r2Out = 22})newRefined2 @OL @(ReadP UTCTime Id) @(Between (MkDay '(2020,5,2)) (MkDay '(2020,5,7)) (MkJust (ToDay Id))) "2020-05-04 12:13:14Z"QRight (Refined2 {r2In = 2020-05-04 12:13:14 UTC, r2Out = "2020-05-04 12:13:14Z"})newRefined2 @OL @(ReadP UTCTime Id) @(Between (MkDay '(2020,5,2)) (MkDay '(2020,5,7)) (MkJust (ToDay Id))) "2020-05-08 12:13:14Z"MLeft "Step 2. False Boolean Check(op) | {Just 2020-05-08 <= Just 2020-05-07}"Ipredicate-typedcreate a wrapped = typeZprtRefinedTIO $ newRefined2T @_ @OL @(MkDayExtra Id >> Just Id) @(Thd Id == 5) (2019,11,1)8Refined2 {r2In = (2019-11-01,44,5), r2Out = (2019,11,1)}ZprtRefinedTIO $ newRefined2T @_ @OL @(MkDayExtra Id >> Just Id) @(Thd Id == 5) (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]mprtRefinedTIO $ newRefined2T @_ @OL @(MkDayExtra Id >> Just Id) @(Msg "wrong day:" (Thd Id == 5)) (2019,11,2)Afailure msg[Step 2. False Boolean Check(op) | {wrong day:6 == 5}]Jpredicate-typedcreate a wrapped = type with an explicit proxyKpredicate-typedcreate a wrapped = type in IOLpredicate-typedsame as M/ without a proxy for used with TypeApplicationsMpredicate-typedsame as O but runs in IOUpredicate-typedcreates a 4-tuple proxy (see F J P O)Quse type application to set the 4-tuple or set the individual parameters directlyset the 4-tuple directly3eg1 = mkProxy2 @'( OL, ReadP Int Id, Gt 10, String)newRefined2P eg1 "24"*Right (Refined2 {r2In = 24, r2Out = "24"})Kskip the 4-tuple and set each parameter individually using type application.eg2 = mkProxy2 @_ @OL @(ReadP Int Id) @(Gt 10)newRefined2P eg2 "24"*Right (Refined2 {r2In = 24, r2Out = "24"})Vpredicate-typedsame as U: but checks to make sure the proxy is consistent with the < constraintWpredicate-typedO instance for = import qualified Data.Aeson as APA.encode (unsafeRefined2 @OZ @(ReadBase Int 16 Id) @(Between 0 255 Id) 254 "fe")"\"fe\""5A.encode (unsafeRefined2 @OZ @Id @'True @Int 123 123)"123"Xpredicate-typedQ instance for =Ypredicate-typedR instance for =import Control.Arrow ((+++))import Data.Time2type K1 = Refined2 OAN (ReadP Day Id) 'True Stringktype K2 = Refined2 OAN (ReadP Day Id) (Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") Id) String&r = unsafeRefined2' "2019-04-23" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)2Refined2 {r2In = 2019-04-23, r2Out = "2019-04-23"}DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)ERefined2:Step 2. False Boolean Check(op) | {2019-05-30 <= 2019-04-23};*** Step 1. Success Initial Conversion(ip) (2019-04-23) ***P ReadP Day 2019-04-23|`- P Id "2019-04-23"'*** Step 2. False Boolean Check(op) ***False 2019-05-30 <= 2019-04-23|+- P Id 2019-04-23|+- P ReadP Day 2019-05-30| || `- P '"2019-05-30"|`- P ReadP Day 2019-06-01 | `- P '"2019-06-01"Zpredicate-typedP instance for = :m + Data.Time.Calendar.WeekDatenxs <- generate (vectorOf 10 (arbitrary @(Refined2 OU (ToEnum Day Id) (Snd (ToWeekDate Id) == "Tuesday") Int)))Zall (\x -> let y = toEnum @Day (r2Out x) in view _3 (toWeekDate y) == 2 && r2In x == y) xsTrue[predicate-typedS instance for = import qualified Data.Aeson as A[A.eitherDecode' @(Refined2 OZ (ReadBase Int 16 Id) (Id > 10 && Id < 256) String) "\"00fe\""-Right (Refined2 {r2In = 254, r2Out = "00fe"})mremoveAnsi $ A.eitherDecode' @(Refined2 OAN (ReadBase Int 16 Id) (Id > 10 && Id < 256) String) "\"00fe443a\""YError in $: Refined2:Step 2. False Boolean Check(op) | {True && False | (16663610 < 256)}9*** Step 1. Success Initial Conversion(ip) (16663610) ***P ReadBase(Int,16) 16663610|`- P Id "00fe443a"'*** Step 2. False Boolean Check(op) ***&False True && False | (16663610 < 256)|+- True 16663610 > 10| || +- P Id 16663610| | | `- P '10|`- False 16663610 < 256 | +- P Id 16663610 | `- P '256\predicate-typedT instance for =kreads @(Refined2 OZ (ReadBase Int 16 Id) (Between 0 255 Id) String) "Refined2 {r2In = 254, r2Out = \"fe\"}"*[(Refined2 {r2In = 254, r2Out = "fe"},"")]lreads @(Refined2 OZ (ReadBase Int 16 Id) (Between 0 255 Id) String) "Refined2 {r2In = 300, r2Out = \"12c\"}"[]ereads @(Refined2 OZ (ReadBase Int 16 Id) (Id < 0) String) "Refined2 {r2In = -1234, r2Out = \"-4d2\"}".[(Refined2 {r2In = -1234, r2Out = "-4d2"},"")]reads @(Refined2 OZ (Map (ReadP Int Id) (Resplit "\\." Id)) (Guard "len/=4" (Len == 4) >> 'True) String) "Refined2 {r2In = [192,168,0,1], r2Out = \"192.168.0.1\"}"=[(Refined2 {r2In = [192,168,0,1], r2Out = "192.168.0.1"},"")]]predicate-typedU instance for Refined2MpureTryTest $ fromString @(Refined2 OL (ReadP Int Id) (Id > 12) String) "523",Right (Refined2 {r2In = 523, r2Out = "523"})KpureTryTest $ fromString @(Refined2 OL (ReadP Int Id) (Id > 12) String) "2"Left ()(/0123645789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV(=>?<NOLMST23645789:;QPRGHIJKEFD1UVBCA@0/None&',-.1:=>?@AHISUVXk#dpredicate-typedchange the opts typeepredicate-typedreplace the opts typefpredicate-typed emulates  using t? by setting the input conversion and output formatting as noopslpredicate-typedZAn ADT that summarises the results of evaluating Refined1 representing all possible statesrpredicate-typed>type family for converting from a 5-tuple '(ip,op,fmt,i) to a t typespredicate-typed$Provides the constraints on Refined1tpredicate-typedFRefinement type that differentiates the input from output: similar to - but only creates the output value as needed.opts are the display optionsip converts i to PP ip i* which is the internal type and stored in uop$ validates that internal type using PP op (PP ip i) ~ Boolfmt outputs the internal type PP fmt (PP ip i) ~ i, (not stored anywhere but created on demand)i is the input typePP fmt (PP ip i)& should be valid as input for Refined1Setting ip to Id and fmt to Id makes it equivalent to : see fSetting 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 uvalidate u using the predicate opshow u using fmt- (does not store the formatted result unlike )]Although a common scenario is String as input, you are free to choose any input type you likeHnewRefined1 @OZ @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) "00fe"Right (Refined1 254)HnewRefined1 @OZ @(ReadBase Int 16 Id) @(Lt 253) @(PrintF "%x" Id) "00fe"/Left "Step 2. False Boolean Check(op) | FalseP"HnewRefined1 @OZ @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) "00fg">Left "Step 1. Initial Conversion(ip) Failed | invalid base 16"newRefined1 @OL @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Msg "length invalid:" (Len == 4)) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1.5"@Left "Step 2. False Boolean Check(op) | {length invalid:5 == 4}"newRefined1 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1.5"8Left "Step 2. Failed Boolean Check(op) | found length=5"newRefined1 @OZ @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "198.162.3.1"Right (Refined1 [198,162,3,1]) :m + Data.Time.Calendar.WeekDatenewRefined1 @OZ @(MkDayExtra Id >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) (2019,10,13)"Right (Refined1 (2019-10-13,41,7))wnewRefined1 @OL @(MkDayExtra Id >> 'Just Id) @(Msg "expected a Sunday:" (Thd Id == 7)) @(UnMkDay (Fst Id)) (2019,10,12)CLeft "Step 2. False Boolean Check(op) | {expected a Sunday:6 == 7}"newRefined1 @OZ @(MkDayExtra' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) (2019,10,12);Left "Step 2. Failed Boolean Check(op) | expected a Sunday"ttype T4 k = '( OZ, MkDayExtra Id >> 'Just Id, Guard "expected a Sunday" (Thd Id == 7) >> 'True, UnMkDay (Fst Id), k))newRefined1P (Proxy @(T4 _)) (2019,10,12);Left "Step 2. Failed Boolean Check(op) | expected a Sunday")newRefined1P (Proxy @(T4 _)) (2019,10,13)"Right (Refined1 (2019-10-13,41,7))vpredicate-typeddirectly load values into t4. It still checks to see that those values are validwpredicate-typeddirectly load values into t without any checkingxpredicate-typed create a t generator^g = genRefined1 @OU @(ReadP Int Id) @(Between 10 100 Id && Even) @(ShowP Id) (choose (10,100))xs <- generate (vectorOf 10 g)Call (\x -> let y = unRefined1 x in y >= 0 && y <= 100 && even y) xsTrueypredicate-typed create a t generator with a Proxyzpredicate-typedcreates a 5-tuple proxy (see ~   )Quse type application to set the 5-tuple or set the individual parameters directlyset the 5-tuple directly=eg1 = mkProxy1 @'( OL, ReadP Int Id, Gt 10, ShowP Id, String)newRefined1P eg1 "24"Right (Refined1 24)Kskip the 5-tuple and set each parameter individually using type application:eg2 = mkProxy1 @_ @OL @(ReadP Int Id) @(Gt 10) @(ShowP Id)newRefined1P eg2 "24"Right (Refined1 24){predicate-typedsame as z: but checks to make sure the proxy is consistent with the s constraint}predicate-typed create a t value using a continuationThis first example reads a hex string and makes sure it is between 100 and 200 and then reads a binary string and adds the values together:set -XPolyKinds:set -XRankNTypespb16 :: forall opts . Proxy '( opts, ReadBase Int 16 Id, Between 100 200 Id, ShowBase 16 Id, String); b16 = Proxy_b2 :: forall opts . Proxy '( opts, ReadBase Int 2 Id, 'True, ShowBase 2 Id, String); b2 = ProxyprtRefinedTIO $ withRefined1TP (b16 @OZ) "a3" $ \x -> withRefined1TP (b2 @OZ) "1001110111" $ \y -> pure (unRefined1 x + unRefined1 y)7947this example fails as the the hex value is out of rangeqprtRefinedTIO $ withRefined1TP (b16 @OAN) "a388" $ \x -> withRefined1TP (b2 @OAN) "1001110111" $ \y -> pure (x,y)6*** Step 1. Success Initial Conversion(ip) (41864) ***P ReadBase(Int,16) 41864|`- P Id "a388"'*** Step 2. False Boolean Check(op) ***False 41864 <= 200| +- P Id 41864| +- P '100| `- P '200=failure msg[Step 2. False Boolean Check(op) | {41864 <= 200}]predicate-typed$pure version for extracting Refined1enewRefined1 @OL @(ParseTimeP TimeOfDay "%-H:%-M:%-S" Id) @'True @(FormatTimeP "%H:%M:%S" Id) "1:15:7"Right (Refined1 01:15:07)dnewRefined1 @OL @(ParseTimeP TimeOfDay "%-H:%-M:%-S" Id) @'True @(FormatTimeP "%H:%M:%S" Id) "1:2:x"aLeft "Step 1. Initial Conversion(ip) Failed | ParseTimeP TimeOfDay (%-H:%-M:%-S) failed to parse"newRefined1 @OL @(Rescan "^(\\d{1,2}):(\\d{1,2}):(\\d{1,2})$" Id >> Snd (Head Id) >> Map (ReadP Int Id) Id) @(All (0 <..> 59) Id && Len == 3) @(PrintL 3 "%02d:%02d:%02d" Id) "1:2:3"Right (Refined1 [1,2,3])predicate-typedcreate a wrapped t typeprtRefinedTIO $ newRefined1TP (Proxy @'( OZ, MkDayExtra Id >> Just Id, GuardSimple (Thd Id == 5) >> 'True, UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,1)Refined1 (2019-11-01,44,5)prtRefinedTIO $ newRefined1TP (Proxy @'( OL, MkDayExtra Id >> Just Id, Thd Id == 5, UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]prtRefinedTIO $ newRefined1TP (Proxy @'( OL, MkDayExtra Id >> Just Id, Msg "wrong day:" (Thd Id == 5), UnMkDay (Fst Id), (Int,Int,Int))) (2019,11,2)Afailure msg[Step 2. False Boolean Check(op) | {wrong day:6 == 5}]predicate-typedattempts to cast a wrapped t to another t with different predicatespredicate-typed*applies a binary operation to two wrapped t parameterspredicate-typedsame as ! but uses a 5-tuple proxy insteadpredicate-typedsame as  but passes in the proxypredicate-typedsame as  but runs in IOpredicate-typedsame as ] but skips the proxy and allows you to set each parameter individually using type applicationpredicate-typedLcreate a Refined1 using a 5-tuple proxy and aggregate the results on failurepredicate-typed3create a Refined1 value using a 5-tuple proxy (see z)use z/ to package all the types together as a 5-tuplepredicate-typedsame as @ but can pass the parameters individually using type applicationWpredicate-typed7creates Refined1 value but skips the initial conversionpredicate-typed similar to  but it emulates t but using Vtakes a 5-tuple proxy as input but outputs the Refined value and the result separately1initial conversion using 'ip' and stores that in Truns 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  and the output from 3.Bif any of the above steps fail the process stops it and dumps out lpredicate-typedsame as I but allows you to set the parameters individually using type applicationpredicate-typedO instance for t import qualified Data.Aeson as A]A.encode (unsafeRefined1 @OZ @(ReadBase Int 16 Id) @(Between 0 255 Id) @(ShowBase 16 Id) 254)"\"fe\""0A.encode (unsafeRefined1 @OZ @Id @'True @Id 123)"123"predicate-typedQ instance for tpredicate-typedR instance for timport Control.Arrow ((+++))import Control.Lensimport Data.Time?type K1 = MakeR1 '( OAN, ReadP Day Id, 'True, ShowP Id, String)vtype K2 = MakeR1 '( OAN, ReadP Day Id, Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") Id, ShowP Id, String)&r = unsafeRefined1' "2019-04-23" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)Refined1 2019-04-23DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)ERefined1:Step 2. False Boolean Check(op) | {2019-05-30 <= 2019-04-23};*** Step 1. Success Initial Conversion(ip) (2019-04-23) ***P ReadP Day 2019-04-23|`- P Id "2019-04-23"'*** Step 2. False Boolean Check(op) ***False 2019-05-30 <= 2019-04-23|+- P Id 2019-04-23|+- P ReadP Day 2019-05-30| || `- P '"2019-05-30"|`- P ReadP Day 2019-06-01 | `- P '"2019-06-01"predicate-typedP instance for tmxs <- generate (vectorOf 10 (arbitrary @(Refined1 OU (ReadP Int Id) (1 <..> 120 && Even) (ShowP Id) String)))all ((/=0) . unRefined1) xsTrueLxs <- generate (vectorOf 10 (arbitrary @(Refined1 OU Id (Prime Id) Id Int)))all (isPrime . unRefined1) xsTruepredicate-typedS instance for t import qualified Data.Aeson as AlA.eitherDecode' @(Refined1 OZ (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe\""Right (Refined1 254)~removeAnsi $ A.eitherDecode' @(Refined1 OAN (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe443a\""YError in $: Refined1:Step 2. False Boolean Check(op) | {True && False | (16663610 < 256)}9*** Step 1. Success Initial Conversion(ip) (16663610) ***P ReadBase(Int,16) 16663610|`- P Id "00fe443a"'*** Step 2. False Boolean Check(op) ***&False True && False | (16663610 < 256)|+- True 16663610 > 10| || +- P Id 16663610| | | `- P '10|`- False 16663610 < 256 | +- P Id 16663610 | `- P '256predicate-typedT instance for tcreads @(Refined1 OZ (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined1 254"[(Refined1 254,"")]creads @(Refined1 OZ (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined1 300"[]]reads @(Refined1 OZ (ReadBase Int 16 Id) (Id < 0) (ShowBase 16 Id) String) "Refined1 (-1234)"[(Refined1 (-1234),"")]reads @(Refined1 OZ (Map (ReadP Int Id) (Resplit "\\." Id)) (Guard "len/=4" (Len == 4) >> 'True) (PrintL 4 "%d.%d.%d.%d" Id) String) "Refined1 [192,168,0,1]"[(Refined1 [192,168,0,1],"")]9reads @(Refined1 OZ Id 'True Id Int) "Refined1 (-123)xyz"[(Refined1 (-123),"xyz")]predicate-typedU instance for Refined1XpureTryTest $ fromString @(Refined1 OL (ReadP Int Id) (Id > 12) (ShowP Id) String) "523"Right (Refined1 523)VpureTryTest $ fromString @(Refined1 OL (ReadP Int Id) (Id > 12) (ShowP Id) String) "2"Left ().defghkijlmnopqrstuvwxyz{|}~.tusghkijlmnopq}|~z{rwvxyfedNone%&',-.=>?@AHPSUVX_k} predicate-typed6splits a list pointed to by 'p' into lists of size 'n'pz @(ChunksOf 2 Id) "abcdef"PresentT ["ab","cd","ef"]pz @(ChunksOf 2 Id) "abcdefg"PresentT ["ab","cd","ef","g"]pz @(ChunksOf 2 Id) "" PresentT []pz @(ChunksOf 2 Id) "a"PresentT ["a"]predicate-typed"very simple conversion to a stringpredicate-typedlike " but for a tuple,pl @(Sum > 44 |+ Id < 2) ([5,6,7,8,14,44],9)True (True (|+) False)TrueT'pl @(Sum > 44 |+ Id < 2) ([5,6,7,14],9)1False (False (|+) False | (32 > 44) (|+) (9 < 2))FalseT'pl @(Sum > 44 |+ Id < 2) ([5,6,7,14],1)True (False (|+) True)TrueTpredicate-typedlike $ but for a tuple2pl @(SplitAt 4 "abcdefg" >> Len > 4 &* Len < 5) ()0False ((>>) False | {False (&*) True | (4 > 4)})FalseTpredicate-typeduncurry experiment]pl @(Uncurry Between (ReadP (Day,Day) "(2017-04-11,2018-12-30)") (ReadP Day Id)) "2019-10-12"*False (Uncurry (2019-10-12 <= 2018-12-30))FalseT]pl @(Uncurry Between (ReadP (Day,Day) "(2017-04-11,2018-12-30)") (ReadP Day Id)) "2017-10-12"7True (Uncurry (2017-04-11 <= 2017-10-12 <= 2018-12-30))TrueT]pl @(Uncurry Between (ReadP (Day,Day) "(2017-04-11,2018-12-30)") (ReadP Day Id)) "2016-10-12"*False (Uncurry (2017-04-11 <= 2016-10-12))FalseTpredicate-typedencode a json filepredicate-typed encode jsonpl @(EncodeJson Id) (10,"def").Present "[10,\"def\"]" (EncodeJson [10,"def"])PresentT "[10,\"def\"]"7pl @(EncodeJson Id >> ParseJson (Int,Bool) Id) (1,True)BPresent (1,True) ((>>) (1,True) | {ParseJson (Int,Bool) (1,True)})PresentT (1,True)predicate-typedparse a json file8pz @(ParseJsonFile [A.Value] "test1.json" >> Id !! 2) ()PresentT (Object (fromList [("lastName",String "Doe"),("age",Number 45.0),("firstName",String "John"),("likesPizza",Bool False)]))predicate-typedparse json data.pl @(ParseJson (Int,String) Id) "[10,\"abc\"]"6Present (10,"abc") (ParseJson (Int,[Char]) (10,"abc"))PresentT (10,"abc")1pl @(ParseJson (Int,String) Id) "[10,\"abc\",99]"Error ParseJson (Int,[Char])([10,"abc",...) Error in $ (Error in $: cannot unpack array of length 3 into a tuple of length 2 | [10,"abc",99]):FailT "ParseJson (Int,[Char])([10,\"abc\",...) Error in $"Cpl @(ParseJson (Int,Bool) (FromString _ Id)) ("[1,true]" :: String)0Present (1,True) (ParseJson (Int,Bool) (1,True))PresentT (1,True)1pl @(ParseJson (Int,Bool) Id) (A.encode (1,True))0Present (1,True) (ParseJson (Int,Bool) (1,True))PresentT (1,True) pl @(ParseJson () Id) "[1,true]"kError ParseJson ()([1,true]) Error in $ (Error in $: parsing () failed, expected an empty array | [1,true]))FailT "ParseJson ()([1,true]) Error in $"predicate-typed(gets the singleton value from a foldablepl @(OneP Id) [10..15],Error OneP 6 elements (expected one element)FailT "OneP 6 elements"pl @(OneP Id) [10]Present 10 (OneP) PresentT 10pl @(OneP Id) []'Error OneP empty (expected one element)FailT "OneP empty"pl @(OneP Id) (Just 10)Present 10 (OneP) PresentT 10pl @(OneP Id) Nothing'Error OneP empty (expected one element)FailT "OneP empty"predicate-typed6applies 'p' to the first and second slot of an n-tuple5pl @(Both Len (Fst Id)) (("abc",[10..17],1,2,3),True)Present (3,8) (Both)PresentT (3,8)6pl @(Both (Pred Id) $ Fst Id) ((12,'z',[10..17]),True)Present (11,'y') (Both)PresentT (11,'y')pl @(Both (Succ Id) Id) (4,'a')Present (5,'b') (Both)PresentT (5,'b')/pl @(Both Len (Fst Id)) (("abc",[10..17]),True)Present (3,8) (Both)PresentT (3,8)8pl @(Both (ReadP Day Id) Id) ("1999-01-01","2001-02-12")&Present (1999-01-01,2001-02-12) (Both) PresentT (1999-01-01,2001-02-12)predicate-typed:creates a constant expression ignoring the second argument9pl @(RDot '[Fst,Snd,Thd,K "xxx"] Id) ((1,(2,9,10)),(3,4))Present "xxx" (K '"xxx")PresentT "xxx"?pl @(RDot '[Fst,Snd,Thd,K '("abc",Id)] Id) ((1,(2,9,10)),(3,4))-Present ("abc",((1,(2,9,10)),(3,4))) (K '(,))%PresentT ("abc",((1,(2,9,10)),(3,4))):pl @(Thd $ Snd $ Fst $ K Id "dud") ((1,("W",9,'a')),(3,4))#Present 'a' (Thd 'a' | ("W",9,'a')) PresentT 'a'Gpl @((Thd $ Snd $ Fst $ K Id "dud") >> Pred Id) ((1,("W",9,'a')),(3,4)))Present '`' ((>>) '`' | {Pred '`' | 'a'}) PresentT '`'predicate-typed similar to X/pl @(Id & Fst & Singleton & Length) (13,"xyzw")Present 1 (Length 1 | [13]) PresentT 1pl @(2 & (&&&) "abc") ()Present ("abc",2) (W '(,))PresentT ("abc",2)pl @(2 & '(,) "abc") ()Present ("abc",2) ('(,))PresentT ("abc",2)pl @('(,) 4 $ '(,) 7 $ "aa") ()Present (4,(7,"aa")) ('(,))PresentT (4,(7,"aa"))0pl @(Thd $ Snd $ Fst Id) ((1,("W",9,'a')),(3,4))#Present 'a' (Thd 'a' | ("W",9,'a')) PresentT 'a'predicate-typedlike  for expressions"pl @(Fst $ Snd $ Id) ((1,2),(3,4))Present 3 (Fst 3 | (3,4)) PresentT 3+pl @((<=) 4 $ Fst $ Snd $ Id) ((1,2),(3,4))False (4 <= 3)FalseTpredicate-typed reversed dot1pl @(RDot '[Fst,Snd,Thd] Id) ((1,(2,9,10)),(3,4))Present 10 (Thd 10 | (2,9,10)) PresentT 10.pl @(RDot '[Fst,Snd] Id) (('a',2),(True,"zy"))Present 2 (Snd 2 | ('a',2)) PresentT 2predicate-typedcompose simple functions0pl @(Dot '[Thd,Snd,Fst] Id) ((1,(2,9,10)),(3,4))Present 10 (Thd 10 | (2,9,10)) PresentT 10predicate-typedtries to extract a from Maybe a otherwise it failspz @(Just Id) (Just "abc")PresentT "abc"pz @(Just Id) NothingFailT "Just(empty)"predicate-typed'takes the init of a list like containerpz @(Init Id) "abcd"PresentT "abc"pz @(Init Id) (T.pack "abcd")PresentT "abc"pz @(Init Id) []FailT "Init(empty)"predicate-typed'takes the last of a list like containerpz @(Last Id) "abcd" PresentT 'd'pz @(Last Id) []FailT "Last(empty)"predicate-typed'takes the tail of a list like containerpz @(Tail Id) "abcd"PresentT "bcd"pz @(Tail Id) []FailT "Tail(empty)"predicate-typed'takes the head of a list like containerpz @(Head Id) "abcd" PresentT 'a'pz @(Head Id) []FailT "Head(empty)"predicate-typedextract the These value from a & otherwise fail with a messageBif there is no These value then p is passed the whole context only,pz @(TheseFail "oops" Id) (These "abc" 20.4)PresentT ("abc",20.4)%pz @(TheseFail "oops" Id) (That "aa") FailT "oops"\pz @(TheseFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,That "xy")!FailT "found That \"xy\" fst=123")pz @(TheseFail (MEmptyT _) Id) (That 222)FailT ""predicate-typedextract the That value from a & otherwise fail with a messageAif there is no That value then p is passed the whole context only$pz @(ThatFail "oops" Id) (That 20.4) PresentT 20.4$pz @(ThatFail "oops" Id) (This "aa") FailT "oops"[pz @(ThatFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,This "xy")!FailT "found This \"xy\" fst=123"(pz @(ThatFail (MEmptyT _) Id) (This 222)FailT ""predicate-typedextract the This value from a & otherwise fail with a messageAif there is no This value then p is passed the whole context only$pz @(ThisFail "oops" Id) (This 20.4) PresentT 20.4$pz @(ThisFail "oops" Id) (That "aa") FailT "oops"[pz @(ThisFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,That "xy")!FailT "found That \"xy\" fst=123"(pz @(ThisFail (MEmptyT _) Id) (That 222)FailT ""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")PresentT (102 % 5,"x")+pz @(TheseDef '(1 % 4,"zz") Id) (This 20.4)PresentT (1 % 4,"zz")*pz @(TheseDef '(1 % 4,"zz") Id) (That "x")PresentT (1 % 4,"zz")apz @(TheseDef '(PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id),999) (Snd Id)) (123,This "xy")*PresentT ("found This \"xy\" fst=123",999)9pz @(TheseDef (MEmptyT (SG.Sum _, String)) Id) (This 222)PresentT (Sum {getSum = 0},"")>pz @(TheseDef (MEmptyT _) Id) (These (222 :: SG.Sum Int) "aa")"PresentT (Sum {getSum = 222},"aa")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)PresentT (102 % 5)$pz @(ThatDef (1 % 4) Id) (This "aa")PresentT (1 % 4))pz @(ThatDef (1 % 4) Id) (These "aa" 2.3)PresentT (1 % 4)[pz @(ThatDef (PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id)) (Snd Id)) (123,This "xy")$PresentT "found This \"xy\" fst=123"'pz @(ThatDef (MEmptyT _) Id) (This 222) PresentT ()6pz @(ThatDef (MEmptyT (SG.Sum _)) Id) (These 'x' 1120)PresentT (Sum {getSum = 0})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)PresentT (102 % 5)$pz @(ThisDef (1 % 4) Id) (That "aa")PresentT (1 % 4))pz @(ThisDef (1 % 4) Id) (These 2.3 "aa")PresentT (1 % 4)[pz @(ThisDef (PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id)) (Snd Id)) (123,That "xy")$PresentT "found That \"xy\" fst=123"'pz @(ThisDef (MEmptyT _) Id) (That 222) PresentT ()5pz @(ThisDef (MEmptyT (SG.Sum _)) Id) (These 222 'x')PresentT (Sum {getSum = 0})predicate-typed extract the Right value from an Y otherwise fail with a messagePif there is no Right value then p is passed the Left value and the whole context&pz @(RightFail "oops" Id) (Right 20.4) PresentT 20.4%pz @(RightFail "oops" Id) (Left "aa") FailT "oops"_pz @(RightFail (PrintT "found left=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Left "xy")FailT "found left=xy fst=123")pz @(RightFail (MEmptyT _) Id) (Left 222)FailT ""predicate-typedextract the Left value from an Y otherwise fail with a messagePif there is no Left value then p is passed the Right value and the whole context$pz @(LeftFail "oops" Id) (Left 20.4) PresentT 20.4%pz @(LeftFail "oops" Id) (Right "aa") FailT "oops"`pz @(LeftFail (PrintT "found right=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Right "xy")FailT "found right=xy fst=123")pz @(LeftFail (MEmptyT _) Id) (Right 222)FailT ""predicate-typed extract the Right value from an YPif there is no Right value then p is passed the Left value and the whole context&pz @(RightDef (1 % 4) Id) (Right 20.4)PresentT (102 % 5)%pz @(RightDef (1 % 4) Id) (Left "aa")PresentT (1 % 4)^pz @(RightDef (PrintT "found left=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Left "xy") PresentT "found left=xy fst=123"(pz @(RightDef (MEmptyT _) Id) (Left 222) PresentT ()1pz @(RightDef (MEmptyT (SG.Sum _)) Id) (Left 222)PresentT (Sum {getSum = 0})predicate-typedextract the Left value from an Y 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)PresentT (102 % 5)%pz @(LeftDef (1 % 4) Id) (Right "aa")PresentT (1 % 4)_pz @(LeftDef (PrintT "found right=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Right "xy")!PresentT "found right=xy fst=123"(pz @(LeftDef (MEmptyT _) Id) (Right 222) PresentT ()1pz @(LeftDef (MEmptyT (SG.Sum _)) Id) (Right 222)PresentT (Sum {getSum = 0})predicate-typedextract the value from a Z or fail"pz @(JustFail "nope" Id) (Just 99) PresentT 99 pz @(JustFail "nope" Id) Nothing FailT "nope"Bpz @(JustFail (PrintF "oops=%d" (Snd Id)) (Fst Id)) (Nothing, 123)FailT "oops=123"Cpz @(JustFail (PrintF "oops=%d" (Snd Id)) (Fst Id)) (Just 'x', 123) PresentT 'x'predicate-typedextract the value from a Z otherwise use the default value$pz @(JustDef (1 % 4) Id) (Just 20.4)PresentT (102 % 5) pz @(JustDef (1 % 4) Id) NothingPresentT (1 % 4)(pz @(JustDef (MEmptyT _) Id) (Just "xy") PresentT "xy"$pz @(JustDef (MEmptyT _) Id) Nothing PresentT ()-pz @(JustDef (MEmptyT (SG.Sum _)) Id) NothingPresentT (Sum {getSum = 0})predicate-typed leverages 8 for repeating predicates (passthrough method) same as DoN n p == FoldN n p Id but more efficientpz @(DoN 4 (Succ Id)) 'c' PresentT 'g'pz @(DoN 4 (Id <> " | ")) "abc"PresentT "abc | | | | "#pz @(DoN 4 (Id <> "|" <> Id)) "abc"JPresentT "abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc"predicate-typedccreates a promoted list of predicates and then evaluates them into a list. see PP instance for '[k]pz @(Repeat 4 (Succ Id)) 'c'PresentT "dddd"pz @(Repeat 4 "abc") ()"PresentT ["abc","abc","abc","abc"][predicate-typed similar to  ,pz @(StripL "xyz" Id) ("xyzHello" :: String)PresentT (Just "Hello"))pz @(StripL "xyz" Id) (T.pack "xyzHello")PresentT (Just "Hello") pz @(StripL "xyz" Id) "xywHello"PresentT Nothing!pz @(StripR "xyz" Id) "Hello xyz"PresentT (Just "Hello ")#pz @(StripR "xyz" Id) "xyzHelloxyw"PresentT Nothingpz @(StripR "xyz" Id) ""PresentT Nothingpz @(StripR "xyz" "xyz") ()PresentT (Just "")\predicate-typed similar to ] ^ _0pz @(TrimBoth (Snd Id)) (20," abc " :: String)PresentT "abc"-pz @(TrimBoth (Snd Id)) (20,T.pack " abc ")PresentT "abc"#pz @(TrimL (Snd Id)) (20," abc ")PresentT "abc "#pz @(TrimR (Snd Id)) (20," abc ")PresentT " abc"pz @(TrimR " abc ") ()PresentT " abc"pz @(TrimR "") () PresentT ""pz @(TrimBoth " ") () PresentT ""pz @(TrimBoth "") () PresentT ""predicate-typed9flipped function application for expressions: similar to X-pz @(Snd Id $& Fst Id) ((*16),4) PresentT 64.pz @("def" $& Id) ("abc"<>) PresentT "abcdef"predicate-typed1function application for expressions: similar to -pz @(Fst Id $$ Snd Id) ((*16),4) PresentT 64.pz @(Id $$ "def") ("abc"<>) PresentT "abcdef"predicate-typed similar to  pz @Join (Just (Just 20))PresentT (Just 20)pz @Join ["ab","cd","","ef"]PresentT "abcdef"predicate-typed similar to `pz @Duplicate (20,"abc")PresentT (20,(20,"abc"))predicate-typed similar to apz @Extract (Nothing,Just 20)PresentT (Just 20)pz @Extract (Identity 20) PresentT 20predicate-typed similar to b)pz @(Fst Id <|> Snd Id) (Nothing,Just 20)PresentT (Just 20))pz @(Fst Id <|> Snd Id) (Just 10,Just 20)PresentT (Just 10))pz @(Fst Id <|> Snd Id) (Nothing,Nothing)PresentT Nothingcpredicate-typed similar to d+pz @(Fst Id <* Snd Id) (Just "abc",Just 20)PresentT (Just "abc")predicate-typed similar to e&pz @(Fst Id <$ Snd Id) ("abc",Just 20)PresentT (Just "abc")predicate-typedprint for lists -- use  as it is safer than ^pl @(PrintL 4 "%s %s %s %s" '[W "xyz", ShowP (Fst Id), ShowP (Snd Id), Thd Id]) (123,'x',"ab")EPresent "xyz 123 'x' ab" (PrintL(4) [xyz 123 'x' ab] | s=%s %s %s %s)PresentT "xyz 123 'x' ab"Zpz @(PrintL 1 "%05d" '[Id]) 123 -- tick is required for a one element list (use 'PrintF')PresentT "00123"1pz @(PrintL 2 "%d %05d" [Fst Id,Snd Id]) (29,123)PresentT "29 00123":pl @(PrintL 3 "first=%d second=%d third=%d" Id) [10,11,12]oPresent "first=10 second=11 third=12" (PrintL(3) [first=10 second=11 third=12] | s=first=%d second=%d third=%d)&PresentT "first=10 second=11 third=12":pl @(PrintL 2 "first=%d second=%d third=%d" Id) [10,11,12],Error PrintL(2) arg count=3 (wrong length 3)FailT "PrintL(2) arg count=3":pl @(PrintL 4 "first=%d second=%d third=%d" Id) [10,11,12],Error PrintL(4) arg count=3 (wrong length 3)FailT "PrintL(4) arg count=3"predicate-typed-print for flat n-tuples of size two or largerGpl @(PrintT "%d %s %s %s" '(Fst Id, Snd Id, Snd Id,Snd Id)) (10,"Asdf")HPresent "10 Asdf Asdf Asdf" (PrintT [10 Asdf Asdf Asdf] | s=%d %s %s %s)PresentT "10 Asdf Asdf Asdf"+pl @(PrintT "%c %d %s" Id) ('x', 10,"Asdf")5Present "x 10 Asdf" (PrintT [x 10 Asdf] | s=%c %d %s)PresentT "x 10 Asdf",pz @(PrintT "fst=%s snd=%03d" Id) ("ab",123)PresentT "fst=ab snd=123"8pz @(PrintT "fst=%s snd=%03d thd=%s" Id) ("ab",123,"xx") PresentT "fst=ab snd=123 thd=xx"Lpl @(PrintT "%s %d %c %s" '(W "xyz", Fst Id, Snd Id, Thd Id)) (123,'x',"ab")>Present "xyz 123 x ab" (PrintT [xyz 123 x ab] | s=%s %d %c %s)PresentT "xyz 123 x ab"$pl @(PrintT "%d %c %s" Id) (123,'x')LError PrintT(IO e=printf: argument list ended prematurely) (PrintT %d %c %s)<FailT "PrintT(IO e=printf: argument list ended prematurely)"-pl @(PrintT "%d %c %s" Id) (123,'x',"abc",11)PError PrintT(IO e=printf: formatting string ended prematurely) (PrintT %d %c %s)@FailT "PrintT(IO e=printf: formatting string ended prematurely)"fpredicate-typed3uses inductive tuples to replace variable argumentspredicate-typed similar to g$pz @(Fst Id <> Snd Id) ("abc","def")PresentT "abcdef" pz @("abcd" <> "ef" <> Id) "ghi"PresentT "abcdefghi" pz @("abcd" <> "ef" <> Id) "ghi"PresentT "abcdefghi"/pz @(Wrap (SG.Sum _) Id <> FromInteger _ 10) 13PresentT (Sum {getSum = 23})3pz @(Wrap (SG.Product _) Id <> FromInteger _ 10) 13%PresentT (Product {getProduct = 130})9pz @('(FromInteger _ 10,"def") <> Id) (SG.Sum 12, "_XYZ")&PresentT (Sum {getSum = 22},"def_XYZ")pz @(SapA' (SG.Max _)) (10,12)PresentT (Max {getMax = 12})pz @(SapA' (SG.Sum _)) (10,12)PresentT (Sum {getSum = 22})hpredicate-typed similar to i j k for strings only.4The 'I' suffixed versions work are case insensitive. pz @(IsInfixI "abc" "axAbCd") ()TrueT!pz @(IsPrefixI "abc" "aBcbCd") ()TrueT pz @(IsPrefix "abc" "aBcbCd") ()FalseT pz @(IsSuffix "bCd" "aBcbCd") ()TrueTpredicate-typedread a value from stdinpredicate-typedEread in a value of a given type from stdin with a prompt: similar to lpredicate-typedwrite a string value to stderrpredicate-typedwrite a string value to stdoutpredicate-typed"write to file, without overwritingpredicate-typed$write to file, overwriting if neededpredicate-typedappend to a filepredicate-typedget the current time using mpredicate-typedget the current time using npredicate-typed5read all the environment variables as key value pairspredicate-typedread an environment variable,pz @(ReadEnv "PATH" >> 'Just Id >> 'True) ()TrueTpredicate-typeddoes the directory existspz @(DirExists ".") ()TrueTpredicate-typed similar to o2pz @(ReadFile "LICENSE" >> 'Just Id >> Len > 0) ()TrueTpz @(FileExists "xyzzy") ()FalseTpredicate-typed similar to p(pz @Sequence [Just 10, Just 20, Just 30]PresentT (Just [10,20,30]):pz @Sequence [Just 10, Just 20, Just 30, Nothing, Just 40]PresentT Nothingqpredicate-typedtries each predicate ps and on the first match runs the corresponding qs but if there is no match on ps then runs the fail case epz @(Case (Failt _ "asdf") '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 50PresentT "50 is same50"pz @(Case (Failt _ "asdf") '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 9PresentT "9 is lt10"pz @(Case (Failt _ "asdf") '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 3PresentT "3 is lt4"pz @(Case (Failt _ "asdf") '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 99 FailT "asdf"pz @(Case (FailS "asdf" >> Snd Id >> Unproxy) '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 99 FailT "asdf"Epz @(Case (Failt _ "x") '[Same "a",Same "b"] '["hey","there"] Id) "b"PresentT "there"Gpz @(Case (Failt _ "x") '[Id == "a",Id == "b"] '["hey","there"] Id) "a"PresentT "hey"Epz @(Case (Failt _ "x") '[Same "a",Same "b"] '["hey","there"] Id) "c" FailT "x"predicate-typed leverages . for repeating predicates (passthrough method)pz @(ParaN 4 (Succ Id)) [1..4]PresentT [2,3,4,5]pz @(ParaN 4 (Succ Id)) "azwxm")FailT "Para:invalid length(5) expected 4"pz @(ParaN 4 (Succ Id)) "azwx"PresentT "b{xy"rpredicate-typedruns values in parallel unlike  which is serial)pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30]PresentT [10,21,120],pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30,40])FailT "Para:invalid length(4) expected 3"predicate-typed/uses PrintF to format output for a single valuepz @(PrintF "value=%03d" Id) 12PresentT "value=012"&pz @(PrintF "%s" (Fst Id)) ("abc",'x')PresentT "abc"&pz @(PrintF "%d" (Fst Id)) ("abc",'x')5FailT "PrintF (IO e=printf: bad formatting char 'd')"predicate-typedintercalate two lists;pz @(Intercalate '["aB"] '["xxxx","yz","z","www","xyz"]) ():PresentT ["xxxx","aB","yz","aB","z","aB","www","aB","xyz"]-pz @(Intercalate '[W 99,Negate 98] Id) [1..5]0PresentT [1,99,-98,2,99,-98,3,99,-98,4,99,-98,5]%pz @(Intercalate '[99,100] Id) [1..5]0PresentT [1,99,100,2,99,100,3,99,100,4,99,100,5]predicate-typed-Display a number at base 2 to 36, similar to  showIntAtBase but supports signed numberspz @(ShowBase 16 Id) 4077PresentT "fed"pz @(ShowBase 16 Id) (-255)PresentT "-ff"pz @(ShowBase 2 Id) 147PresentT "10010011"(pz @(ShowBase 2 (Negate 147)) "whatever"PresentT "-10010011"predicate-typed2Read a number using base 2 through a maximum of 36 pz @(ReadBase Int 16 Id) "00feD" PresentT 4077pz @(ReadBase Int 16 Id) "-ff"PresentT (-255)"pz @(ReadBase Int 2 Id) "10010011" PresentT 147pz @(ReadBase Int 8 Id) "Abff"FailT "invalid base 8"Opl @(ReadBase Int 16 Id >> GuardSimple (Id > 0xffff) >> ShowBase 16 Id) "12344"=Present "12344" ((>>) "12344" | {ShowBase(16) 12344 | 74564})PresentT "12344":set -XBinaryLiteralsPpz @(ReadBase Int 16 Id >> GuardSimple (Id > 0b10011111) >> ShowBase 16 Id) "7f"FailT "(127 > 159)"predicate-typed"Luhn predicate check on last digitpz @(Luhn Id) [1,2,3,0]TrueTpz @(Luhn Id) [1,2,3,4]FalseT)pz @(GuardSimple (Luhn Id)) [15,4,3,1,99]=FailT "(Luhn map=[90,2,3,8,6] sum=109 ret=9 | [15,4,3,1,99])"pl @(Luhn Id) [15,4,3,1,99];False (Luhn map=[90,2,3,8,6] sum=109 ret=9 | [15,4,3,1,99])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") ()3Error Zip(3,2) length mismatch (p=[1,2,3] | q="ab") FailT "Zip(3,2) length mismatch"pl @(Zip '[1,2] "abc") ()2Error Zip(2,3) length mismatch (p=[1,2] | q="abc") FailT "Zip(2,3) length mismatch"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 (p=[1,2] | q="abc")(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 (p=[1,2,3] | q="ab")(FailT "ZipL(3,2) rhs would be truncated"spredicate-typed=Zip two lists to their maximum length using padding if needed=pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abc", [1..5])2PresentT [('a',1),('b',2),('c',3),('Z',4),('Z',5)]Apz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcdefg", [1..5])DPresentT [('a',1),('b',2),('c',3),('d',4),('e',5),('f',99),('g',99)]?pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcde", [1..5])2PresentT [('a',1),('b',2),('c',3),('d',4),('e',5)]:pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("", [1..5])2PresentT [('Z',1),('Z',2),('Z',3),('Z',4),('Z',5)];pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcde", [])7PresentT [('a',99),('b',99),('c',99),('d',99),('e',99)]tpredicate-typed/extract 'a' from '[a]' which I need for type PPpredicate-typed similar to !" thats pads with u or v& if one list is shorter than the other>the key is that all information about both lists are preserved0pz @(ZipThese (Fst Id) (Snd Id)) ("aBc", [1..5])<PresentT [These 'a' 1,These 'B' 2,These 'c' 3,That 4,That 5]3pz @(ZipThese (Fst Id) (Snd Id)) ("aBcDeF", [1..3])IPresentT [These 'a' 1,These 'B' 2,These 'c' 3,This 'D',This 'e',This 'F']"pz @(ZipThese Id Reverse) "aBcDeF"^PresentT [These 'a' 'F',These 'B' 'e',These 'c' 'D',These 'D' 'c',These 'e' 'B',These 'F' 'a']pz @(ZipThese Id '[]) "aBcDeF"@PresentT [This 'a',This 'B',This 'c',This 'D',This 'e',This 'F']pz @(ZipThese '[] Id) "aBcDeF"@PresentT [That 'a',That 'B',That 'c',That 'D',That 'e',That 'F']pz @(ZipThese '[] '[]) "aBcDeF" PresentT []predicate-typed.extracts the first character from a non empty Mpz @(Char1 "aBc") () PresentT 'a'predicate-typed creates a singleton from a value pz @(Singleton (Char1 "aBc")) () PresentT "a"pz @(Singleton Id) FalsePresentT [False](pz @(Singleton (Snd Id)) (False,"hello")PresentT ["hello"] predicate-typed'creates an empty list of the given typepz @(Id :+ EmptyList _) 99 PresentT [99] predicate-typed similar to #$9pz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (This 13) PresentT 13Npz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (That "this is a long string") PresentT 21Epz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (These 20 "somedata") PresentT 28pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (That "this is a long string")(PresentT (Right "this is a long string")pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (These 1 "this is a long string")(PresentT (Right "this is a long string")pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (These 100 "this is a long string")PresentT (Left 100)wpredicate-typed predicate on &pz @(IsThis Id) (This "aBc")TrueTpz @(IsThis Id) (These 1 'a')FalseTpz @(IsThese Id) (These 1 'a')TrueTpl @(IsThat Id) (This 12)False (IsThat | This 12)FalseTpl @(IsThis Id) (This 12)True (IsThis | This 12)TrueTpl @(IsThese Id) (This 12)False (IsThese | This 12)FalseTpl @(IsThese Id) (These 'x' 12)True (IsThese | These 'x' 12)TrueTpredicate-typedinvokes x&requires the OverloadedLists extension:set -XOverloadedLists0pz @(FromListExt (M.Map _ _)) [(4,"x"),(5,"dd")]&PresentT (fromList [(4,"x"),(5,"dd")])predicate-typedinvokes x import qualified Data.Set as Set^run @('OMsg "Fred" ':# 'OLite ':# 'OColorOff) @(FromList (Set.Set Int) << '[2,1,5,5,2,5,2]) ()WFred >>> Present fromList [1,2,5] ((>>) fromList [1,2,5] | {FromList fromList [1,2,5]})PresentT (fromList [1,2,5])predicate-typedinvokes y,pz @ToListExt (M.fromList [(1,'x'),(4,'y')])PresentT [(1,'x'),(4,'y')]pz @ToListExt (T.pack "abc")PresentT "abc"predicate-typed similar to z"pz @(ToList' Id) ("aBc" :: String)PresentT "aBc"pz @(ToList' Id) (Just 14) PresentT [14]pz @(ToList' Id) Nothing PresentT []pz @(ToList' Id) (Left "xx") PresentT [] pz @(ToList' Id) (These 12 "xx")PresentT ["xx"]predicate-typed similar to zpz @ToList ("aBc" :: String)PresentT "aBc"pz @ToList (Just 14) PresentT [14]pz @ToList Nothing PresentT []pz @ToList (Left "xx") PresentT []pz @ToList (These 12 "xx")PresentT ["xx"]predicate-typed similar to {$pz @(IToList _ Id) ("aBc" :: String)"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'pl @(Lt 4) 123False (123 < 4)FalseT pl @(Lt 4) 1 True (1 < 4)TrueTpl @(Negate 7 <..> 20) (-4)True (-7 <= -4 <= 20)TrueTpl @(Negate 7 <..> 20) 21False (21 <= 20)FalseTpredicate-typed!compare two strings ignoring case&pz @(Fst Id ===~ Snd Id) ("abC","aBc") PresentT EQ'pz @(Fst Id ===~ Snd Id) ("abC","DaBc") PresentT LTpredicate-typed similar to |pz @(Fst Id ==! Snd Id) (10,9) PresentT GT)pz @(14 % 3 ==! Fst Id -% Snd Id) (-10,7) PresentT GTpz @(Fst Id ==! Snd Id) (10,11) PresentT LTDpz @(Snd Id ==! (Fst Id >> Snd Id >> Head Id)) (('x',[10,12,13]),10) PresentT EQ:pz @(Snd Id ==! Head (Snd (Fst Id))) (('x',[10,12,13]),10) PresentT EQpredicate-typed} function on a booleanpz @(IdBool Id) FalseFalseTpz @(IdBool Id) TrueTrueTpz @(IdBool (Fst Id)) (True,22)TrueTpl @(IdBool (Lt 3)) 13False (IdBool (13 < 3))FalseTpredicate-typed~ functionpz @(Not Id) FalseTrueTpz @(Not Id) TrueFalseTpz @(Not (Fst Id)) (True,22)FalseTpl @(Not (Lt 3)) 13True (Not (13 < 3))TrueT predicate-typed implication;pz @(Fst Id ~> (Length (Snd Id) >= 4)) (True,[11,12,13,14])TrueT>pz @(Fst Id ~> (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseT?pz @(Fst Id ~> (Length (Snd Id) == 4)) (False,[12,11,12,13,14])TrueT<pz @(Fst Id ~> (Length (Snd Id) >= 4)) (False,[11,12,13,14])TrueT!predicate-typed#short circuit version of boolean Or!pl @(Id > 10 ||~ Failt _ "ss") 11True (True ||~ _ | (11 > 10))TrueTpz @(Id > 10 ||~ Id == 9) 9TrueTpl @(Id > 10 ||~ Id > 9) 9.False (False ||~ False | (9 > 10) ||~ (9 > 9))FalseT"predicate-typed similar to <pz @(Fst Id || (Length (Snd Id) >= 4)) (False,[11,12,13,14])TrueTDpz @(Not (Fst Id) || (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseT#predicate-typed$short circuit version of boolean And pl @(Id > 10 &&~ Failt _ "ss") 9False (False &&~ _ | (9 > 10))FalseTpl @(Id > 10 &&~ Id == 12) 11#False (True &&~ False | (11 == 12))FalseTpl @(Id > 10 &&~ Id == 11) 11True (True &&~ True)TrueT$predicate-typed similar to #pz @(Fst Id && Snd Id) (True, True)TrueTpz @(Id > 15 && Id < 17) 16TrueTpz @(Id > 15 && Id < 17) 30FalseT;pz @(Fst Id && (Length (Snd Id) >= 4)) (True,[11,12,13,14])TrueT>pz @(Fst Id && (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseT'predicate-typed"This is composition for predicates,pz @(Fst Id >> Succ (Id !! 0)) ([11,12],'x') PresentT 12>pz @(Len *** Succ Id >> ShowP (First (Pred Id))) ([11,12],'x')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 failure,predicate-typed similar to .M but uses the root message of the False predicate case as the failure messagezmost uses of GuardSimple can be replaced by a boolean predicate unless you require a failure message instead of true/false"pz @(GuardSimple (Luhn Id)) [1..4]5FailT "(Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])"pl @(Luhn Id) [1..4]3False (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])FalseT%pz @(GuardSimple (Luhn Id)) [1,2,3,0]PresentT [1,2,3,0]&pz @(GuardSimple (Len > 30)) [1,2,3,0]FailT "(4 > 30)".predicate-typed?'p' is the predicate and on failure of the predicate runs 'prt'$pz @(Guard "expected > 3" (Gt 3)) 17 PresentT 17#pz @(Guard "expected > 3" (Gt 3)) 1FailT "expected > 3"1pz @(Guard (PrintF "%d not > 3" Id) (Gt 3)) (-99)FailT "-99 not > 3"/predicate-typed leverages X. for repeating predicates (passthrough method)ipz @(GuardsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,256]1FailT "id=3 must be between 0 and 255, found 256"hpz @(GuardsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,44]PresentT [121,33,7,44]predicate-typedfif a predicate fails then then the corresponding symbol and value will be passed to the print functionpz @(GuardsDetail "%s invalid: found %d" '[ '("hours", Between 0 23 Id),'("minutes",Between 0 59 Id),'("seconds",Between 0 59 Id)]) [13,59,61]!FailT "seconds invalid: found 61"pz @(GuardsDetail "%s invalid: found %d" '[ '("hours", Between 0 23 Id),'("minutes",Between 0 59 Id),'("seconds",Between 0 59 Id)]) [27,59,12]FailT "hours invalid: found 27"pz @(GuardsDetail "%s invalid: found %d" '[ '("hours", Between 0 23 Id),'("minutes",Between 0 59 Id),'("seconds",Between 0 59 Id)]) [23,59,12]PresentT [23,59,12]1predicate-typed leverages X. for repeating predicates (passthrough method)hpl @(BoolsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,256]HFalse (Bool(3) [id=3 must be between 0 and 255, found 256] (256 <= 255))FalseTgpl @(BoolsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,44] True (Bools)TrueT3predicate-typedRboolean guard which checks a given a list of predicates against the list of valuesprefer 3 as 2u doesnt give much added value: passes in the index and the value to prt but you already have the index in the message;pulls the top message from the tree if a predicate is false}pl @(Bools '[ '(W "hh",Between 0 23 Id), '(W "mm",Between 0 59 Id), '(PrintT "<<<%d %d>>>" Id,Between 0 59 Id) ] ) [12,93,14]False (Bool(1) [mm] (93 <= 59))FalseT}pl @(Bools '[ '(W "hh",Between 0 23 Id), '(W "mm",Between 0 59 Id), '(PrintT "<<<%d %d>>>" Id,Between 0 59 Id) ] ) [12,13,94]'False (Bool(2) [<<<2 94>>>] (94 <= 59))FalseT}pl @(Bools '[ '(W "hh",Between 0 23 Id), '(W "mm",Between 0 59 Id), '(PrintT "<<<%d %d>>>" Id,Between 0 59 Id) ] ) [12,13,14] True (Bools)TrueTVpl @(BoolsQuick "abc" '[Between 0 23 Id, Between 0 59 Id, Between 0 59 Id]) [12,13,14] True (Bools)TrueTkpl @(BoolsQuick (PrintT "id=%d val=%d" Id) '[Between 0 23 Id, Between 0 59 Id, Between 0 59 Id]) [12,13,14] True (Bools)TrueTkpl @(BoolsQuick (PrintT "id=%d val=%d" Id) '[Between 0 23 Id, Between 0 59 Id, Between 0 59 Id]) [12,13,99](False (Bool(2) [id=2 val=99] (99 <= 59))FalseTspl @(Bools '[ '("hours",Between 0 23 Id), '("minutes",Between 0 59 Id), '("seconds",Between 0 59 Id) ] ) [12,13,14] True (Bools)TrueTspl @(Bools '[ '("hours",Between 0 23 Id), '("minutes",Between 0 59 Id), '("seconds",Between 0 59 Id) ] ) [12,60,14]$False (Bool(1) [minutes] (60 <= 59))FalseTvpl @(Bools '[ '("hours",Between 0 23 Id), '("minutes",Between 0 59 Id), '("seconds",Between 0 59 Id) ] ) [12,60,14,20]*False (Bools:invalid length(4) expected 3)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]PresentT [17,4]Gpz @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 5)]) [17,4]FailT "arg2 failed"Hpz @(Guards '[ '("arg1 failed",Gt 99), '("arg2 failed", Same 4)]) [17,4]FailT "arg1 failed"epz @(Guards '[ '(PrintT "arg %d failed with value %d" Id,Gt 4), '(PrintT "%d %d" Id, Same 4)]) [17,3] FailT "1 3"Zpz @(GuardsQuick (PrintT "arg %d failed with value %d" Id) '[Gt 4, Ge 3, Same 4]) [17,3,5]!FailT "arg 2 failed with value 5"]pz @(GuardsQuick (PrintT "arg %d failed with value %d" Id) '[Gt 4, Ge 3, Same 4]) [17,3,5,99]+FailT "Guards:invalid length(4) expected 3"8predicate-typed similar to &pz @(QuotRem (Fst Id) (Snd Id)) (10,3)PresentT (3,1)'pz @(QuotRem (Fst Id) (Snd Id)) (10,-3)PresentT (-3,1)(pz @(QuotRem (Fst Id) (Snd Id)) (-10,-3)PresentT (3,-1)'pz @(QuotRem (Fst Id) (Snd Id)) (-10,3)PresentT (-3,-1)&pz @(QuotRem (Fst Id) (Snd Id)) (10,0) FailT "QuotRem zero denominator"9predicate-typed similar to %pz @(DivMod (Fst Id) (Snd Id)) (10,3)PresentT (3,1)&pz @(DivMod (Fst Id) (Snd Id)) (10,-3)PresentT (-4,-2)&pz @(DivMod (Fst Id) (Snd Id)) (-10,3)PresentT (-4,2)'pz @(DivMod (Fst Id) (Snd Id)) (-10,-3)PresentT (3,-1)%pz @(DivMod (Fst Id) (Snd Id)) (10,0)FailT "DivMod zero denominator":predicate-typed similar to "pz @(Mod (Fst Id) (Snd Id)) (10,3) PresentT 1"pz @(Mod (Fst Id) (Snd Id)) (10,0)FailT "Mod zero denominator";predicate-typed similar to "pz @(Div (Fst Id) (Snd Id)) (10,4) PresentT 2"pz @(Div (Fst Id) (Snd Id)) (10,0)FailT "Div zero denominator"=predicate-typed similar to !pz @(Map Even Id) [9,-4,12,1,2,3]+PresentT [False,True,True,False,True,False](pz @(Map '(Even,Odd) Id) [9,-4,12,1,2,3]XPresentT [(False,True),(True,False),(True,False),(False,True),(True,False),(False,True)]?predicate-typedcatch a failureRpz @(Catch (Succ Id) (Fst Id >> Second (ShowP Id) >> PrintT "%s %s" Id >> 'LT)) GT PresentT LTBpz @(Catch' (Succ Id) (Second (ShowP Id) >> PrintT "%s %s" Id)) GT=FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument GT"Bpz @(Catch' (Succ Id) (Second (ShowP Id) >> PrintT "%s %s" Id)) LT PresentT EQ3pz @(Len > 1 && Catch (Id !! 3 == 66) 'False) [1,2]FalseTmore 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 typeEpredicate-typed$Fails the computation with a message+pz @(Failt Int (PrintF "value=%03d" Id)) 99FailT "value=099">pz @(FailS (PrintT "value=%03d string=%s" Id)) (99,"somedata")!FailT "value=099 string=somedata"Gpredicate-typed similar to (pz @(Break (Ge 3) Id) [10,4,1,7,3,1,3,5] PresentT ([],[10,4,1,7,3,1,3,5])(pz @(Break (Lt 3) Id) [10,4,1,7,3,1,3,5]PresentT ([10,4],[1,7,3,1,3,5])Ipredicate-typed similar to 3pz @(GroupBy (Fst Id == Snd Id) Id) [1,3,4,5,1,5,5]$PresentT [[1],[3],[4],[5],[1],[5,5]]7pz @(GroupBy (Fst Id == Snd Id) Id) [1,1,1,3,4,5,1,5,5](PresentT [[1,1,1],[3],[4],[5],[1],[5,5]])pz @(GroupBy (Fst Id == Snd Id) Id) [5,5]PresentT [[5,5]])pz @(GroupBy (Fst Id == Snd Id) Id) [1,2]PresentT [[1],[2]]'pz @(GroupBy (Fst Id == Snd Id) Id) [1]PresentT [[1]]&pz @(GroupBy (Fst Id == Snd Id) Id) [] PresentT []2pz @(GroupBy (Fst Id < Snd Id) Id) [1,2,3,4,4,1,2]PresentT [[1,2,3,4],[4],[1,2]]3pz @(GroupBy (Fst Id /= Snd Id) Id) [1,2,3,4,4,4,1]PresentT [[1,2,3,4],[4],[4,1]]7pan @(GroupBy (Fst Id == Snd Id) Id) "hello goodbye""<P GroupBy ["h","e","ll","o"," ","g","oo","d","b","y","e"]|+- P Id "hello goodbye"|+- False i=0:'h' == 'e'|+- False i=1:'e' == 'l'|+- True i=2:'l' == 'l'|+- False i=3:'l' == 'o'|+- False i=4:'o' == ' '|+- True i=5:' ' == ' '|+- True i=6:' ' == ' '|+- True i=7:' ' == ' '|+- False i=8:' ' == 'g'|+- False i=9:'g' == 'o'|+- True i=10:'o' == 'o'|+- False i=11:'o' == 'd'|+- False i=12:'d' == 'b'|+- False i=13:'b' == 'y'|`- False i=14:'y' == 'e';PresentT ["h","e","ll","o"," ","g","oo","d","b","y","e"]Jpredicate-typed$partition values based on a functionfpz @(PartitionBy Ordering (Case 'EQ '[Id < 0, Id > 0] '[ 'LT, 'GT] Id) Id) [-4,-2,5,6,7,0,-1,2,-3,4,0]DPresentT (fromList [(LT,[-3,-1,-2,-4]),(EQ,[0,0]),(GT,[4,2,7,6,5])])zpl @(PartitionBy Ordering (Case (Failt _ "asdf") '[Id < 2, Id == 2, Id > 2] '[ 'LT, 'EQ, 'GT] Id) Id) [-4,2,5,6,7,1,2,3,4]Present fromList [(LT,[1,-4]),(EQ,[2,2]),(GT,[4,3,7,6,5])] (PartitionBy fromList [(LT,[1,-4]),(EQ,[2,2]),(GT,[4,3,7,6,5])] | s=[-4,2,5,6,7,1,2,3,4])=PresentT (fromList [(LT,[1,-4]),(EQ,[2,2]),(GT,[4,3,7,6,5])])pl @(PartitionBy Ordering (Case (Failt _ "xyzxyzxyzzyyysyfsyfydf") '[Id < 2, Id == 2, Id > 3] '[ 'LT, 'EQ, 'GT] Id) Id) [-4,2,5,6,7,1,2,3,4]<Error xyzxyzxyzzyyysyfsyfydf (PartitionBy(i=7, a=3) excnt=1)FailT "xyzxyzxyzzyyysyfsyfydf"Kpredicate-typed similar to ,pz @(Partition (Ge 3) Id) [10,4,1,7,3,1,3,5]PresentT ([10,4,7,3,3,5],[1,1])0pz @(Partition (Prime Id) Id) [10,4,1,7,3,1,3,5]PresentT ([7,3,3,5],[10,4,1,1]).pz @(Partition (Ge 300) Id) [10,4,1,7,3,1,3,5] PresentT ([],[10,4,1,7,3,1,3,5])0pz @(Partition (Id < 300) Id) [10,4,1,7,3,1,3,5] PresentT ([10,4,1,7,3,1,3,5],[])Lpredicate-typedNcreates a list of overlapping pairs of elements. requires two or more elementspz @Pairs [1,2,3,4]PresentT [(1,2),(2,3),(3,4)] pz @Pairs []FailT "Pairs no data found" pz @Pairs [1]$FailT "Pairs only one element found"Mpredicate-typedif p then run q else run r>pz @(If (Gt 4) "greater than 4" "less than or equal to 4" ) 10PresentT "greater than 4"<pz @(If (Gt 4) "greater than 4" "less than or equal to 4") 0"PresentT "less than or equal to 4"ppz @(If (Snd Id == "a") '("xxx",Fst Id + 13) (If (Snd Id == "b") '("yyy",Fst Id + 7) (Failt _ "oops"))) (99,"b")PresentT ("yyy",106)Opredicate-typed similar to pz @(Map (Pred Id) Id) [1..5]PresentT [0,1,2,3,4]Tpredicate-typedlike # but for a fixed number of elementspz @(IterateN 4 (Succ Id)) 4PresentT [4,5,6,7]Opz @('(0,1) >> IterateN 20 '(Snd Id, Fst Id + Snd Id) >> Map (Fst Id) Id) "sdf"JPresentT [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181]Upredicate-typed similar to =pz @(Unfoldr (MaybeBool (Not Null) (SplitAt 2 Id)) Id) [1..5]PresentT [[1,2],[3,4],[5]]Zpredicate-typed similar to >pz @(Scanl (Snd Id :+ Fst Id) (Fst Id) (Snd Id)) ([99],[1..5])FPresentT [[99],[1,99],[2,1,99],[3,2,1,99],[4,3,2,1,99],[5,4,3,2,1,99]]pz @(ScanN 4 Id (Succ Id)) 'c'PresentT "cdefg"pz @(FoldN 4 Id (Succ Id)) 'c' PresentT 'g'1pz @(Dup >> ScanN 4 Id (Pred Id *** Succ Id)) 'g'<PresentT [('g','g'),('f','h'),('e','i'),('d','j'),('c','k')]^predicate-typed similar to ,. returns a 3-tuple with the results so use      to extractZpz @PartitionThese [This 'a', That 2, This 'c', These 'z' 1, That 4, These 'a' 2, That 99]*PresentT ("ac",[2,4,99],[('z',1),('a',2)])_predicate-typed similar to Apz @PartitionEithers [Left 'a',Right 2,Left 'c',Right 4,Right 99]PresentT ("ac",[2,4,99])/pz @PartitionEithers [Right 2,Right 4,Right 99]PresentT ([],[2,4,99])(pz @PartitionEithers [Left 'a',Left 'c']PresentT ("ac",[]),pz @PartitionEithers ([] :: [Either () Int])PresentT ([],[])`predicate-typed similar to Gpz @(EnumFromThenTo (ToEnum Day 10) (ToEnum Day 20) (ToEnum Day 70)) ()WPresentT [1858-11-27,1858-12-07,1858-12-17,1858-12-27,1859-01-06,1859-01-16,1859-01-26]bpz @(EnumFromThenTo (ReadP Day "2020-01-12") (ReadP Day "2020-02-12") (ReadP Day "2020-08-12")) ()WPresentT [2020-01-12,2020-02-12,2020-03-14,2020-04-14,2020-05-15,2020-06-15,2020-07-16]bpredicate-typed similar to pz @(2 ... 5) ()PresentT [2,3,4,5]pz @('LT ... 'GT) ()PresentT [LT,EQ,GT]pz @(EnumFromTo 'GT 'LT) () PresentT []0pz @(EnumFromTo (Pred Id) (Succ Id)) (SG.Max 10)?PresentT [Max {getMax = 9},Max {getMax = 10},Max {getMax = 11}]npz @(EnumFromTo 1 20 >> Map '(Id, (If (Id `Mod` 3 == 0) "Fizz" "" <> If (Id `Mod` 5 == 0) "Buzz" "" )) Id) 123PresentT [(1,""),(2,""),(3,"Fizz"),(4,""),(5,"Buzz"),(6,"Fizz"),(7,""),(8,""),(9,"Fizz"),(10,"Buzz"),(11,""),(12,"Fizz"),(13,""),(14,""),(15,"FizzBuzz"),(16,""),(17,""),(18,"Fizz"),(19,""),(20,"Buzz")]cpredicate-typed similar to  using pz @Null [1,2,3,4]FalseT pz @Null []TrueTpz @Null NothingTrueTepredicate-typed similar to  using pz @IsEmpty [1,2,3,4]FalseTpz @IsEmpty []TrueTpz @IsEmpty LTFalseTpz @IsEmpty EQTrueTfpredicate-typedpz @Unsnoc [1,2,3,4]PresentT (Just ([1,2,3],4)) pz @Unsnoc []PresentT Nothingpz @Unsnoc ("xyz" :: T.Text)PresentT (Just ("xy",'z'))gpredicate-typedpz @Uncons [1,2,3,4]PresentT (Just (1,[2,3,4])) pz @Uncons []PresentT Nothingpz @Uncons (Seq.fromList "abc")#PresentT (Just ('a',fromList "bc"))pz @Uncons ("xyz" :: T.Text)PresentT (Just ('x',"yz"))hpredicate-typedsimilar to snoc%pz @(Snd Id +: Fst Id) (99,[1,2,3,4])PresentT [1,2,3,4,99]pz @(Fst Id +: Snd Id) ([],5) PresentT [5]pz @(EmptyT [] Id +: 5) 5 PresentT [5]ipredicate-typedsimilar to cons%pz @(Fst Id :+ Snd Id) (99,[1,2,3,4])PresentT [99,1,2,3,4]pz @(Snd Id :+ Fst Id) ([],5) PresentT [5]$pz @(123 :+ EmptyList _) "somestuff"PresentT [123]jpredicate-typedsimilar to (++),pz @(Fst Id ++ Snd Id) ([9,10,11],[1,2,3,4])PresentT [9,10,11,1,2,3,4]pz @(Snd Id ++ Fst Id) ([],[5]) PresentT [5]+pz @(Char1 "xyz" :+ W "ab" ++ W "cdefg") ()PresentT "xabcdefg"(pz @([1,2,3] ++ EmptyList _) "somestuff"PresentT [1,2,3]kpredicate-typed%& pz @(Ors Id) [False,False,False]FalseT#pl @(Ors Id) [True,True,True,False]*True (Ors(4) i=0 | [True,True,True,False])TrueTpl @(Ors Id) []False (Ors(0) | [])FalseTlpredicate-typed%'pz @(Ands Id) [True,True,True]TrueT$pl @(Ands Id) [True,True,True,False],False (Ands(4) i=3 | [True,True,True,False])FalseTpz @(Ands Id) []TrueTnpredicate-typed leveraging )pz @(Lookup Id 2) ["abc","D","eF","","G"]PresentT (Just "eF")*pz @(Lookup Id 20) ["abc","D","eF","","G"]PresentT NothingVpl @((Id !!? Char1 "d") > MkJust 99 || Length Id <= 3) (M.fromList $ zip "abcd" [1..])7False (False || False | (Just 4 > Just 99) || (4 <= 3))FalseTUpz @((Id !!? Char1 "d") > MkJust 2 || Length Id <= 3) (M.fromList $ zip "abcd" [1..])TrueTopredicate-typed similar to  leveraging %pz @(Id !! 2) ["abc","D","eF","","G"] PresentT "eF"&pz @(Id !! 20) ["abc","D","eF","","G"]FailT "(!!) index not found"%import qualified Data.Map.Strict as MFpz @(Id !! "eF") (M.fromList (flip zip [0..] ["abc","D","eF","","G"])) PresentT 2ppredicate-typed similar to  leveraging 1pz @(IxL Id 2 "notfound") ["abc","D","eF","","G"] PresentT "eF"2pz @(IxL Id 20 "notfound") ["abc","D","eF","","G"]PresentT "notfound"rpredicate-typed similar to .pz @(Ix 4 "not found") ["abc","D","eF","","G"] PresentT "G"/pz @(Ix 40 "not found") ["abc","D","eF","","G"]PresentT "not found"upredicate-typed similar to  but for a fixed number 'n'pz @(Cycle 5 Id) [1,2]PresentT [1,2,1,2,1]vpredicate-typed similar to 'pz @(Concat Id) ["abc","D","eF","","G"]PresentT "abcDeFG"3pz @(Concat (Snd Id)) ('x',["abc","D","eF","","G"])PresentT "abcDeFG"wpredicate-typedsimilar to a limited form of 'pz @(FoldMap (SG.Sum _) Id) [44, 12, 3] PresentT 59+pz @(FoldMap (SG.Product _) Id) [44, 12, 3] PresentT 1584type Ands' p = FoldMap SG.All p%pz @(Ands' Id) [True,False,True,True]PresentT Falsepz @(Ands' Id) [True,True,True] PresentT Truepz @(Ands' Id) [] PresentT Truetype Ors' p = FoldMap SG.Any p!pz @(Ors' Id) [False,False,False]PresentT Falsepz @(Ors' Id) []PresentT False&pz @(Ors' Id) [False,False,False,True] PresentT True4type AllPositive' = FoldMap SG.All (Map Positive Id) pz @AllPositive' [3,1,-5,10,2,3]PresentT False4type AllNegative' = FoldMap SG.All (Map Negative Id)"pz @AllNegative' [-1,-5,-10,-2,-3] PresentT True:set -XKindSignaturesZtype Max' (t :: Type) = FoldMap (SG.Max t) Id -- requires t be Bounded for monoid instancepz @(Max' Int) [10,4,5,12,3,4] PresentT 12ypredicate-typed similar to =pz @(ToNEList >> SConcat Id) [SG.Sum 44, SG.Sum 12, SG.Sum 3]PresentT (Sum {getSum = 59})Tpz @(Map '(Pure SG.Sum Id, Pure SG.Max Id) Id >> ToNEList >> SConcat Id) [7,6,1,3,5]-PresentT (Sum {getSum = 22},Max {getMax = 7})zpredicate-typed similar to 1pz @(MConcat Id) [SG.Sum 44, SG.Sum 12, SG.Sum 3]PresentT (Sum {getSum = 59})hpz @(Map '(Pure SG.Sum Id, Pure SG.Max Id) Id >> MConcat Id) [7 :: Int,6,1,3,5] -- monoid so need eg Int-PresentT (Sum {getSum = 22},Max {getMax = 7}){predicate-typed& constructor(pz @(MkThese (Fst Id) (Snd Id)) (44,'x')PresentT (These 44 'x')}predicate-typedv constructorpz @(MkThat _ Id) 44PresentT (That 44)predicate-typedu constructorpz @(MkThis _ Id) 44PresentT (This 44)(pz @(Proxy Int >> MkThis' Unproxy 10) []PresentT (This 10)predicate-typed constructorpz @(MkRight _ Id) 44PresentT (Right 44)predicate-typed constructorpz @(MkLeft _ Id) 44PresentT (Left 44)predicate-typed() constructorpz @(MkJust Id) 44PresentT (Just 44)predicate-typed similar to pz @(EmptyT Maybe Id) ()PresentT Nothingpz @(EmptyT [] Id) () PresentT []%pz @(EmptyT [] (Char1 "x")) (13,True) PresentT ""/pz @(EmptyT (Either String) (Fst Id)) (13,True)PresentT (Left "")predicate-typed similar to pz @(MEmptyT (SG.Sum Int)) ()PresentT (Sum {getSum = 0})Bno Monoid for Maybe a unless a is also a monoid but can use empty!predicate-typed similar to pz @(Pure Maybe Id) 4PresentT (Just 4)pz @(Pure [] Id) 4 PresentT [4]-pz @(Pure (Either String) (Fst Id)) (13,True)PresentT (Right 13)predicate-typed similar to pz @(STimes 4 Id) (SG.Sum 3)PresentT (Sum {getSum = 12})pz @(STimes 4 Id) "ab"PresentT "abababab"predicate-typed similar to *+?pl @(CatMaybes Id) [Just 'a',Nothing,Just 'c',Just 'd',Nothing]2Present "acd" (Concat "acd" | ["a","","c","d",""])PresentT "acd"predicate-typed similar to pz @(IsNothing Id) (Just 123)FalseTpz @(IsNothing Id) NothingTrueTpredicate-typed similar to pz @(IsJust Id) NothingFalseTpz @(IsJust Id) (Just 'a')TrueTpredicate-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) PresentT "19"7pz @(MaybeIn "found nothing" (ShowP (Pred Id))) NothingPresentT "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)PresentT "132"Lpz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (This 123)PresentT (123,"fromthis")Spz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (That "fromthat")PresentT (-99,"fromthat")Ypz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (These 123 "fromthese")PresentT (123,"fromthese")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)PresentT "132"Opz @(EitherX (ShowP (Fst (Fst Id) + Snd Id)) (ShowP Id) (Snd Id)) (9,Right 'x')PresentT "((9,Right 'x'),'x')"Jpz @(EitherX (ShowP Id) (ShowP (Second (Succ Id))) (Snd Id)) (9,Right 'x')PresentT "((9,Right 'x'),'y')"predicate-typed takes the head of a list or failsee H for other supported types eg 2pz @(HeadFail "dude" Id) [ "abc","def","asdfadf" ]PresentT "abc"!pz @(HeadFail "empty list" Id) []FailT "empty list"predicate-typed/takes the head or default of a list-like objectsee H for other supported types eg pz @(HeadDef 444 Id) [] PresentT 444pz @(HeadDef 444 Id) [1..5] PresentT 1pz @(HeadDef 444 Id) [1..5] PresentT 14pz @(HeadDef (Char1 "w") Id) (Seq.fromList "abcdef") PresentT 'a'&pz @(HeadDef (Char1 "w") Id) Seq.empty PresentT 'w':set -XFlexibleContexts1pz @(HeadDef (MEmptyT _) Id) ([] :: [SG.Sum Int])PresentT (Sum {getSum = 0})<pz @(HeadDef (MEmptyT String) '[ "abc","def","asdfadf" ]) ()PresentT "abc"Bpz @(HeadDef (MEmptyT _) (Snd Id)) (123,[ "abc","def","asdfadf" ])PresentT "abc"+pz @(HeadDef (MEmptyT _) (Snd Id)) (123,[]) PresentT ()predicate-typedsimilar to fmap sndpz @FMapSnd (Just ("asf",13))PresentT (Just 13)predicate-typedsimilar to fmap fstpz @FMapFst (Just (13,"Asf"))PresentT (Just 13)to make this work we grab the fst or snd out of the Maybe so it is a head or not/ is a tail or not etc! we still have access to the whole original list so we dont lose anything!predicate-typed function+pz @(Elem (Fst Id) (Snd Id)) ('x',"abcdxy")TrueT+pz @(Elem (Fst Id) (Snd Id)) ('z',"abcdxy")FalseTpredicate-typed<filters a list 'q' keeping or removing those elements in 'p'!pz @(Keep '[5] '[1,5,5,2,5,2]) ()PresentT [5,5,5]'pz @(Keep '[0,1,1,5] '[1,5,5,2,5,2]) ()PresentT [1,5,5,5]#pz @(Remove '[5] '[1,5,5,2,5,2]) ()PresentT [1,2,2])pz @(Remove '[0,1,1,5] '[1,5,5,2,5,2]) ()PresentT [2,2]$pz @(Remove '[99] '[1,5,5,2,5,2]) ()PresentT [1,5,5,2,5,2]'pz @(Remove '[99,91] '[1,5,5,2,5,2]) ()PresentT [1,5,5,2,5,2]!pz @(Remove Id '[1,5,5,2,5,2]) []PresentT [1,5,5,2,5,2]Fpz @(Remove '[] '[1,5,5,2,5,2]) 44 -- works if you make this a number!PresentT [1,5,5,2,5,2]predicate-typedget the next prime numberpz @(PrimeNext Id) 6 PresentT 7!pz @(IterateN 4 (PrimeNext Id)) 3PresentT [3,5,7,11]predicate-typeda predicate on prime numberspz @(Prime Id) 2TrueT#pz @(Map '(Id,Prime Id) Id) [0..12]PresentT [(0,False),(1,False),(2,True),(3,True),(4,False),(5,True),(6,False),(7,True),(8,False),(9,False),(10,False),(11,True),(12,False)]predicate-typedbounded  functionpz @(ToEnumBDef Ordering LT) 2 PresentT GTpz @(ToEnumBDef Ordering LT) 6 PresentT LTpz @(ToEnumBFail Ordering) 6FailT "ToEnum bounded"predicate-typedunsafe  functionpz @(ToEnum Char Id) 120 PresentT 'x'predicate-typed functionpz @(FromEnum Id) 'x' PresentT 120predicate-typed unbounded  functionpz @(Pred Id) 13 PresentT 12pz @(Pred Id) LT:FailT "Pred IO e=Prelude.Enum.Ordering.pred: bad argument"predicate-typed unbounded  functionpz @(Succ Id) 13 PresentT 14pz @(Succ Id) LT PresentT EQpz @(Succ Id) GT:FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument"predicate-typedbounded  functionpz @(PredB' Id) (13 :: Int) PresentT 12pz @(PredB' Id) LTFailT "Pred bounded"predicate-typedunassoc using "pz @Unassoc (These 123 (This 'x'))PresentT (This (These 123 'x'))pz @Unassoc (99,('a',True))PresentT ((99,'a'),True)2pz @Unassoc (This 10 :: These Int (These Bool ()))PresentT (This (This 10))pz @Unassoc (Right (Right 123))PresentT (Right 123):pz @Unassoc (Left 'x' :: Either Char (Either Bool Double))PresentT (Left (Left 'x'))predicate-typed assoc using  pz @Assoc (This (These 123 'x'))PresentT (These 123 (This 'x'))pz @Assoc ((99,'a'),True)PresentT (99,('a',True))pz @Assoc ((99,'a'),True)PresentT (99,('a',True))7pz @Assoc (Right "Abc" :: Either (Either () ()) String)PresentT (Right (Right "Abc"))pz @Assoc (Left (Left 'x'))PresentT (Left 'x')predicate-typed swaps using pz @Swap (Left 123)PresentT (Right 123)pz @Swap (Right 123)PresentT (Left 123)pz @Swap (These 'x' 123)PresentT (These 123 'x')pz @Swap (This 'x')PresentT (That 'x')pz @Swap (That 123)PresentT (This 123)pz @Swap (123,'x')PresentT ('x',123)pz @Swap (Left "abc")PresentT (Right "abc")pz @Swap (Right 123)PresentT (Left 123)predicate-typedreverses using pz @ReverseL (T.pack "AbcDeF")PresentT "FeDcbA"!pz @ReverseL ("AbcDeF" :: String)PresentT "FeDcbA"predicate-typed similar to pz @Reverse [1,2,4]PresentT [4,2,1]pz @Reverse "AbcDeF"PresentT "FeDcbA"predicate-typedlift pure over a Functor#pz @(Pure2 (Either String)) [1,2,4]"PresentT [Right 1,Right 2,Right 4]predicate-typedlift mempty over a FunctorHpz @(MEmpty2 (SG.Product Int)) [Identity (-13), Identity 4, Identity 99]UPresentT [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}]predicate-typedsee : coerce over a functorHpz @(Coerce2 (SG.Sum Integer)) [Identity (-13), Identity 4, Identity 99]@PresentT [Sum {getSum = -13},Sum {getSum = 4},Sum {getSum = 99}]6pz @(Coerce2 (SG.Sum Integer)) (Just (Identity (-13)))$PresentT (Just (Sum {getSum = -13}))4pz @(Coerce2 (SG.Sum Int)) (Nothing @(Identity Int))PresentT Nothingpredicate-typed similar to .pz @(Coerce (SG.Sum Integer)) (Identity (-13))PresentT (Sum {getSum = -13})predicate-typedwraps a value (see  and )pz @(Wrap (SG.Sum _) Id) (-13)PresentT (Sum {getSum = -13})pz @(Wrap SG.Any (Ge 4)) 13PresentT (Any {getAny = True})3pz @(Wrap (NonEmpty _) (Uncons >> 'Just Id)) "abcd"PresentT ('a' :| "bcd")predicate-typedunwraps a value (see )pz @(Unwrap Id) (SG.Sum (-13))PresentT (-13)predicate-typed similar to pz @(Signum Id) (-14) PresentT (-1)pz @(Signum Id) 14 PresentT 1pz @(Signum Id) 0 PresentT 0predicate-typed similar to pz @(Abs Id) (-14) PresentT 14pz @(Abs (Snd Id)) ("xx",14) PresentT 14pz @(Abs Id) 0 PresentT 0pz @(Abs (Negate 44)) "aaa" PresentT 44predicate-typed similar to pz @(Negate Id) 14PresentT (-14)%pz @(Negate (Fst Id * Snd Id)) (14,3)PresentT (-42)pz @(Negate (15 -% 4)) "abc"PresentT (15 % 4)pz @(Negate (15 % 3)) ()PresentT ((-5) % 1)%pz @(Negate (Fst Id % Snd Id)) (14,3)PresentT ((-14) % 3)predicate-typed creates a  valuepz @(Id < 21 % 5) (-3.1)TrueTpz @(Id < 21 % 5) 4.5FalseTpz @(Fst Id % Snd Id) (13,2)PresentT (13 % 2)pz @(13 % Id) 0FailT "(%) zero denominator"pz @(4 % 3 + 5 % 7) "asfd"PresentT (43 % 21)pz @(4 -% 7 * 5 -% 3) "asfd"PresentT (20 % 21)pz @(Negate (14 % 3)) ()PresentT ((-14) % 3)pz @(14 % 3) ()PresentT (14 % 3)6pz @(Negate (14 % 3) ==! FromIntegral _ (Negate 5)) () PresentT GTpz @(14 -% 3 ==! 5 -% 1) "aa" PresentT GT)pz @(Negate (14 % 3) ==! Negate 5 % 2) () PresentT LTpz @(14 -% 3 * 5 -% 1) ()PresentT (70 % 3)pz @(14 % 3 ==! 5 % 1) () PresentT LTpz @(15 % 3 / 4 % 2) ()PresentT (5 % 2)predicate-typedfractional divisionpz @(Fst Id / Snd Id) (13,2) PresentT 6.5pz @(ToRational 13 / Id) 0FailT "(/) zero denominator"pz @(12 % 7 / 14 % 5 + Id) 12.4PresentT (3188 % 245)predicate-typed(addition, multiplication and subtractionpz @(Fst Id * Snd Id) (13,5) PresentT 652pz @(Fst Id + 4 * Length (Snd Id) - 4) (3,"hello") PresentT 19predicate-typed similar to ;pz @(Fst Id `LogBase` Snd Id >> Truncate Int Id) (10,12345) PresentT 4predicate-typedsimilar to 'GHC.Float.(**)'pz @(Fst Id ** Snd Id) (10,4)PresentT 10000.0Hpz @'(Prime Id,Id ^ 3,(FromIntegral _ Id) ** (FromRational _ (1 % 2))) 4PresentT (False,64,2.0)predicate-typedsimilar to 'GHC.Real.(^)'pz @(Fst Id ^ Snd Id) (10,4)PresentT 10000predicate-typedsimilar pz @(Pred Id +++ Id) (Left 13)PresentT (Left 12)*pz @(ShowP Id +++ Reverse) (Right "hello")PresentT (Right "olleh")predicate-typed similar to pz @(IsRight Id) (Right 123)TrueTpz @(IsRight Id) (Left "aa")FalseTpredicate-typed similar to pz @(IsLeft Id) (Right 123)FalseTpz @(IsLeft Id) (Left 'a')TrueTpredicate-typedsimilar pz @(Pred Id ||| Id) (Left 13) PresentT 12%pz @(ShowP Id ||| Id) (Right "hello")PresentT "hello"predicate-typed similar to %pz @(Pred Id *** ShowP Id) (13, True)PresentT (12,"True")+pl @(FlipT (***) Len (Id * 12)) (99,"cdef")/Present (1188,4) ((***) (1188,4) | (99,"cdef"))PresentT (1188,4)predicate-typed similar to predicate-typed similar to  pz @(SplitAt 4 Id) "hello world"PresentT ("hell","o world")!pz @(SplitAt 20 Id) "hello world"PresentT ("hello world","") pz @(SplitAt 0 Id) "hello world"PresentT ("","hello world")1pz @(SplitAt (Snd Id) (Fst Id)) ("hello world",4)PresentT ("hell","o world"))pz @(SplitAt (Negate 2) Id) "hello world"PresentT ("hello wor","ld")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"$PresentT ["he","llo"," ","w","orld"]$pz @(SplitAts '[2] Id) "hello world"PresentT ["he","llo world"]+pz @(SplitAts '[10,1,1,5] Id) "hello world"!PresentT ["hello worl","d","",""]predicate-typed pad 'q' with '\n' values from '\p'\pz @(PadL 5 999 Id) [12,13]PresentT [999,999,999,12,13](pz @(PadR 5 (Fst Id) '[12,13]) (999,'x')PresentT [12,13,999,999,999]+pz @(PadR 2 (Fst Id) '[12,13,14]) (999,'x')PresentT [12,13,14]predicate-typed&Convenient method to convert a 'p' or '\q' to a Y based on a predicate '\b\'" if 'b' then Right 'p' else Left '\q\'Qpz @(EitherBool (Fst Id > 4) (Snd Id >> Fst Id) (Snd Id >> Snd Id)) (24,(-1,999))PresentT (Right 999)Hpz @(EitherBool (Fst Id > 4) (Fst (Snd Id)) (Snd (Snd Id))) (1,(-1,999))PresentT (Left (-1))predicate-typed.Convenient method to convert a value 'p' to a Z based on a predicate '\b\' if '\b\' then Just 'p' else Nothingpz @(MaybeBool (Id > 4) Id) 24PresentT (Just 24) pz @(MaybeBool (Id > 4) Id) (-5)PresentT Nothingpredicate-typedEprocesses a type level list predicates running each in sequence: see 0pz @(Do [Pred Id, ShowP Id, Id &&& Len]) 9876543PresentT ("9876542",7)=pz @(Do '[W 123, W "xyz", Len &&& Id, Pred Id *** Id<>Id]) ()PresentT (2,"xyzxyz")predicate-typedconverts a value to a J: the same as  '\'Proxy'pz @MkProxy 'x'PresentT Proxypredicate-typed> function where you need to provide the type 't' of the resultpz @(Floor Int Id) (23 % 5) PresentT 4predicate-typed> function where you need to provide the type 't' of the resultpz @(Ceiling Int Id) (23 % 5) PresentT 5predicate-typed> function where you need to provide the type 't' of the resultpz @(Truncate Int Id) (23 % 5) PresentT 4predicate-typed> function where you need to provide the type 't' of the result#pz @(FromRational Rational Id) 23.5PresentT (47 % 2)predicate-typed functionpz @(ToRational Id) 23.5PresentT (47 % 2)predicate-typed> function where you need to provide the type 't' of the result#pz @(FromIntegral (SG.Sum _) Id) 23PresentT (Sum {getSum = 23})predicate-typed> function where you need to provide the type 't' of the result"pz @(FromInteger (SG.Sum _) Id) 23PresentT (Sum {getSum = 23}) pz @(FromInteger Rational 44) 12PresentT (44 % 1) pz @(FromInteger Rational Id) 12PresentT (12 % 1)predicate-typed> function where you need to provide the type 't' of the result:set -XFlexibleContexts&pz @(FromString (Identity _) Id) "abc"PresentT (Identity "abc")(pz @(FromString (Seq.Seq Char) Id) "abc"PresentT (fromList "abc")predicate-typed#similar to 6th element in a n-tuple$pz @(L6 Id) (10,"Abc",'x',True,1,99) PresentT 99predicate-typed#similar to 5th element in a n-tuple!pz @(L5 Id) (10,"Abc",'x',True,1) PresentT 1 predicate-typed#similar to 4th element in a n-tuplepz @(L4 Id) (10,"Abc",'x',True) PresentT True;pz @(L4 (Fst (Snd Id))) ('x',((10,"Abc",'x',999),"aa",1),9) PresentT 999 predicate-typed#similar to 3rd element in a n-tuplepz @(Thd Id) (10,"Abc",133) PresentT 133 pz @(Thd Id) (10,"Abc",133,True) PresentT 133 predicate-typed similar to pz @(Snd Id) (10,"Abc")PresentT "Abc"pz @(Snd Id) (10,"Abc",True)PresentT "Abc"predicate-typed similar to pz @(Fst Id) (10,"Abc") PresentT 10pz @(Fst Id) (10,"Abc",'x') PresentT 10!pz @(Fst Id) (10,"Abc",'x',False) PresentT 10predicate-typed similar to  for  instancespz @(Length Id) (Left "aa") PresentT 0pz @(Length Id) (Right "aa") PresentT 1'pz @(Length (Right' Id)) (Right "abcd") PresentT 4:pz @(Length (Thd (Snd Id))) (True,(23,'x',[10,9,1,3,4,2])) PresentT 6predicate-typed similar to pz @Len [10,4,5,12,3,4] PresentT 6 pz @Len [] PresentT 0predicate-typed sort a listOpz @(SortOn (Fst Id) Id) [(10,"abc"), (3,"def"), (4,"gg"), (10,"xyz"), (1,"z")];PresentT [(1,"z"),(3,"def"),(4,"gg"),(10,"abc"),(10,"xyz")]Gpz @(SortBy (OrdP (Snd Id) (Fst Id)) Id) [(10,"ab"),(4,"x"),(20,"bbb")]'PresentT [(20,"bbb"),(10,"ab"),(4,"x")]!pz @(SortBy 'LT Id) [1,5,2,4,7,0]PresentT [1,5,2,4,7,0]!pz @(SortBy 'GT Id) [1,5,2,4,7,0]PresentT [0,7,4,2,5,1]pz @(SortBy ((Fst (Fst Id) ==! Fst (Snd Id)) <> (Snd (Fst Id) ==! Snd (Snd Id))) Id) [(10,"ab"),(4,"x"),(20,"bbb"),(4,"a"),(4,"y")]7PresentT [(4,"a"),(4,"x"),(4,"y"),(10,"ab"),(20,"bbb")]pz @(SortBy ((Fst (Fst Id) ==! Fst (Snd Id)) <> (Snd (Snd Id) ==! Snd (Fst Id))) Id) [(10,"ab"),(4,"x"),(20,"bbb"),(4,"a"),(4,"y")]7PresentT [(4,"y"),(4,"x"),(4,"a"),(10,"ab"),(20,"bbb")]predicate-typed similar to pz @Max [10,4,5,12,3,4] PresentT 12 pz @Max []FailT "empty list"predicate-typed similar to pz @Min [10,4,5,12,3,4] PresentT 3 pz @Min []FailT "empty list"predicate-typed similar to pz @Product [10,4,5,12,3,4]PresentT 28800pz @Product [] PresentT 1predicate-typed similar to pz @Sum [10,4,5,12,3,4] PresentT 38 pz @Sum [] PresentT 0predicate-typedemulates ReadPpredicate-typedIRead but returns the Maybe of the value and any remaining unparsed stringpz @(ReadMaybe Int Id) "123x"PresentT (Just (123,"x"))pz @(ReadMaybe Int Id) "123"PresentT (Just (123,""))pz @(ReadMaybe Int Id) "x123"PresentT Nothingpredicate-typed uses the TB of the given type 't' and 'p' which points to the content to readpz @(ReadP Rational Id) "4 % 5"PresentT (4 % 5)[pz @(Between (ReadP Day "2017-04-11") (ReadP Day "2018-12-30") (ReadP Day Id)) "2018-10-12"TrueT[pz @(Between (ReadP Day "2017-04-11") (ReadP Day "2018-12-30") (ReadP Day Id)) "2016-10-12"FalseTpredicate-typedconvert n) to posix time (seconds since 01-01-1970)Epl @(ReadP UTCTime Id >> UTCTimeToPosix Id) "2020-06-28 22:45:12 UTC"hPresent 1593384312 % 1 ((>>) 1593384312 % 1 | {UTCTimeToPosix 1593384312 % 1 | 2020-06-28 22:45:12 UTC})PresentT (1593384312 % 1)pz @(Rescan "^Date\\((\\d+)([^\\)]+)\\)" Id >> Head Id >> Snd Id >> ((ReadP Integer (Id !! 0) >> PosixToUTCTime (Id % 1000)) &&& ReadP TimeZone (Id !! 1))) "Date(1530144000000+0530)"(PresentT (2018-06-28 00:00:00 UTC,+0530)Cnot so useful: instead use ParseTimeP FormatTimeP with %s %q %z etc<pz @(ParseTimeP ZonedTime "%s%Q%z" Id) "153014400.000+0530""PresentT 1974-11-07 05:30:00 +0530 predicate-typed1convert posix time (seconds since 01-01-1970) to n"pl @(PosixToUTCTime Id) 1593384312YPresent 2020-06-28 22:45:12 UTC (PosixToUTCTime 2020-06-28 22:45:12 UTC | 1593384312 % 1) PresentT 2020-06-28 22:45:12 UTC7pl @(PosixToUTCTime Id >> UTCTimeToPosix Id) 1593384312hPresent 1593384312 % 1 ((>>) 1593384312 % 1 | {UTCTimeToPosix 1593384312 % 1 | 2020-06-28 22:45:12 UTC})PresentT (1593384312 % 1).pl @(PosixToUTCTime (Id % 1000)) 1593384312000YPresent 2020-06-28 22:45:12 UTC (PosixToUTCTime 2020-06-28 22:45:12 UTC | 1593384312 % 1) PresentT 2020-06-28 22:45:12 UTC(pl @(PosixToUTCTime Id) (3600*4+60*7+12)TPresent 1970-01-01 04:07:12 UTC (PosixToUTCTime 1970-01-01 04:07:12 UTC | 14832 % 1) PresentT 1970-01-01 04:07:12 UTCpz @(Rescan "^Date\\((\\d+)([^\\)]+)\\)" Id >> Head Id >> Snd Id >> ReadP Integer (Id !! 0) >> PosixToUTCTime (Id % 1000)) "Date(1530144000000+0530)" PresentT 2018-06-28 00:00:00 UTC!predicate-typed uncreate a * returning hour minute seconds picosecondsNpz @(ReadP UTCTime "2019-01-01 12:13:14.1234Z" >> ToTime Id >> UnMkTime Id) ()PresentT (12,13,70617 % 5000)Mpz @(ReadP UTCTime Id >> ToTime Id >> UnMkTime Id) "2020-07-22 08:01:14.127Z"PresentT (8,1,14127 % 1000)epz @(ReadP ZonedTime Id >> '(UnMkDay (ToDay Id), UnMkTime (ToTime Id))) "2020-07-11 11:41:12.333 CET"+PresentT ((2020,7,11),(11,41,12333 % 1000))"predicate-typed create a ) from a three-tuple of year month and day pz @(MkTime '(1,2,3 % 12345)) ()PresentT 01:02:00.000243013365pz @(MkTime Id) (12,13,65)PresentT 12:13:65pz @(MkTime Id) (17,3,13)PresentT 17:03:13#predicate-typed create a 6 from three int values passed in as year month and day6pz @(MkTime' (Fst Id) (Snd Id) (Thd Id)) (13,99,99999)PresentT 13:99:99999$predicate-typedextract  from DateTime9pz @(ReadP UTCTime Id >> ToDay Id) "2020-07-06 12:11:13Z"PresentT 2020-07-06%predicate-typedextract  from a DateTime9pz @(ReadP UTCTime Id >> ToDay Id) "2020-07-06 12:11:13Z"PresentT 2020-07-06&predicate-typedget week number of the year3pz @(Just (MkDay '(2020,7,11)) >> ToWeekYear Id) () PresentT 28'predicate-typedget day of weekPpz @(Just (MkDay '(2020,7,11)) >> '(UnMkDay Id, ToWeekYear Id,ToWeekDate Id)) ()(PresentT ((2020,7,11),28,(6,"Saturday")))predicate-typed create a K + Week + Day of Week from three int values passed in as year month and day1pz @(MkDayExtra '(1,2,3) >> Just Id >> Fst Id) ()PresentT 0001-02-03(pz @(Fst (Just (MkDayExtra '(1,2,3)))) 1PresentT 0001-02-03 pz @(MkDayExtra Id) (2019,12,30) PresentT (Just (2019-12-30,1,1))<pz @(MkDayExtra' (Fst Id) (Snd Id) (Thd Id)) (2019,99,99999)PresentT Nothingpz @(MkDayExtra Id) (1999,3,13)!PresentT (Just (1999-03-13,10,6))*predicate-typed uncreate a  returning year month and day6pz @(UnMkDay Id) (readNote "invalid day" "2019-12-30")PresentT (2019,12,30),predicate-typed create a 6 from three int values passed in as year month and day"pz @(MkDay '(1,2,3) >> Just Id) ()PresentT 0001-02-03pz @(Just (MkDay '(1,2,3))) 1PresentT 0001-02-03pz @(MkDay Id) (2019,12,30)PresentT (Just 2019-12-30)7pz @(MkDay' (Fst Id) (Snd Id) (Thd Id)) (2019,99,99999)PresentT Nothingpz @(MkDay Id) (1999,3,13)PresentT (Just 1999-03-13).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") ()PresentT 2019-03-11 01:22:33pz @(ParseTimes LocalTime (Fst Id) (Snd Id)) (["%Y-%m-%d %H:%M:%S", "%m/%d/%y %H:%M:%S", "%B %d %Y %H:%M:%S", "%Y-%m-%dT%H:%M:%S"], "03/11/19 01:22:33")PresentT 2019-03-11 01:22:330predicate-typed similar to  where 't' is the H type, 'p' is the datetime format and 'q' points to the content to parse;pz @(ParseTimeP LocalTime "%F %T" Id) "2019-05-24 05:19:59"PresentT 2019-05-24 05:19:59Mpz @(ParseTimeP LocalTime "%F %T" "2019-05-24 05:19:59") (Right "never used")PresentT 2019-05-24 05:19:594keeping 'q' as we might want to extract from a tuple1predicate-typed@type level expression representing a formatted time similar to  using a type level M to get the formatting string\pz @(FormatTimeP "%F %T" Id) (readNote @LocalTime "invalid localtime" "2019-05-24 05:19:59")PresentT "2019-05-24 05:19:59"fpz @(FormatTimeP (Fst Id) (Snd Id)) ("the date is %d/%m/%Y", readNote @Day "invalid day" "2019-05-24")!PresentT "the date is 24/05/2019"2predicate-typed similar to pz @(ShowP Id) [4,8,3,9]PresentT "[4,8,3,9]"pz @(ShowP Id) 'x'PresentT "'x'"pz @(ShowP (42 -% 10)) 'x'PresentT "(-21) % 5"3predicate-typedsplit a list into single valuespz @(Ones Id) [4,8,3,9]PresentT [[4],[8],[3],[9]]pz @(Ones Id) [] PresentT []4predicate-typed similar to pz @Tails [4,8,3,9])PresentT [[4,8,3,9],[8,3,9],[3,9],[9],[]] pz @Tails [] PresentT [[]]5predicate-typed similar to pz @Inits [4,8,3,9])PresentT [[],[4],[4,8],[4,8,3],[4,8,3,9]] pz @Inits [] PresentT [[]]6predicate-typedconverts a string -. value to title casepz @ToTitle "HeLlO wOrld!"PresentT "Hello world!"Tdata Color = Red | White | Blue | Green | Black deriving (Show,Eq,Enum,Bounded,Read)%pz @(ToTitle >> ReadP Color Id) "red" PresentT Red7predicate-typedconverts a string -. value to upper casepz @ToUpper "HeLlO wOrld!"PresentT "HELLO WORLD!"8predicate-typedconverts a string -. value to lower casepz @ToLower "HeLlO wOrld!"PresentT "hello world!"?predicate-typed5predicate for determining if the string is all spacespz @IsSpaceAll "213G"FalseTpz @IsSpaceAll " "TrueTpz @IsSpaceAll ""TrueT@predicate-typed5predicate for determining if the string is all digitspz @IsDigitAll "213G"FalseTpz @IsDigitAll "929"TrueTpredicate-typed(a predicate for determining if a string /.# belongs to the given character setpz @IsLowerAll "abc"TrueTpz @IsLowerAll "abcX"FalseTpz @IsLowerAll (T.pack "abcX")FalseTpz @IsHexDigitAll "01efA"TrueTpz @IsHexDigitAll "01egfA"FalseT8| predicate for determining if a string is all lowercasepz @IsLowerAll "abcdef213"FalseTpz @IsLowerAll "abcdef"TrueTpz @IsLowerAll ""TrueTpz @IsLowerAll "abcdefG"FalseT2pl @(Just Uncons >> IsUpper &* IsLowerAll) "AbcdE">False ((>>) False | {True (&*) False | (IsLowerAll | "bcdE")})FalseT2pl @(Just Uncons >> IsUpper &* IsLowerAll) "Abcde"#True ((>>) True | {True (&*) True})TrueT2pl @(Just Uncons >> IsUpper &* IsLowerAll) "xbcde"8False ((>>) False | {False (&*) True | (IsUpper | "x")})FalseT.pl @(Just Uncons >> IsUpper &* IsLowerAll) "X"#True ((>>) True | {True (&*) True})TrueTpz @( '(IsControlAll, IsLatin1All , IsHexDigitAll , IsOctDigitAll , IsDigitAll , IsPunctuationAll , IsSeparatorAll , IsSpaceAll ) ) "abc134"8PresentT (False,True,True,False,False,False,False,False)Tpl @(SplitAts [1,2,10] Id >> Para '[IsLowerAll, IsDigitAll, IsUpperAll ]) "abdefghi"hPresent [True,False,False] ((>>) [True,False,False] | {Para(0) [True,False,False] | ["a","bd","efghi"]})PresentT [True,False,False]]pl @(SplitAts [1,2,10] Id >> BoolsQuick "" '[IsLowerAll, IsDigitAll, IsUpperAll ]) "a98efghi"8False ((>>) False | {Bool(2) [] (IsUpperAll | "efghi")})FalseTkpl @(SplitAts [1,2,10] Id >> BoolsQuick "" '[IsLowerAll, IsDigitAll, IsUpperAll || IsLowerAll ]) "a98efghi"True ((>>) True | {Bools})TrueTkpl @(SplitAts [1,2,10] Id >> BoolsQuick "" '[IsLowerAll, IsDigitAll, IsUpperAll || IsLowerAll ]) "a98efgHi"eFalse ((>>) False | {Bool(2) [] (False || False | (IsUpperAll | "efgHi") || (IsLowerAll | "efgHi"))})FalseTJpredicate-typed5predicate for determining if the character is a digitpz @IsDigit 'g'FalseTpz @IsDigit '9'TrueTLpredicate-typed5predicate for determining if a character is lowercasepz @IsLower '1'FalseTpz @IsLower 'a'TrueTrpz @(Map '(IsControl, IsLatin1, IsHexDigit, IsOctDigit, IsDigit, IsPunctuation, IsSeparator, IsSpace) Id) "abc134"$PresentT [(False,True,True,False,False,False,False,False),(False,True,True,False,False,False,False,False),(False,True,True,False,False,False,False,False),(False,True,True,True,True,False,False,False),(False,True,True,True,True,False,False,False),(False,True,True,True,True,False,False,False)]predicate-typed(a predicate for determining if a string /.# belongs to the given character setpz @IsSpace '\t'TrueTpz @IsSpace ' 'TrueTpz @IsSpace 'x'FalseTpz @IsLower 'a'TrueTpz @IsLower 'X'FalseTpz @IsHexDigit 'A'TrueTpz @IsHexDigit 'g'FalseTMpredicate-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+)$" (ReplaceFn3 (Fst Id)) (Snd Id)) (\ys -> intercalate " | " $ map (show . succ . readNote @Int "invalid int") ys, "141.201.1.22")PresentT "142 | 202 | 2 | 23"Npredicate-typedA replacement function (String -> String)& that yields the whole match Used by ' and ( Requires Text.Show.Functions:m + Text.Show.Functions[pz @(ReplaceAll "\\." (ReplaceFn2 (Fst Id)) (Snd Id)) (\x -> x <> ":" <> x, "141.201.1.22")PresentT "141.:.201.:.1.:.22"Opredicate-typedA replacement function (String -> [String] -> String)7 which returns the whole match and the groups Used by ' and ( Requires Text.Show.FunctionsPpredicate-typedSimple replacement string: see S and QTpredicate-typed+replace all occurrences of string 'p' with '\q' in 'r'@pl @(ReplaceAllString 'ROverWrite "abc" "def" Id) "123abc456abc"EPresent "123def456def" (ReplaceAll (abc) 123abc456abc | 123def456def)PresentT "123def456def"Epl @(ReplaceAllString' '[] 'ROverWrite "abc" "def" Id) "123AbC456abc"EPresent "123AbC456def" (ReplaceAll (abc) 123AbC456abc | 123AbC456def)PresentT "123AbC456def"Ppl @(ReplaceAllString' '[ 'Caseless ] 'ROverWrite "abc" "def" Id) "123AbC456abc"RPresent "123def456def" (ReplaceAll' ['Caseless] (abc) 123AbC456abc | 123def456def)PresentT "123def456def">pl @(ReplaceAllString 'RPrepend "abc" "def" Id) "123AbC456abc"KPresent "123AbC456defabc" (ReplaceAll (abc) 123AbC456abc | 123AbC456defabc)PresentT "123AbC456defabc"@pl @(ReplaceAllString 'ROverWrite "abc" "def" Id) "123AbC456abc"EPresent "123AbC456def" (ReplaceAll (abc) 123AbC456abc | 123AbC456def)PresentT "123AbC456def"=pl @(ReplaceAllString 'RAppend "abc" "def" Id) "123AbC456abc"KPresent "123AbC456abcdef" (ReplaceAll (abc) 123AbC456abc | 123AbC456abcdef)PresentT "123AbC456abcdef"Upredicate-typed,replace first occurrence of string 'p' with '\q' in 'r'@pl @(ReplaceOneString 'ROverWrite "abc" "def" Id) "123abc456abc"EPresent "123def456abc" (ReplaceOne (abc) 123abc456abc | 123def456abc)PresentT "123def456abc"pz @(Rescan "^Date\\((\\d+[+-]\\d{4})\\)" Id >> Head Id >> Snd Id >> Id !! 0 >> ReplaceOneString 'RPrepend "\\d{3}[+-]" "." Id >> ParseTimeP ZonedTime "%s%Q%z" Id) "Date(1530144000123+0530)"&PresentT 2018-06-28 05:30:00.123 +0530pz @(Rescan "^Date\\((\\d+[+-]\\d{4})\\)" Id >> Head Id >> Snd Id >> Id !! 0 >> ReplaceOneString 'RPrepend "\\d{3}[+-]" "." Id >> ParseTimeP ZonedTime "%s%Q%z" Id) "Date(1593460089052+0800)"&PresentT 2020-06-30 03:48:09.052 +0800pz @(Rescan "^Date\\((\\d+)(\\d{3}[+-]\\d{4})\\)" Id >> Head Id >> Snd Id >> (Id !! 0 <> "." <> Id !! 1) >> ParseTimeP ZonedTime "%s%Q%z" Id) "Date(1593460089052+0800)"&PresentT 2020-06-30 03:48:09.052 +0800predicate-typed6replaces regex 's' with a string 's1' inside the value>pz @(ReplaceAllString 'ROverWrite "\\." ":" Id) "141.201.1.22"PresentT "141:201:1:22"Zpredicate-typed$splits a string on a regex delimiter%pz @(Resplit "\\." Id) "141.201.1.22"PresentT ["141","201","1","22"]<pz @(Resplit (Singleton (Fst Id)) (Snd Id)) (':', "12:13:1")PresentT ["12","13","1"]5pl @(Resplit' '[ 'Caseless ] "aBc" Id) "123AbC456abc"UPresent ["123","456",""] (Resplit' ['Caseless] (aBc) ["123","456",""] | 123AbC456abc)PresentT ["123","456",""]\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"&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"(PresentT [("13:05:25",["13","05","25"])]Epz @(Rescan (Snd Id) "13:05:25") ('a',"^(\\d{2}):(\\d{2}):(\\d{2})$")(PresentT [("13:05:25",["13","05","25"])]cpz @(Rescan "^(\\d{2}):(\\d{2}):(\\d{2})$" Id >> Snd (Head Id) >> Map (ReadP Int Id) Id) "13:05:25"PresentT [13,5,25]Spl @(Rescan "(\\d+)\\D?" Id >> Map (Second (ReadP Int (OneP Id))) Id) "123-444-987"Present [("123-",123),("444-",444),("987",987)] ((>>) [("123-",123),("444-",444),("987",987)] | {Map [("123-",123),("444-",444),("987",987)] | [("123-",["123"]),("444-",["444"]),("987",["987"])]})0PresentT [("123-",123),("444-",444),("987",987)]`predicate-typedrepresents a predicate using a M$ 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"TrueTapredicate-typed equivalent4pz @Unzip3 (zip3 [1..5] "abcd" (cycle [True,False]))3PresentT ([1,2,3,4],"abcd",[True,False,True,False])bpredicate-typed equivalentpz @Unzip (zip [1..5] "abcd")PresentT ([1,2,3,4],"abcd")epredicate-typed:a type level predicate for all negative elements in a listfpredicate-typed:a type level predicate for all positive elements in a listpz @AllPositive [1,5,10,2,3]TrueTpz @AllPositive [0,1,5,10,2,3]FalseTpz @AllPositive [3,1,-5,10,2,3]FalseT!pz @AllNegative [-1,-5,-10,-2,-3]TrueTgpredicate-typed similar to pl @(Any Even Id) [1,5,11,5,3]False (Any(5))FalseTpl @(Any Even Id) [1,5,112,5,3]True (Any(5) i=2 (0 == 0))TrueTpz @(Any Even Id) []FalseThpredicate-typed similar to /pl @(All (Between 1 8 Id) Id) [7,3,4,1,2,9,0,1]False (All(8) i=5 (9 <= 8))FalseTpz @(All Odd Id) [1,5,11,5,3]TrueTpz @(All Odd Id) []TrueT&run @'OANV @(All Even Id) [1,5,11,5,3]6False All(5) i=0 (1 == 0)|+- P Id [1,5,11,5,3]|+- False i=0:1 == 0| || +- P 1 `mod` 2 = 1| | | | | +- P I| | | | | `- P '2| | | `- P '0|+- False i=1:1 == 0| || +- P 5 `mod` 2 = 1| | | | | +- P I| | | | | `- P '2| | | `- P '0|+- False i=2:1 == 0| || +- P 11 `mod` 2 = 1| | | | | +- P I| | | | | `- P '2| | | `- P '0|+- False i=3:1 == 0| || +- P 5 `mod` 2 = 1| | | | | +- P I| | | | | `- P '2| | | `- P '0|`- False i=4:1 == 0 | +- P 3 `mod` 2 = 1 | | | +- P I | | | `- P '2 | `- P '0FalseTipredicate-typedbetween for tuples*pl @(BetweenA (Fst Id) (Snd Id)) ((1,4),8)False (8 <= 4)FalseT*pl @(BetweenA (Fst Id) (Snd Id)) ((1,4),0)False (1 <= 0)FalseT*pl @(BetweenA (Fst Id) (Snd Id)) ((1,4),3)True (1 <= 3 <= 4)TrueTVpl @(BetweenA (ReadP (Day,Day) "(2017-04-11,2018-12-30)") (ReadP Day Id)) "2018-10-12"-True (2017-04-11 <= 2018-10-12 <= 2018-12-30)TrueTVpl @(BetweenA (ReadP (Day,Day) "(2017-04-11,2018-12-30)") (ReadP Day Id)) "2019-10-12" False (2019-10-12 <= 2018-12-30)FalseTVpl @(BetweenA (ReadP (Day,Day) "(2017-04-11,2018-12-30)") (ReadP Day Id)) "2016-10-12" False (2017-04-11 <= 2016-10-12)FalseTkpredicate-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]TrueTpz @(5 <..> 8) 6TrueTpl @(Between 5 8 Id) 9False (9 <= 8)FalseTpz @(10 % 4 <..> 40 % 5) 4TrueTpz @(10 % 4 <..> 40 % 5) 33FalseTlpredicate-typed5a type level predicate for a strictly decreasing listmpredicate-typed6a type level predicate for a monotonic decreasing listnpredicate-typed5a type level predicate for a strictly increasing listopredicate-typed6a type level predicate for a monotonic increasing listpl @Asc "aaacdef" True (All(6))TrueTpz @Asc [1,2,3,4,5,5,7]TrueTpz @Asc' [1,2,3,4,5,5,7]FalseTpz @Asc "axacdef"FalseT6a type level predicate for a monotonic increasing list<predicate-typedbounded  functionpz @(SuccB' Id) (13 :: Int) PresentT 14pz @(SuccB' Id) LT PresentT EQpz @(SuccB 'LT Id) GT PresentT LTpz @(SuccB' Id) GTFailT "Succ bounded"predicate-typedBActs as a proxy in this dsl where you can explicitly set the Type.OIt is passed around as an argument to help the type checker when needed. see /,       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmno$#"! lkonmlkijhgfdec_`]^[\YZWXUVSTQRPONM     LLKJIHGFEDCBA@?>=<;:91/0-.+,*()'&%$"#! =<;:9876st@2ba`OvNKJIHGF543uecdx _zyrqpomnihjgf^]\[  ~|}{  ZYXWVUTSRQPEBCD?>baM54.-,/0321876w'&%A+*)(53310103444644 1!2"2#3$3%1&1'1(1)1*1a4h5i5j5887444444444444887662233j4 None,-.=>?HSUVX6predicate-typed9'ip' type for reading one of many date time formats from predicate-typed4'ip' type for reading one of many date formats from predicate-typed('fmt' type for formatting an ip6 addresspredicate-typed8'op' type for validating an ip6 address using predicatespredicate-typed''ip' type for reading in an ip6 addresspredicate-typed%regular expression for an ip4 addresspredicate-typedregular expression for an octetpredicate-typed('fmt' type for formatting an ip4 addresspredicate-typed5'op' type for validating an ip4 address using a guardpredicate-typed9'op' type for validating an ip4 address using a predicatepredicate-typedB'ip' type for reading in an ip4 address using a regular expressionpredicate-typed''ip' type for reading in an ip4 addresspredicate-typed%regular expression for an ip4 addresspredicate-typed'regular expression for a time componentpredicate-typed"'fmt' type for formatting the timepredicate-typed1'op' type for validating the time using predicatepredicate-typed/'op' type for validating the time using a guardpredicate-typed'ip' type for reading in timepredicate-typed2'fmt' type for formatting the ssn compatible with predicate-typed'op' type for validating a ssnpredicate-typed'ip' type for reading in a ssnpredicate-typed7'fmt' type for formatting the date time compatible ith predicate-typed$'ip' type for reading in a date timepredicate-typed uses builtin predicate-typed@'fmt' type for formatting a credit card using 'ns' as the formatpredicate-typed<'op' type for validating a credit card number by check digitpredicate-typedK'ip' type for converting a credit card number to a list of singleton digits%% None &'-.>HXkpredicate-typed creates a  refinement type8$$(refinedTH 123) :: Refined OZ (Between 100 125 Id) Int Refined 123 :>$$(refinedTH 99) :: Refined OZ (Between 100 125 Id) Int  interactive8:8:4: error: * refinedTH: predicate failed with FalseP (100 <= 99) * In the Template Haskell splice $$(refinedTH 99) In the expression: $$(refinedTH 99) :: Refined (Between 100 125 Id) Int In an equation for 'it': it = $$(refinedTH 99) :: Refined (Between 100 125 Id) Int 9$$(refinedTH 123) :: Refined OAN (Between 100 125 Id) Int Refined 123 K>$$(refinedTH 99) :: Refined OAN (FailS "asdf" >> Between 100 125 Id) Int  interactiveL:116:4: error: * [Error asdf] lhs failed >> | `- [Error asdf] Fail asdf | `- P '"asdf" refinedTH: predicate failed with FailP "asdf" ((>>) lhs failed) * In the Template Haskell splice $$(refinedTH 99) In the expression: $$(refinedTH 99) :: Refined (FailS "asdf" >> Between 100 125 Id) Int predicate-typed creates a 00 refinement type@$$(refined1TH 100) :: Refined1 OZ Id (Between 100 125 Id) Id Int Refined1 100@$$(refined1TH 100) :: Refined1 OZ Id (Between 100 125 Id) Id Int Refined1 100@$$(refined1TH 100) :: Refined1 OZ Id (Between 100 125 Id) Id Int Refined1 100 B>$$(refined1TH 99) :: Refined1 OZ Id (Between 100 125 Id) Id Int  interactive :127:4: error: * *** Step 1. Success Initial Conversion(ip) (99) *** P Id 99 *** Step 2. False Boolean Check(op) *** False 100 <= 99 | +- P Id 99 | +- P '100 | `- P '125 refined1TH: predicate failed with Step 2. False Boolean Check(op) | {100 <= 99} * In the Template Haskell splice $$(refined1TH 99) In the expression: $$(refined1TH 99) :: Refined1 OZ Id (Between 100 125 Id) Id Int In an equation for 'it': it = $$(refined1TH 99) :: Refined1 OZ Id (Between 100 125 Id) Id Int predicate-typed creates a  refinement type=$$(refined2TH 100) :: Refined2 OA Id (Between 100 125 Id) Int"Refined2 {r2In = 100, r2Out = 100}>$$(refined2TH 100) :: Refined2 OAN Id (Between 100 125 Id) Int"Refined2 {r2In = 100, r2Out = 100} @>$$(refined2TH 99) :: Refined2 OAN Id (Between 100 125 Id) Int  interactive :127:4: error: * *** Step 1. Success Initial Conversion(ip) (99) *** P Id 99 *** Step 2. False Boolean Check(op) *** False 100 <= 99 | +- P Id 99 | +- P '100 | `- P '125 refined2TH: predicate failed with Step 2. False Boolean Check(op) | {100 <= 99} * In the Template Haskell splice $$(refined2TH 99) In the expression: $$(refined2TH 99) :: Refined2 OZ Id (Between 100 125 Id) Id Int In an equation for 'it': it = $$(refined2TH 99) :: Refined2 OZ Id (Between 100 125 Id) Id Int predicate-typed creates a  refinement type@$$(refined3TH 100) :: Refined3 OZ Id (Between 100 125 Id) Id Int"Refined3 {r3In = 100, r3Out = 100}A$$(refined3TH 100) :: Refined3 OAN Id (Between 100 125 Id) Id Int"Refined3 {r3In = 100, r3Out = 100} C>$$(refined3TH 99) :: Refined3 OAN Id (Between 100 125 Id) Id Int  interactive :127:4: error: * *** Step 1. Success Initial Conversion(ip) (99) *** P Id 99 *** Step 2. False Boolean Check(op) *** False 100 <= 99 | +- P Id 99 | +- P '100 | `- P '125 refined3TH: predicate failed with Step 2. False Boolean Check(op) | {100 <= 99} * In the Template Haskell splice $$(refined3TH 99) In the expression: $$(refined3TH 99) :: Refined3 OAN Id (Between 100 125 Id) Id Int In an equation for 'it': it = $$(refined3TH 99) :: Refined3 OAN Id (Between 100 125 Id) Id Int $$(refined3TH @OZ @(Resplit "\\." Id >> Map (ReadP Int Id) Id) @(All (0 <..> 0xff) Id && Len == 4) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) "200.2.3.4")8Refined3 {r3In = [200,2,3,4], r3Out = "200.002.003.004"} None,-.=>?HSUVX :* predicate-typed;take any valid Read/Show instance and turn it into a valid :m + Data.Ratio.newRefined3P (readshow @OZ @Rational) "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})/newRefined3P (readshow @OZ @Rational) "13x % 3"LLeft "Step 1. Initial Conversion(ip) Failed | ReadP Ratio Integer (13x % 3)"CnewRefined3P (readshow' @OZ @Rational @(3 % 1 <..> 5 % 1)) "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})MnewRefined3P (Proxy @(ReadShow' OZ Rational (11 -% 2 <..> 3 -% 1))) "-13 % 3"8Right (Refined3 {r3In = (-13) % 3, r3Out = "(-13) % 3"})FnewRefined3P (Proxy @(ReadShow' OZ Rational (Id > (15 % 1)))) "13 % 3"/Left "Step 2. False Boolean Check(op) | FalseP"~newRefined3P (Proxy @(ReadShow' OL Rational (Msg (PrintF "invalid=%3.2f" (FromRational Double Id)) (Id > (15 % 1))))) "13 % 3"FLeft "Step 2. False Boolean Check(op) | {invalid=4.3313 % 3 > 15 % 1}"FnewRefined3P (Proxy @(ReadShow' OZ Rational (Id > (11 % 1)))) "13 % 3"/Left "Step 2. False Boolean Check(op) | FalseP"FnewRefined3P (readshow @OZ @UTCTime) "2018-10-19 14:53:11.5121359 UTC"dRight (Refined3 {r3In = 2018-10-19 14:53:11.5121359 UTC, r3Out = "2018-10-19 14:53:11.5121359 UTC"}):m + Data.Aeson:newRefined3P (readshow @OZ @Value) "String \"jsonstring\""NRight (Refined3 {r3In = String "jsonstring", r3Out = "String \"jsonstring\""})1newRefined3P (readshow @OZ @Value) "Number 123.4">Right (Refined3 {r3In = Number 123.4, r3Out = "Number 123.4"})predicate-typedSconvert a string from a given base 'i' and store it internally as a base 'j' string+newRefined3P (Proxy @(BaseIJ OZ 16 2)) "fe"2Right (Refined3 {r3In = "11111110", r3Out = "fe"}),newRefined3P (Proxy @(BaseIJ OZ 16 2)) "fge">Left "Step 1. Initial Conversion(ip) Failed | invalid base 16"HnewRefined3P (Proxy @(BaseIJ' OL 16 2 (ReadBase Int 2 Id < 1000))) "ffe"6Left "Step 2. False Boolean Check(op) | {4094 < 1000}"predicate-typed noop falsepredicate-typed noop truepredicate-typed Luhn check)newRefined3P (Proxy @(LuhnT OZ 4)) "1230"3Right (Refined3 {r3In = [1,2,3,0], r3Out = "1230"}))newRefined3P (Proxy @(LuhnT OL 4)) "1234"hLeft "Step 2. False Boolean Check(op) | {True && False | (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])}"| uses builtin predicate-typedTconvert a string from a given base 'i' and store it internally as an base 10 integer newRefined3P (base16 @OZ) "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})4newRefined3P (basen' @OZ @16 @(100 <..> 400)) "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})GnewRefined3P (basen' @OZ @16 @(GuardSimple (Id < 400) >> 'True)) "f0fe"7Left "Step 2. Failed Boolean Check(op) | (61694 < 400)"XnewRefined3P (basen' @OL @16 @(Id < 400)) "f0fe" -- todo: why different parens vs braces6Left "Step 2. False Boolean Check(op) | {61694 < 400}"predicate-typed'read in an ipv4 address and validate it%newRefined3P (ip4 @OZ) "001.223.14.1"ARight (Refined3 {r3In = [1,223,14,1], r3Out = "001.223.014.001"})'newRefined3P (ip4 @OL) "001.223.14.999"NLeft "Step 2. Failed Boolean Check(op) | octet 3 out of range 0-255 found 999")newRefined3P (ip4 @OZ) "001.223.14.999.1"MLeft "Step 2. Failed Boolean Check(op) | Guards:invalid length(5) expected 4"%newRefined3P (ip4 @OL) "001.257.14.1"NLeft "Step 2. Failed Boolean Check(op) | octet 1 out of range 0-255 found 257"predicate-typedread in an ssn$newRefined3P (ssn @OZ) "134-01-2211"=Right (Refined3 {r3In = [134,1,2211], r3Out = "134-01-2211"})$newRefined3P (ssn @OL) "666-01-2211"yLeft "Step 2. False Boolean Check(op) | {Bool(0) [number for group 0 invalid: found 666] (True && False | (666 /= 666))}"$newRefined3P (ssn @OL) "667-00-2211"aLeft "Step 2. False Boolean Check(op) | {Bool(1) [number for group 1 invalid: found 0] (1 <= 0)}"predicate-typedcredit card with luhn algorithm'newRefined3P (cc11 @OZ) "1234-5678-901"/Left "Step 2. False Boolean Check(op) | FalseP"'newRefined3P (cc11 @OZ) "1234-5678-903"JRight (Refined3 {r3In = [1,2,3,4,5,6,7,8,9,0,3], r3Out = "1234-5678-903"})#pz @(Ccip >> Ccop 11) "79927398713"TrueT#pz @(Ccip >> Ccop 10) "79927398713"'FailT "expected 10 digits but found 11"predicate-typedread in a valid datetime=newRefined3P (datetime1 @OL @LocalTime) "2018-09-14 02:57:04"LRight (Refined3 {r3In = 2018-09-14 02:57:04, r3Out = "2018-09-14 02:57:04"})=newRefined3P (datetime1 @OL @LocalTime) "2018-09-99 12:12:12"[Left "Step 1. Initial Conversion(ip) Failed | ParseTimeP LocalTime (%F %T) failed to parse"predicate-typedread in a time and validate it!newRefined3P (hms @OL) "23:13:59"8Right (Refined3 {r3In = [23,13,59], r3Out = "23:13:59"})!newRefined3P (hms @OL) "23:13:60"CLeft "Step 2. Failed Boolean Check(op) | seconds invalid: found 60"!newRefined3P (hms @OL) "26:13:59"ALeft "Step 2. Failed Boolean Check(op) | hours invalid: found 26"predicate-typed8ensures that two numbers are in a given range (emulates )%newRefined3P (between @OZ @10 @16) 14(Right (Refined3 {r3In = 14, r3Out = 14})%newRefined3P (between @OZ @10 @16) 17/Left "Step 2. False Boolean Check(op) | FalseP"#prtEval3P (between @OAN @10 @16) 171Left Step 2. False Boolean Check(op) | {17 <= 16}3*** Step 1. Success Initial Conversion(ip) (17) ***P Id 17'*** Step 2. False Boolean Check(op) ***False 17 <= 16| +- P Id 17|+- P '10|`- P '1688 None,-.=>?HSUVX sTpredicate-typed Luhn check*newRefined2 @OZ @Luhnip @(Luhnop 4) "1230"3Right (Refined2 {r2In = [1,2,3,0], r2Out = "1230"})*newRefined2 @OL @Luhnip @(Luhnop 4) "1234"hLeft "Step 2. False Boolean Check(op) | {True && False | (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])}"| uses builtin Sconvert a string from a given base 'i' and store it internally as a base 'j' string,newRefined2 @OZ @(BaseIJip 16 2) @'True "fe"2Right (Refined2 {r2In = "11111110", r2Out = "fe"})-newRefined2 @OZ @(BaseIJip 16 2) @'True "fge">Left "Step 1. Initial Conversion(ip) Failed | invalid base 16"BnewRefined2 @OL @(BaseIJip 16 2) @(ReadBase Int 2 Id < 1000) "ffe"6Left "Step 2. False Boolean Check(op) | {4094 < 1000}"predicate-typedTconvert a string from a given base 'i' and store it internally as an base 10 integer3newRefined2 @OZ @(ReadBase Int 16 Id) @'True "00fe"-Right (Refined2 {r2In = 254, r2Out = "00fe"})BnewRefined2 @OZ @(ReadBase Int 16 Id) @(Between 100 400 Id) "00fe"-Right (Refined2 {r2In = 254, r2Out = "00fe"})OnewRefined2 @OZ @(ReadBase Int 16 Id) @(GuardSimple (Id < 400) >> 'True) "f0fe"7Left "Step 2. Failed Boolean Check(op) | (61694 < 400)"`newRefined2 @OL @(ReadBase Int 16 Id) @(Id < 400) "f0fe" -- todo: why different parens vs braces6Left "Step 2. False Boolean Check(op) | {61694 < 400}"predicate-typed'read in an ipv4 address and validate it-newRefined2 @OZ @Ip4ip @Ip4op' "001.223.14.1">Right (Refined2 {r2In = [1,223,14,1], r2Out = "001.223.14.1"})/newRefined2 @OL @Ip4ip @Ip4op' "001.223.14.999"fLeft "Step 2. False Boolean Check(op) | {Bool(3) [octet 3 out of range 0-255 found 999] (999 <= 255)}"'newRefined2P (ip4 @OL) "001.223.14.999"NLeft "Step 2. Failed Boolean Check(op) | octet 3 out of range 0-255 found 999")newRefined2P (ip4 @OL) "001.223.14.999.1"MLeft "Step 2. Failed Boolean Check(op) | Guards:invalid length(5) expected 4"%newRefined2P (ip4 @OL) "001.257.14.1"NLeft "Step 2. Failed Boolean Check(op) | octet 1 out of range 0-255 found 257"predicate-typedcredit card with luhn algorithm0newRefined2 @OZ @Ccip @(Ccop 11) "1234-5678-901"/Left "Step 2. False Boolean Check(op) | FalseP"0newRefined2 @OZ @Ccip @(Ccop 11) "1234-5678-903"JRight (Refined2 {r2In = [1,2,3,4,5,6,7,8,9,0,3], r2Out = "1234-5678-903"})#pz @(Ccip >> Ccop 11) "79927398713"TrueT#pz @(Ccip >> Ccop 10) "79927398713"'FailT "expected 10 digits but found 11"predicate-typedread in a valid datetime>newRefined2 @OL @(Dtip LocalTime) @'True "2018-09-14 02:57:04"LRight (Refined2 {r2In = 2018-09-14 02:57:04, r2Out = "2018-09-14 02:57:04"})>newRefined2 @OL @(Dtip LocalTime) @'True "2018-09-99 12:12:12"[Left "Step 1. Initial Conversion(ip) Failed | ParseTimeP LocalTime (%F %T) failed to parse"predicate-typedread in an ssn+newRefined2 @OZ @Ssnip @Ssnop "134-01-2211"=Right (Refined2 {r2In = [134,1,2211], r2Out = "134-01-2211"})+newRefined2 @OL @Ssnip @Ssnop "666-01-2211"yLeft "Step 2. False Boolean Check(op) | {Bool(0) [number for group 0 invalid: found 666] (True && False | (666 /= 666))}"+newRefined2 @OL @Ssnip @Ssnop "667-00-2211"aLeft "Step 2. False Boolean Check(op) | {Bool(1) [number for group 1 invalid: found 0] (1 <= 0)}"predicate-typedread in a time and validate it)newRefined2 @OL @Hmsip @Hmsop' "23:13:59"8Right (Refined2 {r2In = [23,13,59], r2Out = "23:13:59"}))newRefined2 @OL @Hmsip @Hmsop' "23:13:60"GLeft "Step 2. False Boolean Check(op) | {Bool(2) [seconds] (60 <= 59)}")newRefined2 @OL @Hmsip @Hmsop' "26:13:59"ELeft "Step 2. False Boolean Check(op) | {Bool(0) [hours] (26 <= 23)}"          1None,-.=>?HSVX tNone u0  !"#$%&'()9:;<=?@AB>0-*+,./12345678CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmno23423523623723823923:23;23<23=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklZYXWVTUSRQmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUUVWXY !Z[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#0)      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                                                                           # !"#$%&'()*+,-./0123456789:;<=>?@!ABCDE!FGHIJKLMNOPQRGST!UV!WXYZ![!*\!(]^_`/a`/b`/cdefdeg!h!!i!j!kl!km!kn!opqrsqtu!ov!wxyz{|#}#~!!!!35!!!!!!!k!k!!!k!!*!!!!!!!!!!!!*!*!!!!!!!!!!!!!!!!!!!!!*!*!!!!!!!!!!!W!!!!!!!qqqqq!!k!k!!!!.predicate-typed-0.7.2.0-LsjUtDgKRIuJtCd3aFXA1xPredicate.UtilPredicate.TH_OrphansPredicate.CorePredicate.RefinedPredicate.Refined3Predicate.Refined2Predicate.Refined1Predicate.PreludePredicate.Examples.CommonPredicate.Util_THPredicate.Examples.Refined3Predicate.Examples.Refined2Paths_predicate_typedPrintLPrintT Predicate ReplaceImplDo>> Control.Arrow&&&GHC.BaseStringRefined2RefinedRefined3$T stripLeft stripRight Control.Monadjoin Data.Alignalign Data.Thesethese Data.Listorsands GHC.MaybeJust Data.Either catMaybesmergeTheseWithData.Text.LensIsText Data.TextRefined1Predicate.Examples.Refined1.pretty-terminal-0.1.0.0-5h8HGBvScbYFgk2HEq8jrWSystem.Console.PrettyDefaultWhiteCyanMagentaBlueYellowGreenRedBlackColor $fLiftFixed$fLiftTimeOfDay$fLiftTimeZone$fLiftZonedTime$fLiftLocalTime $fLiftDay$fLiftDiffTime $fLiftUTCTimeOptTTAnyTT5_5T5_4T5_3T5_2T5_1T4_4T4_3T4_2T4_1OUVOUBOUOAVOABOAOANVOANOLOZOptTCgetOptT'OptTOWidthOMsg ORecursionOOtherOEmpty:#OColorOColorOn OColorOffOAnsiOUnicodeOZeroOLiteONormalOVerbose MonadEvalrunIOcatchit catchitNFliftEvalConsTMapTSumTIfTFlipT%&%% InductListC InductListP inductListC InductTupleC InductTupleP inductTupleCLenT IntersperseT<%>RepeatTGetOrdgetOrd OrderingPCGtCGeCEqCLeCLtCNeGetBoolgetBool GetOrdering getOrderingGetThesegetTheseGetLengetLenGetSymbsgetSymbsGetNatsgetNatsNotTOrTAndT FailUnlessT FailWhenT ZwischenTRReplace RReplace1 RReplace2 RReplace3GetReplaceFnSubgetReplaceFnSub ReplaceFnSubRPrepend ROverWriteRAppendGetROptsgetROptsROptAnchored Auto_calloutCaselessDollar_endonlyDotallDupnamesExtendedExtra Firstline Multiline Newline_cr Newline_crlf Newline_lfNo_auto_captureUngreedyUtf8 No_utf8_checkOther2Other1Color5Color4Color3Color2Color1DebugDZeroDLiteDNormalDVerboseDispAnsiUnicodePOptsLHOptsoWidthoDebugoDispoColoroMsg oRecursionoOtheroNoColorPOptsHolderPEGetBoolTgetBoolTBoolTFailTFalseTTrueTPresentTTT_tBool_tString_tForesttBooltStringtForestpStringmkNodemkNodeB mkNodeSkipP getValAndPEgetValLRFromTTfromTThh getValueLR isVerbosefixBoolTshow01show01'lit01 litVerbose showVerboseshowLlitLlitBLlitBS compileRegex displayROpts splitAndAlign_FailT _PresentT_FalseT_TrueT~>natsymb showThese hasNoTree colorBoolT colorBoolT'fixLite prtTreePure topMessageprettyRationalfixit prefixMsgshowTshowTK prettyOrd removeAnsierrorInProgram readFieldgetOptTchkSize formatOMsgsuboptssetOtherEffects pureTryTestpureTryTestPredisPrime unlessNull$fFoldableBoolT$fSemigroupBoolT$fGetBoolTaFailT$fGetBoolTaPresentT$fGetBoolTBoolFalseT$fGetBoolTBoolTrueT $fFoldableTT $fShowSColor $fShowPColor$fSemigroupHOpts $fMonoidHOpts $fGetROpts[]$fGetROptNo_utf8_check $fGetROptUtf8$fGetROptUngreedy$fGetROptNo_auto_capture$fGetROptNewline_lf$fGetROptNewline_crlf$fGetROptNewline_cr$fGetROptMultiline$fGetROptFirstline$fGetROptExtra$fGetROptExtended$fGetROptDupnames$fGetROptDotall$fGetROptDollar_endonly$fGetROptCaseless$fGetROptAuto_callout$fGetROptAnchored $fGetROpts:$fGetReplaceFnSubRAppend$fGetReplaceFnSubROverWrite$fGetReplaceFnSubRPrepend$fShowRReplace $fGetNats[]: $fGetNats[][] $fGetSymbs[]:$fGetSymbs[][]$fGetLenNonEmpty:|$fGetLenTheseThese$fGetLenTheseThat$fGetLenTheseThis$fGetLenEitherRight$fGetLenEitherLeft$fGetLenMaybeNothing$fGetLenMaybeJust $fGetLen[]: $fGetLen[][]$fGetTheseTheseThese$fGetTheseTheseThat$fGetTheseTheseThis$fGetOrderingGT$fGetOrderingEQ$fGetOrderingLT$fGetBoolFalse $fGetBoolTrue$fGetColorDefault$fGetColorWhite$fGetColorCyan$fGetColorMagenta$fGetColorBlue$fGetColorYellow$fGetColorGreen $fGetColorRed$fGetColorBlack $fGetOrdCNe $fGetOrdCLt $fGetOrdCLe $fGetOrdCEq $fGetOrdCGe $fGetOrdCGt$fInductTupleC(,,,,,,,,,,,)$fInductTupleC(,,,,,,,,,,)$fInductTupleC(,,,,,,,,,)$fInductTupleC(,,,,,,,,)$fInductTupleC(,,,,,,,)$fInductTupleC(,,,,,,)$fInductTupleC(,,,,,)$fInductTupleC(,,,,)$fInductTupleC(,,,)$fInductTupleC(,,)$fInductTupleC(,)$fInductTupleC()$fInductListC12a$fInductListC11a$fInductListC10a$fInductListC9a$fInductListC8a$fInductListC7a$fInductListC6a$fInductListC5a$fInductListC4a$fInductListC3a$fInductListC2a$fInductListC1a$fInductListC0a $fMonadEvalIO$fMonadEvalIdentity $fShowOptT $fOptTCOUV $fOptTCOUB $fOptTCOU $fOptTCOAV $fOptTCOAB $fOptTCOA $fOptTCOANV $fOptTCOAN $fOptTCOL $fOptTCOZ$fOptTCOVerbose$fOptTCONormal $fOptTCOLite $fOptTCOZero$fOptTCOUnicode $fOptTCOAnsi$fOptTCOColorOff$fOptTCOColorOn $fOptTCOColor $fOptTC:# $fOptTCOEmpty $fOptTCOOther$fOptTCORecursion $fOptTCOMsg $fOptTCOWidth $fShowBoolP $fEqBoolP$fShowPE$fShowTT $fShowDisp$fEqDisp $fOrdDebug $fShowDebug $fEqDebug $fEnumDebug$fBoundedDebug $fShowROpt$fEqROpt $fOrdROpt $fEnumROpt $fBoundedROpt$fShowReplaceFnSub$fEqReplaceFnSub$fShowOrderingP $fEqOrderingP$fEnumOrderingP$fBoundedOrderingP $fShowHOpts $fEqBoolT $fShowBoolTHideMsgWIdTIdIPPPevalevalBool evalQuickpzplpanpanvpapabpavpupubpuvrunrunsprtTreerunPQ runPQBool evalBoolHideevalHide $fPBoolTba$fPProxyProxya$fPTheseTheseThese$fPTheseThatThese$fPTheseThisThese$fPEitherRightEither$fPEitherLeftEither$fPMaybeNothingMaybe$fPMaybeJustMaybe$fP[]:a$fP[]:a0$fP[][]a$fP()()a$fPNatna$fPOrderingcmpa$fP(,,,,,,,)(,,,,,,,)a$fP(,,,,,,)(,,,,,,)a$fP(,,,,,)(,,,,,)a$fP(,,,,)(,,,,)a$fP(,,,)(,,,)a $fP(,,)(,,)a $fP(,)(,)a $fPSymbolsa $fPBoolba $fPTYPEProxya $fPTYPE()a $fPTYPEIa $fPTYPEIda $fPTYPEIdTa $fPTYPEMsga $fPTYPEWa $fPTYPEHidex AppendOptT ReplaceOptTRefinedT unRefinedTRefinedC unRefined genRefinedrapply rapplyLiftconvertRefinedT withRefinedTwithRefinedTIO prtRefinedIO newRefined newRefinedM newRefinedT newRefinedTIOunRavelT prtRefinedTIO unsafeRefinedunsafeRefined'$fToJSONRefined$fArbitraryRefined$fHashableRefined$fBinaryRefined$fFromJSONRefined $fReadRefined$fIsStringRefined$fMonadError[]RefinedT$fMonadTransRefinedT $fShowRefined $fEqRefined$fGenericRefined $fLiftRefined$fFunctorRefinedT$fApplicativeRefinedT$fMonadRefinedT$fMonadContRefinedT$fMonadWriterRefinedT$fShowRefinedT$fMonadIORefinedT AppendOptT3 ReplaceOptT3RefinedEmulateMsg3m3Descm3Shortm3Long RResults3RFRTFRTFalseRTTrueFRTTrueTMakeR3'MakeR3 Refined3Cr3Inr3OutunsafeRefined3'unsafeRefined3 genRefined3 genRefined3PmkProxy3 mkProxy3'withRefined3TIO withRefined3TwithRefined3TP newRefined3 newRefined3P newRefined3T newRefined3TPnewRefined3TPIOconvertRefined3TPrapply3rapply3P prtEval3IO prtEval3PIOprtEval3 prtEval3Peval3eval3Peval3Mprt3IOprt3Impleval3PXeval3X$fToJSONRefined3$fHashableRefined3$fBinaryRefined3$fArbitraryRefined3$fFromJSONRefined3$fReadRefined3$fIsStringRefined3 $fShowMsg3$fShowRResults3$fEqMsg3$fLiftRefined3 $fEqRefined3$fShowRefined3 AppendOptT2 ReplaceOptT2MakeR2Msg2m2Descm2Shortm2Long RResults2RTTrue Refined2Cr2Inr2OutunsafeRefined2'unsafeRefined2 genRefined2 genRefined2PwithRefined2TIO withRefined2TwithRefined2TP newRefined2 newRefined2P newRefined2T newRefined2TPnewRefined2TIO prtEval2IO prtEval2PIOprtEval2 prtEval2Peval2Peval2eval2Mprt2IOprt2ImplmkProxy2 mkProxy2'$fToJSONRefined2$fHashableRefined2$fBinaryRefined2$fArbitraryRefined2$fFromJSONRefined2$fReadRefined2$fIsStringRefined2 $fShowMsg2$fShowRResults2$fEqMsg2$fLiftRefined2 $fEqRefined2$fShowRefined2 AppendOptT1 ReplaceOptT1Msg1m1Descm1Shortm1Long RResults1MakeR1 Refined1C unRefined1unsafeRefined1'unsafeRefined1 genRefined1 genRefined1PmkProxy1 mkProxy1'withRefined1TIO withRefined1TwithRefined1TP newRefined1 newRefined1P newRefined1T newRefined1TPnewRefined1TPIOconvertRefined1TPrapply1rapply1P prtEval1IO prtEval1PIOprtEval1 prtEval1Peval1Peval1eval1Mprt1IOprt1Impleval1PXeval1X$fToJSONRefined1$fHashableRefined1$fBinaryRefined1$fArbitraryRefined1$fFromJSONRefined1$fReadRefined1$fIsStringRefined1 $fShowMsg1$fShowRResults1$fEqMsg1$fLiftRefined1 $fEqRefined1$fShowRefined1Tuple6Tuple5Tuple4Tuple3Tuple2RotateChunksOfToString|+OrA&*AndAUncurryEncodeJsonFile EncodeJson ParseJsonFileParseJsonFile' ParseJson ParseJson'OnePBothK&RDotDotInitLastTailHead TheseFailThatFailThisFailTheseDefThatDefThisDef RightFailLeftFailRightDefLeftDefJustFailJustDefDoNRepeatStripRStripLTrimBothTrimRTrimL$&$$Join DuplicateExtract<|>*><*<$SapASapA'<> IsSuffixIIsInfixI IsPrefixIIsSuffixIsInfixIsPrefixStdinReadIO'ReadIOStderrStdout WriteFile WriteFile' AppendFileTimeZtTimeUtc ReadEnvAllReadEnv DirExistsReadDir FileExistsReadFileTraverseSequenceCase''Case'CaseParaNParaPrintF IntercalateShowBaseReadBase ReadBase'LuhnZipZipRZipLZipTheseChar1 Singleton EmptyList EmptyList'TheseIdTheseInIsTheseIsThatIsThis FromListExtFromList ToListExtToList'ToListIToListIToList'CmpICmp===~OrdIOrdA'OrdAOrdP==!IdBoolNot||~||&&~&&>>><<>|>>||>Skip GuardSimpleExitWhenGuardGuardsN GuardsDetailBoolsN BoolsQuickBools GuardsQuickGuardsRemQuotQuotRemDivModModDivOddEvenCatch'CatchUnproxyHoleFailpFailtFailSFailSpanBreakFilterGroupBy PartitionBy PartitionPairsIf ConcatMapMap IterateNUntil IterateNWhile IterateWhile IterateUntilIterateNUnfoldrFoldLFoldNScanNAScanNScanlThesesThatsThissPartitionThesePartitionEithersEnumFromThenTo... EnumFromToNullNull'IsEmptyUnsnocUncons+::+++OrsAnds!!?Lookup!!IxLIx'IxProxyTProxyT'CycleConcatFoldMapToNEListSConcatMConcatMkTheseMkThatMkThat'MkThisMkThis'MkRightMkRight'MkLeftMkLeft'MkJust MkNothing MkNothing'EmptyTMEmptyPMEmptyTMEmptyT'PureSTimes CatMaybesMapMaybe IsNothingIsJustMaybeInTheseXThese'That'This'Right'Left' LookupFail LookupDef LookupFail' LookupDef'InitFailInitDefLastFailLastDefTailFailTailDefHeadFailHeadDefFMapSndFMapFstElemRemoveKeep PrimeNextPrime ToEnumBFail ToEnumBDef ToEnumBDef'ToEnumToEnum'FromEnumPredBPredSuccPredB'SuccB'SuccBUnassocAssocSwapCswapCSwapReverseLReversePure2MEmpty2MEmpty2'Coerce2CoerceWrapWrap'UnwrapSignumAbsNegate-%%//=~<~<=~==~>=~>~NeLtLeSameGeGt/=<<===>=>LogBase**^*-+Dup+++IsRightIsLeftEitherIn|||SecondFirst***DropTakeSplitAtSplitAtsPadRPadL EitherBool MaybeBoolMkProxyFloorFloor'CeilingCeiling'Truncate Truncate' FromRational FromRational' ToRational FromIntegral FromIntegral' FromInteger FromInteger' FromString FromString'L6L5L4L3ThdL2SndL1FstLengthLen SortOnDescSortOnSortByMaxMinProductSumReadQReadQ' ReadMaybe ReadMaybe'ReadPReadP'UTCTimeToPosixPosixToUTCTimeUnMkTimeMkTimeMkTime'ToTimeToDay ToWeekYear ToWeekDate MkDayExtra MkDayExtra'UnMkDayMkDayMkDay' ParseTimes ParseTimes' ParseTimeP ParseTimeP' FormatTimePShowPOnesTailsInitsToTitleToUpperToLower IsLatin1AllIsSeparatorAll IsOctDigitAll IsHexDigitAll IsControlAllIsPunctuationAll IsSpaceAll IsDigitAll IsUpperAll IsLowerAllIsLatin1 IsSeparator IsOctDigit IsHexDigit IsControl IsPunctuationIsSpaceIsDigitIsUpperIsLower ReplaceFn3 ReplaceFn2 ReplaceFn1 ReplaceFnReplaceOneStringReplaceOneString'ReplaceAllStringReplaceAllString' ReplaceOne ReplaceOne' ReplaceAll ReplaceAll'ResplitResplit' RescanRanges RescanRanges'RescanRescan'ReRe'Unzip3UnzipNegativePositive AllNegative AllPositiveAnyAllBetweenA<..>BetweenDesc'DescAsc'Asc$fPTYPEBetweenx $fPTYPE<..>x$fPTYPEBetweenAx $fPTYPEAllx $fPTYPEAnyx $fPTYPERe'x $fPTYPERex$fPTYPERescan'x$fPTYPERescanx$fPTYPERescanRanges'x$fPTYPERescanRangesx$fPTYPEResplit'x$fPTYPEResplitx$fPTYPEReplaceImplx$fPTYPEReplaceAll'x$fPTYPEReplaceAllx$fPTYPEReplaceOne'x$fPTYPEReplaceOnex$fPTYPEReplaceAllStringx$fPTYPEReplaceOneStringx$fPTYPEReplaceFnx$fPTYPEReplaceOneString'x$fPTYPEReplaceAllString'x$fPTYPEReplaceFn1x$fPTYPEReplaceFn2x$fPTYPEReplaceFn3x$fPTYPEIsLatin1x$fPTYPEIsSeparatorx$fPTYPEIsOctDigitx$fPTYPEIsHexDigitx$fPTYPEIsControlx$fPTYPEIsPunctuationx$fPTYPEIsSpacex$fPTYPEIsDigitx$fPTYPEIsUpperx$fPTYPEIsLowerx$fGetCharSetCLatin1$fGetCharSetCSeparator$fGetCharSetCOctDigit$fGetCharSetCHexDigit$fGetCharSetCControl$fGetCharSetCPunctuation$fGetCharSetCSpace$fGetCharSetCNumber$fGetCharSetCUpper$fGetCharSetCLower$fPTYPEIsCharSetAlla$fPTYPEIsCharSetx$fPTYPEIsLowerAllx$fPTYPEIsUpperAllx$fPTYPEIsDigitAllx$fPTYPEIsSpaceAllx$fPTYPEIsPunctuationAllx$fPTYPEIsControlAllx$fPTYPEIsHexDigitAllx$fPTYPEIsOctDigitAllx$fPTYPEIsSeparatorAllx$fPTYPEIsLatin1Allx$fPTYPEToLowera$fPTYPEToUppera$fPTYPEToTitlea $fPTYPEInitsx $fPTYPETailsx $fPTYPEOnesx $fPTYPEShowPx$fPTYPEFormatTimePx$fPTYPEParseTimeP'a$fPTYPEParseTimes'a$fPTYPEMkDay'x$fPTYPEUnMkDayx$fPTYPEMkDayExtra'x$fPTYPEToWeekDatex$fPTYPEToWeekYearx$fToDayCSystemTime $fToDayCRatio $fToDayCDay$fToDayCLocalTime$fToDayCZonedTime$fToDayCUTCTime$fToTimeCSystemTime$fToTimeCRatio$fToTimeCDiffTime$fToTimeCTimeOfDay$fToTimeCLocalTime$fToTimeCZonedTime$fToTimeCUTCTime $fPTYPEToDayx$fPTYPEToTimex$fPTYPEMkTime'x$fPTYPEUnMkTimex$fPTYPEPosixToUTCTimex$fPTYPEUTCTimeToPosixx$fPTYPEReadP'x$fPTYPEReadMaybe'x $fPTYPESum[]$fPTYPEProduct[] $fPTYPEMin[] $fPTYPEMax[] $fPTYPELenas$fPTYPELengthx $fPTYPEL1x$fExtractL1C(,,,,,)$fExtractL1C(,,,,)$fExtractL1C(,,,)$fExtractL1C(,,)$fExtractL1C(,) $fPTYPEFstx $fPTYPEL2x$fExtractL2C(,,,,,)$fExtractL2C(,,,,)$fExtractL2C(,,,)$fExtractL2C(,,)$fExtractL2C(,) $fPTYPESndx$fPTYPEMkTimex$fPTYPEMkDayExtrax $fPTYPEMkDayx $fPTYPEL3x$fExtractL3C(,,,,,)$fExtractL3C(,,,,)$fExtractL3C(,,,)$fExtractL3C(,,)$fExtractL3C(,) $fPTYPEThdx$fExtractL4C(,,,,,)$fExtractL4C(,,,,)$fExtractL4C(,,,)$fExtractL4C(,,)$fExtractL4C(,) $fPTYPEL4x$fExtractL5C(,,,,,)$fExtractL5C(,,,,)$fExtractL5C(,,,)$fExtractL5C(,,)$fExtractL5C(,) $fPTYPEL5x$fExtractL6C(,,,,,)$fExtractL6C(,,,,)$fExtractL6C(,,,)$fExtractL6C(,,)$fExtractL6C(,) $fPTYPEL6x$fPTYPEFromString'a$fPTYPEFromInteger'a$fPTYPEFromIntegral'a$fPTYPEToRationalx$fPTYPEFromRational'a$fPTYPETruncate'x$fPTYPECeiling'x$fPTYPEFloor'x$fPTYPEMkProxya$fPTYPEMaybeBoola$fPTYPEEitherBoola$fPTYPEPadImpla $fPTYPEPadLx $fPTYPEPadRx$fPTYPESplitAtsx$fPTYPESplitAta $fPTYPETakex $fPTYPEDropx $fPTYPE&&&x $fPTYPE***(,) $fPTYPEFirstx$fPTYPESecondx$fPTYPE|||Either$fPTYPEIsLeftx$fPTYPEIsRightx$fPTYPE+++Either $fPTYPEDupx $fPTYPE^a $fPTYPE**a$fPTYPELogBasea$fPTYPEAllPositivex$fPTYPEAllNegativex$fGetBinOpBAdd$fGetBinOpBSub$fGetBinOpBMult $fPTYPEBina $fPTYPE*x $fPTYPE-x $fPTYPE+x $fPTYPE/a $fPTYPE%x$fPTYPENegatex $fPTYPE-%x $fPTYPEAbsx$fPTYPESignumx$fPTYPEUnwrapx $fPTYPEWrap'x$fPTYPECoercea$fPTYPECoerce2f$fPTYPEMEmpty2'f $fPTYPEPure2f$fPTYPEReverseas$fPTYPEReverseLt $fPTYPESwapp $fSwapC(,) $fSwapCThese $fSwapCEither $fPTYPEAssocp $fAssocC(,) $fAssocCThese$fAssocCEither$fPTYPEUnassocp $fPTYPESuccBx $fPTYPESuccx $fPTYPEPredx $fPTYPEPredBx$fPTYPEFromEnumx$fPTYPEToEnum'x$fPTYPEToEnumBDef'a $fPTYPEPrimex$fPTYPEPrimeNextx$fPTYPEKeepImplx $fPTYPEKeepx$fPTYPERemovex $fPTYPEElema$fPTYPEFMapFstf$fPTYPEFMapSndf$fPTYPELookupDefx$fPTYPELookupFailx$fPTYPEEitherXx$fPTYPETheseXx$fPTYPEMaybeInMaybe$fPTYPEIsJustx$fPTYPEIsNothingx$fPTYPECatMaybesx$fPTYPESTimesa $fPTYPEPurex$fPTYPEMEmptyT'a$fPTYPEEmptyTx$fPTYPEMkNothing'a$fPTYPEMkJustx$fPTYPEMkLeft'x$fPTYPEMkRight'x$fPTYPEMkThis'x$fPTYPEMkThat'x$fPTYPEMkThesea$fPTYPEToNEListt$fPTYPEProxyT'x $fPTYPEIx[] $fPTYPEIxLa$fPTYPELookupa $fPTYPE!!?a $fPTYPEAndsx $fPTYPEOrsx $fPTYPE++x $fPTYPE:+x $fPTYPE+:x$fPTYPEUnconss$fPTYPEUnsnocs$fPTYPEIsEmptyas $fPTYPENull'x $fPTYPENulla$fPTYPEEnumFromTox $fPTYPE...x$fPTYPEEnumFromThenTox$fPTYPEPartitionEithers[]$fPTYPEPartitionThese[] $fPTYPEThissx $fPTYPEThatsx$fPTYPEThesesx $fPTYPEScanlx$fPTYPEScanNAx$fPTYPEUnfoldra$fPTYPEIterateNx$fPTYPEIterateWhilex$fPTYPEUnzip3x $fPTYPEUnzipx$fPTYPEConcatMapx $fPTYPEIfa$fPTYPEPairs[] $fPTYPEDesc'x $fPTYPEDescx $fPTYPEAsc'x $fPTYPEAscx$fPTYPEPartitiona$fPTYPESortByx$fPTYPEPartitionBya$fPTYPEGroupBya$fPTYPEFilterx $fPTYPEBreaka $fPTYPEFaila $fPTYPEFailSx $fPTYPE!!a $fPTYPEIx'x$fPTYPEPredB'x$fPTYPESuccB'x $fPTYPEHolea $fPTYPEFailtx$fPTYPEProxyTx$fPTYPEMkThatx$fPTYPEMkThisx$fPTYPEMkRightx$fPTYPEMkLeftx$fPTYPEMkNothingx$fPTYPEMEmptyTx$fPTYPEToEnumBFailx$fPTYPEToEnumBDefx$fPTYPEToEnumx$fPTYPEMEmpty2x $fPTYPEWrapx $fPTYPEFloorx$fPTYPECeilingx$fPTYPETruncatex$fPTYPEFromRationalx$fPTYPEFromIntegralx$fPTYPEFromIntegerx$fPTYPEFromStringx $fPTYPEReadQx$fPTYPEReadMaybex $fPTYPEReadPx$fPTYPEParseTimesx$fPTYPEParseTimePx$fPTYPEUnproxyProxy $fPTYPEFailpx$fPTYPEMEmptyPx $fPTYPECatchx $fPTYPEDiva $fPTYPEModa $fPTYPEOddx $fPTYPEEvenx$fPTYPEDivModa$fPTYPEQuotRema $fPTYPEQuotx $fPTYPERemx$fPTYPEGuardsImplx$fPTYPEGuardsImplx0$fPTYPEGuardsx$fPTYPEBoolsImplx$fPTYPEBoolsImplx0 $fPTYPEBoolsx$fPTYPEGuardsImplXx$fPTYPEGuardsImplXx0$fPTYPEGuardsDetailImplx $fPTYPEGuarda$fPTYPEGuardSimplea $fPTYPESkipa $fPTYPE>>a $fPTYPE>|>x $fPTYPE>|x $fPTYPE|>x$fPTYPECatch'x $fPTYPEScanNx$fPTYPEFoldMapx$fPTYPEMapMaybex $fPTYPEDoa$fPTYPEReadQ'x $fPTYPE<a $fPTYPENotx$fPTYPEExitWhenx $fPTYPESpanx$fPTYPEIterateNUntilx$fPTYPEIterateUntilx$fPTYPEIdBoolx $fPTYPE==!a$fPTYPESortOnDescx$fPTYPESortOnx $fPTYPEOrdAx $fPTYPEOrdA'x $fPTYPE===~a $fPTYPECmpa $fPTYPE/=x $fPTYPE=x $fPTYPE>x $fPTYPECmpIa $fPTYPE/=~x $fPTYPE<~x $fPTYPE<=~x $fPTYPE==~x $fPTYPE>=~x $fPTYPE>~x$fPTYPEIToListx$fPTYPEToListt$fPTYPEToListExtl$fPTYPEFromListx$fPTYPEFromListExtl $fPTYPEIsThx$fPTYPEIsThisx$fPTYPEIsThatx$fPTYPEIsThesex$fPTYPETheseInThese$fPTYPETheseIdx$fPTYPEEmptyList'x$fPTYPEEmptyListx$fPTYPESingletonx $fPTYPEChar1a$fPTYPEToList'x$fPTYPEIToList'x $fPTYPEMapx $fPTYPECyclex$fPTYPEConcatx$fPTYPESConcatx$fPTYPEZipThesea$fPTYPEMConcatx$fPTYPEZipPada $fPTYPEZipLa $fPTYPEZipRa $fPTYPEZipa $fPTYPELuhnx$fPTYPEReadBase'x$fPTYPEReadBasex$fPTYPEShowBasex$fPTYPEIntercalatex$fPTYPEPrintFx$fPTYPEGuardsNx$fPTYPEBoolsNx$fPTYPEBoolsQuickx$fPTYPEGuardsQuickx$fPTYPEParaImpl[]$fPTYPEParaImpl[]0$fPTYPEParaImplx $fPTYPEParax $fPTYPEParaNx$fPTYPECaseImplx$fPTYPECaseImplx0$fPTYPECaseImplx1$fPTYPECaseImplx2$fPTYPECaseImplx3 $fPTYPECase'x$fPTYPECase''x $fPTYPECasex$fPTYPESequencet$fPTYPETraversex$fPTYPEReadFilex$fPTYPEFileExistsx$fPTYPEReadDirx$fPTYPEDirExistsx$fPTYPEReadEnvx$fPTYPEReadEnvAlla$fPTYPETimeUtca$fPTYPETimeZta$fGetFHandleFStderr$fGetFHandleFStdout$fGetModeWFWrite$fGetModeWFWriteForce$fGetModeWFAppend$fGetFHandleFOther$fPTYPEWriteFileImpla$fPTYPEAppendFilex$fPTYPEWriteFile'x$fPTYPEWriteFilex$fPTYPEStdoutx$fPTYPEStderrx $fPTYPEStdinx$fPTYPEIsFixImplx$fPTYPEIsPrefixx$fPTYPEIsInfixx$fPTYPEIsSuffixx$fPTYPEIsPrefixIx$fPTYPEIsInfixIx$fPTYPEIsSuffixIx $fPTYPE<>x $fPTYPESapA'x $fPTYPESapAx $fPrintC(,) $fPrintC()$fPTYPEGuardsDetailx$fPTYPEPrintLx$fPTYPEPrintTx $fPTYPE<$x $fPTYPE<*x $fPTYPE*>x $fPTYPE<|>x$fPTYPEExtractt$fPTYPEDuplicatet $fPTYPEJoint $fPTYPE$&x $fPTYPE$$x$fPTYPETrimImplx $fPTYPETrimLx $fPTYPETrimRx$fPTYPETrimBothx$fPTYPEStripImplx$fPTYPEStripLx$fPTYPEStripRx$fPTYPERepeata $fPTYPEDoNa$fPTYPELookupDef'x$fPTYPEInitDefx$fPTYPELastDefx$fPTYPETailDefx$fPTYPEHeadDefx$fPTYPEJustDefx$fPTYPEJustFailx$fPTYPELookupFail'x$fPTYPEInitFailx$fPTYPELastFailx$fPTYPETailFailx$fPTYPEHeadFailx$fPTYPELeftDefx$fPTYPERightDefx$fPTYPELeftFailx $fPTYPELeft'x$fPTYPERightFailx$fPTYPERight'x$fPTYPEThisDefx$fPTYPEThatDefx$fPTYPETheseDefx$fPTYPEThisFailx $fPTYPEThis'x$fPTYPEThatFailx $fPTYPEThat'x$fPTYPETheseFailx$fPTYPEThese'x $fPTYPEHeadx $fPTYPETailx $fPTYPELastx $fPTYPEFoldLx $fPTYPEFoldNx $fPTYPEInitx $fPTYPEJustx $fPTYPE$a $fPTYPERDota $fPTYPEDota $fPTYPE&a $fPTYPEKa $fPTYPEBothx $fPTYPEOnePx$fPTYPEParseJson'x$fPTYPEParseJsonx$fPTYPEParseJsonFile'x$fPTYPEParseJsonFilex$fPTYPEEncodeJsonx$fPTYPEEncodeJsonFilex$fPTYPEUncurryx $fPTYPEAndAx $fPTYPE&*x $fPTYPEOrAx $fPTYPE|+x$fToStringCByteString$fToStringCByteString0$fToStringCText$fToStringCText0 $fToStringC[]$fPTYPEToStringx$fPTYPEChunksOfa$fPTYPERotatex $fShowCharSet $fShowBinOp $fEqBinOp $fShowWFMode $fEqWFMode $fShowFHandleJsonMicrosoftDateTimeLuhn'Luhn''Luhnop' Ddmmyyyyop' Ddmmyyyyop DdmmyyyyRE DateTimeNip DateTimeFmtsDateNipDateFmtsIp6fmtIp6opIp6ip Ip4StrictREOctetREIp4fmtIp4opIp4op'Ip4ip'Ip4ipIp4REHmsREHmsfmtHmsop'HmsopHmsipSsnfmtSsnopSsnipDtfmtDtipLuhnopLuhnipCcfmtCcopCcip refinedTH refinedTHIO refined1TH refined2TH refined2THIO refined3TH refined3THIO ReadShowR' ReadShow' ReadShowRReadShowBaseIJ'BaseIJOkNotROkNotOkROkLuhnTLuhnRBetweenRBetweenNBaseN'BaseNIp6Ip6RIp4'Ip4R'Ip4Ip4RHms'HmsR'HmsHmsRSsnRSsn DateTimeN DateTimeNRDateN DateTime1Cc11Ccnccnccn'cc11 datetime1ssnhmsip4ip4'ip6base16base16'base2base2'basenbasen'daten datetimenbetweenokoknotreadshow readshow'BaseIJipversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileNameGetColorghc-prim GHC.TypesBool$these-1.1.1.1-7fp3Gb5JuCxEjNjnp6x24YThese(pcre-heavy-1.0.0.2-Ilbciq7LEhJTCtv8ROywWText.Regex.PCRE.HeavysubgsubGetROpt showLitImplHKDbaseData.Functor.IdentityIdentityPColorSColor_pBool_pStringBoolPFailPFalsePTruePPresentPboolT2PpBoolgetValLRfromTTH reifyOptssetWidth setMessage setRecursionsetOther setNoColorsetDispsetCreateColorsetDebugdefOptsotherDef_boolT toNodeString colorBoolPcolorMeType Data.ProxyProxyNatOrderingSymbolconst$aeson-1.5.2.0-Dgx5XUtzHiR6AgI0bpAFaLData.Aeson.Types.ToJSONToJSON(QuickCheck-2.14.1-IqiFngERTXR1loN1el8aePTest.QuickCheck.Arbitrary Arbitrary'hashable-1.3.0.0-1RsrIcitxVDKffGN1TuMlmData.Hashable.ClassHashablebinary-0.8.6.0Data.Binary.ClassBinaryData.Aeson.Types.FromJSONFromJSONGHC.ReadRead Data.StringIsString eval3MSkip eval1MSkip Data.FunctionEitherMaybe StripImplTrimImpl text-1.2.3.1strip stripStartstripEnd$comonad-5.0.6-JfcN6iPhxp7Eeulcp61Z8tControl.Comonad duplicateextractArrowRTPrintC IsFixImpl Data.OldList isInfixOf isPrefixOf isSuffixOf System.IOreadIO time-1.8.0.2&Data.Time.LocalTime.Internal.ZonedTime ZonedTime Data.Time.Clock.Internal.UTCTimeUTCTimereadFileData.Traversable sequenceACaseImplParaImplZipPadExtractAFromListThisThatIsThGHC.ExtsfromListtoList Data.Foldable"lens-4.19.2-DaRWbZHYVYpBUq1F3SQEkCControl.Lens.IndexeditoList GHC.ClassescompareidnotGuardsDetailImpl GuardsImplGHC.RealquotRemdivModmoddivevenGHC.ListbreakgroupBy partitionmapiterateunfoldrscanlpartitionThesepartitionEithersGHC.EnumenumFromThenTo enumFromTonullFoldableControl.Lens.EmptyAsEmptyControl.Lens.ConsunsnocunconslookupControl.Lens.AtIxedcycleconcatfoldMapsconcatmconcatRightLeftemptymemptypurestimes Data.Maybe isNothingisJustmaybeEitherXcontainers-0.6.0.1Data.Sequence.InternalSeqelemKeepImpltoEnumfromEnumpredsuccAssocCControl.Lens.Internal.Iso reversingreverseGHC.PrimcoerceControl.Lens.Wrapped _Wrapped' _Unwrapped'GHC.NumsignumabsnegateRationalBin GHC.FloatlogBaseisRightisLeftsplitAtPadImplfloorceilingtruncate fromRational toRational fromIntegral fromInteger fromString Data.Tuplesndfstlengthmaximumminimumproductsum&Data.Time.LocalTime.Internal.TimeOfDay TimeOfDayData.Time.Calendar.DaysDayData.Time.Format.Parse parseTimeM ParseTimeData.Time.Format formatTimeGHC.Showshowtailsinits IsCharSetAll IsCharSetunzip3unzipanyall