-j      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghie(C) 2011-2014 Edward Kmett, (C) 2010 Tony Morris, Oliver Taylor, Eelis van der Weegen BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Trustworthy+0=K6v produces a new stream by repeatedly applying the unfolding function to the seed value to produce an element of type b= and a new seed value. When the unfolding function returns j/ instead of a new seed value, the stream ends.( efficiently turns a normal list into a  stream, producing j if the input is empty.[ produces the first element of the stream, and a stream of the remaining elements, if any.(Extract the first element of the stream..Extract the possibly-empty tail of the stream. 'Extract the last element of the stream.!9Extract everything except the last element of the stream."!Prepend an element to the stream.# Synonym for ".$Sort a stream.%Converts a normal list to a  stream.'Raises an error if given an empty list.&.Convert a stream to a normal list efficiently.k"Lift list operations to work on a  stream.BewareL: If the provided function returns an empty list, this will raise an error.'Map a function over a  stream.(The ( function takes a stream xs) and returns all the finite prefixes of xs.)The ) function takes a stream xs" and returns all the suffixes of xs.** x xs inserts x into the last position in xs where it is still less than or equal to the next element. In particular, if the list is sorted beforehand, the result will also be sorted.++ x sequences x one or more times.,, is similar to lC, but returns a stream of successive reduced values from the left: Bscanl f z [x1, x2, ...] == z :| [z `f` x1, (z `f` x1) `f` x2, ...] Note that $last (scanl f z xs) == foldl f z xs.-- is the right-to-left dual of , . Note that $head (scanr f z xs) == foldr f z xs... is a variant of ,% that has no starting value argument: Dscanl1 f [x1, x2, ...] == x1 :| [x1 `f` x2, x1 `f` (x2 `f` x3), ...]// is a variant of -% that has no starting value argument.0B'intersperse x xs' alternates elements of the list with copies of x. ,intersperse 0 (1 :| [2,3]) == 1 :| [0,2,0,3]11 f x= produces the infinite sequence of repeated applications of f to x. %iterate f x = x :| [f x, f (f x), ..]22 xs$ returns the infinite repetition of xs: $cycle [1,2,3] = 1 :| [2,3,1,2,3,...]33 a finite NonEmpty stream.44 x= returns a constant stream, where all elements are equal to x.55 n xs returns the first n elements of xs.66 n xs drops the first n) elements off the front of the sequence xs.77 n xs, returns a pair consisting of the prefix of xs of length n< and the remaining stream immediately following this prefix. ['splitAt' n xs == ('take' n xs, 'drop' n xs) xs == ys ++ zs where (ys, zs) = 'splitAt' n xs88 p xs+ returns the longest prefix of the stream xs for which the predicate p holds.99 p xs% returns the suffix remaining after 8 p xs.:: p xs returns the longest prefix of xs that satisfies p,, together with the remainder of the stream. _'span' p xs == ('takeWhile' p xs, 'dropWhile' p xs) xs == ys ++ zs where (ys, zs) = 'span' p xs;The ; p function is equivalent to : (not . p).<< p xs removes any elements from xs that do not satisfy p.=The = function takes a predicate p and a stream xsN, and returns a pair of lists. The first list corresponds to the elements of xs for which p3 holds; the second corresponds to the elements of xs for which p does not hold. 9'partition' p xs = ('filter' p xs, 'filter' (not . p) xs)>The > function takes a stream and returns a list of streams such that flattening the resulting list is equal to the argument. Moreover, each stream in the resulting list contains only equal elements. For example, in list notation: d'group' $ 'cycle' "Mississippi" = "M" : "i" : "ss" : "i" : "ss" : "i" : "pp" : "i" : "M" : "i" : ...?? operates like >7, but uses the provided equality predicate instead of m.@@ operates like >], but uses the knowledge that its input is non-empty to produce guaranteed non-empty output.AA is to @ as ? is to >.BThe isPrefix function returns True2 if the first argument is a prefix of the second.Cxs !! n# returns the element of the stream xs at index n/. Note that the head of the stream has index 0.Beware8: a negative or out-of-bounds index will cause an error.DThe DI function takes two streams and returns a stream of corresponding pairs.EThe E function generalizes Dp. Rather than tupling the elements, the elements are combined using the function passed as the first argument.FThe F function is the inverse of the D function.GThe Ge function breaks a stream of characters into a stream of words, which were delimited by white space.BewareZ: if the input contains no words (i.e. is entirely whitespace), this will cause an error.HThe H% function is an inverse operation to G). It joins words with separating spaces.Beware : the input  ("" :| []) will cause an error.IThe I function breaks a stream of characters into a stream of strings at newline characters. The resulting strings do not contain newlines.JThe J% function is an inverse operation to IA. It joins lines, after appending a terminating newline to each.KThe K function removes duplicate elements from a list. In particular, it keeps only the first occurence of each element. (The name K, means 'essence'.) It is a special case of LC, which allows the programmer to supply their own inequality test.LThe L function behaves just like KO, except it uses a user-supplied equality predicate instead of the overloaded m function.MM for , behaves the same as \ The rows/columns need not be the same length, in which case > transpose . transpose /= idNN for , behaves the same as OO for , behaves the same as: sortBy . comparingC !"#$%&k'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOnopqrstu: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO:'0,-./MNO !"#$3()142*+56789:;<=>?@ABKLCDEFGHIJ%&B !"#$%&k'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOnopqrstu"(C) 2011-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Trustworthy+01 PP is effectively v with a better instance of , built off of an underlying b instead of an underlying .DIdeally, this type would not exist at all and we would just fix the  instance of vS,Provide a Semigroup for an arbitrary Monoid.VUse P (V a) to get the behavior of  from  Data.MonoidYUse P (Y a) to get the behavior of  from  Data.Monoid.cAn associative operation. (a c b) c c = a c (b c c) If a is also a  we further require (c) =  dReduce a non-empty list with <>WThe default definition should be sufficient, but this can be overridden for efficiency.eRepeat a value (n + 1) times. e n a = a c a c ... c a -- using c n times ^The default definition uses peasant multiplication, exploiting associativity to only require O(log n) uses of <>. See also g.fA generalization of   to an arbitrary b<. May fail to terminate for some values in some semigroups.gRepeat a value n times. 8timesN n a = a <> a <> ... <> a -- using <> (n-1) timesImplemented using e.hFold an P case-wise, just like w.i)This lets you use a difference list of a b as a .yPQRSTUVWXYZ[\]^_`abcdefghixyz{|}~0 PQRSTUVWXYZ[\]^_`abcdefghi0bcde_`a\]^YZ[VWXSTUg   PQRhifjPQRSTUVWXYZ[\]^_`abcdefghixyz{|}~c                       !"#$%&'()*+,-./0123456 789:;<=>?@ABCDEFGHIJKLMNOPQRRSTUVWXYYZ[[\]^_`abcd efg hijklmnopqrst eu evwxyz{|}~semigroups-0.15.3Data.SemigroupData.List.NonEmpty Data.List transposesortBy Data.MonoidLastFirstcyclebasemconcatmappendmemptyMonoidgetDualDualappEndoEndogetAllAllgetAnyAnygetSumSum getProductProductNonEmpty:|lengthxorunfoldnonEmptyunconsunfoldrheadtaillastinit<|conssortfromListtoListmapinitstailsinsertsome1scanlscanrscanl1scanr1 intersperseiteratereverserepeattakedropsplitAt takeWhile dropWhilespanbreakfilter partitiongroupgroupBygroup1groupBy1 isPrefixOf!!zipzipWithunzipwordsunwordslinesunlinesnubnubBysortOnOption getOption WrappedMonoid WrapMonoid unwrapMonoidgetLastgetFirstMaxgetMaxMingetMin Semigroup<>sconcattimes1pcycle1timesNoptiondiff Data.MaybeNothinglift Data.Foldablefoldlghc-prim GHC.Classes==$fFoldableNonEmpty$fTraversableNonEmpty$fMonadNonEmpty$fApplicativeNonEmpty$fFunctorNonEmpty$fNFDataNonEmpty$fIsListNonEmpty$fHashableNonEmptyMaybemaybe$fSemigroupMap$fSemigroupIntMap$fSemigroupSet$fSemigroupIntSet$fSemigroupSeq$fMonoidOption$fSemigroupOption$fNFDataOption$fTraversableOption$fFoldableOption$fMonadFixOption$fMonadPlusOption$fAlternativeOption $fMonadOption$fApplicativeOption$fFunctorOption$fHashableOption$fNFDataWrappedMonoid$fEnumWrappedMonoid$fBoundedWrappedMonoid$fMonoidWrappedMonoid$fSemigroupWrappedMonoid$fHashableWrappedMonoid$fSemigroupHashSet$fSemigroupHashMap$fSemigroupText$fSemigroupText0$fSemigroupByteString$fSemigroupByteString0 $fNFDataLast$fMonadFixLast $fMonadLast$fApplicativeLast$fTraversableLast$fFoldableLast $fFunctorLast$fSemigroupLast$fHashableLast $fEnumLast $fBoundedLast $fNFDataFirst$fMonadFixFirst $fMonadFirst$fApplicativeFirst$fTraversableFirst$fFoldableFirst$fFunctorFirst$fSemigroupFirst$fHashableFirst $fEnumFirst$fBoundedFirst $fNFDataMax $fMonadFixMax $fMonadMax$fApplicativeMax$fTraversableMax $fFoldableMax $fFunctorMax $fMonoidMax$fSemigroupMax $fHashableMax $fEnumMax $fBoundedMax $fNFDataMin $fMonadFixMin $fMonadMin$fApplicativeMin$fTraversableMin $fFoldableMin $fFunctorMin $fMonoidMin$fSemigroupMin $fHashableMin $fEnumMin $fBoundedMin$fSemigroupNonEmpty$fSemigroupLast0$fSemigroupFirst0$fSemigroupConst$fSemigroupProduct$fSemigroupSum$fSemigroupAny$fSemigroupAll$fSemigroupEndo$fSemigroupDual$fSemigroupOrdering$fSemigroup(,,,,)$fSemigroup(,,,)$fSemigroup(,,)$fSemigroup(,)$fSemigroupEither$fSemigroupMaybe $fSemigroup[]$fSemigroup(->) $fSemigroup()