/usr/share/doc/libghc-semigroups-doc/html/Data-List-NonEmpty.html is in libghc-semigroups-doc 0.15.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.List.NonEmpty</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-List-NonEmpty.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-List-NonEmpty.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">semigroups-0.15.3: Anything that associates</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Maintainer</th><td>Edward Kmett <ekmett@gmail.com></td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Data.List.NonEmpty</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The type of non-empty streams
</a></li><li><a href="#g:2">Non-empty stream transformations
</a></li><li><a href="#g:3">Basic functions
</a></li><li><a href="#g:4">Building streams
</a></li><li><a href="#g:5">Extracting sublists
</a></li><li><a href="#g:6">Sublist predicates
</a></li><li><a href="#g:7">"Set" operations
</a></li><li><a href="#g:8">Indexing streams
</a></li><li><a href="#g:9">Zipping and unzipping streams
</a></li><li><a href="#g:10">Functions on streams of characters
</a></li><li><a href="#g:11">Converting to and from a list
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A NonEmpty list forms a monad as per list, but always contains at least
one element.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:NonEmpty">NonEmpty</a> a = a <a href="#v::-124-">:|</a> [a]</li><li class="src short"><a href="#v:map">map</a> :: (a -> b) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b</li><li class="src short"><a href="#v:intersperse">intersperse</a> :: a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:scanl">scanl</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f => (b -> a -> b) -> b -> f a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b</li><li class="src short"><a href="#v:scanr">scanr</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f => (a -> b -> b) -> b -> f a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b</li><li class="src short"><a href="#v:scanl1">scanl1</a> :: (a -> a -> a) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:scanr1">scanr1</a> :: (a -> a -> a) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:transpose">transpose</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</li><li class="src short"><a href="#v:sortBy">sortBy</a> :: (a -> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ordering">Ordering</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:sortOn">sortOn</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ord">Ord</a> o => (a -> o) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:length">length</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:head">head</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> a</li><li class="src short"><a href="#v:tail">tail</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]</li><li class="src short"><a href="#v:last">last</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> a</li><li class="src short"><a href="#v:init">init</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]</li><li class="src short"><a href="#v:-60--124-">(<|)</a> :: a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:cons">cons</a> :: a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:uncons">uncons</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> (a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a))</li><li class="src short"><a href="#v:unfoldr">unfoldr</a> :: (a -> (b, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> a)) -> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b</li><li class="src short"><a href="#v:sort">sort</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ord">Ord</a> a => <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:reverse">reverse</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:inits">inits</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f => f a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> [a]</li><li class="src short"><a href="#v:tails">tails</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f => f a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> [a]</li><li class="src short"><a href="#v:iterate">iterate</a> :: (a -> a) -> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:repeat">repeat</a> :: a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:cycle">cycle</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:unfold">unfold</a> :: (a -> (b, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> a)) -> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b</li><li class="src short"><a href="#v:insert">insert</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ord">Ord</a> a) => a -> f a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:some1">some1</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Applicative.html#t:Alternative">Alternative</a> f => f a -> f (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</li><li class="src short"><a href="#v:take">take</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]</li><li class="src short"><a href="#v:drop">drop</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]</li><li class="src short"><a href="#v:splitAt">splitAt</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> ([a], [a])</li><li class="src short"><a href="#v:takeWhile">takeWhile</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]</li><li class="src short"><a href="#v:dropWhile">dropWhile</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]</li><li class="src short"><a href="#v:span">span</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> ([a], [a])</li><li class="src short"><a href="#v:break">break</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> ([a], [a])</li><li class="src short"><a href="#v:filter">filter</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]</li><li class="src short"><a href="#v:partition">partition</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> ([a], [a])</li><li class="src short"><a href="#v:group">group</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> a) => f a -> [<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a]</li><li class="src short"><a href="#v:groupBy">groupBy</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f => (a -> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> f a -> [<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a]</li><li class="src short"><a href="#v:group1">group1</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> a => <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</li><li class="src short"><a href="#v:groupBy1">groupBy1</a> :: (a -> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</li><li class="src short"><a href="#v:isPrefixOf">isPrefixOf</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> a => [a] -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:nub">nub</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> a => <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:nubBy">nubBy</a> :: (a -> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:-33--33-">(!!)</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> a</li><li class="src short"><a href="#v:zip">zip</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> (a, b)</li><li class="src short"><a href="#v:zipWith">zipWith</a> :: (a -> b -> c) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> c</li><li class="src short"><a href="#v:unzip">unzip</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> f => f (a, b) -> (f a, f b)</li><li class="src short"><a href="#v:words">words</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:unwords">unwords</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:lines">lines</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:unlines">unlines</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:fromList">fromList</a> :: [a] -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a</li><li class="src short"><a href="#v:toList">toList</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]</li><li class="src short"><a href="#v:nonEmpty">nonEmpty</a> :: [a] -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</li><li class="src short"><a href="#v:xor">xor</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li></ul></div><div id="interface"><h1 id="g:1">The type of non-empty streams
</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:NonEmpty" class="def">NonEmpty</a> a <a href="src/Data-List-NonEmpty.html#NonEmpty" class="link">Source</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src">a <a name="v::-124-" class="def">:|</a> [a]</td><td class="doc empty"> </td></tr></table></div><div class="subs instances"><p id="control.i:NonEmpty" class="caption collapser" onclick="toggleSection('i:NonEmpty')">Instances</p><div id="section.i:NonEmpty" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Applicative.html#t:Applicative">Applicative</a> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Traversable.html#t:Traversable">Traversable</a> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Data.html#t:Data">Data</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Data.html#t:Data">Data</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ord">Ord</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ord">Ord</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Read.html#t:Read">Read</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Read.html#t:Read">Read</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Show.html#t:Show">Show</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Show.html#t:Show">Show</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-Generics.html#t:Generic">Generic</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/deepseq-1.3.0.1/Control-DeepSeq.html#t:NFData">NFData</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/deepseq-1.3.0.1/Control-DeepSeq.html#t:NFData">NFData</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> a => <a href="/usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Semigroup.html#t:Semigroup">Semigroup</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)</td><td class="doc empty"> </td></tr></table></div></div></div><h1 id="g:2">Non-empty stream transformations
</h1><div class="top"><p class="src"><a name="v:map" class="def">map</a> :: (a -> b) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b<a href="src/Data-List-NonEmpty.html#map" class="link">Source</a></p><div class="doc"><p>Map a function over a <code><a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></code> stream.
</p></div></div><div class="top"><p class="src"><a name="v:intersperse" class="def">intersperse</a> :: a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#intersperse" class="link">Source</a></p><div class="doc"><p>'intersperse x xs' alternates elements of the list with copies of <code>x</code>.
</p><pre> intersperse 0 (1 :| [2,3]) == 1 :| [0,2,0,3]
</pre></div></div><div class="top"><p class="src"><a name="v:scanl" class="def">scanl</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f => (b -> a -> b) -> b -> f a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b<a href="src/Data-List-NonEmpty.html#scanl" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:scanl">scanl</a></code> is similar to <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#v:foldl">foldl</a></code>, but returns a stream of successive
reduced values from the left:
</p><pre> scanl f z [x1, x2, ...] == z :| [z `f` x1, (z `f` x1) `f` x2, ...]
</pre><p>Note that
</p><pre> last (scanl f z xs) == foldl f z xs.
</pre></div></div><div class="top"><p class="src"><a name="v:scanr" class="def">scanr</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f => (a -> b -> b) -> b -> f a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b<a href="src/Data-List-NonEmpty.html#scanr" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:scanr">scanr</a></code> is the right-to-left dual of <code><a href="Data-List-NonEmpty.html#v:scanl">scanl</a></code>.
Note that
</p><pre> head (scanr f z xs) == foldr f z xs.
</pre></div></div><div class="top"><p class="src"><a name="v:scanl1" class="def">scanl1</a> :: (a -> a -> a) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#scanl1" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:scanl1">scanl1</a></code> is a variant of <code><a href="Data-List-NonEmpty.html#v:scanl">scanl</a></code> that has no starting value argument:
</p><pre> scanl1 f [x1, x2, ...] == x1 :| [x1 `f` x2, x1 `f` (x2 `f` x3), ...]
</pre></div></div><div class="top"><p class="src"><a name="v:scanr1" class="def">scanr1</a> :: (a -> a -> a) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#scanr1" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:scanr1">scanr1</a></code> is a variant of <code><a href="Data-List-NonEmpty.html#v:scanr">scanr</a></code> that has no starting value argument.
</p></div></div><div class="top"><p class="src"><a name="v:transpose" class="def">transpose</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)<a href="src/Data-List-NonEmpty.html#transpose" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:sortBy" class="def">sortBy</a> :: (a -> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ordering">Ordering</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#sortBy" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:sortBy">sortBy</a></code> for <code><a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></code>, behaves the same as <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-List.html#t:sortBy">sortBy</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:sortOn" class="def">sortOn</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ord">Ord</a> o => (a -> o) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#sortOn" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:sortOn">sortOn</a></code> for <code><a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></code>, behaves the same as:
</p><pre> sortBy . comparing
</pre></div></div><h1 id="g:3">Basic functions
</h1><div class="top"><p class="src"><a name="v:length" class="def">length</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a><a href="src/Data-List-NonEmpty.html#length" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:head" class="def">head</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> a<a href="src/Data-List-NonEmpty.html#head" class="link">Source</a></p><div class="doc"><p>Extract the first element of the stream.
</p></div></div><div class="top"><p class="src"><a name="v:tail" class="def">tail</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]<a href="src/Data-List-NonEmpty.html#tail" class="link">Source</a></p><div class="doc"><p>Extract the possibly-empty tail of the stream.
</p></div></div><div class="top"><p class="src"><a name="v:last" class="def">last</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> a<a href="src/Data-List-NonEmpty.html#last" class="link">Source</a></p><div class="doc"><p>Extract the last element of the stream.
</p></div></div><div class="top"><p class="src"><a name="v:init" class="def">init</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]<a href="src/Data-List-NonEmpty.html#init" class="link">Source</a></p><div class="doc"><p>Extract everything except the last element of the stream.
</p></div></div><div class="top"><p class="src"><a name="v:-60--124-" class="def">(<|)</a> :: a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#%3C%7C" class="link">Source</a></p><div class="doc"><p>Prepend an element to the stream.
</p></div></div><div class="top"><p class="src"><a name="v:cons" class="def">cons</a> :: a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#cons" class="link">Source</a></p><div class="doc"><p>Synonym for <code><a href="Data-List-NonEmpty.html#v:-60--124-"><|</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:uncons" class="def">uncons</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> (a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a))<a href="src/Data-List-NonEmpty.html#uncons" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:uncons">uncons</a></code> produces the first element of the stream, and a stream of the
remaining elements, if any.
</p></div></div><div class="top"><p class="src"><a name="v:unfoldr" class="def">unfoldr</a> :: (a -> (b, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> a)) -> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b<a href="src/Data-List-NonEmpty.html#unfoldr" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:sort" class="def">sort</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ord">Ord</a> a => <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#sort" class="link">Source</a></p><div class="doc"><p>Sort a stream.
</p></div></div><div class="top"><p class="src"><a name="v:reverse" class="def">reverse</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#reverse" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:reverse">reverse</a></code> a finite NonEmpty stream.
</p></div></div><div class="top"><p class="src"><a name="v:inits" class="def">inits</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f => f a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> [a]<a href="src/Data-List-NonEmpty.html#inits" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:inits">inits</a></code> function takes a stream <code>xs</code> and returns all the
finite prefixes of <code>xs</code>.
</p></div></div><div class="top"><p class="src"><a name="v:tails" class="def">tails</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f => f a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> [a]<a href="src/Data-List-NonEmpty.html#tails" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:tails">tails</a></code> function takes a stream <code>xs</code> and returns all the
suffixes of <code>xs</code>.
</p></div></div><h1 id="g:4">Building streams
</h1><div class="top"><p class="src"><a name="v:iterate" class="def">iterate</a> :: (a -> a) -> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#iterate" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:iterate">iterate</a></code> f x</code> produces the infinite sequence
of repeated applications of <code>f</code> to <code>x</code>.
</p><pre> iterate f x = x :| [f x, f (f x), ..]
</pre></div></div><div class="top"><p class="src"><a name="v:repeat" class="def">repeat</a> :: a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#repeat" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:repeat">repeat</a></code> x</code> returns a constant stream, where all elements are
equal to <code>x</code>.
</p></div></div><div class="top"><p class="src"><a name="v:cycle" class="def">cycle</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#cycle" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:cycle">cycle</a></code> xs</code> returns the infinite repetition of <code>xs</code>:
</p><pre> cycle [1,2,3] = 1 :| [2,3,1,2,3,...]
</pre></div></div><div class="top"><p class="src"><a name="v:unfold" class="def">unfold</a> :: (a -> (b, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> a)) -> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b<a href="src/Data-List-NonEmpty.html#unfold" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:unfold">unfold</a></code> produces a new stream by repeatedly applying the unfolding
function to the seed value to produce an element of type <code>b</code> and a new
seed value. When the unfolding function returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#v:Nothing">Nothing</a></code> instead of
a new seed value, the stream ends.
</p></div></div><div class="top"><p class="src"><a name="v:insert" class="def">insert</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ord">Ord</a> a) => a -> f a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#insert" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:insert">insert</a></code> x xs</code> inserts <code>x</code> into the last position in <code>xs</code> 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.
</p></div></div><div class="top"><p class="src"><a name="v:some1" class="def">some1</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Applicative.html#t:Alternative">Alternative</a> f => f a -> f (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)<a href="src/Data-List-NonEmpty.html#some1" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:some1">some1</a></code> x</code> sequences <code>x</code> one or more times.
</p></div></div><h1 id="g:5">Extracting sublists
</h1><div class="top"><p class="src"><a name="v:take" class="def">take</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]<a href="src/Data-List-NonEmpty.html#take" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:take">take</a></code> n xs</code> returns the first <code>n</code> elements of <code>xs</code>.
</p></div></div><div class="top"><p class="src"><a name="v:drop" class="def">drop</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]<a href="src/Data-List-NonEmpty.html#drop" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:drop">drop</a></code> n xs</code> drops the first <code>n</code> elements off the front of
the sequence <code>xs</code>.
</p></div></div><div class="top"><p class="src"><a name="v:splitAt" class="def">splitAt</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> ([a], [a])<a href="src/Data-List-NonEmpty.html#splitAt" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:splitAt">splitAt</a></code> n xs</code> returns a pair consisting of the prefix of <code>xs</code>
of length <code>n</code> and the remaining stream immediately following this prefix.
</p><pre> 'splitAt' n xs == ('take' n xs, 'drop' n xs)
xs == ys ++ zs where (ys, zs) = 'splitAt' n xs
</pre></div></div><div class="top"><p class="src"><a name="v:takeWhile" class="def">takeWhile</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]<a href="src/Data-List-NonEmpty.html#takeWhile" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:takeWhile">takeWhile</a></code> p xs</code> returns the longest prefix of the stream
<code>xs</code> for which the predicate <code>p</code> holds.
</p></div></div><div class="top"><p class="src"><a name="v:dropWhile" class="def">dropWhile</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]<a href="src/Data-List-NonEmpty.html#dropWhile" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:dropWhile">dropWhile</a></code> p xs</code> returns the suffix remaining after
<code><code><a href="Data-List-NonEmpty.html#v:takeWhile">takeWhile</a></code> p xs</code>.
</p></div></div><div class="top"><p class="src"><a name="v:span" class="def">span</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> ([a], [a])<a href="src/Data-List-NonEmpty.html#span" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:span">span</a></code> p xs</code> returns the longest prefix of <code>xs</code> that satisfies
<code>p</code>, together with the remainder of the stream.
</p><pre> 'span' p xs == ('takeWhile' p xs, 'dropWhile' p xs)
xs == ys ++ zs where (ys, zs) = 'span' p xs
</pre></div></div><div class="top"><p class="src"><a name="v:break" class="def">break</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> ([a], [a])<a href="src/Data-List-NonEmpty.html#break" class="link">Source</a></p><div class="doc"><p>The <code><code><a href="Data-List-NonEmpty.html#v:break">break</a></code> p</code> function is equivalent to <code><code><a href="Data-List-NonEmpty.html#v:span">span</a></code> (not . p)</code>.
</p></div></div><div class="top"><p class="src"><a name="v:filter" class="def">filter</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]<a href="src/Data-List-NonEmpty.html#filter" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-List-NonEmpty.html#v:filter">filter</a></code> p xs</code> removes any elements from <code>xs</code> that do not satisfy <code>p</code>.
</p></div></div><div class="top"><p class="src"><a name="v:partition" class="def">partition</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> ([a], [a])<a href="src/Data-List-NonEmpty.html#partition" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:partition">partition</a></code> function takes a predicate <code>p</code> and a stream
<code>xs</code>, and returns a pair of lists. The first list corresponds to the
elements of <code>xs</code> for which <code>p</code> holds; the second corresponds to the
elements of <code>xs</code> for which <code>p</code> does not hold.
</p><pre> 'partition' p xs = ('filter' p xs, 'filter' (not . p) xs)
</pre></div></div><div class="top"><p class="src"><a name="v:group" class="def">group</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> a) => f a -> [<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a]<a href="src/Data-List-NonEmpty.html#group" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:group">group</a></code> 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:
</p><pre> 'group' $ 'cycle' "Mississippi" = "M" : "i" : "ss" : "i" : "ss" : "i" : "pp" : "i" : "M" : "i" : ...
</pre></div></div><div class="top"><p class="src"><a name="v:groupBy" class="def">groupBy</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> f => (a -> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> f a -> [<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a]<a href="src/Data-List-NonEmpty.html#groupBy" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:groupBy">groupBy</a></code> operates like <code><a href="Data-List-NonEmpty.html#v:group">group</a></code>, but uses the provided equality
predicate instead of <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#v:-61--61-">==</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:group1" class="def">group1</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> a => <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)<a href="src/Data-List-NonEmpty.html#group1" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:group1">group1</a></code> operates like <code><a href="Data-List-NonEmpty.html#v:group">group</a></code>, but uses the knowledge that its
input is non-empty to produce guaranteed non-empty output.
</p></div></div><div class="top"><p class="src"><a name="v:groupBy1" class="def">groupBy1</a> :: (a -> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)<a href="src/Data-List-NonEmpty.html#groupBy1" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:groupBy1">groupBy1</a></code> is to <code><a href="Data-List-NonEmpty.html#v:group1">group1</a></code> as <code><a href="Data-List-NonEmpty.html#v:groupBy">groupBy</a></code> is to <code><a href="Data-List-NonEmpty.html#v:group">group</a></code>.
</p></div></div><h1 id="g:6">Sublist predicates
</h1><div class="top"><p class="src"><a name="v:isPrefixOf" class="def">isPrefixOf</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> a => [a] -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-List-NonEmpty.html#isPrefixOf" class="link">Source</a></p><div class="doc"><p>The <code>isPrefix</code> function returns <code>True</code> if the first argument is
a prefix of the second.
</p></div></div><h1 id="g:7">"Set" operations
</h1><div class="top"><p class="src"><a name="v:nub" class="def">nub</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> a => <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#nub" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:nub">nub</a></code> function removes duplicate elements from a list. In
particular, it keeps only the first occurence of each element.
(The name <code><a href="Data-List-NonEmpty.html#v:nub">nub</a></code> means 'essence'.)
It is a special case of <code><a href="Data-List-NonEmpty.html#v:nubBy">nubBy</a></code>, which allows the programmer to
supply their own inequality test.
</p></div></div><div class="top"><p class="src"><a name="v:nubBy" class="def">nubBy</a> :: (a -> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#nubBy" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:nubBy">nubBy</a></code> function behaves just like <code><a href="Data-List-NonEmpty.html#v:nub">nub</a></code>, except it uses a
user-supplied equality predicate instead of the overloaded <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#v:-61--61-">==</a></code>
function.
</p></div></div><h1 id="g:8">Indexing streams
</h1><div class="top"><p class="src"><a name="v:-33--33-" class="def">(!!)</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> a<a href="src/Data-List-NonEmpty.html#%21%21" class="link">Source</a></p><div class="doc"><p><code>xs !! n</code> returns the element of the stream <code>xs</code> at index
<code>n</code>. Note that the head of the stream has index 0.
</p><p><em>Beware</em>: a negative or out-of-bounds index will cause an error.
</p></div></div><h1 id="g:9">Zipping and unzipping streams
</h1><div class="top"><p class="src"><a name="v:zip" class="def">zip</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> (a, b)<a href="src/Data-List-NonEmpty.html#zip" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:zip">zip</a></code> function takes two streams and returns a stream of
corresponding pairs.
</p></div></div><div class="top"><p class="src"><a name="v:zipWith" class="def">zipWith</a> :: (a -> b -> c) -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> b -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> c<a href="src/Data-List-NonEmpty.html#zipWith" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:zipWith">zipWith</a></code> function generalizes <code><a href="Data-List-NonEmpty.html#v:zip">zip</a></code>. Rather than tupling
the elements, the elements are combined using the function
passed as the first argument.
</p></div></div><div class="top"><p class="src"><a name="v:unzip" class="def">unzip</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> f => f (a, b) -> (f a, f b)<a href="src/Data-List-NonEmpty.html#unzip" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:unzip">unzip</a></code> function is the inverse of the <code><a href="Data-List-NonEmpty.html#v:zip">zip</a></code> function.
</p></div></div><h1 id="g:10">Functions on streams of characters
</h1><div class="top"><p class="src"><a name="v:words" class="def">words</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a><a href="src/Data-List-NonEmpty.html#words" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:words">words</a></code> function breaks a stream of characters into a
stream of words, which were delimited by white space.
</p><p><em>Beware</em>: if the input contains no words (i.e. is entirely
whitespace), this will cause an error.
</p></div></div><div class="top"><p class="src"><a name="v:unwords" class="def">unwords</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a><a href="src/Data-List-NonEmpty.html#unwords" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:unwords">unwords</a></code> function is an inverse operation to <code><a href="Data-List-NonEmpty.html#v:words">words</a></code>. It
joins words with separating spaces.
</p><p><em>Beware</em>: the input <code>("" :| [])</code> will cause an error.
</p></div></div><div class="top"><p class="src"><a name="v:lines" class="def">lines</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a><a href="src/Data-List-NonEmpty.html#lines" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:lines">lines</a></code> function breaks a stream of characters into a stream
of strings at newline characters. The resulting strings do not
contain newlines.
</p></div></div><div class="top"><p class="src"><a name="v:unlines" class="def">unlines</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a><a href="src/Data-List-NonEmpty.html#unlines" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-List-NonEmpty.html#v:unlines">unlines</a></code> function is an inverse operation to <code><a href="Data-List-NonEmpty.html#v:lines">lines</a></code>. It
joins lines, after appending a terminating newline to each.
</p></div></div><h1 id="g:11">Converting to and from a list
</h1><div class="top"><p class="src"><a name="v:fromList" class="def">fromList</a> :: [a] -> <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a<a href="src/Data-List-NonEmpty.html#fromList" class="link">Source</a></p><div class="doc"><p>Converts a normal list to a <code><a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></code> stream.
</p><p>Raises an error if given an empty list.
</p></div></div><div class="top"><p class="src"><a name="v:toList" class="def">toList</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a -> [a]<a href="src/Data-List-NonEmpty.html#toList" class="link">Source</a></p><div class="doc"><p>Convert a stream to a normal list efficiently.
</p></div></div><div class="top"><p class="src"><a name="v:nonEmpty" class="def">nonEmpty</a> :: [a] -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> a)<a href="src/Data-List-NonEmpty.html#nonEmpty" class="link">Source</a></p><div class="doc"><p><code><a href="Data-List-NonEmpty.html#v:nonEmpty">nonEmpty</a></code> efficiently turns a normal list into a <code><a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></code> stream,
producing <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#v:Nothing">Nothing</a></code> if the input is empty.
</p></div></div><div class="top"><p class="src"><a name="v:xor" class="def">xor</a> :: <a href="Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-List-NonEmpty.html#xor" class="link">Source</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.2</p></div></body></html>
|