!uF      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDE SafeDFGHIJKLMDMainly contains useful Template Haskell Lift instances for Date Time(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None1:WG0NUtility methods for Predicate / methods for displaying the evaluation tree ...(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None%&',-.18=>?@AHMPSUVX_`kV'predicate-typed$extract N from the type level to Int)predicate-typed#converts an inductive number to Nat*predicate-typedinductive numbers.predicate-typedget bool from the typelevel0predicate-typedget ordering from the typelevel4predicate-typedgets length of a typelevel list6predicate-typed(get a list of Symbols from the typelevel8predicate-typed%get a list of Nats from the typelevel:predicate-typed typelevel Not;predicate-typed typelevel Or<predicate-typed typelevel And=predicate-typed/helper method to fail with an error if the True>predicate-typedtypelevel Null on Symbol?predicate-typed$makes zero invalid at the type level@predicate-typedtype level BetweenApredicate-typedused by   and N and Oc 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 AFpredicate-typed2convert type level regex option to the value levelHpredicate-typed2extract the regex options from the type level listJpredicate-typed'Regex options for Rescan Resplit Re etcKpredicate-typedForce pattern anchoringLpredicate-typedCompile automatic callouts | Bsr_anycrlf -- R matches only CR, LF, or CrlF | Bsr_unicode -- ^ R matches all Unicode line endingsMpredicate-typedDo caseless matchingNpredicate-typed"dollar not to match newline at endOpredicate-typedmatches anything including NLPpredicate-typed%Allow duplicate names for subpatternsQpredicate-typed Ignore whitespace and # commentsRpredicate-typed,PCRE extra features (not much use currently)Spredicate-typed#Force matching to be before newlineTpredicate-typedcaret and dollar match newlines within data | Newline_any -- ^ Recognize any Unicode newline sequence | Newline_anycrlf -- ^ Recognize CR, LF, and CrlF as newline sequencesUpredicate-typedSet CR as the newline sequenceVpredicate-typed Set CrlF as the newline sequenceWpredicate-typedSet LF as the newline sequenceXpredicate-typed=Disable numbered capturing parentheses (named ones available)Ypredicate-typed Invert greediness of quantifiersZpredicate-typedRun in UTF--8 mode[predicate-typed+Do not check the pattern for UTF-8 validity\predicate-typeddisplay format for the tree]predicate-typeddraw horizontal tree^predicate-typed use unicode_predicate-typedcustomizable optionsapredicate-typedlength of data to display for bpredicate-typed debug levelcpredicate-typed3how to display the tree orientation and unicode etcdpredicate-typedhides one layer of a treeepredicate-typedcolor palette usedgpredicate-typed4the color palette for displaying the expression treejpredicate-typed a monomorphic container of treesopredicate-typed)holds the result of running the predicateppredicate-typed*optional strings to include in the resultsqpredicate-typedMcontains the untyped result from evaluating the expression tree to this pointvpredicate-typedKcontains the typed result from evaluating the expression tree to this point{predicate-typed,describes the evaluation tree for predicates|predicate-typedthe child nodes}predicate-typedthe value at this root node~predicate-typed1detailed information eg input and output and textpredicate-typed,a lens from typed BoolT to the untyped BoolPpredicate-typed&creates a Node for the evaluation treepredicate-typed+creates a Boolean node for a predicate typepredicate-typed/partition a tree into failures and non failurespredicate-typed get the value from BoolT or failpredicate-typed2converts a typed tree to an untyped on for displaypredicate-typed)converts a typed tree into an untyped onepredicate-typed'convenience method to wrap a typed treepredicate-typedsee 2 : add more detail to the tree if there are errorspredicate-typedsee 2 : add less detail to the tree if there are errorspredicate-typedha helper method to add extra context on failure to the tree or extract the value at the root of the treepredicate-typed'skip colors and just return the summarypredicate-typed?skip the detail and just return the summary but keep the colorspredicate-typed skip colorspredicate-typedcolors and detailspredicate-typed>helper method to set the width of data to be shown in the treepredicate-typed$helper method to set the debug levelpredicate-typed6italics dont work but underline does | color palettespredicate-typed6italics dont work but underline does | color palettespredicate-typed6italics dont work but underline does | color palettespredicate-typed6italics dont work but underline does | color palettespredicate-typed6italics dont work but underline does | color palettespredicate-typed$fix PresentT Bool to TrueT or FalseTpredicate-typed+compile a regex using the type level symbolpredicate-typedWextract values from the trees or if there are errors returned a tree with added contextpredicate-typed,extract all root values from a list of treespredicate-typedprism from BoolT to Boolpredicate-typedLapplies a boolean binary operation against the values from two boolean treespredicate-typedget a Nat from the typelevelpredicate-typed"gets the Symbol from the typelevelpredicate-typedEcolors the result of the predicate based on the current color palettewpredicate-typedfailure with stringxpredicate-typedfalse predicateypredicate-typedtrue predicatezpredicate-typednon predicate value    &%$#"!'()*+-,./0123456789:;<=>?@AEDCBFGHIJ[ZYXWVUTSQPONMLKR\^]_`edcbafghijklmnopqustrvzyxw{|~}{|~}vzyxwqustrmnopjklghi_`edcbaf\^]J[ZYXWVUTSQPONMLKRHIFGAEDCB@?>=<;:8967452301./+-,*)'( &%$#"!   9 9 8Dsl for evaluating and displaying type level expressions(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None-.=>?@AHUVXk 4predicate-typed9add a message to give more context to the evaluation tree!pe @(Msg "[somemessage] " Id) 999P [somemessage] Id 999 PresentT 9995predicate-typed0transparent predicate wrapper to make k of kind P6 so it can be in a promoted list (cant mix kinds) see  pl @'[W 123, Id] 99Present [123,99]PresentT [123,99]6predicate-typedGidentity function that also displays the type information for debugging pl @IdT 23 Present 23 PresentT 237predicate-typed1identity function that displays the input unlike 8even more constraints than 81 so we might need to add explicit type signatures pl @Id 23 Present 23 PresentT 238predicate-typedidentity functionpl @I 23 Present 23 PresentT 239predicate-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 predicatesHpredicate-typed(converts the value to the corresponding Qpl @'Proxy 'x' Present ProxyPresentT ProxyIpredicate-typedBextracts the (a,b) from type level 'These a b' if the value exists$pl @('These Id Id) (These 123 "abc")Present (123,"abc")PresentT (123,"abc")%pl @('These Id 5) (These 123 "abcde")Present (123,5)PresentT (123,5)pl @('These Id Id) (This "aaa")Error 'These found ThisFailT "'These found This"pl @('These Id Id) (That "aaa")Error 'These found ThatFailT "'These found That"Jpredicate-typed@extracts the 'b' from type level 'These a b' if the value existspl @('That Id) (That 123) Present 123 PresentT 123pl @('That Id) (This "aaa")Error 'That found ThisFailT "'That found This"pl @('That Id) (These 44 "aaa")Error 'That found TheseFailT "'That found These"Kpredicate-typed@extracts the 'a' from type level 'These a b' if the value existspl @('This Id) (This 123) Present 123 PresentT 123pl @('This Id) (That "aaa")Error 'This found ThatFailT "'This found That" pl @('This Id) (These 999 "aaa")Error 'This found TheseFailT "'This found These"Lpredicate-typedAextracts the 'b' from type level 'Either a b' if the value existspl @('Right Id) (Right 123) Present 123 PresentT 123pl @('Right Id) (Left "aaa")Error 'Right found LeftFailT "'Right found Left"Mpredicate-typedAextracts the 'a' from type level 'Either a b' if the value existspl @('Left Id) (Left 123) Present 123 PresentT 123pl @('Left Id) (Right "aaa")Error 'Left found RightFailT "'Left found Right"Npredicate-typedexpects Nothing otherwise it fails if the value is Nothing then it returns 'Proxy a' as this provides more information than '()'pl @'Nothing Nothing Present ProxyPresentT Proxypl @'Nothing (Just True)Error 'Nothing found JustFailT "'Nothing found Just"Opredicate-typed>extracts the 'a' from type level 'Maybe a' if the value existspl @('Just Id) (Just 123) Present 123 PresentT 123pl @('Just Id) (Just True) Present True PresentT Truepl @('Just Id) NothingError 'Just found NothingFailT "'Just found Nothing"Qpredicate-typed2runs each predicate in turn from the promoted listpl @'[1, 2, 3] 999Present [1,2,3]PresentT [1,2,3]pl @'[W 1, W 2, W 3, Id] 999Present [1,2,3,999]PresentT [1,2,3,999]Rpredicate-typed=extracts the value level representation of the type level '[] pl @'[] False Present [] PresentT []Spredicate-typed=extracts the value level representation of the type level '() pl @'() () Present () PresentT ()Tpredicate-typed:extracts the value level representation of the type level R pl @123 () Present 123 PresentT 123Upredicate-typed8extracts the value level representation of the promoted Spl @'LT "not used" Present LT PresentT LT pl @'EQ () Present EQ PresentT EQVpredicate-typed(run the predicates in a promoted 4-tuple pl @'(4, Id, "inj", 999) "hello"Present (4,"hello","inj",999)PresentT (4,"hello","inj",999)Wpredicate-typed(run the predicates in a promoted 3-tuplepl @'(4, Id, "goodbye") "hello"Present (4,"hello","goodbye")PresentT (4,"hello","goodbye")Xpredicate-typed5run the predicates in a promoted 2-tuple; similar to pl @'(Id, 4) "hello"Present ("hello",4)PresentT ("hello",4)Ypredicate-typedpulls the type level T to the value levelpl @"hello world" ()Present "hello world"PresentT "hello world"Zpredicate-typedpulls the type level U to the value levelpl @'True "ignore this"TrueTrueT pl @'False ()FalseFalseT\predicate-typedV () function pl @() "Asf" Present () PresentT ();predicate-typedreturns a tree of results456789;:<=>?@ABCDEFG9;:<87654=>@AE?BCDFG8Dsl for evaluating and displaying type level expressions(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None %&',-.=>?@AHPSUVX_k+bpredicate-typed leverages f for repeating predicates (passthrough method) same as 'DoN n p' == 'FoldN n p Id' but more efficientpl @(DoN 4 (Succ Id)) 'c' Present 'g' PresentT 'g'pl @(DoN 4 (Id <> " | ")) "abc"Present "abc | | | | "PresentT "abc | | | | "#pl @(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"cpredicate-typedccreates a promoted list of predicates and then evaluates them into a list. see PP instance for '[k]pl @(Repeat 4 (Succ Id)) 'c'Present "dddd"PresentT "dddd"pl @(Repeat 4 "abc") ()!Present ["abc","abc","abc","abc"]"PresentT ["abc","abc","abc","abc"]fpredicate-typed leverages . for repeating predicates (passthrough method)dpl @(GuardsN (Printf2 "id=%d must be between 0 and 255, found %d") 4 (Between 0 255)) [121,33,7,256]/Error id=4 must be between 0 and 255, found 2561FailT "id=4 must be between 0 and 255, found 256"cpl @(GuardsN (Printf2 "id=%d must be between 0 and 255, found %d") 4 (Between 0 255)) [121,33,7,44]Present [121,33,7,44]PresentT [121,33,7,44]ipredicate-typed leverages . for repeating predicates (passthrough method)(pl @(ParaNImpl 'True 4 (Succ Id)) [1..4]Present [2,3,4,5]PresentT [2,3,4,5]"pl @(ParaNLax 4 (Succ Id)) "azwxm"Present "b{xy"PresentT "b{xy"pl @(ParaN 4 (Succ Id)) "azwxm"-Error Para: data elements(5) /= predicates(4)/FailT "Para: data elements(5) /= predicates(4)"pl @(ParaN 4 (Succ Id)) "azwx"Present "b{xy"PresentT "b{xy"lpredicate-typed similar to  /pl @(StripLeft "xyz" Id) ("xyzHello" :: String)Present Just "Hello"PresentT (Just "Hello")import Data.Text (Text)-pl @(StripLeft "xyz" Id) ("xyzHello" :: Text)Present Just "Hello"PresentT (Just "Hello")#pl @(StripLeft "xyz" Id) "xywHello"Present NothingPresentT Nothing%pl @(StripRight "xyz" Id) "Hello xyz"Present Just "Hello "PresentT (Just "Hello ")'pl @(StripRight "xyz" Id) "xyzHelloxyw"Present NothingPresentT Nothingpl @(StripRight "xyz" Id) ""Present NothingPresentT Nothingpl @(StripRight "xyz" "xyz") ()Present Just ""PresentT (Just "")ppredicate-typed similar to   ,pl @(Trim (Snd Id)) (20," abc " :: String) Present "abc"PresentT "abc"import Data.Text (Text)*pl @(Trim (Snd Id)) (20," abc " :: Text) Present "abc"PresentT "abc"'pl @(TrimStart (Snd Id)) (20," abc ")Present "abc "PresentT "abc "%pl @(TrimEnd (Snd Id)) (20," abc ")Present " abc"PresentT " abc"pl @(TrimEnd " abc ") ()Present " abc"PresentT " abc"pl @(TrimEnd "") () Present "" PresentT ""pl @(Trim " ") () Present "" PresentT ""pl @(Trim "") () Present "" PresentT ""tpredicate-typed similar to pl @Join (Just (Just 20))Present Just 20PresentT (Just 20)pl @Join ["ab","cd","","ef"]Present "abcdef"PresentT "abcdef"upredicate-typed similar to Wpl @Duplicate (20,"abc")Present (20,(20,"abc"))PresentT (20,(20,"abc"))vpredicate-typed similar to Xpl @Extract (Nothing,Just 20)Present Just 20PresentT (Just 20)pl @Extract (Identity 20) Present 20 PresentT 20wpredicate-typed similar to Y)pl @(Fst Id <|> Snd Id) (Nothing,Just 20)Present Just 20PresentT (Just 20))pl @(Fst Id <|> Snd Id) (Just 10,Just 20)Present Just 10PresentT (Just 10))pl @(Fst Id <|> Snd Id) (Nothing,Nothing)Present NothingPresentT Nothingxpredicate-typed similar to Z+pl @(Fst Id <* Snd Id) (Just "abc",Just 20)Present Just "abc"PresentT (Just "abc")zpredicate-typed similar to [&pl @(Fst Id <$ Snd Id) ("abc",Just 20)Present Just "abc"PresentT (Just "abc")~predicate-typedprint a 3-tuple6pl @(Printf3 "fst=%s snd=%03d thd=%s") ("ab",123,"xx")Present "fst=ab snd=123 thd=xx" PresentT "fst=ab snd=123 thd=xx"predicate-typedprint a 2-tuple*pl @(Printf2 "fst=%s snd=%03d") ("ab",123)Present "fst=ab snd=123"PresentT "fst=ab snd=123"predicate-typed!Printfn prints an inductive tuple+pl @(Printfn "%s %s" Id) ("123",("def",()))Present "123 def"PresentT "123 def".pl @(Printfn "s=%s d=%03d" Id) ("ab",(123,()))Present "s=ab d=123"PresentT "s=ab d=123"predicate-typedreverses inductive tuples-pl @ReverseTupleN (1,('a',(True,("def",()))))#Present ("def",(True,('a',(1,()))))$PresentT ("def",(True,('a',(1,()))))pl @ReverseTupleN (1,('a',()))Present ('a',(1,()))PresentT ('a',(1,()))pl @ReverseTupleN (999,())Present (999,())PresentT (999,())predicate-typed similar to \$pl @(Fst Id <> Snd Id) ("abc","def")Present "abcdef"PresentT "abcdef" pl @("abcd" <> "ef" <> Id) "ghi"Present "abcdefghi"PresentT "abcdefghi"predicate-typed] ^ _ equivalents pl @(IsInfixI "abc" "axAbCd") ()TrueTrueT!pl @(IsPrefixI "abc" "aBcbCd") ()TrueTrueT pl @(IsPrefix "abc" "aBcbCd") ()FalseFalseT pl @(IsSuffix "bCd" "aBcbCd") ()TrueTrueTprefix infix suffix for stringspredicate-typeddoes the directory existspl @(DirExists ".") ()TrueTrueTpredicate-typeddoes the directory existspl @(DirExists ".") ()TrueTrueTpredicate-typed similar to `4pl @(ReadFile ".ghci" >> 'Just Id >> Len >> Gt 0) ()TrueTrueTpl @(FileExists "xyzzy") ()FalseFalseTpredicate-typed similar to a(pl @Sequence [Just 10, Just 20, Just 30]Present Just [10,20,30]PresentT (Just [10,20,30]):pl @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 epl @(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"pl @(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"pl @(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"pl @(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-typedruns values in parallel unlike )pl @(Para '[Id,Id + 1,Id * 4]) [10,20,30]Present [10,21,120]PresentT [10,21,120]predicate-typeduses Printf to format outputpl @(Printf "value=%03d" Id) 12Present "value=012"PresentT "value=012"Usplits string into pieces before "%" that way we have a chance of catching any errorspredicate-typed Intercalate;pl @(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"]predicate-typed$change associativity of nested pairspl @AssocL (99,('a',True))Present ((99,'a'),True)PresentT ((99,'a'),True)pl @AssocR ((99,'a'),True)Present (99,('a',True))PresentT (99,('a',True))predicate-typed-Display a number at base 2 to 36, similar to b but supports signed numberspl @(ShowBase 16) 4077 Present "fed"PresentT "fed"pl @(ShowBase 16) (-255) Present "-ff"PresentT "-ff"pl @(ShowBase 2) 147Present "10010011"PresentT "10010011")pl @(ShowBase' 2 (Negate 147)) "whatever"Present "-10010011"PresentT "-10010011"predicate-typedRead a number base 2 via 36pl @(ReadBase Int 16) "00feD" Present 4077 PresentT 4077pl @(ReadBase Int 16) "-ff" Present -255PresentT (-255)pl @(ReadBase Int 2) "10010011" Present 147 PresentT 147(supports negative numbers unlike readIntpredicate-typed"Luhn predicate check on last digitpl @(Luhn Id) [1,2,3,0]TrueTrueTpl @(Luhn Id) [1,2,3,4]FalseFalseTpredicate-typedGZip two lists optionally cycling the one of the lists to match the size-pl @(Ziplc (Fst Id) (Snd Id)) ("abc", [1..5])1Present [('a',1),('b',2),('c',3),('a',4),('b',5)]2PresentT [('a',1),('b',2),('c',3),('a',4),('b',5)]1pl @(Ziplc (Fst Id) (Snd Id)) ("abcdefg", [1..5])1Present [('a',1),('b',2),('c',3),('d',4),('e',5)]2PresentT [('a',1),('b',2),('c',3),('d',4),('e',5)]1pl @(Ziprc (Fst Id) (Snd Id)) ("abcdefg", [1..5])APresent [('a',1),('b',2),('c',3),('d',4),('e',5),('f',1),('g',2)]BPresentT [('a',1),('b',2),('c',3),('d',4),('e',5),('f',1),('g',2)]predicate-typed similar to  thats pads with c or d& if one list is shorter than the other>the key is that all information about both lists are preserved0pl @(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]3pl @(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']predicate-typed.extracts the first character from a non empty Tpl @(Char1 "aBc") () Present 'a' PresentT 'a'predicate-typed creates a singleton from a value pl @(Singleton (Char1 "aBc")) () Present "a" PresentT "a"pl @(Singleton Id) FalsePresent [False]PresentT [False](pl @(Singleton (Snd Id)) (False,"hello")Present ["hello"]PresentT ["hello"]predicate-typed'creates an empty list of the given typepl @(Id :+ EmptyList _) 99 Present [99] PresentT [99]predicate-typed similar to e9pl @(TheseIn Id Len (Fst Id + Length (Snd Id))) (This 13) Present 13 PresentT 13Npl @(TheseIn Id Len (Fst Id + Length (Snd Id))) (That "this is a long string") Present 21 PresentT 21Epl @(TheseIn Id Len (Fst Id + Length (Snd Id))) (These 20 "somedata") Present 28 PresentT 28pl @(TheseIn (Left _) (Right _) (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")pl @(TheseIn (Left _) (Right _) (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")pl @(TheseIn (Left _) (Right _) (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 fpl @(IsThis Id) (This "aBc")TrueTrueTpl @(IsThis Id) (These 1 'a')FalseFalseTpl @(IsThese Id) (These 1 'a')TrueTrueTpredicate-typed similar to g"pl @(ToList' Id) ("aBc" :: String) Present "aBc"PresentT "aBc"pl @(ToList' Id) (Just 14) Present [14] PresentT [14]pl @(ToList' Id) Nothing Present [] PresentT []pl @(ToList' Id) (Left "xx") Present [] PresentT [] pl @(ToList' Id) (These 12 "xx")Present ["xx"]PresentT ["xx"]predicate-typed similar to gpl @ToList ("aBc" :: String) Present "aBc"PresentT "aBc"pl @ToList (Just 14) Present [14] PresentT [14]pl @ToList Nothing Present [] PresentT []pl @ToList (Left "xx") Present [] PresentT []pl @ToList (These 12 "xx")Present ["xx"]PresentT ["xx"]predicate-typed similar to h!pl @(IToList _) ("aBc" :: String)!Present [(0,'a'),(1,'B'),(2,'c')]"PresentT [(0,'a'),(1,'B'),(2,'c')]predicate-typed!compare two strings ignoring case&pl @(Fst Id ===? Snd Id) ("abC","aBc") Present EQ PresentT EQ'pl @(Fst Id ===? Snd Id) ("abC","DaBc") Present LT PresentT LTpredicate-typed similar to ipl @(Fst Id === Snd Id) (10,9) Present GT PresentT GT)pl @(14 % 3 === Fst Id %- Snd Id) (-10,7) Present GT PresentT GTpl @(Fst Id === Snd Id) (10,11) Present LT PresentT LTEpl @(Snd Id === (Fst Id >> Snd Id >> Head' Id)) (('x',[10,12,13]),10) Present EQ PresentT EQ;pl @(Snd Id === Head' (Snd (Fst Id))) (('x',[10,12,13]),10) Present EQ PresentT EQpredicate-typed implication<pl @(Fst Id ~> (Snd Id >> Len >> Ge 4)) (True,[11,12,13,14])TrueTrueTApl @(Fst Id ~> (Snd Id >> Len >> Same 4)) (True,[12,11,12,13,14])FalseFalseTBpl @(Fst Id ~> (Snd Id >> Len >> Same 4)) (False,[12,11,12,13,14])TrueTrueT=pl @(Fst Id ~> (Snd Id >> Len >> Ge 4)) (False,[11,12,13,14])TrueTrueTpredicate-typed similar to j=pl @(Fst Id || (Snd Id >> Len >> Ge 4)) (False,[11,12,13,14])TrueTrueTIpl @((Not (Fst Id)) || (Snd Id >> Len >> Same 4)) (True,[12,11,12,13,14])FalseFalseTpredicate-typed similar to k<pl @(Fst Id && (Snd Id >> Len >> Ge 4)) (True,[11,12,13,14])TrueTrueTApl @(Fst Id && (Snd Id >> Len >> Same 4)) (True,[12,11,12,13,14])FalseFalseTpredicate-typed"This is composition for predicates,pl @(Fst Id >> Succ (Id !! 0)) ([11,12],'x') Present 12 PresentT 12>pl @(Len *** Succ Id >> ShowP (First (Pred Id))) ([11,12],'x')Present "(1,'y')"PresentT "(1,'y')"predicate-typedjust run the effect but skip the value for example for use with Stdout so it doesnt interfere with the 'a' on the rhs unless there is an errorpredicate-typed similar to M but uses the root message of the False predicate case as the failure message"pl @(GuardSimple (Luhn Id)) [1..4]1Error Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4]3FailT "Luhn map=[4,6,2,2] sum=14 ret=4 | [1,2,3,4]"%pl @(GuardSimple (Luhn Id)) [1,2,3,0]Present [1,2,3,0]PresentT [1,2,3,0]&pl @(GuardSimple (Len > 30)) [1,2,3,0] Error 4 > 30FailT "4 > 30"predicate-typed?'p' is the predicate and on failure of the predicate runs 'prt'$pl @(Guard "expected > 3" (Gt 3)) 17 Present 17 PresentT 17#pl @(Guard "expected > 3" (Gt 3)) 1Error expected > 3FailT "expected > 3"1pl @(Guard (Printf "%d not > 3" Id) (Gt 3)) (-99)Error -99 not > 3FailT "-99 not > 3"predicate-typedGuards contain a type level list of tuples the action to run on failure of the predicate and the predicate itself Each tuple validating against the corresponding value in a value listGpl @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 4)]) [17,4]Present [17,4]PresentT [17,4]Gpl @(Guards '[ '("arg1 failed",Gt 4), '("arg2 failed", Same 5)]) [17,4]Error arg2 failedFailT "arg2 failed"Hpl @(Guards '[ '("arg1 failed",Gt 99), '("arg2 failed", Same 4)]) [17,4]Error arg1 failedFailT "arg1 failed"apl @(Guards '[ '(Printf2 "arg %d failed with value %d",Gt 4), '(Printf2 "%d %d", Same 4)]) [17,3] Error 2 3 FailT "2 3"Xpl @(GuardsQuick (Printf2 "arg %d failed with value %d") '[Gt 4, Ge 3, Same 4]) [17,3,5]Error arg 3 failed with value 5!FailT "arg 3 failed with value 5"[pl @(GuardsQuick (Printf2 "arg %d failed with value %d") '[Gt 4, Ge 3, Same 4]) [17,3,5,99]/Error Guards: data elements(4) /= predicates(3)1FailT "Guards: data elements(4) /= predicates(3)" predicate-typed similar to l&pl @(QuotRem (Fst Id) (Snd Id)) (10,3) Present (3,1)PresentT (3,1)'pl @(QuotRem (Fst Id) (Snd Id)) (10,-3)Present (-3,1)PresentT (-3,1)(pl @(QuotRem (Fst Id) (Snd Id)) (-10,-3)Present (3,-1)PresentT (3,-1)'pl @(QuotRem (Fst Id) (Snd Id)) (-10,3)Present (-3,-1)PresentT (-3,-1)&pl @(QuotRem (Fst Id) (Snd Id)) (10,0)Error QuotRem zero denominator FailT "QuotRem zero denominator" predicate-typed similar to m%pl @(DivMod (Fst Id) (Snd Id)) (10,3) Present (3,1)PresentT (3,1)&pl @(DivMod (Fst Id) (Snd Id)) (10,-3)Present (-4,-2)PresentT (-4,-2)&pl @(DivMod (Fst Id) (Snd Id)) (-10,3)Present (-4,2)PresentT (-4,2)'pl @(DivMod (Fst Id) (Snd Id)) (-10,-3)Present (3,-1)PresentT (3,-1)%pl @(DivMod (Fst Id) (Snd Id)) (10,0)Error DivMod zero denominatorFailT "DivMod zero denominator" predicate-typed similar to n"pl @(Mod (Fst Id) (Snd Id)) (10,3) Present 1 PresentT 1"pl @(Mod (Fst Id) (Snd Id)) (10,0)Error Mod zero denominatorFailT "Mod zero denominator" predicate-typed similar to o"pl @(Div (Fst Id) (Snd Id)) (10,4) Present 2 PresentT 2"pl @(Div (Fst Id) (Snd Id)) (10,0)Error Div zero denominatorFailT "Div zero denominator"predicate-typedcatch a failurePpl @(Catch (Succ Id) (Fst Id >> Second (ShowP Id) >> Printf2 "%s %s" >> 'LT)) GT Present LT PresentT LT@pl @(Catch' (Succ Id) (Second (ShowP Id) >> Printf2 "%s %s")) GT;Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument GT=FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument GT"@pl @(Catch' (Succ Id) (Second (ShowP Id) >> Printf2 "%s %s")) 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+pl @(Failt Int (Printf "value=%03d" Id)) 99Error value=099FailT "value=099"<pl @(FailS (Printf2 "value=%03d string=%s")) (99,"somedata")Error value=099 string=somedata!FailT "value=099 string=somedata"predicate-typed similar to p(pl @(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])(pl @(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 q,pl @(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])0pl @(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]).pl @(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])0pl @(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 elementspl @Pairs [1,2,3,4]Present [(1,2),(2,3),(3,4)]PresentT [(1,2),(2,3),(3,4)] pl @Pairs []Error Pairs no data foundFailT "Pairs no data found" pl @Pairs [1]"Error Pairs only one element found$FailT "Pairs only one element found"#predicate-typedif p then run q else run r>pl @(If (Gt 4) "greater than 4" "less than or equal to 4" ) 10Present "greater than 4"PresentT "greater than 4"<pl @(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 rpl @(Map (Pred Id) Id) [1..5]Present [0,1,2,3,4]PresentT [0,1,2,3,4]+predicate-typed similar to s:pl @(Unfoldr (MaybeB (Not Null) (SplitAt 2 Id)) Id) [1..5]Present [[1,2],[3,4],[5]]PresentT [[1,2],[3,4],[5]]pl @(IterateN 4 (Succ Id)) 4Present [4,5,6,7]PresentT [4,5,6,7]1predicate-typed similar to t>pl @(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]]pl @(ScanN 4 Id (Succ Id)) 'c'Present "cdefg"PresentT "cdefg"pl @(FoldN 4 Id (Succ Id)) 'c' Present 'g' PresentT 'g'5predicate-typed similar to u,. returns a 3-tuple with the results so use < 7 2 to extractZpl @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)])6predicate-typed similar to vApl @PartitionEithers [Left 'a',Right 2,Left 'c',Right 4,Right 99]Present ("ac",[2,4,99])PresentT ("ac",[2,4,99])9predicate-typed similar to wpl @(EnumFromTo 2 5) ()Present [2,3,4,5]PresentT [2,3,4,5]pl @(EnumFromTo LT GT) ()Present [LT,EQ,GT]PresentT [LT,EQ,GT]:predicate-typed similar to x using ypl @Null [1,2,3,4]FalseFalseT pl @Null []TrueTrueT;predicate-typed similar to x using zpl @IsEmpty [1,2,3,4]FalseFalseTpl @IsEmpty []TrueTrueTpl @IsEmpty LTFalseFalseTpl @IsEmpty EQTrueTrueT<predicate-typed{pl @Unsnoc [1,2,3,4]Present Just ([1,2,3],4)PresentT (Just ([1,2,3],4)) pl @Unsnoc []Present NothingPresentT Nothing=predicate-typed|pl @Uncons [1,2,3,4]Present Just (1,[2,3,4])PresentT (Just (1,[2,3,4])) pl @Uncons []Present NothingPresentT Nothing>predicate-typedsimilar to snoc%pl @(Snd Id +: Fst Id) (99,[1,2,3,4])Present [1,2,3,4,99]PresentT [1,2,3,4,99]pl @(Fst Id +: Snd Id) ([],5) Present [5] PresentT [5]pl @(EmptyT [] Id +: 5) 5 Present [5] PresentT [5]?predicate-typedsimilar to cons%pl @(Fst Id :+ Snd Id) (99,[1,2,3,4])Present [99,1,2,3,4]PresentT [99,1,2,3,4]pl @(Snd Id :+ Fst Id) ([],5) Present [5] PresentT [5]$pl @(123 :+ EmptyList _) "somestuff" Present [123]PresentT [123]Apredicate-typed pl @(Ors Id) [False,False,False]FalseFalseT#pl @(Ors Id) [True,True,True,False]TrueTrueTpl @(Ors Id) []FalseFalseTCpredicate-typedpl @(Ands Id) [True,True,True]TrueTrueT$pl @(Ands Id) [True,True,True,False]FalseFalseTpl @(Ands Id) []TrueTrueTFpredicate-typed} leveraging ~%import qualified Data.Map.Strict as M&pl @(Id !!! 2) ["abc","D","eF","","G"] Present "eF" PresentT "eF"'pl @(Id !!! 20) ["abc","D","eF","","G"]Error index not foundFailT "index not found"Gpl @(Id !!! "eF") (M.fromList (flip zip [0..] ["abc","D","eF","","G"])) Present 2 PresentT 2)pl @(Lookup Id 2) ["abc","D","eF","","G"]Present Just "eF"PresentT (Just "eF")*pl @(Lookup Id 20) ["abc","D","eF","","G"]Present NothingPresentT NothingHpredicate-typed similar to  leveraging ~%import qualified Data.Map.Strict as M%pl @(Id !! 2) ["abc","D","eF","","G"] Present "eF" PresentT "eF"&pl @(Id !! 20) ["abc","D","eF","","G"]Error (!!) index not foundFailT "(!!) index not found"Fpl @(Id !! "eF") (M.fromList (flip zip [0..] ["abc","D","eF","","G"])) Present 2 PresentT 2Jpredicate-typed similar to .pl @(Ix 4 "not found") ["abc","D","eF","","G"] Present "G" PresentT "G"/pl @(Ix 40 "not found") ["abc","D","eF","","G"]Present "not found"PresentT "not found"Mpredicate-typed similar to 'pl @(Concat Id) ["abc","D","eF","","G"]Present "abcDeFG"PresentT "abcDeFG"3pl @(Concat (Snd Id)) ('x',["abc","D","eF","","G"])Present "abcDeFG"PresentT "abcDeFG"Ppredicate-typedsimilar to a limited form of 'pl @(FoldMap (SG.Sum _) Id) [44, 12, 3] Present 59 PresentT 59+pl @(FoldMap (SG.Product _) Id) [44, 12, 3] Present 1584 PresentT 1584Qpredicate-typed similar to 1pl @(MConcat Id) [SG.Sum 44, SG.Sum 12, SG.Sum 3]Present Sum {getSum = 59}PresentT (Sum {getSum = 59})Rpredicate-typedf constructor(pl @(MkThese (Fst Id) (Snd Id)) (44,'x')Present These 44 'x'PresentT (These 44 'x')Tpredicate-typedd constructorpl @(MkThat _ Id) 44Present That 44PresentT (That 44)Vpredicate-typedc constructorpl @(MkThis _ Id) 44Present This 44PresentT (This 44)Xpredicate-typed constructorpl @(MkRight _ Id) 44Present Right 44PresentT (Right 44)Zpredicate-typed constructorpl @(MkLeft _ Id) 44Present Left 44PresentT (Left 44)[predicate-typed constructorpl @(MkJust Id) 44Present Just 44PresentT (Just 44)^predicate-typed similar to pl @(EmptyT Maybe Id) ()Present NothingPresentT Nothingpl @(EmptyT [] Id) () Present [] PresentT []%pl @(EmptyT [] (Char1 "x")) (13,True) Present "" PresentT ""/pl @(EmptyT (Either String) (Fst Id)) (13,True)Present Left ""PresentT (Left "")bpredicate-typed similar to pl @(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!dpredicate-typed similar to pl @(Pure Maybe Id) 4Present Just 4PresentT (Just 4)pl @(Pure [] Id) 4 Present [4] PresentT [4]-pl @(Pure (Either String) (Fst Id)) (13,True)Present Right 13PresentT (Right 13)epredicate-typed similar to pl @(STimes 4 Id) (SG.Sum 3)Present Sum {getSum = 12}PresentT (Sum {getSum = 12})pl @(STimes 4 Id) "ab"Present "abababab"PresentT "abababab"hpredicate-typed similar to  similar to sW but provides a Proxy to the result of 'q' and does not provide the surrounding context8pl @(MaybeIn "foundnothing" (ShowP (Pred Id))) (Just 20) Present "19" PresentT "19"7pl @(MaybeIn "found nothing" (ShowP (Pred Id))) NothingPresent "found nothing"PresentT "found nothing"jpredicate-typed similar to  but additionally provides 'p', '\q'= and 'r' the original input as the first element in the tuplehpl @(TheseX (((Fst Id >> Fst Id) + Snd Id) >> ShowP Id) (ShowP Id) (Snd (Snd Id)) (Snd Id)) (9,This 123) Present "132"PresentT "132"Lpl @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (This 123)Present (123,"fromthis")PresentT (123,"fromthis")Spl @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (That "fromthat")Present (-99,"fromthat")PresentT (-99,"fromthat")Ypl @(TheseX '(Snd Id,"fromthis") '(Negate 99,Snd Id) (Snd Id) Id) (These 123 "fromthese")Present (123,"fromthese")PresentT (123,"fromthese")lpredicate-typed similar to 6 but additionally gives 'p' and 'q' the original inputNpl @(EitherX (ShowP (Fst (Fst Id) + Snd Id)) (ShowP Id) (Snd Id)) (9,Left 123) Present "132"PresentT "132"Opl @(EitherX (ShowP (Fst (Fst Id) + Snd Id)) (ShowP Id) (Snd Id)) (9,Right 'x')Present "((9,Right 'x'),'x')"PresentT "((9,Right 'x'),'x')"Jpl @(EitherX (ShowP Id) (ShowP (Second (Succ Id))) (Snd Id)) (9,Right 'x')Present "((9,Right 'x'),'y')"PresentT "((9,Right 'x'),'y')"ppredicate-typed&similar to either (const Nothing) Justpl @RightToMaybe (Right 13)Present Just 13PresentT (Just 13)pl @RightToMaybe (Left 13)Present NothingPresentT Nothingqpredicate-typed&similar to either Just (const Nothing)pl @LeftToMaybe (Left 13)Present Just 13PresentT (Just 13)pl @LeftToMaybe (Right 13)Present NothingPresentT Nothingpredicate-typedsimilar to fmap sndpl @Fmap_2 (Just ("asf",13))Present Just 13PresentT (Just 13)predicate-typedsimilar to fmap fstpl @Fmap_1 (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+pl @(Elem (Fst Id) (Snd Id)) ('x',"abcdxy")TrueTrueT+pl @(Elem (Fst Id) (Snd Id)) ('z',"abcdxy")FalseFalseTpredicate-typed<filters a list 'q' keeping or removing those elements in 'p'!pl @(Keep '[5] '[1,5,5,2,5,2]) ()Present [5,5,5]PresentT [5,5,5]'pl @(Keep '[0,1,1,5] '[1,5,5,2,5,2]) ()Present [1,5,5,5]PresentT [1,5,5,5]#pl @(Remove '[5] '[1,5,5,2,5,2]) ()Present [1,2,2]PresentT [1,2,2])pl @(Remove '[0,1,1,5] '[1,5,5,2,5,2]) () Present [2,2]PresentT [2,2]$pl @(Remove '[99] '[1,5,5,2,5,2]) ()Present [1,5,5,2,5,2]PresentT [1,5,5,2,5,2]'pl @(Remove '[99,91] '[1,5,5,2,5,2]) ()Present [1,5,5,2,5,2]PresentT [1,5,5,2,5,2]!pl @(Remove Id '[1,5,5,2,5,2]) []Present [1,5,5,2,5,2]PresentT [1,5,5,2,5,2]Fpl @(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-typed functionpl @(Not Id) FalseTrueTrueTpl @(Not Id) TrueFalseFalseTpl @(Not (Fst Id)) (True,22)FalseFalseTpredicate-typeda predicate on prime numberspl @(Prime Id) 2TrueTrueT#pl @(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  functionpl @(ToEnumB Ordering LT) 2 Present GT PresentT GTpl @(ToEnumB Ordering LT) 6 Present LT PresentT LTpl @(ToEnumBF Ordering) 6Error ToEnum bounded failedFailT "ToEnum bounded failed"predicate-typedunsafe  functionpl @(ToEnum Char Id) 120 Present 'x' PresentT 'x'predicate-typed functionpl @(FromEnum Id) 'x' Present 120 PresentT 120predicate-typed unbounded  functionpl @(Pred Id) 13 Present 12 PresentT 12pl @(Pred Id) LT8Error Pred IO e=Prelude.Enum.Ordering.pred: bad argument:FailT "Pred IO e=Prelude.Enum.Ordering.pred: bad argument"predicate-typed unbounded  functionpl @(Succ Id) 13 Present 14 PresentT 14pl @(Succ Id) LT Present EQ PresentT EQpl @(Succ Id) GT8Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument:FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument"predicate-typedbounded  functionpl @(PredB' Id) (13 :: Int) Present 12 PresentT 12pl @(PredB' Id) LTError Pred bounded failedFailT "Pred bounded failed"predicate-typedbounded  functionpl @(SuccB' Id) (13 :: Int) Present 14 PresentT 14pl @(SuccB' Id) LT Present EQ PresentT EQpl @(SuccB 'LT Id) GT Present LT PresentT LTpl @(SuccB' Id) GTError Succ bounded failedFailT "Succ bounded failed"predicate-typed swaps using pl @Swap (Left 123)Present Right 123PresentT (Right 123)pl @Swap (Right 123)Present Left 123PresentT (Left 123)pl @Swap (These 'x' 123)Present These 123 'x'PresentT (These 123 'x')pl @Swap (This 'x')Present That 'x'PresentT (That 'x')pl @Swap (That 123)Present This 123PresentT (This 123)pl @Swap (123,'x')Present ('x',123)PresentT ('x',123)pl @Swap (Left "abc")Present Right "abc"PresentT (Right "abc")pl @Swap (Right 123)Present Left 123PresentT (Left 123)predicate-typedreverses using import Data.Text (Text)pl @ReverseL ("AbcDeF" :: Text)Present "FeDcbA"PresentT "FeDcbA"!pl @ReverseL ("AbcDeF" :: String)Present "FeDcbA"PresentT "FeDcbA"predicate-typed similar to pl @Reverse [1,2,4]Present [4,2,1]PresentT [4,2,1]pl @Reverse "AbcDeF"Present "FeDcbA"PresentT "FeDcbA"predicate-typedlift pure over a Functor#pl @(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 FunctorIpl @(MEmptyT2 (SG.Product Int)) [Identity (-13), Identity 4, Identity 99]TPresent [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}]UPresentT [Product {getProduct = 1},Product {getProduct = 1},Product {getProduct = 1}]predicate-typedsee : coerce over a functorHpl @(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}]6pl @(Coerce2 (SG.Sum Integer)) (Just (Identity (-13)))!Present Just (Sum {getSum = -13})$PresentT (Just (Sum {getSum = -13}))4pl @(Coerce2 (SG.Sum Int)) (Nothing @(Identity Int))Present NothingPresentT Nothingpredicate-typed similar to .pl @(Coerce (SG.Sum Integer)) (Identity (-13))Present Sum {getSum = -13}PresentT (Sum {getSum = -13})predicate-typedwraps a value (see  and ):m + Data.List.NonEmptypl @(Wrap (SG.Sum _) Id) (-13)Present Sum {getSum = -13}PresentT (Sum {getSum = -13})pl @(Wrap SG.Any (Ge 4)) 13Present Any {getAny = True}PresentT (Any {getAny = True})3pl @(Wrap (NonEmpty _) (Uncons >> 'Just Id)) "abcd"Present 'a' :| "bcd"PresentT ('a' :| "bcd")predicate-typedunwraps a value (see )pl @(Unwrap Id) (SG.Sum (-13)) Present -13PresentT (-13)predicate-typed similar to pl @(Signum Id) (-14) Present -1 PresentT (-1)pl @(Signum Id) 14 Present 1 PresentT 1pl @(Signum Id) 0 Present 0 PresentT 0predicate-typed similar to pl @(Abs Id) (-14) Present 14 PresentT 14pl @(Abs (Snd Id)) ("xx",14) Present 14 PresentT 14pl @(Abs Id) 0 Present 0 PresentT 0pl @(Abs (Negate 44)) "aaa" Present 44 PresentT 44predicate-typed similar to pl @(Negate Id) 14 Present -14PresentT (-14)%pl @(Negate (Fst Id * Snd Id)) (14,3) Present -42PresentT (-42)pl @(Negate (15 %- 4)) "abc"Present 15 % 4PresentT (15 % 4)pl @(Negate (15 % 3)) ()Present (-5) % 1PresentT ((-5) % 1)%pl @(Negate (Fst Id % Snd Id)) (14,3)Present (-14) % 3PresentT ((-14) % 3)predicate-typed creates a  valuepl @(Id < 21 % 5) (-3.1)TrueTrueTpl @(Id < 21 % 5) 4.5FalseFalseTpl @(Fst Id % Snd Id) (13,2)Present 13 % 2PresentT (13 % 2)pl @(13 % Id) 0Error MkRatio zero denominator FailT "MkRatio zero denominator"pl @(4 % 3 + 5 % 7) "asfd"Present 43 % 21PresentT (43 % 21)pl @(4 %- 7 * 5 %- 3) "asfd"Present 20 % 21PresentT (20 % 21)pl @(Negate (14 % 3)) ()Present (-14) % 3PresentT ((-14) % 3)pl @(14 % 3) ()Present 14 % 3PresentT (14 % 3)6pl @(Negate (14 % 3) === FromIntegral _ (Negate 5)) () Present GT PresentT GTpl @(14 -% 3 === 5 %- 1) "aa" Present GT PresentT GT)pl @(Negate (14 % 3) === Negate 5 % 2) () Present LT PresentT LTpl @(14 -% 3 * 5 -% 1) ()Present 70 % 3PresentT (70 % 3)pl @(14 % 3 === 5 % 1) () Present LT PresentT LTpl @(15 % 3 / 4 % 2) () Present 5 % 2PresentT (5 % 2)predicate-typedfractional divisionpl @(Fst Id / Snd Id) (13,2) Present 6.5 PresentT 6.5pl @(ToRational 13 / Id) 0Error DivF zero denominatorFailT "DivF zero denominator"predicate-typed(addition, multiplication and subtractionpl @(Fst Id * Snd Id) (13,5) Present 65 PresentT 652pl @(Fst Id + 4 * (Snd Id >> Len) - 4) (3,"hello") Present 19 PresentT 19predicate-typedsimilar pl @(Pred Id +++ Id) (Left 13)Present Left 12PresentT (Left 12)*pl @(ShowP Id +++ Reverse) (Right "hello")Present Right "olleh"PresentT (Right "olleh")predicate-typedsimilar pl @(Pred Id ||| Id) (Left 13) Present 12 PresentT 12%pl @(ShowP Id ||| Id) (Right "hello")Present "hello"PresentT "hello"predicate-typed similar to %pl @(Pred Id *** ShowP Id) (13, True)Present (12,"True")PresentT (12,"True")predicate-typed similar to predicate-typed similar to  pl @(SplitAt 4 Id) "hello world"Present ("hell","o world")PresentT ("hell","o world")!pl @(SplitAt 20 Id) "hello world"Present ("hello world","")PresentT ("hello world","") pl @(SplitAt 0 Id) "hello world"Present ("","hello world")PresentT ("","hello world")1pl @(SplitAt (Snd Id) (Fst Id)) ("hello world",4)Present ("hell","o world")PresentT ("hell","o world")predicate-typedIsplit a list 'p' into parts using the lengths in the type level list 'ns'*pl @(SplitAts '[2,3,1,1] Id) "hello world"#Present ["he","llo"," ","w","orld"]$PresentT ["he","llo"," ","w","orld"]$pl @(SplitAts '[2] Id) "hello world"Present ["he","llo world"]PresentT ["he","llo world"]+pl @(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'\pl @(PadL 5 999 Id) [12,13]Present [999,999,999,12,13]PresentT [999,999,999,12,13](pl @(PadR 5 (Fst Id) '[12,13]) (999,'x')Present [12,13,999,999,999]PresentT [12,13,999,999,999]+pl @(PadR 2 (Fst Id) '[12,13,14]) (999,'x')Present [12,13,14]PresentT [12,13,14] predicate-typed<create inductive tuples from a type level list of predicates6pl @(TupleI '[Id,ShowP Id,Pred Id,W "str", W 999]) 666,Present (666,("666",(665,("str",(999,())))))-PresentT (666,("666",(665,("str",(999,())))))Dpl @(TupleI '[W 999,W "somestring",W 'True, Id, ShowP (Pred Id)]) 232Present (999,("somestring",(True,(23,("22",())))))3PresentT (999,("somestring",(True,(23,("22",())))))predicate-typed&Convenient method to convert a 'p' or '\q' to a  based on a predicate '\b\'" if 'b' then Right 'p' else Left '\q\'Npl @(EitherB (Fst Id > 4) (Snd Id >> Fst Id) (Snd Id >> Snd Id)) (24,(-1,999))Present Right 999PresentT (Right 999)Mpl @(EitherB (Fst Id > 4) (Snd Id >> Fst Id) (Snd Id >> Snd Id)) (1,(-1,999))Present Left (-1)PresentT (Left (-1))predicate-typed.Convenient method to convert a value 'p' to a  based on a predicate '\b\' if '\b\' then Just 'p' else Nothingpl @(MaybeB (Id > 4) Id) 24Present Just 24PresentT (Just 24)pl @(MaybeB (Id > 4) Id) (-5)Present NothingPresentT Nothingpredicate-typedEprocesses a type level list predicates running each in sequence: see 0pl @(Do [Pred Id, ShowP Id, Id &&& Len]) 9876543Present ("9876542",7)PresentT ("9876542",7)=pl @(Do '[W 123, W "xyz", Len &&& Id, Pred Id *** Id<>Id]) ()Present (2,"xyzxyz")PresentT (2,"xyzxyz")predicate-typedconverts a value to a Q: the same as  '\'Proxy'pl @MkProxy 'x' Present ProxyPresentT Proxypredicate-typed> function where you need to provide the type 't' of the resultpl @(Floor Int Id) (23 % 5) Present 4 PresentT 4predicate-typed> function where you need to provide the type 't' of the resultpl @(Ceiling Int Id) (23 % 5) Present 5 PresentT 5predicate-typed> function where you need to provide the type 't' of the resultpl @(Truncate Int Id) (23 % 5) Present 4 PresentT 4predicate-typed> function where you need to provide the type 't' of the result#pl @(FromRational Rational Id) 23.5Present 47 % 2PresentT (47 % 2)predicate-typed functionpl @(ToRational Id) 23.5Present 47 % 2PresentT (47 % 2)predicate-typed> function where you need to provide the type 't' of the result#pl @(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"pl @(FromInteger (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:set -XOverloadedStrings'pl @(FromStringP (Identity _) Id) "abc"Present Identity "abc"PresentT (Identity "abc")&pl @(FromStringP (Seq.Seq _) Id) "abc"Present fromList "abc"PresentT (fromList "abc")&predicate-typed#similar to 6th element in a n-tuple$pl @(L6 Id) (10,"Abc",'x',True,1,99) Present 99 PresentT 99*predicate-typed#similar to 5th element in a n-tuple!pl @(L5 Id) (10,"Abc",'x',True,1) Present 1 PresentT 1.predicate-typed#similar to 4th element in a n-tuplepl @(L4 Id) (10,"Abc",'x',True) Present True PresentT True;pl @(L4 (Fst (Snd Id))) ('x',((10,"Abc",'x',999),"aa",1),9) Present 999 PresentT 9993predicate-typed#similar to 3rd element in a n-tuplepl @(Thd Id) (10,"Abc",133) Present 133 PresentT 133 pl @(Thd Id) (10,"Abc",133,True) Present 133 PresentT 1338predicate-typed similar to pl @(Snd Id) (10,"Abc") Present "Abc"PresentT "Abc"pl @(Snd Id) (10,"Abc",True) Present "Abc"PresentT "Abc"=predicate-typed similar to pl @(Fst Id) (10,"Abc") Present 10 PresentT 10pl @(Fst Id) (10,"Abc",'x') Present 10 PresentT 10!pl @(Fst Id) (10,"Abc",'x',False) Present 10 PresentT 10>predicate-typed similar to  for y instancespl @(Length Id) (Left "aa") Present 0 PresentT 0pl @(Length Id) (Right "aa") Present 1 PresentT 1'pl @(Length (Right' Id)) (Right "abcd") Present 4 PresentT 4:pl @(Length (Thd (Snd Id))) (True,(23,'x',[10,9,1,3,4,2])) Present 6 PresentT 6?predicate-typed similar to pl @Len [10,4,5,12,3,4] Present 6 PresentT 6 pl @Len [] Present 0 PresentT 0Cpredicate-typed sort a listOpl @(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")]Epredicate-typed similar to pl @Max [10,4,5,12,3,4] Present 12 PresentT 12 pl @Max []Error empty listFailT "empty list"Fpredicate-typed similar to pl @Min [10,4,5,12,3,4] Present 3 PresentT 3 pl @Min []Error empty listFailT "empty list"Ipredicate-typed uses the B of the given type 't' and 'p' which points to the content to readpl @(ReadP Rational) "4 % 5" Present 4 % 5PresentT (4 % 5)_pl @(ReadP' Day Id >> Between (ReadP' Day "2017-04-11") (ReadP' Day "2018-12-30")) "2018-10-12"TrueTrueT_pl @(ReadP' Day Id >> Between (ReadP' Day "2017-04-11") (ReadP' Day "2018-12-30")) "2016-10-12"FalseFalseTJpredicate-typed uncreate a  returning year month and day$pl @(UnMkDay Id) (read "2019-12-30")Present (2019,12,30)PresentT (2019,12,30)Lpredicate-typed create a 6 from three int values passed in as year month and daypl @MkDay (2019,12,30)Present Just (2019-12-30,1,1) PresentT (Just (2019-12-30,1,1))7pl @(MkDay' (Fst Id) (Snd Id) (Thd Id)) (2019,99,99999)Present NothingPresentT Nothingpl @MkDay (1999,3,13)Present Just (1999-03-13,10,6)!PresentT (Just (1999-03-13,10,6))Npredicate-typedUA convenience method to match against many different datetime formats to find a matchpl @(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:33pl @(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:33Ppredicate-typed similar to  where 't' is the H type, 'p' is the datetime format and 'q' points to the content to parse;pl @(ParseTimeP LocalTime "%F %T" Id) "2019-05-24 05:19:59"Present 2019-05-24 05:19:59PresentT 2019-05-24 05:19:59ipl @(ParseTimeP LocalTime "%F %T" "2019-05-24 05:19:59") (Right "we ignore this using Symbol and not Id")Present 2019-05-24 05:19:59PresentT 2019-05-24 05:19:594keeping 'q' as we might want to extract from a tupleQpredicate-typed@type level expression representing a formatted time similar to  using a type level T to get the formatting stringFpl @(FormatTimeP "%F %T" Id) (read "2019-05-24 05:19:59" :: LocalTime)Present "2019-05-24 05:19:59"PresentT "2019-05-24 05:19:59"Vpl @(FormatTimeP (Fst Id) (Snd Id)) ("the date is %d/%m/%Y", read "2019-05-24" :: Day) Present "the date is 24/05/2019"!PresentT "the date is 24/05/2019"Rpredicate-typed similar to pl @(ShowP Id) [4,8,3,9]Present "[4,8,3,9]"PresentT "[4,8,3,9]"pl @(ShowP Id) 'x' Present "'x'"PresentT "'x'"pl @(ShowP (42 %- 10)) 'x'Present "(-21) % 5"PresentT "(-21) % 5"Spredicate-typedsplit a list into single valuespl @(Ones Id) [4,8,3,9]Present [[4],[8],[3],[9]]PresentT [[4],[8],[3],[9]]pl @(Ones Id) [] Present [] PresentT []Tpredicate-typed similar to pl @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],[]] pl @Tails [] Present [[]] PresentT [[]]Upredicate-typed similar to pl @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]] pl @Inits [] Present [[]] PresentT [[]]Vpredicate-typedconverts a string   value to upper casepl @ToUpper "HeLlO wOrld!"Present "HELLO WORLD!"PresentT "HELLO WORLD!"Wpredicate-typedconverts a string   value to lower casepl @ToLower "HeLlO wOrld!"Present "hello world!"PresentT "hello world!"_predicate-typed]predicate for determining if the string is all digits >>> pl @IsNumber "213G" False FalseTpl @IsNumber "929"TrueTrueTapredicate-typedbpredicate for determining if a string is all lowercase >>> pl @IsLower "abcdef213" False FalseTpl @IsLower "abcdef"TrueTrueTpl @IsLower ""TrueTrueTpl @IsLower "abcdefG"FalseFalseTopredicate-typed(a predicate for determining if a string ! # belongs to the given character setimport qualified Data.Text as Tpl @IsLower "abc"TrueTrueTpl @IsLower "abcX"FalseFalseTpl @IsLower (T.pack "abcX")FalseFalseTpl @IsHexDigit "01efA"TrueTrueTpl @IsHexDigit "01egfA"FalseFalseTppredicate-typedMA replacement function ([String] -> String) which yields the groups Used by N and N Requires Text.Show.Functions:m + Text.Show.Functionspl @(ReplaceAll "^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$" (MakeRR3 (Fst Id)) (Snd Id)) (\ys -> intercalate " | " $ map (show . succ . read @Int) ys, "141.201.1.22")Present "142 | 202 | 2 | 23"PresentT "142 | 202 | 2 | 23"qpredicate-typedOA replacement function (String -> String) that yields the whole match Used by N and N Requires Text.Show.Functions:m + Text.Show.FunctionsXpl @(ReplaceAll "\\." (MakeRR2 (Fst Id)) (Snd Id)) (\x -> x <> ":" <> x, "141.201.1.22")Present "141.:.201.:.1.:.22"PresentT "141.:.201.:.1.:.22"rpredicate-typedlA replacement function (String -> [String] -> String) which returns the whole match and the groups Used by N and N Requires Text.Show.Functionsspredicate-typedSimple replacement string: see v and t|predicate-typed6replaces regex 's' with a string 's1' inside the value2pl @(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%pl @(Resplit "\\." Id) "141.201.1.22"Present ["141","201","1","22"]PresentT ["141","201","1","22"]<pl @(Resplit (Singleton (Fst Id)) (Snd Id)) (':', "12:13:1")Present ["12","13","1"]PresentT ["12","13","1"]predicate-typed similar to B but gives the column start and ending positions instead of values?pl @(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 groups9pl @(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"])]Epl @(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 T$ as a regular expression evaluates % and returns True if there is a match/pl @(Re "^\\d{2}:\\d{2}:\\d{2}$" Id) "13:05:25"TrueTrueTpredicate-typed equivalentpl @Unzip (zip [1..5] "abcd")Present ([1,2,3,4],"abcd")PresentT ([1,2,3,4],"abcd")predicate-typed similar to pl @(Any Even Id) [1,5,11,5,3]FalseFalseTpl @(Any Even Id) [1,5,112,5,3]TrueTrueTpl @(Any Even Id) []FalseFalseTpredicate-typed similar to pl @(All Even Id) [1,5,11,5,3]FalseFalseTpl @(All Odd Id) [1,5,11,5,3]TrueTrueTpl @(All Odd Id) []TrueTrueTpredicate-typed:a type level predicate for all negative elements in a listpredicate-typed:a type level predicate for all positive elements in a listpl @AllPositive [1,5,10,2,3]TrueTrueTpl @AllPositive [0,1,5,10,2,3]FalseFalseTpl @AllPositive [3,1,-5,10,2,3]FalseFalseT!pl @AllNegative [-1,-5,-10,-2,-3]TrueTrueTpredicate-typedThis is the same as  but where 'r' is 7predicate-typed?A predicate that determines if the value is between 'p' and 'q'&pl @(Between' 5 8 Len) [1,2,3,4,5,5,7]TrueTrueTpl @(Between 5 8) 6TrueTrueTpl @(Between 5 8) 9FalseFalseTpredicate-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"TrueTrueTpl @Asc [1,2,3,4,5,5,7]TrueTrueTpl @Asc' [1,2,3,4,5,5,7]FalseFalseTpl @Asc "axacdef"FalseFalseTApredicate-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 H, O, R)   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJRKLMNOPQSTUVWXYZ[\]^_`fabcdeghijklmnpoqrtsuvwxyz{|}~456789:;<=>?@ABCDEFGbcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~8bcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~)r1s0w3x4y4z46441231111>5?588874444444444447662233.Traditional refinement type with only one type(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None,-.7:;<=>?@AHMPSVXkpredicate-typedthe constraints that  must adhere topredicate-typedNa simple refinement type that ensures the predicate 'p' holds for the type 'a' :m + Data.Time.Calendar.WeekDate#prtRefinedIO @(Between 10 14) ol 13 Right (Refined {unRefined = 13})#prtRefinedIO @(Between 10 14) ol 99 Left FalseP@prtRefinedIO @(Last >> Len == 4) ol ["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) ol "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) ol "141.213.1" Left FalsePprtRefinedIO @(Map (ReadP Int) (Resplit "\\." Id) >> Guard (Printf "bad length: found %d" Len) (Len == 4) >> 'True) ol "141.213.1""Left (FailP "bad length: found 3")prtRefinedIO @(Map (ReadP Int) (Resplit "\\." Id) >> Guard (Printf "bad length: found %d" Len) (Len == 4) >> GuardsN (Printf2 "octet %d out of range %d") 4 (Between 0 255) >> 'True) ol "141.213.1.444"'Left (FailP "octet 4 out of range 444")prtRefinedIO @(Map (ReadP Int) (Resplit "\\." Id) >> Guard (Printf "bad length: found %d" Len) (Len == 4) >> GuardsN (Printf2 "octet %d out of range %d") 4 (Between 0 255) >> 'True) ol "141.213.1x34.444"&Left (FailP "ReadP Int (1x34) failed")AprtRefinedIO @(Map ('[Id] >> ReadP Int) Id >> Luhn Id) ol "12344"%Right (Refined {unRefined = "12344"})AprtRefinedIO @(Map ('[Id] >> ReadP Int) Id >> Luhn Id) ol "12340" Left FalseP2prtRefinedIO @(Any (Prime Id) Id) ol [11,13,17,18]+Right (Refined {unRefined = [11,13,17,18]})2prtRefinedIO @(All (Prime Id) Id) ol [11,13,17,18] Left FalsePQprtRefinedIO @(Snd Id !! Fst Id >> Len > 5) ol (2,["abc","defghij","xyzxyazsfd"])@Right (Refined {unRefined = (2,["abc","defghij","xyzxyazsfd"])})RprtRefinedIO @(Snd Id !! Fst Id >> Len > 5) ol (27,["abc","defghij","xyzxyazsfd"])#Left (FailP "(!!) index not found")RprtRefinedIO @(Snd Id !! Fst Id >> Len <= 5) ol (2,["abc","defghij","xyzxyazsfd"]) Left FalsePpredicate-typed value for predicate-typed binary operation applied to two  valuespredicate-typed%takes two values and lifts them into & and then applies the binary operationpredicate-typedsame as  except we already have valid  values as inputpredicate-typedattempts to lift a refinement type to another refinement type by way of transformation function you can control both the predicate and the typepredicate-typedinvokes the callback with the , value if 'a' is valid for the predicate 'p'predicate-typedsame as  but prints the resultspredicate-typed returns a , value if 'a' is valid for the predicate 'p'predicate-typedreturns a wrapper  around a possible , value if 'a' is valid for the predicate 'p'predicate-typeda way to unsafely create a  valuepredicate-typeda way to unsafely create a  value but run the predicatepredicate-typed instance for predicate-typed instance for import Data.Timeimport Control.Lensimport Control.Arrow ((+++))-type K1 = Refined (ReadP Day >> 'True) Stringctype K2 = Refined (ReadP Day >> Between (ReadP' Day "2019-03-30") (ReadP' Day "2019-06-01")) Stringctype K3 = Refined (ReadP Day >> Between (ReadP' Day "2019-05-30") (ReadP' Day "2019-06-01")) String(r = unsafeRefined' ol "2019-04-23" :: K1NremoveAnsiForDocTest $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)"Refined {unRefined = "2019-04-23"}NremoveAnsiForDocTest $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)"Refined {unRefined = "2019-04-23"}NremoveAnsiForDocTest $ (view _3 +++ view _3) $ B.decodeOrFail @K3 (B.encode r)Refined:FalsePFalse >> False | 2019-04-23|3+- P ReadP Day (2019-04-23) 2019-04-23 | 2019-04-23| || `- P Id "2019-04-23"|`- False False && True |$ +- False 2019-04-23 >= 2019-05-30 | | | +- P I | |9 | `- P ReadP Day (2019-05-30) 2019-05-30 | 2019-05-30 | | | `- P '2019-05-30 |$ `- True 2019-04-23 <= 2019-06-01 | +- P I |9 `- P ReadP Day (2019-06-01) 2019-06-01 | 2019-06-01 | `- P '2019-06-01predicate-typed instance for :set -XOverloadedStrings1eitherDecode' @(Refined (Between 10 14) Int) "13" Right (Refined {unRefined = 13})HremoveAnsiForDocTest $ eitherDecode' @(Refined (Between 10 14) Int) "16"Error in $: Refined:FalsePFalse True && False|+- True 16 >= 10| | | +- P I| | | `- P '10|`- False 16 <= 14 | +- P I | `- P '14predicate-typed instance for :set -XOverloadedStrings@reads @(Refined (Between 0 255) Int) "Refined {unRefined = 254}" [(Refined {unRefined = 254},"")]@reads @(Refined (Between 0 255) Int) "Refined {unRefined = 300}"[]KRefinement type allowing the external type to differ from the internal type(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None%&',-.1:=>?@AHSUVXk~ predicate-typedOconvenience type family for converting from a 4-tuple '(ip,op,fmt,i) to a Proxypredicate-typedJconvenience type family for converting from a 4-tuple '(ip,op,fmt,i) to a  signaturepredicate-typed$Provides the constraints on Refined3predicate-typedCRefinement type that differentiates the input type from output type 'i' is the input type 'ip' converts i to PP ip i which is the internal type 'op' validates that internal type using PP op (PP ip i) ~ Bool 'fmt' outputs the internal type PP fmt (PP ip i) ~ i PP fmt (PP ip i) should be valid input to Refined3 If we fix the input type to String then it looks similar to: 1. read into an internal type 2. validate internal type with a predicate function 3. show/format the internal typedAlthough the most common scenario is String as input, you are free to choose any input type you like :m + Data.Time.Calendar.WeekDateAprtEval3 @(ReadBase Int 16) @(Lt 255) @(Printf "%x" Id) ol "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})AprtEval3 @(ReadBase Int 16) @(Lt 253) @(Printf "%x" Id) ol "00fe"-Left Step 2. False Boolean Check(op) | FalsePAprtEval3 @(ReadBase Int 16) @(Lt 255) @(Printf "%x" Id) ol "00fg"<Left Step 1. Initial Conversion(ip) Failed | invalid base 16prtEval3 @(Map (ReadP Int) (Resplit "\\." Id)) @(Guard (Printf "found length=%d" Len) (Len >> Id == 4) >> 'True) @(Printfnt 4 "%03d.%03d.%03d.%03d") ol "198.162.3.1.5"6Left Step 2. Failed Boolean Check(op) | found length=5prtEval3 @(Map (ReadP Int) (Resplit "\\." Id)) @(Guard (Printf "found length=%d" Len) (Len >> Id == 4) >> 'True) @(Printfnt 4 "%03d.%03d.%03d.%03d") ol "198.162.3.1"BRight (Refined3 {r3In = [198,162,3,1], r3Out = "198.162.003.001"})uprtEval3 @(MkDay >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) ol (2019,10,13)ARight (Refined3 {r3In = (2019-10-13,41,7), r3Out = (2019,10,13)})prtEval3 @(MkDay' (Fst Id) (Snd Id) (Thd Id) >> 'Just Id) @(Guard "expected a Sunday" (Thd Id == 7) >> 'True) @(UnMkDay (Fst Id)) ol (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 _)) ol (2019,10,12)9Left Step 2. Failed Boolean Check(op) | expected a Sunday)prtEval3P (Proxy @(T4 _)) ol (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-typedwraps the parameters for + in a 4-tuple for use with methods such as  and predicate-typeduse type application to set the parameters then it will be wrapped into a 4-tuple checks to make sure the proxy is consistent with Refined3C use for passing into eval3P you can pass in a promoted 4 tuple to other methodspredicate-typed emulates  but uses  reuses the mkProxy3 but returns Refined vs Refined3 using plain Refined to emulate Refined3 sort of we just output fmt instead of embedding it in Refined3 so 'ip' predicate gets us started: we store that 'PP ip i' in Refined then we run the boolean predicate 'op' which is successful if true then we run 'fmt' against 'PP ip i' and output both the Refined (PP p i) and the PP fmt (PP (ip i)) ie 'fmt' run against PP ip i if any of the three steps fails the process stops immediately and dumps out RResultspredicate-typed instance for :set -XOverloadedStringsSencode (unsafeRefined3 @(ReadBase Int 16) @(Between 0 255) @(ShowBase 16) 254 "fe")"\"fe\"".encode (unsafeRefined3 @Id @'True @Id 123 123)"123"predicate-typed instance for import Control.Arrow ((+++))import Control.Lensimport Data.Time6type K1 = MakeR3 '(ReadP Day, 'True, ShowP Id, String)ltype K2 = MakeR3 '(ReadP Day, Between (ReadP' Day "2019-03-30") (ReadP' Day "2019-06-01"), ShowP Id, String)ltype K3 = MakeR3 '(ReadP Day, Between (ReadP' Day "2019-05-30") (ReadP' Day "2019-06-01"), ShowP Id, String))r = unsafeRefined3' ol "2019-04-23" :: K1NremoveAnsiForDocTest $ (view _3 +++ view _3) $ B.decodeOrFail @K1 (B.encode r)2Refined3 {r3In = 2019-04-23, r3Out = "2019-04-23"}NremoveAnsiForDocTest $ (view _3 +++ view _3) $ B.decodeOrFail @K2 (B.encode r)2Refined3 {r3In = 2019-04-23, r3Out = "2019-04-23"}NremoveAnsiForDocTest $ (view _3 +++ view _3) $ B.decodeOrFail @K3 (B.encode r)1Refined3:Step 2. False Boolean Check(op) | FalseP;*** Step 1. Success Initial Conversion(ip) [2019-04-23] ***0P ReadP Day (2019-04-23) 2019-04-23 | 2019-04-23|`- P Id "2019-04-23"'*** Step 2. False Boolean Check(op) ***False False && True|!+- False 2019-04-23 >= 2019-05-30| | | +- P I| |6| `- P ReadP Day (2019-05-30) 2019-05-30 | 2019-05-30| || `- P '2019-05-30|!`- True 2019-04-23 <= 2019-06-01 | +- P I |6 `- P ReadP Day (2019-06-01) 2019-06-01 | 2019-06-01 | `- P '2019-06-01predicate-typed instance for :set -XOverloadedStringsaeitherDecode' @(Refined3 (ReadBase Int 16) (Id > 10 && Id < 256) (ShowBase 16) String) "\"00fe\""+Right (Refined3 {r3In = 254, r3Out = "fe"})|removeAnsiForDocTest $ eitherDecode' @(Refined3 (ReadBase Int 16) (Id > 10 && Id < 256) (ShowBase 16) String) "\"00fe443a\""=Error in $: Refined3:Step 2. False Boolean Check(op) | FalseP9*** 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|+- True 16663610 > 10| || +- P Id 16663610| | | `- P '10|`- False 16663610 < 256 | +- P Id 16663610 | `- P '256predicate-typed instance for :set -XOverloadedStringspreads @(Refined3 (ReadBase Int 16) (Between 0 255) (ShowBase 16) String) "Refined3 {r3In = 254, r3Out = \"fe\"}"*[(Refined3 {r3In = 254, r3Out = "fe"},"")]qreads @(Refined3 (ReadBase Int 16) (Between 0 255) (ShowBase 16) String) "Refined3 {r3In = 300, r3Out = \"12c\"}"[]mreads @(Refined3 (ReadBase Int 16) (Id < 0) (ShowBase 16) String) "Refined3 {r3In = -1234, r3Out = \"-4d2\"}".[(Refined3 {r3In = -1234, r3Out = "-4d2"},"")]reads @(Refined3 (Map (ReadP Int) (Resplit "\\." Id)) (Guard "len/=4" (Len == 4) >> 'True) (Printfnt 4 "%d.%d.%d.%d") String) "Refined3 {r3In = [192,168,0,1], r3Out = \"192.168.0.1\"}"=[(Refined3 {r3In = [192,168,0,1], r3Out = "192.168.0.1"},"")]22=Contains convenient prepackaged 4-tuples to use with Refined3(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None,-.=>?HSUVX predicate-typedCtake any valid Read/Show instance and turn it into a valid Refined3:m + Data.Ratio2prtEval3P (Proxy @(ReadShow Rational)) ol "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})3prtEval3P (Proxy @(ReadShow Rational)) ol "13x % 3"QLeft Step 1. Initial Conversion(ip) Failed | ReadP Ratio Integer (13x % 3) failedMprtEval3P (Proxy @(ReadShow' Rational (Between (3 % 1) (5 % 1)))) ol "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})QprtEval3P (Proxy @(ReadShow' Rational (Between (11 %- 2) (3 %- 1)))) ol "-13 % 3"8Right (Refined3 {r3In = (-13) % 3, r3Out = "(-13) % 3"})CprtEval3P (Proxy @(ReadShow' Rational (Id > (15 % 1)))) ol "13 % 3"-Left Step 2. False Boolean Check(op) | FalsePprtEval3P (Proxy @(ReadShow' Rational (Guard (Printf "invalid=%3.2f" (FromRational Double Id)) (Id > (15 % 1)) >> 'True))) ol "13 % 3"4Left Step 2. Failed Boolean Check(op) | invalid=4.33CprtEval3P (Proxy @(ReadShow' Rational (Id > (11 % 1)))) ol "13 % 3"-Left Step 2. False Boolean Check(op) | FalseP0let tmString = "2018-10-19 14:53:11.5121359 UTC"!let tm = read tmString :: UTCTime1prtEval3P (Proxy @(ReadShow UTCTime)) ol tmStringdRight (Refined3 {r3In = 2018-10-19 14:53:11.5121359 UTC, r3Out = "2018-10-19 14:53:11.5121359 UTC"}):m + Data.Aeson>prtEval3P (Proxy @(ReadShow Value)) ol "String \"jsonstring\""NRight (Refined3 {r3In = String "jsonstring", r3Out = "String \"jsonstring\""})5prtEval3P (Proxy @(ReadShow Value)) ol "Number 123.4">Right (Refined3 {r3In = Number 123.4, r3Out = "Number 123.4"}) predicate-typedYconvert a string from the given base 'i' but stores it internally as a string of base 'j'(prtEval3P (Proxy @(BaseIJ 16 2)) ol "fe"2Right (Refined3 {r3In = "11111110", r3Out = "fe"}))prtEval3P (Proxy @(BaseIJ 16 2)) ol "fge"<Left Step 1. Initial Conversion(ip) Failed | invalid base 16predicate-typedYconvert a string from the given base 'i' but stores it internally as a string of base 'j''prtEval3P (Proxy @(BaseN 16)) ol "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})&predicate-typed'read in an ipv4 address and validate itprtEval3P ip ol "001.223.14.1"ARight (Refined3 {r3In = [1,223,14,1], r3Out = "001.223.014.001"}) prtEval3P ip ol "001.223.14.999"SLeft Step 2. Failed Boolean Check(op) | guard(4) octet out of range 0-255 found 999"prtEval3P ip ol "001.223.14.999.1"=Left Step 1. Initial Conversion(ip) Failed | Regex no resultsprtEval3P ip ol "001.257.14.1"SLeft Step 2. Failed Boolean Check(op) | guard(2) octet out of range 0-255 found 257/predicate-typedread in an ssnprtEval3P ssn ol "134-01-2211"=Right (Refined3 {r3In = [134,1,2211], r3Out = "134-01-2211"})prtEval3P ssn ol "666-01-2211"MLeft Step 2. Failed Boolean Check(op) | number for group 1 invalid: found 666prtEval3P ssn ol "666-01-2211"MLeft Step 2. Failed Boolean Check(op) | number for group 1 invalid: found 666prtEval3P ssn ol "667-00-2211"KLeft Step 2. Failed Boolean Check(op) | number for group 2 invalid: found 0prtEval3P ssn ol "666-01-2211"MLeft Step 2. Failed Boolean Check(op) | number for group 1 invalid: found 666prtEval3P ssn ol "991-22-9999"MLeft Step 2. Failed Boolean Check(op) | number for group 1 invalid: found 9913predicate-typedread in a datetime?prtEval3P (Proxy @(DateTime1 UTCTime)) ol "2018-09-14 02:57:04"PRight (Refined3 {r3In = 2018-09-14 02:57:04 UTC, r3Out = "2018-09-14 02:57:04"})8predicate-typedcredit card with luhn algorithm!prtEval3P cc11 ol "1234-5678-901"-Left Step 2. False Boolean Check(op) | FalseP!prtEval3P cc11 ol "1234-5678-903"JRight (Refined3 {r3In = [1,2,3,4,5,6,7,8,9,0,3], r3Out = "1234-5678-903"})<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"HLeft Step 2. Failed Boolean Check(op) | guard(3) 60 secs is out of rangeprtEval3P hms ol "26:13:59"ILeft Step 2. Failed Boolean Check(op) | guard(1) 26 hours is out of range;      !"#$%&'()*+,-./0123456789:;<=>?@A;876549:3210;/.-,+<*)('&=%$#"! >?@A     KTemplate Haskell methods for creating Refined and Refined3 refinement types(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None &'->HXkQBpredicate-typed creates a " refinement type with terse outputCpredicate-typed creates a m refinement type and allows you to specify options (ol to just get a summary / o2 for full detail and colors)Dpredicate-typed creates a " refinement type with terse outputEpredicate-typed creates a 2 refinement type and allows you to specify optionsBCDEBCDE"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abccdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'( )*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX Y Z [ \ ] ^ _ `abcabdefghijefkeflefmefnhopqrsqrthohohohohuvhuwhuxhyzh{|h}~heeehhhhhhuhohuhhhhhhhahhhohhhhohohohohhhehhhhhehhhhhhhhhhhhhhhhhhhhhhhhhhuhuhhh.predicate-typed-0.1.0.2-BERZ7dEJU8K3NAfNImYX9F TH_OrphansUtilP PredicateCore PredicateRefinedRefined3Refined3HelperUtilP_THPaths_predicate_typed ReplaceImplDoMain>> Control.Arrow&&&T stripLeft stripRightstrip stripStartstripEnd Control.Monadjoin Data.Alignalign Data.Listorsands Data.ThesemergeTheseWithData.Text.LensIsText Data.Text $fLiftUTCTime $fLiftFixed$fLiftTimeOfDay$fLiftLocalTime $fLiftDay$fLiftDiffTime MonadEvalrunIOcatchit catchitNFliftEvalConsTMapTSumTIfTFlipT%&%% TupleLenTArrT ReverseTupleC ReverseTupleP reverseTupleC TupleListD tupleListD TupleListTNEmptyTLenT IntersperseTRepeatTGetOrdgetOrd OrderingPCgtCgeCeqCleCltCneGetNatNgetNatNFromNToNNSZGetBoolgetBool GetOrdering getOrderingGetThesegetTheseGetLengetLenPGetSymbsgetSymbsGetNatsgetNatsNotTOrTAndTFailIfTNullTNotZeroTBetweenTRRRR1RR2RR3GetROptgetROptGetROptsgetROptsROptAnchored Auto_calloutCaselessDollar_endonlyDotallDupnamesExtendedExtra Firstline Multiline Newline_cr Newline_crlf Newline_lfNo_auto_captureUngreedyUtf8 No_utf8_checkDisp NormalDispUnicodePOptsoShowAoDebugoDispoHideoColoroLitePColorunPColorHolderunHolderPE_pBool _pStringsBoolPFailPFalsePTruePPresentPBoolTFailTFalseTTrueTPresentTTT_tBool _tStrings_tForesttBooltStringstForestpStringsboolT2PpBoolmkNodemkNodeB partitionTTsgetTTLRpartitionTTExtendedgetValLRFromTTgetValLRshortTTfromTTfromTTHhh getValueLRgetValueLRHidegetValueLRImpldefOptsololco0o02o03o1o2o3ousetasetdsetusetcsetc0setc1setc2setc3setc4color0color1color2color3color4defhdefufixBoolTshowLit0showLit3showLitshowLit'show0show3showAshowA' compileRegex splitAndAlign formatList valsFromTTsisTrue_boolT groupErrors_FailT _PresentT_FalseT_TrueTimply evalBinStrictnatsymbgetLen showThesegetN toNodeString nullSpace showBoolPdisplayMessagescolorMeprtTTIOprtTTprtTT'prtTreeprtImplfixLite fixPresentP prtTreePureshowImplliteunicode horizontalprettyRationalfixit prefixMsgshowNatshowT showTProxy prettyOrdisPrimeremoveAnsiForDocTest$fFoldableBoolT $fMonoidBoolT$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:$fShowRR $fGetNats[]: $fGetNats[][] $fGetSymbs[]:$fGetSymbs[][] $fGetLenk: $fGetLenk[]$fGetThesexyThese$fGetThesexyThat$fGetThesexyThis$fGetOrderingGT$fGetOrderingEQ$fGetOrderingLT$fGetBoolFalse $fGetBoolTrue $fGetNatNS $fGetNatNZ $fGetOrdCne $fGetOrdClt $fGetOrdCle $fGetOrdCeq $fGetOrdCge $fGetOrdCgt$fTupleListDSa$fTupleListDZa$fReverseTupleC(,)$fReverseTupleC(,)0$fReverseTupleC(,)1$fReverseTupleC(,)2$fReverseTupleC(,)3$fReverseTupleC(,)4$fReverseTupleC(,)5$fReverseTupleC(,)6$fReverseTupleC(,)7$fReverseTupleC(,)8$fReverseTupleC(,)9$fReverseTupleC(,)10$fReverseTupleC() $fMonadEvalIO$fMonadEvalIdentity $fShowBoolP $fEqBoolP$fShowPE$fShowTT $fShowDisp$fEqDisp $fShowROpt$fEqROpt $fOrdROpt $fEnumROpt $fBoundedROpt$fShowOrderingP $fEqOrderingP$fEnumOrderingP$fBoundedOrderingP $fEqBoolT $fShowBoolTMsgWIdTIdIPPPevalevalBoolpe0pepexpe1pe2pe3plplcpupeWithrunPQ$fPProxyProxya$fPTheseTheseThese$fPTheseThatThese$fPTheseThisThese$fPEitherRightEither$fPEitherLeftEither$fPMaybeNothingMaybe$fPMaybeJustMaybe$fP[]:a$fP[]:a0$fP[][]a$fP()()a$fPNatna$fPOrderingcmpa$fP(,,,)(,,,)a $fP(,,)(,,)a $fP(,)(,)a $fPSymbolsa $fPBoolba $fPTYPEProxya $fPTYPE()a $fPTYPEIa $fPTYPEIda $fPTYPEIdTa $fPTYPEMsga $fPTYPEWaDoNRepeat GuardsNLaxGuardsN GuardsNImplParaNLaxParaN ParaNImpl StripLeft StripRightStripLRTrimEnd TrimStartTrimTrim'FnT&$Join DuplicateExtract<|>*><*<$ ApplyConstTCheckTPrintf3'Printf3Printf2 PrintfntLaxPrintfntPrintfn ReverseTupleN TupleListLax TupleList TupleListImplPrintCprtCSapaSapa'<> IsSuffixIIsInfixI IsPrefixIIsSuffixIsInfixIsPrefix IsFixImplNothing'StdinStderrStdout Writefile Writefile' Appendfile WritefileImplGetModegetModeWFModeWFAppendWFWrite WFWriteForce GetFHandle getFHandleFHandleFStdoutFStderrFOtherTimeZTimeU ReadEnvAllReadEnv DirExistsReadDir FileExistsReadFileHHideTraverseSequenceFailCaseCase''Case'CaseCaseImpl GuardsViaParaGuardsViaParaT ParaImplWParaLaxParaParaImpl ToGuardsTToGuardsToParaGuards'GuardsTPrintf IntercalateAssocRAssocLShowBase ShowBase' ReadBaseIntReadBase ReadBase'LuhnZipnZiprcZiplcZipExtractAFromTAZipTheseChar1 Singleton EmptyList EmptyList'TheseidTheseInIsTheseIsThatIsThisIsTh FromListFFromList ToListExtToList'ToListIToListIToList'NeLtLeSameGeGtCmpICmp===?OrdIOrdAOrdA'===OrdPImply~>OR||And&&<<>||>Skip GuardSimple ExitWhen'ExitWhenGuard'Guard GuardsImplW GuardsQuick GuardsLaxGuards GuardsImplOnePRemQuotQuotRemDivModModDivMod'Div'OddEven FailCatchCatch'CatchUnproxyHoleFailPrt2FailPrtFailSFailtFailpFailSpanBreakFilterBy PartitionPairsIf ConcatMapMap IterateNUntil IterateNWhile IterateWhile IterateUntilIterateNUnfoldrUnfoldTFoldlFoldNScanNAScanNScanlThesesThatsThissPartitionThesePartitionEithers CatMaybesMapMaybe EnumFromToNullIsEmptyUnsnocUncons+::+Ors'OrsAnds'AndsLookup'!!!Lookup!!IxLIx'IxProxyTProxyT'ConcatMin'SumFoldMapMConcatMkTheseMkThatMkThat'MkThisMkThis'MkRightMkRight'MkLeftMkLeft'MkJust MkNothing MkNothing'EmptyT MEmptyProxyMEmptyPMEmptyTMEmptyT'PMEmptyPureSTimesIsJust IsNothingMaybeInTheseXTTheseXEitherXTEitherX TheseToMaybe ThatToMaybe ThisToMaybe RightToMaybe LeftToMaybeMaybeXPTMaybeXMaybeXP TheseFailThesePTheseDefThatFailThatPThatDefThisFailThisPThisDef RightFailRightPRightDefLeftFailLeftPLeftDefJustFailJustPJustDefTheseIn'That'This'Right'Left'Just' LookupFailLookupP LookupDef LookupFail'LookupP' LookupDef'GFailGProxyGDefGDef_PA JustDef'''GDef_XXPAXAXAPA JustDef''GDef''JustDef'GDef'InitFailInitPInitDefLastFailLastPLastDefTailFailTailPTailDefHeadFailHeadPHeadDefFmap_2Fmap_1Init'Last'Tail'Head'ElemKeepRemoveKeepImplNotPrimeToEnumBFToEnumBToEnumB'ToEnumToEnum'FromEnumPredSuccPredB'PredBSuccB'SuccBSwappedCswappedCSwapReverseLReverseLeftRightPure2MEmptyT2 MEmptyT2'Coerce2CoerceWrapWrap'UnwrapSignumAbsNegate-%%-%/DivFBinGetBinOpgetBinOp=?>?<<=/===>=>*-+SubAddMultBinOpBMultBSubBAddDup+++IsRightIsLeftEitherIn|||SecondFirstStar***LastInitHeadTailDropTakeSplitAtSplitAtsPadRPadLPadMsg'TupleIEitherBMaybeB DoExpandTMkProxyFloorFloor'CeilingCeiling'Truncate Truncate' FromRational FromRational' ToRational FromIntegral FromIntegral' FromIntegerP FromInteger FromInteger' FromStringP FromStringP' ExtractL6C ExtractL6T extractL6CL6 ExtractL5C ExtractL5T extractL5CL5 ExtractL4C ExtractL4T extractL4CL4 ExtractL3C ExtractL3T extractL3CThdL3 ExtractL2C ExtractL2T extractL2CSndL2 ExtractL1C ExtractL1T extractL1CFstL1LengthLen SortByHelper SortOnDescSortOnSortByMax'MaxMinReadP'ReadPReadP''UnMkDayMkDayMkDay' ParseTimes ParseTimes' ParseTimeP ParseTimeP' FormatTimePShowPOnesTailsInitsToUpperToLowerIsLatin1 IsSeparator IsOctDigit IsHexDigit IsControl IsPunctuationIsSpaceIsNumberIsUpperIsLower GetCharSet getCharSetCharSetCLowerCUpperCNumberCSpace CPunctuationCControl CHexDigit COctDigit CSeparatorCLatin1 IsCharSetMakeRR3MakeRR2MakeRR1MakeRRReplaceOneStringReplaceOneString'ReplaceAllStringReplaceAllString' ReplaceOne ReplaceOne' ReplaceAll ReplaceAll'ResplitResplit' RescanRanges RescanRanges'RescanRescan'ReRe'UnzipAnyAll AllNegative' AllPositive'NegativePositive AllNegative AllPositiveBetween'BetweenDesc'DescAsc'Asc_MX strictmsg simpleAlign getValidBasegetStringPrefix evalQuick $fPTYPERe'x$fPTYPERescan'x$fPTYPERescanRanges'x$fPTYPEResplit'x$fPTYPEReplaceImplx$fPTYPEMakeRRx$fPTYPEMakeRR1x$fPTYPEMakeRR2x$fPTYPEMakeRR3x$fPTYPEIsCharSeta$fGetCharSetCLatin1$fGetCharSetCSeparator$fGetCharSetCOctDigit$fGetCharSetCHexDigit$fGetCharSetCControl$fGetCharSetCPunctuation$fGetCharSetCNumber$fGetCharSetCUpper$fGetCharSetCLower$fPTYPEToLowera$fPTYPEToUppera$fPTYPEInits[]$fPTYPETails[] $fPTYPEOnesx $fPTYPEShowPx$fPTYPEFormatTimePx$fPTYPEParseTimeP'a$fPTYPEParseTimes'a$fPTYPEMkDay'x$fPTYPEUnMkDayx$fPTYPEReadP''x $fPTYPEMin[] $fPTYPEMax[] $fPTYPELenas$fPTYPELengthx$fExtractL1C(,,,,,)$fExtractL1C(,,,,)$fExtractL1C(,,,)$fExtractL1C(,,)$fExtractL1C(,) $fPTYPEL1x$fExtractL2C(,,,,,)$fExtractL2C(,,,,)$fExtractL2C(,,,)$fExtractL2C(,,)$fExtractL2C(,) $fPTYPEL2x$fExtractL3C(,,,,,)$fExtractL3C(,,,,)$fExtractL3C(,,,)$fExtractL3C(,,)$fExtractL3C(,) $fPTYPEL3x$fExtractL4C(,,,,,)$fExtractL4C(,,,,)$fExtractL4C(,,,)$fExtractL4C(,,)$fExtractL4C(,) $fPTYPEL4x$fExtractL5C(,,,,,)$fExtractL5C(,,,,)$fExtractL5C(,,,)$fExtractL5C(,,)$fExtractL5C(,) $fPTYPEL5x$fExtractL6C(,,,,,)$fExtractL6C(,,,,)$fExtractL6C(,,,)$fExtractL6C(,,)$fExtractL6C(,) $fPTYPEL6x$fPTYPEFromStringP'a$fPTYPEFromInteger'a$fPTYPEFromIntegral'a$fPTYPEToRationalx$fPTYPEFromRational'a$fPTYPETruncate'x$fPTYPECeiling'x$fPTYPEFloor'x$fPTYPEMkProxya$fPTYPEMaybeBa$fPTYPEEitherBa$fPTYPETupleIa$fPTYPETupleIa0 $fPTYPEPada$fPTYPESplitAtsx$fPTYPESplitAta $fPTYPE***(,)$fPTYPE|||Either$fPTYPE+++Either$fGetBinOpBAdd$fGetBinOpBSub$fGetBinOpBMult $fPTYPEBina $fPTYPEDivFa $fPTYPE%x$fPTYPENegatex $fPTYPEAbsx$fPTYPESignumx$fPTYPEUnwrapx $fPTYPEWrap'x$fPTYPECoercea$fPTYPECoerce2f$fPTYPEMEmptyT2'f $fPTYPEPure2f$fPTYPEReverseas$fPTYPEReverseLt$fSwappedCTYPE(,)$fSwappedCTYPEEither$fSwappedCTYPEThese $fPTYPESwapp $fPTYPESuccBx $fPTYPEPredBx $fPTYPESuccx $fPTYPEPredx$fPTYPEFromEnumx$fPTYPEToEnum'x$fPTYPEToEnumB'a $fPTYPEPrimex $fPTYPENotx$fPTYPEKeepImplx $fPTYPEElema$fPTYPEFmap_1f$fPTYPEFmap_2f$fPTYPEMaybeXPx$fPTYPELeftToMaybeEither$fPTYPERightToMaybeEither$fPTYPEThisToMaybeThese$fPTYPEThatToMaybeThese$fPTYPETheseToMaybeThese$fPTYPEEitherXx$fPTYPETheseXx$fPTYPEMaybeInMaybe$fPTYPESTimesa $fPTYPEPurex$fPTYPEMEmptyT'a$fPTYPEMEmptyProxyProxy$fPTYPEEmptyTx$fPTYPEMkNothing'a$fPTYPEMkJustx$fPTYPEMkLeft'x$fPTYPEMkRight'x$fPTYPEMkThis'x$fPTYPEMkThat'x$fPTYPEMkThesea$fPTYPEProxyT'a $fPTYPEIx[] $fPTYPEIxLa$fPTYPELookupa $fPTYPEAndsx $fPTYPEOrsx $fPTYPE:+x $fPTYPE+:x$fPTYPEUnconss$fPTYPEUnsnocs$fPTYPEIsEmptyas $fPTYPENullas$fPTYPEEnumFromTox$fPTYPEPartitionEithers[]$fPTYPEPartitionThese[] $fPTYPEScanlx$fPTYPEUnfoldra $fPTYPEIfa$fPTYPEPairs[]$fPTYPEPartitiona $fPTYPEBreaka $fPTYPEFaila $fPTYPEHolea$fPTYPEUnproxyProxy $fPTYPECatchx $fPTYPEDiva $fPTYPEModa$fPTYPEDivModa$fPTYPEQuotRema$fPTYPEGuardsImpl[]$fPTYPEGuardsImpl[]0$fPTYPEGuardsImplW[] $fPTYPEGuarda$fPTYPEGuardSimplea $fPTYPESkipa $fPTYPE>>a $fPTYPEDoa $fPTYPE&&a $fPTYPE||a $fPTYPE~>a $fPTYPEOrdPa $fPTYPEOrdIa $fPTYPECmpa $fPTYPECmpIa$fPTYPEToListt$fPTYPEToListExtl$fPTYPEFromList[]$fPTYPEFromListFl $fPTYPEIsThx$fPTYPETheseInThese$fPTYPEEmptyList'x $fPTYPEChar1a$fPTYPEZipThesea$fPTYPEToList'x$fPTYPEIToList'x $fPTYPEMapx$fPTYPEConcatx$fPTYPEMConcatx $fPTYPEZipa $fPTYPELuhnx$fPTYPEReadBase'x$fPTYPEShowBase'x$fPTYPEIntercalatex$fPTYPEPrintfx$fPTYPEParaImpl[]$fPTYPEParaImpl[]0$fPTYPEParaImpl[]1$fPTYPEParaImplW[]$fPTYPECaseImplx$fPTYPECaseImplx0$fPTYPECaseImplx1$fPTYPECaseImplx2$fPTYPECaseImplx3 $fPTYPECasex$fPTYPESequencet $fPTYPEHidex$fPTYPESortByx$fPTYPEReadFilex$fPTYPEReadDirx$fPTYPEReadEnvx$fPTYPEReadEnvAlla $fPTYPETimeUa $fPTYPETimeZa$fGetFHandleFStderr$fGetFHandleFStdout$fGetModeWFWrite$fGetModeWFWriteForce$fGetModeWFAppend$fGetFHandleFOther$fPTYPEWritefileImpla $fPTYPEStdina$fPTYPEIsFixImplx $fPTYPE<>x $fPrintC(,) $fPrintC()$fPTYPETupleListImpl[]$fPTYPEReverseTupleNtp$fPTYPEPrintfnx $fPTYPE<$x $fPTYPE<*x $fPTYPE<|>x$fPTYPEExtractt$fPTYPEDuplicatet $fPTYPEJoint $fPTYPE$x $fPTYPETrim'x$fPTYPEStripLRx$fPTYPEParaNImpl[]$fPTYPEGuardsNImpl[]$fPTYPERepeata $fPTYPEDoNa $fShowCharSet $fShowBinOp $fEqBinOp $fShowWFMode $fEqWFMode $fShowFHandleRefinedT unRefinedTRefinedC unRefined arbRefinedrapplyrapply0rapply1convertRefinedT withRefinedTwithRefinedTIO prtRefinedIO newRefined newRefinedT newRefinedTIOunRavelT unRavelTIO unRavelTI prtRefinedTIO prtRefinedT unsafeRefinedunsafeRefined'$fToJSONRefined$fBinaryRefined$fFromJSONRefined $fReadRefined$fMonadError[]RefinedT $fShowRefined $fEqRefined$fGenericRefined $fLiftRefined$fFunctorRefinedT$fApplicativeRefinedT$fMonadRefinedT$fMonadContRefinedT$fMonadWriterRefinedT$fShowRefinedT$fMonadIORefinedT$fMonadTransRefinedTMsg3m3Descm3Shortm3LongRResultsRFRTFRTFalseRTTrueFRTTrueTResultsXFXTFXTFalseXTTrueFXTTrueT MkProxy3TMakeR3 Refined3Cr3Inr3OutunsafeRefined3'unsafeRefined3 arbRefined3arbRefined3WithmkProxy3 mkProxy3PwithRefined3TIO withRefined3TwithRefined3TP newRefined3T newRefined3TPnewRefined3TPIOconvertRefined3TconvertRefined3TPrapply3rapply3P prtEval3PIOprtEval3 prtEval3Peval3Peval3eval3Mprt3IOprt3prt3Impleval3PXeval3X$fToJSONRefined3$fBinaryRefined3$fFromJSONRefined3$fReadRefined3 $fShowMsg3 $fShowResults $fEqResults$fShowRResults$fEqMsg3$fLiftRefined3 $fEqRefined3$fShowRefined3 ReadShowR' ReadShow' ReadShowRReadShowBaseIJ'BaseIJOkNotROkNotOkROkLuhn'Luhn''LuhnXLuhnYLuhnR'LuhnRBetweenRBaseN DateTimeN DateTimeFmtsDateNDateFmts Ip4StrictREOctetREHms4HmsvalHmsconvHmsREIpfmtIpopIpipIpHmsfmtHmsopHmsipHmsSsnfmtSsnop'SsnopSsnipSsnDtfmt1Dtop1Dtip1 DateTime1CC11CcnCcfmtCcopCcipccncc11ssnhmsiphms4base16daten datetimen refined3TH refined3TH' refinedTH refinedTH'version getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName)pcre-heavy-1.0.0.2-KXrYdKP0BU7E79BWHqu2TKText.Regex.PCRE.Heavysubgsubghc-prim GHC.TypesTypebase Data.ProxyProxyNatOrderingSymbolBoolGHC.Baseconst$comonad-5.0.5-FVPlQ3vMIc47uubkmCYHT6Control.Comonad duplicateextract Data.OldList isInfixOf isPrefixOf isSuffixOf System.IOreadFileData.Traversable sequenceANumeric showIntAtBase"these-1.0.1-7FXXuLp3dad85dyuznSO1dThisThattheseThese Data.FoldabletoList!lens-4.17.1-GvUyXlqIqfnI3QR1W06LcControl.Lens.IndexeditoList GHC.ClassescompareGHC.RealquotRemdivModmoddivGHC.Listbreak partitionmapunfoldrscanlpartitionThese Data.EitherpartitionEithersGHC.Enum enumFromTonullFoldableControl.Lens.EmptyAsEmptyControl.Lens.ConsunsnocunconslookupControl.Lens.AtIxedconcatfoldMapmconcat GHC.MaybeJustemptymemptypurestimes Data.MaybemaybeelemnottoEnumfromEnumpredsuccControl.Lens.IsoswappedControl.Lens.Internal.Iso reversingreverseGHC.PrimcoerceControl.Lens.WrappedWrappedGHC.NumsignumabsnegateRationalsplitAtEitherMaybefloorceilingtruncate fromRational toRational fromIntegral fromInteger Data.String fromString Data.TuplesndfstlengthmaximumminimumGHC.ReadRead time-1.8.0.2Data.Time.Calendar.DaysDayData.Time.Format.Parse parseTimeM ParseTimeData.Time.Format formatTimeGHC.Showshowtailsinitsunzipanyall(QuickCheck-2.13.2-ELw76TsVduo6OXHYodvTIHTest.QuickCheck.Arbitrary arbitrary$aeson-1.4.5.0-BEtWara5EJO5A8lN6UCd9LData.Aeson.Types.ToJSONToJSONbinary-0.8.6.0Data.Binary.ClassBinaryData.Aeson.Types.FromJSONFromJSON