F$y      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxe(C) 2011-2015 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=K:v 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 y/ instead of a new seed value, the stream ends.( efficiently turns a normal list into a  stream, producing y 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.z"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 {C, 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 |.@@ operates like >?, but uses the provided projection when comparing for equalityAA operates like @_, but sorts the list first so that each equivalence class has, at most, one list in the outputBB operates like >], but uses the knowledge that its input is non-empty to produce guaranteed non-empty output.CC is to B as ? is to >.DD is to B as @ is to >EE is to D as A is to @FThe isPrefix function returns True2 if the first argument is a prefix of the second.Gxs !! 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.HThe HI function takes two streams and returns a stream of corresponding pairs.IThe I function generalizes Hp. Rather than tupling the elements, the elements are combined using the function passed as the first argument.JThe J function is the inverse of the H function.KThe Ke 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.LThe L% function is an inverse operation to K). It joins words with separating spaces.Beware : the input  ("" :| []) will cause an error.MThe M function breaks a stream of characters into a stream of strings at newline characters. The resulting strings do not contain newlines.NThe N% function is an inverse operation to MA. It joins lines, after appending a terminating newline to each.OThe O function removes duplicate elements from a list. In particular, it keeps only the first occurence of each element. (The name O, means 'essence'.) It is a special case of PC, which allows the programmer to supply their own inequality test.PThe P function behaves just like OO, except it uses a user-supplied equality predicate instead of the overloaded | function.QQ for , behaves the same as \ The rows/columns need not be the same length, in which case > transpose . transpose /= idRR for , behaves the same as SS for , behaves the same as: sortBy . comparingI !"#$%&z'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS}~> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS>'0,-./QRS !"#$3()142*+56789:;<=>?@ABCDEFOPGHIJKLMN%&H !"#$%&z'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS}~"(C) 2011-2015 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Trustworthy '+013=JKMTT is effectively  with a better instance of , built off of an underlying j instead of an underlying .DIdeally, this type would not exist at all and we would just fix the  instance of W,Provide a Semigroup for an arbitrary Monoid.ZUse T (Z a) to get the behavior of  from  Data.Monoid]Use T (] a) to get the behavior of   from  Data.Monoid.bb isn't itself a j/ in its own right, but it can be placed inside g and d# to compute an arg min or arg max.kAn associative operation. (a k b) k c = a k (b k c) If a is also a  we further require (k) =  lReduce a non-empty list with <>WThe default definition should be sufficient, but this can be overridden for efficiency.mRepeat a value n times.Given that this works on a je it is allowed to fail if you request 0 or fewer repetitions, and the default definition will do so.hBy making this a member of the class, idempotent semigroups and monoids can upgrade this to execute in O(1) by picking stimes = stimesIdempotent or stimes = stimesIdempotentMonoid respectively. @since 0.18nA generalization of   to an arbitrary j<. May fail to terminate for some values in some semigroups.oThis is a valid definition of m for a .!Unlike the default definition of mD, it is defined for 0 and so it should be preferred where possible.pThis is a valid definition of m for an idempotent .When mappend x x = x<, this definition should be preferred, because it works in O(1) rather than O(log n)qThis is a valid definition of m for an idempotent j.When  x <> x = x<, this definition should be preferred, because it works in O(1) rather than O(log n).rRepeat a value n times. ?mtimesDefault n a = a <> a <> ... <> a -- using <> (n-1) timesImplemented using m and .%This is a suitable definition for an mtimes member of . @since 0.18sFold an T case-wise, just like .t)This lets you use a difference list of a j as a .TUVWXYZ[\]^_`abcdefghijklmnopqrst7 TUVWXYZ[\]^_`abcdefghijklmnopqrst7jklmoqprghidef]^_Z[\WXY   TUVstnbca`~TUVWXYZ[\]^_`abcdefghijklmnopqrstk((C) 2014-2015 Edward Kmett, Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableSafe3JKwGenerically generate a j (k') operation for any type implementing . This operation will append two values by point-wise appending their component fields. It is only defined for product types. w a (w b c) = w (w a b) c xGenerically generate a  ) for any product-like type implementing .%It is only defined for product types. w x a = a = w a x uvwxuvwxvwux uvwx                       !"#$%&'()*+,-./01234567 89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWWXYZ[\  ]^_``aabccdefghijklmnopqrs tuv wxyz{|}~ t t semigroups-0.17Data.SemigroupData.List.NonEmptyData.Semigroup.Generic Data.List transposesortBy Data.MonoidLastFirstcyclebasemconcatmappendmemptyMonoidgetDualDualappEndoEndogetAllAllgetAnyAnygetSumSum getProductProductNonEmpty:|lengthxorunfoldnonEmptyunconsunfoldrheadtaillastinit<|conssortfromListtoListmapinitstailsinsertsome1scanlscanrscanl1scanr1 intersperseiteratereverserepeattakedropsplitAt takeWhile dropWhilespanbreakfilter partitiongroupgroupBy groupWith groupAllWithgroup1groupBy1 groupWith1 groupAllWith1 isPrefixOf!!zipzipWithunzipwordsunwordslinesunlinesnubnubBysortWithOption getOption WrappedMonoid WrapMonoid unwrapMonoidgetLastgetFirstArgMaxArgMinArgMaxgetMaxMingetMin Semigroup<>sconcatstimescycle1 stimesMonoidstimesIdempotentMonoidstimesIdempotent mtimesDefaultoptiondiffGMonoid GSemigroupgmappendgmempty Data.MaybeNothinglift Data.Foldablefoldlghc-prim GHC.Classes==$fFoldableNonEmpty$fTraversableNonEmpty$fMonadNonEmpty$fApplicativeNonEmpty$fFunctorNonEmpty$fMonadZipNonEmpty$fMonadFixNonEmpty$fNFDataNonEmpty$fIsListNonEmpty$fHashableNonEmptyMaybemaybe$fSemigroupTagged$fSemigroupProxy$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$fSemigroupBuilder$fSemigroupText$fSemigroupText0$fSemigroupShortByteString$fSemigroupBuilder0$fSemigroupByteString$fSemigroupByteString0 $fNFDataLast$fMonadFixLast $fMonadLast$fApplicativeLast$fTraversableLast$fFoldableLast $fFunctorLast$fSemigroupLast$fHashableLast $fEnumLast $fBoundedLast $fNFDataFirst$fMonadFixFirst $fMonadFirst$fApplicativeFirst$fTraversableFirst$fFoldableFirst$fFunctorFirst$fSemigroupFirst$fHashableFirst $fEnumFirst$fBoundedFirst $fHashableArg $fNFDataArg$fOrdArg$fEqArg$fTraversableArg $fFoldableArg $fFunctorArg$fNumMax $fNFDataMax $fMonadFixMax $fMonadMax$fApplicativeMax$fTraversableMax $fFoldableMax $fFunctorMax $fMonoidMax$fSemigroupMax $fHashableMax $fEnumMax $fBoundedMax$fNumMin $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() GHC.GenericsGenericgmempty' gmappend' $fGMonoid:*: $fGMonoidM1 $fGMonoidK1 $fGMonoidU1$fGSemigroup:*:$fGSemigroupM1$fGSemigroupK1$fGSemigroupV1$fGSemigroupU1