!T       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     SafeB !"#$%&'DMainly contains useful Template Haskell Lift instances for Date Time(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None1:E:NUtility methods for Predicate / methods for displaying the evaluation tree ...(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None%&',-.18=>?@AHMPSUVX_`kZ'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 ( and )c to allow more flexible replacement These parallel the RegexReplacement (not exported) class in Text.Regex.PCRE.HeavyM but have overlappable instances which is problematic for this code so I use 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-typeddraw vertical tree_predicate-typed use unicode`predicate-typedpretty printer treeapredicate-typedcustomizable optionscpredicate-typedlength of data to display for dpredicate-typed debug levelepredicate-typed3how to display the tree orientation and unicode etcfpredicate-typedhides one layer of a treegpredicate-typedcolor palette usedipredicate-typed4the color palette for displaying the expression treelpredicate-typed a monomorphic container of treesqpredicate-typed)holds the result of running the predicaterpredicate-typed*optional strings to include in the resultsspredicate-typedMcontains the untyped result from evaluating the expression tree to this pointxpredicate-typedKcontains the typed result from evaluating the expression tree to this point}predicate-typed,describes the evaluation tree for predicates~predicate-typedthe child nodespredicate-typedthe value at this root nodepredicate-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 display the tree verticallypredicate-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 palettepredicate-typed"display in document in tree formatypredicate-typedfailure with stringzpredicate-typedfalse predicate{predicate-typedtrue predicate|predicate-typednon predicate value    &%$#"!'()*+-,./0123456789:;<=>?@AEDCBFGHIJ[ZYXWVUTSRQPONMLK\`_^]abgfedchijklmnopqrswuvtx|{zy}~}~x|{zyswuvtopqrlmnijkabgfedch\`_^]J[ZYXWVUTSRQPONMLKHIFGAEDCB@?>=<;:8967452301./+-,*)'( &%$#"!   9 9 8Dsl for evaluating and displaying type level expressions(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None %&',-.=>?@AHPSUVX_`k=predicate-typed similar to    :set -XTypeApplications:set -XDataKinds/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 NothingApredicate-typed similar to      :set -XTypeApplications:set -XDataKinds'pl @(Trim Snd) (20," abc " :: String) Present "abc"PresentT "abc"import Data.Text (Text)%pl @(Trim Snd) (20," abc " :: Text) Present "abc"PresentT "abc""pl @(TrimStart Snd) (20," abc ")Present "abc "PresentT "abc " pl @(TrimEnd Snd) (20," abc ")Present " abc"PresentT " abc"todo: make it work for *Epredicate-typed similar to :set -XTypeApplications:set -XDataKindspl @Join (Just (Just 20))Present Just 20PresentT (Just 20)Fpredicate-typed similar to +:set -XTypeApplications:set -XDataKindspl @Duplicate (20,"abc")Present (20,(20,"abc"))PresentT (20,(20,"abc"))Gpredicate-typed similar to ,:set -XTypeApplications:set -XDataKindspl @Extract (Nothing,Just 20)Present Just 20PresentT (Just 20)pl @Extract (Identity 20) Present 20 PresentT 20Hpredicate-typed similar to -:set -XTypeApplications:set -XDataKinds#pl @(Fst <|> Snd) (Nothing,Just 20)Present Just 20PresentT (Just 20)#pl @(Fst <|> Snd) (Just 10,Just 20)Present Just 10PresentT (Just 10)#pl @(Fst <|> Snd) (Nothing,Nothing)Present NothingPresentT NothingIpredicate-typed similar to .:set -XTypeApplications:set -XDataKinds%pl @(Fst <* Snd) (Just "abc",Just 20)Present Just "abc"PresentT (Just "abc")Kpredicate-typed similar to /:set -XTypeApplications:set -XDataKinds pl @(Fst <$ Snd) ("abc",Just 20)Present Just "abc"PresentT (Just "abc")Spredicate-typedPrintfn prints:set -XTypeApplications:set -XDataKinds+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-typed similar to 0:set -XTypeApplications:set -XDataKindspl @(Fst <> Snd) ("abc","def")Present "abcdef"PresentT "abcdef"cpredicate-typed1 2 3 equivalents:set -XTypeApplications:set -XDataKinds pl @(IsInfixI "abc" "axAbCd") ()TrueTrueT!pl @(IsPrefixI "abc" "aBcbCd") ()TrueTrueT pl @(IsPrefix "abc" "aBcbCd") ()FalseFalseTprefix infix suffix for strings{predicate-typeddoes the directory exists:set -XTypeApplications:set -XDataKindspl @(DirExists ".") ()TrueTrueT}predicate-typeddoes the directory exists:set -XTypeApplications:set -XDataKindspl @(DirExists ".") ()TrueTrueTpredicate-typed similar to 4:set -XTypeApplications:set -XDataKinds4pl @(ReadFile ".ghci" >> 'Just Id >> Len >> Gt 0) ()TrueTrueTpl @(FileExists "xyzzy") ()FalseFalseTpredicate-typed similar to 5:set -XTypeApplications:set -XDataKinds(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 e:set -XTypeApplications:set -XDataKindspl @(Case (FailS "asdf" >> Snd >> 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 >> 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 >> 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 >> 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 :set -XTypeApplications:set -XDataKinds)pl @(Para '[Id,Id + 1,Id * 4]) [10,20,30]Present [10,21,120]PresentT [10,21,120]predicate-typeduses Printf to format output:set -XTypeApplications:set -XDataKindspl @(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:set -XTypeApplications:set -XDataKinds;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 Display a number at base 2 to 36:set -XTypeApplications:set -XDataKindspl @(ShowBase 16) 4077 Present "fed"PresentT "fed"pl @(ShowBase 16) (-255) Present "-ff"PresentT "-ff"pl @(ShowBase 2) 147Present "10010011"PresentT "10010011".supports negative numbers unlike showIntAtBasepredicate-typedRead a number base 2 via 36:set -XTypeApplications:set -XDataKindspl @(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 digit:set -XTypeApplications:set -XDataKindspl @Luhn [1,2,3,0]TrueTrueTpl @Luhn [1,2,3,4]FalseFalseTpredicate-typedGZip two lists optionally cycling the one of the lists to match the size:set -XTypeApplications:set -XDataKinds#pl @(Ziplc Fst Snd) ("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)]'pl @(Ziplc Fst Snd) ("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)]'pl @(Ziprc Fst Snd) ("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 6 or 7& if one list is shorter than the other>the key is that all information about both lists are preserved:set -XTypeApplications:set -XDataKinds&pl @(ZipThese Fst Snd) ("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])pl @(ZipThese Fst Snd) ("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 8:set -XTypeApplications:set -XDataKindspl @(Char1 "aBc") () Present 'a' PresentT 'a'predicate-typed similar to 9:set -XTypeApplications:set -XDataKinds1pl @(TheseIn Id Len (Fst + Length Snd)) (This 13) Present 13 PresentT 13Fpl @(TheseIn Id Len (Fst + Length Snd)) (That "this is a long string") Present 21 PresentT 21=pl @(TheseIn Id Len (Fst + Length Snd)) (These 20 "somedata") Present 28 PresentT 28vpl @(TheseIn (Left _) (Right _) (If (Fst > Length Snd) (MkLeft _ Fst) (MkRight _ Snd))) (That "this is a long string")%Present Right "this is a long string"(PresentT (Right "this is a long string")ypl @(TheseIn (Left _) (Right _) (If (Fst > Length Snd) (MkLeft _ Fst) (MkRight _ Snd))) (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 > Length Snd) (MkLeft _ Fst) (MkRight _ Snd))) (These 100 "this is a long string")Present Left 100PresentT (Left 100)predicate-typed predicate on ::set -XTypeApplications:set -XDataKindspl @IsThis (This "aBc")TrueTrueTpl @IsThis (These 1 'a')FalseFalseTpl @IsThese (These 1 'a')TrueTrueTpredicate-typed similar to ;:set -XTypeApplications:set -XDataKindspl @ToList "aBc" Present "aBc"PresentT "aBc"predicate-typed similar to <:set -XTypeApplications:set -XDataKinds!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:set -XTypeApplications:set -XDataKinds pl @(Fst ===? Snd) ("abC","aBc") Present EQ PresentT EQ!pl @(Fst ===? Snd) ("abC","DaBc") Present LT PresentT LTpredicate-typed similar to =:set -XTypeApplications:set -XDataKindspl @(OrdP Fst Snd) (10,9) Present GT PresentT GTpl @(OrdP Fst Snd) (10,10) Present EQ PresentT EQpl @(OrdP Fst Snd) (10,11) Present LT PresentT LTpredicate-typed implication:set -XTypeApplications:set -XDataKinds6pl @(Fst ~> (Snd >> Len >> Ge 4)) (True,[11,12,13,14])TrueTrueT;pl @(Fst ~> (Snd >> Len >> Same 4)) (True,[12,11,12,13,14])FalseFalseT<pl @(Fst ~> (Snd >> Len >> Same 4)) (False,[12,11,12,13,14])TrueTrueT7pl @(Fst ~> (Snd >> Len >> Ge 4)) (False,[11,12,13,14])TrueTrueTpredicate-typed similar to >:set -XTypeApplications:set -XDataKinds7pl @(Fst || (Snd >> Len >> Ge 4)) (False,[11,12,13,14])TrueTrueTDpl @((Fst >> Not) || (Snd >> Len >> Same 4)) (True,[12,11,12,13,14])FalseFalseTpredicate-typed similar to ?:set -XTypeApplications:set -XDataKinds6pl @(Fst && (Snd >> Len >> Ge 4)) (True,[11,12,13,14])TrueTrueT;pl @(Fst && (Snd >> Len >> Same 4)) (True,[12,11,12,13,14])FalseFalseTpredicate-typed"This is composition for predicates:set -XTypeApplications:set -XDataKinds*pl @(Fst >> Id !! 0 >> Succ) ([11,12],'x') Present 12 PresentT 127pl @(Len *** Succ >> First Pred >> ShowP) ([11,12],'x')Present "(1,'y')"PresentT "(1,'y')"predicate-typed?'p' is the predicate and on failure of the predicate runs 'prt':set -XTypeApplications:set -XDataKinds$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 list:set -XTypeApplications:set -XDataKindsGpl @(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 1 3 FailT "1 3"Xpl @(GuardsQuick (Printf2 "arg %d failed with value %d") '[Gt 4, Ge 3, Same 4]) [17,3,5]Error arg 2 failed with value 5!FailT "arg 2 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 @:set -XTypeApplications:set -XDataKindspl @(QuotRem Fst Snd) (10,3) Present (3,1)PresentT (3,1)pl @(QuotRem Fst Snd) (10,-3)Present (-3,1)PresentT (-3,1)pl @(QuotRem Fst Snd) (-10,-3)Present (3,-1)PresentT (3,-1)pl @(QuotRem Fst Snd) (-10,3)Present (-3,-1)PresentT (-3,-1)pl @(QuotRem Fst Snd) (10,0)Error QuotRem zero denominator FailT "QuotRem zero denominator"predicate-typed similar to A:set -XTypeApplications:set -XDataKindspl @(DivMod Fst Snd) (10,3) Present (3,1)PresentT (3,1)pl @(DivMod Fst Snd) (10,-3)Present (-4,-2)PresentT (-4,-2)pl @(DivMod Fst Snd) (-10,3)Present (-4,2)PresentT (-4,2)pl @(DivMod Fst Snd) (-10,-3)Present (3,-1)PresentT (3,-1)pl @(DivMod Fst Snd) (10,0)Error DivMod zero denominatorFailT "DivMod zero denominator"predicate-typed similar to B:set -XTypeApplications:set -XDataKindspl @(Mod Fst Snd) (10,3) Present 1 PresentT 1pl @(Mod Fst Snd) (10,0)Error Mod zero denominatorFailT "Mod zero denominator"predicate-typed similar to C:set -XTypeApplications:set -XDataKindspl @(Div Fst Snd) (10,4) Present 2 PresentT 2pl @(Div Fst Snd) (10,0)Error Div zero denominatorFailT "Div zero denominator"predicate-typedcatch a failure:set -XTypeApplications:set -XDataKindsCpl @(Catch Succ (Fst >> Second ShowP >> Printf2 "%s %s" >> 'LT)) GT Present LT PresentT LT6pl @(Catch' Succ (Second ShowP >> 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"6pl @(Catch' Succ (Second ShowP >> 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-typedjtransparent predicate wrapper to make k of kind Type so it can be in a promoted list (cant mix kinds) see :set -XTypeApplications:set -XDataKinds:pl @(Do '[W 123, W "xyz", Len &&& Id, Pred *** Id<>Id]) ()Present (2,"xyzxyz")PresentT (2,"xyzxyz")Bpl @(TupleI '[W 999,W "somestring",W 'True, Id, Pred >> ShowP]) 232Present (999,("somestring",(True,(23,("22",())))))3PresentT (999,("somestring",(True,(23,("22",())))))predicate-typed$Fails the computation with a message:set -XTypeApplications:set -XDataKinds+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 D:set -XTypeApplications:set -XDataKinds(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 E:set -XTypeApplications:set -XDataKinds,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])predicate-typed/creates a list of overlapping pairs of elements:set -XTypeApplications:set -XDataKindspl @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:set -XTypeApplications:set -XDataKinds>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 F:set -XTypeApplications:set -XDataKindspl @(Map Pred Id) [1..5]Present [0,1,2,3,4]PresentT [0,1,2,3,4]predicate-typed similar to G:set -XTypeApplications:set -XDataKinds=pl @(Unfoldr (MaybeB (Null >> Not) (SplitAt 2 Id)) Id) [1..5]Present [[1,2],[3,4],[5]]PresentT [[1,2],[3,4],[5]]predicate-typed similar to H:set -XTypeApplications:set -XDataKinds.pl @(Scanl (Snd :+ Fst) Fst Snd) ([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]]predicate-typed similar to I:set -XTypeApplications:set -XDataKindsZpl @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 J:set -XTypeApplications:set -XDataKindsApl @PartitionEithers [Left 'a',Right 2,Left 'c',Right 4,Right 99]Present ("ac",[2,4,99])PresentT ("ac",[2,4,99]) predicate-typed similar to K:set -XTypeApplications:set -XDataKindspl @(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 L using M:set -XTypeApplications:set -XDataKindspl @Null [1,2,3,4]FalseFalseT pl @Null []TrueTrueTpredicate-typed similar to L using N:set -XTypeApplications:set -XDataKindspl @IsEmpty [1,2,3,4]FalseFalseTpl @IsEmpty []TrueTrueTpl @IsEmpty LTFalseFalseTpl @IsEmpty EQTrueTrueTpredicate-typedO:set -XTypeApplications:set -XDataKindspl @Unsnoc [1,2,3,4]Present Just ([1,2,3],4)PresentT (Just ([1,2,3],4)) pl @Unsnoc []Present NothingPresentT Nothingpredicate-typedP:set -XTypeApplications:set -XDataKindspl @Uncons [1,2,3,4]Present Just (1,[2,3,4])PresentT (Just (1,[2,3,4])) pl @Uncons []Present NothingPresentT Nothingpredicate-typedsimilar to snoc:set -XTypeApplications:set -XDataKindspl @(Snd +: Fst) (99,[1,2,3,4])Present [1,2,3,4,99]PresentT [1,2,3,4,99]predicate-typedsimilar to cons:set -XTypeApplications:set -XDataKindspl @(Fst :+ Snd) (99,[1,2,3,4])Present [99,1,2,3,4]PresentT [99,1,2,3,4]predicate-typed:set -XTypeApplications:set -XDataKindspl @Ors [False,False,False]FalseFalseTpl @Ors [True,True,True,False]TrueTrueT pl @Ors []FalseFalseTpredicate-typed:set -XTypeApplications:set -XDataKindspl @Ands [True,True,True]TrueTrueTpl @Ands [True,True,True,False]FalseFalseT pl @Ands []TrueTrueTpredicate-typedQ leveraging R:set -XTypeApplications:set -XDataKinds%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 Nothingpredicate-typed similar to S leveraging R:set -XTypeApplications:set -XDataKinds%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 2predicate-typed similar to S:set -XTypeApplications:set -XDataKinds.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" predicate-typed similar to T:set -XTypeApplications:set -XDataKinds'pl @(Concat Id) ["abc","D","eF","","G"]Present "abcDeFG"PresentT "abcDeFG".pl @(Concat Snd) ('x',["abc","D","eF","","G"])Present "abcDeFG"PresentT "abcDeFG"$predicate-typed similar to U:set -XTypeApplications:set -XDataKinds,pl @MConcat [SG.Sum 44, SG.Sum 12, SG.Sum 3]Present Sum {getSum = 59}PresentT (Sum {getSum = 59})%predicate-typed: constructor:set -XTypeApplications:set -XDataKindspl @(MkThese Fst Snd) (44,'x')Present These 44 'x'PresentT (These 44 'x')'predicate-typed7 constructor:set -XTypeApplications:set -XDataKindspl @(MkThat _ Id) 44Present That 44PresentT (That 44))predicate-typed6 constructor:set -XTypeApplications:set -XDataKindspl @(MkThis _ Id) 44Present This 44PresentT (This 44)+predicate-typedV constructor:set -XTypeApplications:set -XDataKindspl @(MkRight _ Id) 44Present Right 44PresentT (Right 44)-predicate-typedW constructor:set -XTypeApplications:set -XDataKindspl @(MkLeft _ Id) 44Present Left 44PresentT (Left 44).predicate-typedX constructor:set -XTypeApplications:set -XDataKinds pl @MkJust 44Present Just 44PresentT (Just 44)2predicate-typed similar to Y:set -XTypeApplications:set -XDataKindspl @(EmptyT Maybe) ()Present NothingPresentT Nothing6predicate-typed similar to Z:set -XTypeApplications:set -XDataKindspl @(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!8predicate-typed similar to [:set -XTypeApplications:set -XDataKindspl @(Pure Maybe Id) 4Present Just 4PresentT (Just 4)pl @(Pure [] Id) 4 Present [4] PresentT [4]9predicate-typed similar to \:set -XTypeApplications:set -XDataKindspl @(STimes 4 Id) (SG.Sum 3)Present Sum {getSum = 12}PresentT (Sum {getSum = 12})pl @(STimes 4 Id) "ab"Present "abababab"PresentT "abababab"<predicate-typed similar to ] similar to GW but provides a Proxy to the result of 'q' and does not provide the surrounding context:set -XTypeApplications:set -XDataKinds6pl @(MaybeIn "foundnothing" (Pred >> ShowP)) (Just 20) Present "19" PresentT "19"5pl @(MaybeIn "found nothing" (Pred >> ShowP)) 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 tuple:set -XTypeApplications:set -XDataKindsPpl @(TheseX (((Fst >> Fst) + Snd) >> ShowP) ShowP (Snd >> Snd) Snd) (9,This 123) Present "132"PresentT "132"Dpl @(TheseX '(Snd,"fromthis") '(99 >> Negate,Snd) Snd Id) (This 123)Present (123,"fromthis")PresentT (123,"fromthis")Kpl @(TheseX '(Snd,"fromthis") '(99 >> Negate,Snd) Snd Id) (That "fromthat")Present (-99,"fromthat")PresentT (-99,"fromthat")Qpl @(TheseX '(Snd,"fromthis") '(99 >> Negate,Snd) Snd Id) (These 123 "fromthese")Present (123,"fromthese")PresentT (123,"fromthese")@predicate-typed similar to _6 but additionally gives 'p' and 'q' the original input:set -XTypeApplications:set -XDataKindsDpl @(EitherX (((Fst >> Fst) + Snd) >> ShowP) ShowP Snd) (9,Left 123) Present "132"PresentT "132"Epl @(EitherX (((Fst >> Fst) + Snd) >> ShowP) ShowP Snd) (9,Right 'x')Present "((9,Right 'x'),'x')"PresentT "((9,Right 'x'),'x')"<pl @(EitherX ShowP (Second Succ >> ShowP) Snd) (9,Right 'x')Present "((9,Right 'x'),'y')"PresentT "((9,Right 'x'),'y')"Dpredicate-typed&similar to either (const Nothing) Just:set -XTypeApplications:set -XDataKindspl @RightToMaybe (Right 13)Present Just 13PresentT (Just 13)pl @RightToMaybe (Left 13)Present NothingPresentT NothingEpredicate-typed&similar to either Just (const Nothing):set -XTypeApplications:set -XDataKindspl @LeftToMaybe (Left 13)Present Just 13PresentT (Just 13)pl @LeftToMaybe (Right 13)Present NothingPresentT Nothingpredicate-typedsimilar to fmap snd:set -XTypeApplications:set -XDataKindspl @Fmap_2 (Just ("asf",13))Present Just 13PresentT (Just 13)predicate-typedsimilar to fmap fst:set -XTypeApplications:set -XDataKindspl @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:set -XTypeApplications:set -XDataKinds!pl @(Elem Fst Snd) ('x',"abcdxy")TrueTrueT!pl @(Elem Fst Snd) ('z',"abcdxy")FalseFalseTpredicate-typed<filters a list 'q' keeping or removing those elements in 'p':set -XTypeApplications:set -XDataKinds!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-typeda function:set -XTypeApplications:set -XDataKinds pl @Not FalseTrueTrueT pl @Not TrueFalseFalseTpredicate-typeda predicate on prime numbers:set -XTypeApplications:set -XDataKinds pl @Prime 2TrueTrueT pl @(Map '(Id,Prime) 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 b function:set -XTypeApplications:set -XDataKindspl @(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 b function:set -XTypeApplications:set -XDataKindspl @(ToEnum Char) 120 Present 'x' PresentT 'x'predicate-typedc function:set -XTypeApplications:set -XDataKindspl @FromEnum 'x' Present 120 PresentT 120predicate-typed unbounded d function:set -XTypeApplications:set -XDataKinds pl @Pred 13 Present 12 PresentT 12predicate-typed unbounded e function:set -XTypeApplications:set -XDataKinds pl @Succ 13 Present 14 PresentT 14 pl @Succ LT Present EQ PresentT EQ pl @Succ GT8Error Succ IO e=Prelude.Enum.Ordering.succ: bad argument:FailT "Succ IO e=Prelude.Enum.Ordering.succ: bad argument"predicate-typedbounded d function:set -XTypeApplications:set -XDataKindspl @PredB' (13 :: Int) Present 12 PresentT 12predicate-typedbounded e function:set -XTypeApplications:set -XDataKindspl @SuccB' (13 :: Int) Present 14 PresentT 14 pl @SuccB' LT Present EQ PresentT EQpl @(SuccB 'LT) GT Present LT PresentT LT pl @SuccB' GTError Succ bounded failedFailT "Succ bounded failed"predicate-typed swaps using f:set -XTypeApplications:set -XDataKindspl @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)predicate-typedreverses using g:set -XTypeApplications:set -XDataKindsimport Data.Text (Text)pl @ReverseL ("AbcDeF" :: Text)Present "FeDcbA"PresentT "FeDcbA"predicate-typed similar to h:set -XTypeApplications:set -XDataKindspl @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:set -XTypeApplications:set -XDataKinds#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 Functor:set -XTypeApplications:set -XDataKindsIpl @(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 functor:set -XTypeApplications:set -XDataKindsHpl @(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 i:set -XTypeApplications:set -XDataKinds.pl @(Coerce (SG.Sum Integer)) (Identity (-13))Present Sum {getSum = -13}PresentT (Sum {getSum = -13})predicate-typedwraps a value (see j and j):set -XTypeApplications:set -XDataKinds: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 j):set -XTypeApplications:set -XDataKindspl @Unwrap (SG.Sum (-13)) Present -13PresentT (-13)predicate-typed similar to k:set -XTypeApplications:set -XDataKindspl @Signum (-14) Present -1 PresentT (-1) pl @Signum 14 Present 1 PresentT 1 pl @Signum 0 Present 0 PresentT 0predicate-typed similar to l:set -XTypeApplications:set -XDataKinds pl @Abs (-14) Present 14 PresentT 14 pl @Abs 14 Present 14 PresentT 14 pl @Abs 0 Present 0 PresentT 0predicate-typed similar to m:set -XTypeApplications:set -XDataKinds pl @Negate 14 Present -14PresentT (-14)predicate-typedfractional division:set -XTypeApplications:set -XDataKindspl @(Fst / Snd) (13,2) Present 6.5 PresentT 6.5pl @(Pos 13 / Id) 0Error DivF zero denominatorFailT "DivF zero denominator"predicate-typed(addition, multiplication and subtraction:set -XTypeApplications:set -XDataKinds:set -XNoStarIsTypepl @(Fst * Snd) (13,5) Present 65 PresentT 65,pl @(Fst + 4 * (Snd >> Len) - 4) (3,"hello") Present 19 PresentT 19predicate-typedsimilar n:set -XTypeApplications:set -XDataKindspl @(Pred +++ Id) (Left 13)Present Left 12PresentT (Left 12)'pl @(ShowP +++ Reverse) (Right "hello")Present Right "olleh"PresentT (Right "olleh")predicate-typedsimilar _:set -XTypeApplications:set -XDataKindspl @(Pred ||| Id) (Left 13) Present 12 PresentT 12"pl @(ShowP ||| Id) (Right "hello")Present "hello"PresentT "hello"predicate-typed similar to o:set -XTypeApplications:set -XDataKindspl @(Pred *** ShowP) (13, True)Present (12,"True")PresentT (12,"True")predicate-typed similar to ppredicate-typed similar to q:set -XTypeApplications:set -XDataKinds 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")'pl @(SplitAt Snd Fst) ("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':set -XTypeApplications:set -XDataKinds*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'\:set -XTypeApplications:set -XDataKindspl @(PadL 5 999 Id) [12,13]Present [999,999,999,12,13]PresentT [999,999,999,12,13]#pl @(PadR 5 Fst '[12,13]) (999,'x')Present [12,13,999,999,999]PresentT [12,13,999,999,999]&pl @(PadR 2 Fst '[12,13,14]) (999,'x')Present [12,13,14]PresentT [12,13,14]predicate-typed9add a message to give more context to the evaluation tree:set -XTypeApplications:set -XDataKindspe @(Msg' "somemessage" Id) 999P [somemessage] Id 999 PresentT 999predicate-typedget a r from the type levelpredicate-typedget a list of rs from the type levelpredicate-typedLcompares 2 numbers where the numbers are type level signed rationals or Natspredicate-typed,constructs a valid negative rational number predicate-typed,constructs a valid positive rational number predicate-typed3constructs a negative integer as a rational number predicate-typed3constructs a positive integer as a rational number predicate-typed=type level representation of signed rational numbers/integers:set -XTypeApplications:set -XDataKinds:set -XNoStarIsTypepl @(NegR 14 3) ()Present (-14) % 3PresentT ((-14) % 3)pl @(PosR 14 3) ()Present 14 % 3PresentT (14 % 3)#pl @(CmpRat (NegR 14 3) (Neg 5)) () Present GT PresentT GTpl @(NegR 14 3 * Neg 5) ()Present 70 % 3PresentT (70 % 3)pl @(NegR 14 3 - Pos 5) ()Present (-29) % 3PresentT ((-29) % 3)pl @(CmpRat (PosR 14 3) 5) () Present LT PresentT LTpredicate-typed<create inductive tuples from a type level list of predicates:set -XTypeApplications:set -XDataKinds0pl @(TupleI '[Id,ShowP,Pred,W "str", W 999]) 666,Present (666,("666",(665,("str",(999,())))))-PresentT (666,("666",(665,("str",(999,())))))predicate-typed&Convenient method to convert a 'p' or '\q' to a s based on a predicate '\b\'$ if 'b' then Right 'p' else Left '\q\':set -XTypeApplications:set -XDataKinds?pl @(EitherB (Fst > 4) (Snd >> Fst) (Snd >> Snd)) (24,(-1,999))Present Right 999PresentT (Right 999)>pl @(EitherB (Fst > 4) (Snd >> Fst) (Snd >> Snd)) (1,(-1,999))Present Left (-1)PresentT (Left (-1))predicate-typed.Convenient method to convert a value 'p' to a t based on a predicate '\b\' if '\b\' then Just 'p' else Nothing:set -XTypeApplications:set -XDataKindspl @(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 :set -XTypeApplications:set -XDataKinds*pl @(Do [Pred, ShowP, Id &&& Len]) 9876543Present ("9876542",7)PresentT ("9876542",7)predicate-typedconverts a value to a u: the same as  '\'Proxy':set -XTypeApplications:set -XDataKindspl @MkProxy 'x' Present ProxyPresentT Proxypredicate-typedv function:set -XTypeApplications:set -XDataKindspl @(Floor Int Id) (23 % 5) Present 4 PresentT 4predicate-typedw function:set -XTypeApplications:set -XDataKindspl @(Ceiling Int Id) (23 % 5) Present 5 PresentT 5predicate-typedx function:set -XTypeApplications:set -XDataKindspl @(Truncate Int Id) (23 % 5) Present 4 PresentT 4predicate-typedy function:set -XTypeApplications:set -XDataKinds#pl @(FromRational Rational Id) 23.5Present 47 % 2PresentT (47 % 2)predicate-typedz function:set -XTypeApplications:set -XDataKindspl @(ToRational Id) 23.5Present 47 % 2PresentT (47 % 2)predicate-typed{ function:set -XTypeApplications:set -XDataKinds#pl @(FromIntegral (SG.Sum _) Id) 23Present Sum {getSum = 23}PresentT (Sum {getSum = 23})predicate-typed| function:set -XTypeApplications:set -XDataKinds"pl @(FromInteger (SG.Sum _) Id) 23Present Sum {getSum = 23}PresentT (Sum {getSum = 23})predicate-typed} function:set -XTypeApplications:set -XDataKinds: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-typedGidentity function that also displays the type information for debuggingeven more constraints than 4 so we might need to explicitly add types (Typeable):set -XTypeApplications:set -XDataKinds pl @IdT 23 Present 23 PresentT 23predicate-typed)identity function that displays the inputeven more constraints than 1 so we might need to add explicit type signatures:set -XTypeApplications:set -XDataKinds pl @Id 23 Present 23 PresentT 23predicate-typedidentity function:set -XTypeApplications:set -XDataKindspl @I 23 Present 23 PresentT 23predicate-typed$access to third element in a 3-tuple:set -XTypeApplications:set -XDataKindspl @Thd3 (10,True,"Abc") Present "Abc"PresentT "Abc"predicate-typed~ for a 3-tuple:set -XTypeApplications:set -XDataKindspl @Snd3 (10,"Abc",True) Present "Abc"PresentT "Abc"predicate-typed for a 3-tuple:set -XTypeApplications:set -XDataKindspl @Fst3 (10,"Abc",True) Present 10 PresentT 10predicate-typed similar to ~:set -XTypeApplications:set -XDataKindspl @Snd (10,"Abc") Present "Abc"PresentT "Abc"predicate-typed similar to :set -XTypeApplications:set -XDataKindspl @Fst (10,"Abc") Present 10 PresentT 10predicate-typed similar to :set -XTypeApplications:set -XDataKinds#pl @(FthL _ Id) (10,"Abc",'x',True) Present True PresentT True predicate-typed similar to :set -XTypeApplications:set -XDataKindspl @(ThdL _ Id) (10,"Abc",'x') Present 'x' PresentT 'x' predicate-typed similar to :set -XTypeApplications:set -XDataKindspl @(SndL _ Id) (10,"Abc") Present "Abc"PresentT "Abc" predicate-typed similar to :set -XTypeApplications:set -XDataKindspl @(FstL _ Id) (10,"Abc") Present 10 PresentT 10predicate-typed similar to  for M instances:set -XTypeApplications:set -XDataKindspl @(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 4predicate-typed similar to :set -XTypeApplications:set -XDataKindspl @Len [10,4,5,12,3,4] Present 6 PresentT 6 pl @Len [] Present 0 PresentT 0predicate-typed sort a list:set -XTypeApplications:set -XDataKindsJpl @(SortOn Fst 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")]predicate-typed similar to :set -XTypeApplications:set -XDataKindspl @Max [10,4,5,12,3,4] Present 12 PresentT 12 pl @Max []Error empty listFailT "empty list"predicate-typed similar to :set -XTypeApplications:set -XDataKindspl @Min [10,4,5,12,3,4] Present 3 PresentT 3 pl @Min []Error empty listFailT "empty list"predicate-typed uses the B of the given type 't' and 'p' which points to the content to read:set -XTypeApplications:set -XTypeOperators:set -XDataKindspl @(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"FalseFalseTpredicate-typed uncreate a  returning year month and day:set -XTypeApplications:set -XDataKindspl @UnMkDay (read "2019-12-30")Present (2019,(12,30))PresentT (2019,(12,30))predicate-typed create a 6 from three int values passed in as year month and day:set -XTypeApplications:set -XDataKinds:set -XTypeOperators8pl @(MkDay Fst (Snd >> Fst) (Snd >> Snd)) (2019,(12,30))Present Just (2019-12-30,(1,1))"PresentT (Just (2019-12-30,(1,1)));pl @(MkDay Fst (Snd >> Fst) (Snd >> Snd)) (2019,(99,99999))Present NothingPresentT Nothing7pl @(MkDay Fst (Snd >> Fst) (Snd >> Snd)) (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 match:set -XTypeApplications:set -XDataKindspl @(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 Snd) (["%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:set -XTypeApplications:set -XDataKinds;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 tuple predicate-typedBtype level expression representing a formatted time similar to  using a type level 8 to get the formatting string:set -XTypeApplications:set -XDataKindsFpl @(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"Lpl @(FormatTimeP Fst Snd) ("the date is %d/%m/%Y", read "2019-05-24" :: Day) Present "the date is 24/05/2019"!PresentT "the date is 24/05/2019"!predicate-typed similar to :set -XTypeApplications:set -XDataKindspl @ShowP [4,8,3,9]Present "[4,8,3,9]"PresentT "[4,8,3,9]" pl @ShowP 'x' Present "'x'"PresentT "'x'""predicate-typedsplit a list into single values:set -XTypeApplications:set -XDataKindspl @Ones [4,8,3,9]Present [[4],[8],[3],[9]]PresentT [[4],[8],[3],[9]] pl @Ones [] Present [] PresentT []#predicate-typed similar to :set -XTypeApplications:set -XDataKindspl @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 [[]]$predicate-typed similar to :set -XTypeApplications:set -XDataKindspl @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 [[]]%predicate-typedconverts a string * value to upper case:set -XTypeApplications:set -XDataKindspl @ToUpper "HeLlO wOrld!"Present "HELLO WORLD!"PresentT "HELLO WORLD!"&predicate-typedconverts a string * value to lower case:set -XTypeApplications:set -XDataKindspl @ToLower "HeLlO wOrld!"Present "hello world!"PresentT "hello world!">predicate-typed(a predicate for determining if a string # belongs to the given character set:set -XTypeApplications:set -XDataKindsimport qualified Data.Text as Tpl @IsLower "abc"TrueTrueTpl @IsLower "abcX"FalseFalseTpl @IsLower (T.pack "abcX")FalseFalseTpl @IsHexDigit "01efA"TrueTrueTpl @IsHexDigit "01egfA"FalseFalseT?predicate-typedOA replacement function ([String] -> String) which yields the groups Used by ( and ( Requires Text.Show.Functions:m + Text.Show.Functionspl @(ReplaceAll "^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$" (MakeRR3 Fst) Snd) (\ys -> intercalate " | " $ map (show . succ . read @Int) ys, "141.201.1.22")Present "142 | 202 | 2 | 23"PresentT "142 | 202 | 2 | 23"@predicate-typedQA replacement function (String -> String) that yields the whole match Used by ( and ( Requires Text.Show.Functions:m + Text.Show.FunctionsNpl @(ReplaceAll "\\." (MakeRR2 Fst) Snd) (\x -> x <> ":" <> x, "141.201.1.22")Present "141.:.201.:.1.:.22"PresentT "141.:.201.:.1.:.22"Apredicate-typednA replacement function (String -> [String] -> String) which returns the whole match and the groups Used by ( and ( Requires Text.Show.FunctionsBpredicate-typedSimple replacement string: see E and CKpredicate-typed6replaces regex 's' with a string 's1' inside the value:set -XTypeApplications:set -XDataKinds2pl @(ReplaceAllString "\\." ":" Id) "141.201.1.22"Present "141:201:1:22"PresentT "141:201:1:22"Mpredicate-typed$splits a string on a regex delimiter:set -XTypeApplications:set -XDataKinds%pl @(Resplit "\\." Id) "141.201.1.22"Present ["141","201","1","22"]PresentT ["141","201","1","22"]Opredicate-typed similar to PB but gives the column start and ending positions instead of values:set -XTypeApplications:set -XDataKinds?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)])]Qpredicate-typedLruns a regex matcher returning the original values and optionally any groups:set -XTypeApplications:set -XDataKinds9pl @(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"])]Spredicate-typedrepresents a predicate using a 8& as a regular expression evaluates R% and returns True if there is a match:set -XTypeApplications:set -XDataKinds/pl @(Re "^\\d{2}:\\d{2}:\\d{2}$" Id) "13:05:25"TrueTrueTTpredicate-typed equivalent[predicate-typed:a type level predicate for all negative elements in a list\predicate-typed:a type level predicate for all positive elements in a list]predicate-typedThis is the same as ^ but where 'r' is ^predicate-typedlA predicate that determines if the value is between 'p' and 'q' The values can be rational numbers using  or plain Natural numbers_predicate-typed5a type level predicate for a strictly decreasing list`predicate-typed6a type level predicate for a monotonic decreasing listapredicate-typed5a type level predicate for a strictly increasing listbpredicate-typed6a type level predicate for a monotonic increasing listcpredicate-typedUThis is the core class. Each instance of this class can be combined into a dsl using fpredicate-typedA specialised form of e that works only on predicateswpredicate-typed () function:set -XTypeApplications:set -XDataKinds pl @() "Asf" Present () PresentT ()xpredicate-typed(converts the value to the corresponding u:set -XTypeApplications:set -XDataKindspl @'Proxy 'x' Present ProxyPresentT Proxyypredicate-typedBextracts the (a,b) from type level 'These a b' if the value exists:set -XTypeApplications:set -XDataKinds$pl @('These Id Id) (These 123 "abc")Present (123,"abc")PresentT (123,"abc"))pl @('These Pred Len) (These 123 "abcde")Present (122,5)PresentT (122,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"zpredicate-typed@extracts the 'b' from type level 'These a b' if the value exists:set -XTypeApplications:set -XDataKindspl @('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"{predicate-typed@extracts the 'a' from type level 'These a b' if the value exists:set -XTypeApplications:set -XDataKindspl @('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"|predicate-typedAextracts the 'b' from type level 'Either a b' if the value exists:set -XTypeApplications:set -XDataKindspl @('Right Id) (Right 123) Present 123 PresentT 123pl @('Right Id) (Left "aaa")Error 'Right found LeftFailT "'Right found Left"}predicate-typedAextracts the 'a' from type level 'Either a b' if the value exists:set -XTypeApplications:set -XDataKindspl @('Left Id) (Left 123) Present 123 PresentT 123pl @('Left Id) (Right "aaa")Error 'Left found RightFailT "'Left found Right"~predicate-typedexpects Nothing otherwise it fails if the value is Nothing then it returns 'Proxy a' as this provides more information than '()':set -XTypeApplications:set -XDataKindspl @'Nothing Nothing Present ProxyPresentT Proxypl @'Nothing (Just True)Error 'Nothing found JustFailT "'Nothing found Just"predicate-typed>extracts the 'a' from type level 'Maybe a' if the value exists:set -XTypeApplications:set -XDataKindspl @('Just Id) (Just 123) Present 123 PresentT 123pl @('Just Not) (Just True) Present FalsePresentT Falsepl @('Just Id) NothingError 'Just found NothingFailT "'Just found Nothing"predicate-typed2runs each predicate in turn from the promoted list:set -XTypeApplications:set -XDataKinds:set -XNoStarIsTypepl @'[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]&pl @'[W 1, W 2, W 3, Id * 4, Pred] 999Present [1,2,3,3996,998]PresentT [1,2,3,3996,998]:set -XTypeOperatorspl @'[Id * 4, Pred] 999Present [3996,998]PresentT [3996,998]predicate-typed=extracts the value level representation of the type level '[]:set -XTypeApplications:set -XDataKinds pl @'[] False Present [] PresentT []predicate-typed=extracts the value level representation of the type level '():set -XTypeApplications:set -XDataKinds pl @'() () Present () PresentT ()predicate-typed:extracts the value level representation of the type level :set -XTypeApplications:set -XDataKinds pl @123 () Present 123 PresentT 123predicate-typed8extracts the value level representation of the promoted :set -XTypeApplications:set -XDataKindspl @'LT "not used" Present LT PresentT LT pl @'EQ () Present EQ PresentT EQpredicate-typed(run the predicates in a promoted 4-tuple:set -XTypeApplications:set -XDataKinds!pl @'(Len, Id, "inj", 999) "helo"Present (4,"helo","inj",999)PresentT (4,"helo","inj",999)predicate-typed(run the predicates in a promoted 3-tuple:set -XTypeApplications:set -XDataKindspl @'(Len, Id, Reverse) "helo"Present (4,"helo","oleh")PresentT (4,"helo","oleh")predicate-typed5run the predicates in a promoted 2-tuple; similar to p:set -XTypeApplications:set -XDataKindspl @'(Snd, Fst) ("helo",123)Present (123,"helo")PresentT (123,"helo"):set -XTypeOperators'pl @'(Len, Id <> "|" <> Reverse) "helo"Present (4,"helo|oleh")PresentT (4,"helo|oleh")predicate-typedpulls the type level 8 to the value level:set -XTypeApplications:set -XDataKindspl @"hello world" ()Present "hello world"PresentT "hello world"predicate-typedpulls the type level  to the value level:set -XTypeApplications:set -XDataKindspl @'True "ignore this"TrueTrueT pl @'False ()FalseFalseTpredicate-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 , , !epredicate-typedreturns a tree of results<:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnqporstwvuxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123=<;:987654>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcedfghijklmnopqrstu<cedfba`_^]\[ZYXWVUTSRQPONMLgKJIHGFEDCBA@?>3=<;:987654120/.-,+*)('&%$#"!      ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!      hijlmknopqrs~}|{zyxtwvursnqpolmkjihgfedcba`_^]\[ZtXYWVUTSRQPONMLKJIHGFEDCBuA@?>=<;:&C1D0H3I4J4K4\64412311115574444444444447662233.Traditional refinement type with only one type(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None!%&',-.17:;<=>?@AHMPSUVX_kRzpredicate-typedthe constraints that { must adhere to{predicate-typedNa simple refinement type that ensures the predicate 'p' holds for the type 'a':set -XTypeApplications:set -XDataKinds :m + Data.Time.Calendar.WeekDate#prtRefinedIO @(Between 10 14) ol 13 Right (Refined {unRefined = 13})#prtRefinedIO @(Between 10 14) ol 99 Left FalseP:set -XTypeOperators@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) >> GuardsQuick (Printf2 "octet %d out of range %d") (RepeatT 4 (Between 0 255)) >> 'True) ol "141.213.1.444"'Left (FailP "octet 3 out of range 444")prtRefinedIO @(Map (ReadP Int) (Resplit "\\." Id) >> Guard (Printf "bad length: found %d" Len) (Len == 4) >> GuardsQuick (Printf2 "octet %d out of range %d") (RepeatT 4 (Between 0 255)) >> 'True) ol "141.213.1x34.444"&Left (FailP "ReadP Int (1x34) failed")>prtRefinedIO @(Map ('[Id] >> ReadP Int) Id >> Luhn) ol "12344"%Right (Refined {unRefined = "12344"})>prtRefinedIO @(Map ('[Id] >> ReadP Int) Id >> Luhn) ol "12340" Left FalseP*prtRefinedIO @(Any Prime) ol [11,13,17,18]+Right (Refined {unRefined = [11,13,17,18]})*prtRefinedIO @(All Prime) ol [11,13,17,18] Left FalsePKprtRefinedIO @(Snd !! Fst >> Len > 5) ol (2,["abc","defghij","xyzxyazsfd"])@Right (Refined {unRefined = (2,["abc","defghij","xyzxyazsfd"])})LprtRefinedIO @(Snd !! Fst >> Len > 5) ol (27,["abc","defghij","xyzxyazsfd"])#Left (FailP "(!!) index not found")LprtRefinedIO @(Snd !! Fst >> Len <= 5) ol (2,["abc","defghij","xyzxyazsfd"]) Left FalseP}predicate-typed value for {~predicate-typed binary operation applied to two w valuespredicate-typed%takes two values and lifts them into w& 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 w 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 { :set -XTypeApplications:set -XDataKindsimport Data.Timeimport 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 -XTypeApplications:set -XDataKinds: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 -XTypeApplications:set -XDataKinds:set -XOverloadedStrings@reads @(Refined (Between 0 255) Int) "Refined {unRefined = 254}" [(Refined {unRefined = 254},"")]@reads @(Refined (Between 0 255) Int) "Refined {unRefined = 300}"[]wxyz{|}~{|z}~wxyKRefinement type allowing the external type to differ from the internal type(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None%&',-.1:=>?@AHSUVX_kh 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:set -XTypeApplications:set -XDataKinds:set -XTypeOperators :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"})prtEval3 @(MkDay Fst (Snd >> Fst) (Snd >> Snd) >> 'Just Id) @(Guard "expected a Sunday" (Snd >> Snd == 7) >> 'True) @(Fst >> UnMkDay) ol (2019,(10,13))ERight (Refined3 {r3In = (2019-10-13,(41,7)), r3Out = (2019,(10,13))})prtEval3 @(MkDay Fst (Snd >> Fst) (Snd >> Snd) >> 'Just Id) @(Guard "expected a Sunday" (Snd >> Snd == 7) >> 'True) @(Fst >> UnMkDay) ol (2019,(10,12))9Left Step 2. Failed Boolean Check(op) | expected a Sundaytype T4 k = '(MkDay Fst (Snd >> Fst) (Snd >> Snd) >> 'Just Id, Guard "expected a Sunday" (Snd >> Snd == 7) >> 'True, Fst >> UnMkDay, 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))ERight (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 -XTypeApplications:set -XDataKinds: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  :set -XTypeApplications:set -XDataKindsimport Control.Arrow ((+++))import Data.Time3type K1 = MakeR3 '(ReadP Day, 'True, ShowP, String)itype K2 = MakeR3 '(ReadP Day, Between (ReadP' Day "2019-03-30") (ReadP' Day "2019-06-01"), ShowP, String)itype K3 = MakeR3 '(ReadP Day, Between (ReadP' Day "2019-05-30") (ReadP' Day "2019-06-01"), ShowP, 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 -XTypeApplications:set -XDataKinds: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 -XTypeApplications:set -XDataKinds: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%&',-.1:=>?@AHSUVX_kIpredicate-typedCtake any valid Read/Show instance and turn it into a valid Refined3:set -XTypeApplications:set -XDataKinds:set -XTypeOperators: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 (Pos 3) (Pos 5)))) ol "13 % 3"2Right (Refined3 {r3In = 13 % 3, r3Out = "13 % 3"})RprtEval3P (Proxy @(ReadShow' Rational (Between (NegR 11 2) (Neg 3)))) ol "-13 % 3"8Right (Refined3 {r3In = (-13) % 3, r3Out = "(-13) % 3"})AprtEval3P (Proxy @(ReadShow' Rational (Id > Pos 15))) ol "13 % 3"-Left Step 2. False Boolean Check(op) | FalsePprtEval3P (Proxy @(ReadShow' Rational (Guard (Printf "invalid=%3.2f" (FromRational Double Id)) (Id > Pos 15) >> 'True))) ol "13 % 3"4Left Step 2. Failed Boolean Check(op) | invalid=4.33AprtEval3P (Proxy @(ReadShow' Rational (Id > Pos 11))) 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':set -XTypeApplications:set -XDataKinds(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':set -XTypeApplications:set -XDataKinds'prtEval3P (Proxy @(BaseN 16)) ol "00fe"+Right (Refined3 {r3In = 254, r3Out = "fe"})predicate-typed'read in an ipv4 address and validate it:set -XTypeApplications:set -XDataKindsprtEval3P 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(3) 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(1) octet out of range 0-255 found 257predicate-typedread in an ssn:set -XTypeApplications:set -XDataKindsprtEval3P 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 0 invalid: found 666prtEval3P ssn ol "666-01-2211"MLeft Step 2. Failed Boolean Check(op) | number for group 0 invalid: found 666prtEval3P ssn ol "667-00-2211"KLeft Step 2. Failed Boolean Check(op) | number for group 1 invalid: found 0prtEval3P ssn ol "666-01-2211"MLeft Step 2. Failed Boolean Check(op) | number for group 0 invalid: found 666prtEval3P ssn ol "991-22-9999"MLeft Step 2. Failed Boolean Check(op) | number for group 0 invalid: found 991 predicate-typedread in a datetime:set -XTypeApplications:set -XDataKinds?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"})predicate-typedcredit card with luhn algorithm:set -XTypeApplications:set -XDataKinds!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 it:set -XTypeApplications:set -XDataKindsprtEval3P 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(2) 60 secs is out of rangeprtEval3P hms ol "26:13:59"ILeft Step 2. Failed Boolean Check(op) | guard(0) 26 hours is out of range>     >     KTemplate Haskell methods for creating Refined and Refined3 refinement types(c) Grant Weyburne, 2019 BSD-3 gbwey9@gmail.com None &'->HXk0predicate-typed creates a " refinement type with terse outputpredicate-typed creates a m refinement type and allows you to specify options (ol to just get a summary / o2 for full detail and colors)predicate-typed creates a {" refinement type with terse outputpredicate-typed creates a {2 refinement type and allows you to specify options !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\] ^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./012345678679:;<=><=?@A]@A_@A`@Aq@BC@BD@BE@FG@HIJKLJKMNOPJKQJKR@ST:UVNWXNWNW@YZ@Y[@Y\@Y]@^_@B`@Aa@Bb@^cJKd@ef@gh@Si@Sj:kl:mn:mo@^p:qr@^-@Ss@At@e@e@uv@Aw@Ax@Ay@Az@{|JK}@~@SNW@g@g@g@g::@^N:@@@@~@~@~@^@Y@e@u@@Y@Y@Y@Y@Y@Y@@@@::::@S@S@S@@@B@B@^@ANONONO.predicate-typed-0.1.0.0-J06RPW3nF4YCByiyXRpNzp TH_OrphansUtilP PredicateRefinedRefined3Refined3HelperUtilP_THPaths_predicate_typed ReplaceImplT stripLeft stripRightstrip stripStartstripEnd Control.Monadjoin Data.Alignalign Data.Listorsands Data.TextIsTextMain>> $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 NormalDispVerticalUnicodePPTreePOptsoShowAoDebugoDispoHideoColoroLitePColorunPColorHolderunHolderPE_pBool _pStringsBoolPFailPFalsePTruePPresentPBoolTFailTFalseTTrueTPresentTTT_tBool _tStrings_tForesttBooltStringstForestpStringsboolT2PpBoolmkNodemkNodeB partitionTTsgetTTLRpartitionTTExtendedgetValLRFromTTgetValLRshortTTfromTTfromTTHhh getValueLRgetValueLRHidegetValueLRImpldefOptsololco0o02o03o1o2o3setasetvsetdsetusetcsetc0setc1setc2setc3setc4color0color1color2color3color4defhdefvdefudefv'fixBoolTshowLit0showLit3showLitshowLit'show0show3showAshowA' compileRegex splitAndAlign formatList valsFromTTsisTrue_boolT groupErrors_FailT _PresentT_FalseT_TrueTimply evalBinStrictnatsymbgetLen showThesegetN toNodeString nullSpace showBoolPdisplayMessagescolorMeprtTTIOprtTTprtTT'prtTreeprtImplfixLite fixPresentP prtTreePureshowImplliteunicode horizontalvertical vertical'ppTreeprettyRationalfixit 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: $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 $fShowBoolTRepeatP 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 ReadBaseIntReadBase ReadBase'LuhnZipnZiprcZiplcZipExtractT ZipTheseFZipTheseChar1TheseidTheseInIsTheseIsThatIsThisIsTh FromListFFromList ToListExtToList UnIToListTIToListIToList'NeLtLeSameGeGtCmpICmp===?OrdIOrdAOrdA'===OrdPImply~>OR||And&&<<>||>Skip ExitWhen'ExitWhenGuard'Guard GuardsImplW GuardsQuick GuardsLaxGuards GuardsImplOnePRemQuotQuotRemDivModModDivMod'Div'OddEven FailCatchCatch'CatchWUnproxyHoleFailPrt2FailPrtFailSFailtFailpFailSpanBreakFilterBy PartitionPairsIfMapTX ConcatMapMap IterateNUntil IterateNWhile IterateWhile IterateUntilIterateNUnfoldrUnfoldTFoldlRepeatScanNAScanNScanl CatMaybesz CatMaybesy CatMaybesx CatMaybesaThesesThatsThissPartitionThesePartitionEithers CatMaybesMapMaybe EnumFromToNullIsEmptyUnsnocUncons+::+Ors'OrsAnds'AndsLookup'!!!Lookup!!IxLIx'IxProxyTProxyT'ConcatMin'SumFoldMapMConcatMkTheseMkThatMkThat'MkThisMkThis'MkRightMkRight'MkLeftMkLeft'MkJust MkNothing 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'ElemAllElemKeepRemoveKeepImplNotPrimeToEnumBFToEnumBToEnumB'ToEnumToEnum'FromEnumPredSuccPredB'PredBSuccB'SuccBSwapReverseLReverseLeftRightPure2MemptyT2 MemptyT2'Coerce2CoerceWrapWrap'UnwrapSignumAbsNegate/DivFBinGetBinOpgetBinOp=?>?<<=/===>=>*-+SubAddMultBinOpBMultBSubBAddDup+++IsRightIsLeftEitherIn|||SecondFirstStar***&&&LastInitHeadTailDropTakeSplitAtSplitAtsPadRPadLPadMsg'MsgGetRatgetRatGetRatsgetRatsCmpRatNegRPosRNegPosRatTupleIEitherBMaybeBDo DoExpandTMkProxyFloorFloor'CeilingCeiling'Truncate Truncate' FromRational FromRational' ToRational FromIntegral FromIntegral' FromIntegerP FromInteger FromInteger' FromStringP FromStringP'IdTIdIThd3Snd3Fst3SndFstFthLFthL'ThdLThdL'SndLSndL'FstLFstL'LengthLen SortByHelper SortOnDescSortOnSortByMax'MaxMinReadP'ReadPReadP''UnMkDayMkDay 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'AscPPPevalevalBool_MX strictmsgpe0pepexpe1pe2pe3plplcpeWith getValidBasegetStringPrefixrunPQ evalQuick $fPTYPEProxya $fPTYPE()a$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 $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[] $fPTYPEOnesas$fPTYPEShowPas$fPTYPEFormatTimePx$fPTYPEParseTimeP'a$fPTYPEParseTimes'a $fPTYPEMkDayx$fPTYPEUnMkDaya$fPTYPEReadP''x $fPTYPEMin[] $fPTYPEMax[] $fPTYPELenas$fPTYPELengthx $fPTYPEFstL'x $fPTYPESndL'x $fPTYPEThdL'x $fPTYPEFthL'x $fPTYPEFst(,) $fPTYPESnd(,)$fPTYPEFst3(,,)$fPTYPESnd3(,,)$fPTYPEThd3(,,) $fPTYPEIa $fPTYPEIda $fPTYPEIdTa$fPTYPEFromStringP'a$fPTYPEFromInteger'a$fPTYPEFromIntegral'a$fPTYPEToRationalx$fPTYPEFromRational'a$fPTYPETruncate'x$fPTYPECeiling'x$fPTYPEFloor'x$fPTYPEMkProxya$fPTYPEMaybeBa$fPTYPEEitherBa$fPTYPETupleIa$fPTYPETupleIa0 $fPTYPERata $fGetRats[][]$fGetRatTYPERat $fGetRatNatn $fGetRats[]: $fPTYPEMsga $fPTYPEPada$fPTYPESplitAtsx$fPTYPESplitAta $fPTYPE***(,)$fPTYPE|||Either$fPTYPE+++Either$fGetBinOpBAdd$fGetBinOpBSub$fGetBinOpBMult $fPTYPEBina $fPTYPEDivFa$fPTYPENegatea $fPTYPEAbsa$fPTYPESignuma$fPTYPEUnwraps $fPTYPEWrap'x$fPTYPECoercea$fPTYPECoerce2f$fPTYPEMemptyT2'f $fPTYPEPure2f$fPTYPEReverseas$fPTYPEReverseLt $fPTYPESwapp $fPTYPESuccBa $fPTYPEPredBa $fPTYPESucca $fPTYPEPreda$fPTYPEFromEnuma$fPTYPEToEnum'a$fPTYPEToEnumB'a $fPTYPEPrimea $fPTYPENota$fPTYPEKeepImplx $fPTYPEElema$fPTYPEFmap_1f$fPTYPEFmap_2f$fPTYPEMaybeXPx$fPTYPELeftToMaybeEither$fPTYPERightToMaybeEither$fPTYPEThisToMaybeThese$fPTYPEThatToMaybeThese$fPTYPETheseToMaybeThese$fPTYPEEitherXx$fPTYPETheseXx$fPTYPEMaybeInMaybe$fPTYPESTimesa $fPTYPEPurex$fPTYPEMemptyT'a$fPTYPEMemptyProxyProxy$fPTYPEEmptyTa$fPTYPEMkNothing'a$fPTYPEMkJusta$fPTYPEMkLeft'x$fPTYPEMkRight'x$fPTYPEMkThis'x$fPTYPEMkThat'x$fPTYPEMkThesea$fPTYPEMConcat[]$fPTYPEProxyT'a $fPTYPEIx[] $fPTYPEIxLa$fPTYPELookupa $fPTYPEAndsas $fPTYPEOrsas $fPTYPE:+x $fPTYPE+:x$fPTYPEUnconss$fPTYPEUnsnocs$fPTYPEIsEmptyas $fPTYPENullas$fPTYPEEnumFromTox$fPTYPEPartitionEithers[]$fPTYPEPartitionThese[] $fPTYPEScanlx$fPTYPEUnfoldra $fPTYPEMapx$fPTYPEConcatx $fPTYPEIfa$fPTYPEPairs[]$fPTYPEPartitiona $fPTYPEBreaka $fPTYPEFaila $fPTYPEHolea$fPTYPEUnproxyProxy $fPTYPEWa $fPTYPECatchx $fPTYPEDiva $fPTYPEModa$fPTYPEDivModa$fPTYPEQuotRema$fPTYPEGuardsImpl[]$fPTYPEGuardsImpl[]0$fPTYPEGuardsImplW[] $fPTYPEGuarda $fPTYPESkipa $fPTYPE>>a $fPTYPEDoa $fPTYPE&&a $fPTYPE||a $fPTYPE~>a $fPTYPEOrdPa $fPTYPEOrdIa $fPTYPECmpa $fPTYPECmpIa$fPTYPEIToList'x$fPTYPEToListt$fPTYPEToListExtl$fPTYPEFromList[]$fPTYPEFromListFl$fPTYPEIsThThese$fPTYPETheseInThese $fPTYPEChar1a$fPTYPEZipThesea $fPTYPEZipa $fPTYPELuhna$fPTYPEReadBase'x$fPTYPEShowBasea$fPTYPEIntercalatea$fPTYPEPrintfx$fPTYPEParaImpl[]$fPTYPEParaImpl[]0$fPTYPEParaImpl[]1$fPTYPEParaImplW[]$fPTYPECaseImplx$fPTYPECaseImplx0$fPTYPECaseImplx1$fPTYPECaseImplx2$fPTYPECaseImplx3 $fPTYPECasex$fPTYPESequencet $fPTYPEHidea$fPTYPESortByx$fPTYPEReadFilex$fPTYPEReadDirx$fPTYPEReadEnvx$fPTYPEReadEnvAlla $fPTYPETimeUa $fPTYPETimeZa$fGetFHandleFStderr$fGetFHandleFStdout$fGetModeWFWrite$fGetModeWFWriteForce$fGetModeWFAppend$fGetFHandleFOther$fPTYPEWritefileImpla $fPTYPEStdina$fPTYPEIsFixImpla $fPTYPE<>a $fPrintC(,) $fPrintC()$fPTYPETupleListImpl[]$fPTYPEReverseTupleNtp$fPTYPEPrintfnx$fPTYPEZipTheseFa $fPTYPE<$a $fPTYPE<*a $fPTYPE<|>a$fPTYPEExtractt$fPTYPEDuplicatet $fPTYPEJoint $fPTYPE$x $fPTYPETrim'x$fPTYPEStripLRx$fPTYPERepeatPx $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 Ip4strictREOctetREHms4HmsvalHmsconvHmsREIpfmtIpop'IpopIpipIp1IpHmsfmtHmsopHmsipHmsSsnfmtSsnop'SsnopSsnipSsnDtfmt1Dtop1Dtip1 DateTime1CC11CcnCcfmtCcopCcipccncc11ssnhmsipip1hms4base16daten datetimen refined3TH refined3TH' refinedTH refinedTH'version getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName)pcre-heavy-1.0.0.2-GdMJ7fYuC1v24AoDQBpX5eText.Regex.PCRE.Heavysubgsub"lens-4.18.1-IDE8Foj3jGs23LlLnxEovEData.Text.Lens$comonad-5.0.5-1t7DDbZbcMSAgTS70WFpTSControl.Comonad duplicateextractbaseGHC.Base Data.OldList isInfixOf isPrefixOf isSuffixOf System.IOreadFileData.Traversable sequenceA"these-1.0.1-17k2aWolCwBKnK3u9uZqrX Data.TheseThisThatghc-prim GHC.TypesSymboltheseThese Data.FoldabletoListControl.Lens.IndexeditoList GHC.ClassescompareGHC.RealquotRemdivModmoddivGHC.Listbreak partitionmapunfoldrscanlpartitionThese Data.EitherpartitionEithersGHC.Enum enumFromTonullFoldableControl.Lens.EmptyAsEmptyControl.Lens.ConsunsnocunconslookupControl.Lens.AtIxedconcatmconcat GHC.MaybeJustemptymemptypurestimes Data.MaybemaybemergeTheseWith Control.ArrowelemnottoEnumfromEnumpredsuccControl.Lens.IsoswappedControl.Lens.Internal.Iso reversingreverseGHC.PrimcoerceControl.Lens.WrappedWrappedGHC.NumsignumabsnegatesplitAtRationalEitherMaybe Data.ProxyProxyfloorceilingtruncate fromRational toRational fromIntegral fromInteger Data.String fromString Data.TuplesndfstControl.Lens.Tuple_4_3_2_1lengthmaximumminimumGHC.ReadRead time-1.8.0.2Data.Time.Calendar.DaysDayData.Time.Format.Parse parseTimeM ParseTimeData.Time.Format formatTimeGHC.ShowshowtailsinitsunzipconstNatOrderingBool(QuickCheck-2.13.2-1FftnVviu6BCWJanU0jy5VTest.QuickCheck.Arbitrary arbitrary$aeson-1.4.5.0-8OME7V7jjGV1A7y7EkcVexData.Aeson.Types.ToJSONToJSONbinary-0.8.6.0Data.Binary.ClassBinaryData.Aeson.Types.FromJSONFromJSON