! f g      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                               ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f  SafeSghijklmnNone1:TNone%&',-.1=>?@AHPSUVX_`kNqpredicate-typed.a typeclass for choosing which monad to run in predicate-typed&Extract 'a' from a list like containerpredicate-typed=takes a list and converts to a reversed inductive tuple. see inductListC @4 [10,12,13,1](1,(13,(12,(10,()))))inductListC @2 ["ab","cc"]("cc",("ab",()))predicate-typedAtakes a flat n-tuple and creates a reversed inductive tuple. see "inductTupleC (123,'x',False,"abc")("abc",(False,('x',(123,()))))inductTupleC (123,'x')('x',(123,()))%predicate-typedget bool from the typelevel'predicate-typedget ordering from the typelevel+predicate-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)0-predicate-typed(get a list of Symbols from the typelevelgetSymbs @'["abc","def","g"]["abc","def","g"]/predicate-typed%get a list of Nats from the typelevelgetNats @'[10,12,1] [10,12,1]1predicate-typed typelevel Not2predicate-typed typelevel Or3predicate-typed typelevel And4predicate-typed)helper method to fail with msg when False5predicate-typed*helper method to fail with a msg when True6predicate-typedtype level Between7predicate-typedused by  and o and pc 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 7qpredicate-typed2convert type level regex option to the value level<predicate-typed2extract the regex options from the type level list>predicate-typed'Regex options for Rescan Resplit Re etc?predicate-typedForce pattern anchoring@predicate-typedCompile automatic callouts | Bsr_anycrlf -- R matches only CR, LF, or CrlF | Bsr_unicode -- ^ R matches all Unicode line endingsApredicate-typedDo caseless matchingBpredicate-typed"dollar not to match newline at endCpredicate-typedmatches anything including NLDpredicate-typed%Allow duplicate names for subpatternsEpredicate-typed Ignore whitespace and # commentsFpredicate-typed,PCRE extra features (not much use currently)Gpredicate-typed#Force matching to be before newlineHpredicate-typedcaret and dollar match newlines within data | Newline_any -- ^ Recognize any Unicode newline sequence | Newline_anycrlf -- ^ Recognize CR, LF, and CrlF as newline sequencesIpredicate-typedSet CR as the newline sequenceJpredicate-typed Set CrlF as the newline sequenceKpredicate-typedSet LF as the newline sequenceLpredicate-typed=Disable numbered capturing parentheses (named ones available)Mpredicate-typed Invert greediness of quantifiersNpredicate-typedRun in UTF--8 modeOpredicate-typed+Do not check the pattern for UTF-8 validityQpredicate-typed(one line summary used mainly for testingRpredicate-typedMone line summary with additional context from the head of the evaluation treeSpredicate-typed4outputs the evaluation tree but skips noisy subtreesTpredicate-typed4outputs the evaluation tree but skips noisy subtreesUpredicate-typed"outputs the entire evaluation treeVpredicate-typeddisplay format for the treeWpredicate-typeddraw normal treeXpredicate-typed use unicodeYpredicate-typedcustomizable options[predicate-typedlength of data to display for r\predicate-typed debug level]predicate-typed1display the tree using the normal tree or unicode^predicate-typedcolor palette usedspredicate-typed4the color palette for displaying the expression tree_predicate-typed a monomorphic container of trees`predicate-typed8represents the untyped evaluation tree for final displaytpredicate-typed)holds the result of running the predicateupredicate-typed*optional strings to include in the resultsbpredicate-typed?contains the untyped result from evaluating the expression treevpredicate-typedfails the entire evaluationwpredicate-typedFalse predicatexpredicate-typedTrue predicateypredicate-typed Any valuecpredicate-typed=contains the typed result from evaluating the expression treehpredicate-typed-represents the evaluation tree for predicatesjpredicate-typedthe value at this root nodekpredicate-typed1detailed information eg input and output and textlpredicate-typedthe child nodesmpredicate-typedlens for accessing c in hppredicate-typeda lens from typed c to the untyped bspredicate-typed&creates a Node for the evaluation treetpredicate-typed+creates a Boolean node for a predicate typezpredicate-typed get the value from BoolT or failxpredicate-typed2converts a typed tree to an untyped on for display{predicate-typed)converts a typed tree into an untyped oneypredicate-typed'convenience method to wrap a typed treezpredicate-typedsee |2 : add more detail to the tree if there are errors{predicate-typedsee |2 : add less detail to the tree if there are errors|predicate-typedha helper method to add extra context on failure to the tree or extract the value at the root of the tree}predicate-typedminimal data without colors~predicate-typed"returns the summary without colorspredicate-typedsame as ~ but with colorspredicate-typed5displays the detailed evaluation tree without colors.predicate-typed3displays the detailed evaluation tree using colors.predicate-typedsame as  but for a narrow displaypredicate-typedsame as 3 for a wider display and verbose debug mode settingpredicate-typedAdisplays the detailed evaluation tree using unicode and colors. ( works better on Windows)predicate-typedsame as 3 for a wider display and verbose debug mode settingpredicate-typedsame as  but for a narrow displaypredicate-typed$helper method to set the debug levelpredicate-typed,helper method to limit the width of the treepredicate-typed$helper method to set the debug levelpredicate-typed$helper method to set the debug levelpredicate-typed$helper method to set the debug levelpredicate-typed!set display to unicode and colorspredicate-typedset a color palettepredicate-typedno colors are displayedcolor palettes$italics dont work but underline doespredicate-typeddefault color palettecolor palettes$italics dont work but underline doespredicate-typedcolor palettes$italics dont work but underline doespredicate-typedcolor palettes$italics dont work but underline doespredicate-typedcolor palettes$italics dont work but underline doespredicate-typedcolor palettes$italics dont work but underline doespredicate-typed$fix PresentT Bool to TrueT or FalseTpredicate-typed*display all data regardless of debug levelpredicate-typed<more restrictive: only display data at debug level 1 or lesspredicate-typed+compile a regex using the type level symbolpredicate-typedWextract values from the trees or if there are errors returned a tree with added context}predicate-typedprism from BoolT to Boolpredicate-typedboolean implication True ~> FalseFalse True ~> TrueTrueFalse ~> FalseTrue False ~> TrueTruepredicate-typedget a Nat from the typelevelnat @1414predicate-typed"gets the Symbol from the typelevel symb @"abc""abc"predicate-typedEcolors the result of the predicate based on the current color palettepredicate-typed3skip displaying the tree and just output the resultpredicate-typed display in unicode (non-Windows)predicate-typednormal displaypredicate-typed?strip ansi characters from a string and print it (for doctests)predicate-typedsemigroup instance for c   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRTSUVWXYZ\[]^_`abcdefghijklmnopqrstuvwxyz{|}~hijklmnocdefgpb`arqstuvwxz{YZ\[]^PQRTSUVWX|}~>?@ABCDEFGHIJKLMNO<=789:;654321 /0-.+,)*'(%& !"#$_y  9 9 7None-.=>?@AHUVXk/ )'predicate-typed9add a message to give more context to the evaluation tree!pe @(Msg "[somemessage] " Id) 999P [somemessage] Id 999 PresentT 999 pe @(Msg Id 999) "info message:"P info message:'999 PresentT 999(predicate-typed0transparent predicate wrapper to make k of kind ~6 so it can be in a promoted list (cant mix kinds) see pz @'[W 123, Id] 99Present [123,99]PresentT [123,99]%pz @'[W "abc", W "def", Id, Id] "ghi"!Present ["abc","def","ghi","ghi"]"PresentT ["abc","def","ghi","ghi"])predicate-typedGidentity function that also displays the type information for debugging pz @IdT 23 Present 23 PresentT 23*predicate-typed1identity function that displays the input unlike +even more constraints than +1 so we might need to add explicit type signatures pz @Id 23 Present 23 PresentT 23+predicate-typedidentity functionpz @I 23 Present 23 PresentT 23,predicate-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 predicates1predicate-typed9displays the evaluation tree in plain text without colors2predicate-typedCdisplays the evaluation tree using colors without background colors3predicate-typed@displays the evaluation tree using colors with background colors4predicate-typedsame as 2+ but truncates the display tree width: see 5predicate-typedsame as 2 but allows for wider data6predicate-typed:skips the evaluation tree and just displays the end result7predicate-typedsame as 6# but adds context to the end result8predicate-typedsame as 6 but with colors9predicate-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 colors;predicate-typedsame as 9+ but truncates the display tree width: see ?predicate-typed(converts the value to the corresponding pz @'Proxy 'x' Present ProxyPresentT Proxy@predicate-typedBextracts the (a,b) from type level 'These a b' if the value exists$pz @('These Id Id) (These 123 "abc")Present (123,"abc")PresentT (123,"abc")%pz @('These Id 5) (These 123 "abcde")Present (123,5)PresentT (123,5)pz @('These Id Id) (This "aaa")Error 'These found ThisFailT "'These found This"pz @('These Id Id) (That "aaa")Error 'These found ThatFailT "'These found That"Apredicate-typed@extracts the 'b' from type level 'These a b' if the value existspz @('That Id) (That 123) Present 123 PresentT 123pz @('That Id) (This "aaa")Error 'That found ThisFailT "'That found This"pz @('That Id) (These 44 "aaa")Error 'That found TheseFailT "'That found These"Bpredicate-typed@extracts the 'a' from type level 'These a b' if the value existspz @('This Id) (This 123) Present 123 PresentT 123pz @('This Id) (That "aaa")Error 'This found ThatFailT "'This found That" pz @('This Id) (These 999 "aaa")Error 'This found TheseFailT "'This found These"Cpredicate-typedAextracts the 'b' from type level 'Either a b' if the value existspz @('Right Id) (Right 123) Present 123 PresentT 123pz @('Right Id) (Left "aaa")Error 'Right found LeftFailT "'Right found Left"Dpredicate-typedAextracts the 'a' from type level 'Either a b' if the value existspz @('Left Id) (Left 123) Present 123 PresentT 123pz @('Left Id) (Right "aaa")Error 'Left found RightFailT "'Left found Right"Epredicate-typedexpects Nothing otherwise it fails if the value is Nothing then it returns 'Proxy a' as this provides more information than '()'pz @'Nothing Nothing Present ProxyPresentT Proxypz @'Nothing (Just True)Error 'Nothing found JustFailT "'Nothing found Just"Fpredicate-typed>extracts the 'a' from type level 'Maybe a' if the value existspz @('Just Id) (Just 123) Present 123 PresentT 123pz @('Just Id) (Just True) Present True PresentT Truepz @('Just Id) NothingError 'Just found NothingFailT "'Just found Nothing"Hpredicate-typed2runs each predicate in turn from the promoted listpz @'[1, 2, 3] 999Present [1,2,3]PresentT [1,2,3]pz @'[W 1, W 2, W 3, Id] 999Present [1,2,3,999]PresentT [1,2,3,999]Ipredicate-typed=extracts the value level representation of the type level '[] pz @'[] False Present [] PresentT []Jpredicate-typed=extracts the value level representation of the type level '() pz @'() () Present () PresentT ()Kpredicate-typed:extracts the value level representation of the type level  pz @123 () Present 123 PresentT 123Lpredicate-typed8extracts the value level representation of the promoted pz @'LT "not used" Present LT PresentT LT pz @'EQ () Present EQ PresentT EQMpredicate-typed(run the predicates in a promoted 8-tuple.pz @'(4, Id, "inj", 999, 'LT, 1, 2, 3) "hello"&Present (4,"hello","inj",999,LT,1,2,3)'PresentT (4,"hello","inj",999,LT,1,2,3)Npredicate-typed(run the predicates in a promoted 7-tuple+pz @'(4, Id, "inj", 999, 'LT, 1, 2) "hello"$Present (4,"hello","inj",999,LT,1,2)%PresentT (4,"hello","inj",999,LT,1,2)Opredicate-typed(run the predicates in a promoted 6-tuple(pz @'(4, Id, "inj", 999, 'LT, 1) "hello""Present (4,"hello","inj",999,LT,1)#PresentT (4,"hello","inj",999,LT,1)Ppredicate-typed(run the predicates in a promoted 5-tuple%pz @'(4, Id, "inj", 999, 'LT) "hello" Present (4,"hello","inj",999,LT)!PresentT (4,"hello","inj",999,LT)Qpredicate-typed(run the predicates in a promoted 4-tuple pz @'(4, Id, "inj", 999) "hello"Present (4,"hello","inj",999)PresentT (4,"hello","inj",999)Rpredicate-typed(run the predicates in a promoted 3-tuplepz @'(4, Id, "goodbye") "hello"Present (4,"hello","goodbye")PresentT (4,"hello","goodbye")pe @'( 'True, 'False, 123) TrueP '(,,)| +- True 'True|+- False 'False| `- P '123PresentT (True,False,123)Spredicate-typed5run the predicates in a promoted 2-tuple; similar to pz @'(Id, 4) "hello"Present ("hello",4)PresentT ("hello",4)Tpredicate-typedpulls the type level  to the value level as a pz @"hello world" ()Present "hello world"PresentT "hello world"Upredicate-typedpulls the type level  to the value levelpz @'True "not used"TrueTrueT pz @'False ()FalseFalseTWpredicate-typed () function pz @() "Asf" Present () PresentT ().predicate-typedreturns a tree of results'()*+,-./0123456789:;<=>+*)('12349:;5786<,-.=>/0None,-.7:=>?@AHIMPSVXkp`predicate-typedthe constraints that a must adhere toapredicate-typedNa simple refinement type that ensures the predicate 'p' holds for the type 'a'&prtRefinedIO @(Between 10 14 Id) oz 13 Right (Refined {unRefined = 13})&prtRefinedIO @(Between 10 14 Id) oz 99 Left FalsePCprtRefinedIO @(Last Id >> Len == 4) oz ["one","two","three","four"]:Right (Refined {unRefined = ["one","two","three","four"]})UprtRefinedIO @(Re "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$" Id) oz "141.213.1.99",Right (Refined {unRefined = "141.213.1.99"})RprtRefinedIO @(Re "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$" Id) oz "141.213.1" Left FalsePprtRefinedIO @(Map (ReadP Int Id) (Resplit "\\." Id) >> Guard (PrintF "bad length: found %d" Len) (Len == 4) >> 'True) oz "141.213.1""Left (FailP "bad length: found 3")prtRefinedIO @(Map (ReadP Int Id) (Resplit "\\." Id) >> Guard (PrintF "bad length: found %d" Len) (Len == 4) >> GuardsN (PrintT "octet %d out of range %d" Id) 4 (Between 0 255 Id) >> 'True) oz "141.213.1.444"'Left (FailP "octet 3 out of range 444")prtRefinedIO @(Map (ReadP Int Id) (Resplit "\\." Id) >> Guard (PrintF "bad length: found %d" Len) (Len == 4) >> GuardsN (PrintT "octet %d out of range %d" Id) 4 (Between 0 255 Id) >> 'True) oz "141.213.1x34.444"Left (FailP "ReadP Int (1x34)")DprtRefinedIO @(Map ('[Id] >> ReadP Int Id) Id >> Luhn Id) oz "12344"%Right (Refined {unRefined = "12344"})DprtRefinedIO @(Map ('[Id] >> ReadP Int Id) Id >> Luhn Id) oz "12340" Left FalseP2prtRefinedIO @(Any (Prime Id) Id) oz [11,13,17,18]+Right (Refined {unRefined = [11,13,17,18]})2prtRefinedIO @(All (Prime Id) Id) oz [11,13,17,18] Left FalsePQprtRefinedIO @(Snd Id !! Fst Id >> Len > 5) oz (2,["abc","defghij","xyzxyazsfd"])@Right (Refined {unRefined = (2,["abc","defghij","xyzxyazsfd"])})RprtRefinedIO @(Snd Id !! Fst Id >> Len > 5) oz (27,["abc","defghij","xyzxyazsfd"])#Left (FailP "(!!) index not found")RprtRefinedIO @(Snd Id !! Fst Id >> Len <= 5) oz (2,["abc","defghij","xyzxyazsfd"]) Left FalsePcpredicate-typed value for adpredicate-typed binary operation applied to two ] valuesepredicate-typed%takes two values and lifts them into ]& and then applies the binary operationfpredicate-typedsame as d except we already have valid a values as inputgpredicate-typedattempts to lift a refinement type to another refinement type by way of transformation function you can control both the predicate and the typehpredicate-typedinvokes the callback with the a, value if 'a' is valid for the predicate 'p'jpredicate-typedsame as k but prints the resultskpredicate-typed returns a a, value if 'a' is valid for the predicate 'p'lpredicate-typedreturns a wrapper ] around a possible a, value if 'a' is valid for the predicate 'p'rpredicate-typeda way to unsafely create a a valuespredicate-typeda way to unsafely create a a value but run the predicatetpredicate-typed instance for aupredicate-typed instance for avpredicate-typed instance for aimport Data.Timeimport Control.Lensimport Control.Arrow ((+++))0type K1 = Refined (ReadP Day Id >> 'True) Stringctype K2 = Refined (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 {unRefined = "2019-04-23"}DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)Refined:FalsePFalse 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-01wpredicate-typed instance for a:set -XOverloadedStrings import qualified Data.Aeson as A6A.eitherDecode' @(Refined (Between 10 14 Id) Int) "13" Right (Refined {unRefined = 13})CremoveAnsi $ A.eitherDecode' @(Refined (Between 10 14 Id) Int) "16" Error in $: Refined:FalsePFalse 16 <= 14| +- P Id 16|+- P '10|`- P '14xpredicate-typed instance for aCreads @(Refined (Between 0 255 Id) Int) "Refined {unRefined = 254}" [(Refined {unRefined = 254},"")]Creads @(Refined (Between 0 255 Id) Int) "Refined {unRefined = 300}"[]]^_`abcdefghijklmnopqrsab`k]^_jpqhilmcgnodefrsNone&',-.1:=>?@AHISUVXk!predicate-typedused by : for extracting the input type 'i' from a promoted 4-tuplepredicate-typedused by - for extracting 'fmt' from a promoted 4-tuple8pl @(T4_3 Predicate.Examples.Refined3.Ip4) [141,513,9,4]OPresent "141.513.009.004" (PrintL(4) [141.513.009.004] | s=%03d.%03d.%03d.%03d)PresentT "141.513.009.004"predicate-typedused by B for extracting the boolean predicate 'op' from a promoted 4-tuple:pl @(T4_2 Predicate.Examples.Refined3.Ip4) [141,213,308,4]*Error octet 2 out of range 0-255 found 308,FailT "octet 2 out of range 0-255 found 308"<pl @(T4_2 Predicate.Examples.Refined3.Ip4) [141,213,308,4,8])Error Guards:invalid length(5) expected 4+FailT "Guards:invalid length(5) expected 4"predicate-typedused by ( to extract 'ip' from a promoted 4-tuple4pl @(T4_1 Predicate.Examples.Refined3.Ip4) "1.2.3.4"5Present [1,2,3,4] (Map [1,2,3,4] | ["1","2","3","4"])PresentT [1,2,3,4]predicate-typed emulates a using ? by setting the input conversion and output formatting as noopspredicate-typedZAn ADT that summarises the results of evaluating Refined3 representing all possible statespredicate-typed>type family for converting from a 4-tuple '(ip,op,fmt,i) to a  typepredicate-typed$Provides the constraints on Refined3predicate-typed9Refinement type that differentiates the input from outputi is the input typeip converts i to PP ip i* which is the internal 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 PP fmt (PP ip i)& should be valid as input for Refined3Setting ip to Id and fmt to Id makes it 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 likeDprtEval3 @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) oz "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})DprtEval3 @(ReadBase Int 16 Id) @(Lt 253) @(PrintF "%x" Id) oz "00fe"-Left Step 2. False Boolean Check(op) | FalsePDprtEval3 @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) oz "00fg"<Left Step 1. Initial Conversion(ip) Failed | invalid base 16prtEval3 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Msg "length invalid:" (Len == 4)) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) ol "198.162.3.1.5">Left Step 2. False Boolean Check(op) | {length invalid:5 == 4}prtEval3 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) oz "198.162.3.1.5"6Left Step 2. Failed Boolean Check(op) | found length=5prtEval3 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) oz "198.162.3.1"BRight (Refined3 {r3In = [198,162,3,1], r3Out = "198.162.003.001"}) :m + Data.Time.Calendar.WeekDateuprtEval3 @(MkDay >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) oz (2019,10,13)ARight (Refined3 {r3In = (2019-10-13,41,7), r3Out = (2019,10,13)})kprtEval3 @(MkDay >> 'Just Id) @(Msg "expected a Sunday:" (Thd Id == 7)) @(UnMkDay (Fst Id)) ol (2019,10,12)ALeft Step 2. False Boolean Check(op) | {expected a Sunday:6 == 7}prtEval3 @(MkDay' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) oz (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a Sundaygtype T4 k = '(MkDay >> 'Just Id, Guard "expected a Sunday" (Thd Id == 7) >> 'True, UnMkDay (Fst Id), k))prtEval3P (Proxy @(T4 _)) oz (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a Sunday)prtEval3P (Proxy @(T4 _)) oz (2019,10,13)ARight (Refined3 {r3In = (2019-10-13,41,7), r3Out = (2019,10,13)})predicate-typeddirectly load values into 4. It still checks to see that those values are validpredicate-typeddirectly load values into  without any checkingpredicate-typed(uses arbitrary to generate the internal $ and then uses 'fmt' to fill in the  valuepredicate-typedcreates a 4-tuple proxy (see    )Quse type application to set the 4-tuple or set the individual parameters directlyset the 4-tuple directly8eg1 = mkProxy3 @'(ReadP Int Id, Gt 10, ShowP Id, String)prtEval3P eg1 ol "24"*Right (Refined3 {r3In = 24, r3Out = "24"})Kskip the 4-tuple and set each parameter individually using type application6eg2 = mkProxy3 @_ @(ReadP Int Id) @(Gt 10) @(ShowP Id)prtEval3P eg2 ol "24"*Right (Refined3 {r3In = 24, r3Out = "24"})predicate-typedsame as : but checks to make sure the proxy is consistent with the  constraintpredicate-typed create a  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 -XPolyKindsNb16 = Proxy @'(ReadBase Int 16 Id, Between 100 200 Id, ShowBase 16 Id, String)>b2 = Proxy @'(ReadBase Int 2 Id, 'True, ShowBase 2 Id, String)sprtRefinedTIO $ withRefined3TP b16 oz "a3" $ \x -> withRefined3TP b2 oz "1001110111" $ \y -> pure (r3In x + r3In y)7947this example fails as the the hex value is out of rangeiprtRefinedTIO $ withRefined3TP b16 o0 "a388" $ \x -> withRefined3TP b2 o0 "1001110111" $ \y -> pure (x,y)6*** Step 1. Success Initial Conversion(ip) [41864] ***!P ReadBase(Int,16) 41864 | "a388"|`- P Id "a388"'*** Step 2. False Boolean Check(op) ***False 41864 <= 200| +- P Id 41864| +- P '100| `- P '200=failure msg[Step 2. False Boolean Check(op) | {41864 <= 200}]predicate-typedcreate a wrapped  typeprtRefinedTIO $ newRefined3TP (Proxy @'(MkDay >> Just Id, GuardSimple (Thd Id == 5) >> 'True, UnMkDay (Fst Id), (Int,Int,Int))) oz (2019,11,1)8Refined3 {r3In = (2019-11-01,44,5), r3Out = (2019,11,1)}wprtRefinedTIO $ newRefined3TP (Proxy @'(MkDay >> Just Id, Thd Id == 5, UnMkDay (Fst Id), (Int,Int,Int))) ol (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]prtRefinedTIO $ newRefined3TP (Proxy @'(MkDay >> Just Id, Msg "wrong day:" (Thd Id == 5), UnMkDay (Fst Id), (Int,Int,Int))) ol (2019,11,2)Afailure msg[Step 2. False Boolean Check(op) | {wrong day:6 == 5}]predicate-typedattempts to cast a wrapped  to another  with different predicatespredicate-typed*applies a binary operation to two wrapped  parameterspredicate-typedsame as ! but uses a 4-tuple proxy insteadpredicate-typedsame as  but runs in IOpredicate-typedsame as ] but skips the proxy and allows you to set each parameter individually using type applicationpredicate-typedLcreate a Refined3 using a 4-tuple proxy and aggregate the results on failurepredicate-typed3create a Refined3 value using a 4-tuple proxy (see )use / to package all the types together as a 4-tuplepredicate-typedsame as @ but can pass the parameters individually using type applicationpredicate-typed7creates Refined3 value but skips the initial conversionpredicate-typedcalculates from internal valuepredicate-typed similar to  but it emulates  but using aVtakes a 4-tuple proxy as input but outputs the Refined value and the result separately1initial conversion using 'ip' and stores that in aTruns 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 a and the output from 3.Bif any of the above steps fail the process stops it and dumps out predicate-typedsame as I but allows you to set the parameters individually using type applicationpredicate-typed instance for  import qualified Data.Aeson as A^A.encode (unsafeRefined3 @(ReadBase Int 16 Id) @(Between 0 255 Id) @(ShowBase 16 Id) 254 "fe")"\"fe\""0A.encode (unsafeRefined3 @Id @'True @Id 123 123)"123"predicate-typed instance for predicate-typed instance for import Control.Arrow ((+++))import Control.Lensimport Data.Time9type K1 = MakeR3 '(ReadP Day Id, 'True, ShowP Id, String)ptype K2 = MakeR3 '(ReadP Day Id, Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") Id, ShowP Id, String))r = unsafeRefined3' oz "2019-04-23" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)2Refined3 {r3In = 2019-04-23, r3Out = "2019-04-23"}DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)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-01predicate-typed instance for  import qualified Data.Aeson as AiA.eitherDecode' @(Refined3 (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe\""+Right (Refined3 {r3In = 254, r3Out = "fe"})zremoveAnsi $ A.eitherDecode' @(Refined3 (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe443a\""YError in $: Refined3:Step 2. False Boolean Check(op) | {True && False | (16663610 < 256)}9*** Step 1. Success Initial Conversion(ip) [16663610] ***(P ReadBase(Int,16) 16663610 | "00fe443a"|`- P Id "00fe443a"'*** Step 2. False Boolean Check(op) ***&False True && False | (16663610 < 256)|+- True 16663610 > 10| || +- P Id 16663610| | | `- P '10|`- False 16663610 < 256 | +- P Id 16663610 | `- P '256predicate-typed instance for yreads @(Refined3 (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined3 {r3In = 254, r3Out = \"fe\"}"*[(Refined3 {r3In = 254, r3Out = "fe"},"")]zreads @(Refined3 (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined3 {r3In = 300, r3Out = \"12c\"}"[]sreads @(Refined3 (ReadBase Int 16 Id) (Id < 0) (ShowBase 16 Id) String) "Refined3 {r3In = -1234, r3Out = \"-4d2\"}".[(Refined3 {r3In = -1234, r3Out = "-4d2"},"")]reads @(Refined3 (Map (ReadP Int Id) (Resplit "\\." Id)) (Guard "len/=4" (Len == 4) >> 'True) (PrintL 4 "%d.%d.%d.%d" Id) String) "Refined3 {r3In = [192,168,0,1], r3Out = \"192.168.0.1\"}"=[(Refined3 {r3In = [192,168,0,1], r3Out = "192.168.0.1"},"")]..None&',-.1:=>?@AHISUVXkpredicate-typedused by : for extracting the input type 'i' from a promoted 3-tuplepredicate-typedused by B for extracting the boolean predicate 'op' from a promoted 3-tuplepredicate-typedused by ( to extract 'ip' from a promoted 3-tuplepredicate-typed:type family for converting from a 3-tuple '(ip,op,i) to a  typepredicate-typedZAn ADT that summarises the results of evaluating Refined2 representing all possible statespredicate-typed$Provides the constraints on Refined2predicate-typed?Refinement type that allows the input and output types to vary.i& is the input type which is stored in ip converts i to PP ip i which is the internal type in op$ validates that internal type using PP op (PP ip i) ~ Bool]Although a common scenario is String as input, you are free to choose any input type you like2prtEval2 @(ReadBase Int 16 Id) @(Lt 255) oz "00fe"-Right (Refined2 {r2In = 254, r2Out = "00fe"})2prtEval2 @(ReadBase Int 16 Id) @(Lt 253) oz "00fe"-Left Step 2. False Boolean Check(op) | FalseP2prtEval2 @(ReadBase Int 16 Id) @(Lt 255) oz "00fg"<Left Step 1. Initial Conversion(ip) Failed | invalid base 16hprtEval2 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Msg "length invalid:" (Len == 4)) ol "198.162.3.1.5">Left Step 2. False Boolean Check(op) | {length invalid:5 == 4}prtEval2 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) oz "198.162.3.1.5"6Left Step 2. Failed Boolean Check(op) | found length=5~prtEval2 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) oz "198.162.3.1">Right (Refined2 {r2In = [198,162,3,1], r2Out = "198.162.3.1"}) :m + Data.Time.Calendar.WeekDateaprtEval2 @(MkDay >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) oz (2019,10,13)ARight (Refined2 {r2In = (2019-10-13,41,7), r2Out = (2019,10,13)})WprtEval2 @(MkDay >> 'Just Id) @(Msg "expected a Sunday:" (Thd Id == 7)) ol (2019,10,12)ALeft Step 2. False Boolean Check(op) | {expected a Sunday:6 == 7}}prtEval2 @(MkDay' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) oz (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a Sundaypredicate-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  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 @(ReadBase Int 16 Id) @(Between 100 200 Id) oz "a3" $ \x -> withRefined2T @(ReadBase Int 2 Id) @'True oz "1001110111" $ \y -> pure (r2In x + r2In y)7947this example fails as the the hex value is out of rangeprtRefinedTIO $ withRefined2T @(ReadBase Int 16 Id) @(Between 100 200 Id) o0 "a388" $ \x -> withRefined2T @(ReadBase Int 2 Id) @'True o0 "1001110111" $ \y -> pure (x,y)6*** Step 1. Success Initial Conversion(ip) [41864] ***!P ReadBase(Int,16) 41864 | "a388"|`- P Id "a388"'*** Step 2. False Boolean Check(op) ***False 41864 <= 200| +- P Id 41864| +- P '100| `- P '200=failure msg[Step 2. False Boolean Check(op) | {41864 <= 200}]predicate-typedcreate a wrapped  typeQprtRefinedTIO $ newRefined2T @_ @(MkDay >> Just Id) @(Thd Id == 5) ol (2019,11,1)8Refined2 {r2In = (2019-11-01,44,5), r2Out = (2019,11,1)}QprtRefinedTIO $ newRefined2T @_ @(MkDay >> Just Id) @(Thd Id == 5) ol (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]dprtRefinedTIO $ newRefined2T @_ @(MkDay >> Just Id) @(Msg "wrong day:" (Thd Id == 5)) ol (2019,11,2)Afailure msg[Step 2. False Boolean Check(op) | {wrong day:6 == 5}]predicate-typedsame as  but runs in IOpredicate-typedcreates a 3-tuple proxy (see    )Quse type application to set the 4-tuple or set the individual parameters directlyset the 3-tuple directly.eg1 = mkProxy2 @'(ReadP Int Id, Gt 10, String)prtEval2P eg1 ol "24"*Right (Refined2 {r2In = 24, r2Out = "24"})Kskip the 4-tuple and set each parameter individually using type application*eg2 = mkProxy2 @_ @(ReadP Int Id) @(Gt 10)prtEval2P eg2 ol "24"*Right (Refined2 {r2In = 24, r2Out = "24"})predicate-typedsame as : but checks to make sure the proxy is consistent with the  constraintpredicate-typed instance for  import qualified Data.Aeson as ALA.encode (unsafeRefined2 @(ReadBase Int 16 Id) @(Between 0 255 Id) 254 "fe")"\"fe\""1A.encode (unsafeRefined2 @Id @'True @Int 123 123)"123"predicate-typed instance for predicate-typed instance for import Control.Arrow ((+++))import Control.Lensimport Data.Time.type K1 = Refined2 (ReadP Day Id) 'True Stringgtype K2 = Refined2 (ReadP Day Id) (Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") Id) String)r = unsafeRefined2' oz "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-01predicate-typed instance for  import qualified Data.Aeson as AXA.eitherDecode' @(Refined2 (ReadBase Int 16 Id) (Id > 10 && Id < 256) String) "\"00fe\""-Right (Refined2 {r2In = 254, r2Out = "00fe"})iremoveAnsi $ A.eitherDecode' @(Refined2 (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 | "00fe443a"|`- P Id "00fe443a"'*** Step 2. False Boolean Check(op) ***&False True && False | (16663610 < 256)|+- True 16663610 > 10| || +- P Id 16663610| | | `- P '10|`- False 16663610 < 256 | +- P Id 16663610 | `- P '256predicate-typed instance for hreads @(Refined2 (ReadBase Int 16 Id) (Between 0 255 Id) String) "Refined2 {r2In = 254, r2Out = \"fe\"}"*[(Refined2 {r2In = 254, r2Out = "fe"},"")]ireads @(Refined2 (ReadBase Int 16 Id) (Between 0 255 Id) String) "Refined2 {r2In = 300, r2Out = \"12c\"}"[]breads @(Refined2 (ReadBase Int 16 Id) (Id < 0) String) "Refined2 {r2In = -1234, r2Out = \"-4d2\"}".[(Refined2 {r2In = -1234, r2Out = "-4d2"},"")]reads @(Refined2 (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"},"")]$$None&',-.1:=>?@AHISUVXk"Z!predicate-typedused by : for extracting the input type 'i' from a promoted 4-tuplepredicate-typedused by - for extracting 'fmt' from a promoted 4-tuple8pl @(T4_3 Predicate.Examples.Refined3.Ip4) [141,513,9,4]OPresent "141.513.009.004" (PrintL(4) [141.513.009.004] | s=%03d.%03d.%03d.%03d)PresentT "141.513.009.004"predicate-typedused by B for extracting the boolean predicate 'op' from a promoted 4-tuple:pl @(T4_2 Predicate.Examples.Refined3.Ip4) [141,213,308,4]*Error octet 2 out of range 0-255 found 308,FailT "octet 2 out of range 0-255 found 308"<pl @(T4_2 Predicate.Examples.Refined3.Ip4) [141,213,308,4,8])Error Guards:invalid length(5) expected 4+FailT "Guards:invalid length(5) expected 4"predicate-typedused by ( to extract 'ip' from a promoted 4-tuple4pl @(T4_1 Predicate.Examples.Refined3.Ip4) "1.2.3.4"5Present [1,2,3,4] (Map [1,2,3,4] | ["1","2","3","4"])PresentT [1,2,3,4]predicate-typed emulates a using ? by setting the input conversion and output formatting as noopspredicate-typedZAn ADT that summarises the results of evaluating Refined1 representing all possible statespredicate-typed>type family for converting from a 4-tuple '(ip,op,fmt,i) to a  typepredicate-typed$Provides the constraints on Refined1predicate-typedFRefinement type that differentiates the input from output: similar to - but only creates the output value as needed.i is the input typeip converts i to PP ip i* which is the internal type and stored in op$ validates that internal type using PP op (PP ip i) ~ Boolfmt outputs the internal type PP fmt (PP ip i) ~ i, (not stored anywhere but created on demand)PP fmt (PP ip i)& should be valid as input for Refined1Setting ip to Id and fmt to Id makes it 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- (does not store the formatted result unlike )]Although a common scenario is String as input, you are free to choose any input type you likeDprtEval1 @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) oz "00fe"#Right (Refined1 {unRefined1 = 254})DprtEval1 @(ReadBase Int 16 Id) @(Lt 253) @(PrintF "%x" Id) oz "00fe"-Left Step 2. False Boolean Check(op) | FalsePDprtEval1 @(ReadBase Int 16 Id) @(Lt 255) @(PrintF "%x" Id) oz "00fg"<Left Step 1. Initial Conversion(ip) Failed | invalid base 16prtEval1 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Msg "length invalid:" (Len == 4)) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) ol "198.162.3.1.5">Left Step 2. False Boolean Check(op) | {length invalid:5 == 4}prtEval1 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) oz "198.162.3.1.5"6Left Step 2. Failed Boolean Check(op) | found length=5prtEval1 @(Map (ReadP Int Id) (Resplit "\\." Id)) @(Guard (PrintF "found length=%d" Len) (Len == 4) >> 'True) @(PrintL 4 "%03d.%03d.%03d.%03d" Id) oz "198.162.3.1"-Right (Refined1 {unRefined1 = [198,162,3,1]}) :m + Data.Time.Calendar.WeekDateuprtEval1 @(MkDay >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) oz (2019,10,13)1Right (Refined1 {unRefined1 = (2019-10-13,41,7)})kprtEval1 @(MkDay >> 'Just Id) @(Msg "expected a Sunday:" (Thd Id == 7)) @(UnMkDay (Fst Id)) ol (2019,10,12)ALeft Step 2. False Boolean Check(op) | {expected a Sunday:6 == 7}prtEval1 @(MkDay' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) oz (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a Sundaygtype T4 k = '(MkDay >> 'Just Id, Guard "expected a Sunday" (Thd Id == 7) >> 'True, UnMkDay (Fst Id), k))prtEval1P (Proxy @(T4 _)) oz (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a Sunday)prtEval1P (Proxy @(T4 _)) oz (2019,10,13)1Right (Refined1 {unRefined1 = (2019-10-13,41,7)})predicate-typeddirectly load values into 4. It still checks to see that those values are validpredicate-typeddirectly load values into  without any checkingpredicate-typed(uses arbitrary to generate the internal 0 and then uses 'fmt' to fill create output value predicate-typedcreates a 4-tuple proxy (see     )Quse type application to set the 4-tuple or set the individual parameters directlyset the 4-tuple directly8eg1 = mkProxy1 @'(ReadP Int Id, Gt 10, ShowP Id, String)prtEval1P eg1 ol "24""Right (Refined1 {unRefined1 = 24})Kskip the 4-tuple and set each parameter individually using type application6eg2 = mkProxy1 @_ @(ReadP Int Id) @(Gt 10) @(ShowP Id)prtEval1P eg2 ol "24""Right (Refined1 {unRefined1 = 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 -XPolyKindsNb16 = Proxy @'(ReadBase Int 16 Id, Between 100 200 Id, ShowBase 16 Id, String)>b2 = Proxy @'(ReadBase Int 2 Id, 'True, ShowBase 2 Id, String)prtRefinedTIO $ 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 rangeiprtRefinedTIO $ withRefined1TP b16 o0 "a388" $ \x -> withRefined1TP b2 o0 "1001110111" $ \y -> pure (x,y)6*** Step 1. Success Initial Conversion(ip) [41864] ***!P ReadBase(Int,16) 41864 | "a388"|`- P Id "a388"'*** Step 2. False Boolean Check(op) ***False 41864 <= 200| +- P Id 41864| +- P '100| `- P '200=failure msg[Step 2. False Boolean Check(op) | {41864 <= 200}]predicate-typedcreate a wrapped  typeprtRefinedTIO $ newRefined1TP (Proxy @'(MkDay >> Just Id, GuardSimple (Thd Id == 5) >> 'True, UnMkDay (Fst Id), (Int,Int,Int))) oz (2019,11,1))Refined1 {unRefined1 = (2019-11-01,44,5)}wprtRefinedTIO $ newRefined1TP (Proxy @'(MkDay >> Just Id, Thd Id == 5, UnMkDay (Fst Id), (Int,Int,Int))) ol (2019,11,2)7failure msg[Step 2. False Boolean Check(op) | {6 == 5}]prtRefinedTIO $ newRefined1TP (Proxy @'(MkDay >> Just Id, Msg "wrong day:" (Thd Id == 5), UnMkDay (Fst Id), (Int,Int,Int))) ol (2019,11,2)Afailure msg[Step 2. False Boolean Check(op) | {wrong day:6 == 5}]predicate-typedattempts to cast a wrapped  to another  with different predicatespredicate-typed*applies a binary operation to two wrapped  parameterspredicate-typedsame as ! but uses a 4-tuple proxy insteadpredicate-typedsame as  but runs in IOpredicate-typedsame as ] but skips the proxy and allows you to set each parameter individually using type applicationpredicate-typedLcreate a Refined1 using a 4-tuple proxy and aggregate the results on failurepredicate-typed3create a Refined1 value using a 4-tuple proxy (see  )use  / to package all the types together as a 4-tuplepredicate-typedsame as @ but can pass the parameters individually using type applicationpredicate-typed7creates Refined1 value but skips the initial conversionpredicate-typedcalculates from internal valuepredicate-typed similar to  but it emulates  but using aVtakes a 4-tuple proxy as input but outputs the Refined value and the result separately1initial conversion using 'ip' and stores that in aTruns 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 a and the output from 3.Bif any of the above steps fail the process stops it and dumps out predicate-typedsame as I but allows you to set the parameters individually using type applicationpredicate-typed instance for  import qualified Data.Aeson as AYA.encode (unsafeRefined1 @(ReadBase Int 16 Id) @(Between 0 255 Id) @(ShowBase 16 Id) 254)"\"fe\"",A.encode (unsafeRefined1 @Id @'True @Id 123)"123"predicate-typed instance for  predicate-typed instance for import Control.Arrow ((+++))import Control.Lensimport Data.Time9type K1 = MakeR1 '(ReadP Day Id, 'True, ShowP Id, String)ptype K2 = MakeR1 '(ReadP Day Id, Between (ReadP Day "2019-05-30") (ReadP Day "2019-06-01") Id, ShowP Id, String))r = unsafeRefined1' oz "2019-04-23" :: K1DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)"Refined1 {unRefined1 = 2019-04-23}DremoveAnsi $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)ERefined1:Step 2. False Boolean Check(op) | {2019-05-30 <= 2019-04-23};*** Step 1. Success Initial Conversion(ip) [2019-04-23] ***P ReadP Day 2019-04-23|`- P Id "2019-04-23"'*** Step 2. False Boolean Check(op) ***False 2019-05-30 <= 2019-04-23|+- P Id 2019-04-23|+- P ReadP Day 2019-05-30| || `- P '2019-05-30|`- P ReadP Day 2019-06-01 | `- P '2019-06-01!predicate-typed instance for  import qualified Data.Aeson as AiA.eitherDecode' @(Refined1 (ReadBase Int 16 Id) (Id > 10 && Id < 256) (ShowBase 16 Id) String) "\"00fe\""#Right (Refined1 {unRefined1 = 254})zremoveAnsi $ A.eitherDecode' @(Refined1 (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 | "00fe443a"|`- P Id "00fe443a"'*** Step 2. False Boolean Check(op) ***&False True && False | (16663610 < 256)|+- True 16663610 > 10| || +- P Id 16663610| | | `- P '10|`- False 16663610 < 256 | +- P Id 16663610 | `- P '256"predicate-typed instance for oreads @(Refined1 (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined1 {unRefined1 = 254}""[(Refined1 {unRefined1 = 254},"")]oreads @(Refined1 (ReadBase Int 16 Id) (Between 0 255 Id) (ShowBase 16 Id) String) "Refined1 {unRefined1 = 300}"[]greads @(Refined1 (ReadBase Int 16 Id) (Id < 0) (ShowBase 16 Id) String) "Refined1 {unRefined1 = -1234}"$[(Refined1 {unRefined1 = -1234},"")]reads @(Refined1 (Map (ReadP Int Id) (Resplit "\\." Id)) (Guard "len/=4" (Len == 4) >> 'True) (PrintL 4 "%d.%d.%d.%d" Id) String) "Refined1 {unRefined1 = [192,168,0,1]}",[(Refined1 {unRefined1 = [192,168,0,1]},"")]-     -     None%&',-.=>?@AHPSUVX_k +predicate-typed6splits a list pointed to by 'p' into lists of size 'n'pz @(ChunksOf 2 Id) "abcdef"Present ["ab","cd","ef"]PresentT ["ab","cd","ef"]pz @(ChunksOf 2 Id) "abcdefg"Present ["ab","cd","ef","g"]PresentT ["ab","cd","ef","g"]pz @(ChunksOf 2 Id) "" Present [] PresentT []pz @(ChunksOf 2 Id) "a" Present ["a"]PresentT ["a"],predicate-typed"very simple conversion to a string.predicate-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)TrueT0predicate-typedlike  but for a tuple2pl @(SplitAt 4 "abcdefg" >> Len > 4 &* Len < 5) ()0False ((>>) False | {False (&*) True | (4 > 4)})FalseT1predicate-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))FalseT2predicate-typedencode a json file3predicate-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)Qpl @(ParseJson ([String], These Int ()) (EncodeJson Id)) (["abc","def"],This 110)_Present (["abc","def"],This 110) (ParseJson ([[Char]],(These Int ())) (["abc","def"],This 110))!PresentT (["abc","def"],This 110)5predicate-typedparse a json file7predicate-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]"6Error ParseJson (Int,[Char])([10,"abc",...) Error in $: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]"'Error ParseJson ()([1,true]) Error in $)FailT "ParseJson ()([1,true]) Error in $"8predicate-typed(gets the singleton value from a foldablepl @(OneP Id) [10..15]Error OneP 6 elementsFailT "OneP 6 elements"pl @(OneP Id) [10]Present 10 (OneP) PresentT 10pl @(OneP Id) []Error OneP emptyFailT "OneP empty"pl @(OneP Id) (Just 10)Present 10 (OneP) PresentT 10pl @(OneP Id) NothingError OneP emptyFailT "OneP empty"9predicate-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 /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)FalseT=predicate-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 2>predicate-typedcompose simple functions0pl @(Dot '[Thd,Snd,Fst] Id) ((1,(2,9,10)),(3,4))Present 10 (Thd 10 | (2,9,10)) PresentT 10?predicate-typedtries to extract a from Maybe a otherwise it failspz @(Just Id) (Just "abc") Present "abc"PresentT "abc"pz @(Just Id) NothingError Just(empty)FailT "Just(empty)"@predicate-typed'takes the init of a list like containerpz @(Init Id) "abcd" Present "abc"PresentT "abc"pz @(Init Id) (T.pack "abcd") Present "abc"PresentT "abc"pz @(Init Id) []Error Init(empty)FailT "Init(empty)"Apredicate-typed'takes the last of a list like containerpz @(Last Id) "abcd" Present 'd' PresentT 'd'pz @(Last Id) []Error Last(empty)FailT "Last(empty)"Bpredicate-typed'takes the tail of a list like containerpz @(Tail Id) "abcd" Present "bcd"PresentT "bcd"pz @(Tail Id) []Error Tail(empty)FailT "Tail(empty)"Cpredicate-typed'takes the head of a list like containerpz @(Head Id) "abcd" Present 'a' PresentT 'a'pz @(Head Id) []Error Head(empty)FailT "Head(empty)"Dpredicate-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)Present ("abc",20.4)PresentT ("abc",20.4)%pz @(TheseFail "oops" Id) (That "aa") Error oops FailT "oops"\pz @(TheseFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,That "xy")Error found That "xy" fst=123!FailT "found That \"xy\" fst=123")pz @(TheseFail (MEmptyT _) Id) (That 222)ErrorFailT ""Epredicate-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) Present 20.4 PresentT 20.4$pz @(ThatFail "oops" Id) (This "aa") Error oops FailT "oops"[pz @(ThatFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,This "xy")Error found This "xy" fst=123!FailT "found This \"xy\" fst=123"(pz @(ThatFail (MEmptyT _) Id) (This 222)ErrorFailT ""Fpredicate-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) Present 20.4 PresentT 20.4$pz @(ThisFail "oops" Id) (That "aa") Error oops FailT "oops"[pz @(ThisFail (PrintT "found %s fst=%d" '(ShowP (Snd Id),Fst Id)) (Snd Id)) (123,That "xy")Error found That "xy" fst=123!FailT "found That \"xy\" fst=123"(pz @(ThisFail (MEmptyT _) Id) (That 222)ErrorFailT ""Gpredicate-typed extract the These value from an  otherwise use the default valueBif there is no These value then p is passed the whole context only0pz @(TheseDef '(1 % 4,"zz") Id) (These 20.4 "x")Present (102 % 5,"x")PresentT (102 % 5,"x")+pz @(TheseDef '(1 % 4,"zz") Id) (This 20.4)Present (1 % 4,"zz")PresentT (1 % 4,"zz")*pz @(TheseDef '(1 % 4,"zz") Id) (That "x")Present (1 % 4,"zz")PresentT (1 % 4,"zz")apz @(TheseDef '(PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id),999) (Snd Id)) (123,This "xy"))Present ("found This \"xy\" fst=123",999)*PresentT ("found This \"xy\" fst=123",999)9pz @(TheseDef (MEmptyT (SG.Sum _, String)) Id) (This 222)Present (Sum {getSum = 0},"")PresentT (Sum {getSum = 0},"")>pz @(TheseDef (MEmptyT _) Id) (These (222 :: SG.Sum Int) "aa")!Present (Sum {getSum = 222},"aa")"PresentT (Sum {getSum = 222},"aa")Hpredicate-typedextract the That value from an  otherwise use the default valueAif there is no That value then p is passed the whole context only$pz @(ThatDef (1 % 4) Id) (That 20.4)Present 102 % 5PresentT (102 % 5)$pz @(ThatDef (1 % 4) Id) (This "aa") Present 1 % 4PresentT (1 % 4))pz @(ThatDef (1 % 4) Id) (These "aa" 2.3) Present 1 % 4PresentT (1 % 4)[pz @(ThatDef (PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id)) (Snd Id)) (123,This "xy")#Present "found This \"xy\" fst=123"$PresentT "found This \"xy\" fst=123"'pz @(ThatDef (MEmptyT _) Id) (This 222) Present () PresentT ()6pz @(ThatDef (MEmptyT (SG.Sum _)) Id) (These 'x' 1120)Present Sum {getSum = 0}PresentT (Sum {getSum = 0})Ipredicate-typedextract the This value from an  otherwise use the default valueAif there is no This value then p is passed the whole context only$pz @(ThisDef (1 % 4) Id) (This 20.4)Present 102 % 5PresentT (102 % 5)$pz @(ThisDef (1 % 4) Id) (That "aa") Present 1 % 4PresentT (1 % 4))pz @(ThisDef (1 % 4) Id) (These 2.3 "aa") Present 1 % 4PresentT (1 % 4)[pz @(ThisDef (PrintT "found %s fst=%d" '(ShowP (Snd Id), Fst Id)) (Snd Id)) (123,That "xy")#Present "found That \"xy\" fst=123"$PresentT "found That \"xy\" fst=123"'pz @(ThisDef (MEmptyT _) Id) (That 222) Present () PresentT ()5pz @(ThisDef (MEmptyT (SG.Sum _)) Id) (These 222 'x')Present Sum {getSum = 0}PresentT (Sum {getSum = 0})Jpredicate-typed extract the Right value from an  otherwise fail with a messagePif there is no Right value then p is passed the Left value and the whole context&pz @(RightFail "oops" Id) (Right 20.4) Present 20.4 PresentT 20.4%pz @(RightFail "oops" Id) (Left "aa") Error oops FailT "oops"_pz @(RightFail (PrintT "found left=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Left "xy")Error found left=xy fst=123FailT "found left=xy fst=123")pz @(RightFail (MEmptyT _) Id) (Left 222)ErrorFailT ""Kpredicate-typedextract the Left value from an  otherwise fail with a messagePif there is no Left value then p is passed the Right value and the whole context$pz @(LeftFail "oops" Id) (Left 20.4) Present 20.4 PresentT 20.4%pz @(LeftFail "oops" Id) (Right "aa") Error oops FailT "oops"`pz @(LeftFail (PrintT "found right=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Right "xy")Error found right=xy fst=123FailT "found right=xy fst=123")pz @(LeftFail (MEmptyT _) Id) (Right 222)ErrorFailT ""Lpredicate-typed extract the Right value from an Pif there is no Right value then p is passed the Left value and the whole context&pz @(RightDef (1 % 4) Id) (Right 20.4)Present 102 % 5PresentT (102 % 5)%pz @(RightDef (1 % 4) Id) (Left "aa") Present 1 % 4PresentT (1 % 4)^pz @(RightDef (PrintT "found left=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Left "xy")Present "found left=xy fst=123" PresentT "found left=xy fst=123"(pz @(RightDef (MEmptyT _) Id) (Left 222) Present () PresentT ()1pz @(RightDef (MEmptyT (SG.Sum _)) Id) (Left 222)Present Sum {getSum = 0}PresentT (Sum {getSum = 0})Mpredicate-typedextract the Left value from an  otherwise use the default valuePif there is no Left value then p is passed the Right value and the whole context$pz @(LeftDef (1 % 4) Id) (Left 20.4)Present 102 % 5PresentT (102 % 5)%pz @(LeftDef (1 % 4) Id) (Right "aa") Present 1 % 4PresentT (1 % 4)_pz @(LeftDef (PrintT "found right=%s fst=%d" '(Fst Id,Fst (Snd Id))) (Snd Id)) (123,Right "xy") Present "found right=xy fst=123"!PresentT "found right=xy fst=123"(pz @(LeftDef (MEmptyT _) Id) (Right 222) Present () PresentT ()1pz @(LeftDef (MEmptyT (SG.Sum _)) Id) (Right 222)Present Sum {getSum = 0}PresentT (Sum {getSum = 0})Npredicate-typedextract the value from a  or fail"pz @(JustFail "nope" Id) (Just 99) Present 99 PresentT 99 pz @(JustFail "nope" Id) Nothing Error nope FailT "nope"Bpz @(JustFail (PrintF "oops=%d" (Snd Id)) (Fst Id)) (Nothing, 123)Error oops=123FailT "oops=123"Cpz @(JustFail (PrintF "oops=%d" (Snd Id)) (Fst Id)) (Just 'x', 123) Present 'x' PresentT 'x'Opredicate-typedextract the value from a  otherwise use the default value$pz @(JustDef (1 % 4) Id) (Just 20.4)Present 102 % 5PresentT (102 % 5) pz @(JustDef (1 % 4) Id) Nothing Present 1 % 4PresentT (1 % 4)(pz @(JustDef (MEmptyT _) Id) (Just "xy") Present "xy" PresentT "xy"$pz @(JustDef (MEmptyT _) Id) Nothing Present () PresentT ()-pz @(JustDef (MEmptyT (SG.Sum _)) Id) NothingPresent Sum {getSum = 0}PresentT (Sum {getSum = 0})Ppredicate-typed leverages p8 for repeating predicates (passthrough method) same as DoN n p == FoldN n p Id but more efficientpz @(DoN 4 (Succ Id)) 'c' Present 'g' PresentT 'g'pz @(DoN 4 (Id <> " | ")) "abc"Present "abc | | | | "PresentT "abc | | | | "#pz @(DoN 4 (Id <> "|" <> Id)) "abc"IPresent "abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc"JPresentT "abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc"Qpredicate-typedccreates a promoted list of predicates and then evaluates them into a list. see PP instance for '[k]pz @(Repeat 4 (Succ Id)) 'c'Present "dddd"PresentT "dddd"pz @(Repeat 4 "abc") ()!Present ["abc","abc","abc","abc"]"PresentT ["abc","abc","abc","abc"]predicate-typed similar to  ,pz @(StripL "xyz" Id) ("xyzHello" :: String)Present Just "Hello"PresentT (Just "Hello"))pz @(StripL "xyz" Id) (T.pack "xyzHello")Present Just "Hello"PresentT (Just "Hello") pz @(StripL "xyz" Id) "xywHello"Present NothingPresentT Nothing!pz @(StripR "xyz" Id) "Hello xyz"Present Just "Hello "PresentT (Just "Hello ")#pz @(StripR "xyz" Id) "xyzHelloxyw"Present NothingPresentT Nothingpz @(StripR "xyz" Id) ""Present NothingPresentT Nothingpz @(StripR "xyz" "xyz") ()Present Just ""PresentT (Just "")predicate-typed similar to   0pz @(TrimBoth (Snd Id)) (20," abc " :: String) Present "abc"PresentT "abc"-pz @(TrimBoth (Snd Id)) (20,T.pack " abc ") Present "abc"PresentT "abc"#pz @(TrimL (Snd Id)) (20," abc ")Present "abc "PresentT "abc "#pz @(TrimR (Snd Id)) (20," abc ")Present " abc"PresentT " abc"pz @(TrimR " abc ") ()Present " abc"PresentT " abc"pz @(TrimR "") () Present "" PresentT ""pz @(TrimBoth " ") () Present "" PresentT ""pz @(TrimBoth "") () Present "" PresentT ""Wpredicate-typed9flipped function application for expressions: similar to 9pz @(Snd Id $& Fst Id) ((*16),4) Present 64 PresentT 64@pz @("def" $& Id) ("abc"<>) Present "abcdef" PresentT "abcdef"Xpredicate-typed1function application for expressions: similar to 9pz @(Fst Id $$ Snd Id) ((*16),4) Present 64 PresentT 64@pz @(Id $$ "def") ("abc"<>) Present "abcdef" PresentT "abcdef"Ypredicate-typed similar to pz @Join (Just (Just 20))Present Just 20PresentT (Just 20)pz @Join ["ab","cd","","ef"]Present "abcdef"PresentT "abcdef"Zpredicate-typed similar to pz @Duplicate (20,"abc")Present (20,(20,"abc"))PresentT (20,(20,"abc"))[predicate-typed similar to pz @Extract (Nothing,Just 20)Present Just 20PresentT (Just 20)pz @Extract (Identity 20) Present 20 PresentT 20\predicate-typed similar to )pz @(Fst Id <|> Snd Id) (Nothing,Just 20)Present Just 20PresentT (Just 20))pz @(Fst Id <|> Snd Id) (Just 10,Just 20)Present Just 10PresentT (Just 10))pz @(Fst Id <|> Snd Id) (Nothing,Nothing)Present NothingPresentT Nothingpredicate-typed similar to +pz @(Fst Id <* Snd Id) (Just "abc",Just 20)Present Just "abc"PresentT (Just "abc")_predicate-typed similar to &pz @(Fst Id <$ Snd Id) ("abc",Just 20)Present Just "abc"PresentT (Just "abc")`predicate-typed#print for lists -- if you can use a^pl @(PrintL 4 "%s %s %s %s" '[W "xyz", ShowP (Fst Id), ShowP (Snd Id), Thd Id]) (123,'x',"ab")EPresent "xyz 123 'x' ab" (PrintL(4) [xyz 123 'x' ab] | s=%s %s %s %s)PresentT "xyz 123 'x' ab":pl @(PrintL 3 "first=%d second=%d third=%d" Id) [10,11,12]oPresent "first=10 second=11 third=12" (PrintL(3) [first=10 second=11 third=12] | s=first=%d second=%d third=%d)&PresentT "first=10 second=11 third=12":pl @(PrintL 2 "first=%d second=%d third=%d" Id) [10,11,12]Error PrintL(2) arg count=3FailT "PrintL(2) arg count=3":pl @(PrintL 4 "first=%d second=%d third=%d" Id) [10,11,12]Error PrintL(4) arg count=3FailT "PrintL(4) arg count=3"apredicate-typedprint for flat n-tuplesGpl @(PrintT "%d %s %s %s" '(Fst Id, Snd Id, Snd Id,Snd Id)) (10,"Asdf")HPresent "10 Asdf Asdf Asdf" (PrintT [10 Asdf Asdf Asdf] | s=%d %s %s %s)PresentT "10 Asdf Asdf Asdf"+pl @(PrintT "%c %d %s" Id) ('x', 10,"Asdf")5Present "x 10 Asdf" (PrintT [x 10 Asdf] | s=%c %d %s)PresentT "x 10 Asdf",pz @(PrintT "fst=%s snd=%03d" Id) ("ab",123)Present "fst=ab snd=123"PresentT "fst=ab snd=123"8pz @(PrintT "fst=%s snd=%03d thd=%s" Id) ("ab",123,"xx")Present "fst=ab snd=123 thd=xx" PresentT "fst=ab snd=123 thd=xx"Lpl @(PrintT "%s %d %c %s" '(W "xyz", Fst Id, Snd Id, Thd Id)) (123,'x',"ab")>Present "xyz 123 x ab" (PrintT [xyz 123 x ab] | s=%s %d %c %s)PresentT "xyz 123 x ab"$pl @(PrintT "%d %c %s" Id) (123,'x'):Error PrintT(IO e=printf: argument list ended prematurely)<FailT "PrintT(IO e=printf: argument list ended prematurely)"-pl @(PrintT "%d %c %s" Id) (123,'x',"abc",11)>Error PrintT(IO e=printf: formatting string ended prematurely)@FailT "PrintT(IO e=printf: formatting string ended prematurely)"predicate-typed3uses inductive tuples to replace variable argumentsdpredicate-typed similar to $pz @(Fst Id <> Snd Id) ("abc","def")Present "abcdef"PresentT "abcdef" pz @("abcd" <> "ef" <> Id) "ghi"Present "abcdefghi"PresentT "abcdefghi" pz @("abcd" <> "ef" <> Id) "ghi"Present "abcdefghi"PresentT "abcdefghi"/pz @(Wrap (SG.Sum _) Id <> FromInteger _ 10) 13Present Sum {getSum = 23}PresentT (Sum {getSum = 23})3pz @(Wrap (SG.Product _) Id <> FromInteger _ 10) 13"Present Product {getProduct = 130}%PresentT (Product {getProduct = 130})9pz @('(FromInteger _ 10,"def") <> Id) (SG.Sum 12, "_XYZ")%Present (Sum {getSum = 22},"def_XYZ")&PresentT (Sum {getSum = 22},"def_XYZ")pz @(SapA' (SG.Max _)) (10,12)Present Max {getMax = 12}PresentT (Max {getMax = 12})pz @(SapA' (SG.Sum _)) (10,12)Present Sum {getSum = 22}PresentT (Sum {getSum = 22})predicate-typed similar to    for strings only.4The 'I' suffixed versions work are case insensitive. pz @(IsInfixI "abc" "axAbCd") ()TrueTrueT!pz @(IsPrefixI "abc" "aBcbCd") ()TrueTrueT pz @(IsPrefix "abc" "aBcbCd") ()FalseFalseT pz @(IsSuffix "bCd" "aBcbCd") ()TrueTrueTkpredicate-typedread a value from stdinmpredicate-typedEread in a value of a given type from stdin with a prompt: similar to npredicate-typedwrite a string value to stderropredicate-typedwrite a string value to stdoutppredicate-typed"write to file, without overwritingqpredicate-typed$write to file, overwriting if neededrpredicate-typedappend to a filespredicate-typedget the current time using tpredicate-typedget the current time using upredicate-typed5read all the environment variables as key value pairsvpredicate-typedread an environment variable,pz @(ReadEnv "PATH" >> 'Just Id >> 'True) ()TrueTrueTxpredicate-typeddoes the directory existspz @(DirExists ".") ()TrueTrueTzpredicate-typed similar to 2pz @(ReadFile "LICENSE" >> 'Just Id >> Len > 0) ()TrueTrueTpz @(FileExists "xyzzy") ()FalseFalseT{predicate-typed.run the expression 'p' but remove the subtrees}predicate-typed similar to (pz @Sequence [Just 10, Just 20, Just 30]Present Just [10,20,30]PresentT (Just [10,20,30]):pz @Sequence [Just 10, Just 20, Just 30, Nothing, Just 40]Present NothingPresentT Nothingpredicate-typedtries each predicate ps and on the first match runs the corresponding qs but if there is no match on ps then runs the fail case epz @(Case (FailS "asdf" >> Snd Id >> Unproxy ) '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 50Present "50 is same50"PresentT "50 is same50"pz @(Case (FailS "asdf" >> Snd Id >> Unproxy ) '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 9Present "9 is lt10"PresentT "9 is lt10"pz @(Case (FailS "asdf" >> Snd Id >> Unproxy ) '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 3Present "3 is lt4"PresentT "3 is lt4"pz @(Case (FailS "asdf" >> Snd Id >> Unproxy ) '[Lt 4,Lt 10,Same 50] '[PrintF "%d is lt4" Id, PrintF "%d is lt10" Id, PrintF "%d is same50" Id] Id) 99 Error asdf FailT "asdf"predicate-typed leverages . for repeating predicates (passthrough method)pz @(ParaN 4 (Succ Id)) [1..4]Present [2,3,4,5]PresentT [2,3,4,5]pz @(ParaN 4 (Succ Id)) "azwxm"'Error Para:invalid length(5) expected 4)FailT "Para:invalid length(5) expected 4"pz @(ParaN 4 (Succ Id)) "azwx"Present "b{xy"PresentT "b{xy"predicate-typedruns values in parallel unlike p which is serial)pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30]Present [10,21,120]PresentT [10,21,120],pz @(Para '[Id,Id + 1,Id * 4]) [10,20,30,40]'Error Para:invalid length(4) expected 3)FailT "Para:invalid length(4) expected 3"predicate-typeduses PrintF to format outputpz @(PrintF "value=%03d" Id) 12Present "value=012"PresentT "value=012"&pz @(PrintF "%s" (Fst Id)) ("abc",'x') Present "abc"PresentT "abc"&pz @(PrintF "%d" (Fst Id)) ("abc",'x')3Error PrintF (IO e=printf: bad formatting char 'd')5FailT "PrintF (IO e=printf: bad formatting char 'd')"predicate-typedintercalate two lists;pz @(Intercalate '["aB"] '["xxxx","yz","z","www","xyz"]) ()9Present ["xxxx","aB","yz","aB","z","aB","www","aB","xyz"]:PresentT ["xxxx","aB","yz","aB","z","aB","www","aB","xyz"]-pz @(Intercalate '[W 99,Negate 98] Id) [1..5]/Present [1,99,-98,2,99,-98,3,99,-98,4,99,-98,5]0PresentT [1,99,-98,2,99,-98,3,99,-98,4,99,-98,5]%pz @(Intercalate '[99,100] Id) [1..5]/Present [1,99,100,2,99,100,3,99,100,4,99,100,5]0PresentT [1,99,100,2,99,100,3,99,100,4,99,100,5]predicate-typed-Display a number at base 2 to 36, similar to  but supports signed numberspz @(ShowBase 16 Id) 4077 Present "fed"PresentT "fed"pz @(ShowBase 16 Id) (-255) Present "-ff"PresentT "-ff"pz @(ShowBase 2 Id) 147Present "10010011"PresentT "10010011"(pz @(ShowBase 2 (Negate 147)) "whatever"Present "-10010011"PresentT "-10010011"predicate-typed2Read a number using base 2 through a maximum of 36 pz @(ReadBase Int 16 Id) "00feD" Present 4077 PresentT 4077pz @(ReadBase Int 16 Id) "-ff" Present -255PresentT (-255)"pz @(ReadBase Int 2 Id) "10010011" Present 147 PresentT 147pz @(ReadBase Int 8 Id) "Abff"Error invalid base 8FailT "invalid base 8"(supports negative numbers unlike readIntpredicate-typed"Luhn predicate check on last digitpz @(Luhn Id) [1,2,3,0]TrueTrueTpz @(Luhn Id) [1,2,3,4]FalseFalseT)pz @(GuardSimple (Luhn Id)) [15,4,3,1,99];Error (Luhn map=[90,2,3,8,6] sum=109 ret=9 | [15,4,3,1,99])=FailT "(Luhn map=[90,2,3,8,6] sum=109 ret=9 | [15,4,3,1,99])"pl @(Luhn Id) [15,4,3,1,99];False (Luhn map=[90,2,3,8,6] sum=109 ret=9 | [15,4,3,1,99])FalseTpredicate-typed"zip two lists with the same lengthpl @(Zip '[1,2,3] "abc") ()WPresent [(1,'a'),(2,'b'),(3,'c')] (Zip [(1,'a'),(2,'b'),(3,'c')] | p=[1,2,3] | q="abc")"PresentT [(1,'a'),(2,'b'),(3,'c')]pl @(Zip '[1,2,3] "ab") ()Error Zip(3,2) length mismatch FailT "Zip(3,2) length mismatch"pl @(Zip '[1,2] "abc") ()Error Zip(2,3) length mismatch FailT "Zip(2,3) length mismatch"predicate-typed3zip two lists padding the right hand side if needed(pl @(ZipR (Char1 "Z") '[1,2,3] "abc") ()XPresent [(1,'a'),(2,'b'),(3,'c')] (ZipR [(1,'a'),(2,'b'),(3,'c')] | p=[1,2,3] | q="abc")"PresentT [(1,'a'),(2,'b'),(3,'c')]'pl @(ZipR (Char1 "Z") '[1,2,3] "ab") ()WPresent [(1,'a'),(2,'b'),(3,'Z')] (ZipR [(1,'a'),(2,'b'),(3,'Z')] | p=[1,2,3] | q="ab")"PresentT [(1,'a'),(2,'b'),(3,'Z')]&pl @(ZipR (Char1 "Z") '[1,2,3] "a") ()VPresent [(1,'a'),(2,'Z'),(3,'Z')] (ZipR [(1,'a'),(2,'Z'),(3,'Z')] | p=[1,2,3] | q="a")"PresentT [(1,'a'),(2,'Z'),(3,'Z')]&pl @(ZipR (Char1 "Z") '[1,2] "abc") ()&Error ZipR(2,3) rhs would be truncated(FailT "ZipR(2,3) rhs would be truncated"predicate-typed2zip two lists padding the left hand side if neededpl @(ZipL 99 '[1,2,3] "abc") ()XPresent [(1,'a'),(2,'b'),(3,'c')] (ZipL [(1,'a'),(2,'b'),(3,'c')] | p=[1,2,3] | q="abc")"PresentT [(1,'a'),(2,'b'),(3,'c')]pl @(ZipL 99 '[1,2] "abc") ()XPresent [(1,'a'),(2,'b'),(99,'c')] (ZipL [(1,'a'),(2,'b'),(99,'c')] | p=[1,2] | q="abc")#PresentT [(1,'a'),(2,'b'),(99,'c')]pl @(ZipL 99 '[1] "abc") ()XPresent [(1,'a'),(99,'b'),(99,'c')] (ZipL [(1,'a'),(99,'b'),(99,'c')] | p=[1] | q="abc")$PresentT [(1,'a'),(99,'b'),(99,'c')]pl @(ZipL 99 '[1,2,3] "ab") ()&Error ZipL(3,2) rhs would be truncated(FailT "ZipL(3,2) rhs would be truncated"predicate-typed=Zip two lists to their maximum length using padding if needed=pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abc", [1..5])1Present [('a',1),('b',2),('c',3),('Z',4),('Z',5)]2PresentT [('a',1),('b',2),('c',3),('Z',4),('Z',5)]Apz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcdefg", [1..5])CPresent [('a',1),('b',2),('c',3),('d',4),('e',5),('f',99),('g',99)]DPresentT [('a',1),('b',2),('c',3),('d',4),('e',5),('f',99),('g',99)]?pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcde", [1..5])1Present [('a',1),('b',2),('c',3),('d',4),('e',5)]2PresentT [('a',1),('b',2),('c',3),('d',4),('e',5)]:pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("", [1..5])1Present [('Z',1),('Z',2),('Z',3),('Z',4),('Z',5)]2PresentT [('Z',1),('Z',2),('Z',3),('Z',4),('Z',5)];pz @(ZipPad (Char1 "Z") 99 (Fst Id) (Snd Id)) ("abcde", [])6Present [('a',99),('b',99),('c',99),('d',99),('e',99)]7PresentT [('a',99),('b',99),('c',99),('d',99),('e',99)]predicate-typed/extract 'a' from '[a]' which I need for type PPpredicate-typed similar to  ! thats pads with  or & if one list is shorter than the other>the key is that all information about both lists are preserved0pz @(ZipThese (Fst Id) (Snd Id)) ("aBc", [1..5]);Present [These 'a' 1,These 'B' 2,These 'c' 3,That 4,That 5]<PresentT [These 'a' 1,These 'B' 2,These 'c' 3,That 4,That 5]3pz @(ZipThese (Fst Id) (Snd Id)) ("aBcDeF", [1..3])HPresent [These 'a' 1,These 'B' 2,These 'c' 3,This 'D',This 'e',This 'F']IPresentT [These 'a' 1,These 'B' 2,These 'c' 3,This 'D',This 'e',This 'F']"pz @(ZipThese Id Reverse) "aBcDeF"]Present [These 'a' 'F',These 'B' 'e',These 'c' 'D',These 'D' 'c',These 'e' 'B',These 'F' 'a']^PresentT [These 'a' 'F',These 'B' 'e',These 'c' 'D',These 'D' 'c',These 'e' 'B',These 'F' 'a']pz @(ZipThese Id '[]) "aBcDeF"?Present [This 'a',This 'B',This 'c',This 'D',This 'e',This 'F']@PresentT [This 'a',This 'B',This 'c',This 'D',This 'e',This 'F']pz @(ZipThese '[] Id) "aBcDeF"?Present [That 'a',That 'B',That 'c',That 'D',That 'e',That 'F']@PresentT [That 'a',That 'B',That 'c',That 'D',That 'e',That 'F']pz @(ZipThese '[] '[]) "aBcDeF" Present [] PresentT []predicate-typed.extracts the first character from a non empty pz @(Char1 "aBc") () Present 'a' PresentT 'a'predicate-typed creates a singleton from a value pz @(Singleton (Char1 "aBc")) () Present "a" PresentT "a"pz @(Singleton Id) FalsePresent [False]PresentT [False](pz @(Singleton (Snd Id)) (False,"hello")Present ["hello"]PresentT ["hello"]predicate-typed'creates an empty list of the given typepz @(Id :+ EmptyList _) 99 Present [99] PresentT [99]predicate-typed similar to "#9pz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (This 13) Present 13 PresentT 13Npz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (That "this is a long string") Present 21 PresentT 21Epz @(TheseIn Id Len (Fst Id + Length (Snd Id))) (These 20 "somedata") Present 28 PresentT 28pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (That "this is a long string")%Present Right "this is a long string"(PresentT (Right "this is a long string")pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (These 1 "this is a long string")%Present Right "this is a long string"(PresentT (Right "this is a long string")pz @(TheseIn (MkLeft _ Id) (MkRight _ Id) (If (Fst Id > Length (Snd Id)) (MkLeft _ (Fst Id)) (MkRight _ (Snd Id)))) (These 100 "this is a long string")Present Left 100PresentT (Left 100)predicate-typed predicate on pz @(IsThis Id) (This "aBc")TrueTrueTpz @(IsThis Id) (These 1 'a')FalseFalseTpz @(IsThese Id) (These 1 'a')TrueTrueTpl @(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 &requires the OverloadedLists extension:set -XOverloadedLists0pz @(FromListExt (M.Map _ _)) [(4,"x"),(5,"dd")]#Present fromList [(4,"x"),(5,"dd")]&PresentT (fromList [(4,"x"),(5,"dd")])predicate-typedinvokes ,pz @ToListExt (M.fromList [(1,'x'),(4,'y')])Present [(1,'x'),(4,'y')]PresentT [(1,'x'),(4,'y')]pz @ToListExt (T.pack "abc") Present "abc"PresentT "abc"predicate-typed similar to "pz @(ToList' Id) ("aBc" :: String) Present "aBc"PresentT "aBc"pz @(ToList' Id) (Just 14) Present [14] PresentT [14]pz @(ToList' Id) Nothing Present [] PresentT []pz @(ToList' Id) (Left "xx") Present [] PresentT [] pz @(ToList' Id) (These 12 "xx")Present ["xx"]PresentT ["xx"]predicate-typed similar to pz @ToList ("aBc" :: String) Present "aBc"PresentT "aBc"pz @ToList (Just 14) Present [14] PresentT [14]pz @ToList Nothing Present [] PresentT []pz @ToList (Left "xx") Present [] PresentT []pz @ToList (These 12 "xx")Present ["xx"]PresentT ["xx"]predicate-typed similar to $pz @(IToList _ Id) ("aBc" :: String)!Present [(0,'a'),(1,'B'),(2,'c')]"PresentT [(0,'a'),(1,'B'),(2,'c')]predicate-typed>compare two strings ignoring case using the given ordering 'o'predicate-typed/compare two values using the given ordering 'o'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") Present EQ PresentT EQ'pz @(Fst Id ===~ Snd Id) ("abC","DaBc") Present LT PresentT LTpredicate-typed similar to pz @(Fst Id ==! Snd Id) (10,9) Present GT PresentT GT)pz @(14 % 3 ==! Fst Id -% Snd Id) (-10,7) Present GT PresentT GTpz @(Fst Id ==! Snd Id) (10,11) Present LT PresentT LTDpz @(Snd Id ==! (Fst Id >> Snd Id >> Head Id)) (('x',[10,12,13]),10) Present EQ PresentT EQ:pz @(Snd Id ==! Head (Snd (Fst Id))) (('x',[10,12,13]),10) Present EQ PresentT EQpredicate-typed functionpz @(Not Id) FalseTrueTrueTpz @(Not Id) TrueFalseFalseTpz @(Not (Fst Id)) (True,22)FalseFalseTpl @(Not (Lt 3)) 13True (Not (13 < 3))TrueTpredicate-typed implication;pz @(Fst Id ~> (Length (Snd Id) >= 4)) (True,[11,12,13,14])TrueTrueT>pz @(Fst Id ~> (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseFalseT?pz @(Fst Id ~> (Length (Snd Id) == 4)) (False,[12,11,12,13,14])TrueTrueT<pz @(Fst Id ~> (Length (Snd Id) >= 4)) (False,[11,12,13,14])TrueTrueTpredicate-typed similar to <pz @(Fst Id || (Length (Snd Id) >= 4)) (False,[11,12,13,14])TrueTrueTDpz @(Not (Fst Id) || (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseFalseTpredicate-typed similar to #pz @(Fst Id && Snd Id) (True, True)TrueTrueTpz @(Id > 15 && Id < 17) 16TrueTrueTpz @(Id > 15 && Id < 17) 30FalseFalseT;pz @(Fst Id && (Length (Snd Id) >= 4)) (True,[11,12,13,14])TrueTrueT>pz @(Fst Id && (Length (Snd Id) == 4)) (True,[12,11,12,13,14])FalseFalseTpredicate-typed"This is composition for predicates,pz @(Fst Id >> Succ (Id !! 0)) ([11,12],'x') Present 12 PresentT 12>pz @(Len *** Succ Id >> ShowP (First (Pred Id))) ([11,12],'x')Present "(1,'y')"PresentT "(1,'y')"predicate-typedjust run the effect but skip the value for example for use with Stdout so it doesnt interfere with the 'a' on the rhs unless there is an failurepredicate-typed similar to M but uses the root message of the False predicate case as the failure message2most uses of GuardSimple can be replaced by using ~3 and a boolean predicate unless you require failure"pz @(GuardSimple (Luhn Id)) [1..4]3Error (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])5FailT "(Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])"pl @(Luhn Id) [1..4]3False (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])FalseT%pz @(GuardSimple (Luhn Id)) [1,2,3,0]Present [1,2,3,0]PresentT [1,2,3,0]&pz @(GuardSimple (Len > 30)) [1,2,3,0]Error (4 > 30)FailT "(4 > 30)"predicate-typed?'p' is the predicate and on failure of the predicate runs 'prt'$pz @(Guard "expected > 3" (Gt 3)) 17 Present 17 PresentT 17#pz @(Guard "expected > 3" (Gt 3)) 1Error expected > 3FailT "expected > 3"1pz @(Guard (PrintF "%d not > 3" Id) (Gt 3)) (-99)Error -99 not > 3FailT "-99 not > 3"predicate-typed leverages . for repeating predicates (passthrough method)ipz @(GuardsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,256]/Error id=3 must be between 0 and 255, found 2561FailT "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]Present [121,33,7,44]PresentT [121,33,7,44]predicate-typedfif a predicate fails then then the corresponding symbol and value will be passed to the print functionpz @(GuardsDetail "%s invalid: found %d" '[ '("hours", Between 0 23 Id),'("minutes",Between 0 59 Id),'("seconds",Between 0 59 Id)]) [13,59,61]Error seconds invalid: found 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]Error hours invalid: found 27FailT "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]Present [23,59,12]PresentT [23,59,12]predicate-typed leverages . for repeating predicates (passthrough method)hpl @(BoolsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,256]HFalse (Bool(3) [id=3 must be between 0 and 255, found 256] (256 <= 255))FalseTgpl @(BoolsN (PrintT "id=%d must be between 0 and 255, found %d" Id) 4 (Between 0 255 Id)) [121,33,7,44] True (Bools)TrueTpredicate-typedRboolean guard which checks a given a list of predicates against the list of valuesprefer  as u 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]Present [17,4]PresentT [17,4]Gpz @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 5)]) [17,4]Error arg2 failedFailT "arg2 failed"Hpz @(Guards '[ '("arg1 failed",Gt 99), '("arg2 failed", Same 4)]) [17,4]Error arg1 failedFailT "arg1 failed"epz @(Guards '[ '(PrintT "arg %d failed with value %d" Id,Gt 4), '(PrintT "%d %d" Id, Same 4)]) [17,3] Error 1 3 FailT "1 3"Zpz @(GuardsQuick (PrintT "arg %d failed with value %d" Id) '[Gt 4, Ge 3, Same 4]) [17,3,5]Error arg 2 failed with value 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])Error Guards:invalid length(4) expected 3+FailT "Guards:invalid length(4) expected 3"predicate-typed similar to &pz @(QuotRem (Fst Id) (Snd Id)) (10,3) Present (3,1)PresentT (3,1)'pz @(QuotRem (Fst Id) (Snd Id)) (10,-3)Present (-3,1)PresentT (-3,1)(pz @(QuotRem (Fst Id) (Snd Id)) (-10,-3)Present (3,-1)PresentT (3,-1)'pz @(QuotRem (Fst Id) (Snd Id)) (-10,3)Present (-3,-1)PresentT (-3,-1)&pz @(QuotRem (Fst Id) (Snd Id)) (10,0)Error QuotRem zero denominator FailT "QuotRem zero denominator"predicate-typed similar to %pz @(DivMod (Fst Id) (Snd Id)) (10,3) Present (3,1)PresentT (3,1)&pz @(DivMod (Fst Id) (Snd Id)) (10,-3)Present (-4,-2)PresentT (-4,-2)&pz @(DivMod (Fst Id) (Snd Id)) (-10,3)Present (-4,2)PresentT (-4,2)'pz @(DivMod (Fst Id) (Snd Id)) (-10,-3)Present (3,-1)PresentT (3,-1)%pz @(DivMod (Fst Id) (Snd Id)) (10,0)Error DivMod zero denominatorFailT "DivMod zero denominator"predicate-typed similar to "pz @(Mod (Fst Id) (Snd Id)) (10,3) Present 1 PresentT 1"pz @(Mod (Fst Id) (Snd Id)) (10,0)Error Mod zero denominatorFailT "Mod zero denominator"predicate-typed similar to "pz @(Div (Fst Id) (Snd Id)) (10,4) Present 2 PresentT 2"pz @(Div (Fst Id) (Snd Id)) (10,0)Error Div zero denominatorFailT "Div zero denominator"predicate-typed similar to !pz @(Map Even Id) [9,-4,12,1,2,3]*Present [False,True,True,False,True,False]+PresentT [False,True,True,False,True,False](pz @(Map '(Even,Odd) Id) [9,-4,12,1,2,3]WPresent [(False,True),(True,False),(True,False),(False,True),(True,False),(False,True)]XPresentT [(False,True),(True,False),(True,False),(False,True),(True,False),(False,True)]predicate-typedcatch a failureRpz @(Catch (Succ Id) (Fst Id >> Second (ShowP Id) >> PrintT "%s %s" Id >> 'LT)) GT Present LT PresentT LTBpz @(Catch' (Succ Id) (Second (ShowP Id) >> PrintT "%s %s" Id)) GT;Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument GT=FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument GT"Bpz @(Catch' (Succ Id) (Second (ShowP Id) >> PrintT "%s %s" Id)) LT Present EQ PresentT EQmore flexible: takes a (String,x) and a proxy so we can still call 'False 'True now takes the FailT string and x so you can print more detail if you want need the proxy so we can fail without having to explicitly specify a typepredicate-typed$Fails the computation with a message+pz @(Failt Int (PrintF "value=%03d" Id)) 99Error value=099FailT "value=099">pz @(FailS (PrintT "value=%03d string=%s" Id)) (99,"somedata")Error value=099 string=somedata!FailT "value=099 string=somedata"predicate-typed similar to (pz @(Break (Ge 3) Id) [10,4,1,7,3,1,3,5]Present ([],[10,4,1,7,3,1,3,5]) PresentT ([],[10,4,1,7,3,1,3,5])(pz @(Break (Lt 3) Id) [10,4,1,7,3,1,3,5]Present ([10,4],[1,7,3,1,3,5])PresentT ([10,4],[1,7,3,1,3,5])predicate-typed similar to ,pz @(Partition (Ge 3) Id) [10,4,1,7,3,1,3,5]Present ([10,4,7,3,3,5],[1,1])PresentT ([10,4,7,3,3,5],[1,1])0pz @(Partition (Prime Id) Id) [10,4,1,7,3,1,3,5]Present ([7,3,3,5],[10,4,1,1])PresentT ([7,3,3,5],[10,4,1,1]).pz @(Partition (Ge 300) Id) [10,4,1,7,3,1,3,5]Present ([],[10,4,1,7,3,1,3,5]) PresentT ([],[10,4,1,7,3,1,3,5])0pz @(Partition (Id < 300) Id) [10,4,1,7,3,1,3,5]Present ([10,4,1,7,3,1,3,5],[]) PresentT ([10,4,1,7,3,1,3,5],[])predicate-typedNcreates a list of overlapping pairs of elements. requires two or more elementspz @Pairs [1,2,3,4]Present [(1,2),(2,3),(3,4)]PresentT [(1,2),(2,3),(3,4)] pz @Pairs []Error Pairs no data foundFailT "Pairs no data found" pz @Pairs [1]"Error Pairs only one element found$FailT "Pairs only one element found"predicate-typedif p then run q else run r>pz @(If (Gt 4) "greater than 4" "less than or equal to 4" ) 10Present "greater than 4"PresentT "greater than 4"<pz @(If (Gt 4) "greater than 4" "less than or equal to 4") 0!Present "less than or equal to 4""PresentT "less than or equal to 4"predicate-typed similar to pz @(Map (Pred Id) Id) [1..5]Present [0,1,2,3,4]PresentT [0,1,2,3,4]predicate-typed similar to =pz @(Unfoldr (MaybeBool (Not Null) (SplitAt 2 Id)) Id) [1..5]Present [[1,2],[3,4],[5]]PresentT [[1,2],[3,4],[5]]pz @(IterateN 4 (Succ Id)) 4Present [4,5,6,7]PresentT [4,5,6,7]predicate-typed similar to >pz @(Scanl (Snd Id :+ Fst Id) (Fst Id) (Snd Id)) ([99],[1..5])EPresent [[99],[1,99],[2,1,99],[3,2,1,99],[4,3,2,1,99],[5,4,3,2,1,99]]FPresentT [[99],[1,99],[2,1,99],[3,2,1,99],[4,3,2,1,99],[5,4,3,2,1,99]]pz @(ScanN 4 Id (Succ Id)) 'c'Present "cdefg"PresentT "cdefg"pz @(FoldN 4 Id (Succ Id)) 'c' Present 'g' PresentT 'g'1pz @(Dup >> ScanN 4 Id (Pred Id *** Succ Id)) 'g';Present [('g','g'),('f','h'),('e','i'),('d','j'),('c','k')]<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])Present ("ac",[2,4,99],[('z',1),('a',2)])*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]Present ("ac",[2,4,99])PresentT ("ac",[2,4,99])/pz @PartitionEithers [Right 2,Right 4,Right 99]Present ([],[2,4,99])PresentT ([],[2,4,99])(pz @PartitionEithers [Left 'a',Left 'c']Present ("ac",[])PresentT ("ac",[]),pz @PartitionEithers ([] :: [Either () Int])Present ([],[])PresentT ([],[])predicate-typed similar to pz @(EnumFromTo 2 5) ()Present [2,3,4,5]PresentT [2,3,4,5]pz @(EnumFromTo 'LT 'GT) ()Present [LT,EQ,GT]PresentT [LT,EQ,GT]pz @(EnumFromTo 'GT 'LT) () Present [] PresentT []0pz @(EnumFromTo (Pred Id) (Succ Id)) (SG.Max 10)>Present [Max {getMax = 9},Max {getMax = 10},Max {getMax = 11}]?PresentT [Max {getMax = 9},Max {getMax = 10},Max {getMax = 11}]predicate-typed similar to  using pz @Null [1,2,3,4]FalseFalseT pz @Null []TrueTrueTpz @Null NothingTrueTrueTpredicate-typed similar to  using pz @IsEmpty [1,2,3,4]FalseFalseTpz @IsEmpty []TrueTrueTpz @IsEmpty LTFalseFalseTpz @IsEmpty EQTrueTrueTpredicate-typedpz @Unsnoc [1,2,3,4]Present Just ([1,2,3],4)PresentT (Just ([1,2,3],4)) pz @Unsnoc []Present NothingPresentT Nothingpz @Unsnoc ("xyz" :: T.Text)Present Just ("xy",'z')PresentT (Just ("xy",'z'))predicate-typedpz @Uncons [1,2,3,4]Present Just (1,[2,3,4])PresentT (Just (1,[2,3,4])) pz @Uncons []Present NothingPresentT Nothingpz @Uncons (Seq.fromList "abc") Present Just ('a',fromList "bc")#PresentT (Just ('a',fromList "bc"))pz @Uncons ("xyz" :: T.Text)Present Just ('x',"yz")PresentT (Just ('x',"yz"))predicate-typedsimilar to snoc%pz @(Snd Id +: Fst Id) (99,[1,2,3,4])Present [1,2,3,4,99]PresentT [1,2,3,4,99]pz @(Fst Id +: Snd Id) ([],5) Present [5] PresentT [5]pz @(EmptyT [] Id +: 5) 5 Present [5] PresentT [5]predicate-typedsimilar to cons%pz @(Fst Id :+ Snd Id) (99,[1,2,3,4])Present [99,1,2,3,4]PresentT [99,1,2,3,4]pz @(Snd Id :+ Fst Id) ([],5) Present [5] PresentT [5]$pz @(123 :+ EmptyList _) "somestuff" Present [123]PresentT [123]predicate-typedsimilar to (++),pz @(Fst Id ++ Snd Id) ([9,10,11],[1,2,3,4])Present [9,10,11,1,2,3,4]PresentT [9,10,11,1,2,3,4]pz @(Snd Id ++ Fst Id) ([],[5]) Present [5] PresentT [5]+pz @(Char1 "xyz" :+ W "ab" ++ W "cdefg") ()Present "xabcdefg"PresentT "xabcdefg"(pz @([1,2,3] ++ EmptyList _) "somestuff"Present [1,2,3]PresentT [1,2,3]predicate-typed$% pz @(Ors Id) [False,False,False]FalseFalseT#pl @(Ors Id) [True,True,True,False]*True (Ors(4) i=0 | [True,True,True,False])TrueTpl @(Ors Id) []False (Ors(0) | [])FalseTpredicate-typed$&pz @(Ands Id) [True,True,True]TrueTrueT$pl @(Ands Id) [True,True,True,False],False (Ands(4) i=3 | [True,True,True,False])FalseTpz @(Ands Id) []TrueTrueTpredicate-typed leveraging )pz @(Lookup Id 2) ["abc","D","eF","","G"]Present Just "eF"PresentT (Just "eF")*pz @(Lookup Id 20) ["abc","D","eF","","G"]Present NothingPresentT 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..])TrueTrueTpredicate-typed similar to  leveraging %pz @(Id !! 2) ["abc","D","eF","","G"] Present "eF" PresentT "eF"&pz @(Id !! 20) ["abc","D","eF","","G"]Error (!!) index not foundFailT "(!!) index not found"%import qualified Data.Map.Strict as MFpz @(Id !! "eF") (M.fromList (flip zip [0..] ["abc","D","eF","","G"])) Present 2 PresentT 2predicate-typed similar to  leveraging 1pz @(IxL Id 2 "notfound") ["abc","D","eF","","G"] Present "eF" PresentT "eF"2pz @(IxL Id 20 "notfound") ["abc","D","eF","","G"]Present "notfound"PresentT "notfound"predicate-typed similar to .pz @(Ix 4 "not found") ["abc","D","eF","","G"] Present "G" PresentT "G"/pz @(Ix 40 "not found") ["abc","D","eF","","G"]Present "not found"PresentT "not found"predicate-typed similar to  but for a fixed number 'n'pz @(Cycle 5 Id) [1,2]Present [1,2,1,2,1]PresentT [1,2,1,2,1]predicate-typed similar to 'pz @(Concat Id) ["abc","D","eF","","G"]Present "abcDeFG"PresentT "abcDeFG"3pz @(Concat (Snd Id)) ('x',["abc","D","eF","","G"])Present "abcDeFG"PresentT "abcDeFG"predicate-typedsimilar to a limited form of 'pz @(FoldMap (SG.Sum _) Id) [44, 12, 3] Present 59 PresentT 59+pz @(FoldMap (SG.Product _) Id) [44, 12, 3] Present 1584 PresentT 1584type Ands' p = FoldMap SG.All p%pz @(Ands' Id) [True,False,True,True] Present FalsePresentT Falsepz @(Ands' Id) [True,True,True] Present True PresentT Truepz @(Ands' Id) [] Present True PresentT Truetype Ors' p = FoldMap SG.Any p!pz @(Ors' Id) [False,False,False] Present FalsePresentT Falsepz @(Ors' Id) [] Present FalsePresentT False&pz @(Ors' Id) [False,False,False,True] Present True PresentT True4type AllPositive' = FoldMap SG.All (Map Positive Id) pz @AllPositive' [3,1,-5,10,2,3] Present FalsePresentT False4type AllNegative' = FoldMap SG.All (Map Negative Id)"pz @AllNegative' [-1,-5,-10,-2,-3] Present True PresentT True:set -XKindSignaturesZtype Max' (t :: Type) = FoldMap (SG.Max t) Id -- requires t be Bounded for monoid instancepz @(Max' Int) [10,4,5,12,3,4] Present 12 PresentT 12predicate-typed similar to 1pz @(MConcat Id) [SG.Sum 44, SG.Sum 12, SG.Sum 3]Present Sum {getSum = 59}PresentT (Sum {getSum = 59})predicate-typed constructor(pz @(MkThese (Fst Id) (Snd Id)) (44,'x')Present These 44 'x'PresentT (These 44 'x')predicate-typed constructorpz @(MkThat _ Id) 44Present That 44PresentT (That 44)predicate-typed constructorpz @(MkThis _ Id) 44Present This 44PresentT (This 44)(pz @(Proxy Int >> MkThis' Unproxy 10) []Present This 10PresentT (This 10)predicate-typed constructorpz @(MkRight _ Id) 44Present Right 44PresentT (Right 44)predicate-typed constructorpz @(MkLeft _ Id) 44Present Left 44PresentT (Left 44)predicate-typed'( constructorpz @(MkJust Id) 44Present Just 44PresentT (Just 44)predicate-typed similar to pz @(EmptyT Maybe Id) ()Present NothingPresentT Nothingpz @(EmptyT [] Id) () Present [] PresentT []%pz @(EmptyT [] (Char1 "x")) (13,True) Present "" PresentT ""/pz @(EmptyT (Either String) (Fst Id)) (13,True)Present Left ""PresentT (Left "")predicate-typed similar to pz @(MEmptyT (SG.Sum Int)) ()Present Sum {getSum = 0}PresentT (Sum {getSum = 0})Bno Monoid for Maybe a unless a is also a monoid but can use empty! predicate-typed similar to pz @(Pure Maybe Id) 4Present Just 4PresentT (Just 4)pz @(Pure [] Id) 4 Present [4] PresentT [4]-pz @(Pure (Either String) (Fst Id)) (13,True)Present Right 13PresentT (Right 13) predicate-typed similar to pz @(STimes 4 Id) (SG.Sum 3)Present Sum {getSum = 12}PresentT (Sum {getSum = 12})pz @(STimes 4 Id) "ab"Present "abababab"PresentT "abababab" 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)FalseFalseTpz @(IsNothing Id) NothingTrueTrueTpredicate-typed similar to pz @(IsJust Id) NothingFalseFalseTpz @(IsJust Id) (Just 'a')TrueTrueTpredicate-typed similar to Rprovides a Proxy to the result of 'q' but does not provide the surrounding context8pz @(MaybeIn "foundnothing" (ShowP (Pred Id))) (Just 20) Present "19" PresentT "19"7pz @(MaybeIn "found nothing" (ShowP (Pred Id))) NothingPresent "found nothing"PresentT "found nothing"predicate-typed similar to "+ but additionally provides 'p', '\q'= and 'r' the original input as the first element in the tuplebpz @(TheseX ((Fst (Fst Id) + Snd Id) >> ShowP Id) (ShowP Id) (Snd (Snd Id)) (Snd Id)) (9,This 123) Present "132"PresentT "132"Lpz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (This 123)Present (123,"fromthis")PresentT (123,"fromthis")Spz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (That "fromthat")Present (-99,"fromthat")PresentT (-99,"fromthat")Ypz @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (These 123 "fromthese")Present (123,"fromthese")PresentT (123,"fromthese")predicate-typed similar to 6 but additionally gives 'p' and 'q' the original inputNpz @(EitherX (ShowP (Fst (Fst Id) + Snd Id)) (ShowP Id) (Snd Id)) (9,Left 123) Present "132"PresentT "132"Opz @(EitherX (ShowP (Fst (Fst Id) + Snd Id)) (ShowP Id) (Snd Id)) (9,Right 'x')Present "((9,Right 'x'),'x')"PresentT "((9,Right 'x'),'x')"Jpz @(EitherX (ShowP Id) (ShowP (Second (Succ Id))) (Snd Id)) (9,Right 'x')Present "((9,Right 'x'),'y')"PresentT "((9,Right 'x'),'y')" predicate-typed takes the head of a list or failsee   for other supported types eg 2pz @(HeadFail "dude" Id) [ "abc","def","asdfadf" ] Present "abc"PresentT "abc"!pz @(HeadFail "empty list" Id) []Error empty listFailT "empty list"!predicate-typed/takes the head or default of a list-like objectsee   for other supported types eg pz @(HeadDef 444 Id) [] Present 444 PresentT 444pz @(HeadDef 444 Id) [1..5] Present 1 PresentT 1pz @(HeadDef 444 Id) [1..5] Present 1 PresentT 14pz @(HeadDef (Char1 "w") Id) (Seq.fromList "abcdef") Present 'a' PresentT 'a'&pz @(HeadDef (Char1 "w") Id) Seq.empty Present 'w' PresentT 'w':set -XFlexibleContexts1pz @(HeadDef (MEmptyT _) Id) ([] :: [SG.Sum Int])Present Sum {getSum = 0}PresentT (Sum {getSum = 0})<pz @(HeadDef (MEmptyT String) '[ "abc","def","asdfadf" ]) () Present "abc"PresentT "abc"Bpz @(HeadDef (MEmptyT _) (Snd Id)) (123,[ "abc","def","asdfadf" ]) Present "abc"PresentT "abc"+pz @(HeadDef (MEmptyT _) (Snd Id)) (123,[]) Present () PresentT ()"predicate-typedsimilar to fmap sndpz @FMapSnd (Just ("asf",13))Present Just 13PresentT (Just 13)#predicate-typedsimilar to fmap fstpz @FMapFst (Just (13,"Asf"))Present Just 13PresentT (Just 13)to make this work we grab the fst or snd out of the Maybe so it is a head or not/ is a tail or not etc! we still have access to the whole original list so we dont lose anything!$predicate-typed function+pz @(Elem (Fst Id) (Snd Id)) ('x',"abcdxy")TrueTrueT+pz @(Elem (Fst Id) (Snd Id)) ('z',"abcdxy")FalseFalseTpredicate-typed<filters a list 'q' keeping or removing those elements in 'p'!pz @(Keep '[5] '[1,5,5,2,5,2]) ()Present [5,5,5]PresentT [5,5,5]'pz @(Keep '[0,1,1,5] '[1,5,5,2,5,2]) ()Present [1,5,5,5]PresentT [1,5,5,5]#pz @(Remove '[5] '[1,5,5,2,5,2]) ()Present [1,2,2]PresentT [1,2,2])pz @(Remove '[0,1,1,5] '[1,5,5,2,5,2]) () Present [2,2]PresentT [2,2]$pz @(Remove '[99] '[1,5,5,2,5,2]) ()Present [1,5,5,2,5,2]PresentT [1,5,5,2,5,2]'pz @(Remove '[99,91] '[1,5,5,2,5,2]) ()Present [1,5,5,2,5,2]PresentT [1,5,5,2,5,2]!pz @(Remove Id '[1,5,5,2,5,2]) []Present [1,5,5,2,5,2]PresentT [1,5,5,2,5,2]Fpz @(Remove '[] '[1,5,5,2,5,2]) 44 -- works if you make this a number!Present [1,5,5,2,5,2]PresentT [1,5,5,2,5,2]'predicate-typeda predicate on prime numberspz @(Prime Id) 2TrueTrueT#pz @(Map '(Id,Prime Id) Id) [0..12]Present [(0,False),(1,False),(2,True),(3,True),(4,False),(5,True),(6,False),(7,True),(8,False),(9,False),(10,False),(11,True),(12,False)]PresentT [(0,False),(1,False),(2,True),(3,True),(4,False),(5,True),(6,False),(7,True),(8,False),(9,False),(10,False),(11,True),(12,False)]*predicate-typedbounded  functionpz @(ToEnumBDef Ordering LT) 2 Present GT PresentT GTpz @(ToEnumBDef Ordering LT) 6 Present LT PresentT LTpz @(ToEnumBFail Ordering) 6Error ToEnum boundedFailT "ToEnum bounded",predicate-typedunsafe  functionpz @(ToEnum Char Id) 120 Present 'x' PresentT 'x'-predicate-typed functionpz @(FromEnum Id) 'x' Present 120 PresentT 120/predicate-typed unbounded  functionpz @(Pred Id) 13 Present 12 PresentT 12pz @(Pred Id) LT8Error Pred IO e=Prelude.Enum.Ordering.pred: bad argument:FailT "Pred IO e=Prelude.Enum.Ordering.pred: bad argument"0predicate-typed unbounded  functionpz @(Succ Id) 13 Present 14 PresentT 14pz @(Succ Id) LT Present EQ PresentT EQpz @(Succ Id) GT8Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument:FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument"1predicate-typedbounded  functionpz @(PredB' Id) (13 :: Int) Present 12 PresentT 12pz @(PredB' Id) LTError Pred boundedFailT "Pred bounded"4predicate-typedunassoc using "pz @Unassoc (These 123 (This 'x'))Present This (These 123 'x')PresentT (This (These 123 'x'))pz @Unassoc (99,('a',True))Present ((99,'a'),True)PresentT ((99,'a'),True)2pz @Unassoc (This 10 :: These Int (These Bool ()))Present This (This 10)PresentT (This (This 10))pz @Unassoc (Right (Right 123))Present Right 123PresentT (Right 123):pz @Unassoc (Left 'x' :: Either Char (Either Bool Double))Present Left (Left 'x')PresentT (Left (Left 'x'))5predicate-typed assoc using  pz @Assoc (This (These 123 'x'))Present These 123 (This 'x')PresentT (These 123 (This 'x'))pz @Assoc ((99,'a'),True)Present (99,('a',True))PresentT (99,('a',True))pz @Assoc ((99,'a'),True)Present (99,('a',True))PresentT (99,('a',True))7pz @Assoc (Right "Abc" :: Either (Either () ()) String)Present Right (Right "Abc")PresentT (Right (Right "Abc"))pz @Assoc (Left (Left 'x'))Present Left 'x'PresentT (Left 'x')8predicate-typed swaps using 6pz @Swap (Left 123)Present Right 123PresentT (Right 123)pz @Swap (Right 123)Present Left 123PresentT (Left 123)pz @Swap (These 'x' 123)Present These 123 'x'PresentT (These 123 'x')pz @Swap (This 'x')Present That 'x'PresentT (That 'x')pz @Swap (That 123)Present This 123PresentT (This 123)pz @Swap (123,'x')Present ('x',123)PresentT ('x',123)pz @Swap (Left "abc")Present Right "abc"PresentT (Right "abc")pz @Swap (Right 123)Present Left 123PresentT (Left 123)9predicate-typedreverses using pz @ReverseL (T.pack "AbcDeF")Present "FeDcbA"PresentT "FeDcbA"!pz @ReverseL ("AbcDeF" :: String)Present "FeDcbA"PresentT "FeDcbA":predicate-typed similar to pz @Reverse [1,2,4]Present [4,2,1]PresentT [4,2,1]pz @Reverse "AbcDeF"Present "FeDcbA"PresentT "FeDcbA";predicate-typedlift pure over a Functor#pz @(Pure2 (Either String)) [1,2,4]!Present [Right 1,Right 2,Right 4]"PresentT [Right 1,Right 2,Right 4]=predicate-typedlift mempty over a FunctorHpz @(MEmpty2 (SG.Product Int)) [Identity (-13), Identity 4, Identity 99]TPresent [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}]UPresentT [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}]>predicate-typedsee ?: coerce over a functorHpz @(Coerce2 (SG.Sum Integer)) [Identity (-13), Identity 4, Identity 99]?Present [Sum {getSum = -13},Sum {getSum = 4},Sum {getSum = 99}]@PresentT [Sum {getSum = -13},Sum {getSum = 4},Sum {getSum = 99}]6pz @(Coerce2 (SG.Sum Integer)) (Just (Identity (-13)))!Present Just (Sum {getSum = -13})$PresentT (Just (Sum {getSum = -13}))4pz @(Coerce2 (SG.Sum Int)) (Nothing @(Identity Int))Present NothingPresentT Nothing?predicate-typed similar to .pz @(Coerce (SG.Sum Integer)) (Identity (-13))Present Sum {getSum = -13}PresentT (Sum {getSum = -13})Apredicate-typedwraps a value (see  and ):m + Data.List.NonEmptypz @(Wrap (SG.Sum _) Id) (-13)Present Sum {getSum = -13}PresentT (Sum {getSum = -13})pz @(Wrap SG.Any (Ge 4)) 13Present Any {getAny = True}PresentT (Any {getAny = True})3pz @(Wrap (NonEmpty _) (Uncons >> 'Just Id)) "abcd"Present 'a' :| "bcd"PresentT ('a' :| "bcd")Bpredicate-typedunwraps a value (see )pz @(Unwrap Id) (SG.Sum (-13)) Present -13PresentT (-13)Cpredicate-typed similar to pz @(Signum Id) (-14) Present -1 PresentT (-1)pz @(Signum Id) 14 Present 1 PresentT 1pz @(Signum Id) 0 Present 0 PresentT 0Dpredicate-typed similar to pz @(Abs Id) (-14) Present 14 PresentT 14pz @(Abs (Snd Id)) ("xx",14) Present 14 PresentT 14pz @(Abs Id) 0 Present 0 PresentT 0pz @(Abs (Negate 44)) "aaa" Present 44 PresentT 44Epredicate-typed similar to pz @(Negate Id) 14 Present -14PresentT (-14)%pz @(Negate (Fst Id * Snd Id)) (14,3) Present -42PresentT (-42)pz @(Negate (15 -% 4)) "abc"Present 15 % 4PresentT (15 % 4)pz @(Negate (15 % 3)) ()Present (-5) % 1PresentT ((-5) % 1)%pz @(Negate (Fst Id % Snd Id)) (14,3)Present (-14) % 3PresentT ((-14) % 3)Gpredicate-typed creates a  valuepz @(Id < 21 % 5) (-3.1)TrueTrueTpz @(Id < 21 % 5) 4.5FalseFalseTpz @(Fst Id % Snd Id) (13,2)Present 13 % 2PresentT (13 % 2)pz @(13 % Id) 0Error (%) zero denominatorFailT "(%) zero denominator"pz @(4 % 3 + 5 % 7) "asfd"Present 43 % 21PresentT (43 % 21)pz @(4 -% 7 * 5 -% 3) "asfd"Present 20 % 21PresentT (20 % 21)pz @(Negate (14 % 3)) ()Present (-14) % 3PresentT ((-14) % 3)pz @(14 % 3) ()Present 14 % 3PresentT (14 % 3)6pz @(Negate (14 % 3) ==! FromIntegral _ (Negate 5)) () Present GT PresentT GTpz @(14 -% 3 ==! 5 -% 1) "aa" Present GT PresentT GT)pz @(Negate (14 % 3) ==! Negate 5 % 2) () Present LT PresentT LTpz @(14 -% 3 * 5 -% 1) ()Present 70 % 3PresentT (70 % 3)pz @(14 % 3 ==! 5 % 1) () Present LT PresentT LTpz @(15 % 3 / 4 % 2) () Present 5 % 2PresentT (5 % 2)Hpredicate-typedfractional divisionpz @(Fst Id / Snd Id) (13,2) Present 6.5 PresentT 6.5pz @(ToRational 13 / Id) 0Error (/) zero denominatorFailT "(/) zero denominator"pz @(12 % 7 / 14 % 5 + Id) 12.4Present 3188 % 245PresentT (3188 % 245)predicate-typed(addition, multiplication and subtractionpz @(Fst Id * Snd Id) (13,5) Present 65 PresentT 652pz @(Fst Id + 4 * Length (Snd Id) - 4) (3,"hello") Present 19 PresentT 19_predicate-typedsimilar pz @(Pred Id +++ Id) (Left 13)Present Left 12PresentT (Left 12)*pz @(ShowP Id +++ Reverse) (Right "hello")Present Right "olleh"PresentT (Right "olleh")`predicate-typed similar to pz @(IsRight Id) (Right 123)TrueTrueTpz @(IsRight Id) (Left "aa")FalseFalseTapredicate-typed similar to pz @(IsLeft Id) (Right 123)FalseFalseTpz @(IsLeft Id) (Left 'a')TrueTrueTcpredicate-typedsimilar pz @(Pred Id ||| Id) (Left 13) Present 12 PresentT 12%pz @(ShowP Id ||| Id) (Right "hello")Present "hello"PresentT "hello"fpredicate-typed similar to %pz @(Pred Id *** ShowP Id) (13, True)Present (12,"True")PresentT (12,"True")+pl @(FlipT (***) Len (Id * 12)) (99,"cdef")/Present (1188,4) ((***) (1188,4) | (99,"cdef"))PresentT (1188,4)gpredicate-typed similar to jpredicate-typed similar to  pz @(SplitAt 4 Id) "hello world"Present ("hell","o world")PresentT ("hell","o world")!pz @(SplitAt 20 Id) "hello world"Present ("hello world","")PresentT ("hello world","") pz @(SplitAt 0 Id) "hello world"Present ("","hello world")PresentT ("","hello world")1pz @(SplitAt (Snd Id) (Fst Id)) ("hello world",4)Present ("hell","o world")PresentT ("hell","o world"))pz @(SplitAt (Negate 2) Id) "hello world"Present ("hello wor","ld")PresentT ("hello wor","ld")kpredicate-typedIsplit a list 'p' into parts using the lengths in the type level list 'ns'*pz @(SplitAts '[2,3,1,1] Id) "hello world"#Present ["he","llo"," ","w","orld"]$PresentT ["he","llo"," ","w","orld"]$pz @(SplitAts '[2] Id) "hello world"Present ["he","llo world"]PresentT ["he","llo world"]+pz @(SplitAts '[10,1,1,5] Id) "hello world" Present ["hello worl","d","",""]!PresentT ["hello worl","d","",""]predicate-typed pad 'q' with '\n' values from '\p'\pz @(PadL 5 999 Id) [12,13]Present [999,999,999,12,13]PresentT [999,999,999,12,13](pz @(PadR 5 (Fst Id) '[12,13]) (999,'x')Present [12,13,999,999,999]PresentT [12,13,999,999,999]+pz @(PadR 2 (Fst Id) '[12,13,14]) (999,'x')Present [12,13,14]PresentT [12,13,14]npredicate-typed&Convenient method to convert a 'p' or '\q' to a  based on a predicate '\b\'" if 'b' then Right 'p' else Left '\q\'Qpz @(EitherBool (Fst Id > 4) (Snd Id >> Fst Id) (Snd Id >> Snd Id)) (24,(-1,999))Present Right 999PresentT (Right 999)Hpz @(EitherBool (Fst Id > 4) (Fst (Snd Id)) (Snd (Snd Id))) (1,(-1,999))Present Left (-1)PresentT (Left (-1))opredicate-typed.Convenient method to convert a value 'p' to a  based on a predicate '\b\' if '\b\' then Just 'p' else Nothingpz @(MaybeBool (Id > 4) Id) 24Present Just 24PresentT (Just 24) pz @(MaybeBool (Id > 4) Id) (-5)Present NothingPresentT Nothingppredicate-typedEprocesses a type level list predicates running each in sequence: see 0pz @(Do [Pred Id, ShowP Id, Id &&& Len]) 9876543Present ("9876542",7)PresentT ("9876542",7)=pz @(Do '[W 123, W "xyz", Len &&& Id, Pred Id *** Id<>Id]) ()Present (2,"xyzxyz")PresentT (2,"xyzxyz")qpredicate-typedconverts a value to a : the same as  '\'Proxy'pz @MkProxy 'x' Present ProxyPresentT Proxyspredicate-typed> function where you need to provide the type 't' of the resultpz @(Floor Int Id) (23 % 5) Present 4 PresentT 4upredicate-typed> function where you need to provide the type 't' of the resultpz @(Ceiling Int Id) (23 % 5) Present 5 PresentT 5wpredicate-typed> function where you need to provide the type 't' of the resultpz @(Truncate Int Id) (23 % 5) Present 4 PresentT 4ypredicate-typed> function where you need to provide the type 't' of the result#pz @(FromRational Rational Id) 23.5Present 47 % 2PresentT (47 % 2)zpredicate-typed functionpz @(ToRational Id) 23.5Present 47 % 2PresentT (47 % 2)|predicate-typed> function where you need to provide the type 't' of the result#pz @(FromIntegral (SG.Sum _) Id) 23Present Sum {getSum = 23}PresentT (Sum {getSum = 23})~predicate-typed> function where you need to provide the type 't' of the result"pz @(FromInteger (SG.Sum _) Id) 23Present Sum {getSum = 23}PresentT (Sum {getSum = 23}) pz @(FromInteger Rational 44) 12Present 44 % 1PresentT (44 % 1) pz @(FromInteger Rational Id) 12Present 12 % 1PresentT (12 % 1)predicate-typed> function where you need to provide the type 't' of the result:set -XFlexibleContexts&pz @(FromString (Identity _) Id) "abc"Present Identity "abc"PresentT (Identity "abc")(pz @(FromString (Seq.Seq Char) Id) "abc"Present fromList "abc"PresentT (fromList "abc")predicate-typed#similar to 6th element in a n-tuple$pz @(L6 Id) (10,"Abc",'x',True,1,99) Present 99 PresentT 99predicate-typed#similar to 5th element in a n-tuple!pz @(L5 Id) (10,"Abc",'x',True,1) Present 1 PresentT 1predicate-typed#similar to 4th element in a n-tuplepz @(L4 Id) (10,"Abc",'x',True) Present True PresentT True;pz @(L4 (Fst (Snd Id))) ('x',((10,"Abc",'x',999),"aa",1),9) Present 999 PresentT 999predicate-typed#similar to 3rd element in a n-tuplepz @(Thd Id) (10,"Abc",133) Present 133 PresentT 133 pz @(Thd Id) (10,"Abc",133,True) Present 133 PresentT 133predicate-typed similar to pz @(Snd Id) (10,"Abc") Present "Abc"PresentT "Abc"pz @(Snd Id) (10,"Abc",True) Present "Abc"PresentT "Abc"predicate-typed similar to pz @(Fst Id) (10,"Abc") Present 10 PresentT 10pz @(Fst Id) (10,"Abc",'x') Present 10 PresentT 10!pz @(Fst Id) (10,"Abc",'x',False) Present 10 PresentT 10predicate-typed similar to  for  instancespz @(Length Id) (Left "aa") Present 0 PresentT 0pz @(Length Id) (Right "aa") Present 1 PresentT 1'pz @(Length (Right' Id)) (Right "abcd") Present 4 PresentT 4:pz @(Length (Thd (Snd Id))) (True,(23,'x',[10,9,1,3,4,2])) Present 6 PresentT 6predicate-typed similar to pz @Len [10,4,5,12,3,4] Present 6 PresentT 6 pz @Len [] Present 0 PresentT 0predicate-typed sort a listOpz @(SortOn (Fst Id) Id) [(10,"abc"), (3,"def"), (4,"gg"), (10,"xyz"), (1,"z")]:Present [(1,"z"),(3,"def"),(4,"gg"),(10,"abc"),(10,"xyz")];PresentT [(1,"z"),(3,"def"),(4,"gg"),(10,"abc"),(10,"xyz")]Gpz @(SortBy (OrdP (Snd Id) (Fst Id)) Id) [(10,"ab"),(4,"x"),(20,"bbb")]&Present [(20,"bbb"),(10,"ab"),(4,"x")]'PresentT [(20,"bbb"),(10,"ab"),(4,"x")]!pz @(SortBy 'LT Id) [1,5,2,4,7,0]Present [1,5,2,4,7,0]PresentT [1,5,2,4,7,0]!pz @(SortBy 'GT Id) [1,5,2,4,7,0]Present [0,7,4,2,5,1]PresentT [0,7,4,2,5,1]pz @(SortBy ((Fst (Fst Id) ==! Fst (Snd Id)) <> (Snd (Fst Id) ==! Snd (Snd Id))) Id) [(10,"ab"),(4,"x"),(20,"bbb"),(4,"a"),(4,"y")]6Present [(4,"a"),(4,"x"),(4,"y"),(10,"ab"),(20,"bbb")]7PresentT [(4,"a"),(4,"x"),(4,"y"),(10,"ab"),(20,"bbb")]pz @(SortBy ((Fst (Fst Id) ==! Fst (Snd Id)) <> (Snd (Snd Id) ==! Snd (Fst Id))) Id) [(10,"ab"),(4,"x"),(20,"bbb"),(4,"a"),(4,"y")]6Present [(4,"y"),(4,"x"),(4,"a"),(10,"ab"),(20,"bbb")]7PresentT [(4,"y"),(4,"x"),(4,"a"),(10,"ab"),(20,"bbb")]predicate-typed similar to pz @Max [10,4,5,12,3,4] Present 12 PresentT 12 pz @Max []Error empty listFailT "empty list"predicate-typed similar to pz @Min [10,4,5,12,3,4] Present 3 PresentT 3 pz @Min []Error empty listFailT "empty list"predicate-typed similar to pz @Product [10,4,5,12,3,4] Present 28800PresentT 28800pz @Product [] Present 1 PresentT 1predicate-typed similar to pz @Sum [10,4,5,12,3,4] Present 38 PresentT 38 pz @Sum [] Present 0 PresentT 0predicate-typedemulates ReadPpredicate-typedIRead but returns the Maybe of the value and any remaining unparsed stringpz @(ReadMaybe Int Id) "123x"Present Just (123,"x")PresentT (Just (123,"x"))pz @(ReadMaybe Int Id) "123"Present Just (123,"")PresentT (Just (123,""))pz @(ReadMaybe Int Id) "x123"Present NothingPresentT Nothingpredicate-typed uses the B of the given type 't' and 'p' which points to the content to readpz @(ReadP Rational Id) "4 % 5" Present 4 % 5PresentT (4 % 5)[pz @(Between (ReadP Day "2017-04-11") (ReadP Day "2018-12-30") (ReadP Day Id)) "2018-10-12"TrueTrueT[pz @(Between (ReadP Day "2017-04-11") (ReadP Day "2018-12-30") (ReadP Day Id)) "2016-10-12"FalseFalseTpredicate-typed uncreate a  returning year month and day6pz @(UnMkDay Id) (readNote "invalid day" "2019-12-30")Present (2019,12,30)PresentT (2019,12,30)predicate-typed create a 6 from three int values passed in as year month and daypz @MkDay (2019,12,30)Present Just (2019-12-30,1,1) PresentT (Just (2019-12-30,1,1))7pz @(MkDay' (Fst Id) (Snd Id) (Thd Id)) (2019,99,99999)Present NothingPresentT Nothingpz @MkDay (1999,3,13)Present Just (1999-03-13,10,6)!PresentT (Just (1999-03-13,10,6))predicate-typedUA convenience method to match against many different datetime formats to find a matchpz @(ParseTimes LocalTime '["%Y-%m-%d %H:%M:%S", "%m/%d/%y %H:%M:%S", "%B %d %Y %H:%M:%S", "%Y-%m-%dT%H:%M:%S"] "03/11/19 01:22:33") ()Present 2019-03-11 01:22:33PresentT 2019-03-11 01:22:33pz @(ParseTimes LocalTime (Fst Id) (Snd Id)) (["%Y-%m-%d %H:%M:%S", "%m/%d/%y %H:%M:%S", "%B %d %Y %H:%M:%S", "%Y-%m-%dT%H:%M:%S"], "03/11/19 01:22:33")Present 2019-03-11 01:22:33PresentT 2019-03-11 01:22:33predicate-typed similar to  where 't' is the  H type, 'p' is the datetime format and 'q' points to the content to parse;pz @(ParseTimeP LocalTime "%F %T" Id) "2019-05-24 05:19:59"Present 2019-05-24 05:19:59PresentT 2019-05-24 05:19:59Mpz @(ParseTimeP LocalTime "%F %T" "2019-05-24 05:19:59") (Right "never used")Present 2019-05-24 05:19:59PresentT 2019-05-24 05:19:594keeping 'q' as we might want to extract from a tuplepredicate-typed@type level expression representing a formatted time similar to   using a type level  to get the formatting string\pz @(FormatTimeP "%F %T" Id) (readNote @LocalTime "invalid localtime" "2019-05-24 05:19:59")Present "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") Present "the date is 24/05/2019"!PresentT "the date is 24/05/2019"predicate-typed similar to  pz @(ShowP Id) [4,8,3,9]Present "[4,8,3,9]"PresentT "[4,8,3,9]"pz @(ShowP Id) 'x' Present "'x'"PresentT "'x'"pz @(ShowP (42 -% 10)) 'x'Present "(-21) % 5"PresentT "(-21) % 5"predicate-typedsplit a list into single valuespz @(Ones Id) [4,8,3,9]Present [[4],[8],[3],[9]]PresentT [[4],[8],[3],[9]]pz @(Ones Id) [] Present [] PresentT []predicate-typed similar to  pz @Tails [4,8,3,9](Present [[4,8,3,9],[8,3,9],[3,9],[9],[]])PresentT [[4,8,3,9],[8,3,9],[3,9],[9],[]] pz @Tails [] Present [[]] PresentT [[]]predicate-typed similar to  pz @Inits [4,8,3,9](Present [[],[4],[4,8],[4,8,3],[4,8,3,9]])PresentT [[],[4],[4,8],[4,8,3],[4,8,3,9]] pz @Inits [] Present [[]] PresentT [[]]predicate-typedconverts a string ,- value to upper casepz @ToUpper "HeLlO wOrld!"Present "HELLO WORLD!"PresentT "HELLO WORLD!"predicate-typedconverts a string ,- value to lower casepz @ToLower "HeLlO wOrld!"Present "hello world!"PresentT "hello world!"predicate-typed5predicate for determining if the string is all spacespz @IsSpaceAll "213G"FalseFalseTpz @IsSpaceAll " "TrueTrueTpz @IsSpaceAll ""TrueTrueTpredicate-typed5predicate for determining if the string is all digitspz @IsDigitAll "213G"FalseFalseTpz @IsDigitAll "929"TrueTrueTpredicate-typed(a predicate for determining if a string .-# belongs to the given character setpz @IsLowerAll "abc"TrueTrueTpz @IsLowerAll "abcX"FalseFalseTpz @IsLowerAll (T.pack "abcX")FalseFalseTpz @IsHexDigitAll "01efA"TrueTrueTpz @IsHexDigitAll "01egfA"FalseFalseT8| predicate for determining if a string is all lowercasepz @IsLowerAll "abcdef213"FalseFalseTpz @IsLowerAll "abcdef"TrueTrueTpz @IsLowerAll ""TrueTrueTpz @IsLowerAll "abcdefG"FalseFalseT2pl @(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"7Present (False,True,True,False,False,False,False,False)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"))})FalseTpredicate-typed5predicate for determining if the character is a digitpz @IsDigit 'g'FalseFalseTpz @IsDigit '9'TrueTrueTpredicate-typed5predicate for determining if a character is lowercasepz @IsLower '1'FalseFalseTpz @IsLower 'a'TrueTrueTrpz @(Map '(IsControl, IsLatin1, IsHexDigit, IsOctDigit, IsDigit, IsPunctuation, IsSeparator, IsSpace) Id) "abc134"#Present [(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)]$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'TrueTrueTpz @IsSpace ' 'TrueTrueTpz @IsSpace 'x'FalseFalseTpz @IsLower 'a'TrueTrueTpz @IsLower 'X'FalseFalseTpz @IsHexDigit 'A'TrueTrueTpz @IsHexDigit 'g'FalseFalseTpredicate-typedA replacement function ([String] -> String)" which yields the groups Used by o and p 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")Present "142 | 202 | 2 | 23"PresentT "142 | 202 | 2 | 23"predicate-typedA replacement function (String -> String)& that yields the whole match Used by o and p Requires Text.Show.Functions:m + Text.Show.Functions[pz @(ReplaceAll "\\." (ReplaceFn2 (Fst Id)) (Snd Id)) (\x -> x <> ":" <> x, "141.201.1.22")Present "141.:.201.:.1.:.22"PresentT "141.:.201.:.1.:.22"predicate-typedA replacement function (String -> [String] -> String)7 which returns the whole match and the groups Used by o and p Requires Text.Show.Functionspredicate-typedSimple replacement string: see  and predicate-typed+replace all occurrences of string 'p' with '\q' in 'r'4pl @(ReplaceAllString "abc" "def" Id) "123abc456abc"IPresent "123def456def" (ReplaceAll' [] (abc) 123abc456abc | 123def456def)PresentT "123def456def"9pl @(ReplaceAllString' '[] "abc" "def" Id) "123AbC456abc"IPresent "123AbC456def" (ReplaceAll' [] (abc) 123AbC456abc | 123AbC456def)PresentT "123AbC456def"Dpl @(ReplaceAllString' '[ 'Caseless ] "abc" "def" Id) "123AbC456abc"EPresent "123def456def" (ReplaceAll (abc) 123AbC456abc | 123def456def)PresentT "123def456def"predicate-typed,replace first occurrence of string 'p' with '\q' in 'r'4pl @(ReplaceOneString "abc" "def" Id) "123abc456abc"IPresent "123def456abc" (ReplaceOne' [] (abc) 123abc456abc | 123def456abc)PresentT "123def456abc"predicate-typed6replaces regex 's' with a string 's1' inside the value2pz @(ReplaceAllString "\\." ":" Id) "141.201.1.22"Present "141:201:1:22"PresentT "141:201:1:22"predicate-typed$splits a string on a regex delimiter%pz @(Resplit "\\." Id) "141.201.1.22"Present ["141","201","1","22"]PresentT ["141","201","1","22"]<pz @(Resplit (Singleton (Fst Id)) (Snd Id)) (':', "12:13:1")Present ["12","13","1"]PresentT ["12","13","1"]5pl @(Resplit' '[ 'Caseless ] "aBc" Id) "123AbC456abc"HPresent ["123","456",""] (Resplit (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"%Present [((0,8),[(0,2),(3,5),(6,8)])]&PresentT [((0,8),[(0,2),(3,5),(6,8)])]predicate-typedLruns a regex matcher returning the original values and optionally any groups9pz @(Rescan "^(\\d{2}):(\\d{2}):(\\d{2})$" Id) "13:05:25"'Present [("13:05:25",["13","05","25"])](PresentT [("13:05:25",["13","05","25"])]Epz @(Rescan (Snd Id) "13:05:25") ('a',"^(\\d{2}):(\\d{2}):(\\d{2})$")'Present [("13:05:25",["13","05","25"])](PresentT [("13:05:25",["13","05","25"])]predicate-typedrepresents a predicate using a $ as a regular expression evaluates % and returns True if there is a match/pz @(Re "^\\d{2}:\\d{2}:\\d{2}$" Id) "13:05:25"TrueTrueTpredicate-typed equivalent4pz @Unzip3 (zip3 [1..5] "abcd" (cycle [True,False]))2Present ([1,2,3,4],"abcd",[True,False,True,False])3PresentT ([1,2,3,4],"abcd",[True,False,True,False])predicate-typed equivalentpz @Unzip (zip [1..5] "abcd")Present ([1,2,3,4],"abcd")PresentT ([1,2,3,4],"abcd")predicate-typed:a type level predicate for all negative elements in a listpredicate-typed:a type level predicate for all positive elements in a listpz @AllPositive [1,5,10,2,3]TrueTrueTpz @AllPositive [0,1,5,10,2,3]FalseFalseTpz @AllPositive [3,1,-5,10,2,3]FalseFalseT!pz @AllNegative [-1,-5,-10,-2,-3]TrueTrueTpredicate-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) []FalseFalseTpredicate-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]TrueTrueTpz @(All Odd Id) []TrueTrueTpe @(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 '0FalseTpredicate-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)FalseTpredicate-typed?A predicate that determines if the value is between 'p' and 'q'%pz @(Between 5 8 Len) [1,2,3,4,5,5,7]TrueTrueTpz @(5 <..> 8) 6TrueTrueTpl @(Between 5 8 Id) 9False (9 <= 8)FalseTpz @(10 % 4 <..> 40 % 5) 4TrueTrueTpz @(10 % 4 <..> 40 % 5) 33FalseFalseTpredicate-typed5a type level predicate for a strictly decreasing listpredicate-typed6a type level predicate for a monotonic decreasing listpredicate-typed5a type level predicate for a strictly increasing listpredicate-typed6a type level predicate for a monotonic increasing listpl @Asc "aaacdef" True (All(6))TrueTpz @Asc [1,2,3,4,5,5,7]TrueTrueTpz @Asc' [1,2,3,4,5,5,7]FalseFalseTpz @Asc "axacdef"FalseFalseT6a type level predicate for a monotonic increasing listpredicate-typedlimit the size of the listspredicate-typedbounded  functionpz @(SuccB' Id) (13 :: Int) Present 14 PresentT 14pz @(SuccB' Id) LT Present EQ PresentT EQpz @(SuccB 'LT Id) GT Present LT PresentT LTpz @(SuccB' Id) GTError Succ boundedFailT "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[\]^_`abcdefghijklmnopqrstuvwxyz{|}~0/.-^86754]\[HEDC}~{|vwtursGFzxyq763254gfedc_ZYXUWVNMLIKJTSRQPO0/-+,32.1)*(B@A?>$8mlkj+*ih:9%&   ?ONoa`MKLJnbd bc<=CB@A! IFHEGD~zyxwvutsrpqonkmlTVURSjihgfe,`a ;_^]#"}|Y\[Z<;p>=PXW:{1Q9'0-3/3;1<0W1X0\3]4^4_4d644123111111555F8G8H7I4J4K4L4M4N4U4V4W4X4Y4Z4[7\6]6_2c2f3g34 None,-.=>?HSUVX+fpredicate-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,-.=>?HSUVX|  predicate-typed;take any valid Read/Show instance and turn it into a valid :m + Data.Ratio*prtEval3P (readshow @Rational) oz "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})+prtEval3P (readshow @Rational) oz "13x % 3"JLeft Step 1. Initial Conversion(ip) Failed | ReadP Ratio Integer (13x % 3)?prtEval3P (readshow' @Rational @(3 % 1 <..> 5 % 1)) oz "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})JprtEval3P (Proxy @(ReadShow' Rational (11 -% 2 <..> 3 -% 1))) oz "-13 % 3"8Right (Refined3 {r3In = (-13) % 3, r3Out = "(-13) % 3"})CprtEval3P (Proxy @(ReadShow' Rational (Id > (15 % 1)))) oz "13 % 3"-Left Step 2. False Boolean Check(op) | FalseP{prtEval3P (Proxy @(ReadShow' Rational (Msg (PrintF "invalid=%3.2f" (FromRational Double Id)) (Id > (15 % 1))))) ol "13 % 3"DLeft Step 2. False Boolean Check(op) | {invalid=4.3313 % 3 > 15 % 1}CprtEval3P (Proxy @(ReadShow' Rational (Id > (11 % 1)))) oz "13 % 3"-Left Step 2. False Boolean Check(op) | FalseP0let tmString = "2018-10-19 14:53:11.5121359 UTC"!let tm = read tmString :: UTCTime)prtEval3P (readshow @UTCTime) oz tmStringdRight (Refined3 {r3In = 2018-10-19 14:53:11.5121359 UTC, r3Out = "2018-10-19 14:53:11.5121359 UTC"}):m + Data.Aeson6prtEval3P (readshow @Value) oz "String \"jsonstring\""NRight (Refined3 {r3In = String "jsonstring", r3Out = "String \"jsonstring\""})-prtEval3P (readshow @Value) oz "Number 123.4">Right (Refined3 {r3In = Number 123.4, r3Out = "Number 123.4"}) predicate-typedSconvert a string from a given base 'i' and store it internally as a base 'j' string(prtEval3P (Proxy @(BaseIJ 16 2)) oz "fe"2Right (Refined3 {r3In = "11111110", r3Out = "fe"}))prtEval3P (Proxy @(BaseIJ 16 2)) oz "fge"<Left Step 1. Initial Conversion(ip) Failed | invalid base 16EprtEval3P (Proxy @(BaseIJ' 16 2 (ReadBase Int 2 Id < 1000))) ol "ffe"4Left Step 2. False Boolean Check(op) | {4094 < 1000} predicate-typed noop falsepredicate-typed noop truepredicate-typed Luhn check&prtEval3P (Proxy @(LuhnT 4)) oz "1230"3Right (Refined3 {r3In = [1,2,3,0], r3Out = "1230"})&prtEval3P (Proxy @(LuhnT 4)) ol "1234"fLeft Step 2. False Boolean Check(op) | {True && False | (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])}| uses builtin predicate-typedTconvert a string from a given base 'i' and store it internally as an base 10 integerprtEval3P base16 oz "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})0prtEval3P (basen' @16 @(100 <..> 400)) oz "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})CprtEval3P (basen' @16 @(GuardSimple (Id < 400) >> 'True)) oz "f0fe"5Left Step 2. Failed Boolean Check(op) | (61694 < 400)TprtEval3P (basen' @16 @(Id < 400)) ol "f0fe" -- todo: why different parens vs braces4Left Step 2. False Boolean Check(op) | {61694 < 400}predicate-typed'read in an ipv4 address and validate itprtEval3P ip4 oz "001.223.14.1"ARight (Refined3 {r3In = [1,223,14,1], r3Out = "001.223.014.001"})!prtEval3P ip4 ol "001.223.14.999"LLeft Step 2. Failed Boolean Check(op) | octet 3 out of range 0-255 found 999#prtEval3P ip4 oz "001.223.14.999.1"KLeft Step 2. Failed Boolean Check(op) | Guards:invalid length(5) expected 4prtEval3P ip4 ol "001.257.14.1"LLeft Step 2. Failed Boolean Check(op) | octet 1 out of range 0-255 found 257$predicate-typedread in an ssnprtEval3P ssn oz "134-01-2211"=Right (Refined3 {r3In = [134,1,2211], r3Out = "134-01-2211"})prtEval3P ssn ol "666-01-2211"wLeft Step 2. False Boolean Check(op) | {Bool(0) [number for group 0 invalid: found 666] (True && False | (666 /= 666))}prtEval3P ssn ol "667-00-2211"_Left Step 2. False Boolean Check(op) | {Bool(1) [number for group 1 invalid: found 0] (1 <= 0)}'predicate-typedcredit card with luhn algorithm!prtEval3P cc11 oz "1234-5678-901"-Left Step 2. False Boolean Check(op) | FalseP!prtEval3P cc11 oz "1234-5678-903"JRight (Refined3 {r3In = [1,2,3,4,5,6,7,8,9,0,3], r3Out = "1234-5678-903"})#pz @(Ccip >> Ccop 11) "79927398713"TrueTrueT#pz @(Ccip >> Ccop 10) "79927398713"%Error expected 10 digits but found 11'FailT "expected 10 digits but found 11"+predicate-typedread in a valid datetime9prtEval3P (datetime1 @LocalTime) ol "2018-09-14 02:57:04"LRight (Refined3 {r3In = 2018-09-14 02:57:04, r3Out = "2018-09-14 02:57:04"})9prtEval3P (datetime1 @LocalTime) ol "2018-09-99 12:12:12"YLeft Step 1. Initial Conversion(ip) Failed | ParseTimeP LocalTime (%F %T) failed to parse-predicate-typedread in a time and validate itprtEval3P hms ol "23:13:59"8Right (Refined3 {r3In = [23,13,59], r3Out = "23:13:59"})prtEval3P hms ol "23:13:60"ALeft Step 2. Failed Boolean Check(op) | seconds invalid: found 60prtEval3P hms ol "26:13:59"?Left Step 2. Failed Boolean Check(op) | hours invalid: found 26:predicate-typed8ensures that two numbers are in a given range (emulates )!prtEval3P (between @10 @16) oz 14(Right (Refined3 {r3In = 14, r3Out = 14})!prtEval3P (between @10 @16) oz 17-Left Step 2. False Boolean Check(op) | FalseP!prtEval3P (between @10 @16) o0 171Left Step 2. False Boolean Check(op) | {17 <= 16}3*** Step 1. Success Initial Conversion(ip) [17] ***P Id 17'*** Step 2. False Boolean Check(op) ***False 17 <= 16| +- P Id 17|+- P '10|`- P '169      !"#$%&'()*+,-./0123456789:;<=>9+%89-!". ()'*&,$#/01642753  = >:;<  None,-.=>?HSUVXApredicate-typed Luhn check&prtEval2 @Luhnip @(Luhnop 4) oz "1230"3Right (Refined2 {r2In = [1,2,3,0], r2Out = "1230"})&prtEval2 @Luhnip @(Luhnop 4) ol "1234"fLeft Step 2. False Boolean Check(op) | {True && False | (Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4])}| uses builtin Sconvert a string from a given base 'i' and store it internally as a base 'j' string(prtEval2 @(BaseIJip 16 2) @'True oz "fe"2Right (Refined2 {r2In = "11111110", r2Out = "fe"}))prtEval2 @(BaseIJip 16 2) @'True oz "fge"<Left Step 1. Initial Conversion(ip) Failed | invalid base 16>prtEval2 @(BaseIJip 16 2) @(ReadBase Int 2 Id < 1000) ol "ffe"4Left Step 2. False Boolean Check(op) | {4094 < 1000}Cpredicate-typedTconvert a string from a given base 'i' and store it internally as an base 10 integer/prtEval2 @(ReadBase Int 16 Id) @'True oz "00fe"-Right (Refined2 {r2In = 254, r2Out = "00fe"})>prtEval2 @(ReadBase Int 16 Id) @(Between 100 400 Id) oz "00fe"-Right (Refined2 {r2In = 254, r2Out = "00fe"})KprtEval2 @(ReadBase Int 16 Id) @(GuardSimple (Id < 400) >> 'True) oz "f0fe"5Left Step 2. Failed Boolean Check(op) | (61694 < 400)\prtEval2 @(ReadBase Int 16 Id) @(Id < 400) ol "f0fe" -- todo: why different parens vs braces4Left Step 2. False Boolean Check(op) | {61694 < 400}Ipredicate-typed'read in an ipv4 address and validate it)prtEval2 @Ip4ip @Ip4op' oz "001.223.14.1">Right (Refined2 {r2In = [1,223,14,1], r2Out = "001.223.14.1"})+prtEval2 @Ip4ip @Ip4op' ol "001.223.14.999"dLeft Step 2. False Boolean Check(op) | {Bool(3) [octet 3 out of range 0-255 found 999] (999 <= 255)}!prtEval2P ip4 ol "001.223.14.999"LLeft Step 2. Failed Boolean Check(op) | octet 3 out of range 0-255 found 999#prtEval2P ip4 ol "001.223.14.999.1"KLeft Step 2. Failed Boolean Check(op) | Guards:invalid length(5) expected 4prtEval2P ip4 ol "001.257.14.1"LLeft Step 2. Failed Boolean Check(op) | octet 1 out of range 0-255 found 257Spredicate-typedread in a valid datetime:prtEval2 @(Dtip LocalTime) @'True ol "2018-09-14 02:57:04"LRight (Refined2 {r2In = 2018-09-14 02:57:04, r2Out = "2018-09-14 02:57:04"}):prtEval2 @(Dtip LocalTime) @'True ol "2018-09-99 12:12:12"YLeft Step 1. Initial Conversion(ip) Failed | ParseTimeP LocalTime (%F %T) failed to parseTpredicate-typedcredit card with luhn algorithm,prtEval2 @Ccip @(Ccop 11) oz "1234-5678-901"-Left Step 2. False Boolean Check(op) | FalseP,prtEval2 @Ccip @(Ccop 11) oz "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"TrueTrueT#pz @(Ccip >> Ccop 10) "79927398713"%Error expected 10 digits but found 11'FailT "expected 10 digits but found 11"Xpredicate-typedread in an ssn'prtEval2 @Ssnip @Ssnop oz "134-01-2211"=Right (Refined2 {r2In = [134,1,2211], r2Out = "134-01-2211"})'prtEval2 @Ssnip @Ssnop ol "666-01-2211"wLeft Step 2. False Boolean Check(op) | {Bool(0) [number for group 0 invalid: found 666] (True && False | (666 /= 666))}'prtEval2 @Ssnip @Ssnop ol "667-00-2211"_Left Step 2. False Boolean Check(op) | {Bool(1) [number for group 1 invalid: found 0] (1 <= 0)}Ypredicate-typedread in a time and validate it%prtEval2 @Hmsip @Hmsop' ol "23:13:59"8Right (Refined2 {r2In = [23,13,59], r2Out = "23:13:59"})%prtEval2 @Hmsip @Hmsop' ol "23:13:60"ELeft Step 2. False Boolean Check(op) | {Bool(2) [seconds] (60 <= 59)}%prtEval2 @Hmsip @Hmsop' ol "26:13:59"CLeft Step 2. False Boolean Check(op) | {Bool(0) [hours] (26 <= 23)} ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ SUWRVPQYLMZJKT^XNO[HI\FG]DECB@?ANone   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRTSUVWXYZ\[]^_`abcdefghijklmnopqrstuvwxyz{|}~'()*+,-./0123456789:;<=>]^_`abcdefghijklmnopqrs*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None &'->HXk _predicate-typed creates a " refinement type with terse output5$$(refinedTH 123) :: Refined (Between 100 125 Id) IntRefined {unRefined = 123} 7>$$(refinedTH 99) :: Refined (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 `predicate-typed creates a  refinement type*allows you to specify display options (eg  for unicode /  for ansi)9$$(refinedTH' o2 123) :: Refined (Between 100 125 Id) IntRefined {unRefined = 123} K>$$(refinedTH' o2 99) :: Refined (FailS "asdf" >> Between 100 125 Id) Int  interactiveR:116:4: error: * [Error asdf] lhs failed >> | `- [Error asdf] Fail asdf | `- P 'asdf refinedTH: predicate failed with FailP "asdf" ((>>) lhs failed) * In the Template Haskell splice $$(refinedTH' o0 99) In the expression: $$(refinedTH' o2 99) :: Refined (FailS "asdf" >> Between 100 125 Id) Int apredicate-typed creates a //" refinement type with terse output=$$(refined1TH 100) :: Refined1 Id (Between 100 125 Id) Id IntRefined1 {unRefined1 = 100}=$$(refined1TH 100) :: Refined1 Id (Between 100 125 Id) Id IntRefined1 {unRefined1 = 100}bpredicate-typed creates a // refinement type*allows you to specify display options (eg  for unicode /  for ansi)A$$(refined1TH' o2 100) :: Refined1 Id (Between 100 125 Id) Id IntRefined1 {unRefined1 = 100} C>$$(refined1TH' o2 99) :: Refined1 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' o2 99) In the expression: $$(refined1TH' o2 99) :: Refined1 Id (Between 100 125 Id) Id Int In an equation for 'it': it = $$(refined1TH' o2 99) :: Refined1 Id (Between 100 125 Id) Id Int cpredicate-typed creates a 00" refinement type with terse output:$$(refined2TH 100) :: Refined2 Id (Between 100 125 Id) Int"Refined2 {r2In = 100, r2Out = 100}dpredicate-typed creates a 00 refinement type*allows you to specify display options (eg  for unicode /  for ansi)>$$(refined2TH' o2 100) :: Refined2 Id (Between 100 125 Id) Int"Refined2 {r2In = 100, r2Out = 100} @>$$(refined2TH' o2 99) :: Refined2 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' o2 99) In the expression: $$(refined2TH' o2 99) :: Refined2 Id (Between 100 125 Id) Id Int In an equation for 'it': it = $$(refined2TH' o2 99) :: Refined2 Id (Between 100 125 Id) Id Int epredicate-typed creates a " refinement type with terse output=$$(refined3TH 100) :: Refined3 Id (Between 100 125 Id) Id Int"Refined3 {r3In = 100, r3Out = 100}fpredicate-typed creates a  refinement type*allows you to specify display options (eg  for unicode /  for ansi)A$$(refined3TH' o2 100) :: Refined3 Id (Between 100 125 Id) Id Int"Refined3 {r3In = 100, r3Out = 100} C>$$(refined3TH' o2 99) :: Refined3 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' o2 99) In the expression: $$(refined3TH' o2 99) :: Refined3 Id (Between 100 125 Id) Id Int In an equation for 'it': it = $$(refined3TH' o2 99) :: Refined3 Id (Between 100 125 Id) Id Int _`abcdef_`abcdef123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghhijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~0     / !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU(VWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N   O $ % ) * + , - . / 0 1 2 4 3 & ' ( 5 7 ; I H < = > ? @ A : P Q R S T U V W X Y Z [ \ ] ^ _`ab`acdefghijklmnopqrstuvqrwqrxqryqrzt{|}~ttS"t)t'...trtttutxttttttt""tttqqqqttttttttttt)tttttttttt)t)ttttttttuttttttqtttttqt)t)txtt t t t t ttttttttttt !t"#t$t%&'t(t)t*t+,-.predicate-typed-0.6.2.0-IoKn08I3B6tDFtG6D3yS1nPredicate.TH_OrphansPredicate.UtilPredicate.CorePredicate.RefinedPredicate.Refined3Predicate.Refined2Predicate.Refined1Predicate.PreludePredicate.Examples.CommonPredicate.Examples.Refined3Predicate.Examples.Refined2Predicate.Util_THPaths_predicate_typedPrintLPrintT Predicate ReplaceImplDo>> Control.Arrow&&&GHC.BaseStringRefinedRefined3$T stripLeft stripRight Control.Monadjoin Data.Alignalign Data.Thesethese Data.Listorsands GHC.MaybeJust Data.Either catMaybesmergeTheseWithData.Text.LensIsText Data.TextRefined1Refined2 $fLiftUTCTime $fLiftFixed$fLiftTimeOfDay$fLiftLocalTime $fLiftDay$fLiftDiffTime MonadEvalrunIOcatchit catchitNFliftEvalConsTMapTSumTIfTFlipT%&%% InductListC InductListP inductListC InductTupleC InductTupleP inductTupleCLenT IntersperseT<%>RepeatTGetOrdgetOrd OrderingPCGtCGeCEqCLeCLtCNeGetBoolgetBool GetOrdering getOrderingGetThesegetTheseGetLengetLenGetSymbsgetSymbsGetNatsgetNatsNotTOrTAndT FailUnlessT FailWhenT ZwischenTRReplace RReplace1 RReplace2 RReplace3GetROptsgetROptsROptAnchored Auto_calloutCaselessDollar_endonlyDotallDupnamesExtendedExtra Firstline Multiline Newline_cr Newline_crlf Newline_lfNo_auto_captureUngreedyUtf8 No_utf8_checkODebugOZeroOLite OSubNormalONormalOVerboseDispAnsiUnicodePOptsoWidthoDebugoDispoColorHolderPEBoolPBoolTFailTFalseTTrueTPresentTTT_tBool _tStrings_tForesttBooltStringstForestboolT2PpBoolpStringsmkNodemkNodeB mkNodeSkipP getValAndPEgetValLRFromTTfromTThh getValueLRgetValueLRHidedefOptsozololco0o2o2no3ouou3oun isVerbosesetwverbosenormal subnormalsetusetccolor0color1color2color3color4color5fixBoolTshow01lit01show01'lit01'showLit0showLit1show0show3show1showLlitLlitBLlitBS compileRegex splitAndAlign_FailT _PresentT_FalseT_TrueT~>natsymb showThese hasNoTree showBoolPcolorMeprtTTIOprtTTprtTreefixLite prtTreePure topMessage' topMessagelitezerounicodeansiprettyRationalfixit prefixMsgshowT prettyOrd removeAnsierrorInProgram readField$fFoldableBoolT$fSemigroupBoolT $fFoldableTT $fShowPOpts $fGetROpts[]$fGetROptNo_utf8_check $fGetROptUtf8$fGetROptUngreedy$fGetROptNo_auto_capture$fGetROptNewline_lf$fGetROptNewline_crlf$fGetROptNewline_cr$fGetROptMultiline$fGetROptFirstline$fGetROptExtra$fGetROptExtended$fGetROptDupnames$fGetROptDotall$fGetROptDollar_endonly$fGetROptCaseless$fGetROptAuto_callout$fGetROptAnchored $fGetROpts:$fShowRReplace $fGetNats[]: $fGetNats[][] $fGetSymbs[]:$fGetSymbs[][]$fGetLenNonEmpty:|$fGetLenTheseThese$fGetLenTheseThat$fGetLenTheseThis$fGetLenEitherRight$fGetLenEitherLeft$fGetLenMaybeNothing$fGetLenMaybeJust $fGetLen[]: $fGetLen[][]$fGetTheseTheseThese$fGetTheseTheseThat$fGetTheseTheseThis$fGetOrderingGT$fGetOrderingEQ$fGetOrderingLT$fGetBoolFalse $fGetBoolTrue $fGetOrdCNe $fGetOrdCLt $fGetOrdCLe $fGetOrdCEq $fGetOrdCGe $fGetOrdCGt$fInductTupleC(,,,,,,,,,,,)$fInductTupleC(,,,,,,,,,,)$fInductTupleC(,,,,,,,,,)$fInductTupleC(,,,,,,,,)$fInductTupleC(,,,,,,,)$fInductTupleC(,,,,,,)$fInductTupleC(,,,,,)$fInductTupleC(,,,,)$fInductTupleC(,,,)$fInductTupleC(,,)$fInductTupleC(,)$fInductTupleC()$fInductListC12a$fInductListC11a$fInductListC10a$fInductListC9a$fInductListC8a$fInductListC7a$fInductListC6a$fInductListC5a$fInductListC4a$fInductListC3a$fInductListC2a$fInductListC1a$fInductListC0a $fMonadEvalIO$fMonadEvalIdentity $fShowBoolP $fEqBoolP$fShowPE$fShowTT $fShowDisp$fEqDisp $fOrdODebug $fShowODebug $fEqODebug $fEnumODebug$fBoundedODebug $fShowROpt$fEqROpt $fOrdROpt $fEnumROpt $fBoundedROpt$fShowOrderingP $fEqOrderingP$fEnumOrderingP$fBoundedOrderingP $fEqBoolT $fShowBoolTMsgWIdTIdIPPPevalevalBool evalQuickpepe2pe2ape2npe3pzplplcpupuapunpeWithrunPQ runPQBool$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 $fPTYPEWaRefinedT unRefinedTRefinedC unRefined arbRefinedrapplyrapply0 rapplyLiftconvertRefinedT withRefinedTwithRefinedTIO prtRefinedIO newRefined newRefinedT newRefinedTIOunRavelT unRavelTIO prtRefinedTIO prtRefinedT unsafeRefinedunsafeRefined'$fToJSONRefined$fHashableRefined$fBinaryRefined$fFromJSONRefined $fReadRefined$fIsStringRefined$fMonadError[]RefinedT$fMonadTransRefinedT $fShowRefined $fEqRefined$fGenericRefined $fLiftRefined$fFunctorRefinedT$fApplicativeRefinedT$fMonadRefinedT$fMonadContRefinedT$fMonadWriterRefinedT$fShowRefinedT$fMonadIORefinedTT4_4T4_3T4_2T4_1RefinedEmulateMsg3m3Descm3Shortm3Long RResults3RFRTFRTFalseRTTrueFRTTrueTMakeR3 Refined3Cr3Inr3OutunsafeRefined3'unsafeRefined3 arbRefined3arbRefined3WithmkProxy3 mkProxy3'withRefined3TIO withRefined3TwithRefined3TP newRefined3T newRefined3TPnewRefined3TPIOconvertRefined3TPrapply3rapply3P prtEval3PIOprtEval3 prtEval3Peval3Peval3prt3IOprt3prt3Impleval3PXeval3X$fToJSONRefined3$fHashableRefined3$fBinaryRefined3$fFromJSONRefined3$fReadRefined3$fIsStringRefined3 $fShowMsg3$fShowRResults3$fEqMsg3$fLiftRefined3 $fEqRefined3$fShowRefined3T3_3T3_2T3_1MakeR2Msg2m2Descm2Shortm2Long RResults2RTTrue Refined2Cr2Inr2OutunsafeRefined2'unsafeRefined2withRefined2TIO withRefined2TwithRefined2TP newRefined2T newRefined2TPnewRefined2TIO prtEval2PIOprtEval2 prtEval2Peval2Peval2prt2IOprt2prt2ImplmkProxy2 mkProxy2'$fToJSONRefined2$fHashableRefined2$fBinaryRefined2$fFromJSONRefined2$fReadRefined2$fIsStringRefined2 $fShowMsg2$fShowRResults2$fEqMsg2$fLiftRefined2 $fEqRefined2$fShowRefined2Msg1m1Descm1Shortm1Long RResults1MakeR1 Refined1C unRefined1unsafeRefined1'unsafeRefined1 arbRefined1arbRefined1WithmkProxy1 mkProxy1'withRefined1TIO withRefined1TwithRefined1TP newRefined1T newRefined1TPnewRefined1TPIOconvertRefined1TPrapply1rapply1P prtEval1PIOprtEval1 prtEval1Peval1Peval1prt1IOprt1prt1Impleval1PXeval1X$fToJSONRefined1$fHashableRefined1$fBinaryRefined1$fFromJSONRefined1$fReadRefined1$fIsStringRefined1 $fShowMsg1$fShowRResults1$fEqMsg1$fLiftRefined1 $fEqRefined1$fShowRefined1RotateChunksOfToString|+OrA&*AndAUncurryEncodeJsonFile EncodeJson ParseJsonFileParseJsonFile' ParseJson ParseJson'OnePBothK&RDotDotInitLastTailHead TheseFailThatFailThisFailTheseDefThatDefThisDef RightFailLeftFailRightDefLeftDefJustFailJustDefDoNRepeatStripRStripLTrimBothTrimRTrimL$&$$Join DuplicateExtract<|>*><*<$SapASapA'<> IsSuffixIIsInfixI IsPrefixIIsSuffixIsInfixIsPrefixStdinReadIO'ReadIOStderrStdout WriteFile WriteFile' AppendFileTimeZtTimeUtc ReadEnvAllReadEnv DirExistsReadDir FileExistsReadFileHideTraverseSequenceCase''Case'CaseParaNParaPrintF IntercalateShowBaseReadBase ReadBase'LuhnZipZipRZipLZipTheseChar1 Singleton EmptyList EmptyList'TheseIdTheseInIsTheseIsThatIsThis FromListExtFromList ToListExtToList'ToListIToListIToList'CmpICmp===~OrdIOrdA'OrdAOrdP==!Not||&&>>><<>|>>||>Skip GuardSimpleExitWhenGuardGuardsN GuardsDetailBoolsN BoolsQuickBools GuardsQuickGuardsRemQuotQuotRemDivModModDivOddEvenCatch'CatchUnproxyHoleFailpFailtFailSFailSpanBreakFilter PartitionPairsIf ConcatMapMap IterateNUntil IterateNWhile IterateWhile IterateUntilIterateNUnfoldrFoldLFoldNScanNAScanNScanlThesesThatsThissPartitionThesePartitionEithers EnumFromToNullNull'IsEmptyUnsnocUncons+::+++OrsAnds!!?Lookup!!IxLIx'IxProxyTProxyT'CycleConcatFoldMapMConcatMkTheseMkThatMkThat'MkThisMkThis'MkRightMkRight'MkLeftMkLeft'MkJust MkNothing MkNothing'EmptyTMEmptyPMEmptyTMEmptyT'PureSTimes CatMaybesMapMaybe IsNothingIsJustMaybeInTheseXThese'That'This'Right'Left' LookupFail LookupDef LookupFail' LookupDef'InitFailInitDefLastFailLastDefTailFailTailDefHeadFailHeadDefFMapSndFMapFstElemRemoveKeepPrime ToEnumBFail ToEnumBDef ToEnumBDef'ToEnumToEnum'FromEnumPredBPredSuccPredB'SuccB'SuccBUnassocAssocSwapCswapCSwapReverseLReversePure2MEmpty2MEmpty2'Coerce2CoerceWrapWrap'UnwrapSignumAbsNegate-%%//=~<~<=~==~>=~>~NeLtLeSameGeGt/=<<===>=>*-+Dup+++IsRightIsLeftEitherIn|||SecondFirst***DropTakeSplitAtSplitAtsPadRPadL EitherBool MaybeBoolMkProxyFloorFloor'CeilingCeiling'Truncate Truncate' FromRational FromRational' ToRational FromIntegral FromIntegral' FromInteger FromInteger' FromString FromString'L6L5L4L3ThdL2SndL1FstLengthLen SortOnDescSortOnSortByMaxMinProductSumReadQReadQ' ReadMaybe ReadMaybe'ReadPReadP'UnMkDayMkDayMkDay' ParseTimes ParseTimes' ParseTimeP ParseTimeP' FormatTimePShowPOnesTailsInitsToUpperToLower 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 $fPTYPEInitsx $fPTYPETailsx $fPTYPEOnesx $fPTYPEShowPx$fPTYPEFormatTimePx$fPTYPEParseTimeP'a$fPTYPEParseTimes'a$fPTYPEMkDay'x$fPTYPEUnMkDayx$fPTYPEReadP'x$fPTYPEReadMaybe'x $fPTYPESum[]$fPTYPEProduct[] $fPTYPEMin[] $fPTYPEMax[] $fPTYPELenas$fPTYPELengthx $fPTYPEL1x$fExtractL1C(,,,,,)$fExtractL1C(,,,,)$fExtractL1C(,,,)$fExtractL1C(,,)$fExtractL1C(,) $fPTYPEFstx $fPTYPEL2x$fExtractL2C(,,,,,)$fExtractL2C(,,,,)$fExtractL2C(,,,)$fExtractL2C(,,)$fExtractL2C(,) $fPTYPESndx $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$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$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$fPTYPEProxyT'x $fPTYPEIx[] $fPTYPEIxLa$fPTYPELookupa $fPTYPE!!?a $fPTYPEAndsx $fPTYPEOrsx $fPTYPE++x $fPTYPE:+x $fPTYPE+:x$fPTYPEUnconss$fPTYPEUnsnocs$fPTYPEIsEmptyas $fPTYPENull'x $fPTYPENulla$fPTYPEEnumFromTox$fPTYPEPartitionEithers[]$fPTYPEPartitionThese[] $fPTYPEThissx $fPTYPEThatsx$fPTYPEThesesx $fPTYPEScanlx$fPTYPEScanNAx$fPTYPEUnfoldra$fPTYPEIterateNx$fPTYPEIterateWhilex$fPTYPEUnzip3x $fPTYPEUnzipx$fPTYPEConcatMapx $fPTYPEIfa$fPTYPEPairs[] $fPTYPEDesc'x $fPTYPEDescx $fPTYPEAsc'x $fPTYPEAscx$fPTYPEPartitiona$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 $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$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 $fPTYPEHidex$fPTYPESortByx$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 $fShowFHandleLuhn'Luhn''Luhnop' Ddmmyyyyop' Ddmmyyyyop DdmmyyyyRE DateTimeNip DateTimeFmtsDateNipDateFmtsIp6fmtIp6opIp6ip Ip4StrictREOctetREIp4fmtIp4opIp4op'Ip4ip'Ip4ipIp4REHmsREHmsfmtHmsop'HmsopHmsipSsnfmtSsnopSsnipDtfmtDtipLuhnopLuhnipCcfmtCcopCcip ReadShowR' ReadShow' ReadShowRReadShowBaseIJ'BaseIJOkNotROkNotOkROkLuhnTLuhnRBetweenRBetweenNBaseN'BaseN DateTimeN DateTimeNRDateNIp6Ip6RIp4'Ip4R'Ip4Ip4RHms'HmsR'HmsHmsRSsnRSsn DateTime1CC11Ccnccnccn'cc11 datetime1ssnhmshms'ip4ip4'ip6base16base16'base2base2'basenbasen'daten datetimenbetweenokoknotreadshow readshow'BaseIJip refinedTH refinedTH' refined1TH refined1TH' refined2TH refined2TH' refined3TH refined3TH'version getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName)pcre-heavy-1.0.0.2-ChCGs8upZiD3exJkt5Gwg8Text.Regex.PCRE.HeavysubgsubGetROpt showLitImplPColor_pBool _pStringsFailPFalsePTruePPresentPgetValLRfromTTHgetValueLRImpl_boolTghc-prim GHC.TypesTypebase Data.ProxyProxyNatOrderingSymbolBoolconst(QuickCheck-2.13.2-8nV7osDGiuU4p27xQv2fwBTest.QuickCheck.Arbitrary arbitrary$aeson-1.4.6.0-7526D9tGKahHh2FW4ZeY7VData.Aeson.Types.ToJSONToJSON'hashable-1.2.7.0-2SI038axTEd7AEZJ275kpiData.Hashable.ClassHashablebinary-0.8.6.0Data.Binary.ClassBinaryData.Aeson.Types.FromJSONFromJSONGHC.ReadRead eval3MSkipeval3MQuickIdentity eval1MSkipeval1MQuickIdentity Data.Function"these-1.0.1-3UTMdwaa4leJANRBM2TWHZTheseEitherMaybe StripImplTrimImpl text-1.2.3.1strip stripStartstripEnd$comonad-5.0.6-GvBnJAzclaB4q7AeSPsEI2Control.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 sequenceACaseImplParaImplNumeric showIntAtBaseZipPadExtractAFromListThisThatIsThGHC.ExtsfromListtoList Data.Foldable"lens-4.17.1-4fon9Pm6UyWHUNX2DejVtJControl.Lens.IndexeditoList GHC.ClassescomparenotGuardsDetailImpl GuardsImplGHC.RealquotRemdivModmoddivevenGHC.Listbreak partitionmapunfoldrscanlpartitionThesepartitionEithersGHC.Enum enumFromTonullFoldableControl.Lens.EmptyAsEmptyControl.Lens.ConsunsnocunconslookupControl.Lens.AtIxedcycleconcatfoldMapmconcatRightLeftemptymemptypurestimes Data.Maybe isNothingisJustmaybeEitherXcontainers-0.6.0.1Data.Sequence.InternalSeqelemKeepImpltoEnumfromEnumpredsuccAssocCControl.Lens.Internal.Iso reversingreverseGHC.PrimcoerceControl.Lens.Wrapped _Wrapped' _Unwrapped'GHC.NumsignumabsnegateRationalBinisRightisLeftsplitAtPadImplfloorceilingtruncate fromRational toRational fromIntegral fromInteger Data.String fromString Data.TuplesndfstlengthmaximumminimumproductsumData.Time.Calendar.DaysDayData.Time.Format.Parse parseTimeM ParseTimeData.Time.Format formatTimeGHC.Showshowtailsinits IsCharSetAll IsCharSetunzip3unzipanyall_MX