úÎvÁpz;      !"#$%&'()*+,-./0123456789:non-portable (see .cabal) experimental$Brent Yorgey <byorgey@cis.upenn.edu>None#Concatenation of lists. Instances: $ type instance Nil :++: xs = xs 3 type instance (h:*:t) :++: xs = h :*: (t :++: xs) non-portable (see .cabal) experimental$Brent Yorgey <byorgey@cis.upenn.edu>None;The API presented by !Data.Pattern.Base.Difference.GADT and  #Data.Pattern.Base.Difference.Coerce. An instance of ; is a = type which converts an inductively-defined type to one with  an efficient append operation. <constructs the empty d t. = appends two d ts. >given a "cons"% operation, constructs the singleton d t. ?given a "nil" value, "runs" the d t. @ABCDEFGHIJKLMN;<=>?OPQRSTUM;<=>?@ABCDEFGHIJKLMN;<=>?OPQRSTUnon-portable (see .cabal) experimental$Brent Yorgey <byorgey@cis.upenn.edu>NoneTuples with types given by xs. Curried functions. We have Fun ' [x1, ..., xn] r = x1 -> ... -> xn -> rThe empty tuple The singleton tuple Concatenation of tuples. 3Runs a tuple by applying it to a curried function. V?Runs a tuple by applying it to an uncurried function expecting  nested pairs. WXYZ[\]^_ V`abcdefgh   WXYZ[\]^_ V`abcdefghnon-portable (see .cabal) experimental$Brent Yorgey <byorgey@cis.upenn.edu>None 7Pattern-match clauses. Typically something of the form  pattern  functionAwhere the function takes one argument for each variable bound by  the pattern.  Clauses can be constructed with () , run with tryMatch,  and manipulated by the i and j instances. In  particular, the () operator from the k class 3 is the way to list multiple cases in a pattern. #Extract the underlying computation  constituting a  . This % function is not intended to be used  directly; instead, see match,  tryMatch, mmatch, and elim from  Data.Pattern.Common. "The pattern type. A value of type Pattern vars a is a pattern  which matches values of type a and binds variables with types  given by the type-list vars". For example, something of type  # Pattern (a :*: c :*: Nil) (a,b,c) @is a pattern which matches against a triple and binds values of  types a and c0. (A pattern of this type can be constructed as  tup3 var __ var.) Many "normal", patterns can be conveniently defined using mk0,  mk1, mk2 , and so on.  Construct a  + from a pattern and a function which takes E one argument for each variable bound by the pattern. For example,  pair __ nothing ->> 3 % pair var nothing ->> \x -> x + 3 + pair var (just var) ->> \x y -> x + y + 3  l     l non-portable (see .cabal) experimental$Brent Yorgey <byorgey@cis.upenn.edu>None$FVariable pattern: always succeeds, and binds the value to a variable. give b1 always succeeds, ignoring the matched value and  providing the value b& instead. Useful in conjunction with  ()< for providing default values in cases that would otherwise  not bind any values. BWildcard pattern: always succeeds, binding no variables. (This is  written as two underscores.) !Failure pattern: never succeeds. :Predicate pattern. Succeeds if the given predicate yields m,  fails otherwise. Can be used with ()* for some uses similar to pattern guards:   match a $ # left (var /\ is even) ->> id ( <|> left __ ->> const 0 ( <|> right __ ->> const 1  Note that  is like 5 but with n instead of o  (). ;Constant pattern: test for equality to the given constant. cst x = is (==x). AConjunctive (and) pattern: matches a value against two patterns, C and succeeds only if both succeed, binding variables from both. (/\) = 7 (\a -> Just (a,a))<Disjunctive (or) pattern: matches a value against the first B pattern, or against the second pattern if the first one fails. =View pattern: do some computation, then pattern match on the  result. Convenient infix synonym for . >Partial view pattern: do some (possibly failing) computation, F then pattern match on the result if the computation is successful. Convenient infix synonym for .  pfilter p matches every element of a p data structure  against the pattern p), discarding elements that do not match. D From the matching elements, binds a list of values corresponding  to each pattern variable. pmap p matches every element of a q data ! structure against the pattern p!. The entire match fails if any ! of the elements fail to match p. If all the elements match,  binds a t6-structure full of bound values corresponding to each  variable bound in p.  pfoldr p f b matches every element of a p data ! structure against the pattern p, discarding elements that do @ not match. Folds over the bindings produced by the matching ( elements to produce a summary value. :The same functionality could be achieved by matching with   pfilter p2 and then appropriately combining and folding the 7 resulting lists of bound values. In particular, if p binds  only one value we have  E match t (pfoldr p f b ->> id) === match t (pfilter p ->> foldr f b) However, when p1 binds more than one value, it can be convenient @ to be able to process the bindings from each match together, D rather than having to deal with them once they are separated out  into separate lists. "Runs" a  /, by matching it against a value and returning  a result if it matches, or Nothing if the match fails. !! satisfies the identity #match a c = fromJust (tryMatch a c). " mmatch m p = m >>= # p?Useful for applicative-looking monadic pattern matching, as in  ex7 :: IO ()  ex7 = mmatch getLine $  cst "" ->> return () . <|> var ->> putStrLn . ("You said " ++) #  elim = flip !/Useful for anonymous matching (or for building " eliminators",  like r and s). For example: $ either withLeft withRight = elim $ % left var ->> withLeft & <|> right var ->> withRight $Match True. %Match False. &!A strict match on the unit value (). 'A synonym for &. (BConstruct a pattern match against a pair from a pair of patterns. )A synonym for (. *Match a 3-tuple. +Match a 4-tuple. ,Match a 5-tuple. - Match the t constructor of o. . Match the u constructor of o. / Match the v constructor of w. 0 Match the x constructor of w. 1Match the empty list. 2Match a cons. 3 Match zero. 4AMatch a natural number which is the successor of another natural A (and match the predecessor with a nested pattern). Together,  3 and 4 allow viewing Integral types as Peano numbers.  Note that 4! never matches negative numbers. , !"#$%&'()*+,-./01234yz56789:* !"#$%&'()*+,-./0123456789:*! "#$%&'()*+,-./0123456789:, !"#$%&'()*+,-./01234yz56789:non-portable (see .cabal) experimental$Brent Yorgey <byorgey@cis.upenn.edu>None;  !"#$%&'()*+,-./0123456789:{      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHHIIJKLMNOPPQRRSTUVWXYZ[\]]^_`abcdefghijklmnopqrpqstuvwxytz{|t}t~{{€{‚ƒ„first-class-patterns-0.3.2Data.Pattern.BaseData.Pattern.Base.TypeListData.Pattern.Base.TupleData.Pattern.CommonData.Pattern.Base.Difference Data.PatternbaseControl.Applicative<|>:++: Distribute distributeMapTupleFunzeroToneT<>runTupleClause runClausePattern runPattern->>vargive__pfailiscst/\\/view-->tryView-?>pfilterpmappfoldrtryMatchmatchmmatchelimtruefalseunittup0pairtup2tup3tup4tup5nothingjustleftrightnilconszerosucmk0mk1mk2mk3mk4mk5 DifferencezeroDplusDmkOneDevalDCoerceDListD:==:EqualListclosureassoc rightIdentGadtDProxyDproxyassoc2 rightIdent2$fDifferenceCoerceD$fList:$fList[]$fDifferenceGadtD runTupleTTupablemkTupleTuple' runTuple' UncurriableuncurryTTup unconsTuple tupleHead tupleTail $fDistribute:$fDistribute[] $fTupable: $fTupable[]$fUncurriable:$fUncurriable[]GHC.BaseMonad Control.Monad MonadPlus Alternativeghc-prim GHC.TypesTrueBool Data.MaybeMaybe Data.FoldableFoldableData.Traversable Traversablemaybe Data.EithereitherNothingJustLeftEitherRighttwice succtwice