scion-browser 0.1.3 → 0.1.3.1
raw patch · 14 files changed
+8/−21255 lines, 14 filesdep +aeson-nativedep −aeson
Dependencies added: aeson-native
Dependencies removed: aeson
Files
- data/base-unicode-symbols.txt +0/−347
- data/containers.txt +0/−2909
- data/ghc-mtl.txt +0/−56
- data/ghc-prim.txt +0/−1158
- data/haskell2010.txt +0/−4715
- data/haskell98.txt +0/−2532
- data/html.txt +0/−272
- data/vector.txt +0/−8948
- data/wai.txt +0/−127
- data/warp.txt +0/−91
- scion-browser.cabal +3/−3
- scion-browser.cabal~ +5/−4
- test/Scion/Browser/ParserTests.hs +0/−84
- test/Test.hs +0/−9
− data/base-unicode-symbols.txt
@@ -1,347 +0,0 @@--- Hoogle documentation, generated by Haddock--- See Hoogle, http://www.haskell.org/hoogle/----- | Unicode alternatives for common functions and operators--- --- This package defines new symbols for a number of functions and--- operators in the base package.--- --- All symbols are documented with their actual definition and--- information regarding their Unicode code point. They should be--- completely interchangeable with their definitions.--- --- For further Unicode goodness you can enable the <tt>UnicodeSyntax</tt>--- language extension [1]. This extension enables Unicode characters to--- be used to stand for certain ASCII character sequences, i.e. → instead--- of <tt>-></tt>, ∀ instead of <tt>forall</tt> and many others.--- --- Original idea by Péter Diviánszky.--- --- [1]--- <a>http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#unicode-syntax</a>-@package base-unicode-symbols-@version 0.2.1.5---module Data.Ord.Unicode---- | (≤) = (<a><=</a>)--- --- U+2264, LESS-THAN OR EQUAL TO-(≤) :: Ord α => α -> α -> Bool---- | (≥) = (<a>>=</a>)--- --- U+2265, GREATER-THAN OR EQUAL TO-(≥) :: Ord α => α -> α -> Bool---- | (≮) = (<a>>=</a>)--- --- U+226E, NOT LESS-THAN-(≮) :: Ord α => α -> α -> Bool---- | (≯) = (<a><=</a>)--- --- U+226F, NOT GREATER-THAN-(≯) :: Ord α => α -> α -> Bool---module Data.Monoid.Unicode---- | (∅) = <a>mempty</a>--- --- U+2205, EMPTY SET-(∅) :: Monoid α => α---- | (⊕) = <a>mappend</a>--- --- U+2295, CIRCLED PLUS-(⊕) :: Monoid α => α -> α -> α---module Data.List.Unicode---- | (⧺) = (<a>++</a>)--- --- U+29FA, DOUBLE PLUS-(⧺) :: [α] -> [α] -> [α]---- | (∈) = <a>elem</a>--- --- U+2208, ELEMENT OF-(∈) :: Eq α => α -> [α] -> Bool---- | (∋) = <a>flip</a> (∈)--- --- U+220B, CONTAINS AS MEMBER-(∋) :: Eq α => [α] -> α -> Bool---- | (∉) = <a>notElem</a>--- --- U+2209, NOT AN ELEMENT OF-(∉) :: Eq α => α -> [α] -> Bool---- | (∌) = <a>flip</a> (∉)--- --- U+220C, DOES NOT CONTAIN AS MEMBER-(∌) :: Eq α => [α] -> α -> Bool---- | (∪) = <a>union</a>--- --- U+222A, UNION-(∪) :: Eq α => [α] -> [α] -> [α]---- | (∖) = (<a>\\</a>)--- --- U+2216, SET MINUS-(∖) :: Eq α => [α] -> [α] -> [α]---- | Symmetric difference--- --- a ∆ b = (a ∖ b) ∪ (b ∖ a)--- --- U+2206, INCREMENT-(∆) :: Eq α => [α] -> [α] -> [α]---- | (∩) = <a>intersect</a>--- --- U+2229, INTERSECTION-(∩) :: Eq α => [α] -> [α] -> [α]---module Data.Function.Unicode---- | (∘) = (<a>.</a>)--- --- U+2218, RING OPERATOR-(∘) :: (β -> γ) -> (α -> β) -> (α -> γ)---module Data.Foldable.Unicode---- | (∈) = <a>elem</a>--- --- U+2208, ELEMENT OF-(∈) :: (Foldable t, Eq α) => α -> t α -> Bool---- | (∋) = <a>flip</a> (∈)--- --- U+220B, CONTAINS AS MEMBER-(∋) :: (Foldable t, Eq α) => t α -> α -> Bool---- | (∉) = <a>notElem</a>--- --- U+2209, NOT AN ELEMENT OF-(∉) :: (Foldable t, Eq α) => α -> t α -> Bool---- | (∌) = <a>flip</a> (∉)--- --- U+220C, DOES NOT CONTAIN AS MEMBER-(∌) :: (Foldable t, Eq α) => t α -> α -> Bool---module Data.Eq.Unicode---- | (≡) = (<a>==</a>)--- --- U+2261, IDENTICAL TO-(≡) :: Eq α => α -> α -> Bool---- | (≢) = (<a>/=</a>)--- --- U+2262, NOT IDENTICAL TO-(≢) :: Eq α => α -> α -> Bool---- | (≠) = (<a>/=</a>)--- --- U+2260, NOT EQUAL TO-(≠) :: Eq α => α -> α -> Bool---module Data.Bool.Unicode---- | (∧) = (<a>&&</a>)--- --- U+2227, LOGICAL AND-(∧) :: Bool -> Bool -> Bool---- | (∨) = (<a>||</a>)--- --- U+2228, LOGICAL OR-(∨) :: Bool -> Bool -> Bool---- | (¬) = <a>not</a>--- --- U+00AC, NOT SIGN-(¬) :: Bool -> Bool---module Prelude.Unicode---- | (¬) = <a>not</a>--- --- U+00AC, NOT SIGN-(¬) :: Bool -> Bool---- | (∧) = (<a>&&</a>)--- --- U+2227, LOGICAL AND-(∧) :: Bool -> Bool -> Bool---- | (∨) = (<a>||</a>)--- --- U+2228, LOGICAL OR-(∨) :: Bool -> Bool -> Bool---- | (≡) = (<a>==</a>)--- --- U+2261, IDENTICAL TO-(≡) :: Eq α => α -> α -> Bool---- | (≢) = (<a>/=</a>)--- --- U+2262, NOT IDENTICAL TO-(≢) :: Eq α => α -> α -> Bool---- | (≠) = (<a>/=</a>)--- --- U+2260, NOT EQUAL TO-(≠) :: Eq α => α -> α -> Bool---- | (≤) = (<a><=</a>)--- --- U+2264, LESS-THAN OR EQUAL TO-(≤) :: Ord α => α -> α -> Bool---- | (≥) = (<a>>=</a>)--- --- U+2265, GREATER-THAN OR EQUAL TO-(≥) :: Ord α => α -> α -> Bool---- | (≮) = (<a>>=</a>)--- --- U+226E, NOT LESS-THAN-(≮) :: Ord α => α -> α -> Bool---- | (≯) = (<a><=</a>)--- --- U+226F, NOT GREATER-THAN-(≯) :: Ord α => α -> α -> Bool---- | π = <a>pi</a>--- --- U+03C0, GREEK SMALL LETTER PI-π :: Floating α => α---- | (÷) = (<a>/</a>)--- --- U+00F7, DIVISION SIGN-(÷) :: Fractional α => α -> α -> α---- | (⋅) = (<a>*</a>)--- --- U+22C5, DOT OPERATOR-(⋅) :: Num α => α -> α -> α---- | (∘) = (<a>.</a>)--- --- U+2218, RING OPERATOR-(∘) :: (β -> γ) -> (α -> β) -> (α -> γ)---- | (⧺) = (<a>++</a>)--- --- U+29FA, DOUBLE PLUS-(⧺) :: [α] -> [α] -> [α]---- | (∈) = <a>elem</a>--- --- U+2208, ELEMENT OF-(∈) :: Eq α => α -> [α] -> Bool---- | (∉) = <a>notElem</a>--- --- U+2209, NOT AN ELEMENT OF-(∉) :: Eq α => α -> [α] -> Bool---- | (⊥) = <a>undefined</a>--- --- U+22A5, UP TACK-(⊥) :: α---module Control.Monad.Unicode---- | (≫=) = (<a>>>=</a>)--- --- (U+226B, MUCH GREATER-THAN) + (U+3D, EQUALS SIGN)-(≫=) :: Monad m => m α -> (α -> m β) -> m β---- | (≫) = (<a>>></a>)--- --- U+226B, MUCH GREATER-THAN-(≫) :: Monad m => m α -> m β -> m β---- | (=≪) = (<a>=<<</a>)--- --- (U+3D, EQUALS SIGN) + (U+226A, MUCH LESS-THAN)-(=≪) :: Monad m => (α -> m β) -> m α -> m β---module Control.Applicative.Unicode---- | (⊛) = <a><*></a>--- --- U+229B, CIRCLED ASTERISK OPERATOR-(⊛) :: Applicative f => f (α -> β) -> f α -> f β---- | (∅) = <a>empty</a>--- --- U+2205, EMPTY SET-(∅) :: Alternative f => f α---module Control.Category.Unicode---- | (∘) = (<a>.</a>)--- --- U+2218, RING OPERATOR-(∘) :: Category ⇝ => (β ⇝ γ) -> (α ⇝ β) -> (α ⇝ γ)---- | (⋙) = (<a>>>></a>)--- --- U+22D9, VERY MUCH GREATER-THAN-(⋙) :: Category ⇝ => (α ⇝ β) -> (β ⇝ γ) -> (α ⇝ γ)---- | (⋘) = (<a><<<</a>)--- --- U+22D8, VERY MUCH LESS-THAN-(⋘) :: Category ⇝ => (β ⇝ γ) -> (α ⇝ β) -> (α ⇝ γ)---module Control.Arrow.Unicode---- | (⋙) = (<a>>>></a>)--- --- U+22D9, VERY MUCH GREATER-THAN-(⋙) :: Category ⇝ => (α ⇝ β) -> (β ⇝ γ) -> (α ⇝ γ)---- | (⋘) = (<a><<<</a>)--- --- U+22D8, VERY MUCH LESS-THAN-(⋘) :: Category ⇝ => (β ⇝ γ) -> (α ⇝ β) -> (α ⇝ γ)---- | (⁂) = (<a>***</a>)--- --- U+2042, ASTERISM-(⁂) :: Arrow ⇝ => (α ⇝ β) -> (α' ⇝ β') -> (α, α') ⇝ (β, β')---- | (⧻) = (<a>+++</a>)--- --- U+29FB, TRIPLE PLUS-(⧻) :: ArrowChoice ⇝ => (α ⇝ β) -> (α' ⇝ β') -> (Either α α' ⇝ Either β β')---- | (⫴) = (<a>|||</a>)--- --- U+2AF4, TRIPLE VERTICAL BAR BINARY RELATION-(⫴) :: ArrowChoice ⇝ => (α ⇝ δ) -> (β ⇝ δ) -> (Either α β ⇝ δ)
− data/containers.txt
@@ -1,2909 +0,0 @@--- Hoogle documentation, generated by Haddock--- See Hoogle, http://www.haskell.org/hoogle/----- | Assorted concrete container types--- --- This package contains efficient general-purpose implementations of--- various basic immutable container types. The declared cost of each--- operation is either worst-case or amortized, but remains valid even if--- structures are shared.-@package containers-@version 0.4.0.0----- | An efficient implementation of sets.--- --- Since many function names (but not the type name) clash with--- <a>Prelude</a> names, this module is usually imported--- <tt>qualified</tt>, e.g.--- --- <pre>--- import Data.Set (Set)--- import qualified Data.Set as Set--- </pre>--- --- The implementation of <a>Set</a> is based on <i>size balanced</i>--- binary trees (or trees of <i>bounded balance</i>) as described by:--- --- <ul>--- <li>Stephen Adams, "<i>Efficient sets: a balancing act</i>", Journal--- of Functional Programming 3(4):553-562, October 1993,--- <a>http://www.swiss.ai.mit.edu/~adams/BB/</a>.</li>--- <li>J. Nievergelt and E.M. Reingold, "<i>Binary search trees of--- bounded balance</i>", SIAM journal of computing 2(1), March 1973.</li>--- </ul>--- --- Note that the implementation is <i>left-biased</i> -- the elements of--- a first argument are always preferred to the second, for example in--- <a>union</a> or <a>insert</a>. Of course, left-biasing can only be--- observed when equality is an equivalence relation instead of--- structural equality.-module Data.Set---- | A set of values <tt>a</tt>.-data Set a---- | <i>O(n+m)</i>. See <a>difference</a>.-(\\) :: Ord a => Set a -> Set a -> Set a---- | <i>O(1)</i>. Is this the empty set?-null :: Set a -> Bool---- | <i>O(1)</i>. The number of elements in the set.-size :: Set a -> Int---- | <i>O(log n)</i>. Is the element in the set?-member :: Ord a => a -> Set a -> Bool---- | <i>O(log n)</i>. Is the element not in the set?-notMember :: Ord a => a -> Set a -> Bool---- | <i>O(n+m)</i>. Is this a subset? <tt>(s1 <a>isSubsetOf</a> s2)</tt>--- tells whether <tt>s1</tt> is a subset of <tt>s2</tt>.-isSubsetOf :: Ord a => Set a -> Set a -> Bool---- | <i>O(n+m)</i>. Is this a proper subset? (ie. a subset but not equal).-isProperSubsetOf :: Ord a => Set a -> Set a -> Bool---- | <i>O(1)</i>. The empty set.-empty :: Set a---- | <i>O(1)</i>. Create a singleton set.-singleton :: a -> Set a---- | <i>O(log n)</i>. Insert an element in a set. If the set already--- contains an element equal to the given value, it is replaced with the--- new value.-insert :: Ord a => a -> Set a -> Set a---- | <i>O(log n)</i>. Delete an element from a set.-delete :: Ord a => a -> Set a -> Set a---- | <i>O(n+m)</i>. The union of two sets, preferring the first set when--- equal elements are encountered. The implementation uses the efficient--- <i>hedge-union</i> algorithm. Hedge-union is more efficient on (bigset--- <a>union</a> smallset).-union :: Ord a => Set a -> Set a -> Set a---- | The union of a list of sets: (<tt><a>unions</a> == <a>foldl</a>--- <a>union</a> <a>empty</a></tt>).-unions :: Ord a => [Set a] -> Set a---- | <i>O(n+m)</i>. Difference of two sets. The implementation uses an--- efficient <i>hedge</i> algorithm comparable with <i>hedge-union</i>.-difference :: Ord a => Set a -> Set a -> Set a---- | <i>O(n+m)</i>. The intersection of two sets. Elements of the result--- come from the first set, so for example--- --- <pre>--- import qualified Data.Set as S--- data AB = A | B deriving Show--- instance Ord AB where compare _ _ = EQ--- instance Eq AB where _ == _ = True--- main = print (S.singleton A `S.intersection` S.singleton B,--- S.singleton B `S.intersection` S.singleton A)--- </pre>--- --- prints <tt>(fromList [A],fromList [B])</tt>.-intersection :: Ord a => Set a -> Set a -> Set a---- | <i>O(n)</i>. Filter all elements that satisfy the predicate.-filter :: Ord a => (a -> Bool) -> Set a -> Set a---- | <i>O(n)</i>. Partition the set into two sets, one with all elements--- that satisfy the predicate and one with all elements that don't--- satisfy the predicate. See also <a>split</a>.-partition :: Ord a => (a -> Bool) -> Set a -> (Set a, Set a)---- | <i>O(log n)</i>. The expression (<tt><a>split</a> x set</tt>) is a--- pair <tt>(set1,set2)</tt> where <tt>set1</tt> comprises the elements--- of <tt>set</tt> less than <tt>x</tt> and <tt>set2</tt> comprises the--- elements of <tt>set</tt> greater than <tt>x</tt>.-split :: Ord a => a -> Set a -> (Set a, Set a)---- | <i>O(log n)</i>. Performs a <a>split</a> but also returns whether the--- pivot element was found in the original set.-splitMember :: Ord a => a -> Set a -> (Set a, Bool, Set a)---- | <i>O(n*log n)</i>. <tt><a>map</a> f s</tt> is the set obtained by--- applying <tt>f</tt> to each element of <tt>s</tt>.--- --- It's worth noting that the size of the result may be smaller if, for--- some <tt>(x,y)</tt>, <tt>x /= y && f x == f y</tt>-map :: (Ord a, Ord b) => (a -> b) -> Set a -> Set b---- | <i>O(n)</i>. The--- --- <tt><a>mapMonotonic</a> f s == <a>map</a> f s</tt>, but works only--- when <tt>f</tt> is monotonic. <i>The precondition is not checked.</i>--- Semi-formally, we have:--- --- <pre>--- and [x < y ==> f x < f y | x <- ls, y <- ls] --- ==> mapMonotonic f s == map f s--- where ls = toList s--- </pre>-mapMonotonic :: (a -> b) -> Set a -> Set b---- | <i>O(n)</i>. Fold over the elements of a set in an unspecified order.-fold :: (a -> b -> b) -> b -> Set a -> b---- | <i>O(log n)</i>. The minimal element of a set.-findMin :: Set a -> a---- | <i>O(log n)</i>. The maximal element of a set.-findMax :: Set a -> a---- | <i>O(log n)</i>. Delete the minimal element.-deleteMin :: Set a -> Set a---- | <i>O(log n)</i>. Delete the maximal element.-deleteMax :: Set a -> Set a---- | <i>O(log n)</i>. Delete and find the minimal element.--- --- <pre>--- deleteFindMin set = (findMin set, deleteMin set)--- </pre>-deleteFindMin :: Set a -> (a, Set a)---- | <i>O(log n)</i>. Delete and find the maximal element.--- --- <pre>--- deleteFindMax set = (findMax set, deleteMax set)--- </pre>-deleteFindMax :: Set a -> (a, Set a)---- | <i>O(log n)</i>. Retrieves the maximal key of the set, and the set--- stripped of that element, or <a>Nothing</a> if passed an empty set.-maxView :: Set a -> Maybe (a, Set a)---- | <i>O(log n)</i>. Retrieves the minimal key of the set, and the set--- stripped of that element, or <a>Nothing</a> if passed an empty set.-minView :: Set a -> Maybe (a, Set a)---- | <i>O(n)</i>. The elements of a set.-elems :: Set a -> [a]---- | <i>O(n)</i>. Convert the set to a list of elements.-toList :: Set a -> [a]---- | <i>O(n*log n)</i>. Create a set from a list of elements.-fromList :: Ord a => [a] -> Set a---- | <i>O(n)</i>. Convert the set to an ascending list of elements.-toAscList :: Set a -> [a]---- | <i>O(n)</i>. Build a set from an ascending list in linear time. <i>The--- precondition (input list is ascending) is not checked.</i>-fromAscList :: Eq a => [a] -> Set a---- | <i>O(n)</i>. Build a set from an ascending list of distinct elements--- in linear time. <i>The precondition (input list is strictly ascending)--- is not checked.</i>-fromDistinctAscList :: [a] -> Set a---- | <i>O(n)</i>. Show the tree that implements the set. The tree is shown--- in a compressed, hanging format.-showTree :: Show a => Set a -> String---- | <i>O(n)</i>. The expression (<tt>showTreeWith hang wide map</tt>)--- shows the tree that implements the set. If <tt>hang</tt> is--- <tt>True</tt>, a <i>hanging</i> tree is shown otherwise a rotated tree--- is shown. If <tt>wide</tt> is <a>True</a>, an extra wide version is--- shown.--- --- <pre>--- Set> putStrLn $ showTreeWith True False $ fromDistinctAscList [1..5]--- 4--- +--2--- | +--1--- | +--3--- +--5--- --- Set> putStrLn $ showTreeWith True True $ fromDistinctAscList [1..5]--- 4--- |--- +--2--- | |--- | +--1--- | |--- | +--3--- |--- +--5--- --- Set> putStrLn $ showTreeWith False True $ fromDistinctAscList [1..5]--- +--5--- |--- 4--- |--- | +--3--- | |--- +--2--- |--- +--1--- </pre>-showTreeWith :: Show a => Bool -> Bool -> Set a -> String---- | <i>O(n)</i>. Test if the internal set structure is valid.-valid :: Ord a => Set a -> Bool-instance Typeable1 Set-instance (Read a, Ord a) => Read (Set a)-instance Show a => Show (Set a)-instance Ord a => Ord (Set a)-instance Eq a => Eq (Set a)-instance (Data a, Ord a) => Data (Set a)-instance Foldable Set-instance Ord a => Monoid (Set a)----- | An efficient implementation of maps from keys to values--- (dictionaries).--- --- Since many function names (but not the type name) clash with--- <a>Prelude</a> names, this module is usually imported--- <tt>qualified</tt>, e.g.--- --- <pre>--- import Data.Map (Map)--- import qualified Data.Map as Map--- </pre>--- --- The implementation of <a>Map</a> is based on <i>size balanced</i>--- binary trees (or trees of <i>bounded balance</i>) as described by:--- --- <ul>--- <li>Stephen Adams, "<i>Efficient sets: a balancing act</i>", Journal--- of Functional Programming 3(4):553-562, October 1993,--- <a>http://www.swiss.ai.mit.edu/~adams/BB/</a>.</li>--- <li>J. Nievergelt and E.M. Reingold, "<i>Binary search trees of--- bounded balance</i>", SIAM journal of computing 2(1), March 1973.</li>--- </ul>--- --- Note that the implementation is <i>left-biased</i> -- the elements of--- a first argument are always preferred to the second, for example in--- <a>union</a> or <a>insert</a>.--- --- Operation comments contain the operation time complexity in the Big-O--- notation <a>http://en.wikipedia.org/wiki/Big_O_notation</a>.-module Data.Map---- | A Map from keys <tt>k</tt> to values <tt>a</tt>.-data Map k a---- | <i>O(log n)</i>. Find the value at a key. Calls <a>error</a> when the--- element can not be found.--- --- <pre>--- fromList [(5,'a'), (3,'b')] ! 1 Error: element not in the map--- fromList [(5,'a'), (3,'b')] ! 5 == 'a'--- </pre>-(!) :: Ord k => Map k a -> k -> a---- | Same as <a>difference</a>.-(\\) :: Ord k => Map k a -> Map k b -> Map k a---- | <i>O(1)</i>. Is the map empty?--- --- <pre>--- Data.Map.null (empty) == True--- Data.Map.null (singleton 1 'a') == False--- </pre>-null :: Map k a -> Bool---- | <i>O(1)</i>. The number of elements in the map.--- --- <pre>--- size empty == 0--- size (singleton 1 'a') == 1--- size (fromList([(1,'a'), (2,'c'), (3,'b')])) == 3--- </pre>-size :: Map k a -> Int---- | <i>O(log n)</i>. Is the key a member of the map? See also--- <a>notMember</a>.--- --- <pre>--- member 5 (fromList [(5,'a'), (3,'b')]) == True--- member 1 (fromList [(5,'a'), (3,'b')]) == False--- </pre>-member :: Ord k => k -> Map k a -> Bool---- | <i>O(log n)</i>. Is the key not a member of the map? See also--- <a>member</a>.--- --- <pre>--- notMember 5 (fromList [(5,'a'), (3,'b')]) == False--- notMember 1 (fromList [(5,'a'), (3,'b')]) == True--- </pre>-notMember :: Ord k => k -> Map k a -> Bool---- | <i>O(log n)</i>. Lookup the value at a key in the map.--- --- The function will return the corresponding value as <tt>(<a>Just</a>--- value)</tt>, or <a>Nothing</a> if the key isn't in the map.--- --- An example of using <tt>lookup</tt>:--- --- <pre>--- import Prelude hiding (lookup)--- import Data.Map--- --- employeeDept = fromList([("John","Sales"), ("Bob","IT")])--- deptCountry = fromList([("IT","USA"), ("Sales","France")])--- countryCurrency = fromList([("USA", "Dollar"), ("France", "Euro")])--- --- employeeCurrency :: String -> Maybe String--- employeeCurrency name = do--- dept <- lookup name employeeDept--- country <- lookup dept deptCountry--- lookup country countryCurrency--- --- main = do--- putStrLn $ "John's currency: " ++ (show (employeeCurrency "John"))--- putStrLn $ "Pete's currency: " ++ (show (employeeCurrency "Pete"))--- </pre>--- --- The output of this program:--- --- <pre>--- John's currency: Just "Euro"--- Pete's currency: Nothing--- </pre>-lookup :: Ord k => k -> Map k a -> Maybe a---- | <i>O(log n)</i>. The expression <tt>(<a>findWithDefault</a> def k--- map)</tt> returns the value at key <tt>k</tt> or returns default value--- <tt>def</tt> when the key is not in the map.--- --- <pre>--- findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x'--- findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'--- </pre>-findWithDefault :: Ord k => a -> k -> Map k a -> a---- | <i>O(1)</i>. The empty map.--- --- <pre>--- empty == fromList []--- size empty == 0--- </pre>-empty :: Map k a---- | <i>O(1)</i>. A map with a single element.--- --- <pre>--- singleton 1 'a' == fromList [(1, 'a')]--- size (singleton 1 'a') == 1--- </pre>-singleton :: k -> a -> Map k a---- | <i>O(log n)</i>. Insert a new key and value in the map. If the key is--- already present in the map, the associated value is replaced with the--- supplied value. <a>insert</a> is equivalent to <tt><a>insertWith</a>--- <a>const</a></tt>.--- --- <pre>--- insert 5 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'x')]--- insert 7 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'a'), (7, 'x')]--- insert 5 'x' empty == singleton 5 'x'--- </pre>-insert :: Ord k => k -> a -> Map k a -> Map k a---- | <i>O(log n)</i>. Insert with a function, combining new value and old--- value. <tt><a>insertWith</a> f key value mp</tt> will insert the pair--- (key, value) into <tt>mp</tt> if key does not exist in the map. If the--- key does exist, the function will insert the pair <tt>(key, f--- new_value old_value)</tt>.--- --- <pre>--- insertWith (++) 5 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "xxxa")]--- insertWith (++) 7 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a"), (7, "xxx")]--- insertWith (++) 5 "xxx" empty == singleton 5 "xxx"--- </pre>-insertWith :: Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a---- | Same as <a>insertWith</a>, but the combining function is applied--- strictly. This is often the most desirable behavior.--- --- For example, to update a counter:--- --- <pre>--- insertWith' (+) k 1 m--- </pre>-insertWith' :: Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a---- | <i>O(log n)</i>. Insert with a function, combining key, new value and--- old value. <tt><a>insertWithKey</a> f key value mp</tt> will insert--- the pair (key, value) into <tt>mp</tt> if key does not exist in the--- map. If the key does exist, the function will insert the pair--- <tt>(key,f key new_value old_value)</tt>. Note that the key passed to--- f is the same key passed to <a>insertWithKey</a>.--- --- <pre>--- let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value--- insertWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:xxx|a")]--- insertWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a"), (7, "xxx")]--- insertWithKey f 5 "xxx" empty == singleton 5 "xxx"--- </pre>-insertWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a---- | Same as <a>insertWithKey</a>, but the combining function is applied--- strictly.-insertWithKey' :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a---- | <i>O(log n)</i>. Combines insert operation with old value retrieval.--- The expression (<tt><a>insertLookupWithKey</a> f k x map</tt>) is a--- pair where the first element is equal to (<tt><a>lookup</a> k--- map</tt>) and the second element equal to (<tt><a>insertWithKey</a> f--- k x map</tt>).--- --- <pre>--- let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value--- insertLookupWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "5:xxx|a")])--- insertLookupWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a"), (7, "xxx")])--- insertLookupWithKey f 5 "xxx" empty == (Nothing, singleton 5 "xxx")--- </pre>--- --- This is how to define <tt>insertLookup</tt> using--- <tt>insertLookupWithKey</tt>:--- --- <pre>--- let insertLookup kx x t = insertLookupWithKey (\_ a _ -> a) kx x t--- insertLookup 5 "x" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "x")])--- insertLookup 7 "x" (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a"), (7, "x")])--- </pre>-insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a)---- | <i>O(log n)</i>. A strict version of <a>insertLookupWithKey</a>.-insertLookupWithKey' :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a)---- | <i>O(log n)</i>. Delete a key and its value from the map. When the key--- is not a member of the map, the original map is returned.--- --- <pre>--- delete 5 (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- delete 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- delete 5 empty == empty--- </pre>-delete :: Ord k => k -> Map k a -> Map k a---- | <i>O(log n)</i>. Update a value at a specific key with the result of--- the provided function. When the key is not a member of the map, the--- original map is returned.--- --- <pre>--- adjust ("new " ++) 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "new a")]--- adjust ("new " ++) 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- adjust ("new " ++) 7 empty == empty--- </pre>-adjust :: Ord k => (a -> a) -> k -> Map k a -> Map k a---- | <i>O(log n)</i>. Adjust a value at a specific key. When the key is not--- a member of the map, the original map is returned.--- --- <pre>--- let f key x = (show key) ++ ":new " ++ x--- adjustWithKey f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:new a")]--- adjustWithKey f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- adjustWithKey f 7 empty == empty--- </pre>-adjustWithKey :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a---- | <i>O(log n)</i>. The expression (<tt><a>update</a> f k map</tt>)--- updates the value <tt>x</tt> at <tt>k</tt> (if it is in the map). If--- (<tt>f x</tt>) is <a>Nothing</a>, the element is deleted. If it is--- (<tt><a>Just</a> y</tt>), the key <tt>k</tt> is bound to the new value--- <tt>y</tt>.--- --- <pre>--- let f x = if x == "a" then Just "new a" else Nothing--- update f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "new a")]--- update f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- update f 3 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- </pre>-update :: Ord k => (a -> Maybe a) -> k -> Map k a -> Map k a---- | <i>O(log n)</i>. The expression (<tt><a>updateWithKey</a> f k--- map</tt>) updates the value <tt>x</tt> at <tt>k</tt> (if it is in the--- map). If (<tt>f k x</tt>) is <a>Nothing</a>, the element is deleted.--- If it is (<tt><a>Just</a> y</tt>), the key <tt>k</tt> is bound to the--- new value <tt>y</tt>.--- --- <pre>--- let f k x = if x == "a" then Just ((show k) ++ ":new a") else Nothing--- updateWithKey f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:new a")]--- updateWithKey f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- updateWithKey f 3 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- </pre>-updateWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> Map k a---- | <i>O(log n)</i>. Lookup and update. See also <a>updateWithKey</a>. The--- function returns changed value, if it is updated. Returns the original--- key value if the map entry is deleted.--- --- <pre>--- let f k x = if x == "a" then Just ((show k) ++ ":new a") else Nothing--- updateLookupWithKey f 5 (fromList [(5,"a"), (3,"b")]) == (Just "5:new a", fromList [(3, "b"), (5, "5:new a")])--- updateLookupWithKey f 7 (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a")])--- updateLookupWithKey f 3 (fromList [(5,"a"), (3,"b")]) == (Just "b", singleton 5 "a")--- </pre>-updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a)---- | <i>O(log n)</i>. The expression (<tt><a>alter</a> f k map</tt>) alters--- the value <tt>x</tt> at <tt>k</tt>, or absence thereof. <a>alter</a>--- can be used to insert, delete, or update a value in a <a>Map</a>. In--- short : <tt><a>lookup</a> k (<a>alter</a> f k m) = f (<a>lookup</a> k--- m)</tt>.--- --- <pre>--- let f _ = Nothing--- alter f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- alter f 5 (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- --- let f _ = Just "c"--- alter f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a"), (7, "c")]--- alter f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "c")]--- </pre>-alter :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a---- | <i>O(n+m)</i>. The expression (<tt><a>union</a> t1 t2</tt>) takes the--- left-biased union of <tt>t1</tt> and <tt>t2</tt>. It prefers--- <tt>t1</tt> when duplicate keys are encountered, i.e.--- (<tt><a>union</a> == <a>unionWith</a> <a>const</a></tt>). The--- implementation uses the efficient <i>hedge-union</i> algorithm.--- Hedge-union is more efficient on (bigset `<a>union</a>` smallset).--- --- <pre>--- union (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "a"), (7, "C")]--- </pre>-union :: Ord k => Map k a -> Map k a -> Map k a---- | <i>O(n+m)</i>. Union with a combining function. The implementation--- uses the efficient <i>hedge-union</i> algorithm.--- --- <pre>--- unionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "aA"), (7, "C")]--- </pre>-unionWith :: Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a---- | <i>O(n+m)</i>. Union with a combining function. The implementation--- uses the efficient <i>hedge-union</i> algorithm. Hedge-union is more--- efficient on (bigset `<a>union</a>` smallset).--- --- <pre>--- let f key left_value right_value = (show key) ++ ":" ++ left_value ++ "|" ++ right_value--- unionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "5:a|A"), (7, "C")]--- </pre>-unionWithKey :: Ord k => (k -> a -> a -> a) -> Map k a -> Map k a -> Map k a---- | The union of a list of maps: (<tt><a>unions</a> == <a>foldl</a>--- <a>union</a> <a>empty</a></tt>).--- --- <pre>--- unions [(fromList [(5, "a"), (3, "b")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "A3"), (3, "B3")])]--- == fromList [(3, "b"), (5, "a"), (7, "C")]--- unions [(fromList [(5, "A3"), (3, "B3")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "a"), (3, "b")])]--- == fromList [(3, "B3"), (5, "A3"), (7, "C")]--- </pre>-unions :: Ord k => [Map k a] -> Map k a---- | The union of a list of maps, with a combining operation:--- (<tt><a>unionsWith</a> f == <a>foldl</a> (<a>unionWith</a> f)--- <a>empty</a></tt>).--- --- <pre>--- unionsWith (++) [(fromList [(5, "a"), (3, "b")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "A3"), (3, "B3")])]--- == fromList [(3, "bB3"), (5, "aAA3"), (7, "C")]--- </pre>-unionsWith :: Ord k => (a -> a -> a) -> [Map k a] -> Map k a---- | <i>O(n+m)</i>. Difference of two maps. Return elements of the first--- map not existing in the second map. The implementation uses an--- efficient <i>hedge</i> algorithm comparable with <i>hedge-union</i>.--- --- <pre>--- difference (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 3 "b"--- </pre>-difference :: Ord k => Map k a -> Map k b -> Map k a---- | <i>O(n+m)</i>. Difference with a combining function. When two equal--- keys are encountered, the combining function is applied to the values--- of these keys. If it returns <a>Nothing</a>, the element is discarded--- (proper set difference). If it returns (<tt><a>Just</a> y</tt>), the--- element is updated with a new value <tt>y</tt>. The implementation--- uses an efficient <i>hedge</i> algorithm comparable with--- <i>hedge-union</i>.--- --- <pre>--- let f al ar = if al == "b" then Just (al ++ ":" ++ ar) else Nothing--- differenceWith f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (3, "B"), (7, "C")])--- == singleton 3 "b:B"--- </pre>-differenceWith :: Ord k => (a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a---- | <i>O(n+m)</i>. Difference with a combining function. When two equal--- keys are encountered, the combining function is applied to the key and--- both values. If it returns <a>Nothing</a>, the element is discarded--- (proper set difference). If it returns (<tt><a>Just</a> y</tt>), the--- element is updated with a new value <tt>y</tt>. The implementation--- uses an efficient <i>hedge</i> algorithm comparable with--- <i>hedge-union</i>.--- --- <pre>--- let f k al ar = if al == "b" then Just ((show k) ++ ":" ++ al ++ "|" ++ ar) else Nothing--- differenceWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (3, "B"), (10, "C")])--- == singleton 3 "3:b|B"--- </pre>-differenceWithKey :: Ord k => (k -> a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a---- | <i>O(n+m)</i>. Intersection of two maps. Return data in the first map--- for the keys existing in both maps. (<tt><a>intersection</a> m1 m2 ==--- <a>intersectionWith</a> <a>const</a> m1 m2</tt>).--- --- <pre>--- intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a"--- </pre>-intersection :: Ord k => Map k a -> Map k b -> Map k a---- | <i>O(n+m)</i>. Intersection with a combining function.--- --- <pre>--- intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA"--- </pre>-intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c---- | <i>O(n+m)</i>. Intersection with a combining function. Intersection is--- more efficient on (bigset `<a>intersection</a>` smallset).--- --- <pre>--- let f k al ar = (show k) ++ ":" ++ al ++ "|" ++ ar--- intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A"--- </pre>-intersectionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c---- | <i>O(n)</i>. Map a function over all values in the map.--- --- <pre>--- map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")]--- </pre>-map :: (a -> b) -> Map k a -> Map k b---- | <i>O(n)</i>. Map a function over all values in the map.--- --- <pre>--- let f key x = (show key) ++ ":" ++ x--- mapWithKey f (fromList [(5,"a"), (3,"b")]) == fromList [(3, "3:b"), (5, "5:a")]--- </pre>-mapWithKey :: (k -> a -> b) -> Map k a -> Map k b---- | <i>O(n)</i>. The function <a>mapAccum</a> threads an accumulating--- argument through the map in ascending order of keys.--- --- <pre>--- let f a b = (a ++ b, b ++ "X")--- mapAccum f "Everything: " (fromList [(5,"a"), (3,"b")]) == ("Everything: ba", fromList [(3, "bX"), (5, "aX")])--- </pre>-mapAccum :: (a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)---- | <i>O(n)</i>. The function <a>mapAccumWithKey</a> threads an--- accumulating argument through the map in ascending order of keys.--- --- <pre>--- let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X")--- mapAccumWithKey f "Everything:" (fromList [(5,"a"), (3,"b")]) == ("Everything: 3-b 5-a", fromList [(3, "bX"), (5, "aX")])--- </pre>-mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)---- | <i>O(n)</i>. The function <tt>mapAccumR</tt> threads an accumulating--- argument through the map in descending order of keys.-mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)---- | <i>O(n*log n)</i>. <tt><a>mapKeys</a> f s</tt> is the map obtained by--- applying <tt>f</tt> to each key of <tt>s</tt>.--- --- The size of the result may be smaller if <tt>f</tt> maps two or more--- distinct keys to the same new key. In this case the value at the--- smallest of these keys is retained.--- --- <pre>--- mapKeys (+ 1) (fromList [(5,"a"), (3,"b")]) == fromList [(4, "b"), (6, "a")]--- mapKeys (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "c"--- mapKeys (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 3 "c"--- </pre>-mapKeys :: Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a---- | <i>O(n*log n)</i>. <tt><a>mapKeysWith</a> c f s</tt> is the map--- obtained by applying <tt>f</tt> to each key of <tt>s</tt>.--- --- The size of the result may be smaller if <tt>f</tt> maps two or more--- distinct keys to the same new key. In this case the associated values--- will be combined using <tt>c</tt>.--- --- <pre>--- mapKeysWith (++) (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "cdab"--- mapKeysWith (++) (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 3 "cdab"--- </pre>-mapKeysWith :: Ord k2 => (a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a---- | <i>O(n)</i>. <tt><a>mapKeysMonotonic</a> f s == <a>mapKeys</a> f--- s</tt>, but works only when <tt>f</tt> is strictly monotonic. That is,--- for any values <tt>x</tt> and <tt>y</tt>, if <tt>x</tt> <--- <tt>y</tt> then <tt>f x</tt> < <tt>f y</tt>. <i>The precondition is--- not checked.</i> Semi-formally, we have:--- --- <pre>--- and [x < y ==> f x < f y | x <- ls, y <- ls] --- ==> mapKeysMonotonic f s == mapKeys f s--- where ls = keys s--- </pre>--- --- This means that <tt>f</tt> maps distinct original keys to distinct--- resulting keys. This function has better performance than--- <a>mapKeys</a>.--- --- <pre>--- mapKeysMonotonic (\ k -> k * 2) (fromList [(5,"a"), (3,"b")]) == fromList [(6, "b"), (10, "a")]--- valid (mapKeysMonotonic (\ k -> k * 2) (fromList [(5,"a"), (3,"b")])) == True--- valid (mapKeysMonotonic (\ _ -> 1) (fromList [(5,"a"), (3,"b")])) == False--- </pre>-mapKeysMonotonic :: (k1 -> k2) -> Map k1 a -> Map k2 a---- | <i>O(n)</i>. Fold the values in the map, such that <tt><a>fold</a> f z--- == <a>foldr</a> f z . <a>elems</a></tt>. For example,--- --- <pre>--- elems map = fold (:) [] map--- </pre>--- --- <pre>--- let f a len = len + (length a)--- fold f 0 (fromList [(5,"a"), (3,"bbb")]) == 4--- </pre>-fold :: (a -> b -> b) -> b -> Map k a -> b---- | <i>O(n)</i>. Fold the keys and values in the map, such that--- <tt><a>foldWithKey</a> f z == <a>foldr</a> (<a>uncurry</a> f) z .--- <a>toAscList</a></tt>. For example,--- --- <pre>--- keys map = foldWithKey (\k x ks -> k:ks) [] map--- </pre>--- --- <pre>--- let f k a result = result ++ "(" ++ (show k) ++ ":" ++ a ++ ")"--- foldWithKey f "Map: " (fromList [(5,"a"), (3,"b")]) == "Map: (5:a)(3:b)"--- </pre>--- --- This is identical to <a>foldrWithKey</a>, and you should use that one--- instead of this one. This name is kept for backward compatibility.-foldWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b---- | <i>O(n)</i>. Post-order fold. The function will be applied from the--- lowest value to the highest.-foldrWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b---- | <i>O(n)</i>. Pre-order fold. The function will be applied from the--- highest value to the lowest.-foldlWithKey :: (b -> k -> a -> b) -> b -> Map k a -> b---- | <i>O(n)</i>. Return all elements of the map in the ascending order of--- their keys.--- --- <pre>--- elems (fromList [(5,"a"), (3,"b")]) == ["b","a"]--- elems empty == []--- </pre>-elems :: Map k a -> [a]---- | <i>O(n)</i>. Return all keys of the map in ascending order.--- --- <pre>--- keys (fromList [(5,"a"), (3,"b")]) == [3,5]--- keys empty == []--- </pre>-keys :: Map k a -> [k]---- | <i>O(n)</i>. The set of all keys of the map.--- --- <pre>--- keysSet (fromList [(5,"a"), (3,"b")]) == Data.Set.fromList [3,5]--- keysSet empty == Data.Set.empty--- </pre>-keysSet :: Map k a -> Set k---- | <i>O(n)</i>. Return all key/value pairs in the map in ascending key--- order.--- --- <pre>--- assocs (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]--- assocs empty == []--- </pre>-assocs :: Map k a -> [(k, a)]---- | <i>O(n)</i>. Convert to a list of key/value pairs.--- --- <pre>--- toList (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]--- toList empty == []--- </pre>-toList :: Map k a -> [(k, a)]---- | <i>O(n*log n)</i>. Build a map from a list of key/value pairs. See--- also <a>fromAscList</a>. If the list contains more than one value for--- the same key, the last value for the key is retained.--- --- <pre>--- fromList [] == empty--- fromList [(5,"a"), (3,"b"), (5, "c")] == fromList [(5,"c"), (3,"b")]--- fromList [(5,"c"), (3,"b"), (5, "a")] == fromList [(5,"a"), (3,"b")]--- </pre>-fromList :: Ord k => [(k, a)] -> Map k a---- | <i>O(n*log n)</i>. Build a map from a list of key/value pairs with a--- combining function. See also <a>fromAscListWith</a>.--- --- <pre>--- fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"a")] == fromList [(3, "ab"), (5, "aba")]--- fromListWith (++) [] == empty--- </pre>-fromListWith :: Ord k => (a -> a -> a) -> [(k, a)] -> Map k a---- | <i>O(n*log n)</i>. Build a map from a list of key/value pairs with a--- combining function. See also <a>fromAscListWithKey</a>.--- --- <pre>--- let f k a1 a2 = (show k) ++ a1 ++ a2--- fromListWithKey f [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"a")] == fromList [(3, "3ab"), (5, "5a5ba")]--- fromListWithKey f [] == empty--- </pre>-fromListWithKey :: Ord k => (k -> a -> a -> a) -> [(k, a)] -> Map k a---- | <i>O(n)</i>. Convert to an ascending list.--- --- <pre>--- toAscList (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]--- </pre>-toAscList :: Map k a -> [(k, a)]---- | <i>O(n)</i>. Convert to a descending list.-toDescList :: Map k a -> [(k, a)]---- | <i>O(n)</i>. Build a map from an ascending list in linear time. <i>The--- precondition (input list is ascending) is not checked.</i>--- --- <pre>--- fromAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")]--- fromAscList [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "b")]--- valid (fromAscList [(3,"b"), (5,"a"), (5,"b")]) == True--- valid (fromAscList [(5,"a"), (3,"b"), (5,"b")]) == False--- </pre>-fromAscList :: Eq k => [(k, a)] -> Map k a---- | <i>O(n)</i>. Build a map from an ascending list in linear time with a--- combining function for equal keys. <i>The precondition (input list is--- ascending) is not checked.</i>--- --- <pre>--- fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "ba")]--- valid (fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")]) == True--- valid (fromAscListWith (++) [(5,"a"), (3,"b"), (5,"b")]) == False--- </pre>-fromAscListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> Map k a---- | <i>O(n)</i>. Build a map from an ascending list in linear time with a--- combining function for equal keys. <i>The precondition (input list is--- ascending) is not checked.</i>--- --- <pre>--- let f k a1 a2 = (show k) ++ ":" ++ a1 ++ a2--- fromAscListWithKey f [(3,"b"), (5,"a"), (5,"b"), (5,"b")] == fromList [(3, "b"), (5, "5:b5:ba")]--- valid (fromAscListWithKey f [(3,"b"), (5,"a"), (5,"b"), (5,"b")]) == True--- valid (fromAscListWithKey f [(5,"a"), (3,"b"), (5,"b"), (5,"b")]) == False--- </pre>-fromAscListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> Map k a---- | <i>O(n)</i>. Build a map from an ascending list of distinct elements--- in linear time. <i>The precondition is not checked.</i>--- --- <pre>--- fromDistinctAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")]--- valid (fromDistinctAscList [(3,"b"), (5,"a")]) == True--- valid (fromDistinctAscList [(3,"b"), (5,"a"), (5,"b")]) == False--- </pre>-fromDistinctAscList :: [(k, a)] -> Map k a---- | <i>O(n)</i>. Filter all values that satisfy the predicate.--- --- <pre>--- filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty--- filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty--- </pre>-filter :: Ord k => (a -> Bool) -> Map k a -> Map k a---- | <i>O(n)</i>. Filter all keys/values that satisfy the predicate.--- --- <pre>--- filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- </pre>-filterWithKey :: Ord k => (k -> a -> Bool) -> Map k a -> Map k a---- | <i>O(n)</i>. Partition the map according to a predicate. The first map--- contains all elements that satisfy the predicate, the second all--- elements that fail the predicate. See also <a>split</a>.--- --- <pre>--- partition (> "a") (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a")--- partition (< "x") (fromList [(5,"a"), (3,"b")]) == (fromList [(3, "b"), (5, "a")], empty)--- partition (> "x") (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3, "b"), (5, "a")])--- </pre>-partition :: Ord k => (a -> Bool) -> Map k a -> (Map k a, Map k a)---- | <i>O(n)</i>. Partition the map according to a predicate. The first map--- contains all elements that satisfy the predicate, the second all--- elements that fail the predicate. See also <a>split</a>.--- --- <pre>--- partitionWithKey (\ k _ -> k > 3) (fromList [(5,"a"), (3,"b")]) == (singleton 5 "a", singleton 3 "b")--- partitionWithKey (\ k _ -> k < 7) (fromList [(5,"a"), (3,"b")]) == (fromList [(3, "b"), (5, "a")], empty)--- partitionWithKey (\ k _ -> k > 7) (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3, "b"), (5, "a")])--- </pre>-partitionWithKey :: Ord k => (k -> a -> Bool) -> Map k a -> (Map k a, Map k a)---- | <i>O(n)</i>. Map values and collect the <a>Just</a> results.--- --- <pre>--- let f x = if x == "a" then Just "new a" else Nothing--- mapMaybe f (fromList [(5,"a"), (3,"b")]) == singleton 5 "new a"--- </pre>-mapMaybe :: Ord k => (a -> Maybe b) -> Map k a -> Map k b---- | <i>O(n)</i>. Map keys/values and collect the <a>Just</a> results.--- --- <pre>--- let f k _ = if k < 5 then Just ("key : " ++ (show k)) else Nothing--- mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key : 3"--- </pre>-mapMaybeWithKey :: Ord k => (k -> a -> Maybe b) -> Map k a -> Map k b---- | <i>O(n)</i>. Map values and separate the <a>Left</a> and <a>Right</a>--- results.--- --- <pre>--- let f a = if a < "c" then Left a else Right a--- mapEither f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])--- == (fromList [(3,"b"), (5,"a")], fromList [(1,"x"), (7,"z")])--- --- mapEither (\ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])--- == (empty, fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])--- </pre>-mapEither :: Ord k => (a -> Either b c) -> Map k a -> (Map k b, Map k c)---- | <i>O(n)</i>. Map keys/values and separate the <a>Left</a> and--- <a>Right</a> results.--- --- <pre>--- let f k a = if k < 5 then Left (k * 2) else Right (a ++ a)--- mapEitherWithKey f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])--- == (fromList [(1,2), (3,6)], fromList [(5,"aa"), (7,"zz")])--- --- mapEitherWithKey (\_ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])--- == (empty, fromList [(1,"x"), (3,"b"), (5,"a"), (7,"z")])--- </pre>-mapEitherWithKey :: Ord k => (k -> a -> Either b c) -> Map k a -> (Map k b, Map k c)---- | <i>O(log n)</i>. The expression (<tt><a>split</a> k map</tt>) is a--- pair <tt>(map1,map2)</tt> where the keys in <tt>map1</tt> are smaller--- than <tt>k</tt> and the keys in <tt>map2</tt> larger than <tt>k</tt>.--- Any key equal to <tt>k</tt> is found in neither <tt>map1</tt> nor--- <tt>map2</tt>.--- --- <pre>--- split 2 (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3,"b"), (5,"a")])--- split 3 (fromList [(5,"a"), (3,"b")]) == (empty, singleton 5 "a")--- split 4 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a")--- split 5 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", empty)--- split 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], empty)--- </pre>-split :: Ord k => k -> Map k a -> (Map k a, Map k a)---- | <i>O(log n)</i>. The expression (<tt><a>splitLookup</a> k map</tt>)--- splits a map just like <a>split</a> but also returns <tt><a>lookup</a>--- k map</tt>.--- --- <pre>--- splitLookup 2 (fromList [(5,"a"), (3,"b")]) == (empty, Nothing, fromList [(3,"b"), (5,"a")])--- splitLookup 3 (fromList [(5,"a"), (3,"b")]) == (empty, Just "b", singleton 5 "a")--- splitLookup 4 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", Nothing, singleton 5 "a")--- splitLookup 5 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", Just "a", empty)--- splitLookup 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], Nothing, empty)--- </pre>-splitLookup :: Ord k => k -> Map k a -> (Map k a, Maybe a, Map k a)---- | <i>O(n+m)</i>. This function is defined as (<tt><a>isSubmapOf</a> =--- <a>isSubmapOfBy</a> (==)</tt>).-isSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool---- | <i>O(n+m)</i>. The expression (<tt><a>isSubmapOfBy</a> f t1 t2</tt>)--- returns <a>True</a> if all keys in <tt>t1</tt> are in tree--- <tt>t2</tt>, and when <tt>f</tt> returns <a>True</a> when applied to--- their respective values. For example, the following expressions are--- all <a>True</a>:--- --- <pre>--- isSubmapOfBy (==) (fromList [('a',1)]) (fromList [('a',1),('b',2)])--- isSubmapOfBy (<=) (fromList [('a',1)]) (fromList [('a',1),('b',2)])--- isSubmapOfBy (==) (fromList [('a',1),('b',2)]) (fromList [('a',1),('b',2)])--- </pre>--- --- But the following are all <a>False</a>:--- --- <pre>--- isSubmapOfBy (==) (fromList [('a',2)]) (fromList [('a',1),('b',2)])--- isSubmapOfBy (<) (fromList [('a',1)]) (fromList [('a',1),('b',2)])--- isSubmapOfBy (==) (fromList [('a',1),('b',2)]) (fromList [('a',1)])--- </pre>-isSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool---- | <i>O(n+m)</i>. Is this a proper submap? (ie. a submap but not equal).--- Defined as (<tt><a>isProperSubmapOf</a> = <a>isProperSubmapOfBy</a>--- (==)</tt>).-isProperSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool---- | <i>O(n+m)</i>. Is this a proper submap? (ie. a submap but not equal).--- The expression (<tt><a>isProperSubmapOfBy</a> f m1 m2</tt>) returns--- <a>True</a> when <tt>m1</tt> and <tt>m2</tt> are not equal, all keys--- in <tt>m1</tt> are in <tt>m2</tt>, and when <tt>f</tt> returns--- <a>True</a> when applied to their respective values. For example, the--- following expressions are all <a>True</a>:--- --- <pre>--- isProperSubmapOfBy (==) (fromList [(1,1)]) (fromList [(1,1),(2,2)])--- isProperSubmapOfBy (<=) (fromList [(1,1)]) (fromList [(1,1),(2,2)])--- </pre>--- --- But the following are all <a>False</a>:--- --- <pre>--- isProperSubmapOfBy (==) (fromList [(1,1),(2,2)]) (fromList [(1,1),(2,2)])--- isProperSubmapOfBy (==) (fromList [(1,1),(2,2)]) (fromList [(1,1)])--- isProperSubmapOfBy (<) (fromList [(1,1)]) (fromList [(1,1),(2,2)])--- </pre>-isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool---- | <i>O(log n)</i>. Lookup the <i>index</i> of a key. The index is a--- number from <i>0</i> up to, but not including, the <a>size</a> of the--- map.--- --- <pre>--- isJust (lookupIndex 2 (fromList [(5,"a"), (3,"b")])) == False--- fromJust (lookupIndex 3 (fromList [(5,"a"), (3,"b")])) == 0--- fromJust (lookupIndex 5 (fromList [(5,"a"), (3,"b")])) == 1--- isJust (lookupIndex 6 (fromList [(5,"a"), (3,"b")])) == False--- </pre>-lookupIndex :: Ord k => k -> Map k a -> Maybe Int---- | <i>O(log n)</i>. Return the <i>index</i> of a key. The index is a--- number from <i>0</i> up to, but not including, the <a>size</a> of the--- map. Calls <a>error</a> when the key is not a <a>member</a> of the--- map.--- --- <pre>--- findIndex 2 (fromList [(5,"a"), (3,"b")]) Error: element is not in the map--- findIndex 3 (fromList [(5,"a"), (3,"b")]) == 0--- findIndex 5 (fromList [(5,"a"), (3,"b")]) == 1--- findIndex 6 (fromList [(5,"a"), (3,"b")]) Error: element is not in the map--- </pre>-findIndex :: Ord k => k -> Map k a -> Int---- | <i>O(log n)</i>. Retrieve an element by <i>index</i>. Calls--- <a>error</a> when an invalid index is used.--- --- <pre>--- elemAt 0 (fromList [(5,"a"), (3,"b")]) == (3,"b")--- elemAt 1 (fromList [(5,"a"), (3,"b")]) == (5, "a")--- elemAt 2 (fromList [(5,"a"), (3,"b")]) Error: index out of range--- </pre>-elemAt :: Int -> Map k a -> (k, a)---- | <i>O(log n)</i>. Update the element at <i>index</i>. Calls--- <a>error</a> when an invalid index is used.--- --- <pre>--- updateAt (\ _ _ -> Just "x") 0 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "x"), (5, "a")]--- updateAt (\ _ _ -> Just "x") 1 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "x")]--- updateAt (\ _ _ -> Just "x") 2 (fromList [(5,"a"), (3,"b")]) Error: index out of range--- updateAt (\ _ _ -> Just "x") (-1) (fromList [(5,"a"), (3,"b")]) Error: index out of range--- updateAt (\_ _ -> Nothing) 0 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- updateAt (\_ _ -> Nothing) 1 (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- updateAt (\_ _ -> Nothing) 2 (fromList [(5,"a"), (3,"b")]) Error: index out of range--- updateAt (\_ _ -> Nothing) (-1) (fromList [(5,"a"), (3,"b")]) Error: index out of range--- </pre>-updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a---- | <i>O(log n)</i>. Delete the element at <i>index</i>. Defined as--- (<tt><a>deleteAt</a> i map = <a>updateAt</a> (k x ->--- <a>Nothing</a>) i map</tt>).--- --- <pre>--- deleteAt 0 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- deleteAt 1 (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- deleteAt 2 (fromList [(5,"a"), (3,"b")]) Error: index out of range--- deleteAt (-1) (fromList [(5,"a"), (3,"b")]) Error: index out of range--- </pre>-deleteAt :: Int -> Map k a -> Map k a---- | <i>O(log n)</i>. The minimal key of the map. Calls <a>error</a> is the--- map is empty.--- --- <pre>--- findMin (fromList [(5,"a"), (3,"b")]) == (3,"b")--- findMin empty Error: empty map has no minimal element--- </pre>-findMin :: Map k a -> (k, a)---- | <i>O(log n)</i>. The maximal key of the map. Calls <a>error</a> is the--- map is empty.--- --- <pre>--- findMax (fromList [(5,"a"), (3,"b")]) == (5,"a")--- findMax empty Error: empty map has no maximal element--- </pre>-findMax :: Map k a -> (k, a)---- | <i>O(log n)</i>. Delete the minimal key. Returns an empty map if the--- map is empty.--- --- <pre>--- deleteMin (fromList [(5,"a"), (3,"b"), (7,"c")]) == fromList [(5,"a"), (7,"c")]--- deleteMin empty == empty--- </pre>-deleteMin :: Map k a -> Map k a---- | <i>O(log n)</i>. Delete the maximal key. Returns an empty map if the--- map is empty.--- --- <pre>--- deleteMax (fromList [(5,"a"), (3,"b"), (7,"c")]) == fromList [(3,"b"), (5,"a")]--- deleteMax empty == empty--- </pre>-deleteMax :: Map k a -> Map k a---- | <i>O(log n)</i>. Delete and find the minimal element.--- --- <pre>--- deleteFindMin (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((3,"b"), fromList[(5,"a"), (10,"c")]) --- deleteFindMin Error: can not return the minimal element of an empty map--- </pre>-deleteFindMin :: Map k a -> ((k, a), Map k a)---- | <i>O(log n)</i>. Delete and find the maximal element.--- --- <pre>--- deleteFindMax (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((10,"c"), fromList [(3,"b"), (5,"a")])--- deleteFindMax empty Error: can not return the maximal element of an empty map--- </pre>-deleteFindMax :: Map k a -> ((k, a), Map k a)---- | <i>O(log n)</i>. Update the value at the minimal key.--- --- <pre>--- updateMin (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "Xb"), (5, "a")]--- updateMin (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- </pre>-updateMin :: (a -> Maybe a) -> Map k a -> Map k a---- | <i>O(log n)</i>. Update the value at the maximal key.--- --- <pre>--- updateMax (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "Xa")]--- updateMax (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- </pre>-updateMax :: (a -> Maybe a) -> Map k a -> Map k a---- | <i>O(log n)</i>. Update the value at the minimal key.--- --- <pre>--- updateMinWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"3:b"), (5,"a")]--- updateMinWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- </pre>-updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a---- | <i>O(log n)</i>. Update the value at the maximal key.--- --- <pre>--- updateMaxWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"b"), (5,"5:a")]--- updateMaxWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- </pre>-updateMaxWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a---- | <i>O(log n)</i>. Retrieves the value associated with minimal key of--- the map, and the map stripped of that element, or <a>Nothing</a> if--- passed an empty map.--- --- <pre>--- minView (fromList [(5,"a"), (3,"b")]) == Just ("b", singleton 5 "a")--- minView empty == Nothing--- </pre>-minView :: Map k a -> Maybe (a, Map k a)---- | <i>O(log n)</i>. Retrieves the value associated with maximal key of--- the map, and the map stripped of that element, or <a>Nothing</a> if--- passed an--- --- <pre>--- maxView (fromList [(5,"a"), (3,"b")]) == Just ("a", singleton 3 "b")--- maxView empty == Nothing--- </pre>-maxView :: Map k a -> Maybe (a, Map k a)---- | <i>O(log n)</i>. Retrieves the minimal (key,value) pair of the map,--- and the map stripped of that element, or <a>Nothing</a> if passed an--- empty map.--- --- <pre>--- minViewWithKey (fromList [(5,"a"), (3,"b")]) == Just ((3,"b"), singleton 5 "a")--- minViewWithKey empty == Nothing--- </pre>-minViewWithKey :: Map k a -> Maybe ((k, a), Map k a)---- | <i>O(log n)</i>. Retrieves the maximal (key,value) pair of the map,--- and the map stripped of that element, or <a>Nothing</a> if passed an--- empty map.--- --- <pre>--- maxViewWithKey (fromList [(5,"a"), (3,"b")]) == Just ((5,"a"), singleton 3 "b")--- maxViewWithKey empty == Nothing--- </pre>-maxViewWithKey :: Map k a -> Maybe ((k, a), Map k a)---- | <i>O(n)</i>. Show the tree that implements the map. The tree is shown--- in a compressed, hanging format. See <a>showTreeWith</a>.-showTree :: (Show k, Show a) => Map k a -> String---- | <i>O(n)</i>. The expression (<tt><a>showTreeWith</a> showelem hang--- wide map</tt>) shows the tree that implements the map. Elements are--- shown using the <tt>showElem</tt> function. If <tt>hang</tt> is--- <a>True</a>, a <i>hanging</i> tree is shown otherwise a rotated tree--- is shown. If <tt>wide</tt> is <a>True</a>, an extra wide version is--- shown.--- --- <pre>--- Map> let t = fromDistinctAscList [(x,()) | x <- [1..5]]--- Map> putStrLn $ showTreeWith (\k x -> show (k,x)) True False t--- (4,())--- +--(2,())--- | +--(1,())--- | +--(3,())--- +--(5,())--- --- Map> putStrLn $ showTreeWith (\k x -> show (k,x)) True True t--- (4,())--- |--- +--(2,())--- | |--- | +--(1,())--- | |--- | +--(3,())--- |--- +--(5,())--- --- Map> putStrLn $ showTreeWith (\k x -> show (k,x)) False True t--- +--(5,())--- |--- (4,())--- |--- | +--(3,())--- | |--- +--(2,())--- |--- +--(1,())--- </pre>-showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String---- | <i>O(n)</i>. Test if the internal map structure is valid.--- --- <pre>--- valid (fromAscList [(3,"b"), (5,"a")]) == True--- valid (fromAscList [(5,"a"), (3,"b")]) == False--- </pre>-valid :: Ord k => Map k a -> Bool-instance Typeable2 Map-instance (Show k, Show a) => Show (Map k a)-instance (Ord k, Read k, Read e) => Read (Map k e)-instance Foldable (Map k)-instance Traversable (Map k)-instance Functor (Map k)-instance (Ord k, Ord v) => Ord (Map k v)-instance (Eq k, Eq a) => Eq (Map k a)-instance (Data k, Data a, Ord k) => Data (Map k a)-instance Ord k => Monoid (Map k v)----- | An efficient implementation of integer sets.--- --- Since many function names (but not the type name) clash with--- <a>Prelude</a> names, this module is usually imported--- <tt>qualified</tt>, e.g.--- --- <pre>--- import Data.IntSet (IntSet)--- import qualified Data.IntSet as IntSet--- </pre>--- --- The implementation is based on <i>big-endian patricia trees</i>. This--- data structure performs especially well on binary operations like--- <a>union</a> and <a>intersection</a>. However, my benchmarks show that--- it is also (much) faster on insertions and deletions when compared to--- a generic size-balanced set implementation (see <a>Data.Set</a>).--- --- <ul>--- <li>Chris Okasaki and Andy Gill, "<i>Fast Mergeable Integer Maps</i>",--- Workshop on ML, September 1998, pages 77-86,--- <a>http://citeseer.ist.psu.edu/okasaki98fast.html</a></li>--- <li>D.R. Morrison, "/PATRICIA -- Practical Algorithm To Retrieve--- Information Coded In Alphanumeric/", Journal of the ACM, 15(4),--- October 1968, pages 514-534.</li>--- </ul>--- --- Many operations have a worst-case complexity of <i>O(min(n,W))</i>.--- This means that the operation can become linear in the number of--- elements with a maximum of <i>W</i> -- the number of bits in an--- <a>Int</a> (32 or 64).-module Data.IntSet---- | A set of integers.-data IntSet---- | <i>O(n+m)</i>. See <a>difference</a>.-(\\) :: IntSet -> IntSet -> IntSet---- | <i>O(1)</i>. Is the set empty?-null :: IntSet -> Bool---- | <i>O(n)</i>. Cardinality of the set.-size :: IntSet -> Int---- | <i>O(min(n,W))</i>. Is the value a member of the set?-member :: Int -> IntSet -> Bool---- | <i>O(min(n,W))</i>. Is the element not in the set?-notMember :: Int -> IntSet -> Bool---- | <i>O(n+m)</i>. Is this a subset? <tt>(s1 <a>isSubsetOf</a> s2)</tt>--- tells whether <tt>s1</tt> is a subset of <tt>s2</tt>.-isSubsetOf :: IntSet -> IntSet -> Bool---- | <i>O(n+m)</i>. Is this a proper subset? (ie. a subset but not equal).-isProperSubsetOf :: IntSet -> IntSet -> Bool---- | <i>O(1)</i>. The empty set.-empty :: IntSet---- | <i>O(1)</i>. A set of one element.-singleton :: Int -> IntSet---- | <i>O(min(n,W))</i>. Add a value to the set. When the value is already--- an element of the set, it is replaced by the new one, ie.--- <a>insert</a> is left-biased.-insert :: Int -> IntSet -> IntSet---- | <i>O(min(n,W))</i>. Delete a value in the set. Returns the original--- set when the value was not present.-delete :: Int -> IntSet -> IntSet---- | <i>O(n+m)</i>. The union of two sets.-union :: IntSet -> IntSet -> IntSet---- | The union of a list of sets.-unions :: [IntSet] -> IntSet---- | <i>O(n+m)</i>. Difference between two sets.-difference :: IntSet -> IntSet -> IntSet---- | <i>O(n+m)</i>. The intersection of two sets.-intersection :: IntSet -> IntSet -> IntSet---- | <i>O(n)</i>. Filter all elements that satisfy some predicate.-filter :: (Int -> Bool) -> IntSet -> IntSet---- | <i>O(n)</i>. partition the set according to some predicate.-partition :: (Int -> Bool) -> IntSet -> (IntSet, IntSet)---- | <i>O(min(n,W))</i>. The expression (<tt><a>split</a> x set</tt>) is a--- pair <tt>(set1,set2)</tt> where <tt>set1</tt> comprises the elements--- of <tt>set</tt> less than <tt>x</tt> and <tt>set2</tt> comprises the--- elements of <tt>set</tt> greater than <tt>x</tt>.--- --- <pre>--- split 3 (fromList [1..5]) == (fromList [1,2], fromList [4,5])--- </pre>-split :: Int -> IntSet -> (IntSet, IntSet)---- | <i>O(min(n,W))</i>. Performs a <a>split</a> but also returns whether--- the pivot element was found in the original set.-splitMember :: Int -> IntSet -> (IntSet, Bool, IntSet)---- | <i>O(min(n,W))</i>. The minimal element of the set.-findMin :: IntSet -> Int---- | <i>O(min(n,W))</i>. The maximal element of a set.-findMax :: IntSet -> Int---- | <i>O(min(n,W))</i>. Delete the minimal element.-deleteMin :: IntSet -> IntSet---- | <i>O(min(n,W))</i>. Delete the maximal element.-deleteMax :: IntSet -> IntSet---- | <i>O(min(n,W))</i>. Delete and find the minimal element.--- --- <pre>--- deleteFindMin set = (findMin set, deleteMin set)--- </pre>-deleteFindMin :: IntSet -> (Int, IntSet)---- | <i>O(min(n,W))</i>. Delete and find the maximal element.--- --- <pre>--- deleteFindMax set = (findMax set, deleteMax set)--- </pre>-deleteFindMax :: IntSet -> (Int, IntSet)---- | <i>O(min(n,W))</i>. Retrieves the maximal key of the set, and the set--- stripped of that element, or <a>Nothing</a> if passed an empty set.-maxView :: IntSet -> Maybe (Int, IntSet)---- | <i>O(min(n,W))</i>. Retrieves the minimal key of the set, and the set--- stripped of that element, or <a>Nothing</a> if passed an empty set.-minView :: IntSet -> Maybe (Int, IntSet)---- | <i>O(n*min(n,W))</i>. <tt><a>map</a> f s</tt> is the set obtained by--- applying <tt>f</tt> to each element of <tt>s</tt>.--- --- It's worth noting that the size of the result may be smaller if, for--- some <tt>(x,y)</tt>, <tt>x /= y && f x == f y</tt>-map :: (Int -> Int) -> IntSet -> IntSet---- | <i>O(n)</i>. Fold over the elements of a set in an unspecified order.--- --- <pre>--- sum set == fold (+) 0 set--- elems set == fold (:) [] set--- </pre>-fold :: (Int -> b -> b) -> b -> IntSet -> b---- | <i>O(n)</i>. The elements of a set. (For sets, this is equivalent to--- toList)-elems :: IntSet -> [Int]---- | <i>O(n)</i>. Convert the set to a list of elements.-toList :: IntSet -> [Int]---- | <i>O(n*min(n,W))</i>. Create a set from a list of integers.-fromList :: [Int] -> IntSet---- | <i>O(n)</i>. Convert the set to an ascending list of elements.-toAscList :: IntSet -> [Int]---- | <i>O(n)</i>. Build a set from an ascending list of elements. <i>The--- precondition (input list is ascending) is not checked.</i>-fromAscList :: [Int] -> IntSet---- | <i>O(n)</i>. Build a set from an ascending list of distinct elements.--- <i>The precondition (input list is strictly ascending) is not--- checked.</i>-fromDistinctAscList :: [Int] -> IntSet---- | <i>O(n)</i>. Show the tree that implements the set. The tree is shown--- in a compressed, hanging format.-showTree :: IntSet -> String---- | <i>O(n)</i>. The expression (<tt><a>showTreeWith</a> hang wide--- map</tt>) shows the tree that implements the set. If <tt>hang</tt> is--- <a>True</a>, a <i>hanging</i> tree is shown otherwise a rotated tree--- is shown. If <tt>wide</tt> is <a>True</a>, an extra wide version is--- shown.-showTreeWith :: Bool -> Bool -> IntSet -> String-instance Typeable IntSet-instance Read IntSet-instance Show IntSet-instance Ord IntSet-instance Eq IntSet-instance Data IntSet-instance Monoid IntSet----- | An efficient implementation of maps from integer keys to values.--- --- Since many function names (but not the type name) clash with--- <a>Prelude</a> names, this module is usually imported--- <tt>qualified</tt>, e.g.--- --- <pre>--- import Data.IntMap (IntMap)--- import qualified Data.IntMap as IntMap--- </pre>--- --- The implementation is based on <i>big-endian patricia trees</i>. This--- data structure performs especially well on binary operations like--- <a>union</a> and <a>intersection</a>. However, my benchmarks show that--- it is also (much) faster on insertions and deletions when compared to--- a generic size-balanced map implementation (see <a>Data.Map</a>).--- --- <ul>--- <li>Chris Okasaki and Andy Gill, "<i>Fast Mergeable Integer Maps</i>",--- Workshop on ML, September 1998, pages 77-86,--- <a>http://citeseer.ist.psu.edu/okasaki98fast.html</a></li>--- <li>D.R. Morrison, "/PATRICIA -- Practical Algorithm To Retrieve--- Information Coded In Alphanumeric/", Journal of the ACM, 15(4),--- October 1968, pages 514-534.</li>--- </ul>--- --- Operation comments contain the operation time complexity in the Big-O--- notation <a>http://en.wikipedia.org/wiki/Big_O_notation</a>. Many--- operations have a worst-case complexity of <i>O(min(n,W))</i>. This--- means that the operation can become linear in the number of elements--- with a maximum of <i>W</i> -- the number of bits in an <a>Int</a> (32--- or 64).-module Data.IntMap---- | A map of integers to values <tt>a</tt>.-data IntMap a-type Key = Int---- | <i>O(min(n,W))</i>. Find the value at a key. Calls <a>error</a> when--- the element can not be found.--- --- <pre>--- fromList [(5,'a'), (3,'b')] ! 1 Error: element not in the map--- fromList [(5,'a'), (3,'b')] ! 5 == 'a'--- </pre>-(!) :: IntMap a -> Key -> a---- | Same as <a>difference</a>.-(\\) :: IntMap a -> IntMap b -> IntMap a---- | <i>O(1)</i>. Is the map empty?--- --- <pre>--- Data.IntMap.null (empty) == True--- Data.IntMap.null (singleton 1 'a') == False--- </pre>-null :: IntMap a -> Bool---- | <i>O(n)</i>. Number of elements in the map.--- --- <pre>--- size empty == 0--- size (singleton 1 'a') == 1--- size (fromList([(1,'a'), (2,'c'), (3,'b')])) == 3--- </pre>-size :: IntMap a -> Int---- | <i>O(min(n,W))</i>. Is the key a member of the map?--- --- <pre>--- member 5 (fromList [(5,'a'), (3,'b')]) == True--- member 1 (fromList [(5,'a'), (3,'b')]) == False--- </pre>-member :: Key -> IntMap a -> Bool---- | <i>O(log n)</i>. Is the key not a member of the map?--- --- <pre>--- notMember 5 (fromList [(5,'a'), (3,'b')]) == False--- notMember 1 (fromList [(5,'a'), (3,'b')]) == True--- </pre>-notMember :: Key -> IntMap a -> Bool---- | <i>O(min(n,W))</i>. Lookup the value at a key in the map. See also--- <tt>Data.Map.lookup</tt>.-lookup :: Key -> IntMap a -> Maybe a---- | <i>O(min(n,W))</i>. The expression <tt>(<a>findWithDefault</a> def k--- map)</tt> returns the value at key <tt>k</tt> or returns <tt>def</tt>--- when the key is not an element of the map.--- --- <pre>--- findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x'--- findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'--- </pre>-findWithDefault :: a -> Key -> IntMap a -> a---- | <i>O(1)</i>. The empty map.--- --- <pre>--- empty == fromList []--- size empty == 0--- </pre>-empty :: IntMap a---- | <i>O(1)</i>. A map of one element.--- --- <pre>--- singleton 1 'a' == fromList [(1, 'a')]--- size (singleton 1 'a') == 1--- </pre>-singleton :: Key -> a -> IntMap a---- | <i>O(min(n,W))</i>. Insert a new key/value pair in the map. If the key--- is already present in the map, the associated value is replaced with--- the supplied value, i.e. <a>insert</a> is equivalent to--- <tt><a>insertWith</a> <a>const</a></tt>.--- --- <pre>--- insert 5 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'x')]--- insert 7 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'a'), (7, 'x')]--- insert 5 'x' empty == singleton 5 'x'--- </pre>-insert :: Key -> a -> IntMap a -> IntMap a---- | <i>O(min(n,W))</i>. Insert with a combining function.--- <tt><a>insertWith</a> f key value mp</tt> will insert the pair (key,--- value) into <tt>mp</tt> if key does not exist in the map. If the key--- does exist, the function will insert <tt>f new_value old_value</tt>.--- --- <pre>--- insertWith (++) 5 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "xxxa")]--- insertWith (++) 7 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a"), (7, "xxx")]--- insertWith (++) 5 "xxx" empty == singleton 5 "xxx"--- </pre>-insertWith :: (a -> a -> a) -> Key -> a -> IntMap a -> IntMap a---- | <i>O(min(n,W))</i>. Insert with a combining function.--- <tt><a>insertWithKey</a> f key value mp</tt> will insert the pair--- (key, value) into <tt>mp</tt> if key does not exist in the map. If the--- key does exist, the function will insert <tt>f key new_value--- old_value</tt>.--- --- <pre>--- let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value--- insertWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:xxx|a")]--- insertWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a"), (7, "xxx")]--- insertWithKey f 5 "xxx" empty == singleton 5 "xxx"--- </pre>-insertWithKey :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a---- | <i>O(min(n,W))</i>. The expression (<tt><a>insertLookupWithKey</a> f k--- x map</tt>) is a pair where the first element is equal to--- (<tt><a>lookup</a> k map</tt>) and the second element equal to--- (<tt><a>insertWithKey</a> f k x map</tt>).--- --- <pre>--- let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value--- insertLookupWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "5:xxx|a")])--- insertLookupWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a"), (7, "xxx")])--- insertLookupWithKey f 5 "xxx" empty == (Nothing, singleton 5 "xxx")--- </pre>--- --- This is how to define <tt>insertLookup</tt> using--- <tt>insertLookupWithKey</tt>:--- --- <pre>--- let insertLookup kx x t = insertLookupWithKey (\_ a _ -> a) kx x t--- insertLookup 5 "x" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "x")])--- insertLookup 7 "x" (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a"), (7, "x")])--- </pre>-insertLookupWithKey :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> (Maybe a, IntMap a)---- | <i>O(min(n,W))</i>. Delete a key and its value from the map. When the--- key is not a member of the map, the original map is returned.--- --- <pre>--- delete 5 (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- delete 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- delete 5 empty == empty--- </pre>-delete :: Key -> IntMap a -> IntMap a---- | <i>O(min(n,W))</i>. Adjust a value at a specific key. When the key is--- not a member of the map, the original map is returned.--- --- <pre>--- adjust ("new " ++) 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "new a")]--- adjust ("new " ++) 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- adjust ("new " ++) 7 empty == empty--- </pre>-adjust :: (a -> a) -> Key -> IntMap a -> IntMap a---- | <i>O(min(n,W))</i>. Adjust a value at a specific key. When the key is--- not a member of the map, the original map is returned.--- --- <pre>--- let f key x = (show key) ++ ":new " ++ x--- adjustWithKey f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:new a")]--- adjustWithKey f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- adjustWithKey f 7 empty == empty--- </pre>-adjustWithKey :: (Key -> a -> a) -> Key -> IntMap a -> IntMap a---- | <i>O(min(n,W))</i>. The expression (<tt><a>update</a> f k map</tt>)--- updates the value <tt>x</tt> at <tt>k</tt> (if it is in the map). If--- (<tt>f x</tt>) is <a>Nothing</a>, the element is deleted. If it is--- (<tt><a>Just</a> y</tt>), the key <tt>k</tt> is bound to the new value--- <tt>y</tt>.--- --- <pre>--- let f x = if x == "a" then Just "new a" else Nothing--- update f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "new a")]--- update f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- update f 3 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- </pre>-update :: (a -> Maybe a) -> Key -> IntMap a -> IntMap a---- | <i>O(min(n,W))</i>. The expression (<tt><a>update</a> f k map</tt>)--- updates the value <tt>x</tt> at <tt>k</tt> (if it is in the map). If--- (<tt>f k x</tt>) is <a>Nothing</a>, the element is deleted. If it is--- (<tt><a>Just</a> y</tt>), the key <tt>k</tt> is bound to the new value--- <tt>y</tt>.--- --- <pre>--- let f k x = if x == "a" then Just ((show k) ++ ":new a") else Nothing--- updateWithKey f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:new a")]--- updateWithKey f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]--- updateWithKey f 3 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- </pre>-updateWithKey :: (Key -> a -> Maybe a) -> Key -> IntMap a -> IntMap a---- | <i>O(min(n,W))</i>. Lookup and update. The function returns original--- value, if it is updated. This is different behavior than--- <tt>Data.Map.updateLookupWithKey</tt>. Returns the original key value--- if the map entry is deleted.--- --- <pre>--- let f k x = if x == "a" then Just ((show k) ++ ":new a") else Nothing--- updateLookupWithKey f 5 (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "5:new a")])--- updateLookupWithKey f 7 (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a")])--- updateLookupWithKey f 3 (fromList [(5,"a"), (3,"b")]) == (Just "b", singleton 5 "a")--- </pre>-updateLookupWithKey :: (Key -> a -> Maybe a) -> Key -> IntMap a -> (Maybe a, IntMap a)---- | <i>O(log n)</i>. The expression (<tt><a>alter</a> f k map</tt>) alters--- the value <tt>x</tt> at <tt>k</tt>, or absence thereof. <a>alter</a>--- can be used to insert, delete, or update a value in an <a>IntMap</a>.--- In short : <tt><a>lookup</a> k (<a>alter</a> f k m) = f (<a>lookup</a>--- k m)</tt>.-alter :: (Maybe a -> Maybe a) -> Int -> IntMap a -> IntMap a---- | <i>O(n+m)</i>. The (left-biased) union of two maps. It prefers the--- first map when duplicate keys are encountered, i.e. (<tt><a>union</a>--- == <a>unionWith</a> <a>const</a></tt>).--- --- <pre>--- union (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "a"), (7, "C")]--- </pre>-union :: IntMap a -> IntMap a -> IntMap a---- | <i>O(n+m)</i>. The union with a combining function.--- --- <pre>--- unionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "aA"), (7, "C")]--- </pre>-unionWith :: (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a---- | <i>O(n+m)</i>. The union with a combining function.--- --- <pre>--- let f key left_value right_value = (show key) ++ ":" ++ left_value ++ "|" ++ right_value--- unionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "5:a|A"), (7, "C")]--- </pre>-unionWithKey :: (Key -> a -> a -> a) -> IntMap a -> IntMap a -> IntMap a---- | The union of a list of maps.--- --- <pre>--- unions [(fromList [(5, "a"), (3, "b")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "A3"), (3, "B3")])]--- == fromList [(3, "b"), (5, "a"), (7, "C")]--- unions [(fromList [(5, "A3"), (3, "B3")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "a"), (3, "b")])]--- == fromList [(3, "B3"), (5, "A3"), (7, "C")]--- </pre>-unions :: [IntMap a] -> IntMap a---- | The union of a list of maps, with a combining operation.--- --- <pre>--- unionsWith (++) [(fromList [(5, "a"), (3, "b")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "A3"), (3, "B3")])]--- == fromList [(3, "bB3"), (5, "aAA3"), (7, "C")]--- </pre>-unionsWith :: (a -> a -> a) -> [IntMap a] -> IntMap a---- | <i>O(n+m)</i>. Difference between two maps (based on keys).--- --- <pre>--- difference (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 3 "b"--- </pre>-difference :: IntMap a -> IntMap b -> IntMap a---- | <i>O(n+m)</i>. Difference with a combining function.--- --- <pre>--- let f al ar = if al == "b" then Just (al ++ ":" ++ ar) else Nothing--- differenceWith f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (3, "B"), (7, "C")])--- == singleton 3 "b:B"--- </pre>-differenceWith :: (a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a---- | <i>O(n+m)</i>. Difference with a combining function. When two equal--- keys are encountered, the combining function is applied to the key and--- both values. If it returns <a>Nothing</a>, the element is discarded--- (proper set difference). If it returns (<tt><a>Just</a> y</tt>), the--- element is updated with a new value <tt>y</tt>.--- --- <pre>--- let f k al ar = if al == "b" then Just ((show k) ++ ":" ++ al ++ "|" ++ ar) else Nothing--- differenceWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (3, "B"), (10, "C")])--- == singleton 3 "3:b|B"--- </pre>-differenceWithKey :: (Key -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a---- | <i>O(n+m)</i>. The (left-biased) intersection of two maps (based on--- keys).--- --- <pre>--- intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a"--- </pre>-intersection :: IntMap a -> IntMap b -> IntMap a---- | <i>O(n+m)</i>. The intersection with a combining function.--- --- <pre>--- intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA"--- </pre>-intersectionWith :: (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c---- | <i>O(n+m)</i>. The intersection with a combining function.--- --- <pre>--- let f k al ar = (show k) ++ ":" ++ al ++ "|" ++ ar--- intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A"--- </pre>-intersectionWithKey :: (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c---- | <i>O(n)</i>. Map a function over all values in the map.--- --- <pre>--- map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")]--- </pre>-map :: (a -> b) -> IntMap a -> IntMap b---- | <i>O(n)</i>. Map a function over all values in the map.--- --- <pre>--- let f key x = (show key) ++ ":" ++ x--- mapWithKey f (fromList [(5,"a"), (3,"b")]) == fromList [(3, "3:b"), (5, "5:a")]--- </pre>-mapWithKey :: (Key -> a -> b) -> IntMap a -> IntMap b---- | <i>O(n)</i>. The function <tt><a>mapAccum</a></tt> threads an--- accumulating argument through the map in ascending order of keys.--- --- <pre>--- let f a b = (a ++ b, b ++ "X")--- mapAccum f "Everything: " (fromList [(5,"a"), (3,"b")]) == ("Everything: ba", fromList [(3, "bX"), (5, "aX")])--- </pre>-mapAccum :: (a -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)---- | <i>O(n)</i>. The function <tt><a>mapAccumWithKey</a></tt> threads an--- accumulating argument through the map in ascending order of keys.--- --- <pre>--- let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X")--- mapAccumWithKey f "Everything:" (fromList [(5,"a"), (3,"b")]) == ("Everything: 3-b 5-a", fromList [(3, "bX"), (5, "aX")])--- </pre>-mapAccumWithKey :: (a -> Key -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)---- | <i>O(n)</i>. The function <tt><tt>mapAccumR</tt></tt> threads an--- accumulating argument through the map in descending order of keys.-mapAccumRWithKey :: (a -> Key -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)---- | <i>O(n)</i>. Fold the values in the map, such that <tt><a>fold</a> f z--- == <tt>Prelude.foldr</tt> f z . <a>elems</a></tt>. For example,--- --- <pre>--- elems map = fold (:) [] map--- </pre>--- --- <pre>--- let f a len = len + (length a)--- fold f 0 (fromList [(5,"a"), (3,"bbb")]) == 4--- </pre>-fold :: (a -> b -> b) -> b -> IntMap a -> b---- | <i>O(n)</i>. Fold the keys and values in the map, such that--- <tt><a>foldWithKey</a> f z == <tt>Prelude.foldr</tt> (<a>uncurry</a>--- f) z . <a>toAscList</a></tt>. For example,--- --- <pre>--- keys map = foldWithKey (\k x ks -> k:ks) [] map--- </pre>--- --- <pre>--- let f k a result = result ++ "(" ++ (show k) ++ ":" ++ a ++ ")"--- foldWithKey f "Map: " (fromList [(5,"a"), (3,"b")]) == "Map: (5:a)(3:b)"--- </pre>-foldWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b---- | <i>O(n)</i>. Return all elements of the map in the ascending order of--- their keys.--- --- <pre>--- elems (fromList [(5,"a"), (3,"b")]) == ["b","a"]--- elems empty == []--- </pre>-elems :: IntMap a -> [a]---- | <i>O(n)</i>. Return all keys of the map in ascending order.--- --- <pre>--- keys (fromList [(5,"a"), (3,"b")]) == [3,5]--- keys empty == []--- </pre>-keys :: IntMap a -> [Key]---- | <i>O(n*min(n,W))</i>. The set of all keys of the map.--- --- <pre>--- keysSet (fromList [(5,"a"), (3,"b")]) == Data.IntSet.fromList [3,5]--- keysSet empty == Data.IntSet.empty--- </pre>-keysSet :: IntMap a -> IntSet---- | <i>O(n)</i>. Return all key/value pairs in the map in ascending key--- order.--- --- <pre>--- assocs (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]--- assocs empty == []--- </pre>-assocs :: IntMap a -> [(Key, a)]---- | <i>O(n)</i>. Convert the map to a list of key/value pairs.--- --- <pre>--- toList (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]--- toList empty == []--- </pre>-toList :: IntMap a -> [(Key, a)]---- | <i>O(n*min(n,W))</i>. Create a map from a list of key/value pairs.--- --- <pre>--- fromList [] == empty--- fromList [(5,"a"), (3,"b"), (5, "c")] == fromList [(5,"c"), (3,"b")]--- fromList [(5,"c"), (3,"b"), (5, "a")] == fromList [(5,"a"), (3,"b")]--- </pre>-fromList :: [(Key, a)] -> IntMap a---- | <i>O(n*min(n,W))</i>. Create a map from a list of key/value pairs with--- a combining function. See also <a>fromAscListWith</a>.--- --- <pre>--- fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"a")] == fromList [(3, "ab"), (5, "aba")]--- fromListWith (++) [] == empty--- </pre>-fromListWith :: (a -> a -> a) -> [(Key, a)] -> IntMap a---- | <i>O(n*min(n,W))</i>. Build a map from a list of key/value pairs with--- a combining function. See also fromAscListWithKey'.--- --- <pre>--- fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"a")] == fromList [(3, "ab"), (5, "aba")]--- fromListWith (++) [] == empty--- </pre>-fromListWithKey :: (Key -> a -> a -> a) -> [(Key, a)] -> IntMap a---- | <i>O(n)</i>. Convert the map to a list of key/value pairs where the--- keys are in ascending order.--- --- <pre>--- toAscList (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]--- </pre>-toAscList :: IntMap a -> [(Key, a)]---- | <i>O(n)</i>. Build a map from a list of key/value pairs where the keys--- are in ascending order.--- --- <pre>--- fromAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")]--- fromAscList [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "b")]--- </pre>-fromAscList :: [(Key, a)] -> IntMap a---- | <i>O(n)</i>. Build a map from a list of key/value pairs where the keys--- are in ascending order, with a combining function on equal keys.--- <i>The precondition (input list is ascending) is not checked.</i>--- --- <pre>--- fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "ba")]--- </pre>-fromAscListWith :: (a -> a -> a) -> [(Key, a)] -> IntMap a---- | <i>O(n)</i>. Build a map from a list of key/value pairs where the keys--- are in ascending order, with a combining function on equal keys.--- <i>The precondition (input list is ascending) is not checked.</i>--- --- <pre>--- fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "ba")]--- </pre>-fromAscListWithKey :: (Key -> a -> a -> a) -> [(Key, a)] -> IntMap a---- | <i>O(n)</i>. Build a map from a list of key/value pairs where the keys--- are in ascending order and all distinct. <i>The precondition (input--- list is strictly ascending) is not checked.</i>--- --- <pre>--- fromDistinctAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")]--- </pre>-fromDistinctAscList :: [(Key, a)] -> IntMap a---- | <i>O(n)</i>. Filter all values that satisfy some predicate.--- --- <pre>--- filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty--- filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty--- </pre>-filter :: (a -> Bool) -> IntMap a -> IntMap a---- | <i>O(n)</i>. Filter all keys/values that satisfy some predicate.--- --- <pre>--- filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- </pre>-filterWithKey :: (Key -> a -> Bool) -> IntMap a -> IntMap a---- | <i>O(n)</i>. Partition the map according to some predicate. The first--- map contains all elements that satisfy the predicate, the second all--- elements that fail the predicate. See also <a>split</a>.--- --- <pre>--- partition (> "a") (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a")--- partition (< "x") (fromList [(5,"a"), (3,"b")]) == (fromList [(3, "b"), (5, "a")], empty)--- partition (> "x") (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3, "b"), (5, "a")])--- </pre>-partition :: (a -> Bool) -> IntMap a -> (IntMap a, IntMap a)---- | <i>O(n)</i>. Partition the map according to some predicate. The first--- map contains all elements that satisfy the predicate, the second all--- elements that fail the predicate. See also <a>split</a>.--- --- <pre>--- partitionWithKey (\ k _ -> k > 3) (fromList [(5,"a"), (3,"b")]) == (singleton 5 "a", singleton 3 "b")--- partitionWithKey (\ k _ -> k < 7) (fromList [(5,"a"), (3,"b")]) == (fromList [(3, "b"), (5, "a")], empty)--- partitionWithKey (\ k _ -> k > 7) (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3, "b"), (5, "a")])--- </pre>-partitionWithKey :: (Key -> a -> Bool) -> IntMap a -> (IntMap a, IntMap a)---- | <i>O(n)</i>. Map values and collect the <a>Just</a> results.--- --- <pre>--- let f x = if x == "a" then Just "new a" else Nothing--- mapMaybe f (fromList [(5,"a"), (3,"b")]) == singleton 5 "new a"--- </pre>-mapMaybe :: (a -> Maybe b) -> IntMap a -> IntMap b---- | <i>O(n)</i>. Map keys/values and collect the <a>Just</a> results.--- --- <pre>--- let f k _ = if k < 5 then Just ("key : " ++ (show k)) else Nothing--- mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key : 3"--- </pre>-mapMaybeWithKey :: (Key -> a -> Maybe b) -> IntMap a -> IntMap b---- | <i>O(n)</i>. Map values and separate the <a>Left</a> and <a>Right</a>--- results.--- --- <pre>--- let f a = if a < "c" then Left a else Right a--- mapEither f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])--- == (fromList [(3,"b"), (5,"a")], fromList [(1,"x"), (7,"z")])--- --- mapEither (\ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])--- == (empty, fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])--- </pre>-mapEither :: (a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)---- | <i>O(n)</i>. Map keys/values and separate the <a>Left</a> and--- <a>Right</a> results.--- --- <pre>--- let f k a = if k < 5 then Left (k * 2) else Right (a ++ a)--- mapEitherWithKey f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])--- == (fromList [(1,2), (3,6)], fromList [(5,"aa"), (7,"zz")])--- --- mapEitherWithKey (\_ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])--- == (empty, fromList [(1,"x"), (3,"b"), (5,"a"), (7,"z")])--- </pre>-mapEitherWithKey :: (Key -> a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)---- | <i>O(log n)</i>. The expression (<tt><a>split</a> k map</tt>) is a--- pair <tt>(map1,map2)</tt> where all keys in <tt>map1</tt> are lower--- than <tt>k</tt> and all keys in <tt>map2</tt> larger than <tt>k</tt>.--- Any key equal to <tt>k</tt> is found in neither <tt>map1</tt> nor--- <tt>map2</tt>.--- --- <pre>--- split 2 (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3,"b"), (5,"a")])--- split 3 (fromList [(5,"a"), (3,"b")]) == (empty, singleton 5 "a")--- split 4 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a")--- split 5 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", empty)--- split 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], empty)--- </pre>-split :: Key -> IntMap a -> (IntMap a, IntMap a)---- | <i>O(log n)</i>. Performs a <a>split</a> but also returns whether the--- pivot key was found in the original map.--- --- <pre>--- splitLookup 2 (fromList [(5,"a"), (3,"b")]) == (empty, Nothing, fromList [(3,"b"), (5,"a")])--- splitLookup 3 (fromList [(5,"a"), (3,"b")]) == (empty, Just "b", singleton 5 "a")--- splitLookup 4 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", Nothing, singleton 5 "a")--- splitLookup 5 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", Just "a", empty)--- splitLookup 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], Nothing, empty)--- </pre>-splitLookup :: Key -> IntMap a -> (IntMap a, Maybe a, IntMap a)---- | <i>O(n+m)</i>. Is this a submap? Defined as (<tt><a>isSubmapOf</a> =--- <a>isSubmapOfBy</a> (==)</tt>).-isSubmapOf :: Eq a => IntMap a -> IntMap a -> Bool---- | <i>O(n+m)</i>. The expression (<tt><a>isSubmapOfBy</a> f m1 m2</tt>)--- returns <a>True</a> if all keys in <tt>m1</tt> are in <tt>m2</tt>, and--- when <tt>f</tt> returns <a>True</a> when applied to their respective--- values. For example, the following expressions are all <a>True</a>:--- --- <pre>--- isSubmapOfBy (==) (fromList [(1,1)]) (fromList [(1,1),(2,2)])--- isSubmapOfBy (<=) (fromList [(1,1)]) (fromList [(1,1),(2,2)])--- isSubmapOfBy (==) (fromList [(1,1),(2,2)]) (fromList [(1,1),(2,2)])--- </pre>--- --- But the following are all <a>False</a>:--- --- <pre>--- isSubmapOfBy (==) (fromList [(1,2)]) (fromList [(1,1),(2,2)])--- isSubmapOfBy (<) (fromList [(1,1)]) (fromList [(1,1),(2,2)])--- isSubmapOfBy (==) (fromList [(1,1),(2,2)]) (fromList [(1,1)])--- </pre>-isSubmapOfBy :: (a -> b -> Bool) -> IntMap a -> IntMap b -> Bool---- | <i>O(n+m)</i>. Is this a proper submap? (ie. a submap but not equal).--- Defined as (<tt><a>isProperSubmapOf</a> = <a>isProperSubmapOfBy</a>--- (==)</tt>).-isProperSubmapOf :: Eq a => IntMap a -> IntMap a -> Bool---- | <i>O(n+m)</i>. Is this a proper submap? (ie. a submap but not equal).--- The expression (<tt><a>isProperSubmapOfBy</a> f m1 m2</tt>) returns--- <a>True</a> when <tt>m1</tt> and <tt>m2</tt> are not equal, all keys--- in <tt>m1</tt> are in <tt>m2</tt>, and when <tt>f</tt> returns--- <a>True</a> when applied to their respective values. For example, the--- following expressions are all <a>True</a>:--- --- <pre>--- isProperSubmapOfBy (==) (fromList [(1,1)]) (fromList [(1,1),(2,2)])--- isProperSubmapOfBy (<=) (fromList [(1,1)]) (fromList [(1,1),(2,2)])--- </pre>--- --- But the following are all <a>False</a>:--- --- <pre>--- isProperSubmapOfBy (==) (fromList [(1,1),(2,2)]) (fromList [(1,1),(2,2)])--- isProperSubmapOfBy (==) (fromList [(1,1),(2,2)]) (fromList [(1,1)])--- isProperSubmapOfBy (<) (fromList [(1,1)]) (fromList [(1,1),(2,2)])--- </pre>-isProperSubmapOfBy :: (a -> b -> Bool) -> IntMap a -> IntMap b -> Bool---- | <i>O(log n)</i>. Retrieves the maximal key of the map, and the map--- stripped of that element, or <a>Nothing</a> if passed an empty map.-maxView :: IntMap a -> Maybe (a, IntMap a)---- | <i>O(log n)</i>. Retrieves the minimal key of the map, and the map--- stripped of that element, or <a>Nothing</a> if passed an empty map.-minView :: IntMap a -> Maybe (a, IntMap a)---- | <i>O(log n)</i>. The minimal key of the map.-findMin :: IntMap a -> (Int, a)---- | <i>O(log n)</i>. The maximal key of the map.-findMax :: IntMap a -> (Int, a)---- | <i>O(log n)</i>. Delete the minimal key. An error is thrown if the--- IntMap is already empty. Note, this is not the same behavior Map.-deleteMin :: IntMap a -> IntMap a---- | <i>O(log n)</i>. Delete the maximal key. An error is thrown if the--- IntMap is already empty. Note, this is not the same behavior Map.-deleteMax :: IntMap a -> IntMap a---- | <i>O(log n)</i>. Delete and find the minimal element.-deleteFindMin :: IntMap a -> (a, IntMap a)---- | <i>O(log n)</i>. Delete and find the maximal element.-deleteFindMax :: IntMap a -> (a, IntMap a)---- | <i>O(log n)</i>. Update the value at the minimal key.--- --- <pre>--- updateMin (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "Xb"), (5, "a")]--- updateMin (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- </pre>-updateMin :: (a -> a) -> IntMap a -> IntMap a---- | <i>O(log n)</i>. Update the value at the maximal key.--- --- <pre>--- updateMax (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "Xa")]--- updateMax (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- </pre>-updateMax :: (a -> a) -> IntMap a -> IntMap a---- | <i>O(log n)</i>. Update the value at the minimal key.--- --- <pre>--- updateMinWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"3:b"), (5,"a")]--- updateMinWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"--- </pre>-updateMinWithKey :: (Key -> a -> a) -> IntMap a -> IntMap a---- | <i>O(log n)</i>. Update the value at the maximal key.--- --- <pre>--- updateMaxWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"b"), (5,"5:a")]--- updateMaxWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"--- </pre>-updateMaxWithKey :: (Key -> a -> a) -> IntMap a -> IntMap a---- | <i>O(log n)</i>. Retrieves the minimal (key,value) pair of the map,--- and the map stripped of that element, or <a>Nothing</a> if passed an--- empty map.--- --- <pre>--- minViewWithKey (fromList [(5,"a"), (3,"b")]) == Just ((3,"b"), singleton 5 "a")--- minViewWithKey empty == Nothing--- </pre>-minViewWithKey :: IntMap a -> Maybe ((Key, a), IntMap a)---- | <i>O(log n)</i>. Retrieves the maximal (key,value) pair of the map,--- and the map stripped of that element, or <a>Nothing</a> if passed an--- empty map.--- --- <pre>--- maxViewWithKey (fromList [(5,"a"), (3,"b")]) == Just ((5,"a"), singleton 3 "b")--- maxViewWithKey empty == Nothing--- </pre>-maxViewWithKey :: IntMap a -> Maybe ((Key, a), IntMap a)---- | <i>O(n)</i>. Show the tree that implements the map. The tree is shown--- in a compressed, hanging format.-showTree :: Show a => IntMap a -> String---- | <i>O(n)</i>. The expression (<tt><a>showTreeWith</a> hang wide--- map</tt>) shows the tree that implements the map. If <tt>hang</tt> is--- <a>True</a>, a <i>hanging</i> tree is shown otherwise a rotated tree--- is shown. If <tt>wide</tt> is <a>True</a>, an extra wide version is--- shown.-showTreeWith :: Show a => Bool -> Bool -> IntMap a -> String-instance Typeable1 IntMap-instance Read e => Read (IntMap e)-instance Show a => Show (IntMap a)-instance Functor IntMap-instance Ord a => Ord (IntMap a)-instance Eq a => Eq (IntMap a)-instance Data a => Data (IntMap a)-instance Traversable IntMap-instance Foldable IntMap-instance Monoid (IntMap a)----- | General purpose finite sequences. Apart from being finite and having--- strict operations, sequences also differ from lists in supporting a--- wider variety of operations efficiently.--- --- An amortized running time is given for each operation, with <i>n</i>--- referring to the length of the sequence and <i>i</i> being the--- integral index used by some operations. These bounds hold even in a--- persistent (shared) setting.--- --- The implementation uses 2-3 finger trees annotated with sizes, as--- described in section 4.2 of--- --- <ul>--- <li>Ralf Hinze and Ross Paterson, "Finger trees: a simple--- general-purpose data structure", <i>Journal of Functional--- Programming</i> 16:2 (2006) pp 197-217.--- <a>http://www.soi.city.ac.uk/~ross/papers/FingerTree.html</a></li>--- </ul>--- --- <i>Note</i>: Many of these operations have the same names as similar--- operations on lists in the <a>Prelude</a>. The ambiguity may be--- resolved using either qualification or the <tt>hiding</tt> clause.-module Data.Sequence---- | General-purpose finite sequences.-data Seq a---- | <i>O(1)</i>. The empty sequence.-empty :: Seq a---- | <i>O(1)</i>. A singleton sequence.-singleton :: a -> Seq a---- | <i>O(1)</i>. Add an element to the left end of a sequence. Mnemonic: a--- triangle with the single element at the pointy end.-(<|) :: a -> Seq a -> Seq a---- | <i>O(1)</i>. Add an element to the right end of a sequence. Mnemonic:--- a triangle with the single element at the pointy end.-(|>) :: Seq a -> a -> Seq a---- | <i>O(log(min(n1,n2)))</i>. Concatenate two sequences.-(><) :: Seq a -> Seq a -> Seq a---- | <i>O(n)</i>. Create a sequence from a finite list of elements. There--- is a function <a>toList</a> in the opposite direction for all--- instances of the <a>Foldable</a> class, including <a>Seq</a>.-fromList :: [a] -> Seq a---- | <i>O(log n)</i>. <tt>replicate n x</tt> is a sequence consisting of--- <tt>n</tt> copies of <tt>x</tt>.-replicate :: Int -> a -> Seq a---- | <a>replicateA</a> is an <a>Applicative</a> version of--- <a>replicate</a>, and makes <i>O(log n)</i> calls to <a><*></a>--- and <a>pure</a>.--- --- <pre>--- replicateA n x = sequenceA (replicate n x)--- </pre>-replicateA :: Applicative f => Int -> f a -> f (Seq a)---- | <a>replicateM</a> is a sequence counterpart of--- <tt>Control.Monad.replicateM</tt>.--- --- <pre>--- replicateM n x = sequence (replicate n x)--- </pre>-replicateM :: Monad m => Int -> m a -> m (Seq a)---- | <i>O(n)</i>. Constructs a sequence by repeated application of a--- function to a seed value.--- --- <pre>--- iterateN n f x = fromList (Prelude.take n (Prelude.iterate f x))--- </pre>-iterateN :: Int -> (a -> a) -> a -> Seq a---- | Builds a sequence from a seed value. Takes time linear in the number--- of generated elements. <i>WARNING:</i> If the number of generated--- elements is infinite, this method will not terminate.-unfoldr :: (b -> Maybe (a, b)) -> b -> Seq a---- | <tt><a>unfoldl</a> f x</tt> is equivalent to <tt><a>reverse</a>--- (<a>unfoldr</a> (swap . f) x)</tt>.-unfoldl :: (b -> Maybe (b, a)) -> b -> Seq a---- | <i>O(1)</i>. Is this the empty sequence?-null :: Seq a -> Bool---- | <i>O(1)</i>. The number of elements in the sequence.-length :: Seq a -> Int---- | View of the left end of a sequence.-data ViewL a---- | empty sequence-EmptyL :: ViewL a---- | leftmost element and the rest of the sequence-(:<) :: a -> Seq a -> ViewL a---- | <i>O(1)</i>. Analyse the left end of a sequence.-viewl :: Seq a -> ViewL a---- | View of the right end of a sequence.-data ViewR a---- | empty sequence-EmptyR :: ViewR a---- | the sequence minus the rightmost element, and the rightmost element-(:>) :: Seq a -> a -> ViewR a---- | <i>O(1)</i>. Analyse the right end of a sequence.-viewr :: Seq a -> ViewR a---- | <a>scanl</a> is similar to <a>foldl</a>, but returns a sequence of--- reduced values from the left:--- --- <pre>--- scanl f z (fromList [x1, x2, ...]) = fromList [z, z `f` x1, (z `f` x1) `f` x2, ...]--- </pre>-scanl :: (a -> b -> a) -> a -> Seq b -> Seq a---- | <a>scanl1</a> is a variant of <a>scanl</a> that has no starting value--- argument:--- --- <pre>--- scanl1 f (fromList [x1, x2, ...]) = fromList [x1, x1 `f` x2, ...]--- </pre>-scanl1 :: (a -> a -> a) -> Seq a -> Seq a---- | <a>scanr</a> is the right-to-left dual of <a>scanl</a>.-scanr :: (a -> b -> b) -> b -> Seq a -> Seq b---- | <a>scanr1</a> is a variant of <a>scanr</a> that has no starting value--- argument.-scanr1 :: (a -> a -> a) -> Seq a -> Seq a---- | <i>O(n)</i>. Returns a sequence of all suffixes of this sequence,--- longest first. For example,--- --- <pre>--- tails (fromList "abc") = fromList [fromList "abc", fromList "bc", fromList "c", fromList ""]--- </pre>--- --- Evaluating the <i>i</i>th suffix takes <i>O(log(min(i, n-i)))</i>, but--- evaluating every suffix in the sequence takes <i>O(n)</i> due to--- sharing.-tails :: Seq a -> Seq (Seq a)---- | <i>O(n)</i>. Returns a sequence of all prefixes of this sequence,--- shortest first. For example,--- --- <pre>--- inits (fromList "abc") = fromList [fromList "", fromList "a", fromList "ab", fromList "abc"]--- </pre>--- --- Evaluating the <i>i</i>th prefix takes <i>O(log(min(i, n-i)))</i>, but--- evaluating every prefix in the sequence takes <i>O(n)</i> due to--- sharing.-inits :: Seq a -> Seq (Seq a)---- | <i>O(i)</i> where <i>i</i> is the prefix length. <a>takeWhileL</a>,--- applied to a predicate <tt>p</tt> and a sequence <tt>xs</tt>, returns--- the longest prefix (possibly empty) of <tt>xs</tt> of elements that--- satisfy <tt>p</tt>.-takeWhileL :: (a -> Bool) -> Seq a -> Seq a---- | <i>O(i)</i> where <i>i</i> is the suffix length. <a>takeWhileR</a>,--- applied to a predicate <tt>p</tt> and a sequence <tt>xs</tt>, returns--- the longest suffix (possibly empty) of <tt>xs</tt> of elements that--- satisfy <tt>p</tt>.--- --- <tt><a>takeWhileR</a> p xs</tt> is equivalent to <tt><a>reverse</a>--- (<a>takeWhileL</a> p (<a>reverse</a> xs))</tt>.-takeWhileR :: (a -> Bool) -> Seq a -> Seq a---- | <i>O(i)</i> where <i>i</i> is the prefix length. <tt><a>dropWhileL</a>--- p xs</tt> returns the suffix remaining after <tt><a>takeWhileL</a> p--- xs</tt>.-dropWhileL :: (a -> Bool) -> Seq a -> Seq a---- | <i>O(i)</i> where <i>i</i> is the suffix length. <tt><a>dropWhileR</a>--- p xs</tt> returns the prefix remaining after <tt><a>takeWhileR</a> p--- xs</tt>.--- --- <tt><a>dropWhileR</a> p xs</tt> is equivalent to <tt><a>reverse</a>--- (<a>dropWhileL</a> p (<a>reverse</a> xs))</tt>.-dropWhileR :: (a -> Bool) -> Seq a -> Seq a---- | <i>O(i)</i> where <i>i</i> is the prefix length. <a>spanl</a>, applied--- to a predicate <tt>p</tt> and a sequence <tt>xs</tt>, returns a pair--- whose first element is the longest prefix (possibly empty) of--- <tt>xs</tt> of elements that satisfy <tt>p</tt> and the second element--- is the remainder of the sequence.-spanl :: (a -> Bool) -> Seq a -> (Seq a, Seq a)---- | <i>O(i)</i> where <i>i</i> is the suffix length. <a>spanr</a>, applied--- to a predicate <tt>p</tt> and a sequence <tt>xs</tt>, returns a pair--- whose <i>first</i> element is the longest <i>suffix</i> (possibly--- empty) of <tt>xs</tt> of elements that satisfy <tt>p</tt> and the--- second element is the remainder of the sequence.-spanr :: (a -> Bool) -> Seq a -> (Seq a, Seq a)---- | <i>O(i)</i> where <i>i</i> is the breakpoint index. <a>breakl</a>,--- applied to a predicate <tt>p</tt> and a sequence <tt>xs</tt>, returns--- a pair whose first element is the longest prefix (possibly empty) of--- <tt>xs</tt> of elements that <i>do not satisfy</i> <tt>p</tt> and the--- second element is the remainder of the sequence.--- --- <tt><a>breakl</a> p</tt> is equivalent to <tt><a>spanl</a> (not .--- p)</tt>.-breakl :: (a -> Bool) -> Seq a -> (Seq a, Seq a)---- | <tt><a>breakr</a> p</tt> is equivalent to <tt><a>spanr</a> (not .--- p)</tt>.-breakr :: (a -> Bool) -> Seq a -> (Seq a, Seq a)---- | <i>O(n)</i>. The <a>partition</a> function takes a predicate--- <tt>p</tt> and a sequence <tt>xs</tt> and returns sequences of those--- elements which do and do not satisfy the predicate.-partition :: (a -> Bool) -> Seq a -> (Seq a, Seq a)---- | <i>O(n)</i>. The <a>filter</a> function takes a predicate <tt>p</tt>--- and a sequence <tt>xs</tt> and returns a sequence of those elements--- which satisfy the predicate.-filter :: (a -> Bool) -> Seq a -> Seq a---- | <i>O(n log n)</i>. <a>sort</a> sorts the specified <a>Seq</a> by the--- natural ordering of its elements. The sort is stable. If stability is--- not required, <a>unstableSort</a> can be considerably faster, and in--- particular uses less memory.-sort :: Ord a => Seq a -> Seq a---- | <i>O(n log n)</i>. <a>sortBy</a> sorts the specified <a>Seq</a>--- according to the specified comparator. The sort is stable. If--- stability is not required, <a>unstableSortBy</a> can be considerably--- faster, and in particular uses less memory.-sortBy :: (a -> a -> Ordering) -> Seq a -> Seq a---- | <i>O(n log n)</i>. <a>unstableSort</a> sorts the specified <a>Seq</a>--- by the natural ordering of its elements, but the sort is not stable.--- This algorithm is frequently faster and uses less memory than--- <a>sort</a>, and performs extremely well -- frequently twice as fast--- as <a>sort</a> -- when the sequence is already nearly sorted.-unstableSort :: Ord a => Seq a -> Seq a---- | <i>O(n log n)</i>. A generalization of <a>unstableSort</a>,--- <a>unstableSortBy</a> takes an arbitrary comparator and sorts the--- specified sequence. The sort is not stable. This algorithm is--- frequently faster and uses less memory than <a>sortBy</a>, and--- performs extremely well -- frequently twice as fast as <a>sortBy</a>--- -- when the sequence is already nearly sorted.-unstableSortBy :: (a -> a -> Ordering) -> Seq a -> Seq a---- | <i>O(log(min(i,n-i)))</i>. The element at the specified position,--- counting from 0. The argument should thus be a non-negative integer--- less than the size of the sequence. If the position is out of range,--- <a>index</a> fails with an error.-index :: Seq a -> Int -> a---- | <i>O(log(min(i,n-i)))</i>. Update the element at the specified--- position. If the position is out of range, the original sequence is--- returned.-adjust :: (a -> a) -> Int -> Seq a -> Seq a---- | <i>O(log(min(i,n-i)))</i>. Replace the element at the specified--- position. If the position is out of range, the original sequence is--- returned.-update :: Int -> a -> Seq a -> Seq a---- | <i>O(log(min(i,n-i)))</i>. The first <tt>i</tt> elements of a--- sequence. If <tt>i</tt> is negative, <tt><a>take</a> i s</tt> yields--- the empty sequence. If the sequence contains fewer than <tt>i</tt>--- elements, the whole sequence is returned.-take :: Int -> Seq a -> Seq a---- | <i>O(log(min(i,n-i)))</i>. Elements of a sequence after the first--- <tt>i</tt>. If <tt>i</tt> is negative, <tt><a>drop</a> i s</tt> yields--- the whole sequence. If the sequence contains fewer than <tt>i</tt>--- elements, the empty sequence is returned.-drop :: Int -> Seq a -> Seq a---- | <i>O(log(min(i,n-i)))</i>. Split a sequence at a given position.--- <tt><a>splitAt</a> i s = (<a>take</a> i s, <a>drop</a> i s)</tt>.-splitAt :: Int -> Seq a -> (Seq a, Seq a)---- | <a>elemIndexL</a> finds the leftmost index of the specified element,--- if it is present, and otherwise <a>Nothing</a>.-elemIndexL :: Eq a => a -> Seq a -> Maybe Int---- | <a>elemIndicesL</a> finds the indices of the specified element, from--- left to right (i.e. in ascending order).-elemIndicesL :: Eq a => a -> Seq a -> [Int]---- | <a>elemIndexR</a> finds the rightmost index of the specified element,--- if it is present, and otherwise <a>Nothing</a>.-elemIndexR :: Eq a => a -> Seq a -> Maybe Int---- | <a>elemIndicesR</a> finds the indices of the specified element, from--- right to left (i.e. in descending order).-elemIndicesR :: Eq a => a -> Seq a -> [Int]---- | <tt><a>findIndexL</a> p xs</tt> finds the index of the leftmost--- element that satisfies <tt>p</tt>, if any exist.-findIndexL :: (a -> Bool) -> Seq a -> Maybe Int---- | <tt><a>findIndicesL</a> p</tt> finds all indices of elements that--- satisfy <tt>p</tt>, in ascending order.-findIndicesL :: (a -> Bool) -> Seq a -> [Int]---- | <tt><a>findIndexR</a> p xs</tt> finds the index of the rightmost--- element that satisfies <tt>p</tt>, if any exist.-findIndexR :: (a -> Bool) -> Seq a -> Maybe Int---- | <tt><a>findIndicesR</a> p</tt> finds all indices of elements that--- satisfy <tt>p</tt>, in descending order.-findIndicesR :: (a -> Bool) -> Seq a -> [Int]---- | <a>foldlWithIndex</a> is a version of <a>foldl</a> that also provides--- access to the index of each element.-foldlWithIndex :: (b -> Int -> a -> b) -> b -> Seq a -> b---- | <a>foldrWithIndex</a> is a version of <a>foldr</a> that also provides--- access to the index of each element.-foldrWithIndex :: (Int -> a -> b -> b) -> b -> Seq a -> b---- | A generalization of <a>fmap</a>, <a>mapWithIndex</a> takes a mapping--- function that also depends on the element's index, and applies it to--- every element in the sequence.-mapWithIndex :: (Int -> a -> b) -> Seq a -> Seq b---- | <i>O(n)</i>. The reverse of a sequence.-reverse :: Seq a -> Seq a---- | <i>O(min(n1,n2))</i>. <a>zip</a> takes two sequences and returns a--- sequence of corresponding pairs. If one input is short, excess--- elements are discarded from the right end of the longer sequence.-zip :: Seq a -> Seq b -> Seq (a, b)---- | <i>O(min(n1,n2))</i>. <a>zipWith</a> generalizes <a>zip</a> by zipping--- with the function given as the first argument, instead of a tupling--- function. For example, <tt>zipWith (+)</tt> is applied to two--- sequences to take the sequence of corresponding sums.-zipWith :: (a -> b -> c) -> Seq a -> Seq b -> Seq c---- | <i>O(min(n1,n2,n3))</i>. <a>zip3</a> takes three sequences and returns--- a sequence of triples, analogous to <a>zip</a>.-zip3 :: Seq a -> Seq b -> Seq c -> Seq (a, b, c)---- | <i>O(min(n1,n2,n3))</i>. <a>zipWith3</a> takes a function which--- combines three elements, as well as three sequences and returns a--- sequence of their point-wise combinations, analogous to--- <a>zipWith</a>.-zipWith3 :: (a -> b -> c -> d) -> Seq a -> Seq b -> Seq c -> Seq d---- | <i>O(min(n1,n2,n3,n4))</i>. <a>zip4</a> takes four sequences and--- returns a sequence of quadruples, analogous to <a>zip</a>.-zip4 :: Seq a -> Seq b -> Seq c -> Seq d -> Seq (a, b, c, d)---- | <i>O(min(n1,n2,n3,n4))</i>. <a>zipWith4</a> takes a function which--- combines four elements, as well as four sequences and returns a--- sequence of their point-wise combinations, analogous to--- <a>zipWith</a>.-zipWith4 :: (a -> b -> c -> d -> e) -> Seq a -> Seq b -> Seq c -> Seq d -> Seq e-instance Eq a => Eq (ViewR a)-instance Ord a => Ord (ViewR a)-instance Show a => Show (ViewR a)-instance Read a => Read (ViewR a)-instance Data a => Data (ViewR a)-instance Eq a => Eq (ViewL a)-instance Ord a => Ord (ViewL a)-instance Show a => Show (ViewL a)-instance Read a => Read (ViewL a)-instance Data a => Data (ViewL a)-instance Traversable ViewR-instance Foldable ViewR-instance Functor ViewR-instance Typeable1 ViewR-instance Traversable ViewL-instance Foldable ViewL-instance Functor ViewL-instance Typeable1 ViewL-instance Applicative (State s)-instance Monad (State s)-instance Functor (State s)-instance Applicative Id-instance Monad Id-instance Functor Id-instance Traversable Elem-instance Foldable Elem-instance Functor Elem-instance Sized (Elem a)-instance Sized (Node a)-instance Traversable Node-instance Functor Node-instance Foldable Node-instance Sized a => Sized (Digit a)-instance Traversable Digit-instance Functor Digit-instance Foldable Digit-instance Traversable FingerTree-instance Functor FingerTree-instance Foldable FingerTree-instance Sized a => Sized (FingerTree a)-instance Data a => Data (Seq a)-instance Typeable1 Seq-instance Monoid (Seq a)-instance Read a => Read (Seq a)-instance Show a => Show (Seq a)-instance Ord a => Ord (Seq a)-instance Eq a => Eq (Seq a)-instance MonadPlus Seq-instance Monad Seq-instance Traversable Seq-instance Foldable Seq-instance Functor Seq----- | Multi-way trees (<i>aka</i> rose trees) and forests.-module Data.Tree---- | Multi-way trees, also known as <i>rose trees</i>.-data Tree a-Node :: a -> Forest a -> Tree a---- | label value-rootLabel :: Tree a -> a---- | zero or more child trees-subForest :: Tree a -> Forest a-type Forest a = [Tree a]---- | Neat 2-dimensional drawing of a tree.-drawTree :: Tree String -> String---- | Neat 2-dimensional drawing of a forest.-drawForest :: Forest String -> String---- | The elements of a tree in pre-order.-flatten :: Tree a -> [a]---- | Lists of nodes at each level of the tree.-levels :: Tree a -> [[a]]---- | Build a tree from a seed value-unfoldTree :: (b -> (a, [b])) -> b -> Tree a---- | Build a forest from a list of seed values-unfoldForest :: (b -> (a, [b])) -> [b] -> Forest a---- | Monadic tree builder, in depth-first order-unfoldTreeM :: Monad m => (b -> m (a, [b])) -> b -> m (Tree a)---- | Monadic forest builder, in depth-first order-unfoldForestM :: Monad m => (b -> m (a, [b])) -> [b] -> m (Forest a)---- | Monadic tree builder, in breadth-first order, using an algorithm--- adapted from <i>Breadth-First Numbering: Lessons from a Small Exercise--- in Algorithm Design</i>, by Chris Okasaki, <i>ICFP'00</i>.-unfoldTreeM_BF :: Monad m => (b -> m (a, [b])) -> b -> m (Tree a)---- | Monadic forest builder, in breadth-first order, using an algorithm--- adapted from <i>Breadth-First Numbering: Lessons from a Small Exercise--- in Algorithm Design</i>, by Chris Okasaki, <i>ICFP'00</i>.-unfoldForestM_BF :: Monad m => (b -> m (a, [b])) -> [b] -> m (Forest a)-instance Eq a => Eq (Tree a)-instance Read a => Read (Tree a)-instance Show a => Show (Tree a)-instance Data a => Data (Tree a)-instance Foldable Tree-instance Traversable Tree-instance Monad Tree-instance Applicative Tree-instance Functor Tree-instance Typeable1 Tree----- | A version of the graph algorithms described in:--- --- <i>Lazy Depth-First Search and Linear Graph Algorithms in Haskell</i>,--- by David King and John Launchbury.-module Data.Graph---- | The strongly connected components of a directed graph, topologically--- sorted.-stronglyConnComp :: Ord key => [(node, key, [key])] -> [SCC node]---- | The strongly connected components of a directed graph, topologically--- sorted. The function is the same as <a>stronglyConnComp</a>, except--- that all the information about each node retained. This interface is--- used when you expect to apply <a>SCC</a> to (some of) the result of--- <a>SCC</a>, so you don't want to lose the dependency information.-stronglyConnCompR :: Ord key => [(node, key, [key])] -> [SCC (node, key, [key])]---- | Strongly connected component.-data SCC vertex---- | A single vertex that is not in any cycle.-AcyclicSCC :: vertex -> SCC vertex---- | A maximal set of mutually reachable vertices.-CyclicSCC :: [vertex] -> SCC vertex---- | The vertices of a strongly connected component.-flattenSCC :: SCC vertex -> [vertex]---- | The vertices of a list of strongly connected components.-flattenSCCs :: [SCC a] -> [a]---- | Adjacency list representation of a graph, mapping each vertex to its--- list of successors.-type Graph = Table [Vertex]---- | Table indexed by a contiguous set of vertices.-type Table a = Array Vertex a---- | The bounds of a <a>Table</a>.-type Bounds = (Vertex, Vertex)---- | An edge from the first vertex to the second.-type Edge = (Vertex, Vertex)---- | Abstract representation of vertices.-type Vertex = Int---- | Build a graph from a list of nodes uniquely identified by keys, with a--- list of keys of nodes this node should have edges to. The out-list may--- contain keys that don't correspond to nodes of the graph; they are--- ignored.-graphFromEdges :: Ord key => [(node, key, [key])] -> (Graph, Vertex -> (node, key, [key]), key -> Maybe Vertex)---- | Identical to <a>graphFromEdges</a>, except that the return value does--- not include the function which maps keys to vertices. This version of--- <a>graphFromEdges</a> is for backwards compatibility.-graphFromEdges' :: Ord key => [(node, key, [key])] -> (Graph, Vertex -> (node, key, [key]))---- | Build a graph from a list of edges.-buildG :: Bounds -> [Edge] -> Graph---- | The graph obtained by reversing all edges.-transposeG :: Graph -> Graph---- | All vertices of a graph.-vertices :: Graph -> [Vertex]---- | All edges of a graph.-edges :: Graph -> [Edge]---- | A table of the count of edges from each node.-outdegree :: Graph -> Table Int---- | A table of the count of edges into each node.-indegree :: Graph -> Table Int---- | A spanning forest of the part of the graph reachable from the listed--- vertices, obtained from a depth-first search of the graph starting at--- each of the listed vertices in order.-dfs :: Graph -> [Vertex] -> Forest Vertex---- | A spanning forest of the graph, obtained from a depth-first search of--- the graph starting from each vertex in an unspecified order.-dff :: Graph -> Forest Vertex---- | A topological sort of the graph. The order is partially specified by--- the condition that a vertex <i>i</i> precedes <i>j</i> whenever--- <i>j</i> is reachable from <i>i</i> but not vice versa.-topSort :: Graph -> [Vertex]---- | The connected components of a graph. Two vertices are connected if--- there is a path between them, traversing edges in either direction.-components :: Graph -> Forest Vertex---- | The strongly connected components of a graph.-scc :: Graph -> Forest Vertex---- | The biconnected components of a graph. An undirected graph is--- biconnected if the deletion of any vertex leaves it connected.-bcc :: Graph -> Forest [Vertex]---- | A list of vertices reachable from a given vertex.-reachable :: Graph -> Vertex -> [Vertex]---- | Is the second vertex reachable from the first?-path :: Graph -> Vertex -> Vertex -> Bool-instance Monad (SetM s)
− data/ghc-mtl.txt
@@ -1,56 +0,0 @@--- Hoogle documentation, generated by Haddock--- See Hoogle, http://www.haskell.org/hoogle/----- | An mtl compatible version of the Ghc-Api monads--- and monad-transformers.--- --- Provides an <a>mtl</a> compatible version of the <a>GhcT</a>--- monad-transformer defined in the 'GHC-API' since version 6.10.1.-@package ghc-mtl-@version 1.0.1.0--module Control.Monad.Ghc-data Ghc a-runGhc :: Maybe FilePath -> Ghc a -> IO a-data GhcT m a-runGhcT :: (Functor m, MonadCatchIO m) => Maybe FilePath -> GhcT m a -> m a---- | A monad that has all the features needed by GHC API calls.--- --- In short, a GHC monad--- --- <ul>--- <li>allows embedding of IO actions,</li>--- <li>can log warnings,</li>--- <li>allows handling of (extensible) exceptions, and</li>--- <li>maintains a current session.</li>--- </ul>--- --- If you do not use <a>Ghc</a> or <a>GhcT</a>, make sure to call--- <tt>GHC.initGhcMonad</tt> before any call to the GHC API functions can--- occur.-class (Functor m, MonadIO m, WarnLogMonad m, ExceptionMonad m) => GhcMonad m :: (* -> *)-getSession :: GhcMonad m => m HscEnv-setSession :: GhcMonad m => HscEnv -> m ()-instance Functor Ghc-instance Monad Ghc-instance WarnLogMonad Ghc-instance ExceptionMonad Ghc-instance MonadIO Ghc-instance GhcMonad Ghc-instance Functor m => Functor (MTLAdapter m)-instance Monad m => Monad (MTLAdapter m)-instance Functor m => Functor (GhcT m)-instance Monad m => Monad (GhcT m)-instance MonadCatchIO m => ExceptionMonad (MTLAdapter m)-instance MonadIO m => MonadIO (MTLAdapter m)-instance (Functor m, MonadCatchIO m) => GhcMonad (GhcT m)-instance MonadIO m => WarnLogMonad (GhcT m)-instance MonadCatchIO m => ExceptionMonad (GhcT m)-instance MonadCatchIO m => MonadCatchIO (GhcT m)-instance MonadIO m => MonadIO (GhcT m)-instance MonadIO m => MonadIO (GhcT m)-instance MonadTrans GhcT-instance MonadCatchIO Ghc-instance MonadIO Ghc
− data/ghc-prim.txt
@@ -1,1158 +0,0 @@--- Hoogle documentation, generated by Haddock--- See Hoogle, http://www.haskell.org/hoogle/----- | GHC primitives--- --- GHC primitives.-@package ghc-prim----- | GHC magic. Use GHC.Exts from the base package instead of importing--- this module directly.-module GHC.Magic---- | The call '(inline f)' reduces to <tt>f</tt>, but <a>inline</a> has a--- BuiltInRule that tries to inline <tt>f</tt> (if it has an unfolding)--- unconditionally The <tt>NOINLINE</tt> pragma arranges that inline only--- gets inlined (and hence eliminated) late in compilation, after the--- rule has had a good chance to fire.-inline :: a -> a--module GHC.Generics-data Unit-Unit :: Unit-data (:+:) a b-Inl :: a -> :+: a b-Inr :: b -> :+: a b-data (:*:) a b-(:*:) :: a -> b -> :*: a b----- | GHC type definitions. Use GHC.Exts from the base package instead of--- importing this module directly.-module GHC.Types---- | The character type <a>Char</a> is an enumeration whose values--- represent Unicode (or equivalently ISO/IEC 10646) characters (see--- <a>http://www.unicode.org/</a> for details). This set extends the ISO--- 8859-1 (Latin-1) character set (the first 256 charachers), which is--- itself an extension of the ASCII character set (the first 128--- characters). A character literal in Haskell has type <a>Char</a>.--- --- To convert a <a>Char</a> to or from the corresponding <a>Int</a> value--- defined by Unicode, use <tt>Prelude.toEnum</tt> and--- <tt>Prelude.fromEnum</tt> from the <tt>Prelude.Enum</tt> class--- respectively (or equivalently <tt>ord</tt> and <tt>chr</tt>).-data Char-C# :: Char# -> Char---- | A fixed-precision integer type with at least the range <tt>[-2^29 ..--- 2^29-1]</tt>. The exact range for a given implementation can be--- determined by using <tt>Prelude.minBound</tt> and--- <tt>Prelude.maxBound</tt> from the <tt>Prelude.Bounded</tt> class.-data Int-I# :: Int# -> Int---- | Single-precision floating point numbers. It is desirable that this--- type be at least equal in range and precision to the IEEE--- single-precision type.-data Float-F# :: Float# -> Float---- | Double-precision floating point numbers. It is desirable that this--- type be at least equal in range and precision to the IEEE--- double-precision type.-data Double-D# :: Double# -> Double---- | A value of type <tt><a>IO</a> a</tt> is a computation which, when--- performed, does some I/O before returning a value of type <tt>a</tt>.--- --- There is really only one way to "perform" an I/O action: bind it to--- <tt>Main.main</tt> in your program. When your program is run, the I/O--- will be performed. It isn't possible to perform I/O from an arbitrary--- function, unless that function is itself in the <a>IO</a> monad and--- called at some point, directly or indirectly, from <tt>Main.main</tt>.--- --- <a>IO</a> is a monad, so <a>IO</a> actions can be combined using--- either the do-notation or the <tt>>></tt> and <tt>>>=</tt>--- operations from the <tt>Monad</tt> class.-newtype IO a-IO :: (State# RealWorld -> (# State# RealWorld, a #)) -> IO a--module GHC.Unit---- | The unit datatype <tt>()</tt> has one non-undefined member, the--- nullary constructor <tt>()</tt>.-data ()-() :: ()--module GHC.Debug-debugLn :: [Char] -> IO ()-debugErrLn :: [Char] -> IO ()--module GHC.Ordering-data Ordering-LT :: Ordering-EQ :: Ordering-GT :: Ordering----- | The tuple data types-module GHC.Tuple-data (,) a b-(,) :: a -> b -> (,) a b-data (,,) a b c-(,,) :: a -> b -> c -> (,,) a b c-data (,,,) a b c d-(,,,) :: a -> b -> c -> d -> (,,,) a b c d-data (,,,,) a b c d e-(,,,,) :: a -> b -> c -> d -> e -> (,,,,) a b c d e-data (,,,,,) a b c d e f-(,,,,,) :: a -> b -> c -> d -> e -> f -> (,,,,,) a b c d e f-data (,,,,,,) a b c d e f g-(,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> (,,,,,,) a b c d e f g-data (,,,,,,,) a b c d e f g h-(,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> (,,,,,,,) a b c d e f g h-data (,,,,,,,,) a b c d e f g h i-(,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> (,,,,,,,,) a b c d e f g h i-data (,,,,,,,,,) a b c d e f g h i j-(,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> (,,,,,,,,,) a b c d e f g h i j-data (,,,,,,,,,,) a b c d e f g h i j k-(,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> (,,,,,,,,,,) a b c d e f g h i j k-data (,,,,,,,,,,,) a b c d e f g h i j k l-(,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> (,,,,,,,,,,,) a b c d e f g h i j k l-data (,,,,,,,,,,,,) a b c d e f g h i j k l m-(,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> (,,,,,,,,,,,,) a b c d e f g h i j k l m-data (,,,,,,,,,,,,,) a b c d e f g h i j k l m n-(,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> (,,,,,,,,,,,,,) a b c d e f g h i j k l m n-data (,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o-(,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> (,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o-data (,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p-(,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> (,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p-data (,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q-(,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> (,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q-data (,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r-(,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> (,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r-data (,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s-(,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> (,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s-data (,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t-(,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> (,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t-data (,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u-(,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> (,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u-data (,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v-(,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> (,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v-data (,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w-(,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> (,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w-data (,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x-(,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> (,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x-data (,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y-(,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> (,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y-data (,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z-(,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> (,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z-data (,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_-(,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> a__ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> a__ -> b__ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> a__ -> b__ -> c__ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> a__ -> b__ -> c__ -> d__ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> a__ -> b__ -> c__ -> d__ -> e__ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> a__ -> b__ -> c__ -> d__ -> e__ -> f__ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> a__ -> b__ -> c__ -> d__ -> e__ -> f__ -> g__ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> a__ -> b__ -> c__ -> d__ -> e__ -> f__ -> g__ -> h__ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> a__ -> b__ -> c__ -> d__ -> e__ -> f__ -> g__ -> h__ -> i__ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__-data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__-(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> y -> z -> a_ -> b_ -> c_ -> d_ -> e_ -> f_ -> g_ -> h_ -> i_ -> j_ -> k_ -> l_ -> m_ -> n_ -> o_ -> p_ -> q_ -> r_ -> s_ -> t_ -> u_ -> v_ -> w_ -> x_ -> y_ -> z_ -> a__ -> b__ -> c__ -> d__ -> e__ -> f__ -> g__ -> h__ -> i__ -> j__ -> (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__--module GHC.Bool-data Bool-False :: Bool-True :: Bool----- | GHC's primitive types and operations. Use GHC.Exts from the base--- package instead of importing this module directly.-module GHC.Prim-data Char#-gtChar# :: Char# -> Char# -> Bool-geChar# :: Char# -> Char# -> Bool-eqChar# :: Char# -> Char# -> Bool-neChar# :: Char# -> Char# -> Bool-ltChar# :: Char# -> Char# -> Bool-leChar# :: Char# -> Char# -> Bool-ord# :: Char# -> Int#-data Int#-(+#) :: Int# -> Int# -> Int#-(-#) :: Int# -> Int# -> Int#---- | Low word of signed integer multiply.-(*#) :: Int# -> Int# -> Int#---- | Return non-zero if there is any possibility that the upper word of a--- signed integer multiply might contain useful information. Return zero--- only if you are completely sure that no overflow can occur. On a--- 32-bit platform, the recommmended implementation is to do a 32 x 32--- -> 64 signed multiply, and subtract result[63:32] from (result[31]--- >>signed 31). If this is zero, meaning that the upper word is--- merely a sign extension of the lower one, no overflow can occur.--- --- On a 64-bit platform it is not always possible to acquire the top 64--- bits of the result. Therefore, a recommended implementation is to take--- the absolute value of both operands, and return 0 iff bits[63:31] of--- them are zero, since that means that their magnitudes fit within 31--- bits, so the magnitude of the product must fit into 62 bits.--- --- If in doubt, return non-zero, but do make an effort to create the--- correct answer for small args, since otherwise the performance of--- <tt>(*) :: Integer -> Integer -> Integer</tt> will be poor.-mulIntMayOflo# :: Int# -> Int# -> Int#---- | Rounds towards zero.-quotInt# :: Int# -> Int# -> Int#---- | Satisfies <tt>(quotInt# x y) *# y +# (remInt# x y) == x</tt>.-remInt# :: Int# -> Int# -> Int#-negateInt# :: Int# -> Int#---- | Add with carry. First member of result is (wrapped) sum; second member--- is 0 iff no overflow occured.-addIntC# :: Int# -> Int# -> (# Int#, Int# #)---- | Subtract with carry. First member of result is (wrapped) difference;--- second member is 0 iff no overflow occured.-subIntC# :: Int# -> Int# -> (# Int#, Int# #)-(>#) :: Int# -> Int# -> Bool-(>=#) :: Int# -> Int# -> Bool-(==#) :: Int# -> Int# -> Bool-(/=#) :: Int# -> Int# -> Bool-(<#) :: Int# -> Int# -> Bool-(<=#) :: Int# -> Int# -> Bool-chr# :: Int# -> Char#-int2Word# :: Int# -> Word#-int2Float# :: Int# -> Float#-int2Double# :: Int# -> Double#---- | Shift left. Result undefined if shift amount is not in the range 0 to--- word size - 1 inclusive.-uncheckedIShiftL# :: Int# -> Int# -> Int#---- | Shift right arithmetic. Result undefined if shift amount is not in the--- range 0 to word size - 1 inclusive.-uncheckedIShiftRA# :: Int# -> Int# -> Int#---- | Shift right logical. Result undefined if shift amount is not in the--- range 0 to word size - 1 inclusive.-uncheckedIShiftRL# :: Int# -> Int# -> Int#-data Word#-plusWord# :: Word# -> Word# -> Word#-minusWord# :: Word# -> Word# -> Word#-timesWord# :: Word# -> Word# -> Word#-quotWord# :: Word# -> Word# -> Word#-remWord# :: Word# -> Word# -> Word#-and# :: Word# -> Word# -> Word#-or# :: Word# -> Word# -> Word#-xor# :: Word# -> Word# -> Word#-not# :: Word# -> Word#---- | Shift left logical. Result undefined if shift amount is not in the--- range 0 to word size - 1 inclusive.-uncheckedShiftL# :: Word# -> Int# -> Word#---- | Shift right logical. Result undefined if shift amount is not in the--- range 0 to word size - 1 inclusive.-uncheckedShiftRL# :: Word# -> Int# -> Word#-word2Int# :: Word# -> Int#-gtWord# :: Word# -> Word# -> Bool-geWord# :: Word# -> Word# -> Bool-eqWord# :: Word# -> Word# -> Bool-neWord# :: Word# -> Word# -> Bool-ltWord# :: Word# -> Word# -> Bool-leWord# :: Word# -> Word# -> Bool-narrow8Int# :: Int# -> Int#-narrow16Int# :: Int# -> Int#-narrow32Int# :: Int# -> Int#-narrow8Word# :: Word# -> Word#-narrow16Word# :: Word# -> Word#-narrow32Word# :: Word# -> Word#-data Double#-(>##) :: Double# -> Double# -> Bool-(>=##) :: Double# -> Double# -> Bool-(==##) :: Double# -> Double# -> Bool-(/=##) :: Double# -> Double# -> Bool-(<##) :: Double# -> Double# -> Bool-(<=##) :: Double# -> Double# -> Bool-(+##) :: Double# -> Double# -> Double#-(-##) :: Double# -> Double# -> Double#-(*##) :: Double# -> Double# -> Double#-(/##) :: Double# -> Double# -> Double#-negateDouble# :: Double# -> Double#---- | Truncates a <tt>Double</tt>. Results are undefined if the truncation--- if truncation yields a value outside the range of <tt>Int#</tt>.-double2Int# :: Double# -> Int#-double2Float# :: Double# -> Float#-expDouble# :: Double# -> Double#-logDouble# :: Double# -> Double#-sqrtDouble# :: Double# -> Double#-sinDouble# :: Double# -> Double#-cosDouble# :: Double# -> Double#-tanDouble# :: Double# -> Double#-asinDouble# :: Double# -> Double#-acosDouble# :: Double# -> Double#-atanDouble# :: Double# -> Double#-sinhDouble# :: Double# -> Double#-coshDouble# :: Double# -> Double#-tanhDouble# :: Double# -> Double#---- | Exponentiation.-(**##) :: Double# -> Double# -> Double#---- | Convert to integer. First component of the result is -1 or 1,--- indicating the sign of the mantissa. The next two are the high and low--- 32 bits of the mantissa respectively, and the last is the exponent.-decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #)-data Float#-gtFloat# :: Float# -> Float# -> Bool-geFloat# :: Float# -> Float# -> Bool-eqFloat# :: Float# -> Float# -> Bool-neFloat# :: Float# -> Float# -> Bool-ltFloat# :: Float# -> Float# -> Bool-leFloat# :: Float# -> Float# -> Bool-plusFloat# :: Float# -> Float# -> Float#-minusFloat# :: Float# -> Float# -> Float#-timesFloat# :: Float# -> Float# -> Float#-divideFloat# :: Float# -> Float# -> Float#-negateFloat# :: Float# -> Float#---- | Truncates a <tt>Float</tt>. Results are undefined if the truncation if--- truncation yields a value outside the range of <tt>Int#</tt>.-float2Int# :: Float# -> Int#-expFloat# :: Float# -> Float#-logFloat# :: Float# -> Float#-sqrtFloat# :: Float# -> Float#-sinFloat# :: Float# -> Float#-cosFloat# :: Float# -> Float#-tanFloat# :: Float# -> Float#-asinFloat# :: Float# -> Float#-acosFloat# :: Float# -> Float#-atanFloat# :: Float# -> Float#-sinhFloat# :: Float# -> Float#-coshFloat# :: Float# -> Float#-tanhFloat# :: Float# -> Float#-powerFloat# :: Float# -> Float# -> Float#-float2Double# :: Float# -> Double#---- | Convert to integers. First <tt>Int#</tt> in result is the mantissa;--- second is the exponent.-decodeFloat_Int# :: Float# -> (# Int#, Int# #)-data Array# a-data MutableArray# s a---- | Create a new mutable array with the specified number of elements, in--- the specified state thread, with each element containing the specified--- initial value.-newArray# :: Int# -> a -> State# s -> (# State# s, MutableArray# s a #)-sameMutableArray# :: MutableArray# s a -> MutableArray# s a -> Bool---- | Read from specified index of mutable array. Result is not yet--- evaluated.-readArray# :: MutableArray# s a -> Int# -> State# s -> (# State# s, a #)---- | Write to specified index of mutable array.-writeArray# :: MutableArray# s a -> Int# -> a -> State# s -> State# s---- | Read from specified index of immutable array. Result is packaged into--- an unboxed singleton; the result itself is not yet evaluated.-indexArray# :: Array# a -> Int# -> (# a #)---- | Make a mutable array immutable, without copying.-unsafeFreezeArray# :: MutableArray# s a -> State# s -> (# State# s, Array# a #)---- | Make an immutable array mutable, without copying.-unsafeThawArray# :: Array# a -> State# s -> (# State# s, MutableArray# s a #)-data ByteArray#-data MutableByteArray# s---- | Create a new mutable byte array of specified size (in bytes), in the--- specified state thread.-newByteArray# :: Int# -> State# s -> (# State# s, MutableByteArray# s #)---- | Create a mutable byte array that the GC guarantees not to move.-newPinnedByteArray# :: Int# -> State# s -> (# State# s, MutableByteArray# s #)---- | Create a mutable byte array, aligned by the specified amount, that the--- GC guarantees not to move.-newAlignedPinnedByteArray# :: Int# -> Int# -> State# s -> (# State# s, MutableByteArray# s #)---- | Intended for use with pinned arrays; otherwise very unsafe!-byteArrayContents# :: ByteArray# -> Addr#-sameMutableByteArray# :: MutableByteArray# s -> MutableByteArray# s -> Bool---- | Make a mutable byte array immutable, without copying.-unsafeFreezeByteArray# :: MutableByteArray# s -> State# s -> (# State# s, ByteArray# #)---- | Return the size of the array in bytes.-sizeofByteArray# :: ByteArray# -> Int#---- | Return the size of the array in bytes.-sizeofMutableByteArray# :: MutableByteArray# s -> Int#---- | Read 8-bit character; offset in bytes.-indexCharArray# :: ByteArray# -> Int# -> Char#---- | Read 31-bit character; offset in 4-byte words.-indexWideCharArray# :: ByteArray# -> Int# -> Char#-indexIntArray# :: ByteArray# -> Int# -> Int#-indexWordArray# :: ByteArray# -> Int# -> Word#-indexAddrArray# :: ByteArray# -> Int# -> Addr#-indexFloatArray# :: ByteArray# -> Int# -> Float#-indexDoubleArray# :: ByteArray# -> Int# -> Double#-indexStablePtrArray# :: ByteArray# -> Int# -> StablePtr# a-indexInt8Array# :: ByteArray# -> Int# -> Int#-indexInt16Array# :: ByteArray# -> Int# -> Int#-indexInt32Array# :: ByteArray# -> Int# -> Int#-indexInt64Array# :: ByteArray# -> Int# -> Int#-indexWord8Array# :: ByteArray# -> Int# -> Word#-indexWord16Array# :: ByteArray# -> Int# -> Word#-indexWord32Array# :: ByteArray# -> Int# -> Word#-indexWord64Array# :: ByteArray# -> Int# -> Word#---- | Read 8-bit character; offset in bytes.-readCharArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Char# #)---- | Read 31-bit character; offset in 4-byte words.-readWideCharArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Char# #)-readIntArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)-readWordArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)-readAddrArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Addr# #)-readFloatArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Float# #)-readDoubleArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Double# #)-readStablePtrArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, StablePtr# a #)-readInt8Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)-readInt16Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)-readInt32Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)-readInt64Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)-readWord8Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)-readWord16Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)-readWord32Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)-readWord64Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)---- | Write 8-bit character; offset in bytes.-writeCharArray# :: MutableByteArray# s -> Int# -> Char# -> State# s -> State# s---- | Write 31-bit character; offset in 4-byte words.-writeWideCharArray# :: MutableByteArray# s -> Int# -> Char# -> State# s -> State# s-writeIntArray# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s-writeWordArray# :: MutableByteArray# s -> Int# -> Word# -> State# s -> State# s-writeAddrArray# :: MutableByteArray# s -> Int# -> Addr# -> State# s -> State# s-writeFloatArray# :: MutableByteArray# s -> Int# -> Float# -> State# s -> State# s-writeDoubleArray# :: MutableByteArray# s -> Int# -> Double# -> State# s -> State# s-writeStablePtrArray# :: MutableByteArray# s -> Int# -> StablePtr# a -> State# s -> State# s-writeInt8Array# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s-writeInt16Array# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s-writeInt32Array# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s-writeInt64Array# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s-writeWord8Array# :: MutableByteArray# s -> Int# -> Word# -> State# s -> State# s-writeWord16Array# :: MutableByteArray# s -> Int# -> Word# -> State# s -> State# s-writeWord32Array# :: MutableByteArray# s -> Int# -> Word# -> State# s -> State# s-writeWord64Array# :: MutableByteArray# s -> Int# -> Word# -> State# s -> State# s---- | An arbitrary machine address assumed to point outside the--- garbage-collected heap.-data Addr#---- | The null address.-nullAddr# :: Addr#-plusAddr# :: Addr# -> Int# -> Addr#---- | Result is meaningless if two <tt>Addr#</tt>s are so far apart that--- their difference doesn't fit in an <tt>Int#</tt>.-minusAddr# :: Addr# -> Addr# -> Int#---- | Return the remainder when the <tt>Addr#</tt> arg, treated like an--- <tt>Int#</tt>, is divided by the <tt>Int#</tt> arg.-remAddr# :: Addr# -> Int# -> Int#---- | Coerce directly from address to int. Strongly deprecated.-addr2Int# :: Addr# -> Int#---- | Coerce directly from int to address. Strongly deprecated.-int2Addr# :: Int# -> Addr#-gtAddr# :: Addr# -> Addr# -> Bool-geAddr# :: Addr# -> Addr# -> Bool-eqAddr# :: Addr# -> Addr# -> Bool-neAddr# :: Addr# -> Addr# -> Bool-ltAddr# :: Addr# -> Addr# -> Bool-leAddr# :: Addr# -> Addr# -> Bool---- | Reads 8-bit character; offset in bytes.-indexCharOffAddr# :: Addr# -> Int# -> Char#---- | Reads 31-bit character; offset in 4-byte words.-indexWideCharOffAddr# :: Addr# -> Int# -> Char#-indexIntOffAddr# :: Addr# -> Int# -> Int#-indexWordOffAddr# :: Addr# -> Int# -> Word#-indexAddrOffAddr# :: Addr# -> Int# -> Addr#-indexFloatOffAddr# :: Addr# -> Int# -> Float#-indexDoubleOffAddr# :: Addr# -> Int# -> Double#-indexStablePtrOffAddr# :: Addr# -> Int# -> StablePtr# a-indexInt8OffAddr# :: Addr# -> Int# -> Int#-indexInt16OffAddr# :: Addr# -> Int# -> Int#-indexInt32OffAddr# :: Addr# -> Int# -> Int#-indexInt64OffAddr# :: Addr# -> Int# -> Int#-indexWord8OffAddr# :: Addr# -> Int# -> Word#-indexWord16OffAddr# :: Addr# -> Int# -> Word#-indexWord32OffAddr# :: Addr# -> Int# -> Word#-indexWord64OffAddr# :: Addr# -> Int# -> Word#---- | Reads 8-bit character; offset in bytes.-readCharOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Char# #)---- | Reads 31-bit character; offset in 4-byte words.-readWideCharOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Char# #)-readIntOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)-readWordOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word# #)-readAddrOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Addr# #)-readFloatOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Float# #)-readDoubleOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Double# #)-readStablePtrOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, StablePtr# a #)-readInt8OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)-readInt16OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)-readInt32OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)-readInt64OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)-readWord8OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word# #)-readWord16OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word# #)-readWord32OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word# #)-readWord64OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word# #)-writeCharOffAddr# :: Addr# -> Int# -> Char# -> State# s -> State# s-writeWideCharOffAddr# :: Addr# -> Int# -> Char# -> State# s -> State# s-writeIntOffAddr# :: Addr# -> Int# -> Int# -> State# s -> State# s-writeWordOffAddr# :: Addr# -> Int# -> Word# -> State# s -> State# s-writeAddrOffAddr# :: Addr# -> Int# -> Addr# -> State# s -> State# s-writeFloatOffAddr# :: Addr# -> Int# -> Float# -> State# s -> State# s-writeDoubleOffAddr# :: Addr# -> Int# -> Double# -> State# s -> State# s-writeStablePtrOffAddr# :: Addr# -> Int# -> StablePtr# a -> State# s -> State# s-writeInt8OffAddr# :: Addr# -> Int# -> Int# -> State# s -> State# s-writeInt16OffAddr# :: Addr# -> Int# -> Int# -> State# s -> State# s-writeInt32OffAddr# :: Addr# -> Int# -> Int# -> State# s -> State# s-writeInt64OffAddr# :: Addr# -> Int# -> Int# -> State# s -> State# s-writeWord8OffAddr# :: Addr# -> Int# -> Word# -> State# s -> State# s-writeWord16OffAddr# :: Addr# -> Int# -> Word# -> State# s -> State# s-writeWord32OffAddr# :: Addr# -> Int# -> Word# -> State# s -> State# s-writeWord64OffAddr# :: Addr# -> Int# -> Word# -> State# s -> State# s---- | A <tt>MutVar#</tt> behaves like a single-element mutable array.-data MutVar# s a---- | Create <tt>MutVar#</tt> with specified initial value in specified--- state thread.-newMutVar# :: a -> State# s -> (# State# s, MutVar# s a #)---- | Read contents of <tt>MutVar#</tt>. Result is not yet evaluated.-readMutVar# :: MutVar# s a -> State# s -> (# State# s, a #)---- | Write contents of <tt>MutVar#</tt>.-writeMutVar# :: MutVar# s a -> a -> State# s -> State# s-sameMutVar# :: MutVar# s a -> MutVar# s a -> Bool-atomicModifyMutVar# :: MutVar# s a -> (a -> b) -> State# s -> (# State# s, c #)-catch# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> (b -> State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-raise# :: a -> b-raiseIO# :: a -> State# (RealWorld) -> (# State# (RealWorld), b #)-maskAsyncExceptions# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-maskUninterruptible# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-unmaskAsyncExceptions# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-getMaskingState# :: State# (RealWorld) -> (# State# (RealWorld), Int# #)-data TVar# s a-atomically# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-retry# :: State# (RealWorld) -> (# State# (RealWorld), a #)-catchRetry# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-catchSTM# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> (b -> State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-check# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), () #)---- | Create a new <tt>TVar#</tt> holding a specified initial value.-newTVar# :: a -> State# s -> (# State# s, TVar# s a #)---- | Read contents of <tt>TVar#</tt>. Result is not yet evaluated.-readTVar# :: TVar# s a -> State# s -> (# State# s, a #)---- | Read contents of <tt>TVar#</tt> outside an STM transaction-readTVarIO# :: TVar# s a -> State# s -> (# State# s, a #)---- | Write contents of <tt>TVar#</tt>.-writeTVar# :: TVar# s a -> a -> State# s -> State# s-sameTVar# :: TVar# s a -> TVar# s a -> Bool---- | A shared mutable variable (<i>not</i> the same as a--- <tt>MutVar#</tt>!). (Note: in a non-concurrent implementation,--- <tt>(MVar# a)</tt> can be represented by <tt>(MutVar# (Maybe--- a))</tt>.)-data MVar# s a---- | Create new <tt>MVar#</tt>; initially empty.-newMVar# :: State# s -> (# State# s, MVar# s a #)---- | If <tt>MVar#</tt> is empty, block until it becomes full. Then remove--- and return its contents, and set it empty.-takeMVar# :: MVar# s a -> State# s -> (# State# s, a #)---- | If <tt>MVar#</tt> is empty, immediately return with integer 0 and--- value undefined. Otherwise, return with integer 1 and contents of--- <tt>MVar#</tt>, and set <tt>MVar#</tt> empty.-tryTakeMVar# :: MVar# s a -> State# s -> (# State# s, Int#, a #)---- | If <tt>MVar#</tt> is full, block until it becomes empty. Then store--- value arg as its new contents.-putMVar# :: MVar# s a -> a -> State# s -> State# s---- | If <tt>MVar#</tt> is full, immediately return with integer 0.--- Otherwise, store value arg as <tt>MVar#</tt>'s new contents, and--- return with integer 1.-tryPutMVar# :: MVar# s a -> a -> State# s -> (# State# s, Int# #)-sameMVar# :: MVar# s a -> MVar# s a -> Bool---- | Return 1 if <tt>MVar#</tt> is empty; 0 otherwise.-isEmptyMVar# :: MVar# s a -> State# s -> (# State# s, Int# #)---- | Sleep specified number of microseconds.-delay# :: Int# -> State# s -> State# s---- | Block until input is available on specified file descriptor.-waitRead# :: Int# -> State# s -> State# s---- | Block until output is possible on specified file descriptor.-waitWrite# :: Int# -> State# s -> State# s---- | <tt>State#</tt> is the primitive, unlifted type of states. It has one--- type parameter, thus <tt>State# RealWorld</tt>, or <tt>State# s</tt>,--- where s is a type variable. The only purpose of the type parameter is--- to keep different state threads separate. It is represented by nothing--- at all.-data State# s---- | <tt>RealWorld</tt> is deeply magical. It is <i>primitive</i>, but it--- is not <i>unlifted</i> (hence <tt>ptrArg</tt>). We never manipulate--- values of type <tt>RealWorld</tt>; it's only used in the type system,--- to parameterise <tt>State#</tt>.-data RealWorld---- | (In a non-concurrent implementation, this can be a singleton type,--- whose (unique) value is returned by <tt>myThreadId#</tt>. The other--- operations can be omitted.)-data ThreadId#-fork# :: a -> State# (RealWorld) -> (# State# (RealWorld), ThreadId# #)-forkOn# :: Int# -> a -> State# (RealWorld) -> (# State# (RealWorld), ThreadId# #)-killThread# :: ThreadId# -> a -> State# (RealWorld) -> State# (RealWorld)-yield# :: State# (RealWorld) -> State# (RealWorld)-myThreadId# :: State# (RealWorld) -> (# State# (RealWorld), ThreadId# #)-labelThread# :: ThreadId# -> Addr# -> State# (RealWorld) -> State# (RealWorld)-isCurrentThreadBound# :: State# (RealWorld) -> (# State# (RealWorld), Int# #)-noDuplicate# :: State# (RealWorld) -> State# (RealWorld)-threadStatus# :: ThreadId# -> State# (RealWorld) -> (# State# (RealWorld), Int# #)-data Weak# b-mkWeak# :: o -> b -> c -> State# (RealWorld) -> (# State# (RealWorld), Weak# b #)-mkWeakForeignEnv# :: o -> b -> Addr# -> Addr# -> Int# -> Addr# -> State# (RealWorld) -> (# State# (RealWorld), Weak# b #)-deRefWeak# :: Weak# a -> State# (RealWorld) -> (# State# (RealWorld), Int#, a #)-finalizeWeak# :: Weak# a -> State# (RealWorld) -> (# State# (RealWorld), Int#, State# (RealWorld) -> (# State# (RealWorld), () #) #)-touch# :: o -> State# (RealWorld) -> State# (RealWorld)-data StablePtr# a-data StableName# a-makeStablePtr# :: a -> State# (RealWorld) -> (# State# (RealWorld), StablePtr# a #)-deRefStablePtr# :: StablePtr# a -> State# (RealWorld) -> (# State# (RealWorld), a #)-eqStablePtr# :: StablePtr# a -> StablePtr# a -> Int#-makeStableName# :: a -> State# (RealWorld) -> (# State# (RealWorld), StableName# a #)-eqStableName# :: StableName# a -> StableName# a -> Int#-stableNameToInt# :: StableName# a -> Int#-reallyUnsafePtrEquality# :: a -> a -> Int#-par# :: a -> Int#-getSpark# :: State# s -> (# State# s, Int#, a #)---- | Returns the number of sparks in the local spark pool.-numSparks# :: State# s -> (# State# s, Int# #)-parGlobal# :: a -> Int# -> Int# -> Int# -> Int# -> b -> Int#-parLocal# :: a -> Int# -> Int# -> Int# -> Int# -> b -> Int#-parAt# :: b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#-parAtAbs# :: a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#-parAtRel# :: a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#-parAtForNow# :: b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#-dataToTag# :: a -> Int#-tagToEnum# :: Int# -> a---- | Primitive bytecode type.-data BCO#---- | Convert an <tt>Addr#</tt> to a followable type.-addrToHValue# :: Addr# -> (# a #)-mkApUpd0# :: BCO# -> (# a #)-newBCO# :: ByteArray# -> ByteArray# -> Array# a -> Int# -> ByteArray# -> State# s -> (# State# s, BCO# #)-unpackClosure# :: a -> (# Addr#, Array# b, ByteArray# #)-getApStackVal# :: a -> Int# -> (# Int#, b #)-traceCcs# :: a -> b -> b---- | Evaluates its first argument to head normal form, and then returns its--- second argument as the result.-seq :: a -> b -> b---- | The call <tt>(inline f)</tt> arranges that f is inlined, regardless of--- its size. More precisely, the call <tt>(inline f)</tt> rewrites to the--- right-hand side of <tt>f</tt>'s definition. This allows the programmer--- to control inlining from a particular call site rather than the--- definition site of the function (c.f. <tt>INLINE</tt> pragmas in--- User's Guide, Section 7.10.3, "INLINE and NOINLINE pragmas").--- --- This inlining occurs regardless of the argument to the call or the--- size of <tt>f</tt>'s definition; it is unconditional. The main caveat--- is that <tt>f</tt>'s definition must be visible to the compiler. That--- is, <tt>f</tt> must be <tt>let</tt>-bound in the current scope. If no--- inlining takes place, the <tt>inline</tt> function expands to the--- identity function in Phase zero; so its use imposes no overhead.--- --- It is good practice to mark the function with an INLINABLE pragma at--- its definition, (a) so that GHC guarantees to expose its unfolding--- regardless of size, and (b) so that you have control over exactly what--- is inlined.-inline :: a -> a---- | The <tt>lazy</tt> function restrains strictness analysis a little. The--- call <tt>(lazy e)</tt> means the same as <tt>e</tt>, but <tt>lazy</tt>--- has a magical property so far as strictness analysis is concerned: it--- is lazy in its first argument, even though its semantics is strict.--- After strictness analysis has run, calls to <tt>lazy</tt> are inlined--- to be the identity function.--- --- This behaviour is occasionally useful when controlling evaluation--- order. Notably, <tt>lazy</tt> is used in the library definition of--- <tt>Control.Parallel.par</tt>:--- --- <pre>--- par :: a -> b -> b--- </pre>--- --- <pre>--- par x y = case (par# x) of _ -> lazy y--- </pre>--- --- If <tt>lazy</tt> were not lazy, <tt>par</tt> would look strict in--- <tt>y</tt> which would defeat the whole purpose of <tt>par</tt>.--- --- Like <tt>seq</tt>, the argument of <tt>lazy</tt> can have an unboxed--- type.-lazy :: a -> a---- | The type constructor <tt>Any</tt> is type to which you can unsafely--- coerce any lifted type, and back.--- --- <ul>--- <li>It is lifted, and hence represented by a pointer</li>--- <li>It does not claim to be a <i>data</i> type, and that's important--- for the code generator, because the code gen may <i>enter</i> a data--- value but never enters a function value.</li>--- </ul>--- --- It's also used to instantiate un-constrained type variables after type--- checking. For example--- --- <pre>--- length Any []--- </pre>--- --- Annoyingly, we sometimes need <tt>Any</tt>s of other kinds, such as--- <tt>(* -> *)</tt> etc. This is a bit like tuples. We define a--- couple of useful ones here, and make others up on the fly. If any of--- these others end up being exported into interface files, we'll get a--- crash; at least until we add interface-file syntax to support them.-data Any a---- | The function <tt>unsafeCoerce#</tt> allows you to side-step the--- typechecker entirely. That is, it allows you to coerce any type into--- any other type. If you use this function, you had better get it right,--- otherwise segmentation faults await. It is generally used when you--- want to write a program that you know is well-typed, but where--- Haskell's type system is not expressive enough to prove that it is--- well typed.--- --- The following uses of <tt>unsafeCoerce#</tt> are supposed to work--- (i.e. not lead to spurious compile-time or run-time crashes):--- --- <ul>--- <li>Casting any lifted type to <tt>Any</tt></li>--- <li>Casting <tt>Any</tt> back to the real type</li>--- <li>Casting an unboxed type to another unboxed type of the same size--- (but not coercions between floating-point and integral types)</li>--- <li>Casting between two types that have the same runtime--- representation. One case is when the two types differ only in--- "phantom" type parameters, for example <tt>Ptr Int</tt> to <tt>Ptr--- Float</tt>, or <tt>[Int]</tt> to <tt>[Float]</tt> when the list is--- known to be empty. Also, a <tt>newtype</tt> of a type <tt>T</tt> has--- the same representation at runtime as <tt>T</tt>.</li>--- </ul>--- --- Other uses of <tt>unsafeCoerce#</tt> are undefined. In particular, you--- should not use <tt>unsafeCoerce#</tt> to cast a T to an algebraic data--- type D, unless T is also an algebraic data type. For example, do not--- cast <tt>Int->Int</tt> to <tt>Bool</tt>, even if you later cast--- that <tt>Bool</tt> back to <tt>Int->Int</tt> before applying it.--- The reasons have to do with GHC's internal representation details (for--- the congnoscenti, data values can be entered but function closures--- cannot). If you want a safe type to cast things to, use <tt>Any</tt>,--- which is not an algebraic data type.-unsafeCoerce# :: a -> b---- | Emits an event via the RTS tracing framework. The contents of the--- event is the zero-terminated byte string passed as the first argument.--- The event will be emitted either to the .eventlog file, or to stderr,--- depending on the runtime RTS flags.-traceEvent# :: Addr# -> State# s -> State# s--module GHC.PrimopWrappers-gtChar# :: Char# -> Char# -> Bool-geChar# :: Char# -> Char# -> Bool-eqChar# :: Char# -> Char# -> Bool-neChar# :: Char# -> Char# -> Bool-ltChar# :: Char# -> Char# -> Bool-leChar# :: Char# -> Char# -> Bool-ord# :: Char# -> Int#-(+#) :: Int# -> Int# -> Int#-(-#) :: Int# -> Int# -> Int#-(*#) :: Int# -> Int# -> Int#-mulIntMayOflo# :: Int# -> Int# -> Int#-quotInt# :: Int# -> Int# -> Int#-remInt# :: Int# -> Int# -> Int#-negateInt# :: Int# -> Int#-addIntC# :: Int# -> Int# -> (# Int#, Int# #)-subIntC# :: Int# -> Int# -> (# Int#, Int# #)-(>#) :: Int# -> Int# -> Bool-(>=#) :: Int# -> Int# -> Bool-(==#) :: Int# -> Int# -> Bool-(/=#) :: Int# -> Int# -> Bool-(<#) :: Int# -> Int# -> Bool-(<=#) :: Int# -> Int# -> Bool-chr# :: Int# -> Char#-int2Word# :: Int# -> Word#-int2Float# :: Int# -> Float#-int2Double# :: Int# -> Double#-uncheckedIShiftL# :: Int# -> Int# -> Int#-uncheckedIShiftRA# :: Int# -> Int# -> Int#-uncheckedIShiftRL# :: Int# -> Int# -> Int#-plusWord# :: Word# -> Word# -> Word#-minusWord# :: Word# -> Word# -> Word#-timesWord# :: Word# -> Word# -> Word#-quotWord# :: Word# -> Word# -> Word#-remWord# :: Word# -> Word# -> Word#-and# :: Word# -> Word# -> Word#-or# :: Word# -> Word# -> Word#-xor# :: Word# -> Word# -> Word#-not# :: Word# -> Word#-uncheckedShiftL# :: Word# -> Int# -> Word#-uncheckedShiftRL# :: Word# -> Int# -> Word#-word2Int# :: Word# -> Int#-gtWord# :: Word# -> Word# -> Bool-geWord# :: Word# -> Word# -> Bool-eqWord# :: Word# -> Word# -> Bool-neWord# :: Word# -> Word# -> Bool-ltWord# :: Word# -> Word# -> Bool-leWord# :: Word# -> Word# -> Bool-narrow8Int# :: Int# -> Int#-narrow16Int# :: Int# -> Int#-narrow32Int# :: Int# -> Int#-narrow8Word# :: Word# -> Word#-narrow16Word# :: Word# -> Word#-narrow32Word# :: Word# -> Word#-(>##) :: Double# -> Double# -> Bool-(>=##) :: Double# -> Double# -> Bool-(==##) :: Double# -> Double# -> Bool-(/=##) :: Double# -> Double# -> Bool-(<##) :: Double# -> Double# -> Bool-(<=##) :: Double# -> Double# -> Bool-(+##) :: Double# -> Double# -> Double#-(-##) :: Double# -> Double# -> Double#-(*##) :: Double# -> Double# -> Double#-(/##) :: Double# -> Double# -> Double#-negateDouble# :: Double# -> Double#-double2Int# :: Double# -> Int#-double2Float# :: Double# -> Float#-expDouble# :: Double# -> Double#-logDouble# :: Double# -> Double#-sqrtDouble# :: Double# -> Double#-sinDouble# :: Double# -> Double#-cosDouble# :: Double# -> Double#-tanDouble# :: Double# -> Double#-asinDouble# :: Double# -> Double#-acosDouble# :: Double# -> Double#-atanDouble# :: Double# -> Double#-sinhDouble# :: Double# -> Double#-coshDouble# :: Double# -> Double#-tanhDouble# :: Double# -> Double#-(**##) :: Double# -> Double# -> Double#-decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #)-gtFloat# :: Float# -> Float# -> Bool-geFloat# :: Float# -> Float# -> Bool-eqFloat# :: Float# -> Float# -> Bool-neFloat# :: Float# -> Float# -> Bool-ltFloat# :: Float# -> Float# -> Bool-leFloat# :: Float# -> Float# -> Bool-plusFloat# :: Float# -> Float# -> Float#-minusFloat# :: Float# -> Float# -> Float#-timesFloat# :: Float# -> Float# -> Float#-divideFloat# :: Float# -> Float# -> Float#-negateFloat# :: Float# -> Float#-float2Int# :: Float# -> Int#-expFloat# :: Float# -> Float#-logFloat# :: Float# -> Float#-sqrtFloat# :: Float# -> Float#-sinFloat# :: Float# -> Float#-cosFloat# :: Float# -> Float#-tanFloat# :: Float# -> Float#-asinFloat# :: Float# -> Float#-acosFloat# :: Float# -> Float#-atanFloat# :: Float# -> Float#-sinhFloat# :: Float# -> Float#-coshFloat# :: Float# -> Float#-tanhFloat# :: Float# -> Float#-powerFloat# :: Float# -> Float# -> Float#-float2Double# :: Float# -> Double#-decodeFloat_Int# :: Float# -> (# Int#, Int# #)-newArray# :: Int# -> a -> State# s -> (# State# s, MutableArray# s a #)-sameMutableArray# :: MutableArray# s a -> MutableArray# s a -> Bool-readArray# :: MutableArray# s a -> Int# -> State# s -> (# State# s, a #)-writeArray# :: MutableArray# s a -> Int# -> a -> State# s -> State# s-indexArray# :: Array# a -> Int# -> (# a #)-unsafeFreezeArray# :: MutableArray# s a -> State# s -> (# State# s, Array# a #)-unsafeThawArray# :: Array# a -> State# s -> (# State# s, MutableArray# s a #)-newByteArray# :: Int# -> State# s -> (# State# s, MutableByteArray# s #)-newPinnedByteArray# :: Int# -> State# s -> (# State# s, MutableByteArray# s #)-newAlignedPinnedByteArray# :: Int# -> Int# -> State# s -> (# State# s, MutableByteArray# s #)-byteArrayContents# :: ByteArray# -> Addr#-sameMutableByteArray# :: MutableByteArray# s -> MutableByteArray# s -> Bool-unsafeFreezeByteArray# :: MutableByteArray# s -> State# s -> (# State# s, ByteArray# #)-sizeofByteArray# :: ByteArray# -> Int#-sizeofMutableByteArray# :: MutableByteArray# s -> Int#-indexCharArray# :: ByteArray# -> Int# -> Char#-indexWideCharArray# :: ByteArray# -> Int# -> Char#-indexIntArray# :: ByteArray# -> Int# -> Int#-indexWordArray# :: ByteArray# -> Int# -> Word#-indexAddrArray# :: ByteArray# -> Int# -> Addr#-indexFloatArray# :: ByteArray# -> Int# -> Float#-indexDoubleArray# :: ByteArray# -> Int# -> Double#-indexStablePtrArray# :: ByteArray# -> Int# -> StablePtr# a-indexInt8Array# :: ByteArray# -> Int# -> Int#-indexInt16Array# :: ByteArray# -> Int# -> Int#-indexInt32Array# :: ByteArray# -> Int# -> Int#-indexInt64Array# :: ByteArray# -> Int# -> Int#-indexWord8Array# :: ByteArray# -> Int# -> Word#-indexWord16Array# :: ByteArray# -> Int# -> Word#-indexWord32Array# :: ByteArray# -> Int# -> Word#-indexWord64Array# :: ByteArray# -> Int# -> Word#-readCharArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Char# #)-readWideCharArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Char# #)-readIntArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)-readWordArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)-readAddrArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Addr# #)-readFloatArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Float# #)-readDoubleArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Double# #)-readStablePtrArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, StablePtr# a #)-readInt8Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)-readInt16Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)-readInt32Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)-readInt64Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)-readWord8Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)-readWord16Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)-readWord32Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)-readWord64Array# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)-writeCharArray# :: MutableByteArray# s -> Int# -> Char# -> State# s -> State# s-writeWideCharArray# :: MutableByteArray# s -> Int# -> Char# -> State# s -> State# s-writeIntArray# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s-writeWordArray# :: MutableByteArray# s -> Int# -> Word# -> State# s -> State# s-writeAddrArray# :: MutableByteArray# s -> Int# -> Addr# -> State# s -> State# s-writeFloatArray# :: MutableByteArray# s -> Int# -> Float# -> State# s -> State# s-writeDoubleArray# :: MutableByteArray# s -> Int# -> Double# -> State# s -> State# s-writeStablePtrArray# :: MutableByteArray# s -> Int# -> StablePtr# a -> State# s -> State# s-writeInt8Array# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s-writeInt16Array# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s-writeInt32Array# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s-writeInt64Array# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s-writeWord8Array# :: MutableByteArray# s -> Int# -> Word# -> State# s -> State# s-writeWord16Array# :: MutableByteArray# s -> Int# -> Word# -> State# s -> State# s-writeWord32Array# :: MutableByteArray# s -> Int# -> Word# -> State# s -> State# s-writeWord64Array# :: MutableByteArray# s -> Int# -> Word# -> State# s -> State# s-plusAddr# :: Addr# -> Int# -> Addr#-minusAddr# :: Addr# -> Addr# -> Int#-remAddr# :: Addr# -> Int# -> Int#-addr2Int# :: Addr# -> Int#-int2Addr# :: Int# -> Addr#-gtAddr# :: Addr# -> Addr# -> Bool-geAddr# :: Addr# -> Addr# -> Bool-eqAddr# :: Addr# -> Addr# -> Bool-neAddr# :: Addr# -> Addr# -> Bool-ltAddr# :: Addr# -> Addr# -> Bool-leAddr# :: Addr# -> Addr# -> Bool-indexCharOffAddr# :: Addr# -> Int# -> Char#-indexWideCharOffAddr# :: Addr# -> Int# -> Char#-indexIntOffAddr# :: Addr# -> Int# -> Int#-indexWordOffAddr# :: Addr# -> Int# -> Word#-indexAddrOffAddr# :: Addr# -> Int# -> Addr#-indexFloatOffAddr# :: Addr# -> Int# -> Float#-indexDoubleOffAddr# :: Addr# -> Int# -> Double#-indexStablePtrOffAddr# :: Addr# -> Int# -> StablePtr# a-indexInt8OffAddr# :: Addr# -> Int# -> Int#-indexInt16OffAddr# :: Addr# -> Int# -> Int#-indexInt32OffAddr# :: Addr# -> Int# -> Int#-indexInt64OffAddr# :: Addr# -> Int# -> Int#-indexWord8OffAddr# :: Addr# -> Int# -> Word#-indexWord16OffAddr# :: Addr# -> Int# -> Word#-indexWord32OffAddr# :: Addr# -> Int# -> Word#-indexWord64OffAddr# :: Addr# -> Int# -> Word#-readCharOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Char# #)-readWideCharOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Char# #)-readIntOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)-readWordOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word# #)-readAddrOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Addr# #)-readFloatOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Float# #)-readDoubleOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Double# #)-readStablePtrOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, StablePtr# a #)-readInt8OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)-readInt16OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)-readInt32OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)-readInt64OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)-readWord8OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word# #)-readWord16OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word# #)-readWord32OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word# #)-readWord64OffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word# #)-writeCharOffAddr# :: Addr# -> Int# -> Char# -> State# s -> State# s-writeWideCharOffAddr# :: Addr# -> Int# -> Char# -> State# s -> State# s-writeIntOffAddr# :: Addr# -> Int# -> Int# -> State# s -> State# s-writeWordOffAddr# :: Addr# -> Int# -> Word# -> State# s -> State# s-writeAddrOffAddr# :: Addr# -> Int# -> Addr# -> State# s -> State# s-writeFloatOffAddr# :: Addr# -> Int# -> Float# -> State# s -> State# s-writeDoubleOffAddr# :: Addr# -> Int# -> Double# -> State# s -> State# s-writeStablePtrOffAddr# :: Addr# -> Int# -> StablePtr# a -> State# s -> State# s-writeInt8OffAddr# :: Addr# -> Int# -> Int# -> State# s -> State# s-writeInt16OffAddr# :: Addr# -> Int# -> Int# -> State# s -> State# s-writeInt32OffAddr# :: Addr# -> Int# -> Int# -> State# s -> State# s-writeInt64OffAddr# :: Addr# -> Int# -> Int# -> State# s -> State# s-writeWord8OffAddr# :: Addr# -> Int# -> Word# -> State# s -> State# s-writeWord16OffAddr# :: Addr# -> Int# -> Word# -> State# s -> State# s-writeWord32OffAddr# :: Addr# -> Int# -> Word# -> State# s -> State# s-writeWord64OffAddr# :: Addr# -> Int# -> Word# -> State# s -> State# s-newMutVar# :: a -> State# s -> (# State# s, MutVar# s a #)-readMutVar# :: MutVar# s a -> State# s -> (# State# s, a #)-writeMutVar# :: MutVar# s a -> a -> State# s -> State# s-sameMutVar# :: MutVar# s a -> MutVar# s a -> Bool-atomicModifyMutVar# :: MutVar# s a -> (a -> b) -> State# s -> (# State# s, c #)-catch# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> (b -> State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-raise# :: a -> b-raiseIO# :: a -> State# (RealWorld) -> (# State# (RealWorld), b #)-maskAsyncExceptions# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-maskUninterruptible# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-unmaskAsyncExceptions# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-getMaskingState# :: State# (RealWorld) -> (# State# (RealWorld), Int# #)-atomically# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-retry# :: State# (RealWorld) -> (# State# (RealWorld), a #)-catchRetry# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-catchSTM# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> (b -> State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), a #)-check# :: (State# (RealWorld) -> (# State# (RealWorld), a #)) -> State# (RealWorld) -> (# State# (RealWorld), () #)-newTVar# :: a -> State# s -> (# State# s, TVar# s a #)-readTVar# :: TVar# s a -> State# s -> (# State# s, a #)-readTVarIO# :: TVar# s a -> State# s -> (# State# s, a #)-writeTVar# :: TVar# s a -> a -> State# s -> State# s-sameTVar# :: TVar# s a -> TVar# s a -> Bool-newMVar# :: State# s -> (# State# s, MVar# s a #)-takeMVar# :: MVar# s a -> State# s -> (# State# s, a #)-tryTakeMVar# :: MVar# s a -> State# s -> (# State# s, Int#, a #)-putMVar# :: MVar# s a -> a -> State# s -> State# s-tryPutMVar# :: MVar# s a -> a -> State# s -> (# State# s, Int# #)-sameMVar# :: MVar# s a -> MVar# s a -> Bool-isEmptyMVar# :: MVar# s a -> State# s -> (# State# s, Int# #)-delay# :: Int# -> State# s -> State# s-waitRead# :: Int# -> State# s -> State# s-waitWrite# :: Int# -> State# s -> State# s-fork# :: a -> State# (RealWorld) -> (# State# (RealWorld), ThreadId# #)-forkOn# :: Int# -> a -> State# (RealWorld) -> (# State# (RealWorld), ThreadId# #)-killThread# :: ThreadId# -> a -> State# (RealWorld) -> State# (RealWorld)-yield# :: State# (RealWorld) -> State# (RealWorld)-myThreadId# :: State# (RealWorld) -> (# State# (RealWorld), ThreadId# #)-labelThread# :: ThreadId# -> Addr# -> State# (RealWorld) -> State# (RealWorld)-isCurrentThreadBound# :: State# (RealWorld) -> (# State# (RealWorld), Int# #)-noDuplicate# :: State# (RealWorld) -> State# (RealWorld)-threadStatus# :: ThreadId# -> State# (RealWorld) -> (# State# (RealWorld), Int# #)-mkWeak# :: o -> b -> c -> State# (RealWorld) -> (# State# (RealWorld), Weak# b #)-mkWeakForeignEnv# :: o -> b -> Addr# -> Addr# -> Int# -> Addr# -> State# (RealWorld) -> (# State# (RealWorld), Weak# b #)-deRefWeak# :: Weak# a -> State# (RealWorld) -> (# State# (RealWorld), Int#, a #)-finalizeWeak# :: Weak# a -> State# (RealWorld) -> (# State# (RealWorld), Int#, State# (RealWorld) -> (# State# (RealWorld), () #) #)-touch# :: o -> State# (RealWorld) -> State# (RealWorld)-makeStablePtr# :: a -> State# (RealWorld) -> (# State# (RealWorld), StablePtr# a #)-deRefStablePtr# :: StablePtr# a -> State# (RealWorld) -> (# State# (RealWorld), a #)-eqStablePtr# :: StablePtr# a -> StablePtr# a -> Int#-makeStableName# :: a -> State# (RealWorld) -> (# State# (RealWorld), StableName# a #)-eqStableName# :: StableName# a -> StableName# a -> Int#-stableNameToInt# :: StableName# a -> Int#-reallyUnsafePtrEquality# :: a -> a -> Int#-getSpark# :: State# s -> (# State# s, Int#, a #)-numSparks# :: State# s -> (# State# s, Int# #)-dataToTag# :: a -> Int#-addrToHValue# :: Addr# -> (# a #)-mkApUpd0# :: BCO# -> (# a #)-newBCO# :: ByteArray# -> ByteArray# -> Array# a -> Int# -> ByteArray# -> State# s -> (# State# s, BCO# #)-unpackClosure# :: a -> (# Addr#, Array# b, ByteArray# #)-getApStackVal# :: a -> Int# -> (# Int#, b #)-traceCcs# :: a -> b -> b-traceEvent# :: Addr# -> State# s -> State# s
− data/haskell2010.txt
@@ -1,4715 +0,0 @@--- Hoogle documentation, generated by Haddock--- See Hoogle, http://www.haskell.org/hoogle/----- | Compatibility with Haskell 2010--- --- This package provides exactly the library modules defined by the--- Haskell 2010 standard.-@package haskell2010-@version 1.0.0.0----- | The Haskell 2010 Prelude: a standard module imported by default into--- all Haskell modules. For more documentation, see the Haskell 2010--- Report <a>http://www.haskell.org/onlinereport/</a>.-module Prelude-data Bool :: *-False :: Bool-True :: Bool---- | Boolean "and"-(&&) :: Bool -> Bool -> Bool---- | Boolean "or"-(||) :: Bool -> Bool -> Bool---- | Boolean "not"-not :: Bool -> Bool---- | <a>otherwise</a> is defined as the value <a>True</a>. It helps to make--- guards more readable. eg.--- --- <pre>--- f x | x < 0 = ...--- | otherwise = ...--- </pre>-otherwise :: Bool---- | The <a>Maybe</a> type encapsulates an optional value. A value of type--- <tt><a>Maybe</a> a</tt> either contains a value of type <tt>a</tt>--- (represented as <tt><a>Just</a> a</tt>), or it is empty (represented--- as <a>Nothing</a>). Using <a>Maybe</a> is a good way to deal with--- errors or exceptional cases without resorting to drastic measures such--- as <a>error</a>.--- --- The <a>Maybe</a> type is also a monad. It is a simple kind of error--- monad, where all errors are represented by <a>Nothing</a>. A richer--- error monad can be built using the <tt>Data.Either.Either</tt> type.-data Maybe a :: * -> *-Nothing :: Maybe a-Just :: a -> Maybe a---- | The <a>maybe</a> function takes a default value, a function, and a--- <a>Maybe</a> value. If the <a>Maybe</a> value is <a>Nothing</a>, the--- function returns the default value. Otherwise, it applies the function--- to the value inside the <a>Just</a> and returns the result.-maybe :: b -> (a -> b) -> Maybe a -> b---- | The <a>Either</a> type represents values with two possibilities: a--- value of type <tt><a>Either</a> a b</tt> is either <tt><a>Left</a>--- a</tt> or <tt><a>Right</a> b</tt>.--- --- The <a>Either</a> type is sometimes used to represent a value which is--- either correct or an error; by convention, the <a>Left</a> constructor--- is used to hold an error value and the <a>Right</a> constructor is--- used to hold a correct value (mnemonic: "right" also means "correct").-data Either a b :: * -> * -> *-Left :: a -> Either a b-Right :: b -> Either a b---- | Case analysis for the <a>Either</a> type. If the value is--- <tt><a>Left</a> a</tt>, apply the first function to <tt>a</tt>; if it--- is <tt><a>Right</a> b</tt>, apply the second function to <tt>b</tt>.-either :: (a -> c) -> (b -> c) -> Either a b -> c-data Ordering :: *-LT :: Ordering-EQ :: Ordering-GT :: Ordering---- | The character type <a>Char</a> is an enumeration whose values--- represent Unicode (or equivalently ISO/IEC 10646) characters (see--- <a>http://www.unicode.org/</a> for details). This set extends the ISO--- 8859-1 (Latin-1) character set (the first 256 charachers), which is--- itself an extension of the ASCII character set (the first 128--- characters). A character literal in Haskell has type <a>Char</a>.--- --- To convert a <a>Char</a> to or from the corresponding <a>Int</a> value--- defined by Unicode, use <tt>Prelude.toEnum</tt> and--- <tt>Prelude.fromEnum</tt> from the <tt>Prelude.Enum</tt> class--- respectively (or equivalently <tt>ord</tt> and <tt>chr</tt>).-data Char :: *---- | A <a>String</a> is a list of characters. String constants in Haskell--- are values of type <a>String</a>.-type String = [Char]---- | Extract the first component of a pair.-fst :: (a, b) -> a---- | Extract the second component of a pair.-snd :: (a, b) -> b---- | <a>curry</a> converts an uncurried function to a curried function.-curry :: ((a, b) -> c) -> a -> b -> c---- | <a>uncurry</a> converts a curried function to a function on pairs.-uncurry :: (a -> b -> c) -> (a, b) -> c---- | The <a>Eq</a> class defines equality (<a>==</a>) and inequality--- (<a>/=</a>). All the basic datatypes exported by the <a>Prelude</a>--- are instances of <a>Eq</a>, and <a>Eq</a> may be derived for any--- datatype whose constituents are also instances of <a>Eq</a>.--- --- Minimal complete definition: either <a>==</a> or <a>/=</a>.-class Eq a-(==) :: Eq a => a -> a -> Bool-(/=) :: Eq a => a -> a -> Bool---- | The <a>Ord</a> class is used for totally ordered datatypes.--- --- Instances of <a>Ord</a> can be derived for any user-defined datatype--- whose constituent types are in <a>Ord</a>. The declared order of the--- constructors in the data declaration determines the ordering in--- derived <a>Ord</a> instances. The <a>Ordering</a> datatype allows a--- single comparison to determine the precise ordering of two objects.--- --- Minimal complete definition: either <a>compare</a> or <a><=</a>.--- Using <a>compare</a> can be more efficient for complex types.-class Eq a => Ord a-compare :: Ord a => a -> a -> Ordering-(<) :: Ord a => a -> a -> Bool-(>=) :: Ord a => a -> a -> Bool-(>) :: Ord a => a -> a -> Bool-(<=) :: Ord a => a -> a -> Bool-max :: Ord a => a -> a -> a-min :: Ord a => a -> a -> a---- | Class <a>Enum</a> defines operations on sequentially ordered types.--- --- The <tt>enumFrom</tt>... methods are used in Haskell's translation of--- arithmetic sequences.--- --- Instances of <a>Enum</a> may be derived for any enumeration type--- (types whose constructors have no fields). The nullary constructors--- are assumed to be numbered left-to-right by <a>fromEnum</a> from--- <tt>0</tt> through <tt>n-1</tt>. See Chapter 10 of the <i>Haskell--- Report</i> for more details.--- --- For any type that is an instance of class <a>Bounded</a> as well as--- <a>Enum</a>, the following should hold:--- --- <ul>--- <li>The calls <tt><a>succ</a> <a>maxBound</a></tt> and <tt><a>pred</a>--- <a>minBound</a></tt> should result in a runtime error.</li>--- <li><a>fromEnum</a> and <a>toEnum</a> should give a runtime error if--- the result value is not representable in the result type. For example,--- <tt><a>toEnum</a> 7 :: <a>Bool</a></tt> is an error.</li>--- <li><a>enumFrom</a> and <a>enumFromThen</a> should be defined with an--- implicit bound, thus:</li>--- </ul>--- --- <pre>--- enumFrom x = enumFromTo x maxBound--- enumFromThen x y = enumFromThenTo x y bound--- where--- bound | fromEnum y >= fromEnum x = maxBound--- | otherwise = minBound--- </pre>-class Enum a-succ :: Enum a => a -> a-pred :: Enum a => a -> a-toEnum :: Enum a => Int -> a-fromEnum :: Enum a => a -> Int-enumFrom :: Enum a => a -> [a]-enumFromThen :: Enum a => a -> a -> [a]-enumFromTo :: Enum a => a -> a -> [a]-enumFromThenTo :: Enum a => a -> a -> a -> [a]---- | The <a>Bounded</a> class is used to name the upper and lower limits of--- a type. <a>Ord</a> is not a superclass of <a>Bounded</a> since types--- that are not totally ordered may also have upper and lower bounds.--- --- The <a>Bounded</a> class may be derived for any enumeration type;--- <a>minBound</a> is the first constructor listed in the <tt>data</tt>--- declaration and <a>maxBound</a> is the last. <a>Bounded</a> may also--- be derived for single-constructor datatypes whose constituent types--- are in <a>Bounded</a>.-class Bounded a-minBound :: Bounded a => a-maxBound :: Bounded a => a---- | A fixed-precision integer type with at least the range <tt>[-2^29 ..--- 2^29-1]</tt>. The exact range for a given implementation can be--- determined by using <tt>Prelude.minBound</tt> and--- <tt>Prelude.maxBound</tt> from the <tt>Prelude.Bounded</tt> class.-data Int :: *---- | Arbitrary-precision integers.-data Integer :: *---- | Single-precision floating point numbers. It is desirable that this--- type be at least equal in range and precision to the IEEE--- single-precision type.-data Float :: *---- | Double-precision floating point numbers. It is desirable that this--- type be at least equal in range and precision to the IEEE--- double-precision type.-data Double :: *---- | Arbitrary-precision rational numbers, represented as a ratio of two--- <a>Integer</a> values. A rational number may be constructed using the--- <a>%</a> operator.-type Rational = Ratio Integer---- | Basic numeric class.--- --- Minimal complete definition: all except <a>negate</a> or <tt>(-)</tt>-class (Eq a, Show a) => Num a-(+) :: Num a => a -> a -> a-(*) :: Num a => a -> a -> a-(-) :: Num a => a -> a -> a-negate :: Num a => a -> a-abs :: Num a => a -> a-signum :: Num a => a -> a-fromInteger :: Num a => Integer -> a-class (Num a, Ord a) => Real a-toRational :: Real a => a -> Rational---- | Integral numbers, supporting integer division.--- --- Minimal complete definition: <a>quotRem</a> and <a>toInteger</a>-class (Real a, Enum a) => Integral a-quot :: Integral a => a -> a -> a-rem :: Integral a => a -> a -> a-div :: Integral a => a -> a -> a-mod :: Integral a => a -> a -> a-quotRem :: Integral a => a -> a -> (a, a)-divMod :: Integral a => a -> a -> (a, a)-toInteger :: Integral a => a -> Integer---- | Fractional numbers, supporting real division.--- --- Minimal complete definition: <a>fromRational</a> and (<a>recip</a> or--- <tt>(<a>/</a>)</tt>)-class Num a => Fractional a-(/) :: Fractional a => a -> a -> a-recip :: Fractional a => a -> a-fromRational :: Fractional a => Rational -> a---- | Trigonometric and hyperbolic functions and related functions.--- --- Minimal complete definition: <a>pi</a>, <a>exp</a>, <a>log</a>,--- <a>sin</a>, <a>cos</a>, <a>sinh</a>, <a>cosh</a>, <a>asin</a>,--- <a>acos</a>, <a>atan</a>, <a>asinh</a>, <a>acosh</a> and <a>atanh</a>-class Fractional a => Floating a-pi :: Floating a => a-exp :: Floating a => a -> a-sqrt :: Floating a => a -> a-log :: Floating a => a -> a-(**) :: Floating a => a -> a -> a-logBase :: Floating a => a -> a -> a-sin :: Floating a => a -> a-tan :: Floating a => a -> a-cos :: Floating a => a -> a-asin :: Floating a => a -> a-atan :: Floating a => a -> a-acos :: Floating a => a -> a-sinh :: Floating a => a -> a-tanh :: Floating a => a -> a-cosh :: Floating a => a -> a-asinh :: Floating a => a -> a-atanh :: Floating a => a -> a-acosh :: Floating a => a -> a---- | Extracting components of fractions.--- --- Minimal complete definition: <a>properFraction</a>-class (Real a, Fractional a) => RealFrac a-properFraction :: (RealFrac a, Integral b) => a -> (b, a)-truncate :: (RealFrac a, Integral b) => a -> b-round :: (RealFrac a, Integral b) => a -> b-ceiling :: (RealFrac a, Integral b) => a -> b-floor :: (RealFrac a, Integral b) => a -> b---- | Efficient, machine-independent access to the components of a--- floating-point number.--- --- Minimal complete definition: all except <a>exponent</a>,--- <a>significand</a>, <a>scaleFloat</a> and <a>atan2</a>-class (RealFrac a, Floating a) => RealFloat a-floatRadix :: RealFloat a => a -> Integer-floatDigits :: RealFloat a => a -> Int-floatRange :: RealFloat a => a -> (Int, Int)-decodeFloat :: RealFloat a => a -> (Integer, Int)-encodeFloat :: RealFloat a => Integer -> Int -> a-exponent :: RealFloat a => a -> Int-significand :: RealFloat a => a -> a-scaleFloat :: RealFloat a => Int -> a -> a-isNaN :: RealFloat a => a -> Bool-isInfinite :: RealFloat a => a -> Bool-isDenormalized :: RealFloat a => a -> Bool-isNegativeZero :: RealFloat a => a -> Bool-isIEEE :: RealFloat a => a -> Bool-atan2 :: RealFloat a => a -> a -> a---- | the same as <tt><a>flip</a> (<a>-</a>)</tt>.--- --- Because <tt>-</tt> is treated specially in the Haskell grammar,--- <tt>(-</tt> <i>e</i><tt>)</tt> is not a section, but an application of--- prefix negation. However, <tt>(<a>subtract</a></tt>--- <i>exp</i><tt>)</tt> is equivalent to the disallowed section.-subtract :: Num a => a -> a -> a-even :: Integral a => a -> Bool-odd :: Integral a => a -> Bool---- | <tt><a>gcd</a> x y</tt> is the greatest (positive) integer that--- divides both <tt>x</tt> and <tt>y</tt>; for example <tt><a>gcd</a>--- (-3) 6</tt> = <tt>3</tt>, <tt><a>gcd</a> (-3) (-6)</tt> = <tt>3</tt>,--- <tt><a>gcd</a> 0 4</tt> = <tt>4</tt>. <tt><a>gcd</a> 0 0</tt> raises a--- runtime error.-gcd :: Integral a => a -> a -> a---- | <tt><a>lcm</a> x y</tt> is the smallest positive integer that both--- <tt>x</tt> and <tt>y</tt> divide.-lcm :: Integral a => a -> a -> a---- | raise a number to a non-negative integral power-(^) :: (Num a, Integral b) => a -> b -> a---- | raise a number to an integral power-(^^) :: (Fractional a, Integral b) => a -> b -> a---- | general coercion from integral types-fromIntegral :: (Integral a, Num b) => a -> b---- | general coercion to fractional types-realToFrac :: (Real a, Fractional b) => a -> b---- | The <a>Monad</a> class defines the basic operations over a--- <i>monad</i>, a concept from a branch of mathematics known as--- <i>category theory</i>. From the perspective of a Haskell programmer,--- however, it is best to think of a monad as an <i>abstract datatype</i>--- of actions. Haskell's <tt>do</tt> expressions provide a convenient--- syntax for writing monadic expressions.--- --- Minimal complete definition: <a>>>=</a> and <a>return</a>.--- --- Instances of <a>Monad</a> should satisfy the following laws:--- --- <pre>--- return a >>= k == k a--- m >>= return == m--- m >>= (\x -> k x >>= h) == (m >>= k) >>= h--- </pre>--- --- Instances of both <a>Monad</a> and <a>Functor</a> should additionally--- satisfy the law:--- --- <pre>--- fmap f xs == xs >>= return . f--- </pre>--- --- The instances of <a>Monad</a> for lists, <tt>Data.Maybe.Maybe</tt> and--- <tt>System.IO.IO</tt> defined in the <a>Prelude</a> satisfy these--- laws.-class Monad m :: (* -> *)-(>>=) :: Monad m => m a -> (a -> m b) -> m b-(>>) :: Monad m => m a -> m b -> m b-return :: Monad m => a -> m a-fail :: Monad m => String -> m a---- | The <a>Functor</a> class is used for types that can be mapped over.--- Instances of <a>Functor</a> should satisfy the following laws:--- --- <pre>--- fmap id == id--- fmap (f . g) == fmap f . fmap g--- </pre>--- --- The instances of <a>Functor</a> for lists, <tt>Data.Maybe.Maybe</tt>--- and <tt>System.IO.IO</tt> satisfy these laws.-class Functor f :: (* -> *)-fmap :: Functor f => (a -> b) -> f a -> f b---- | <tt><a>mapM</a> f</tt> is equivalent to <tt><a>sequence</a> .--- <a>map</a> f</tt>.-mapM :: Monad m => (a -> m b) -> [a] -> m [b]---- | <tt><a>mapM_</a> f</tt> is equivalent to <tt><a>sequence_</a> .--- <a>map</a> f</tt>.-mapM_ :: Monad m => (a -> m b) -> [a] -> m ()---- | Evaluate each action in the sequence from left to right, and collect--- the results.-sequence :: Monad m => [m a] -> m [a]---- | Evaluate each action in the sequence from left to right, and ignore--- the results.-sequence_ :: Monad m => [m a] -> m ()---- | Same as <a>>>=</a>, but with the arguments interchanged.-(=<<) :: Monad m => (a -> m b) -> m a -> m b---- | Identity function.-id :: a -> a---- | Constant function.-const :: a -> b -> a---- | Function composition.-(.) :: (b -> c) -> (a -> b) -> a -> c---- | <tt><a>flip</a> f</tt> takes its (first) two arguments in the reverse--- order of <tt>f</tt>.-flip :: (a -> b -> c) -> b -> a -> c---- | Application operator. This operator is redundant, since ordinary--- application <tt>(f x)</tt> means the same as <tt>(f <a>$</a> x)</tt>.--- However, <a>$</a> has low, right-associative binding precedence, so it--- sometimes allows parentheses to be omitted; for example:--- --- <pre>--- f $ g $ h x = f (g (h x))--- </pre>--- --- It is also useful in higher-order situations, such as <tt><a>map</a>--- (<a>$</a> 0) xs</tt>, or <tt><tt>Data.List.zipWith</tt> (<a>$</a>) fs--- xs</tt>.-($) :: (a -> b) -> a -> b---- | <tt><a>until</a> p f</tt> yields the result of applying <tt>f</tt>--- until <tt>p</tt> holds.-until :: (a -> Bool) -> (a -> a) -> a -> a---- | <a>asTypeOf</a> is a type-restricted version of <a>const</a>. It is--- usually used as an infix operator, and its typing forces its first--- argument (which is usually overloaded) to have the same type as the--- second.-asTypeOf :: a -> a -> a---- | <a>error</a> stops execution and displays an error message.-error :: [Char] -> a---- | A special case of <a>error</a>. It is expected that compilers will--- recognize this and insert error messages which are more appropriate to--- the context in which <a>undefined</a> appears.-undefined :: a---- | Evaluates its first argument to head normal form, and then returns its--- second argument as the result.-seq :: a -> b -> b---- | Strict (call-by-value) application, defined in terms of <a>seq</a>.-($!) :: (a -> b) -> a -> b---- | <a>map</a> <tt>f xs</tt> is the list obtained by applying <tt>f</tt>--- to each element of <tt>xs</tt>, i.e.,--- --- <pre>--- map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]--- map f [x1, x2, ...] == [f x1, f x2, ...]--- </pre>-map :: (a -> b) -> [a] -> [b]---- | Append two lists, i.e.,--- --- <pre>--- [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]--- [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]--- </pre>--- --- If the first list is not finite, the result is the first list.-(++) :: [a] -> [a] -> [a]---- | <a>filter</a>, applied to a predicate and a list, returns the list of--- those elements that satisfy the predicate; i.e.,--- --- <pre>--- filter p xs = [ x | x <- xs, p x]--- </pre>-filter :: (a -> Bool) -> [a] -> [a]---- | Extract the first element of a list, which must be non-empty.-head :: [a] -> a---- | Extract the last element of a list, which must be finite and--- non-empty.-last :: [a] -> a---- | Extract the elements after the head of a list, which must be--- non-empty.-tail :: [a] -> [a]---- | Return all the elements of a list except the last one. The list must--- be non-empty.-init :: [a] -> [a]---- | Test whether a list is empty.-null :: [a] -> Bool---- | <i>O(n)</i>. <a>length</a> returns the length of a finite list as an--- <a>Int</a>. It is an instance of the more general--- <tt>Data.List.genericLength</tt>, the result type of which may be any--- kind of number.-length :: [a] -> Int---- | List index (subscript) operator, starting from 0. It is an instance of--- the more general <tt>Data.List.genericIndex</tt>, which takes an index--- of any integral type.-(!!) :: [a] -> Int -> a---- | <a>reverse</a> <tt>xs</tt> returns the elements of <tt>xs</tt> in--- reverse order. <tt>xs</tt> must be finite.-reverse :: [a] -> [a]---- | <a>foldl</a>, applied to a binary operator, a starting value--- (typically the left-identity of the operator), and a list, reduces the--- list using the binary operator, from left to right:--- --- <pre>--- foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn--- </pre>--- --- The list must be finite.-foldl :: (a -> b -> a) -> a -> [b] -> a---- | <a>foldl1</a> is a variant of <a>foldl</a> that has no starting value--- argument, and thus must be applied to non-empty lists.-foldl1 :: (a -> a -> a) -> [a] -> a---- | <a>foldr</a>, applied to a binary operator, a starting value--- (typically the right-identity of the operator), and a list, reduces--- the list using the binary operator, from right to left:--- --- <pre>--- foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)--- </pre>-foldr :: (a -> b -> b) -> b -> [a] -> b---- | <a>foldr1</a> is a variant of <a>foldr</a> that has no starting value--- argument, and thus must be applied to non-empty lists.-foldr1 :: (a -> a -> a) -> [a] -> a---- | <a>and</a> returns the conjunction of a Boolean list. For the result--- to be <a>True</a>, the list must be finite; <a>False</a>, however,--- results from a <a>False</a> value at a finite index of a finite or--- infinite list.-and :: [Bool] -> Bool---- | <a>or</a> returns the disjunction of a Boolean list. For the result to--- be <a>False</a>, the list must be finite; <a>True</a>, however,--- results from a <a>True</a> value at a finite index of a finite or--- infinite list.-or :: [Bool] -> Bool---- | Applied to a predicate and a list, <a>any</a> determines if any--- element of the list satisfies the predicate. For the result to be--- <a>False</a>, the list must be finite; <a>True</a>, however, results--- from a <a>True</a> value for the predicate applied to an element at a--- finite index of a finite or infinite list.-any :: (a -> Bool) -> [a] -> Bool---- | Applied to a predicate and a list, <a>all</a> determines if all--- elements of the list satisfy the predicate. For the result to be--- <a>True</a>, the list must be finite; <a>False</a>, however, results--- from a <a>False</a> value for the predicate applied to an element at a--- finite index of a finite or infinite list.-all :: (a -> Bool) -> [a] -> Bool---- | The <a>sum</a> function computes the sum of a finite list of numbers.-sum :: Num a => [a] -> a---- | The <a>product</a> function computes the product of a finite list of--- numbers.-product :: Num a => [a] -> a---- | Concatenate a list of lists.-concat :: [[a]] -> [a]---- | Map a function over a list and concatenate the results.-concatMap :: (a -> [b]) -> [a] -> [b]---- | <a>maximum</a> returns the maximum value from a list, which must be--- non-empty, finite, and of an ordered type. It is a special case of--- <a>maximumBy</a>, which allows the programmer to supply their own--- comparison function.-maximum :: Ord a => [a] -> a---- | <a>minimum</a> returns the minimum value from a list, which must be--- non-empty, finite, and of an ordered type. It is a special case of--- <a>minimumBy</a>, which allows the programmer to supply their own--- comparison function.-minimum :: Ord a => [a] -> a---- | <a>scanl</a> is similar to <a>foldl</a>, but returns a list of--- successive reduced values from the left:--- --- <pre>--- scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]--- </pre>--- --- Note that--- --- <pre>--- last (scanl f z xs) == foldl f z xs.--- </pre>-scanl :: (a -> b -> a) -> a -> [b] -> [a]---- | <a>scanl1</a> is a variant of <a>scanl</a> that has no starting value--- argument:--- --- <pre>--- scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]--- </pre>-scanl1 :: (a -> a -> a) -> [a] -> [a]---- | <a>scanr</a> is the right-to-left dual of <a>scanl</a>. Note that--- --- <pre>--- head (scanr f z xs) == foldr f z xs.--- </pre>-scanr :: (a -> b -> b) -> b -> [a] -> [b]---- | <a>scanr1</a> is a variant of <a>scanr</a> that has no starting value--- argument.-scanr1 :: (a -> a -> a) -> [a] -> [a]---- | <a>iterate</a> <tt>f x</tt> returns an infinite list of repeated--- applications of <tt>f</tt> to <tt>x</tt>:--- --- <pre>--- iterate f x == [x, f x, f (f x), ...]--- </pre>-iterate :: (a -> a) -> a -> [a]---- | <a>repeat</a> <tt>x</tt> is an infinite list, with <tt>x</tt> the--- value of every element.-repeat :: a -> [a]---- | <a>replicate</a> <tt>n x</tt> is a list of length <tt>n</tt> with--- <tt>x</tt> the value of every element. It is an instance of the more--- general <tt>Data.List.genericReplicate</tt>, in which <tt>n</tt> may--- be of any integral type.-replicate :: Int -> a -> [a]---- | <a>cycle</a> ties a finite list into a circular one, or equivalently,--- the infinite repetition of the original list. It is the identity on--- infinite lists.-cycle :: [a] -> [a]---- | <a>take</a> <tt>n</tt>, applied to a list <tt>xs</tt>, returns the--- prefix of <tt>xs</tt> of length <tt>n</tt>, or <tt>xs</tt> itself if--- <tt>n > <a>length</a> xs</tt>:--- --- <pre>--- take 5 "Hello World!" == "Hello"--- take 3 [1,2,3,4,5] == [1,2,3]--- take 3 [1,2] == [1,2]--- take 3 [] == []--- take (-1) [1,2] == []--- take 0 [1,2] == []--- </pre>--- --- It is an instance of the more general <tt>Data.List.genericTake</tt>,--- in which <tt>n</tt> may be of any integral type.-take :: Int -> [a] -> [a]---- | <a>drop</a> <tt>n xs</tt> returns the suffix of <tt>xs</tt> after the--- first <tt>n</tt> elements, or <tt>[]</tt> if <tt>n > <a>length</a>--- xs</tt>:--- --- <pre>--- drop 6 "Hello World!" == "World!"--- drop 3 [1,2,3,4,5] == [4,5]--- drop 3 [1,2] == []--- drop 3 [] == []--- drop (-1) [1,2] == [1,2]--- drop 0 [1,2] == [1,2]--- </pre>--- --- It is an instance of the more general <tt>Data.List.genericDrop</tt>,--- in which <tt>n</tt> may be of any integral type.-drop :: Int -> [a] -> [a]---- | <a>splitAt</a> <tt>n xs</tt> returns a tuple where first element is--- <tt>xs</tt> prefix of length <tt>n</tt> and second element is the--- remainder of the list:--- --- <pre>--- splitAt 6 "Hello World!" == ("Hello ","World!")--- splitAt 3 [1,2,3,4,5] == ([1,2,3],[4,5])--- splitAt 1 [1,2,3] == ([1],[2,3])--- splitAt 3 [1,2,3] == ([1,2,3],[])--- splitAt 4 [1,2,3] == ([1,2,3],[])--- splitAt 0 [1,2,3] == ([],[1,2,3])--- splitAt (-1) [1,2,3] == ([],[1,2,3])--- </pre>--- --- It is equivalent to <tt>(<a>take</a> n xs, <a>drop</a> n xs)</tt>.--- <a>splitAt</a> is an instance of the more general--- <tt>Data.List.genericSplitAt</tt>, in which <tt>n</tt> may be of any--- integral type.-splitAt :: Int -> [a] -> ([a], [a])---- | <a>takeWhile</a>, applied to a predicate <tt>p</tt> and a list--- <tt>xs</tt>, returns the longest prefix (possibly empty) of--- <tt>xs</tt> of elements that satisfy <tt>p</tt>:--- --- <pre>--- takeWhile (< 3) [1,2,3,4,1,2,3,4] == [1,2]--- takeWhile (< 9) [1,2,3] == [1,2,3]--- takeWhile (< 0) [1,2,3] == []--- </pre>-takeWhile :: (a -> Bool) -> [a] -> [a]---- | <a>dropWhile</a> <tt>p xs</tt> returns the suffix remaining after--- <a>takeWhile</a> <tt>p xs</tt>:--- --- <pre>--- dropWhile (< 3) [1,2,3,4,5,1,2,3] == [3,4,5,1,2,3]--- dropWhile (< 9) [1,2,3] == []--- dropWhile (< 0) [1,2,3] == [1,2,3]--- </pre>-dropWhile :: (a -> Bool) -> [a] -> [a]---- | <a>span</a>, applied to a predicate <tt>p</tt> and a list <tt>xs</tt>,--- returns a tuple where first element is longest prefix (possibly empty)--- of <tt>xs</tt> of elements that satisfy <tt>p</tt> and second element--- is the remainder of the list:--- --- <pre>--- span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4])--- span (< 9) [1,2,3] == ([1,2,3],[])--- span (< 0) [1,2,3] == ([],[1,2,3])--- </pre>--- --- <a>span</a> <tt>p xs</tt> is equivalent to <tt>(<a>takeWhile</a> p xs,--- <a>dropWhile</a> p xs)</tt>-span :: (a -> Bool) -> [a] -> ([a], [a])---- | <a>break</a>, applied to a predicate <tt>p</tt> and a list--- <tt>xs</tt>, returns a tuple where first element is longest prefix--- (possibly empty) of <tt>xs</tt> of elements that <i>do not satisfy</i>--- <tt>p</tt> and second element is the remainder of the list:--- --- <pre>--- break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4])--- break (< 9) [1,2,3] == ([],[1,2,3])--- break (> 9) [1,2,3] == ([1,2,3],[])--- </pre>--- --- <a>break</a> <tt>p</tt> is equivalent to <tt><a>span</a> (<a>not</a> .--- p)</tt>.-break :: (a -> Bool) -> [a] -> ([a], [a])---- | <a>elem</a> is the list membership predicate, usually written in infix--- form, e.g., <tt>x `elem` xs</tt>. For the result to be <a>False</a>,--- the list must be finite; <a>True</a>, however, results from an element--- equal to <tt>x</tt> found at a finite index of a finite or infinite--- list.-elem :: Eq a => a -> [a] -> Bool---- | <a>notElem</a> is the negation of <a>elem</a>.-notElem :: Eq a => a -> [a] -> Bool---- | <a>lookup</a> <tt>key assocs</tt> looks up a key in an association--- list.-lookup :: Eq a => a -> [(a, b)] -> Maybe b---- | <a>zip</a> takes two lists and returns a list of corresponding pairs.--- If one input list is short, excess elements of the longer list are--- discarded.-zip :: [a] -> [b] -> [(a, b)]---- | <a>zip3</a> takes three lists and returns a list of triples, analogous--- to <a>zip</a>.-zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]---- | <a>zipWith</a> generalises <a>zip</a> by zipping with the function--- given as the first argument, instead of a tupling function. For--- example, <tt><a>zipWith</a> (+)</tt> is applied to two lists to--- produce the list of corresponding sums.-zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]---- | The <a>zipWith3</a> function takes a function which combines three--- elements, as well as three lists and returns a list of their--- point-wise combination, analogous to <a>zipWith</a>.-zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]---- | <a>unzip</a> transforms a list of pairs into a list of first--- components and a list of second components.-unzip :: [(a, b)] -> ([a], [b])---- | The <a>unzip3</a> function takes a list of triples and returns three--- lists, analogous to <a>unzip</a>.-unzip3 :: [(a, b, c)] -> ([a], [b], [c])---- | <a>lines</a> breaks a string up into a list of strings at newline--- characters. The resulting strings do not contain newlines.-lines :: String -> [String]---- | <a>words</a> breaks a string up into a list of words, which were--- delimited by white space.-words :: String -> [String]---- | <a>unlines</a> is an inverse operation to <a>lines</a>. It joins--- lines, after appending a terminating newline to each.-unlines :: [String] -> String---- | <a>unwords</a> is an inverse operation to <a>words</a>. It joins words--- with separating spaces.-unwords :: [String] -> String---- | The <tt>shows</tt> functions return a function that prepends the--- output <a>String</a> to an existing <a>String</a>. This allows--- constant-time concatenation of results using function composition.-type ShowS = String -> String---- | Conversion of values to readable <a>String</a>s.--- --- Minimal complete definition: <a>showsPrec</a> or <a>show</a>.--- --- Derived instances of <a>Show</a> have the following properties, which--- are compatible with derived instances of <tt>Text.Read.Read</tt>:--- --- <ul>--- <li>The result of <a>show</a> is a syntactically correct Haskell--- expression containing only constants, given the fixity declarations in--- force at the point where the type is declared. It contains only the--- constructor names defined in the data type, parentheses, and spaces.--- When labelled constructor fields are used, braces, commas, field--- names, and equal signs are also used.</li>--- <li>If the constructor is defined to be an infix operator, then--- <a>showsPrec</a> will produce infix applications of the--- constructor.</li>--- <li>the representation will be enclosed in parentheses if the--- precedence of the top-level constructor in <tt>x</tt> is less than--- <tt>d</tt> (associativity is ignored). Thus, if <tt>d</tt> is--- <tt>0</tt> then the result is never surrounded in parentheses; if--- <tt>d</tt> is <tt>11</tt> it is always surrounded in parentheses,--- unless it is an atomic expression.</li>--- <li>If the constructor is defined using record syntax, then--- <a>show</a> will produce the record-syntax form, with the fields given--- in the same order as the original declaration.</li>--- </ul>--- --- For example, given the declarations--- --- <pre>--- infixr 5 :^:--- data Tree a = Leaf a | Tree a :^: Tree a--- </pre>--- --- the derived instance of <a>Show</a> is equivalent to--- --- <pre>--- instance (Show a) => Show (Tree a) where--- --- showsPrec d (Leaf m) = showParen (d > app_prec) $--- showString "Leaf " . showsPrec (app_prec+1) m--- where app_prec = 10--- --- showsPrec d (u :^: v) = showParen (d > up_prec) $--- showsPrec (up_prec+1) u . --- showString " :^: " .--- showsPrec (up_prec+1) v--- where up_prec = 5--- </pre>--- --- Note that right-associativity of <tt>:^:</tt> is ignored. For example,--- --- <ul>--- <li><tt><a>show</a> (Leaf 1 :^: Leaf 2 :^: Leaf 3)</tt> produces the--- string <tt>"Leaf 1 :^: (Leaf 2 :^: Leaf 3)"</tt>.</li>--- </ul>-class Show a-showsPrec :: Show a => Int -> a -> ShowS-show :: Show a => a -> String-showList :: Show a => [a] -> ShowS---- | equivalent to <a>showsPrec</a> with a precedence of 0.-shows :: Show a => a -> ShowS---- | utility function converting a <a>Char</a> to a show function that--- simply prepends the character unchanged.-showChar :: Char -> ShowS---- | utility function converting a <a>String</a> to a show function that--- simply prepends the string unchanged.-showString :: String -> ShowS---- | utility function that surrounds the inner show function with--- parentheses when the <a>Bool</a> parameter is <a>True</a>.-showParen :: Bool -> ShowS -> ShowS---- | A parser for a type <tt>a</tt>, represented as a function that takes a--- <a>String</a> and returns a list of possible parses as--- <tt>(a,<a>String</a>)</tt> pairs.--- --- Note that this kind of backtracking parser is very inefficient;--- reading a large structure may be quite slow (cf <a>ReadP</a>).-type ReadS a = String -> [(a, String)]---- | Parsing of <a>String</a>s, producing values.--- --- Minimal complete definition: <a>readsPrec</a> (or, for GHC only,--- <a>readPrec</a>)--- --- Derived instances of <a>Read</a> make the following assumptions, which--- derived instances of <tt>Text.Show.Show</tt> obey:--- --- <ul>--- <li>If the constructor is defined to be an infix operator, then the--- derived <a>Read</a> instance will parse only infix applications of the--- constructor (not the prefix form).</li>--- <li>Associativity is not used to reduce the occurrence of parentheses,--- although precedence may be.</li>--- <li>If the constructor is defined using record syntax, the derived--- <a>Read</a> will parse only the record-syntax form, and furthermore,--- the fields must be given in the same order as the original--- declaration.</li>--- <li>The derived <a>Read</a> instance allows arbitrary Haskell--- whitespace between tokens of the input string. Extra parentheses are--- also allowed.</li>--- </ul>--- --- For example, given the declarations--- --- <pre>--- infixr 5 :^:--- data Tree a = Leaf a | Tree a :^: Tree a--- </pre>--- --- the derived instance of <a>Read</a> in Haskell 98 is equivalent to--- --- <pre>--- instance (Read a) => Read (Tree a) where--- --- readsPrec d r = readParen (d > app_prec)--- (\r -> [(Leaf m,t) |--- ("Leaf",s) <- lex r,--- (m,t) <- readsPrec (app_prec+1) s]) r--- --- ++ readParen (d > up_prec)--- (\r -> [(u:^:v,w) |--- (u,s) <- readsPrec (up_prec+1) r,--- (":^:",t) <- lex s,--- (v,w) <- readsPrec (up_prec+1) t]) r--- --- where app_prec = 10--- up_prec = 5--- </pre>--- --- Note that right-associativity of <tt>:^:</tt> is unused.--- --- The derived instance in GHC is equivalent to--- --- <pre>--- instance (Read a) => Read (Tree a) where--- --- readPrec = parens $ (prec app_prec $ do--- Ident "Leaf" <- lexP--- m <- step readPrec--- return (Leaf m))--- --- +++ (prec up_prec $ do--- u <- step readPrec--- Symbol ":^:" <- lexP--- v <- step readPrec--- return (u :^: v))--- --- where app_prec = 10--- up_prec = 5--- --- readListPrec = readListPrecDefault--- </pre>-class Read a-readsPrec :: Read a => Int -> ReadS a-readList :: Read a => ReadS [a]---- | equivalent to <a>readsPrec</a> with a precedence of 0.-reads :: Read a => ReadS a---- | <tt><a>readParen</a> <a>True</a> p</tt> parses what <tt>p</tt> parses,--- but surrounded with parentheses.--- --- <tt><a>readParen</a> <a>False</a> p</tt> parses what <tt>p</tt>--- parses, but optionally surrounded with parentheses.-readParen :: Bool -> ReadS a -> ReadS a---- | The <a>read</a> function reads input from a string, which must be--- completely consumed by the input process.-read :: Read a => String -> a---- | The <a>lex</a> function reads a single lexeme from the input,--- discarding initial white space, and returning the characters that--- constitute the lexeme. If the input string contains only white space,--- <a>lex</a> returns a single successful `lexeme' consisting of the--- empty string. (Thus <tt><a>lex</a> "" = [("","")]</tt>.) If there is--- no legal lexeme at the beginning of the input string, <a>lex</a> fails--- (i.e. returns <tt>[]</tt>).--- --- This lexer is not completely faithful to the Haskell lexical syntax in--- the following respects:--- --- <ul>--- <li>Qualified names are not handled properly</li>--- <li>Octal and hexadecimal numerics are not recognized as a single--- token</li>--- <li>Comments are not treated properly</li>--- </ul>-lex :: ReadS String---- | A value of type <tt><a>IO</a> a</tt> is a computation which, when--- performed, does some I/O before returning a value of type <tt>a</tt>.--- --- There is really only one way to "perform" an I/O action: bind it to--- <tt>Main.main</tt> in your program. When your program is run, the I/O--- will be performed. It isn't possible to perform I/O from an arbitrary--- function, unless that function is itself in the <a>IO</a> monad and--- called at some point, directly or indirectly, from <tt>Main.main</tt>.--- --- <a>IO</a> is a monad, so <a>IO</a> actions can be combined using--- either the do-notation or the <tt>>></tt> and <tt>>>=</tt>--- operations from the <tt>Monad</tt> class.-data IO a :: * -> *---- | Write a character to the standard output device (same as--- <a>hPutChar</a> <a>stdout</a>).-putChar :: Char -> IO ()---- | Write a string to the standard output device (same as <a>hPutStr</a>--- <a>stdout</a>).-putStr :: String -> IO ()---- | The same as <a>putStr</a>, but adds a newline character.-putStrLn :: String -> IO ()---- | The <a>print</a> function outputs a value of any printable type to the--- standard output device. Printable types are those that are instances--- of class <a>Show</a>; <a>print</a> converts values to strings for--- output using the <a>show</a> operation and adds a newline.--- --- For example, a program to print the first 20 integers and their powers--- of 2 could be written as:--- --- <pre>--- main = print ([(n, 2^n) | n <- [0..19]])--- </pre>-print :: Show a => a -> IO ()---- | Read a character from the standard input device (same as--- <a>hGetChar</a> <a>stdin</a>).-getChar :: IO Char---- | Read a line from the standard input device (same as <a>hGetLine</a>--- <a>stdin</a>).-getLine :: IO String---- | The <a>getContents</a> operation returns all user input as a single--- string, which is read lazily as it is needed (same as--- <a>hGetContents</a> <a>stdin</a>).-getContents :: IO String---- | The <a>interact</a> function takes a function of type--- <tt>String->String</tt> as its argument. The entire input from the--- standard input device is passed to this function as its argument, and--- the resulting string is output on the standard output device.-interact :: (String -> String) -> IO ()---- | File and directory names are values of type <a>String</a>, whose--- precise meaning is operating system dependent. Files can be opened,--- yielding a handle which can then be used to operate on the contents of--- that file.-type FilePath = String---- | The <a>readFile</a> function reads a file and returns the contents of--- the file as a string. The file is read lazily, on demand, as with--- <a>getContents</a>.-readFile :: FilePath -> IO String---- | The computation <a>writeFile</a> <tt>file str</tt> function writes the--- string <tt>str</tt>, to the file <tt>file</tt>.-writeFile :: FilePath -> String -> IO ()---- | The computation <a>appendFile</a> <tt>file str</tt> function appends--- the string <tt>str</tt>, to the file <tt>file</tt>.--- --- Note that <a>writeFile</a> and <a>appendFile</a> write a literal--- string to a file. To write a value of any printable type, as with--- <a>print</a>, use the <a>show</a> function to convert the value to a--- string first.--- --- <pre>--- main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]])--- </pre>-appendFile :: FilePath -> String -> IO ()---- | The <a>readIO</a> function is similar to <a>read</a> except that it--- signals parse failure to the <a>IO</a> monad instead of terminating--- the program.-readIO :: Read a => String -> IO a---- | The <a>readLn</a> function combines <a>getLine</a> and <a>readIO</a>.-readLn :: Read a => IO a---- | The Haskell 98 type for exceptions in the <a>IO</a> monad. Any I/O--- operation may raise an <a>IOError</a> instead of returning a result.--- For a more general type of exception, including also those that arise--- in pure code, see <a>Control.Exception.Exception</a>.--- --- In Haskell 98, this is an opaque type.-type IOError = IOException---- | Raise an <a>IOError</a> in the <a>IO</a> monad.-ioError :: IOError -> IO a---- | Construct an <a>IOError</a> value with a string describing the error.--- The <a>fail</a> method of the <a>IO</a> instance of the <a>Monad</a>--- class raises a <a>userError</a>, thus:--- --- <pre>--- instance Monad IO where --- ...--- fail s = ioError (userError s)--- </pre>-userError :: String -> IOError---- | The <a>catch</a> function establishes a handler that receives any--- <a>IOError</a> raised in the action protected by <a>catch</a>. An--- <a>IOError</a> is caught by the most recent handler established by--- <a>catch</a>. These handlers are not selective: all <a>IOError</a>s--- are caught. Exception propagation must be explicitly provided in a--- handler by re-raising any unwanted exceptions. For example, in--- --- <pre>--- f = catch g (\e -> if IO.isEOFError e then return [] else ioError e)--- </pre>--- --- the function <tt>f</tt> returns <tt>[]</tt> when an end-of-file--- exception (cf. <a>isEOFError</a>) occurs in <tt>g</tt>; otherwise, the--- exception is propagated to the next outer handler.--- --- When an exception propagates outside the main program, the Haskell--- system prints the associated <a>IOError</a> value and exits the--- program.--- --- Non-I/O exceptions are not caught by this variant; to catch all--- exceptions, use <tt>Control.Exception.catch</tt> from--- <a>Control.Exception</a>.-catch :: IO a -> (IOError -> IO a) -> IO a--module Foreign.StablePtr---- | A <i>stable pointer</i> is a reference to a Haskell expression that is--- guaranteed not to be affected by garbage collection, i.e., it will--- neither be deallocated nor will the value of the stable pointer itself--- change during garbage collection (ordinary references may be relocated--- during garbage collection). Consequently, stable pointers can be--- passed to foreign code, which can treat it as an opaque reference to a--- Haskell value.--- --- A value of type <tt>StablePtr a</tt> is a stable pointer to a Haskell--- expression of type <tt>a</tt>.-data StablePtr a :: * -> *---- | Create a stable pointer referring to the given Haskell value.-newStablePtr :: a -> IO (StablePtr a)---- | Obtain the Haskell value referenced by a stable pointer, i.e., the--- same value that was passed to the corresponding call to--- <tt>makeStablePtr</tt>. If the argument to <a>deRefStablePtr</a> has--- already been freed using <a>freeStablePtr</a>, the behaviour of--- <a>deRefStablePtr</a> is undefined.-deRefStablePtr :: StablePtr a -> IO a---- | Dissolve the association between the stable pointer and the Haskell--- value. Afterwards, if the stable pointer is passed to--- <a>deRefStablePtr</a> or <a>freeStablePtr</a>, the behaviour is--- undefined. However, the stable pointer may still be passed to--- <a>castStablePtrToPtr</a>, but the <tt><tt>Foreign.Ptr.Ptr</tt>--- ()</tt> value returned by <a>castStablePtrToPtr</a>, in this case, is--- undefined (in particular, it may be <tt>Foreign.Ptr.nullPtr</tt>).--- Nevertheless, the call to <a>castStablePtrToPtr</a> is guaranteed not--- to diverge.-freeStablePtr :: StablePtr a -> IO ()---- | Coerce a stable pointer to an address. No guarantees are made about--- the resulting value, except that the original stable pointer can be--- recovered by <a>castPtrToStablePtr</a>. In particular, the address may--- not refer to an accessible memory location and any attempt to pass it--- to the member functions of the class--- <tt>Foreign.Storable.Storable</tt> leads to undefined behaviour.-castStablePtrToPtr :: StablePtr a -> Ptr ()---- | The inverse of <a>castStablePtrToPtr</a>, i.e., we have the identity--- --- <pre>--- sp == castPtrToStablePtr (castStablePtrToPtr sp)--- </pre>--- --- for any stable pointer <tt>sp</tt> on which <a>freeStablePtr</a> has--- not been executed yet. Moreover, <a>castPtrToStablePtr</a> may only be--- applied to pointers that have been produced by--- <a>castStablePtrToPtr</a>.-castPtrToStablePtr :: Ptr () -> StablePtr a--module Data.Ix---- | The <a>Ix</a> class is used to map a contiguous subrange of values in--- a type onto integers. It is used primarily for array indexing (see the--- array package).--- --- The first argument <tt>(l,u)</tt> of each of these operations is a--- pair specifying the lower and upper bounds of a contiguous subrange of--- values.--- --- An implementation is entitled to assume the following laws about these--- operations:--- --- <ul>--- <li><tt><a>inRange</a> (l,u) i == <a>elem</a> i (<a>range</a>--- (l,u))</tt> <tt> </tt></li>--- <li><tt><a>range</a> (l,u) <a>!!</a> <a>index</a> (l,u) i == i</tt>,--- when <tt><a>inRange</a> (l,u) i</tt></li>--- <li><tt><a>map</a> (<a>index</a> (l,u)) (<a>range</a> (l,u))) ==--- [0..<a>rangeSize</a> (l,u)-1]</tt> <tt> </tt></li>--- <li><tt><a>rangeSize</a> (l,u) == <a>length</a> (<a>range</a>--- (l,u))</tt> <tt> </tt></li>--- </ul>--- --- Minimal complete instance: <a>range</a>, <a>index</a> and--- <a>inRange</a>.-class Ord a => Ix a-range :: Ix a => (a, a) -> [a]-index :: Ix a => (a, a) -> a -> Int-inRange :: Ix a => (a, a) -> a -> Bool-rangeSize :: Ix a => (a, a) -> Int--module Data.Char---- | The character type <a>Char</a> is an enumeration whose values--- represent Unicode (or equivalently ISO/IEC 10646) characters (see--- <a>http://www.unicode.org/</a> for details). This set extends the ISO--- 8859-1 (Latin-1) character set (the first 256 charachers), which is--- itself an extension of the ASCII character set (the first 128--- characters). A character literal in Haskell has type <a>Char</a>.--- --- To convert a <a>Char</a> to or from the corresponding <a>Int</a> value--- defined by Unicode, use <tt>Prelude.toEnum</tt> and--- <tt>Prelude.fromEnum</tt> from the <tt>Prelude.Enum</tt> class--- respectively (or equivalently <tt>ord</tt> and <tt>chr</tt>).-data Char :: *---- | A <a>String</a> is a list of characters. String constants in Haskell--- are values of type <a>String</a>.-type String = [Char]---- | Selects control characters, which are the non-printing characters of--- the Latin-1 subset of Unicode.-isControl :: Char -> Bool---- | Returns <a>True</a> for any Unicode space character, and the control--- characters <tt>\t</tt>, <tt>\n</tt>, <tt>\r</tt>, <tt>\f</tt>,--- <tt>\v</tt>.-isSpace :: Char -> Bool---- | Selects lower-case alphabetic Unicode characters (letters).-isLower :: Char -> Bool---- | Selects upper-case or title-case alphabetic Unicode characters--- (letters). Title case is used by a small number of letter ligatures--- like the single-character form of <i>Lj</i>.-isUpper :: Char -> Bool---- | Selects alphabetic Unicode characters (lower-case, upper-case and--- title-case letters, plus letters of caseless scripts and modifiers--- letters). This function is equivalent to <tt>Data.Char.isLetter</tt>.-isAlpha :: Char -> Bool---- | Selects alphabetic or numeric digit Unicode characters.--- --- Note that numeric digits outside the ASCII range are selected by this--- function but not by <a>isDigit</a>. Such digits may be part of--- identifiers but are not used by the printer and reader to represent--- numbers.-isAlphaNum :: Char -> Bool---- | Selects printable Unicode characters (letters, numbers, marks,--- punctuation, symbols and spaces).-isPrint :: Char -> Bool---- | Selects ASCII digits, i.e. <tt>'0'</tt>..<tt>'9'</tt>.-isDigit :: Char -> Bool---- | Selects ASCII octal digits, i.e. <tt>'0'</tt>..<tt>'7'</tt>.-isOctDigit :: Char -> Bool---- | Selects ASCII hexadecimal digits, i.e. <tt>'0'</tt>..<tt>'9'</tt>,--- <tt>'a'</tt>..<tt>'f'</tt>, <tt>'A'</tt>..<tt>'F'</tt>.-isHexDigit :: Char -> Bool---- | Selects alphabetic Unicode characters (lower-case, upper-case and--- title-case letters, plus letters of caseless scripts and modifiers--- letters). This function is equivalent to <tt>Data.Char.isAlpha</tt>.-isLetter :: Char -> Bool---- | Selects Unicode mark characters, e.g. accents and the like, which--- combine with preceding letters.-isMark :: Char -> Bool---- | Selects Unicode numeric characters, including digits from various--- scripts, Roman numerals, etc.-isNumber :: Char -> Bool---- | Selects Unicode punctuation characters, including various kinds of--- connectors, brackets and quotes.-isPunctuation :: Char -> Bool---- | Selects Unicode symbol characters, including mathematical and currency--- symbols.-isSymbol :: Char -> Bool---- | Selects Unicode space and separator characters.-isSeparator :: Char -> Bool---- | Selects the first 128 characters of the Unicode character set,--- corresponding to the ASCII character set.-isAscii :: Char -> Bool---- | Selects the first 256 characters of the Unicode character set,--- corresponding to the ISO 8859-1 (Latin-1) character set.-isLatin1 :: Char -> Bool---- | Selects ASCII upper-case letters, i.e. characters satisfying both--- <a>isAscii</a> and <a>isUpper</a>.-isAsciiUpper :: Char -> Bool---- | Selects ASCII lower-case letters, i.e. characters satisfying both--- <a>isAscii</a> and <a>isLower</a>.-isAsciiLower :: Char -> Bool---- | Unicode General Categories (column 2 of the UnicodeData table) in the--- order they are listed in the Unicode standard.-data GeneralCategory :: *---- | Lu: Letter, Uppercase-UppercaseLetter :: GeneralCategory---- | Ll: Letter, Lowercase-LowercaseLetter :: GeneralCategory---- | Lt: Letter, Titlecase-TitlecaseLetter :: GeneralCategory---- | Lm: Letter, Modifier-ModifierLetter :: GeneralCategory---- | Lo: Letter, Other-OtherLetter :: GeneralCategory---- | Mn: Mark, Non-Spacing-NonSpacingMark :: GeneralCategory---- | Mc: Mark, Spacing Combining-SpacingCombiningMark :: GeneralCategory---- | Me: Mark, Enclosing-EnclosingMark :: GeneralCategory---- | Nd: Number, Decimal-DecimalNumber :: GeneralCategory---- | Nl: Number, Letter-LetterNumber :: GeneralCategory---- | No: Number, Other-OtherNumber :: GeneralCategory---- | Pc: Punctuation, Connector-ConnectorPunctuation :: GeneralCategory---- | Pd: Punctuation, Dash-DashPunctuation :: GeneralCategory---- | Ps: Punctuation, Open-OpenPunctuation :: GeneralCategory---- | Pe: Punctuation, Close-ClosePunctuation :: GeneralCategory---- | Pi: Punctuation, Initial quote-InitialQuote :: GeneralCategory---- | Pf: Punctuation, Final quote-FinalQuote :: GeneralCategory---- | Po: Punctuation, Other-OtherPunctuation :: GeneralCategory---- | Sm: Symbol, Math-MathSymbol :: GeneralCategory---- | Sc: Symbol, Currency-CurrencySymbol :: GeneralCategory---- | Sk: Symbol, Modifier-ModifierSymbol :: GeneralCategory---- | So: Symbol, Other-OtherSymbol :: GeneralCategory---- | Zs: Separator, Space-Space :: GeneralCategory---- | Zl: Separator, Line-LineSeparator :: GeneralCategory---- | Zp: Separator, Paragraph-ParagraphSeparator :: GeneralCategory---- | Cc: Other, Control-Control :: GeneralCategory---- | Cf: Other, Format-Format :: GeneralCategory---- | Cs: Other, Surrogate-Surrogate :: GeneralCategory---- | Co: Other, Private Use-PrivateUse :: GeneralCategory---- | Cn: Other, Not Assigned-NotAssigned :: GeneralCategory---- | The Unicode general category of the character.-generalCategory :: Char -> GeneralCategory---- | Convert a letter to the corresponding upper-case letter, if any. Any--- other character is returned unchanged.-toUpper :: Char -> Char---- | Convert a letter to the corresponding lower-case letter, if any. Any--- other character is returned unchanged.-toLower :: Char -> Char---- | Convert a letter to the corresponding title-case or upper-case letter,--- if any. (Title case differs from upper case only for a small number of--- ligature letters.) Any other character is returned unchanged.-toTitle :: Char -> Char---- | Convert a single digit <a>Char</a> to the corresponding <a>Int</a>.--- This function fails unless its argument satisfies <a>isHexDigit</a>,--- but recognises both upper and lower-case hexadecimal digits (i.e.--- <tt>'0'</tt>..<tt>'9'</tt>, <tt>'a'</tt>..<tt>'f'</tt>,--- <tt>'A'</tt>..<tt>'F'</tt>).-digitToInt :: Char -> Int---- | Convert an <a>Int</a> in the range <tt>0</tt>..<tt>15</tt> to the--- corresponding single digit <a>Char</a>. This function fails on other--- inputs, and generates lower-case hexadecimal digits.-intToDigit :: Int -> Char---- | The <tt>Prelude.fromEnum</tt> method restricted to the type--- <tt>Data.Char.Char</tt>.-ord :: Char -> Int---- | The <tt>Prelude.toEnum</tt> method restricted to the type--- <tt>Data.Char.Char</tt>.-chr :: Int -> Char---- | Convert a character to a string using only printable characters, using--- Haskell source-language escape conventions. For example:--- --- <pre>--- showLitChar '\n' s = "\\n" ++ s--- </pre>-showLitChar :: Char -> ShowS---- | Read a string representation of a character, using Haskell--- source-language escape conventions. For example:--- --- <pre>--- lexLitChar "\\nHello" = [("\\n", "Hello")]--- </pre>-lexLitChar :: ReadS String---- | Read a string representation of a character, using Haskell--- source-language escape conventions, and convert it to the character--- that it encodes. For example:--- --- <pre>--- readLitChar "\\nHello" = [('\n', "Hello")]--- </pre>-readLitChar :: ReadS Char--module Data.Int---- | A fixed-precision integer type with at least the range <tt>[-2^29 ..--- 2^29-1]</tt>. The exact range for a given implementation can be--- determined by using <tt>Prelude.minBound</tt> and--- <tt>Prelude.maxBound</tt> from the <tt>Prelude.Bounded</tt> class.-data Int :: *---- | 8-bit signed integer type-data Int8 :: *---- | 16-bit signed integer type-data Int16 :: *---- | 32-bit signed integer type-data Int32 :: *---- | 64-bit signed integer type-data Int64 :: *--module Data.Ratio---- | Rational numbers, with numerator and denominator of some--- <a>Integral</a> type.-data Integral a => Ratio a :: * -> *---- | Arbitrary-precision rational numbers, represented as a ratio of two--- <a>Integer</a> values. A rational number may be constructed using the--- <a>%</a> operator.-type Rational = Ratio Integer---- | Forms the ratio of two integral numbers.-(%) :: Integral a => a -> a -> Ratio a---- | Extract the numerator of the ratio in reduced form: the numerator and--- denominator have no common factor and the denominator is positive.-numerator :: Integral a => Ratio a -> a---- | Extract the denominator of the ratio in reduced form: the numerator--- and denominator have no common factor and the denominator is positive.-denominator :: Integral a => Ratio a -> a---- | <a>approxRational</a>, applied to two real fractional numbers--- <tt>x</tt> and <tt>epsilon</tt>, returns the simplest rational number--- within <tt>epsilon</tt> of <tt>x</tt>. A rational number <tt>y</tt> is--- said to be <i>simpler</i> than another <tt>y'</tt> if--- --- <ul>--- <li><tt><a>abs</a> (<a>numerator</a> y) <= <a>abs</a>--- (<a>numerator</a> y')</tt>, and</li>--- <li><tt><a>denominator</a> y <= <a>denominator</a> y'</tt>.</li>--- </ul>--- --- Any real interval contains a unique simplest rational; in particular,--- note that <tt>0/1</tt> is the simplest rational of all.-approxRational :: RealFrac a => a -> a -> Rational--module Data.Word---- | A <a>Word</a> is an unsigned integral type, with the same size as--- <a>Int</a>.-data Word :: *---- | 8-bit unsigned integer type-data Word8 :: *---- | 16-bit unsigned integer type-data Word16 :: *---- | 32-bit unsigned integer type-data Word32 :: *---- | 64-bit unsigned integer type-data Word64 :: *----- | The module <a>Foreign.Ptr</a> provides typed pointers to foreign--- entities. We distinguish two kinds of pointers: pointers to data and--- pointers to functions. It is understood that these two kinds of--- pointers may be represented differently as they may be references to--- data and text segments, respectively.-module Foreign.Ptr---- | A value of type <tt><a>Ptr</a> a</tt> represents a pointer to an--- object, or an array of objects, which may be marshalled to or from--- Haskell values of type <tt>a</tt>.--- --- The type <tt>a</tt> will often be an instance of class--- <tt>Foreign.Storable.Storable</tt> which provides the marshalling--- operations. However this is not essential, and you can provide your--- own operations to access the pointer. For example you might write--- small foreign functions to get or set the fields of a C--- <tt>struct</tt>.-data Ptr a :: * -> *---- | The constant <a>nullPtr</a> contains a distinguished value of--- <a>Ptr</a> that is not associated with a valid memory location.-nullPtr :: Ptr a---- | The <a>castPtr</a> function casts a pointer from one type to another.-castPtr :: Ptr a -> Ptr b---- | Advances the given address by the given offset in bytes.-plusPtr :: Ptr a -> Int -> Ptr b---- | Given an arbitrary address and an alignment constraint,--- <a>alignPtr</a> yields the next higher address that fulfills the--- alignment constraint. An alignment constraint <tt>x</tt> is fulfilled--- by any address divisible by <tt>x</tt>. This operation is idempotent.-alignPtr :: Ptr a -> Int -> Ptr a---- | Computes the offset required to get from the second to the first--- argument. We have--- --- <pre>--- p2 == p1 `plusPtr` (p2 `minusPtr` p1)--- </pre>-minusPtr :: Ptr a -> Ptr b -> Int---- | A value of type <tt><a>FunPtr</a> a</tt> is a pointer to a function--- callable from foreign code. The type <tt>a</tt> will normally be a--- <i>foreign type</i>, a function type with zero or more arguments where--- --- <ul>--- <li>the argument types are <i>marshallable foreign types</i>, i.e.--- <a>Char</a>, <a>Int</a>, <a>Double</a>, <a>Float</a>, <a>Bool</a>,--- <tt>Data.Int.Int8</tt>, <tt>Data.Int.Int16</tt>,--- <tt>Data.Int.Int32</tt>, <tt>Data.Int.Int64</tt>,--- <tt>Data.Word.Word8</tt>, <tt>Data.Word.Word16</tt>,--- <tt>Data.Word.Word32</tt>, <tt>Data.Word.Word64</tt>, <tt><a>Ptr</a>--- a</tt>, <tt><a>FunPtr</a> a</tt>,--- <tt><tt>Foreign.StablePtr.StablePtr</tt> a</tt> or a renaming of any--- of these using <tt>newtype</tt>.</li>--- <li>the return type is either a marshallable foreign type or has the--- form <tt><a>IO</a> t</tt> where <tt>t</tt> is a marshallable foreign--- type or <tt>()</tt>.</li>--- </ul>--- --- A value of type <tt><a>FunPtr</a> a</tt> may be a pointer to a foreign--- function, either returned by another foreign function or imported with--- a a static address import like--- --- <pre>--- foreign import ccall "stdlib.h &free"--- p_free :: FunPtr (Ptr a -> IO ())--- </pre>--- --- or a pointer to a Haskell function created using a <i>wrapper</i> stub--- declared to produce a <a>FunPtr</a> of the correct type. For example:--- --- <pre>--- type Compare = Int -> Int -> Bool--- foreign import ccall "wrapper"--- mkCompare :: Compare -> IO (FunPtr Compare)--- </pre>--- --- Calls to wrapper stubs like <tt>mkCompare</tt> allocate storage, which--- should be released with <tt>Foreign.Ptr.freeHaskellFunPtr</tt> when no--- longer required.--- --- To convert <a>FunPtr</a> values to corresponding Haskell functions,--- one can define a <i>dynamic</i> stub for the specific foreign type,--- e.g.--- --- <pre>--- type IntFunction = CInt -> IO ()--- foreign import ccall "dynamic" --- mkFun :: FunPtr IntFunction -> IntFunction--- </pre>-data FunPtr a :: * -> *---- | The constant <a>nullFunPtr</a> contains a distinguished value of--- <a>FunPtr</a> that is not associated with a valid memory location.-nullFunPtr :: FunPtr a---- | Casts a <a>FunPtr</a> to a <a>FunPtr</a> of a different type.-castFunPtr :: FunPtr a -> FunPtr b---- | Casts a <a>FunPtr</a> to a <a>Ptr</a>.--- --- <i>Note:</i> this is valid only on architectures where data and--- function pointers range over the same set of addresses, and should--- only be used for bindings to external libraries whose interface--- already relies on this assumption.-castFunPtrToPtr :: FunPtr a -> Ptr b---- | Casts a <a>Ptr</a> to a <a>FunPtr</a>.--- --- <i>Note:</i> this is valid only on architectures where data and--- function pointers range over the same set of addresses, and should--- only be used for bindings to external libraries whose interface--- already relies on this assumption.-castPtrToFunPtr :: Ptr a -> FunPtr b---- | Release the storage associated with the given <a>FunPtr</a>, which--- must have been obtained from a wrapper stub. This should be called--- whenever the return value from a foreign import wrapper function is no--- longer required; otherwise, the storage it uses will leak.-freeHaskellFunPtr :: FunPtr a -> IO ()---- | A signed integral type that can be losslessly converted to and from--- <tt>Ptr</tt>. This type is also compatible with the C99 type--- <tt>intptr_t</tt>, and can be marshalled to and from that type safely.-data IntPtr :: *---- | casts a <tt>Ptr</tt> to an <tt>IntPtr</tt>-ptrToIntPtr :: Ptr a -> IntPtr---- | casts an <tt>IntPtr</tt> to a <tt>Ptr</tt>-intPtrToPtr :: IntPtr -> Ptr a---- | An unsigned integral type that can be losslessly converted to and from--- <tt>Ptr</tt>. This type is also compatible with the C99 type--- <tt>uintptr_t</tt>, and can be marshalled to and from that type--- safely.-data WordPtr :: *---- | casts a <tt>Ptr</tt> to a <tt>WordPtr</tt>-ptrToWordPtr :: Ptr a -> WordPtr---- | casts a <tt>WordPtr</tt> to a <tt>Ptr</tt>-wordPtrToPtr :: WordPtr -> Ptr a--module Data.Maybe---- | The <a>Maybe</a> type encapsulates an optional value. A value of type--- <tt><a>Maybe</a> a</tt> either contains a value of type <tt>a</tt>--- (represented as <tt><a>Just</a> a</tt>), or it is empty (represented--- as <a>Nothing</a>). Using <a>Maybe</a> is a good way to deal with--- errors or exceptional cases without resorting to drastic measures such--- as <a>error</a>.--- --- The <a>Maybe</a> type is also a monad. It is a simple kind of error--- monad, where all errors are represented by <a>Nothing</a>. A richer--- error monad can be built using the <tt>Data.Either.Either</tt> type.-data Maybe a :: * -> *-Nothing :: Maybe a-Just :: a -> Maybe a---- | The <a>maybe</a> function takes a default value, a function, and a--- <a>Maybe</a> value. If the <a>Maybe</a> value is <a>Nothing</a>, the--- function returns the default value. Otherwise, it applies the function--- to the value inside the <a>Just</a> and returns the result.-maybe :: b -> (a -> b) -> Maybe a -> b---- | The <a>isJust</a> function returns <a>True</a> iff its argument is of--- the form <tt>Just _</tt>.-isJust :: Maybe a -> Bool---- | The <a>isNothing</a> function returns <a>True</a> iff its argument is--- <a>Nothing</a>.-isNothing :: Maybe a -> Bool---- | The <a>fromJust</a> function extracts the element out of a <a>Just</a>--- and throws an error if its argument is <a>Nothing</a>.-fromJust :: Maybe a -> a---- | The <a>fromMaybe</a> function takes a default value and and--- <a>Maybe</a> value. If the <a>Maybe</a> is <a>Nothing</a>, it returns--- the default values; otherwise, it returns the value contained in the--- <a>Maybe</a>.-fromMaybe :: a -> Maybe a -> a---- | The <a>listToMaybe</a> function returns <a>Nothing</a> on an empty--- list or <tt><a>Just</a> a</tt> where <tt>a</tt> is the first element--- of the list.-listToMaybe :: [a] -> Maybe a---- | The <a>maybeToList</a> function returns an empty list when given--- <a>Nothing</a> or a singleton list when not given <a>Nothing</a>.-maybeToList :: Maybe a -> [a]---- | The <a>catMaybes</a> function takes a list of <a>Maybe</a>s and--- returns a list of all the <a>Just</a> values.-catMaybes :: [Maybe a] -> [a]---- | The <a>mapMaybe</a> function is a version of <a>map</a> which can--- throw out elements. In particular, the functional argument returns--- something of type <tt><a>Maybe</a> b</tt>. If this is <a>Nothing</a>,--- no element is added on to the result list. If it just <tt><a>Just</a>--- b</tt>, then <tt>b</tt> is included in the result list.-mapMaybe :: (a -> Maybe b) -> [a] -> [b]--module Numeric---- | Converts a possibly-negative <a>Real</a> value to a string.-showSigned :: Real a => (a -> ShowS) -> Int -> a -> ShowS---- | Shows a <i>non-negative</i> <a>Integral</a> number using the base--- specified by the first argument, and the character representation--- specified by the second.-showIntAtBase :: Integral a => a -> (Int -> Char) -> a -> ShowS---- | Show <i>non-negative</i> <a>Integral</a> numbers in base 10.-showInt :: Integral a => a -> ShowS---- | Show <i>non-negative</i> <a>Integral</a> numbers in base 16.-showHex :: Integral a => a -> ShowS---- | Show <i>non-negative</i> <a>Integral</a> numbers in base 8.-showOct :: Integral a => a -> ShowS---- | Show a signed <a>RealFloat</a> value using scientific (exponential)--- notation (e.g. <tt>2.45e2</tt>, <tt>1.5e-3</tt>).--- --- In the call <tt><a>showEFloat</a> digs val</tt>, if <tt>digs</tt> is--- <a>Nothing</a>, the value is shown to full precision; if <tt>digs</tt>--- is <tt><a>Just</a> d</tt>, then at most <tt>d</tt> digits after the--- decimal point are shown.-showEFloat :: RealFloat a => Maybe Int -> a -> ShowS---- | Show a signed <a>RealFloat</a> value using standard decimal notation--- (e.g. <tt>245000</tt>, <tt>0.0015</tt>).--- --- In the call <tt><a>showFFloat</a> digs val</tt>, if <tt>digs</tt> is--- <a>Nothing</a>, the value is shown to full precision; if <tt>digs</tt>--- is <tt><a>Just</a> d</tt>, then at most <tt>d</tt> digits after the--- decimal point are shown.-showFFloat :: RealFloat a => Maybe Int -> a -> ShowS---- | Show a signed <a>RealFloat</a> value using standard decimal notation--- for arguments whose absolute value lies between <tt>0.1</tt> and--- <tt>9,999,999</tt>, and scientific notation otherwise.--- --- In the call <tt><a>showGFloat</a> digs val</tt>, if <tt>digs</tt> is--- <a>Nothing</a>, the value is shown to full precision; if <tt>digs</tt>--- is <tt><a>Just</a> d</tt>, then at most <tt>d</tt> digits after the--- decimal point are shown.-showGFloat :: RealFloat a => Maybe Int -> a -> ShowS---- | Show a signed <a>RealFloat</a> value to full precision using standard--- decimal notation for arguments whose absolute value lies between--- <tt>0.1</tt> and <tt>9,999,999</tt>, and scientific notation--- otherwise.-showFloat :: RealFloat a => a -> ShowS---- | <a>floatToDigits</a> takes a base and a non-negative <a>RealFloat</a>--- number, and returns a list of digits and an exponent. In particular,--- if <tt>x>=0</tt>, and--- --- <pre>--- floatToDigits base x = ([d1,d2,...,dn], e)--- </pre>--- --- then--- --- <ol>--- <li><pre>n >= 1</pre></li>--- <li><pre>x = 0.d1d2...dn * (base**e)</pre></li>--- <li><pre>0 <= di <= base-1</pre></li>--- </ol>-floatToDigits :: RealFloat a => Integer -> a -> ([Int], Int)---- | Reads a <i>signed</i> <a>Real</a> value, given a reader for an--- unsigned value.-readSigned :: Real a => ReadS a -> ReadS a---- | Reads an <i>unsigned</i> <a>Integral</a> value in an arbitrary base.-readInt :: Num a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a---- | Read an unsigned number in decimal notation.-readDec :: Num a => ReadS a---- | Read an unsigned number in octal notation.-readOct :: Num a => ReadS a---- | Read an unsigned number in hexadecimal notation. Both upper or lower--- case letters are allowed.-readHex :: Num a => ReadS a---- | Reads an <i>unsigned</i> <a>RealFrac</a> value, expressed in decimal--- scientific notation.-readFloat :: RealFrac a => ReadS a---- | Reads a non-empty string of decimal digits.-lexDigits :: ReadS String---- | Converts a <a>Rational</a> value into any type in class--- <a>RealFloat</a>.-fromRat :: RealFloat a => Rational -> a--module System.IO.Error---- | Errors of type <a>IOError</a> are used by the <a>IO</a> monad. This is--- an abstract type; the module <a>System.IO.Error</a> provides functions--- to interrogate and construct values of type <a>IOError</a>.-type IOError = IOError---- | Construct an <a>IOError</a> value with a string describing the error.--- The <a>fail</a> method of the <a>IO</a> instance of the <a>Monad</a>--- class raises a <a>userError</a>, thus:--- --- <pre>--- instance Monad IO where --- ...--- fail s = ioError (userError s)--- </pre>-userError :: String -> IOError---- | Construct an <a>IOError</a> of the given type where the second--- argument describes the error location and the third and fourth--- argument contain the file handle and file path of the file involved in--- the error if applicable.-mkIOError :: IOErrorType -> String -> Maybe Handle -> Maybe FilePath -> IOError---- | Adds a location description and maybe a file path and file handle to--- an <a>IOError</a>. If any of the file handle or file path is not given--- the corresponding value in the <a>IOError</a> remains unaltered.-annotateIOError :: IOError -> String -> Maybe Handle -> Maybe FilePath -> IOError---- | An error indicating that an <a>IO</a> operation failed because one of--- its arguments already exists.-isAlreadyExistsError :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because one of--- its arguments does not exist.-isDoesNotExistError :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because one of--- its arguments is a single-use resource, which is already being used--- (for example, opening the same file twice for writing might give this--- error).-isAlreadyInUseError :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because the--- device is full.-isFullError :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because the end--- of file has been reached.-isEOFError :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because the--- operation was not possible. Any computation which returns an <a>IO</a>--- result may fail with <a>isIllegalOperation</a>. In some cases, an--- implementation will not be able to distinguish between the possible--- error causes. In this case it should fail with--- <a>isIllegalOperation</a>.-isIllegalOperation :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because the--- user does not have sufficient operating system privilege to perform--- that operation.-isPermissionError :: IOError -> Bool---- | A programmer-defined error value constructed using <a>userError</a>.-isUserError :: IOError -> Bool-ioeGetErrorString :: IOError -> String-ioeGetHandle :: IOError -> Maybe Handle-ioeGetFileName :: IOError -> Maybe FilePath---- | An abstract type that contains a value for each variant of--- <a>IOError</a>.-data IOErrorType :: *---- | I/O error where the operation failed because one of its arguments--- already exists.-alreadyExistsErrorType :: IOErrorType---- | I/O error where the operation failed because one of its arguments does--- not exist.-doesNotExistErrorType :: IOErrorType---- | I/O error where the operation failed because one of its arguments is a--- single-use resource, which is already being used.-alreadyInUseErrorType :: IOErrorType---- | I/O error where the operation failed because the device is full.-fullErrorType :: IOErrorType---- | I/O error where the operation failed because the end of file has been--- reached.-eofErrorType :: IOErrorType---- | I/O error where the operation is not possible.-illegalOperationErrorType :: IOErrorType---- | I/O error where the operation failed because the user does not have--- sufficient operating system privilege to perform that operation.-permissionErrorType :: IOErrorType---- | I/O error that is programmer-defined.-userErrorType :: IOErrorType---- | Raise an <a>IOError</a> in the <a>IO</a> monad.-ioError :: IOError -> IO a---- | The <a>catch</a> function establishes a handler that receives any--- <a>IOError</a> raised in the action protected by <a>catch</a>. An--- <a>IOError</a> is caught by the most recent handler established by--- <a>catch</a>. These handlers are not selective: all <a>IOError</a>s--- are caught. Exception propagation must be explicitly provided in a--- handler by re-raising any unwanted exceptions. For example, in--- --- <pre>--- f = catch g (\e -> if IO.isEOFError e then return [] else ioError e)--- </pre>--- --- the function <tt>f</tt> returns <tt>[]</tt> when an end-of-file--- exception (cf. <a>isEOFError</a>) occurs in <tt>g</tt>; otherwise, the--- exception is propagated to the next outer handler.--- --- When an exception propagates outside the main program, the Haskell--- system prints the associated <a>IOError</a> value and exits the--- program.-catch :: IO a -> (IOError -> IO a) -> IO a---- | The construct <a>try</a> <tt>comp</tt> exposes IO errors which occur--- within a computation, and which are not fully handled.-try :: IO a -> IO (Either IOError a)----- | This module defines bitwise operations for signed and unsigned--- integers.-module Data.Bits---- | The <a>Bits</a> class defines bitwise operations over integral types.--- --- <ul>--- <li>Bits are numbered from 0 with bit 0 being the least significant--- bit.</li>--- </ul>--- --- Minimal complete definition: <a>.&.</a>, <a>.|.</a>, <a>xor</a>,--- <a>complement</a>, (<a>shift</a> or (<a>shiftL</a> and--- <a>shiftR</a>)), (<a>rotate</a> or (<a>rotateL</a> and--- <a>rotateR</a>)), <a>bitSize</a> and <a>isSigned</a>.-class Num a => Bits a-(.&.) :: Bits a => a -> a -> a-(.|.) :: Bits a => a -> a -> a-xor :: Bits a => a -> a -> a-complement :: Bits a => a -> a-shift :: Bits a => a -> Int -> a-rotate :: Bits a => a -> Int -> a-bit :: Bits a => Int -> a-setBit :: Bits a => a -> Int -> a-clearBit :: Bits a => a -> Int -> a-complementBit :: Bits a => a -> Int -> a-testBit :: Bits a => a -> Int -> Bool-bitSize :: Bits a => a -> Int-isSigned :: Bits a => a -> Bool-shiftL :: Bits a => a -> Int -> a-shiftR :: Bits a => a -> Int -> a-rotateL :: Bits a => a -> Int -> a-rotateR :: Bits a => a -> Int -> a--module Foreign.Storable---- | The member functions of this class facilitate writing values of--- primitive types to raw memory (which may have been allocated with the--- above mentioned routines) and reading values from blocks of raw--- memory. The class, furthermore, includes support for computing the--- storage requirements and alignment restrictions of storable types.--- --- Memory addresses are represented as values of type <tt><a>Ptr</a>--- a</tt>, for some <tt>a</tt> which is an instance of class--- <a>Storable</a>. The type argument to <a>Ptr</a> helps provide some--- valuable type safety in FFI code (you can't mix pointers of different--- types without an explicit cast), while helping the Haskell type system--- figure out which marshalling method is needed for a given pointer.--- --- All marshalling between Haskell and a foreign language ultimately--- boils down to translating Haskell data structures into the binary--- representation of a corresponding data structure of the foreign--- language and vice versa. To code this marshalling in Haskell, it is--- necessary to manipulate primitive data types stored in unstructured--- memory blocks. The class <a>Storable</a> facilitates this manipulation--- on all types for which it is instantiated, which are the standard--- basic types of Haskell, the fixed size <tt>Int</tt> types--- (<a>Int8</a>, <a>Int16</a>, <a>Int32</a>, <a>Int64</a>), the fixed--- size <tt>Word</tt> types (<a>Word8</a>, <a>Word16</a>, <a>Word32</a>,--- <a>Word64</a>), <a>StablePtr</a>, all types from--- <a>Foreign.C.Types</a>, as well as <a>Ptr</a>.--- --- Minimal complete definition: <a>sizeOf</a>, <a>alignment</a>, one of--- <a>peek</a>, <a>peekElemOff</a> and <a>peekByteOff</a>, and one of--- <a>poke</a>, <a>pokeElemOff</a> and <a>pokeByteOff</a>.-class Storable a-sizeOf :: Storable a => a -> Int-alignment :: Storable a => a -> Int-peekElemOff :: Storable a => Ptr a -> Int -> IO a-pokeElemOff :: Storable a => Ptr a -> Int -> a -> IO ()-peekByteOff :: Storable a => Ptr b -> Int -> IO a-pokeByteOff :: Storable a => Ptr b -> Int -> a -> IO ()-peek :: Storable a => Ptr a -> IO a-poke :: Storable a => Ptr a -> a -> IO ()--module Foreign.C.Types---- | Haskell type representing the C <tt>char</tt> type.-data CChar :: *---- | Haskell type representing the C <tt>signed char</tt> type.-data CSChar :: *---- | Haskell type representing the C <tt>unsigned char</tt> type.-data CUChar :: *---- | Haskell type representing the C <tt>short</tt> type.-data CShort :: *---- | Haskell type representing the C <tt>unsigned short</tt> type.-data CUShort :: *---- | Haskell type representing the C <tt>int</tt> type.-data CInt :: *---- | Haskell type representing the C <tt>unsigned int</tt> type.-data CUInt :: *---- | Haskell type representing the C <tt>long</tt> type.-data CLong :: *---- | Haskell type representing the C <tt>unsigned long</tt> type.-data CULong :: *---- | Haskell type representing the C <tt>ptrdiff_t</tt> type.-data CPtrdiff :: *---- | Haskell type representing the C <tt>size_t</tt> type.-data CSize :: *---- | Haskell type representing the C <tt>wchar_t</tt> type.-data CWchar :: *---- | Haskell type representing the C <tt>sig_atomic_t</tt> type.-data CSigAtomic :: *---- | Haskell type representing the C <tt>long long</tt> type.-data CLLong :: *---- | Haskell type representing the C <tt>unsigned long long</tt> type.-data CULLong :: *-data CIntPtr :: *-data CUIntPtr :: *-data CIntMax :: *-data CUIntMax :: *---- | Haskell type representing the C <tt>clock_t</tt> type.-data CClock :: *---- | Haskell type representing the C <tt>time_t</tt> type.-data CTime :: *---- | Haskell type representing the C <tt>float</tt> type.-data CFloat :: *---- | Haskell type representing the C <tt>double</tt> type.-data CDouble :: *---- | Haskell type representing the C <tt>FILE</tt> type.-data CFile :: *---- | Haskell type representing the C <tt>fpos_t</tt> type.-data CFpos :: *---- | Haskell type representing the C <tt>jmp_buf</tt> type.-data CJmpBuf :: *--module Foreign.ForeignPtr---- | The type <a>ForeignPtr</a> represents references to objects that are--- maintained in a foreign language, i.e., that are not part of the data--- structures usually managed by the Haskell storage manager. The--- essential difference between <a>ForeignPtr</a>s and vanilla memory--- references of type <tt>Ptr a</tt> is that the former may be associated--- with <i>finalizers</i>. A finalizer is a routine that is invoked when--- the Haskell storage manager detects that - within the Haskell heap and--- stack - there are no more references left that are pointing to the--- <a>ForeignPtr</a>. Typically, the finalizer will, then, invoke--- routines in the foreign language that free the resources bound by the--- foreign object.--- --- The <a>ForeignPtr</a> is parameterised in the same way as <a>Ptr</a>.--- The type argument of <a>ForeignPtr</a> should normally be an instance--- of class <a>Storable</a>.-data ForeignPtr a :: * -> *---- | A finalizer is represented as a pointer to a foreign function that, at--- finalisation time, gets as an argument a plain pointer variant of the--- foreign pointer that the finalizer is associated with.-type FinalizerPtr a = FunPtr (Ptr a -> IO ())-type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> IO ())---- | Turns a plain memory reference into a foreign pointer, and associates--- a finalizer with the reference. The finalizer will be executed after--- the last reference to the foreign object is dropped. There is no--- guarantee of promptness, however the finalizer will be executed before--- the program exits.-newForeignPtr :: FinalizerPtr a -> Ptr a -> IO (ForeignPtr a)---- | Turns a plain memory reference into a foreign pointer that may be--- associated with finalizers by using <a>addForeignPtrFinalizer</a>.-newForeignPtr_ :: Ptr a -> IO (ForeignPtr a)---- | This function adds a finalizer to the given foreign object. The--- finalizer will run <i>before</i> all other finalizers for the same--- object which have already been registered.-addForeignPtrFinalizer :: FinalizerPtr a -> ForeignPtr a -> IO ()---- | This variant of <a>newForeignPtr</a> adds a finalizer that expects an--- environment in addition to the finalized pointer. The environment that--- will be passed to the finalizer is fixed by the second argument to--- <a>newForeignPtrEnv</a>.-newForeignPtrEnv :: FinalizerEnvPtr env a -> Ptr env -> Ptr a -> IO (ForeignPtr a)---- | Like <a>addForeignPtrFinalizerEnv</a> but allows the finalizer to be--- passed an additional environment parameter to be passed to the--- finalizer. The environment passed to the finalizer is fixed by the--- second argument to <a>addForeignPtrFinalizerEnv</a>-addForeignPtrFinalizerEnv :: FinalizerEnvPtr env a -> Ptr env -> ForeignPtr a -> IO ()---- | This is a way to look at the pointer living inside a foreign object.--- This function takes a function which is applied to that pointer. The--- resulting <a>IO</a> action is then executed. The foreign object is--- kept alive at least during the whole action, even if it is not used--- directly inside. Note that it is not safe to return the pointer from--- the action and use it after the action completes. All uses of the--- pointer should be inside the <a>withForeignPtr</a> bracket. The reason--- for this unsafeness is the same as for <a>unsafeForeignPtrToPtr</a>--- below: the finalizer may run earlier than expected, because the--- compiler can only track usage of the <a>ForeignPtr</a> object, not a--- <a>Ptr</a> object made from it.--- --- This function is normally used for marshalling data to or from the--- object pointed to by the <a>ForeignPtr</a>, using the operations from--- the <a>Storable</a> class.-withForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b---- | Causes the finalizers associated with a foreign pointer to be run--- immediately.-finalizeForeignPtr :: ForeignPtr a -> IO ()---- | This function extracts the pointer component of a foreign pointer.--- This is a potentially dangerous operations, as if the argument to--- <a>unsafeForeignPtrToPtr</a> is the last usage occurrence of the given--- foreign pointer, then its finalizer(s) will be run, which potentially--- invalidates the plain pointer just obtained. Hence,--- <a>touchForeignPtr</a> must be used wherever it has to be guaranteed--- that the pointer lives on - i.e., has another usage occurrence.--- --- To avoid subtle coding errors, hand written marshalling code should--- preferably use <tt>Foreign.ForeignPtr.withForeignPtr</tt> rather than--- combinations of <a>unsafeForeignPtrToPtr</a> and--- <a>touchForeignPtr</a>. However, the latter routines are occasionally--- preferred in tool generated marshalling code.-unsafeForeignPtrToPtr :: ForeignPtr a -> Ptr a---- | This function ensures that the foreign object in question is alive at--- the given place in the sequence of IO actions. In particular--- <a>withForeignPtr</a> does a <a>touchForeignPtr</a> after it executes--- the user action.--- --- Note that this function should not be used to express dependencies--- between finalizers on <a>ForeignPtr</a>s. For example, if the--- finalizer for a <a>ForeignPtr</a> <tt>F1</tt> calls--- <a>touchForeignPtr</a> on a second <a>ForeignPtr</a> <tt>F2</tt>, then--- the only guarantee is that the finalizer for <tt>F2</tt> is never--- started before the finalizer for <tt>F1</tt>. They might be started--- together if for example both <tt>F1</tt> and <tt>F2</tt> are otherwise--- unreachable.--- --- In general, it is not recommended to use finalizers on separate--- objects with ordering constraints between them. To express the--- ordering robustly requires explicit synchronisation between--- finalizers.-touchForeignPtr :: ForeignPtr a -> IO ()---- | This function casts a <a>ForeignPtr</a> parameterised by one type into--- another type.-castForeignPtr :: ForeignPtr a -> ForeignPtr b---- | Allocate some memory and return a <a>ForeignPtr</a> to it. The memory--- will be released automatically when the <a>ForeignPtr</a> is--- discarded.--- --- <a>mallocForeignPtr</a> is equivalent to--- --- <pre>--- do { p <- malloc; newForeignPtr finalizerFree p }--- </pre>--- --- although it may be implemented differently internally: you may not--- assume that the memory returned by <a>mallocForeignPtr</a> has been--- allocated with <tt>Foreign.Marshal.Alloc.malloc</tt>.-mallocForeignPtr :: Storable a => IO (ForeignPtr a)---- | This function is similar to <a>mallocForeignPtr</a>, except that the--- size of the memory required is given explicitly as a number of bytes.-mallocForeignPtrBytes :: Int -> IO (ForeignPtr a)---- | This function is similar to--- <tt>Foreign.Marshal.Array.mallocArray</tt>, but yields a memory area--- that has a finalizer attached that releases the memory area. As with--- <a>mallocForeignPtr</a>, it is not guaranteed that the block of memory--- was allocated by <tt>Foreign.Marshal.Alloc.malloc</tt>.-mallocForeignPtrArray :: Storable a => Int -> IO (ForeignPtr a)---- | This function is similar to--- <tt>Foreign.Marshal.Array.mallocArray0</tt>, but yields a memory area--- that has a finalizer attached that releases the memory area. As with--- <a>mallocForeignPtr</a>, it is not guaranteed that the block of memory--- was allocated by <tt>Foreign.Marshal.Alloc.malloc</tt>.-mallocForeignPtrArray0 :: Storable a => Int -> IO (ForeignPtr a)--module System.Exit---- | Defines the exit codes that a program can return.-data ExitCode :: *---- | indicates successful termination;-ExitSuccess :: ExitCode---- | indicates program failure with an exit code. The exact interpretation--- of the code is operating-system dependent. In particular, some values--- may be prohibited (e.g. 0 on a POSIX-compliant system).-ExitFailure :: Int -> ExitCode---- | Computation <tt><a>exitWith</a> code</tt> terminates the program,--- returning <tt>code</tt> to the program's caller. The caller may--- interpret the return code as it wishes, but the program should return--- <a>ExitSuccess</a> to mean normal completion, and--- <tt><a>ExitFailure</a> n</tt> to mean that the program encountered a--- problem from which it could not recover. The value <a>exitFailure</a>--- is equal to <tt><a>exitWith</a> (<a>ExitFailure</a> exitfail)</tt>,--- where <tt>exitfail</tt> is implementation-dependent. <a>exitWith</a>--- bypasses the error handling in the I/O monad and cannot be intercepted--- by <a>catch</a> from the <tt>Prelude</tt>.-exitWith :: ExitCode -> IO a---- | The computation <a>exitFailure</a> is equivalent to <a>exitWith</a>--- <tt>(</tt><a>ExitFailure</a> <i>exitfail</i><tt>)</tt>, where--- <i>exitfail</i> is implementation-dependent.-exitFailure :: IO a---- | The computation <a>exitSuccess</a> is equivalent to <a>exitWith</a>--- <a>ExitSuccess</a>, It terminates the program successfully.-exitSuccess :: IO a--module Foreign.Marshal.Error---- | Execute an <a>IO</a> action, throwing a <a>userError</a> if the--- predicate yields <a>True</a> when applied to the result returned by--- the <a>IO</a> action. If no exception is raised, return the result of--- the computation.-throwIf :: (a -> Bool) -> (a -> String) -> IO a -> IO a---- | Like <a>throwIf</a>, but discarding the result-throwIf_ :: (a -> Bool) -> (a -> String) -> IO a -> IO ()---- | Guards against negative result values-throwIfNeg :: (Ord a, Num a) => (a -> String) -> IO a -> IO a---- | Like <a>throwIfNeg</a>, but discarding the result-throwIfNeg_ :: (Ord a, Num a) => (a -> String) -> IO a -> IO ()---- | Guards against null pointers-throwIfNull :: String -> IO (Ptr a) -> IO (Ptr a)---- | Discard the return value of an <a>IO</a> action-void :: IO a -> IO ()----- | The module <a>Foreign.Marshal.Alloc</a> provides operations to--- allocate and deallocate blocks of raw memory (i.e., unstructured--- chunks of memory outside of the area maintained by the Haskell storage--- manager). These memory blocks are commonly used to pass compound data--- structures to foreign functions or to provide space in which compound--- result values are obtained from foreign functions.--- --- If any of the allocation functions fails, a value of <tt>nullPtr</tt>--- is produced. If <a>free</a> or <a>reallocBytes</a> is applied to a--- memory area that has been allocated with <a>alloca</a> or--- <a>allocaBytes</a>, the behaviour is undefined. Any further access to--- memory areas allocated with <a>alloca</a> or <a>allocaBytes</a>, after--- the computation that was passed to the allocation function has--- terminated, leads to undefined behaviour. Any further access to the--- memory area referenced by a pointer passed to <a>realloc</a>,--- <a>reallocBytes</a>, or <a>free</a> entails undefined behaviour.--- --- All storage allocated by functions that allocate based on a <i>size in--- bytes</i> must be sufficiently aligned for any of the basic foreign--- types that fits into the newly allocated storage. All storage--- allocated by functions that allocate based on a specific type must be--- sufficiently aligned for that type. Array allocation routines need to--- obey the same alignment constraints for each array element.-module Foreign.Marshal.Alloc---- | <tt><a>alloca</a> f</tt> executes the computation <tt>f</tt>, passing--- as argument a pointer to a temporarily allocated block of memory--- sufficient to hold values of type <tt>a</tt>.--- --- The memory is freed when <tt>f</tt> terminates (either normally or via--- an exception), so the pointer passed to <tt>f</tt> must <i>not</i> be--- used after this.-alloca :: Storable a => (Ptr a -> IO b) -> IO b---- | <tt><a>allocaBytes</a> n f</tt> executes the computation <tt>f</tt>,--- passing as argument a pointer to a temporarily allocated block of--- memory of <tt>n</tt> bytes. The block of memory is sufficiently--- aligned for any of the basic foreign types that fits into a memory--- block of the allocated size.--- --- The memory is freed when <tt>f</tt> terminates (either normally or via--- an exception), so the pointer passed to <tt>f</tt> must <i>not</i> be--- used after this.-allocaBytes :: Int -> (Ptr a -> IO b) -> IO b---- | Allocate a block of memory that is sufficient to hold values of type--- <tt>a</tt>. The size of the area allocated is determined by the--- <a>sizeOf</a> method from the instance of <a>Storable</a> for the--- appropriate type.--- --- The memory may be deallocated using <a>free</a> or--- <a>finalizerFree</a> when no longer required.-malloc :: Storable a => IO (Ptr a)---- | Allocate a block of memory of the given number of bytes. The block of--- memory is sufficiently aligned for any of the basic foreign types that--- fits into a memory block of the allocated size.--- --- The memory may be deallocated using <a>free</a> or--- <a>finalizerFree</a> when no longer required.-mallocBytes :: Int -> IO (Ptr a)---- | Resize a memory area that was allocated with <a>malloc</a> or--- <a>mallocBytes</a> to the size needed to store values of type--- <tt>b</tt>. The returned pointer may refer to an entirely different--- memory area, but will be suitably aligned to hold values of type--- <tt>b</tt>. The contents of the referenced memory area will be the--- same as of the original pointer up to the minimum of the original size--- and the size of values of type <tt>b</tt>.--- --- If the argument to <a>realloc</a> is <a>nullPtr</a>, <a>realloc</a>--- behaves like <a>malloc</a>.-realloc :: Storable b => Ptr a -> IO (Ptr b)---- | Resize a memory area that was allocated with <a>malloc</a> or--- <a>mallocBytes</a> to the given size. The returned pointer may refer--- to an entirely different memory area, but will be sufficiently aligned--- for any of the basic foreign types that fits into a memory block of--- the given size. The contents of the referenced memory area will be the--- same as of the original pointer up to the minimum of the original size--- and the given size.--- --- If the pointer argument to <a>reallocBytes</a> is <a>nullPtr</a>,--- <a>reallocBytes</a> behaves like <a>malloc</a>. If the requested size--- is 0, <a>reallocBytes</a> behaves like <a>free</a>.-reallocBytes :: Ptr a -> Int -> IO (Ptr a)---- | Free a block of memory that was allocated with <a>malloc</a>,--- <a>mallocBytes</a>, <a>realloc</a>, <a>reallocBytes</a>,--- <tt>Foreign.Marshal.Utils.new</tt> or any of the <tt>new</tt><i>X</i>--- functions in <a>Foreign.Marshal.Array</a> or <a>Foreign.C.String</a>.-free :: Ptr a -> IO ()---- | A pointer to a foreign function equivalent to <a>free</a>, which may--- be used as a finalizer (cf <tt>Foreign.ForeignPtr.ForeignPtr</tt>) for--- storage allocated with <a>malloc</a>, <a>mallocBytes</a>,--- <a>realloc</a> or <a>reallocBytes</a>.-finalizerFree :: FinalizerPtr a--module Foreign.Marshal.Utils---- | <tt><a>with</a> val f</tt> executes the computation <tt>f</tt>,--- passing as argument a pointer to a temporarily allocated block of--- memory into which <tt>val</tt> has been marshalled (the combination of--- <a>alloca</a> and <a>poke</a>).--- --- The memory is freed when <tt>f</tt> terminates (either normally or via--- an exception), so the pointer passed to <tt>f</tt> must <i>not</i> be--- used after this.-with :: Storable a => a -> (Ptr a -> IO b) -> IO b---- | Allocate a block of memory and marshal a value into it (the--- combination of <a>malloc</a> and <a>poke</a>). The size of the area--- allocated is determined by the <tt>Foreign.Storable.sizeOf</tt> method--- from the instance of <a>Storable</a> for the appropriate type.--- --- The memory may be deallocated using--- <tt>Foreign.Marshal.Alloc.free</tt> or--- <tt>Foreign.Marshal.Alloc.finalizerFree</tt> when no longer required.-new :: Storable a => a -> IO (Ptr a)---- | Convert a Haskell <a>Bool</a> to its numeric representation-fromBool :: Num a => Bool -> a---- | Convert a Boolean in numeric representation to a Haskell value-toBool :: Num a => a -> Bool---- | Allocate storage and marshal a storable value wrapped into a--- <a>Maybe</a>--- --- <ul>--- <li>the <a>nullPtr</a> is used to represent <a>Nothing</a></li>--- </ul>-maybeNew :: (a -> IO (Ptr a)) -> Maybe a -> IO (Ptr a)---- | Converts a <tt>withXXX</tt> combinator into one marshalling a value--- wrapped into a <a>Maybe</a>, using <a>nullPtr</a> to represent--- <a>Nothing</a>.-maybeWith :: (a -> (Ptr b -> IO c) -> IO c) -> Maybe a -> (Ptr b -> IO c) -> IO c---- | Convert a peek combinator into a one returning <a>Nothing</a> if--- applied to a <a>nullPtr</a>-maybePeek :: (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)---- | Replicates a <tt>withXXX</tt> combinator over a list of objects,--- yielding a list of marshalled objects-withMany :: (a -> (b -> res) -> res) -> [a] -> ([b] -> res) -> res---- | Copies the given number of bytes from the second area (source) into--- the first (destination); the copied areas may <i>not</i> overlap-copyBytes :: Ptr a -> Ptr a -> Int -> IO ()---- | Copies the given number of bytes from the second area (source) into--- the first (destination); the copied areas <i>may</i> overlap-moveBytes :: Ptr a -> Ptr a -> Int -> IO ()----- | The module <a>Foreign.Marshal.Array</a> provides operations for--- marshalling Haskell lists into monolithic arrays and vice versa. Most--- functions come in two flavours: one for arrays terminated by a special--- termination element and one where an explicit length parameter is used--- to determine the extent of an array. The typical example for the--- former case are C's NUL terminated strings. However, please note that--- C strings should usually be marshalled using the functions provided by--- <a>Foreign.C.String</a> as the Unicode encoding has to be taken into--- account. All functions specifically operating on arrays that are--- terminated by a special termination element have a name ending on--- <tt>0</tt>---e.g., <a>mallocArray</a> allocates space for an array of--- the given size, whereas <a>mallocArray0</a> allocates space for one--- more element to ensure that there is room for the terminator.-module Foreign.Marshal.Array---- | Allocate storage for the given number of elements of a storable type--- (like <tt>Foreign.Marshal.Alloc.malloc</tt>, but for multiple--- elements).-mallocArray :: Storable a => Int -> IO (Ptr a)---- | Like <a>mallocArray</a>, but add an extra position to hold a special--- termination element.-mallocArray0 :: Storable a => Int -> IO (Ptr a)---- | Temporarily allocate space for the given number of elements (like--- <tt>Foreign.Marshal.Alloc.alloca</tt>, but for multiple elements).-allocaArray :: Storable a => Int -> (Ptr a -> IO b) -> IO b---- | Like <a>allocaArray</a>, but add an extra position to hold a special--- termination element.-allocaArray0 :: Storable a => Int -> (Ptr a -> IO b) -> IO b---- | Adjust the size of an array-reallocArray :: Storable a => Ptr a -> Int -> IO (Ptr a)---- | Adjust the size of an array including an extra position for the end--- marker.-reallocArray0 :: Storable a => Ptr a -> Int -> IO (Ptr a)---- | Convert an array of given length into a Haskell list.-peekArray :: Storable a => Int -> Ptr a -> IO [a]---- | Convert an array terminated by the given end marker into a Haskell--- list-peekArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO [a]---- | Write the list elements consecutive into memory-pokeArray :: Storable a => Ptr a -> [a] -> IO ()---- | Write the list elements consecutive into memory and terminate them--- with the given marker element-pokeArray0 :: Storable a => a -> Ptr a -> [a] -> IO ()---- | Write a list of storable elements into a newly allocated, consecutive--- sequence of storable values (like <tt>Foreign.Marshal.Utils.new</tt>,--- but for multiple elements).-newArray :: Storable a => [a] -> IO (Ptr a)---- | Write a list of storable elements into a newly allocated, consecutive--- sequence of storable values, where the end is fixed by the given end--- marker-newArray0 :: Storable a => a -> [a] -> IO (Ptr a)---- | Temporarily store a list of storable values in memory (like--- <tt>Foreign.Marshal.Utils.with</tt>, but for multiple elements).-withArray :: Storable a => [a] -> (Ptr a -> IO b) -> IO b---- | Like <a>withArray</a>, but a terminator indicates where the array ends-withArray0 :: Storable a => a -> [a] -> (Ptr a -> IO b) -> IO b---- | Like <a>withArray</a>, but the action gets the number of values as an--- additional parameter-withArrayLen :: Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b---- | Like <a>withArrayLen</a>, but a terminator indicates where the array--- ends-withArrayLen0 :: Storable a => a -> [a] -> (Int -> Ptr a -> IO b) -> IO b---- | Copy the given number of elements from the second array (source) into--- the first array (destination); the copied areas may <i>not</i> overlap-copyArray :: Storable a => Ptr a -> Ptr a -> Int -> IO ()---- | Copy the given number of elements from the second array (source) into--- the first array (destination); the copied areas <i>may</i> overlap-moveArray :: Storable a => Ptr a -> Ptr a -> Int -> IO ()---- | Return the number of elements in an array, excluding the terminator-lengthArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO Int---- | Advance a pointer into an array by the given number of elements-advancePtr :: Storable a => Ptr a -> Int -> Ptr a----- | Utilities for primitive marshalling of C strings.--- --- The marshalling converts each Haskell character, representing a--- Unicode code point, to one or more bytes in a manner that, by default,--- is determined by the current locale. As a consequence, no guarantees--- can be made about the relative length of a Haskell string and its--- corresponding C string, and therefore all the marshalling routines--- include memory allocation. The translation between Unicode and the--- encoding of the current locale may be lossy.-module Foreign.C.String---- | A C string is a reference to an array of C characters terminated by--- NUL.-type CString = Ptr CChar---- | A string with explicit length information in bytes instead of a--- terminating NUL (allowing NUL characters in the middle of the string).-type CStringLen = (Ptr CChar, Int)---- | Marshal a NUL terminated C string into a Haskell string.-peekCString :: CString -> IO String---- | Marshal a C string with explicit length into a Haskell string.-peekCStringLen :: CStringLen -> IO String---- | Marshal a Haskell string into a NUL terminated C string.--- --- <ul>--- <li>the Haskell string may <i>not</i> contain any NUL characters</li>--- <li>new storage is allocated for the C string and must be explicitly--- freed using <tt>Foreign.Marshal.Alloc.free</tt> or--- <tt>Foreign.Marshal.Alloc.finalizerFree</tt>.</li>--- </ul>-newCString :: String -> IO CString---- | Marshal a Haskell string into a C string (ie, character array) with--- explicit length information.--- --- <ul>--- <li>new storage is allocated for the C string and must be explicitly--- freed using <tt>Foreign.Marshal.Alloc.free</tt> or--- <tt>Foreign.Marshal.Alloc.finalizerFree</tt>.</li>--- </ul>-newCStringLen :: String -> IO CStringLen---- | Marshal a Haskell string into a NUL terminated C string using--- temporary storage.--- --- <ul>--- <li>the Haskell string may <i>not</i> contain any NUL characters</li>--- <li>the memory is freed when the subcomputation terminates (either--- normally or via an exception), so the pointer to the temporary storage--- must <i>not</i> be used after this.</li>--- </ul>-withCString :: String -> (CString -> IO a) -> IO a---- | Marshal a Haskell string into a C string (ie, character array) in--- temporary storage, with explicit length information.--- --- <ul>--- <li>the memory is freed when the subcomputation terminates (either--- normally or via an exception), so the pointer to the temporary storage--- must <i>not</i> be used after this.</li>--- </ul>-withCStringLen :: String -> (CStringLen -> IO a) -> IO a---- | Determines whether a character can be accurately encoded in a--- <a>CString</a>. Unrepresentable characters are converted to--- <tt>'?'</tt>.--- --- Currently only Latin-1 characters are representable.-charIsRepresentable :: Char -> IO Bool---- | Convert a Haskell character to a C character. This function is only--- safe on the first 256 characters.-castCharToCChar :: Char -> CChar---- | Convert a C byte, representing a Latin-1 character, to the--- corresponding Haskell character.-castCCharToChar :: CChar -> Char---- | Convert a Haskell character to a C <tt>unsigned char</tt>. This--- function is only safe on the first 256 characters.-castCharToCUChar :: Char -> CUChar---- | Convert a C <tt>unsigned char</tt>, representing a Latin-1 character,--- to the corresponding Haskell character.-castCUCharToChar :: CUChar -> Char---- | Convert a Haskell character to a C <tt>signed char</tt>. This function--- is only safe on the first 256 characters.-castCharToCSChar :: Char -> CSChar---- | Convert a C <tt>signed char</tt>, representing a Latin-1 character, to--- the corresponding Haskell character.-castCSCharToChar :: CSChar -> Char---- | Marshal a NUL terminated C string into a Haskell string.-peekCAString :: CString -> IO String---- | Marshal a C string with explicit length into a Haskell string.-peekCAStringLen :: CStringLen -> IO String---- | Marshal a Haskell string into a NUL terminated C string.--- --- <ul>--- <li>the Haskell string may <i>not</i> contain any NUL characters</li>--- <li>new storage is allocated for the C string and must be explicitly--- freed using <tt>Foreign.Marshal.Alloc.free</tt> or--- <tt>Foreign.Marshal.Alloc.finalizerFree</tt>.</li>--- </ul>-newCAString :: String -> IO CString---- | Marshal a Haskell string into a C string (ie, character array) with--- explicit length information.--- --- <ul>--- <li>new storage is allocated for the C string and must be explicitly--- freed using <tt>Foreign.Marshal.Alloc.free</tt> or--- <tt>Foreign.Marshal.Alloc.finalizerFree</tt>.</li>--- </ul>-newCAStringLen :: String -> IO CStringLen---- | Marshal a Haskell string into a NUL terminated C string using--- temporary storage.--- --- <ul>--- <li>the Haskell string may <i>not</i> contain any NUL characters</li>--- <li>the memory is freed when the subcomputation terminates (either--- normally or via an exception), so the pointer to the temporary storage--- must <i>not</i> be used after this.</li>--- </ul>-withCAString :: String -> (CString -> IO a) -> IO a---- | Marshal a Haskell string into a C string (ie, character array) in--- temporary storage, with explicit length information.--- --- <ul>--- <li>the memory is freed when the subcomputation terminates (either--- normally or via an exception), so the pointer to the temporary storage--- must <i>not</i> be used after this.</li>--- </ul>-withCAStringLen :: String -> (CStringLen -> IO a) -> IO a---- | A C wide string is a reference to an array of C wide characters--- terminated by NUL.-type CWString = Ptr CWchar---- | A wide character string with explicit length information in--- <a>CWchar</a>s instead of a terminating NUL (allowing NUL characters--- in the middle of the string).-type CWStringLen = (Ptr CWchar, Int)---- | Marshal a NUL terminated C wide string into a Haskell string.-peekCWString :: CWString -> IO String---- | Marshal a C wide string with explicit length into a Haskell string.-peekCWStringLen :: CWStringLen -> IO String---- | Marshal a Haskell string into a NUL terminated C wide string.--- --- <ul>--- <li>the Haskell string may <i>not</i> contain any NUL characters</li>--- <li>new storage is allocated for the C wide string and must be--- explicitly freed using <tt>Foreign.Marshal.Alloc.free</tt> or--- <tt>Foreign.Marshal.Alloc.finalizerFree</tt>.</li>--- </ul>-newCWString :: String -> IO CWString---- | Marshal a Haskell string into a C wide string (ie, wide character--- array) with explicit length information.--- --- <ul>--- <li>new storage is allocated for the C wide string and must be--- explicitly freed using <tt>Foreign.Marshal.Alloc.free</tt> or--- <tt>Foreign.Marshal.Alloc.finalizerFree</tt>.</li>--- </ul>-newCWStringLen :: String -> IO CWStringLen---- | Marshal a Haskell string into a NUL terminated C wide string using--- temporary storage.--- --- <ul>--- <li>the Haskell string may <i>not</i> contain any NUL characters</li>--- <li>the memory is freed when the subcomputation terminates (either--- normally or via an exception), so the pointer to the temporary storage--- must <i>not</i> be used after this.</li>--- </ul>-withCWString :: String -> (CWString -> IO a) -> IO a---- | Marshal a Haskell string into a NUL terminated C wide string using--- temporary storage.--- --- <ul>--- <li>the Haskell string may <i>not</i> contain any NUL characters</li>--- <li>the memory is freed when the subcomputation terminates (either--- normally or via an exception), so the pointer to the temporary storage--- must <i>not</i> be used after this.</li>--- </ul>-withCWStringLen :: String -> (CWStringLen -> IO a) -> IO a----- | The module <a>Foreign.C.Error</a> facilitates C-specific error--- handling of <tt>errno</tt>.-module Foreign.C.Error---- | Haskell representation for <tt>errno</tt> values. The implementation--- is deliberately exposed, to allow users to add their own definitions--- of <a>Errno</a> values.-newtype Errno :: *-Errno :: CInt -> Errno-eOK :: Errno-e2BIG :: Errno-eACCES :: Errno-eADDRINUSE :: Errno-eADDRNOTAVAIL :: Errno-eADV :: Errno-eAFNOSUPPORT :: Errno-eAGAIN :: Errno-eALREADY :: Errno-eBADF :: Errno-eBADMSG :: Errno-eBADRPC :: Errno-eBUSY :: Errno-eCHILD :: Errno-eCOMM :: Errno-eCONNABORTED :: Errno-eCONNREFUSED :: Errno-eCONNRESET :: Errno-eDEADLK :: Errno-eDESTADDRREQ :: Errno-eDIRTY :: Errno-eDOM :: Errno-eDQUOT :: Errno-eEXIST :: Errno-eFAULT :: Errno-eFBIG :: Errno-eFTYPE :: Errno-eHOSTDOWN :: Errno-eHOSTUNREACH :: Errno-eIDRM :: Errno-eILSEQ :: Errno-eINPROGRESS :: Errno-eINTR :: Errno-eINVAL :: Errno-eIO :: Errno-eISCONN :: Errno-eISDIR :: Errno-eLOOP :: Errno-eMFILE :: Errno-eMLINK :: Errno-eMSGSIZE :: Errno-eMULTIHOP :: Errno-eNAMETOOLONG :: Errno-eNETDOWN :: Errno-eNETRESET :: Errno-eNETUNREACH :: Errno-eNFILE :: Errno-eNOBUFS :: Errno-eNODATA :: Errno-eNODEV :: Errno-eNOENT :: Errno-eNOEXEC :: Errno-eNOLCK :: Errno-eNOLINK :: Errno-eNOMEM :: Errno-eNOMSG :: Errno-eNONET :: Errno-eNOPROTOOPT :: Errno-eNOSPC :: Errno-eNOSR :: Errno-eNOSTR :: Errno-eNOSYS :: Errno-eNOTBLK :: Errno-eNOTCONN :: Errno-eNOTDIR :: Errno-eNOTEMPTY :: Errno-eNOTSOCK :: Errno-eNOTTY :: Errno-eNXIO :: Errno-eOPNOTSUPP :: Errno-ePERM :: Errno-ePFNOSUPPORT :: Errno-ePIPE :: Errno-ePROCLIM :: Errno-ePROCUNAVAIL :: Errno-ePROGMISMATCH :: Errno-ePROGUNAVAIL :: Errno-ePROTO :: Errno-ePROTONOSUPPORT :: Errno-ePROTOTYPE :: Errno-eRANGE :: Errno-eREMCHG :: Errno-eREMOTE :: Errno-eROFS :: Errno-eRPCMISMATCH :: Errno-eRREMOTE :: Errno-eSHUTDOWN :: Errno-eSOCKTNOSUPPORT :: Errno-eSPIPE :: Errno-eSRCH :: Errno-eSRMNT :: Errno-eSTALE :: Errno-eTIME :: Errno-eTIMEDOUT :: Errno-eTOOMANYREFS :: Errno-eTXTBSY :: Errno-eUSERS :: Errno-eWOULDBLOCK :: Errno-eXDEV :: Errno---- | Yield <a>True</a> if the given <a>Errno</a> value is valid on the--- system. This implies that the <a>Eq</a> instance of <a>Errno</a> is--- also system dependent as it is only defined for valid values of--- <a>Errno</a>.-isValidErrno :: Errno -> Bool---- | Get the current value of <tt>errno</tt> in the current thread.-getErrno :: IO Errno---- | Reset the current thread's <tt>errno</tt> value to <a>eOK</a>.-resetErrno :: IO ()---- | Construct an <a>IOError</a> based on the given <a>Errno</a> value. The--- optional information can be used to improve the accuracy of error--- messages.-errnoToIOError :: String -> Errno -> Maybe Handle -> Maybe String -> IOError---- | Throw an <a>IOError</a> corresponding to the current value of--- <a>getErrno</a>.-throwErrno :: String -> IO a---- | Throw an <a>IOError</a> corresponding to the current value of--- <a>getErrno</a> if the result value of the <a>IO</a> action meets the--- given predicate.-throwErrnoIf :: (a -> Bool) -> String -> IO a -> IO a---- | as <a>throwErrnoIf</a>, but discards the result of the <a>IO</a>--- action after error handling.-throwErrnoIf_ :: (a -> Bool) -> String -> IO a -> IO ()---- | as <a>throwErrnoIf</a>, but retry the <a>IO</a> action when it yields--- the error code <a>eINTR</a> - this amounts to the standard retry loop--- for interrupted POSIX system calls.-throwErrnoIfRetry :: (a -> Bool) -> String -> IO a -> IO a---- | as <a>throwErrnoIfRetry</a>, but discards the result.-throwErrnoIfRetry_ :: (a -> Bool) -> String -> IO a -> IO ()---- | Throw an <a>IOError</a> corresponding to the current value of--- <a>getErrno</a> if the <a>IO</a> action returns a result of--- <tt>-1</tt>.-throwErrnoIfMinus1 :: Num a => String -> IO a -> IO a---- | as <a>throwErrnoIfMinus1</a>, but discards the result.-throwErrnoIfMinus1_ :: Num a => String -> IO a -> IO ()---- | Throw an <a>IOError</a> corresponding to the current value of--- <a>getErrno</a> if the <a>IO</a> action returns a result of--- <tt>-1</tt>, but retries in case of an interrupted operation.-throwErrnoIfMinus1Retry :: Num a => String -> IO a -> IO a---- | as <a>throwErrnoIfMinus1</a>, but discards the result.-throwErrnoIfMinus1Retry_ :: Num a => String -> IO a -> IO ()---- | Throw an <a>IOError</a> corresponding to the current value of--- <a>getErrno</a> if the <a>IO</a> action returns <a>nullPtr</a>.-throwErrnoIfNull :: String -> IO (Ptr a) -> IO (Ptr a)---- | Throw an <a>IOError</a> corresponding to the current value of--- <a>getErrno</a> if the <a>IO</a> action returns <a>nullPtr</a>, but--- retry in case of an interrupted operation.-throwErrnoIfNullRetry :: String -> IO (Ptr a) -> IO (Ptr a)---- | as <a>throwErrnoIfRetry</a>, but additionally if the operation yields--- the error code <a>eAGAIN</a> or <a>eWOULDBLOCK</a>, an alternative--- action is executed before retrying.-throwErrnoIfRetryMayBlock :: (a -> Bool) -> String -> IO a -> IO b -> IO a---- | as <a>throwErrnoIfRetryMayBlock</a>, but discards the result.-throwErrnoIfRetryMayBlock_ :: (a -> Bool) -> String -> IO a -> IO b -> IO ()---- | as <a>throwErrnoIfMinus1Retry</a>, but checks for operations that--- would block.-throwErrnoIfMinus1RetryMayBlock :: Num a => String -> IO a -> IO b -> IO a---- | as <a>throwErrnoIfMinus1RetryMayBlock</a>, but discards the result.-throwErrnoIfMinus1RetryMayBlock_ :: Num a => String -> IO a -> IO b -> IO ()---- | as <a>throwErrnoIfNullRetry</a>, but checks for operations that would--- block.-throwErrnoIfNullRetryMayBlock :: String -> IO (Ptr a) -> IO b -> IO (Ptr a)---- | as <a>throwErrno</a>, but exceptions include the given path when--- appropriate.-throwErrnoPath :: String -> FilePath -> IO a---- | as <a>throwErrnoIf</a>, but exceptions include the given path when--- appropriate.-throwErrnoPathIf :: (a -> Bool) -> String -> FilePath -> IO a -> IO a---- | as <a>throwErrnoIf_</a>, but exceptions include the given path when--- appropriate.-throwErrnoPathIf_ :: (a -> Bool) -> String -> FilePath -> IO a -> IO ()---- | as <a>throwErrnoIfNull</a>, but exceptions include the given path when--- appropriate.-throwErrnoPathIfNull :: String -> FilePath -> IO (Ptr a) -> IO (Ptr a)---- | as <a>throwErrnoIfMinus1</a>, but exceptions include the given path--- when appropriate.-throwErrnoPathIfMinus1 :: Num a => String -> FilePath -> IO a -> IO a---- | as <a>throwErrnoIfMinus1_</a>, but exceptions include the given path--- when appropriate.-throwErrnoPathIfMinus1_ :: Num a => String -> FilePath -> IO a -> IO ()--module Foreign.Marshal---- | Sometimes an external entity is a pure function, except that it passes--- arguments and/or results via pointers. The function--- <tt>unsafeLocalState</tt> permits the packaging of such entities as--- pure functions.--- --- The only IO operations allowed in the IO action passed to--- <tt>unsafeLocalState</tt> are (a) local allocation (<tt>alloca</tt>,--- <tt>allocaBytes</tt> and derived operations such as <tt>withArray</tt>--- and <tt>withCString</tt>), and (b) pointer operations--- (<tt>Foreign.Storable</tt> and <tt>Foreign.Ptr</tt>) on the pointers--- to local storage, and (c) foreign functions whose only observable--- effect is to read and/or write the locally allocated memory. Passing--- an IO operation that does not obey these rules results in undefined--- behaviour.--- --- It is expected that this operation will be replaced in a future--- revision of Haskell.-unsafeLocalState :: IO a -> a--module Data.Complex---- | Complex numbers are an algebraic type.--- --- For a complex number <tt>z</tt>, <tt><a>abs</a> z</tt> is a number--- with the magnitude of <tt>z</tt>, but oriented in the positive real--- direction, whereas <tt><a>signum</a> z</tt> has the phase of--- <tt>z</tt>, but unit magnitude.-data RealFloat a => Complex a :: * -> *---- | forms a complex number from its real and imaginary rectangular--- components.-(:+) :: !a -> !a -> Complex a---- | Extracts the real part of a complex number.-realPart :: RealFloat a => Complex a -> a---- | Extracts the imaginary part of a complex number.-imagPart :: RealFloat a => Complex a -> a---- | Form a complex number from polar components of magnitude and phase.-mkPolar :: RealFloat a => a -> a -> Complex a---- | <tt><a>cis</a> t</tt> is a complex value with magnitude <tt>1</tt> and--- phase <tt>t</tt> (modulo <tt>2*<a>pi</a></tt>).-cis :: RealFloat a => a -> Complex a---- | The function <a>polar</a> takes a complex number and returns a--- (magnitude, phase) pair in canonical form: the magnitude is--- nonnegative, and the phase in the range <tt>(-<a>pi</a>,--- <a>pi</a>]</tt>; if the magnitude is zero, then so is the phase.-polar :: RealFloat a => Complex a -> (a, a)---- | The nonnegative magnitude of a complex number.-magnitude :: RealFloat a => Complex a -> a---- | The phase of a complex number, in the range <tt>(-<a>pi</a>,--- <a>pi</a>]</tt>. If the magnitude is zero, then so is the phase.-phase :: RealFloat a => Complex a -> a---- | The conjugate of a complex number.-conjugate :: RealFloat a => Complex a -> Complex a--module System.Environment---- | Computation <a>getArgs</a> returns a list of the program's command--- line arguments (not including the program name).-getArgs :: IO [String]---- | Computation <a>getProgName</a> returns the name of the program as it--- was invoked.--- --- However, this is hard-to-impossible to implement on some non-Unix--- OSes, so instead, for maximum portability, we just return the leafname--- of the program as invoked. Even then there are some differences--- between platforms: on Windows, for example, a program invoked as foo--- is probably really <tt>FOO.EXE</tt>, and that is what--- <a>getProgName</a> will return.-getProgName :: IO String---- | Computation <a>getEnv</a> <tt>var</tt> returns the value of the--- environment variable <tt>var</tt>.--- --- This computation may fail with:--- --- <ul>--- <li><tt>System.IO.Error.isDoesNotExistError</tt> if the environment--- variable does not exist.</li>--- </ul>-getEnv :: String -> IO String--module Foreign.C--module Foreign--module Data.List---- | Append two lists, i.e.,--- --- <pre>--- [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]--- [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]--- </pre>--- --- If the first list is not finite, the result is the first list.-(++) :: [a] -> [a] -> [a]---- | Extract the first element of a list, which must be non-empty.-head :: [a] -> a---- | Extract the last element of a list, which must be finite and--- non-empty.-last :: [a] -> a---- | Extract the elements after the head of a list, which must be--- non-empty.-tail :: [a] -> [a]---- | Return all the elements of a list except the last one. The list must--- be non-empty.-init :: [a] -> [a]---- | Test whether a list is empty.-null :: [a] -> Bool---- | <i>O(n)</i>. <a>length</a> returns the length of a finite list as an--- <a>Int</a>. It is an instance of the more general--- <tt>Data.List.genericLength</tt>, the result type of which may be any--- kind of number.-length :: [a] -> Int---- | <a>map</a> <tt>f xs</tt> is the list obtained by applying <tt>f</tt>--- to each element of <tt>xs</tt>, i.e.,--- --- <pre>--- map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]--- map f [x1, x2, ...] == [f x1, f x2, ...]--- </pre>-map :: (a -> b) -> [a] -> [b]---- | <a>reverse</a> <tt>xs</tt> returns the elements of <tt>xs</tt> in--- reverse order. <tt>xs</tt> must be finite.-reverse :: [a] -> [a]---- | The <a>intersperse</a> function takes an element and a list and--- `intersperses' that element between the elements of the list. For--- example,--- --- <pre>--- intersperse ',' "abcde" == "a,b,c,d,e"--- </pre>-intersperse :: a -> [a] -> [a]---- | <a>intercalate</a> <tt>xs xss</tt> is equivalent to <tt>(<a>concat</a>--- (<a>intersperse</a> xs xss))</tt>. It inserts the list <tt>xs</tt> in--- between the lists in <tt>xss</tt> and concatenates the result.-intercalate :: [a] -> [[a]] -> [a]---- | The <a>transpose</a> function transposes the rows and columns of its--- argument. For example,--- --- <pre>--- transpose [[1,2,3],[4,5,6]] == [[1,4],[2,5],[3,6]]--- </pre>-transpose :: [[a]] -> [[a]]---- | The <a>subsequences</a> function returns the list of all subsequences--- of the argument.--- --- <pre>--- subsequences "abc" == ["","a","b","ab","c","ac","bc","abc"]--- </pre>-subsequences :: [a] -> [[a]]---- | The <a>permutations</a> function returns the list of all permutations--- of the argument.--- --- <pre>--- permutations "abc" == ["abc","bac","cba","bca","cab","acb"]--- </pre>-permutations :: [a] -> [[a]]---- | <a>foldl</a>, applied to a binary operator, a starting value--- (typically the left-identity of the operator), and a list, reduces the--- list using the binary operator, from left to right:--- --- <pre>--- foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn--- </pre>--- --- The list must be finite.-foldl :: (a -> b -> a) -> a -> [b] -> a---- | A strict version of <a>foldl</a>.-foldl' :: (a -> b -> a) -> a -> [b] -> a---- | <a>foldl1</a> is a variant of <a>foldl</a> that has no starting value--- argument, and thus must be applied to non-empty lists.-foldl1 :: (a -> a -> a) -> [a] -> a---- | A strict version of <a>foldl1</a>-foldl1' :: (a -> a -> a) -> [a] -> a---- | <a>foldr</a>, applied to a binary operator, a starting value--- (typically the right-identity of the operator), and a list, reduces--- the list using the binary operator, from right to left:--- --- <pre>--- foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)--- </pre>-foldr :: (a -> b -> b) -> b -> [a] -> b---- | <a>foldr1</a> is a variant of <a>foldr</a> that has no starting value--- argument, and thus must be applied to non-empty lists.-foldr1 :: (a -> a -> a) -> [a] -> a---- | Concatenate a list of lists.-concat :: [[a]] -> [a]---- | Map a function over a list and concatenate the results.-concatMap :: (a -> [b]) -> [a] -> [b]---- | <a>and</a> returns the conjunction of a Boolean list. For the result--- to be <a>True</a>, the list must be finite; <a>False</a>, however,--- results from a <a>False</a> value at a finite index of a finite or--- infinite list.-and :: [Bool] -> Bool---- | <a>or</a> returns the disjunction of a Boolean list. For the result to--- be <a>False</a>, the list must be finite; <a>True</a>, however,--- results from a <a>True</a> value at a finite index of a finite or--- infinite list.-or :: [Bool] -> Bool---- | Applied to a predicate and a list, <a>any</a> determines if any--- element of the list satisfies the predicate. For the result to be--- <a>False</a>, the list must be finite; <a>True</a>, however, results--- from a <a>True</a> value for the predicate applied to an element at a--- finite index of a finite or infinite list.-any :: (a -> Bool) -> [a] -> Bool---- | Applied to a predicate and a list, <a>all</a> determines if all--- elements of the list satisfy the predicate. For the result to be--- <a>True</a>, the list must be finite; <a>False</a>, however, results--- from a <a>False</a> value for the predicate applied to an element at a--- finite index of a finite or infinite list.-all :: (a -> Bool) -> [a] -> Bool---- | The <a>sum</a> function computes the sum of a finite list of numbers.-sum :: Num a => [a] -> a---- | The <a>product</a> function computes the product of a finite list of--- numbers.-product :: Num a => [a] -> a---- | <a>maximum</a> returns the maximum value from a list, which must be--- non-empty, finite, and of an ordered type. It is a special case of--- <a>maximumBy</a>, which allows the programmer to supply their own--- comparison function.-maximum :: Ord a => [a] -> a---- | <a>minimum</a> returns the minimum value from a list, which must be--- non-empty, finite, and of an ordered type. It is a special case of--- <a>minimumBy</a>, which allows the programmer to supply their own--- comparison function.-minimum :: Ord a => [a] -> a---- | <a>scanl</a> is similar to <a>foldl</a>, but returns a list of--- successive reduced values from the left:--- --- <pre>--- scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]--- </pre>--- --- Note that--- --- <pre>--- last (scanl f z xs) == foldl f z xs.--- </pre>-scanl :: (a -> b -> a) -> a -> [b] -> [a]---- | <a>scanl1</a> is a variant of <a>scanl</a> that has no starting value--- argument:--- --- <pre>--- scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]--- </pre>-scanl1 :: (a -> a -> a) -> [a] -> [a]---- | <a>scanr</a> is the right-to-left dual of <a>scanl</a>. Note that--- --- <pre>--- head (scanr f z xs) == foldr f z xs.--- </pre>-scanr :: (a -> b -> b) -> b -> [a] -> [b]---- | <a>scanr1</a> is a variant of <a>scanr</a> that has no starting value--- argument.-scanr1 :: (a -> a -> a) -> [a] -> [a]---- | The <a>mapAccumL</a> function behaves like a combination of <a>map</a>--- and <a>foldl</a>; it applies a function to each element of a list,--- passing an accumulating parameter from left to right, and returning a--- final value of this accumulator together with the new list.-mapAccumL :: (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])---- | The <a>mapAccumR</a> function behaves like a combination of <a>map</a>--- and <a>foldr</a>; it applies a function to each element of a list,--- passing an accumulating parameter from right to left, and returning a--- final value of this accumulator together with the new list.-mapAccumR :: (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])---- | <a>iterate</a> <tt>f x</tt> returns an infinite list of repeated--- applications of <tt>f</tt> to <tt>x</tt>:--- --- <pre>--- iterate f x == [x, f x, f (f x), ...]--- </pre>-iterate :: (a -> a) -> a -> [a]---- | <a>repeat</a> <tt>x</tt> is an infinite list, with <tt>x</tt> the--- value of every element.-repeat :: a -> [a]---- | <a>replicate</a> <tt>n x</tt> is a list of length <tt>n</tt> with--- <tt>x</tt> the value of every element. It is an instance of the more--- general <tt>Data.List.genericReplicate</tt>, in which <tt>n</tt> may--- be of any integral type.-replicate :: Int -> a -> [a]---- | <a>cycle</a> ties a finite list into a circular one, or equivalently,--- the infinite repetition of the original list. It is the identity on--- infinite lists.-cycle :: [a] -> [a]---- | The <a>unfoldr</a> function is a `dual' to <a>foldr</a>: while--- <a>foldr</a> reduces a list to a summary value, <a>unfoldr</a> builds--- a list from a seed value. The function takes the element and returns--- <a>Nothing</a> if it is done producing the list or returns <a>Just</a>--- <tt>(a,b)</tt>, in which case, <tt>a</tt> is a prepended to the list--- and <tt>b</tt> is used as the next element in a recursive call. For--- example,--- --- <pre>--- iterate f == unfoldr (\x -> Just (x, f x))--- </pre>--- --- In some cases, <a>unfoldr</a> can undo a <a>foldr</a> operation:--- --- <pre>--- unfoldr f' (foldr f z xs) == xs--- </pre>--- --- if the following holds:--- --- <pre>--- f' (f x y) = Just (x,y)--- f' z = Nothing--- </pre>--- --- A simple use of unfoldr:--- --- <pre>--- unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10--- [10,9,8,7,6,5,4,3,2,1]--- </pre>-unfoldr :: (b -> Maybe (a, b)) -> b -> [a]---- | <a>take</a> <tt>n</tt>, applied to a list <tt>xs</tt>, returns the--- prefix of <tt>xs</tt> of length <tt>n</tt>, or <tt>xs</tt> itself if--- <tt>n > <a>length</a> xs</tt>:--- --- <pre>--- take 5 "Hello World!" == "Hello"--- take 3 [1,2,3,4,5] == [1,2,3]--- take 3 [1,2] == [1,2]--- take 3 [] == []--- take (-1) [1,2] == []--- take 0 [1,2] == []--- </pre>--- --- It is an instance of the more general <tt>Data.List.genericTake</tt>,--- in which <tt>n</tt> may be of any integral type.-take :: Int -> [a] -> [a]---- | <a>drop</a> <tt>n xs</tt> returns the suffix of <tt>xs</tt> after the--- first <tt>n</tt> elements, or <tt>[]</tt> if <tt>n > <a>length</a>--- xs</tt>:--- --- <pre>--- drop 6 "Hello World!" == "World!"--- drop 3 [1,2,3,4,5] == [4,5]--- drop 3 [1,2] == []--- drop 3 [] == []--- drop (-1) [1,2] == [1,2]--- drop 0 [1,2] == [1,2]--- </pre>--- --- It is an instance of the more general <tt>Data.List.genericDrop</tt>,--- in which <tt>n</tt> may be of any integral type.-drop :: Int -> [a] -> [a]---- | <a>splitAt</a> <tt>n xs</tt> returns a tuple where first element is--- <tt>xs</tt> prefix of length <tt>n</tt> and second element is the--- remainder of the list:--- --- <pre>--- splitAt 6 "Hello World!" == ("Hello ","World!")--- splitAt 3 [1,2,3,4,5] == ([1,2,3],[4,5])--- splitAt 1 [1,2,3] == ([1],[2,3])--- splitAt 3 [1,2,3] == ([1,2,3],[])--- splitAt 4 [1,2,3] == ([1,2,3],[])--- splitAt 0 [1,2,3] == ([],[1,2,3])--- splitAt (-1) [1,2,3] == ([],[1,2,3])--- </pre>--- --- It is equivalent to <tt>(<a>take</a> n xs, <a>drop</a> n xs)</tt>.--- <a>splitAt</a> is an instance of the more general--- <tt>Data.List.genericSplitAt</tt>, in which <tt>n</tt> may be of any--- integral type.-splitAt :: Int -> [a] -> ([a], [a])---- | <a>takeWhile</a>, applied to a predicate <tt>p</tt> and a list--- <tt>xs</tt>, returns the longest prefix (possibly empty) of--- <tt>xs</tt> of elements that satisfy <tt>p</tt>:--- --- <pre>--- takeWhile (< 3) [1,2,3,4,1,2,3,4] == [1,2]--- takeWhile (< 9) [1,2,3] == [1,2,3]--- takeWhile (< 0) [1,2,3] == []--- </pre>-takeWhile :: (a -> Bool) -> [a] -> [a]---- | <a>dropWhile</a> <tt>p xs</tt> returns the suffix remaining after--- <a>takeWhile</a> <tt>p xs</tt>:--- --- <pre>--- dropWhile (< 3) [1,2,3,4,5,1,2,3] == [3,4,5,1,2,3]--- dropWhile (< 9) [1,2,3] == []--- dropWhile (< 0) [1,2,3] == [1,2,3]--- </pre>-dropWhile :: (a -> Bool) -> [a] -> [a]---- | <a>span</a>, applied to a predicate <tt>p</tt> and a list <tt>xs</tt>,--- returns a tuple where first element is longest prefix (possibly empty)--- of <tt>xs</tt> of elements that satisfy <tt>p</tt> and second element--- is the remainder of the list:--- --- <pre>--- span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4])--- span (< 9) [1,2,3] == ([1,2,3],[])--- span (< 0) [1,2,3] == ([],[1,2,3])--- </pre>--- --- <a>span</a> <tt>p xs</tt> is equivalent to <tt>(<a>takeWhile</a> p xs,--- <a>dropWhile</a> p xs)</tt>-span :: (a -> Bool) -> [a] -> ([a], [a])---- | <a>break</a>, applied to a predicate <tt>p</tt> and a list--- <tt>xs</tt>, returns a tuple where first element is longest prefix--- (possibly empty) of <tt>xs</tt> of elements that <i>do not satisfy</i>--- <tt>p</tt> and second element is the remainder of the list:--- --- <pre>--- break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4])--- break (< 9) [1,2,3] == ([],[1,2,3])--- break (> 9) [1,2,3] == ([1,2,3],[])--- </pre>--- --- <a>break</a> <tt>p</tt> is equivalent to <tt><a>span</a> (<a>not</a> .--- p)</tt>.-break :: (a -> Bool) -> [a] -> ([a], [a])---- | The <a>stripPrefix</a> function drops the given prefix from a list. It--- returns <a>Nothing</a> if the list did not start with the prefix--- given, or <a>Just</a> the list after the prefix, if it does.--- --- <pre>--- stripPrefix "foo" "foobar" == Just "bar"--- stripPrefix "foo" "foo" == Just ""--- stripPrefix "foo" "barfoo" == Nothing--- stripPrefix "foo" "barfoobaz" == Nothing--- </pre>-stripPrefix :: Eq a => [a] -> [a] -> Maybe [a]---- | The <a>group</a> function takes a list and returns a list of lists--- such that the concatenation of the result is equal to the argument.--- Moreover, each sublist in the result contains only equal elements. For--- example,--- --- <pre>--- group "Mississippi" = ["M","i","ss","i","ss","i","pp","i"]--- </pre>--- --- It is a special case of <a>groupBy</a>, which allows the programmer to--- supply their own equality test.-group :: Eq a => [a] -> [[a]]---- | The <a>inits</a> function returns all initial segments of the--- argument, shortest first. For example,--- --- <pre>--- inits "abc" == ["","a","ab","abc"]--- </pre>-inits :: [a] -> [[a]]---- | The <a>tails</a> function returns all final segments of the argument,--- longest first. For example,--- --- <pre>--- tails "abc" == ["abc", "bc", "c",""]--- </pre>-tails :: [a] -> [[a]]---- | The <a>isPrefixOf</a> function takes two lists and returns <a>True</a>--- iff the first list is a prefix of the second.-isPrefixOf :: Eq a => [a] -> [a] -> Bool---- | The <a>isSuffixOf</a> function takes two lists and returns <a>True</a>--- iff the first list is a suffix of the second. Both lists must be--- finite.-isSuffixOf :: Eq a => [a] -> [a] -> Bool---- | The <a>isInfixOf</a> function takes two lists and returns <a>True</a>--- iff the first list is contained, wholly and intact, anywhere within--- the second.--- --- Example:--- --- <pre>--- isInfixOf "Haskell" "I really like Haskell." == True--- isInfixOf "Ial" "I really like Haskell." == False--- </pre>-isInfixOf :: Eq a => [a] -> [a] -> Bool---- | <a>elem</a> is the list membership predicate, usually written in infix--- form, e.g., <tt>x `elem` xs</tt>. For the result to be <a>False</a>,--- the list must be finite; <a>True</a>, however, results from an element--- equal to <tt>x</tt> found at a finite index of a finite or infinite--- list.-elem :: Eq a => a -> [a] -> Bool---- | <a>notElem</a> is the negation of <a>elem</a>.-notElem :: Eq a => a -> [a] -> Bool---- | <a>lookup</a> <tt>key assocs</tt> looks up a key in an association--- list.-lookup :: Eq a => a -> [(a, b)] -> Maybe b---- | The <a>find</a> function takes a predicate and a list and returns the--- first element in the list matching the predicate, or <a>Nothing</a> if--- there is no such element.-find :: (a -> Bool) -> [a] -> Maybe a---- | <a>filter</a>, applied to a predicate and a list, returns the list of--- those elements that satisfy the predicate; i.e.,--- --- <pre>--- filter p xs = [ x | x <- xs, p x]--- </pre>-filter :: (a -> Bool) -> [a] -> [a]---- | The <a>partition</a> function takes a predicate a list and returns the--- pair of lists of elements which do and do not satisfy the predicate,--- respectively; i.e.,--- --- <pre>--- partition p xs == (filter p xs, filter (not . p) xs)--- </pre>-partition :: (a -> Bool) -> [a] -> ([a], [a])---- | List index (subscript) operator, starting from 0. It is an instance of--- the more general <tt>Data.List.genericIndex</tt>, which takes an index--- of any integral type.-(!!) :: [a] -> Int -> a---- | The <a>elemIndex</a> function returns the index of the first element--- in the given list which is equal (by <a>==</a>) to the query element,--- or <a>Nothing</a> if there is no such element.-elemIndex :: Eq a => a -> [a] -> Maybe Int---- | The <a>elemIndices</a> function extends <a>elemIndex</a>, by returning--- the indices of all elements equal to the query element, in ascending--- order.-elemIndices :: Eq a => a -> [a] -> [Int]---- | The <a>findIndex</a> function takes a predicate and a list and returns--- the index of the first element in the list satisfying the predicate,--- or <a>Nothing</a> if there is no such element.-findIndex :: (a -> Bool) -> [a] -> Maybe Int---- | The <a>findIndices</a> function extends <a>findIndex</a>, by returning--- the indices of all elements satisfying the predicate, in ascending--- order.-findIndices :: (a -> Bool) -> [a] -> [Int]---- | <a>zip</a> takes two lists and returns a list of corresponding pairs.--- If one input list is short, excess elements of the longer list are--- discarded.-zip :: [a] -> [b] -> [(a, b)]---- | <a>zip3</a> takes three lists and returns a list of triples, analogous--- to <a>zip</a>.-zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]---- | The <a>zip4</a> function takes four lists and returns a list of--- quadruples, analogous to <a>zip</a>.-zip4 :: [a] -> [b] -> [c] -> [d] -> [(a, b, c, d)]---- | The <a>zip5</a> function takes five lists and returns a list of--- five-tuples, analogous to <a>zip</a>.-zip5 :: [a] -> [b] -> [c] -> [d] -> [e] -> [(a, b, c, d, e)]---- | The <a>zip6</a> function takes six lists and returns a list of--- six-tuples, analogous to <a>zip</a>.-zip6 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [(a, b, c, d, e, f)]---- | The <a>zip7</a> function takes seven lists and returns a list of--- seven-tuples, analogous to <a>zip</a>.-zip7 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [(a, b, c, d, e, f, g)]---- | <a>zipWith</a> generalises <a>zip</a> by zipping with the function--- given as the first argument, instead of a tupling function. For--- example, <tt><a>zipWith</a> (+)</tt> is applied to two lists to--- produce the list of corresponding sums.-zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]---- | The <a>zipWith3</a> function takes a function which combines three--- elements, as well as three lists and returns a list of their--- point-wise combination, analogous to <a>zipWith</a>.-zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]---- | The <a>zipWith4</a> function takes a function which combines four--- elements, as well as four lists and returns a list of their point-wise--- combination, analogous to <a>zipWith</a>.-zipWith4 :: (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e]---- | The <a>zipWith5</a> function takes a function which combines five--- elements, as well as five lists and returns a list of their point-wise--- combination, analogous to <a>zipWith</a>.-zipWith5 :: (a -> b -> c -> d -> e -> f) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f]---- | The <a>zipWith6</a> function takes a function which combines six--- elements, as well as six lists and returns a list of their point-wise--- combination, analogous to <a>zipWith</a>.-zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g]---- | The <a>zipWith7</a> function takes a function which combines seven--- elements, as well as seven lists and returns a list of their--- point-wise combination, analogous to <a>zipWith</a>.-zipWith7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [h]---- | <a>unzip</a> transforms a list of pairs into a list of first--- components and a list of second components.-unzip :: [(a, b)] -> ([a], [b])---- | The <a>unzip3</a> function takes a list of triples and returns three--- lists, analogous to <a>unzip</a>.-unzip3 :: [(a, b, c)] -> ([a], [b], [c])---- | The <a>unzip4</a> function takes a list of quadruples and returns four--- lists, analogous to <a>unzip</a>.-unzip4 :: [(a, b, c, d)] -> ([a], [b], [c], [d])---- | The <a>unzip5</a> function takes a list of five-tuples and returns--- five lists, analogous to <a>unzip</a>.-unzip5 :: [(a, b, c, d, e)] -> ([a], [b], [c], [d], [e])---- | The <a>unzip6</a> function takes a list of six-tuples and returns six--- lists, analogous to <a>unzip</a>.-unzip6 :: [(a, b, c, d, e, f)] -> ([a], [b], [c], [d], [e], [f])---- | The <a>unzip7</a> function takes a list of seven-tuples and returns--- seven lists, analogous to <a>unzip</a>.-unzip7 :: [(a, b, c, d, e, f, g)] -> ([a], [b], [c], [d], [e], [f], [g])---- | <a>lines</a> breaks a string up into a list of strings at newline--- characters. The resulting strings do not contain newlines.-lines :: String -> [String]---- | <a>words</a> breaks a string up into a list of words, which were--- delimited by white space.-words :: String -> [String]---- | <a>unlines</a> is an inverse operation to <a>lines</a>. It joins--- lines, after appending a terminating newline to each.-unlines :: [String] -> String---- | <a>unwords</a> is an inverse operation to <a>words</a>. It joins words--- with separating spaces.-unwords :: [String] -> String---- | <i>O(n^2)</i>. The <a>nub</a> function removes duplicate elements from--- a list. In particular, it keeps only the first occurrence of each--- element. (The name <a>nub</a> means `essence'.) It is a special case--- of <a>nubBy</a>, which allows the programmer to supply their own--- equality test.-nub :: Eq a => [a] -> [a]---- | <a>delete</a> <tt>x</tt> removes the first occurrence of <tt>x</tt>--- from its list argument. For example,--- --- <pre>--- delete 'a' "banana" == "bnana"--- </pre>--- --- It is a special case of <a>deleteBy</a>, which allows the programmer--- to supply their own equality test.-delete :: Eq a => a -> [a] -> [a]---- | The <a>\\</a> function is list difference ((non-associative). In the--- result of <tt>xs</tt> <a>\\</a> <tt>ys</tt>, the first occurrence of--- each element of <tt>ys</tt> in turn (if any) has been removed from--- <tt>xs</tt>. Thus--- --- <pre>--- (xs ++ ys) \\ xs == ys.--- </pre>--- --- It is a special case of <a>deleteFirstsBy</a>, which allows the--- programmer to supply their own equality test.-(\\) :: Eq a => [a] -> [a] -> [a]---- | The <a>union</a> function returns the list union of the two lists. For--- example,--- --- <pre>--- "dog" `union` "cow" == "dogcw"--- </pre>--- --- Duplicates, and elements of the first list, are removed from the the--- second list, but if the first list contains duplicates, so will the--- result. It is a special case of <a>unionBy</a>, which allows the--- programmer to supply their own equality test.-union :: Eq a => [a] -> [a] -> [a]---- | The <a>intersect</a> function takes the list intersection of two--- lists. For example,--- --- <pre>--- [1,2,3,4] `intersect` [2,4,6,8] == [2,4]--- </pre>--- --- If the first list contains duplicates, so will the result.--- --- <pre>--- [1,2,2,3,4] `intersect` [6,4,4,2] == [2,2,4]--- </pre>--- --- It is a special case of <a>intersectBy</a>, which allows the--- programmer to supply their own equality test.-intersect :: Eq a => [a] -> [a] -> [a]---- | The <a>sort</a> function implements a stable sorting algorithm. It is--- a special case of <a>sortBy</a>, which allows the programmer to supply--- their own comparison function.-sort :: Ord a => [a] -> [a]---- | The <a>insert</a> function takes an element and a list and inserts the--- element into the list at the last position where it is still less than--- or equal to the next element. In particular, if the list is sorted--- before the call, the result will also be sorted. It is a special case--- of <a>insertBy</a>, which allows the programmer to supply their own--- comparison function.-insert :: Ord a => a -> [a] -> [a]---- | The <a>nubBy</a> function behaves just like <a>nub</a>, except it uses--- a user-supplied equality predicate instead of the overloaded <a>==</a>--- function.-nubBy :: (a -> a -> Bool) -> [a] -> [a]---- | The <a>deleteBy</a> function behaves like <a>delete</a>, but takes a--- user-supplied equality predicate.-deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a]---- | The <a>deleteFirstsBy</a> function takes a predicate and two lists and--- returns the first list with the first occurrence of each element of--- the second list removed.-deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]---- | The <a>unionBy</a> function is the non-overloaded version of--- <a>union</a>.-unionBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]---- | The <a>intersectBy</a> function is the non-overloaded version of--- <a>intersect</a>.-intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]---- | The <a>groupBy</a> function is the non-overloaded version of--- <a>group</a>.-groupBy :: (a -> a -> Bool) -> [a] -> [[a]]---- | The <a>sortBy</a> function is the non-overloaded version of--- <a>sort</a>.-sortBy :: (a -> a -> Ordering) -> [a] -> [a]---- | The non-overloaded version of <a>insert</a>.-insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a]---- | The <a>maximumBy</a> function takes a comparison function and a list--- and returns the greatest element of the list by the comparison--- function. The list must be finite and non-empty.-maximumBy :: (a -> a -> Ordering) -> [a] -> a---- | The <a>minimumBy</a> function takes a comparison function and a list--- and returns the least element of the list by the comparison function.--- The list must be finite and non-empty.-minimumBy :: (a -> a -> Ordering) -> [a] -> a---- | The <a>genericLength</a> function is an overloaded version of--- <a>length</a>. In particular, instead of returning an <a>Int</a>, it--- returns any type which is an instance of <a>Num</a>. It is, however,--- less efficient than <a>length</a>.-genericLength :: Num i => [b] -> i---- | The <a>genericTake</a> function is an overloaded version of--- <a>take</a>, which accepts any <a>Integral</a> value as the number of--- elements to take.-genericTake :: Integral i => i -> [a] -> [a]---- | The <a>genericDrop</a> function is an overloaded version of--- <a>drop</a>, which accepts any <a>Integral</a> value as the number of--- elements to drop.-genericDrop :: Integral i => i -> [a] -> [a]---- | The <a>genericSplitAt</a> function is an overloaded version of--- <a>splitAt</a>, which accepts any <a>Integral</a> value as the--- position at which to split.-genericSplitAt :: Integral i => i -> [b] -> ([b], [b])---- | The <a>genericIndex</a> function is an overloaded version of--- <a>!!</a>, which accepts any <a>Integral</a> value as the index.-genericIndex :: Integral a => [b] -> a -> b---- | The <a>genericReplicate</a> function is an overloaded version of--- <a>replicate</a>, which accepts any <a>Integral</a> value as the--- number of repetitions to make.-genericReplicate :: Integral i => i -> a -> [a]----- | The <a>Control.Monad</a> module provides the <a>Functor</a>,--- <a>Monad</a> and <a>MonadPlus</a> classes, together with some useful--- operations on monads.-module Control.Monad---- | The <a>Functor</a> class is used for types that can be mapped over.--- Instances of <a>Functor</a> should satisfy the following laws:--- --- <pre>--- fmap id == id--- fmap (f . g) == fmap f . fmap g--- </pre>--- --- The instances of <a>Functor</a> for lists, <tt>Data.Maybe.Maybe</tt>--- and <tt>System.IO.IO</tt> satisfy these laws.-class Functor f :: (* -> *)-fmap :: Functor f => (a -> b) -> f a -> f b---- | The <a>Monad</a> class defines the basic operations over a--- <i>monad</i>, a concept from a branch of mathematics known as--- <i>category theory</i>. From the perspective of a Haskell programmer,--- however, it is best to think of a monad as an <i>abstract datatype</i>--- of actions. Haskell's <tt>do</tt> expressions provide a convenient--- syntax for writing monadic expressions.--- --- Minimal complete definition: <a>>>=</a> and <a>return</a>.--- --- Instances of <a>Monad</a> should satisfy the following laws:--- --- <pre>--- return a >>= k == k a--- m >>= return == m--- m >>= (\x -> k x >>= h) == (m >>= k) >>= h--- </pre>--- --- Instances of both <a>Monad</a> and <a>Functor</a> should additionally--- satisfy the law:--- --- <pre>--- fmap f xs == xs >>= return . f--- </pre>--- --- The instances of <a>Monad</a> for lists, <tt>Data.Maybe.Maybe</tt> and--- <tt>System.IO.IO</tt> defined in the <a>Prelude</a> satisfy these--- laws.-class Monad m :: (* -> *)-(>>=) :: Monad m => m a -> (a -> m b) -> m b-(>>) :: Monad m => m a -> m b -> m b-return :: Monad m => a -> m a-fail :: Monad m => String -> m a---- | Monads that also support choice and failure.-class Monad m => MonadPlus m :: (* -> *)-mzero :: MonadPlus m => m a-mplus :: MonadPlus m => m a -> m a -> m a---- | <tt><a>mapM</a> f</tt> is equivalent to <tt><a>sequence</a> .--- <a>map</a> f</tt>.-mapM :: Monad m => (a -> m b) -> [a] -> m [b]---- | <tt><a>mapM_</a> f</tt> is equivalent to <tt><a>sequence_</a> .--- <a>map</a> f</tt>.-mapM_ :: Monad m => (a -> m b) -> [a] -> m ()---- | <a>forM</a> is <a>mapM</a> with its arguments flipped-forM :: Monad m => [a] -> (a -> m b) -> m [b]---- | <a>forM_</a> is <a>mapM_</a> with its arguments flipped-forM_ :: Monad m => [a] -> (a -> m b) -> m ()---- | Evaluate each action in the sequence from left to right, and collect--- the results.-sequence :: Monad m => [m a] -> m [a]---- | Evaluate each action in the sequence from left to right, and ignore--- the results.-sequence_ :: Monad m => [m a] -> m ()---- | Same as <a>>>=</a>, but with the arguments interchanged.-(=<<) :: Monad m => (a -> m b) -> m a -> m b---- | Left-to-right Kleisli composition of monads.-(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c---- | Right-to-left Kleisli composition of monads.--- <tt>(<a>>=></a>)</tt>, with the arguments flipped-(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c---- | <tt><a>forever</a> act</tt> repeats the action infinitely.-forever :: Monad m => m a -> m b---- | <tt><a>void</a> value</tt> discards or ignores the result of--- evaluation, such as the return value of an <a>IO</a> action.-void :: Functor f => f a -> f ()---- | The <a>join</a> function is the conventional monad join operator. It--- is used to remove one level of monadic structure, projecting its bound--- argument into the outer level.-join :: Monad m => m (m a) -> m a---- | This generalizes the list-based <a>concat</a> function.-msum :: MonadPlus m => [m a] -> m a---- | This generalizes the list-based <a>filter</a> function.-filterM :: Monad m => (a -> m Bool) -> [a] -> m [a]---- | The <a>mapAndUnzipM</a> function maps its first argument over a list,--- returning the result as a pair of lists. This function is mainly used--- with complicated data structures or a state-transforming monad.-mapAndUnzipM :: Monad m => (a -> m (b, c)) -> [a] -> m ([b], [c])---- | The <a>zipWithM</a> function generalizes <a>zipWith</a> to arbitrary--- monads.-zipWithM :: Monad m => (a -> b -> m c) -> [a] -> [b] -> m [c]---- | <a>zipWithM_</a> is the extension of <a>zipWithM</a> which ignores the--- final result.-zipWithM_ :: Monad m => (a -> b -> m c) -> [a] -> [b] -> m ()---- | The <a>foldM</a> function is analogous to <a>foldl</a>, except that--- its result is encapsulated in a monad. Note that <a>foldM</a> works--- from left-to-right over the list arguments. This could be an issue--- where <tt>(<a>>></a>)</tt> and the `folded function' are not--- commutative.--- --- <pre>--- foldM f a1 [x1, x2, ..., xm]--- </pre>--- --- ==--- --- <pre>--- do--- a2 <- f a1 x1--- a3 <- f a2 x2--- ...--- f am xm--- </pre>--- --- If right-to-left evaluation is required, the input list should be--- reversed.-foldM :: Monad m => (a -> b -> m a) -> a -> [b] -> m a---- | Like <a>foldM</a>, but discards the result.-foldM_ :: Monad m => (a -> b -> m a) -> a -> [b] -> m ()---- | <tt><a>replicateM</a> n act</tt> performs the action <tt>n</tt> times,--- gathering the results.-replicateM :: Monad m => Int -> m a -> m [a]---- | Like <a>replicateM</a>, but discards the result.-replicateM_ :: Monad m => Int -> m a -> m ()---- | <tt><a>guard</a> b</tt> is <tt><a>return</a> ()</tt> if <tt>b</tt> is--- <a>True</a>, and <a>mzero</a> if <tt>b</tt> is <a>False</a>.-guard :: MonadPlus m => Bool -> m ()---- | Conditional execution of monadic expressions. For example,--- --- <pre>--- when debug (putStr "Debugging\n")--- </pre>--- --- will output the string <tt>Debugging\n</tt> if the Boolean value--- <tt>debug</tt> is <a>True</a>, and otherwise do nothing.-when :: Monad m => Bool -> m () -> m ()---- | The reverse of <a>when</a>.-unless :: Monad m => Bool -> m () -> m ()---- | Promote a function to a monad.-liftM :: Monad m => (a1 -> r) -> m a1 -> m r---- | Promote a function to a monad, scanning the monadic arguments from--- left to right. For example,--- --- <pre>--- liftM2 (+) [0,1] [0,2] = [0,2,1,3]--- liftM2 (+) (Just 1) Nothing = Nothing--- </pre>-liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r---- | Promote a function to a monad, scanning the monadic arguments from--- left to right (cf. <a>liftM2</a>).-liftM3 :: Monad m => (a1 -> a2 -> a3 -> r) -> m a1 -> m a2 -> m a3 -> m r---- | Promote a function to a monad, scanning the monadic arguments from--- left to right (cf. <a>liftM2</a>).-liftM4 :: Monad m => (a1 -> a2 -> a3 -> a4 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m r---- | Promote a function to a monad, scanning the monadic arguments from--- left to right (cf. <a>liftM2</a>).-liftM5 :: Monad m => (a1 -> a2 -> a3 -> a4 -> a5 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m a5 -> m r---- | In many situations, the <a>liftM</a> operations can be replaced by--- uses of <a>ap</a>, which promotes function application.--- --- <pre>--- return f `ap` x1 `ap` ... `ap` xn--- </pre>--- --- is equivalent to--- --- <pre>--- liftMn f x1 x2 ... xn--- </pre>-ap :: Monad m => m (a -> b) -> m a -> m b--module System.IO---- | A value of type <tt><a>IO</a> a</tt> is a computation which, when--- performed, does some I/O before returning a value of type <tt>a</tt>.--- --- There is really only one way to "perform" an I/O action: bind it to--- <tt>Main.main</tt> in your program. When your program is run, the I/O--- will be performed. It isn't possible to perform I/O from an arbitrary--- function, unless that function is itself in the <a>IO</a> monad and--- called at some point, directly or indirectly, from <tt>Main.main</tt>.--- --- <a>IO</a> is a monad, so <a>IO</a> actions can be combined using--- either the do-notation or the <tt>>></tt> and <tt>>>=</tt>--- operations from the <tt>Monad</tt> class.-data IO a :: * -> *-fixIO :: (a -> IO a) -> IO a---- | File and directory names are values of type <a>String</a>, whose--- precise meaning is operating system dependent. Files can be opened,--- yielding a handle which can then be used to operate on the contents of--- that file.-type FilePath = String---- | Haskell defines operations to read and write characters from and to--- files, represented by values of type <tt>Handle</tt>. Each value of--- this type is a <i>handle</i>: a record used by the Haskell run-time--- system to <i>manage</i> I/O with file system objects. A handle has at--- least the following properties:--- --- <ul>--- <li>whether it manages input or output or both;</li>--- <li>whether it is <i>open</i>, <i>closed</i> or--- <i>semi-closed</i>;</li>--- <li>whether the object is seekable;</li>--- <li>whether buffering is disabled, or enabled on a line or block--- basis;</li>--- <li>a buffer (whose length may be zero).</li>--- </ul>--- --- Most handles will also have a current I/O position indicating where--- the next input or output operation will occur. A handle is--- <i>readable</i> if it manages only input or both input and output;--- likewise, it is <i>writable</i> if it manages only output or both--- input and output. A handle is <i>open</i> when first allocated. Once--- it is closed it can no longer be used for either input or output,--- though an implementation cannot re-use its storage while references--- remain to it. Handles are in the <a>Show</a> and <a>Eq</a> classes.--- The string produced by showing a handle is system dependent; it should--- include enough information to identify the handle for debugging. A--- handle is equal according to <a>==</a> only to itself; no attempt is--- made to compare the internal state of different handles for equality.-data Handle :: *---- | A handle managing input from the Haskell program's standard input--- channel.-stdin :: Handle---- | A handle managing output to the Haskell program's standard output--- channel.-stdout :: Handle---- | A handle managing output to the Haskell program's standard error--- channel.-stderr :: Handle---- | <tt><a>withFile</a> name mode act</tt> opens a file using--- <a>openFile</a> and passes the resulting handle to the computation--- <tt>act</tt>. The handle will be closed on exit from <a>withFile</a>,--- whether by normal termination or by raising an exception. If closing--- the handle raises an exception, then this exception will be raised by--- <a>withFile</a> rather than any exception raised by <tt>act</tt>.-withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r---- | Computation <a>openFile</a> <tt>file mode</tt> allocates and returns a--- new, open handle to manage the file <tt>file</tt>. It manages input if--- <tt>mode</tt> is <a>ReadMode</a>, output if <tt>mode</tt> is--- <a>WriteMode</a> or <a>AppendMode</a>, and both input and output if--- mode is <a>ReadWriteMode</a>.--- --- If the file does not exist and it is opened for output, it should be--- created as a new file. If <tt>mode</tt> is <a>WriteMode</a> and the--- file already exists, then it should be truncated to zero length. Some--- operating systems delete empty files, so there is no guarantee that--- the file will exist following an <a>openFile</a> with <tt>mode</tt>--- <a>WriteMode</a> unless it is subsequently written to successfully.--- The handle is positioned at the end of the file if <tt>mode</tt> is--- <a>AppendMode</a>, and otherwise at the beginning (in which case its--- internal position is 0). The initial buffer mode is--- implementation-dependent.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isAlreadyInUseError</tt> if the file is already open and--- cannot be reopened;</li>--- <li><tt>isDoesNotExistError</tt> if the file does not exist; or</li>--- <li><tt>isPermissionError</tt> if the user does not have permission to--- open the file.</li>--- </ul>-openFile :: FilePath -> IOMode -> IO Handle---- | See <tt>System.IO.openFile</tt>-data IOMode :: *-ReadMode :: IOMode-WriteMode :: IOMode-AppendMode :: IOMode-ReadWriteMode :: IOMode---- | Computation <a>hClose</a> <tt>hdl</tt> makes handle <tt>hdl</tt>--- closed. Before the computation finishes, if <tt>hdl</tt> is writable--- its buffer is flushed as for <a>hFlush</a>. Performing <a>hClose</a>--- on a handle that has already been closed has no effect; doing so is--- not an error. All other operations on a closed handle will fail. If--- <a>hClose</a> fails for any reason, any further operations (apart from--- <a>hClose</a>) on the handle will still fail as if <tt>hdl</tt> had--- been successfully closed.-hClose :: Handle -> IO ()---- | The <a>readFile</a> function reads a file and returns the contents of--- the file as a string. The file is read lazily, on demand, as with--- <a>getContents</a>.-readFile :: FilePath -> IO String---- | The computation <a>writeFile</a> <tt>file str</tt> function writes the--- string <tt>str</tt>, to the file <tt>file</tt>.-writeFile :: FilePath -> String -> IO ()---- | The computation <a>appendFile</a> <tt>file str</tt> function appends--- the string <tt>str</tt>, to the file <tt>file</tt>.--- --- Note that <a>writeFile</a> and <a>appendFile</a> write a literal--- string to a file. To write a value of any printable type, as with--- <a>print</a>, use the <a>show</a> function to convert the value to a--- string first.--- --- <pre>--- main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]])--- </pre>-appendFile :: FilePath -> String -> IO ()---- | For a handle <tt>hdl</tt> which attached to a physical file,--- <a>hFileSize</a> <tt>hdl</tt> returns the size of that file in 8-bit--- bytes.-hFileSize :: Handle -> IO Integer---- | <a>hSetFileSize</a> <tt>hdl</tt> <tt>size</tt> truncates the physical--- file with handle <tt>hdl</tt> to <tt>size</tt> bytes.-hSetFileSize :: Handle -> Integer -> IO ()---- | For a readable handle <tt>hdl</tt>, <a>hIsEOF</a> <tt>hdl</tt> returns--- <a>True</a> if no further input can be taken from <tt>hdl</tt> or for--- a physical file, if the current I/O position is equal to the length of--- the file. Otherwise, it returns <a>False</a>.--- --- NOTE: <a>hIsEOF</a> may block, because it has to attempt to read from--- the stream to determine whether there is any more data to be read.-hIsEOF :: Handle -> IO Bool---- | The computation <a>isEOF</a> is identical to <a>hIsEOF</a>, except--- that it works only on <a>stdin</a>.-isEOF :: IO Bool---- | Three kinds of buffering are supported: line-buffering,--- block-buffering or no-buffering. These modes have the following--- effects. For output, items are written out, or <i>flushed</i>, from--- the internal buffer according to the buffer mode:--- --- <ul>--- <li><i>line-buffering</i>: the entire output buffer is flushed--- whenever a newline is output, the buffer overflows, a--- <tt>System.IO.hFlush</tt> is issued, or the handle is closed.</li>--- <li><i>block-buffering</i>: the entire buffer is written out whenever--- it overflows, a <tt>System.IO.hFlush</tt> is issued, or the handle is--- closed.</li>--- <li><i>no-buffering</i>: output is written immediately, and never--- stored in the buffer.</li>--- </ul>--- --- An implementation is free to flush the buffer more frequently, but not--- less frequently, than specified above. The output buffer is emptied as--- soon as it has been written out.--- --- Similarly, input occurs according to the buffer mode for the handle:--- --- <ul>--- <li><i>line-buffering</i>: when the buffer for the handle is not--- empty, the next item is obtained from the buffer; otherwise, when the--- buffer is empty, characters up to and including the next newline--- character are read into the buffer. No characters are available until--- the newline character is available or the buffer is full.</li>--- <li><i>block-buffering</i>: when the buffer for the handle becomes--- empty, the next block of data is read into the buffer.</li>--- <li><i>no-buffering</i>: the next input item is read and returned. The--- <tt>System.IO.hLookAhead</tt> operation implies that even a--- no-buffered handle may require a one-character buffer.</li>--- </ul>--- --- The default buffering mode when a handle is opened is--- implementation-dependent and may depend on the file system object--- which is attached to that handle. For most implementations, physical--- files will normally be block-buffered and terminals will normally be--- line-buffered.-data BufferMode :: *---- | buffering is disabled if possible.-NoBuffering :: BufferMode---- | line-buffering should be enabled if possible.-LineBuffering :: BufferMode---- | block-buffering should be enabled if possible. The size of the buffer--- is <tt>n</tt> items if the argument is <a>Just</a> <tt>n</tt> and is--- otherwise implementation-dependent.-BlockBuffering :: Maybe Int -> BufferMode---- | Computation <a>hSetBuffering</a> <tt>hdl mode</tt> sets the mode of--- buffering for handle <tt>hdl</tt> on subsequent reads and writes.--- --- If the buffer mode is changed from <a>BlockBuffering</a> or--- <a>LineBuffering</a> to <a>NoBuffering</a>, then--- --- <ul>--- <li>if <tt>hdl</tt> is writable, the buffer is flushed as for--- <a>hFlush</a>;</li>--- <li>if <tt>hdl</tt> is not writable, the contents of the buffer is--- discarded.</li>--- </ul>--- --- This operation may fail with:--- --- <ul>--- <li><tt>isPermissionError</tt> if the handle has already been used for--- reading or writing and the implementation does not allow the buffering--- mode to be changed.</li>--- </ul>-hSetBuffering :: Handle -> BufferMode -> IO ()---- | Computation <a>hGetBuffering</a> <tt>hdl</tt> returns the current--- buffering mode for <tt>hdl</tt>.-hGetBuffering :: Handle -> IO BufferMode---- | The action <a>hFlush</a> <tt>hdl</tt> causes any items buffered for--- output in handle <tt>hdl</tt> to be sent immediately to the operating--- system.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isFullError</tt> if the device is full;</li>--- <li><tt>isPermissionError</tt> if a system resource limit would be--- exceeded. It is unspecified whether the characters in the buffer are--- discarded or retained under these circumstances.</li>--- </ul>-hFlush :: Handle -> IO ()---- | Computation <a>hGetPosn</a> <tt>hdl</tt> returns the current I/O--- position of <tt>hdl</tt> as a value of the abstract type--- <a>HandlePosn</a>.-hGetPosn :: Handle -> IO HandlePosn---- | If a call to <a>hGetPosn</a> <tt>hdl</tt> returns a position--- <tt>p</tt>, then computation <a>hSetPosn</a> <tt>p</tt> sets the--- position of <tt>hdl</tt> to the position it held at the time of the--- call to <a>hGetPosn</a>.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isPermissionError</tt> if a system resource limit would be--- exceeded.</li>--- </ul>-hSetPosn :: HandlePosn -> IO ()-data HandlePosn :: *---- | Computation <a>hSeek</a> <tt>hdl mode i</tt> sets the position of--- handle <tt>hdl</tt> depending on <tt>mode</tt>. The offset <tt>i</tt>--- is given in terms of 8-bit bytes.--- --- If <tt>hdl</tt> is block- or line-buffered, then seeking to a position--- which is not in the current buffer will first cause any items in the--- output buffer to be written to the device, and then cause the input--- buffer to be discarded. Some handles may not be seekable (see--- <a>hIsSeekable</a>), or only support a subset of the possible--- positioning operations (for instance, it may only be possible to seek--- to the end of a tape, or to a positive offset from the beginning or--- current position). It is not possible to set a negative I/O position,--- or for a physical file, an I/O position beyond the current--- end-of-file.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isIllegalOperationError</tt> if the Handle is not seekable, or--- does not support the requested seek mode.</li>--- <li><tt>isPermissionError</tt> if a system resource limit would be--- exceeded.</li>--- </ul>-hSeek :: Handle -> SeekMode -> Integer -> IO ()---- | A mode that determines the effect of <tt>hSeek</tt> <tt>hdl mode--- i</tt>.-data SeekMode :: *---- | the position of <tt>hdl</tt> is set to <tt>i</tt>.-AbsoluteSeek :: SeekMode---- | the position of <tt>hdl</tt> is set to offset <tt>i</tt> from the--- current position.-RelativeSeek :: SeekMode---- | the position of <tt>hdl</tt> is set to offset <tt>i</tt> from the end--- of the file.-SeekFromEnd :: SeekMode---- | Computation <a>hTell</a> <tt>hdl</tt> returns the current position of--- the handle <tt>hdl</tt>, as the number of bytes from the beginning of--- the file. The value returned may be subsequently passed to--- <a>hSeek</a> to reposition the handle to the current position.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isIllegalOperationError</tt> if the Handle is not--- seekable.</li>--- </ul>-hTell :: Handle -> IO Integer-hIsOpen :: Handle -> IO Bool-hIsClosed :: Handle -> IO Bool-hIsReadable :: Handle -> IO Bool-hIsWritable :: Handle -> IO Bool-hIsSeekable :: Handle -> IO Bool---- | Is the handle connected to a terminal?-hIsTerminalDevice :: Handle -> IO Bool---- | Set the echoing status of a handle connected to a terminal.-hSetEcho :: Handle -> Bool -> IO ()---- | Get the echoing status of a handle connected to a terminal.-hGetEcho :: Handle -> IO Bool---- | <a>hShow</a> is in the <a>IO</a> monad, and gives more comprehensive--- output than the (pure) instance of <a>Show</a> for <a>Handle</a>.-hShow :: Handle -> IO String---- | Computation <a>hWaitForInput</a> <tt>hdl t</tt> waits until input is--- available on handle <tt>hdl</tt>. It returns <a>True</a> as soon as--- input is available on <tt>hdl</tt>, or <a>False</a> if no input is--- available within <tt>t</tt> milliseconds. Note that--- <a>hWaitForInput</a> waits until one or more full <i>characters</i>--- are available, which means that it needs to do decoding, and hence may--- fail with a decoding error.--- --- If <tt>t</tt> is less than zero, then <tt>hWaitForInput</tt> waits--- indefinitely.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isEOFError</tt> if the end of file has been reached.</li>--- <li>a decoding error, if the input begins with an invalid byte--- sequence in this Handle's encoding.</li>--- </ul>-hWaitForInput :: Handle -> Int -> IO Bool---- | Computation <a>hReady</a> <tt>hdl</tt> indicates whether at least one--- item is available for input from handle <tt>hdl</tt>.--- --- This operation may fail with:--- --- <ul>--- <li><tt>System.IO.Error.isEOFError</tt> if the end of file has been--- reached.</li>--- </ul>-hReady :: Handle -> IO Bool---- | Computation <a>hGetChar</a> <tt>hdl</tt> reads a character from the--- file or channel managed by <tt>hdl</tt>, blocking until a character is--- available.--- --- This operation may fail with:--- --- <ul>--- <li><a>isEOFError</a> if the end of file has been reached.</li>--- </ul>-hGetChar :: Handle -> IO Char---- | Computation <a>hGetLine</a> <tt>hdl</tt> reads a line from the file or--- channel managed by <tt>hdl</tt>.--- --- This operation may fail with:--- --- <ul>--- <li><a>isEOFError</a> if the end of file is encountered when reading--- the <i>first</i> character of the line.</li>--- </ul>--- --- If <a>hGetLine</a> encounters end-of-file at any other point while--- reading in a line, it is treated as a line terminator and the--- (partial) line is returned.-hGetLine :: Handle -> IO String---- | Computation <a>hLookAhead</a> returns the next character from the--- handle without removing it from the input buffer, blocking until a--- character is available.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isEOFError</tt> if the end of file has been reached.</li>--- </ul>-hLookAhead :: Handle -> IO Char---- | Computation <a>hGetContents</a> <tt>hdl</tt> returns the list of--- characters corresponding to the unread portion of the channel or file--- managed by <tt>hdl</tt>, which is put into an intermediate state,--- <i>semi-closed</i>. In this state, <tt>hdl</tt> is effectively closed,--- but items are read from <tt>hdl</tt> on demand and accumulated in a--- special list returned by <a>hGetContents</a> <tt>hdl</tt>.--- --- Any operation that fails because a handle is closed, also fails if a--- handle is semi-closed. The only exception is <tt>hClose</tt>. A--- semi-closed handle becomes closed:--- --- <ul>--- <li>if <tt>hClose</tt> is applied to it;</li>--- <li>if an I/O error occurs when reading an item from the handle;</li>--- <li>or once the entire contents of the handle has been read.</li>--- </ul>--- --- Once a semi-closed handle becomes closed, the contents of the--- associated list becomes fixed. The contents of this final list is only--- partially specified: it will contain at least all the items of the--- stream that were evaluated prior to the handle becoming closed.--- --- Any I/O errors encountered while a handle is semi-closed are simply--- discarded.--- --- This operation may fail with:--- --- <ul>--- <li><a>isEOFError</a> if the end of file has been reached.</li>--- </ul>-hGetContents :: Handle -> IO String---- | Computation <a>hPutChar</a> <tt>hdl ch</tt> writes the character--- <tt>ch</tt> to the file or channel managed by <tt>hdl</tt>. Characters--- may be buffered if buffering is enabled for <tt>hdl</tt>.--- --- This operation may fail with:--- --- <ul>--- <li><a>isFullError</a> if the device is full; or</li>--- <li><a>isPermissionError</a> if another system resource limit would be--- exceeded.</li>--- </ul>-hPutChar :: Handle -> Char -> IO ()---- | Computation <a>hPutStr</a> <tt>hdl s</tt> writes the string <tt>s</tt>--- to the file or channel managed by <tt>hdl</tt>.--- --- This operation may fail with:--- --- <ul>--- <li><a>isFullError</a> if the device is full; or</li>--- <li><a>isPermissionError</a> if another system resource limit would be--- exceeded.</li>--- </ul>-hPutStr :: Handle -> String -> IO ()---- | The same as <a>hPutStr</a>, but adds a newline character.-hPutStrLn :: Handle -> String -> IO ()---- | Computation <a>hPrint</a> <tt>hdl t</tt> writes the string--- representation of <tt>t</tt> given by the <a>shows</a> function to the--- file or channel managed by <tt>hdl</tt> and appends a newline.--- --- This operation may fail with:--- --- <ul>--- <li><tt>System.IO.Error.isFullError</tt> if the device is full;--- or</li>--- <li><tt>System.IO.Error.isPermissionError</tt> if another system--- resource limit would be exceeded.</li>--- </ul>-hPrint :: Show a => Handle -> a -> IO ()---- | The <a>interact</a> function takes a function of type--- <tt>String->String</tt> as its argument. The entire input from the--- standard input device is passed to this function as its argument, and--- the resulting string is output on the standard output device.-interact :: (String -> String) -> IO ()---- | Write a character to the standard output device (same as--- <a>hPutChar</a> <a>stdout</a>).-putChar :: Char -> IO ()---- | Write a string to the standard output device (same as <a>hPutStr</a>--- <a>stdout</a>).-putStr :: String -> IO ()---- | The same as <a>putStr</a>, but adds a newline character.-putStrLn :: String -> IO ()---- | The <a>print</a> function outputs a value of any printable type to the--- standard output device. Printable types are those that are instances--- of class <a>Show</a>; <a>print</a> converts values to strings for--- output using the <a>show</a> operation and adds a newline.--- --- For example, a program to print the first 20 integers and their powers--- of 2 could be written as:--- --- <pre>--- main = print ([(n, 2^n) | n <- [0..19]])--- </pre>-print :: Show a => a -> IO ()---- | Read a character from the standard input device (same as--- <a>hGetChar</a> <a>stdin</a>).-getChar :: IO Char---- | Read a line from the standard input device (same as <a>hGetLine</a>--- <a>stdin</a>).-getLine :: IO String---- | The <a>getContents</a> operation returns all user input as a single--- string, which is read lazily as it is needed (same as--- <a>hGetContents</a> <a>stdin</a>).-getContents :: IO String---- | The <a>readIO</a> function is similar to <a>read</a> except that it--- signals parse failure to the <a>IO</a> monad instead of terminating--- the program.-readIO :: Read a => String -> IO a---- | The <a>readLn</a> function combines <a>getLine</a> and <a>readIO</a>.-readLn :: Read a => IO a--module Data.Array---- | The type of immutable non-strict (boxed) arrays with indices in--- <tt>i</tt> and elements in <tt>e</tt>.-data Ix i => Array i e :: * -> * -> *---- | Construct an array with the specified bounds and containing values for--- given indices within these bounds.--- --- The array is undefined (i.e. bottom) if any index in the list is out--- of bounds. If any two associations in the list have the same index,--- the value at that index is undefined (i.e. bottom).--- --- Because the indices must be checked for these errors, <a>array</a> is--- strict in the bounds argument and in the indices of the association--- list, but non-strict in the values. Thus, recurrences such as the--- following are possible:--- --- <pre>--- a = array (1,100) ((1,1) : [(i, i * a!(i-1)) | i <- [2..100]])--- </pre>--- --- Not every index within the bounds of the array need appear in the--- association list, but the values associated with indices that do not--- appear will be undefined (i.e. bottom).--- --- If, in any dimension, the lower bound is greater than the upper bound,--- then the array is legal, but empty. Indexing an empty array always--- gives an array-bounds error, but <a>bounds</a> still yields the bounds--- with which the array was constructed.-array :: Ix i => (i, i) -> [(i, e)] -> Array i e---- | Construct an array from a pair of bounds and a list of values in index--- order.-listArray :: Ix i => (i, i) -> [e] -> Array i e---- | The <a>accumArray</a> function deals with repeated indices in the--- association list using an <i>accumulating function</i> which combines--- the values of associations with the same index. For example, given a--- list of values of some index type, <tt>hist</tt> produces a histogram--- of the number of occurrences of each index within a specified range:--- --- <pre>--- hist :: (Ix a, Num b) => (a,a) -> [a] -> Array a b--- hist bnds is = accumArray (+) 0 bnds [(i, 1) | i<-is, inRange bnds i]--- </pre>--- --- If the accumulating function is strict, then <a>accumArray</a> is--- strict in the values, as well as the indices, in the association list.--- Thus, unlike ordinary arrays built with <a>array</a>, accumulated--- arrays should not in general be recursive.-accumArray :: Ix i => (e -> a -> e) -> e -> (i, i) -> [(i, a)] -> Array i e---- | The value at the given index in an array.-(!) :: Ix i => Array i e -> i -> e---- | The bounds with which an array was constructed.-bounds :: Ix i => Array i e -> (i, i)---- | The list of indices of an array in ascending order.-indices :: Ix i => Array i e -> [i]---- | The list of elements of an array in index order.-elems :: Ix i => Array i e -> [e]---- | The list of associations of an array in index order.-assocs :: Ix i => Array i e -> [(i, e)]---- | Constructs an array identical to the first argument except that it has--- been updated by the associations in the right argument. For example,--- if <tt>m</tt> is a 1-origin, <tt>n</tt> by <tt>n</tt> matrix, then--- --- <pre>--- m//[((i,i), 0) | i <- [1..n]]--- </pre>--- --- is the same matrix, except with the diagonal zeroed.--- --- Repeated indices in the association list are handled as for--- <a>array</a>: the resulting array is undefined (i.e. bottom),-(//) :: Ix i => Array i e -> [(i, e)] -> Array i e---- | <tt><a>accum</a> f</tt> takes an array and an association list and--- accumulates pairs from the list into the array with the accumulating--- function <tt>f</tt>. Thus <a>accumArray</a> can be defined using--- <a>accum</a>:--- --- <pre>--- accumArray f z b = accum f (array b [(i, z) | i <- range b])--- </pre>-accum :: Ix i => (e -> a -> e) -> Array i e -> [(i, a)] -> Array i e---- | <a>ixmap</a> allows for transformations on array indices. It may be--- thought of as providing function composition on the right with the--- mapping that the original array embodies.--- --- A similar transformation of array values may be achieved using--- <a>fmap</a> from the <a>Array</a> instance of the <a>Functor</a>--- class.-ixmap :: (Ix i, Ix j) => (i, i) -> (i -> j) -> Array j e -> Array i e
− data/haskell98.txt
@@ -1,2532 +0,0 @@--- Hoogle documentation, generated by Haddock--- See Hoogle, http://www.haskell.org/hoogle/----- | Compatibility with Haskell 98--- --- This package provides compatibility with the modules of Haskell 98 and--- the FFI addendum, by means of wrappers around modules from the base--- package (which in many cases have additional features). However--- Prelude, Numeric and Foreign are provided directly by the base--- package.-@package haskell98-@version 1.1.0.1--module MarshalUtils--module MarshalError---- | An abstract type that contains a value for each variant of--- <a>IOError</a>.-data IOErrorType :: *---- | Construct an <a>IOError</a> of the given type where the second--- argument describes the error location and the third and fourth--- argument contain the file handle and file path of the file involved in--- the error if applicable.-mkIOError :: IOErrorType -> String -> Maybe Handle -> Maybe FilePath -> IOError---- | I/O error where the operation failed because one of its arguments--- already exists.-alreadyExistsErrorType :: IOErrorType---- | I/O error where the operation failed because one of its arguments does--- not exist.-doesNotExistErrorType :: IOErrorType---- | I/O error where the operation failed because one of its arguments is a--- single-use resource, which is already being used.-alreadyInUseErrorType :: IOErrorType---- | I/O error where the operation failed because the device is full.-fullErrorType :: IOErrorType---- | I/O error where the operation failed because the end of file has been--- reached.-eofErrorType :: IOErrorType---- | I/O error where the operation is not possible.-illegalOperationErrorType :: IOErrorType---- | I/O error where the operation failed because the user does not have--- sufficient operating system privilege to perform that operation.-permissionErrorType :: IOErrorType---- | I/O error that is programmer-defined.-userErrorType :: IOErrorType---- | Adds a location description and maybe a file path and file handle to--- an <a>IOError</a>. If any of the file handle or file path is not given--- the corresponding value in the <a>IOError</a> remains unaltered.-annotateIOError :: IOError -> String -> Maybe Handle -> Maybe FilePath -> IOError--module MarshalArray--module MarshalAlloc--module CTypes--module CForeign--module CError--module Time---- | A representation of the internal clock time. Clock times may be--- compared, converted to strings, or converted to an external calendar--- time <a>CalendarTime</a> for I/O or other manipulations.-data ClockTime :: *---- | A month of the year.-data Month :: *-January :: Month-February :: Month-March :: Month-April :: Month-May :: Month-June :: Month-July :: Month-August :: Month-September :: Month-October :: Month-November :: Month-December :: Month---- | A day of the week.-data Day :: *-Sunday :: Day-Monday :: Day-Tuesday :: Day-Wednesday :: Day-Thursday :: Day-Friday :: Day-Saturday :: Day---- | <a>CalendarTime</a> is a user-readable and manipulable representation--- of the internal <a>ClockTime</a> type.-data CalendarTime :: *-CalendarTime :: Int -> Month -> Int -> Int -> Int -> Int -> Integer -> Day -> Int -> String -> Int -> Bool -> CalendarTime---- | Year (pre-Gregorian dates are inaccurate)-ctYear :: CalendarTime -> Int---- | Month of the year-ctMonth :: CalendarTime -> Month---- | Day of the month (1 to 31)-ctDay :: CalendarTime -> Int---- | Hour of the day (0 to 23)-ctHour :: CalendarTime -> Int---- | Minutes (0 to 59)-ctMin :: CalendarTime -> Int---- | Seconds (0 to 61, allowing for up to two leap seconds)-ctSec :: CalendarTime -> Int---- | Picoseconds-ctPicosec :: CalendarTime -> Integer---- | Day of the week-ctWDay :: CalendarTime -> Day---- | Day of the year (0 to 364, or 365 in leap years)-ctYDay :: CalendarTime -> Int---- | Name of the time zone-ctTZName :: CalendarTime -> String---- | Variation from UTC in seconds-ctTZ :: CalendarTime -> Int---- | <a>True</a> if Daylight Savings Time would be in effect, and--- <a>False</a> otherwise-ctIsDST :: CalendarTime -> Bool---- | records the difference between two clock times in a user-readable way.-data TimeDiff :: *-TimeDiff :: Int -> Int -> Int -> Int -> Int -> Int -> Integer -> TimeDiff-tdYear :: TimeDiff -> Int-tdMonth :: TimeDiff -> Int-tdDay :: TimeDiff -> Int-tdHour :: TimeDiff -> Int-tdMin :: TimeDiff -> Int-tdSec :: TimeDiff -> Int-tdPicosec :: TimeDiff -> Integer-getClockTime :: IO ClockTime---- | <tt><a>addToClockTime</a> d t</tt> adds a time difference <tt>d</tt>--- and a clock time <tt>t</tt> to yield a new clock time. The difference--- <tt>d</tt> may be either positive or negative.-addToClockTime :: TimeDiff -> ClockTime -> ClockTime---- | <tt><a>diffClockTimes</a> t1 t2</tt> returns the difference between--- two clock times <tt>t1</tt> and <tt>t2</tt> as a <a>TimeDiff</a>.-diffClockTimes :: ClockTime -> ClockTime -> TimeDiff---- | converts an internal clock time to a local time, modified by the--- timezone and daylight savings time settings in force at the time of--- conversion. Because of this dependence on the local environment,--- <a>toCalendarTime</a> is in the <a>IO</a> monad.-toCalendarTime :: ClockTime -> IO CalendarTime---- | converts an internal clock time into a <a>CalendarTime</a> in standard--- UTC format.-toUTCTime :: ClockTime -> CalendarTime---- | converts a <a>CalendarTime</a> into the corresponding internal--- <a>ClockTime</a>, ignoring the contents of the <a>ctWDay</a>,--- <a>ctYDay</a>, <a>ctTZName</a> and <a>ctIsDST</a> fields.-toClockTime :: CalendarTime -> ClockTime---- | formats calendar times using local conventions.-calendarTimeToString :: CalendarTime -> String---- | formats calendar times using local conventions and a formatting--- string. The formatting string is that understood by the ISO C--- <tt>strftime()</tt> function.-formatCalendarTime :: TimeLocale -> String -> CalendarTime -> String--module Locale-data TimeLocale :: *-TimeLocale :: [(String, String)] -> [(String, String)] -> [(String, String)] -> (String, String) -> String -> String -> String -> String -> TimeLocale-defaultTimeLocale :: TimeLocale--module List---- | The <a>elemIndex</a> function returns the index of the first element--- in the given list which is equal (by <a>==</a>) to the query element,--- or <a>Nothing</a> if there is no such element.-elemIndex :: Eq a => a -> [a] -> Maybe Int---- | The <a>elemIndices</a> function extends <a>elemIndex</a>, by returning--- the indices of all elements equal to the query element, in ascending--- order.-elemIndices :: Eq a => a -> [a] -> [Int]---- | The <a>find</a> function takes a predicate and a list and returns the--- first element in the list matching the predicate, or <a>Nothing</a> if--- there is no such element.-find :: (a -> Bool) -> [a] -> Maybe a---- | The <a>findIndex</a> function takes a predicate and a list and returns--- the index of the first element in the list satisfying the predicate,--- or <a>Nothing</a> if there is no such element.-findIndex :: (a -> Bool) -> [a] -> Maybe Int---- | The <a>findIndices</a> function extends <a>findIndex</a>, by returning--- the indices of all elements satisfying the predicate, in ascending--- order.-findIndices :: (a -> Bool) -> [a] -> [Int]---- | <i>O(n^2)</i>. The <a>nub</a> function removes duplicate elements from--- a list. In particular, it keeps only the first occurrence of each--- element. (The name <a>nub</a> means `essence'.) It is a special case--- of <a>nubBy</a>, which allows the programmer to supply their own--- equality test.-nub :: Eq a => [a] -> [a]---- | The <a>nubBy</a> function behaves just like <a>nub</a>, except it uses--- a user-supplied equality predicate instead of the overloaded <a>==</a>--- function.-nubBy :: (a -> a -> Bool) -> [a] -> [a]---- | <a>delete</a> <tt>x</tt> removes the first occurrence of <tt>x</tt>--- from its list argument. For example,--- --- <pre>--- delete 'a' "banana" == "bnana"--- </pre>--- --- It is a special case of <a>deleteBy</a>, which allows the programmer--- to supply their own equality test.-delete :: Eq a => a -> [a] -> [a]---- | The <a>deleteBy</a> function behaves like <a>delete</a>, but takes a--- user-supplied equality predicate.-deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a]---- | The <a>\\</a> function is list difference ((non-associative). In the--- result of <tt>xs</tt> <a>\\</a> <tt>ys</tt>, the first occurrence of--- each element of <tt>ys</tt> in turn (if any) has been removed from--- <tt>xs</tt>. Thus--- --- <pre>--- (xs ++ ys) \\ xs == ys.--- </pre>--- --- It is a special case of <a>deleteFirstsBy</a>, which allows the--- programmer to supply their own equality test.-(\\) :: Eq a => [a] -> [a] -> [a]---- | The <a>deleteFirstsBy</a> function takes a predicate and two lists and--- returns the first list with the first occurrence of each element of--- the second list removed.-deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]---- | The <a>union</a> function returns the list union of the two lists. For--- example,--- --- <pre>--- "dog" `union` "cow" == "dogcw"--- </pre>--- --- Duplicates, and elements of the first list, are removed from the the--- second list, but if the first list contains duplicates, so will the--- result. It is a special case of <a>unionBy</a>, which allows the--- programmer to supply their own equality test.-union :: Eq a => [a] -> [a] -> [a]---- | The <a>unionBy</a> function is the non-overloaded version of--- <a>union</a>.-unionBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]---- | The <a>intersect</a> function takes the list intersection of two--- lists. For example,--- --- <pre>--- [1,2,3,4] `intersect` [2,4,6,8] == [2,4]--- </pre>--- --- If the first list contains duplicates, so will the result.--- --- <pre>--- [1,2,2,3,4] `intersect` [6,4,4,2] == [2,2,4]--- </pre>--- --- It is a special case of <a>intersectBy</a>, which allows the--- programmer to supply their own equality test.-intersect :: Eq a => [a] -> [a] -> [a]---- | The <a>intersectBy</a> function is the non-overloaded version of--- <a>intersect</a>.-intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]---- | The <a>intersperse</a> function takes an element and a list and--- `intersperses' that element between the elements of the list. For--- example,--- --- <pre>--- intersperse ',' "abcde" == "a,b,c,d,e"--- </pre>-intersperse :: a -> [a] -> [a]---- | The <a>transpose</a> function transposes the rows and columns of its--- argument. For example,--- --- <pre>--- transpose [[1,2,3],[4,5,6]] == [[1,4],[2,5],[3,6]]--- </pre>-transpose :: [[a]] -> [[a]]---- | The <a>partition</a> function takes a predicate a list and returns the--- pair of lists of elements which do and do not satisfy the predicate,--- respectively; i.e.,--- --- <pre>--- partition p xs == (filter p xs, filter (not . p) xs)--- </pre>-partition :: (a -> Bool) -> [a] -> ([a], [a])---- | The <a>group</a> function takes a list and returns a list of lists--- such that the concatenation of the result is equal to the argument.--- Moreover, each sublist in the result contains only equal elements. For--- example,--- --- <pre>--- group "Mississippi" = ["M","i","ss","i","ss","i","pp","i"]--- </pre>--- --- It is a special case of <a>groupBy</a>, which allows the programmer to--- supply their own equality test.-group :: Eq a => [a] -> [[a]]---- | The <a>groupBy</a> function is the non-overloaded version of--- <a>group</a>.-groupBy :: (a -> a -> Bool) -> [a] -> [[a]]---- | The <a>inits</a> function returns all initial segments of the--- argument, shortest first. For example,--- --- <pre>--- inits "abc" == ["","a","ab","abc"]--- </pre>--- --- Note that <a>inits</a> has the following strictness property:--- <tt>inits _|_ = [] : _|_</tt>-inits :: [a] -> [[a]]---- | The <a>tails</a> function returns all final segments of the argument,--- longest first. For example,--- --- <pre>--- tails "abc" == ["abc", "bc", "c",""]--- </pre>--- --- Note that <a>tails</a> has the following strictness property:--- <tt>tails _|_ = _|_ : _|_</tt>-tails :: [a] -> [[a]]---- | The <a>isPrefixOf</a> function takes two lists and returns <a>True</a>--- iff the first list is a prefix of the second.-isPrefixOf :: Eq a => [a] -> [a] -> Bool---- | The <a>isSuffixOf</a> function takes two lists and returns <a>True</a>--- iff the first list is a suffix of the second. Both lists must be--- finite.-isSuffixOf :: Eq a => [a] -> [a] -> Bool---- | The <a>mapAccumL</a> function behaves like a combination of <a>map</a>--- and <a>foldl</a>; it applies a function to each element of a list,--- passing an accumulating parameter from left to right, and returning a--- final value of this accumulator together with the new list.-mapAccumL :: (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])---- | The <a>mapAccumR</a> function behaves like a combination of <a>map</a>--- and <a>foldr</a>; it applies a function to each element of a list,--- passing an accumulating parameter from right to left, and returning a--- final value of this accumulator together with the new list.-mapAccumR :: (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])---- | The <a>sort</a> function implements a stable sorting algorithm. It is--- a special case of <a>sortBy</a>, which allows the programmer to supply--- their own comparison function.-sort :: Ord a => [a] -> [a]---- | The <a>sortBy</a> function is the non-overloaded version of--- <a>sort</a>.-sortBy :: (a -> a -> Ordering) -> [a] -> [a]---- | The <a>insert</a> function takes an element and a list and inserts the--- element into the list at the last position where it is still less than--- or equal to the next element. In particular, if the list is sorted--- before the call, the result will also be sorted. It is a special case--- of <a>insertBy</a>, which allows the programmer to supply their own--- comparison function.-insert :: Ord a => a -> [a] -> [a]---- | The non-overloaded version of <a>insert</a>.-insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a]---- | The <a>maximumBy</a> function takes a comparison function and a list--- and returns the greatest element of the list by the comparison--- function. The list must be finite and non-empty.-maximumBy :: (a -> a -> Ordering) -> [a] -> a---- | The <a>minimumBy</a> function takes a comparison function and a list--- and returns the least element of the list by the comparison function.--- The list must be finite and non-empty.-minimumBy :: (a -> a -> Ordering) -> [a] -> a---- | The <a>genericLength</a> function is an overloaded version of--- <a>length</a>. In particular, instead of returning an <a>Int</a>, it--- returns any type which is an instance of <a>Num</a>. It is, however,--- less efficient than <a>length</a>.-genericLength :: Num i => [b] -> i---- | The <a>genericTake</a> function is an overloaded version of--- <a>take</a>, which accepts any <a>Integral</a> value as the number of--- elements to take.-genericTake :: Integral i => i -> [a] -> [a]---- | The <a>genericDrop</a> function is an overloaded version of--- <a>drop</a>, which accepts any <a>Integral</a> value as the number of--- elements to drop.-genericDrop :: Integral i => i -> [a] -> [a]---- | The <a>genericSplitAt</a> function is an overloaded version of--- <a>splitAt</a>, which accepts any <a>Integral</a> value as the--- position at which to split.-genericSplitAt :: Integral i => i -> [b] -> ([b], [b])---- | The <a>genericIndex</a> function is an overloaded version of--- <a>!!</a>, which accepts any <a>Integral</a> value as the index.-genericIndex :: Integral a => [b] -> a -> b---- | The <a>genericReplicate</a> function is an overloaded version of--- <a>replicate</a>, which accepts any <a>Integral</a> value as the--- number of repetitions to make.-genericReplicate :: Integral i => i -> a -> [a]---- | The <a>zip4</a> function takes four lists and returns a list of--- quadruples, analogous to <a>zip</a>.-zip4 :: [a] -> [b] -> [c] -> [d] -> [(a, b, c, d)]---- | The <a>zip5</a> function takes five lists and returns a list of--- five-tuples, analogous to <a>zip</a>.-zip5 :: [a] -> [b] -> [c] -> [d] -> [e] -> [(a, b, c, d, e)]---- | The <a>zip6</a> function takes six lists and returns a list of--- six-tuples, analogous to <a>zip</a>.-zip6 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [(a, b, c, d, e, f)]---- | The <a>zip7</a> function takes seven lists and returns a list of--- seven-tuples, analogous to <a>zip</a>.-zip7 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [(a, b, c, d, e, f, g)]---- | The <a>zipWith4</a> function takes a function which combines four--- elements, as well as four lists and returns a list of their point-wise--- combination, analogous to <a>zipWith</a>.-zipWith4 :: (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e]---- | The <a>zipWith5</a> function takes a function which combines five--- elements, as well as five lists and returns a list of their point-wise--- combination, analogous to <a>zipWith</a>.-zipWith5 :: (a -> b -> c -> d -> e -> f) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f]---- | The <a>zipWith6</a> function takes a function which combines six--- elements, as well as six lists and returns a list of their point-wise--- combination, analogous to <a>zipWith</a>.-zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g]---- | The <a>zipWith7</a> function takes a function which combines seven--- elements, as well as seven lists and returns a list of their--- point-wise combination, analogous to <a>zipWith</a>.-zipWith7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [h]---- | The <a>unzip4</a> function takes a list of quadruples and returns four--- lists, analogous to <a>unzip</a>.-unzip4 :: [(a, b, c, d)] -> ([a], [b], [c], [d])---- | The <a>unzip5</a> function takes a list of five-tuples and returns--- five lists, analogous to <a>unzip</a>.-unzip5 :: [(a, b, c, d, e)] -> ([a], [b], [c], [d], [e])---- | The <a>unzip6</a> function takes a list of six-tuples and returns six--- lists, analogous to <a>unzip</a>.-unzip6 :: [(a, b, c, d, e, f)] -> ([a], [b], [c], [d], [e], [f])---- | The <a>unzip7</a> function takes a list of seven-tuples and returns--- seven lists, analogous to <a>unzip</a>.-unzip7 :: [(a, b, c, d, e, f, g)] -> ([a], [b], [c], [d], [e], [f], [g])---- | The <a>unfoldr</a> function is a `dual' to <a>foldr</a>: while--- <a>foldr</a> reduces a list to a summary value, <a>unfoldr</a> builds--- a list from a seed value. The function takes the element and returns--- <a>Nothing</a> if it is done producing the list or returns <a>Just</a>--- <tt>(a,b)</tt>, in which case, <tt>a</tt> is a prepended to the list--- and <tt>b</tt> is used as the next element in a recursive call. For--- example,--- --- <pre>--- iterate f == unfoldr (\x -> Just (x, f x))--- </pre>--- --- In some cases, <a>unfoldr</a> can undo a <a>foldr</a> operation:--- --- <pre>--- unfoldr f' (foldr f z xs) == xs--- </pre>--- --- if the following holds:--- --- <pre>--- f' (f x y) = Just (x,y)--- f' z = Nothing--- </pre>--- --- A simple use of unfoldr:--- --- <pre>--- unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10--- [10,9,8,7,6,5,4,3,2,1]--- </pre>-unfoldr :: (b -> Maybe (a, b)) -> b -> [a]---- | <a>map</a> <tt>f xs</tt> is the list obtained by applying <tt>f</tt>--- to each element of <tt>xs</tt>, i.e.,--- --- <pre>--- map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]--- map f [x1, x2, ...] == [f x1, f x2, ...]--- </pre>-map :: (a -> b) -> [a] -> [b]---- | Append two lists, i.e.,--- --- <pre>--- [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]--- [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]--- </pre>--- --- If the first list is not finite, the result is the first list.-(++) :: [a] -> [a] -> [a]---- | Concatenate a list of lists.-concat :: [[a]] -> [a]---- | <a>filter</a>, applied to a predicate and a list, returns the list of--- those elements that satisfy the predicate; i.e.,--- --- <pre>--- filter p xs = [ x | x <- xs, p x]--- </pre>-filter :: (a -> Bool) -> [a] -> [a]---- | Extract the first element of a list, which must be non-empty.-head :: [a] -> a---- | Extract the last element of a list, which must be finite and--- non-empty.-last :: [a] -> a---- | Extract the elements after the head of a list, which must be--- non-empty.-tail :: [a] -> [a]---- | Return all the elements of a list except the last one. The list must--- be non-empty.-init :: [a] -> [a]---- | Test whether a list is empty.-null :: [a] -> Bool---- | <i>O(n)</i>. <a>length</a> returns the length of a finite list as an--- <a>Int</a>. It is an instance of the more general--- <tt>Data.List.genericLength</tt>, the result type of which may be any--- kind of number.-length :: [a] -> Int---- | List index (subscript) operator, starting from 0. It is an instance of--- the more general <tt>Data.List.genericIndex</tt>, which takes an index--- of any integral type.-(!!) :: [a] -> Int -> a---- | <a>foldl</a>, applied to a binary operator, a starting value--- (typically the left-identity of the operator), and a list, reduces the--- list using the binary operator, from left to right:--- --- <pre>--- foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn--- </pre>--- --- The list must be finite.-foldl :: (a -> b -> a) -> a -> [b] -> a---- | <a>foldl1</a> is a variant of <a>foldl</a> that has no starting value--- argument, and thus must be applied to non-empty lists.-foldl1 :: (a -> a -> a) -> [a] -> a---- | <a>scanl</a> is similar to <a>foldl</a>, but returns a list of--- successive reduced values from the left:--- --- <pre>--- scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]--- </pre>--- --- Note that--- --- <pre>--- last (scanl f z xs) == foldl f z xs.--- </pre>-scanl :: (a -> b -> a) -> a -> [b] -> [a]---- | <a>scanl1</a> is a variant of <a>scanl</a> that has no starting value--- argument:--- --- <pre>--- scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]--- </pre>-scanl1 :: (a -> a -> a) -> [a] -> [a]---- | <a>foldr</a>, applied to a binary operator, a starting value--- (typically the right-identity of the operator), and a list, reduces--- the list using the binary operator, from right to left:--- --- <pre>--- foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)--- </pre>-foldr :: (a -> b -> b) -> b -> [a] -> b---- | <a>foldr1</a> is a variant of <a>foldr</a> that has no starting value--- argument, and thus must be applied to non-empty lists.-foldr1 :: (a -> a -> a) -> [a] -> a---- | <a>scanr</a> is the right-to-left dual of <a>scanl</a>. Note that--- --- <pre>--- head (scanr f z xs) == foldr f z xs.--- </pre>-scanr :: (a -> b -> b) -> b -> [a] -> [b]---- | <a>scanr1</a> is a variant of <a>scanr</a> that has no starting value--- argument.-scanr1 :: (a -> a -> a) -> [a] -> [a]---- | <a>iterate</a> <tt>f x</tt> returns an infinite list of repeated--- applications of <tt>f</tt> to <tt>x</tt>:--- --- <pre>--- iterate f x == [x, f x, f (f x), ...]--- </pre>-iterate :: (a -> a) -> a -> [a]---- | <a>repeat</a> <tt>x</tt> is an infinite list, with <tt>x</tt> the--- value of every element.-repeat :: a -> [a]---- | <a>replicate</a> <tt>n x</tt> is a list of length <tt>n</tt> with--- <tt>x</tt> the value of every element. It is an instance of the more--- general <tt>Data.List.genericReplicate</tt>, in which <tt>n</tt> may--- be of any integral type.-replicate :: Int -> a -> [a]---- | <a>cycle</a> ties a finite list into a circular one, or equivalently,--- the infinite repetition of the original list. It is the identity on--- infinite lists.-cycle :: [a] -> [a]---- | <a>take</a> <tt>n</tt>, applied to a list <tt>xs</tt>, returns the--- prefix of <tt>xs</tt> of length <tt>n</tt>, or <tt>xs</tt> itself if--- <tt>n > <a>length</a> xs</tt>:--- --- <pre>--- take 5 "Hello World!" == "Hello"--- take 3 [1,2,3,4,5] == [1,2,3]--- take 3 [1,2] == [1,2]--- take 3 [] == []--- take (-1) [1,2] == []--- take 0 [1,2] == []--- </pre>--- --- It is an instance of the more general <tt>Data.List.genericTake</tt>,--- in which <tt>n</tt> may be of any integral type.-take :: Int -> [a] -> [a]---- | <a>drop</a> <tt>n xs</tt> returns the suffix of <tt>xs</tt> after the--- first <tt>n</tt> elements, or <tt>[]</tt> if <tt>n > <a>length</a>--- xs</tt>:--- --- <pre>--- drop 6 "Hello World!" == "World!"--- drop 3 [1,2,3,4,5] == [4,5]--- drop 3 [1,2] == []--- drop 3 [] == []--- drop (-1) [1,2] == [1,2]--- drop 0 [1,2] == [1,2]--- </pre>--- --- It is an instance of the more general <tt>Data.List.genericDrop</tt>,--- in which <tt>n</tt> may be of any integral type.-drop :: Int -> [a] -> [a]---- | <a>splitAt</a> <tt>n xs</tt> returns a tuple where first element is--- <tt>xs</tt> prefix of length <tt>n</tt> and second element is the--- remainder of the list:--- --- <pre>--- splitAt 6 "Hello World!" == ("Hello ","World!")--- splitAt 3 [1,2,3,4,5] == ([1,2,3],[4,5])--- splitAt 1 [1,2,3] == ([1],[2,3])--- splitAt 3 [1,2,3] == ([1,2,3],[])--- splitAt 4 [1,2,3] == ([1,2,3],[])--- splitAt 0 [1,2,3] == ([],[1,2,3])--- splitAt (-1) [1,2,3] == ([],[1,2,3])--- </pre>--- --- It is equivalent to <tt>(<a>take</a> n xs, <a>drop</a> n xs)</tt> when--- <tt>n</tt> is not <tt>_|_</tt> (<tt>splitAt _|_ xs = _|_</tt>).--- <a>splitAt</a> is an instance of the more general--- <tt>Data.List.genericSplitAt</tt>, in which <tt>n</tt> may be of any--- integral type.-splitAt :: Int -> [a] -> ([a], [a])---- | <a>takeWhile</a>, applied to a predicate <tt>p</tt> and a list--- <tt>xs</tt>, returns the longest prefix (possibly empty) of--- <tt>xs</tt> of elements that satisfy <tt>p</tt>:--- --- <pre>--- takeWhile (< 3) [1,2,3,4,1,2,3,4] == [1,2]--- takeWhile (< 9) [1,2,3] == [1,2,3]--- takeWhile (< 0) [1,2,3] == []--- </pre>-takeWhile :: (a -> Bool) -> [a] -> [a]---- | <a>dropWhile</a> <tt>p xs</tt> returns the suffix remaining after--- <a>takeWhile</a> <tt>p xs</tt>:--- --- <pre>--- dropWhile (< 3) [1,2,3,4,5,1,2,3] == [3,4,5,1,2,3]--- dropWhile (< 9) [1,2,3] == []--- dropWhile (< 0) [1,2,3] == [1,2,3]--- </pre>-dropWhile :: (a -> Bool) -> [a] -> [a]---- | <a>span</a>, applied to a predicate <tt>p</tt> and a list <tt>xs</tt>,--- returns a tuple where first element is longest prefix (possibly empty)--- of <tt>xs</tt> of elements that satisfy <tt>p</tt> and second element--- is the remainder of the list:--- --- <pre>--- span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4])--- span (< 9) [1,2,3] == ([1,2,3],[])--- span (< 0) [1,2,3] == ([],[1,2,3])--- </pre>--- --- <a>span</a> <tt>p xs</tt> is equivalent to <tt>(<a>takeWhile</a> p xs,--- <a>dropWhile</a> p xs)</tt>-span :: (a -> Bool) -> [a] -> ([a], [a])---- | <a>break</a>, applied to a predicate <tt>p</tt> and a list--- <tt>xs</tt>, returns a tuple where first element is longest prefix--- (possibly empty) of <tt>xs</tt> of elements that <i>do not satisfy</i>--- <tt>p</tt> and second element is the remainder of the list:--- --- <pre>--- break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4])--- break (< 9) [1,2,3] == ([],[1,2,3])--- break (> 9) [1,2,3] == ([1,2,3],[])--- </pre>--- --- <a>break</a> <tt>p</tt> is equivalent to <tt><a>span</a> (<a>not</a> .--- p)</tt>.-break :: (a -> Bool) -> [a] -> ([a], [a])---- | <a>lines</a> breaks a string up into a list of strings at newline--- characters. The resulting strings do not contain newlines.-lines :: String -> [String]---- | <a>words</a> breaks a string up into a list of words, which were--- delimited by white space.-words :: String -> [String]---- | <a>unlines</a> is an inverse operation to <a>lines</a>. It joins--- lines, after appending a terminating newline to each.-unlines :: [String] -> String---- | <a>unwords</a> is an inverse operation to <a>words</a>. It joins words--- with separating spaces.-unwords :: [String] -> String---- | <a>reverse</a> <tt>xs</tt> returns the elements of <tt>xs</tt> in--- reverse order. <tt>xs</tt> must be finite.-reverse :: [a] -> [a]---- | <a>and</a> returns the conjunction of a Boolean list. For the result--- to be <a>True</a>, the list must be finite; <a>False</a>, however,--- results from a <a>False</a> value at a finite index of a finite or--- infinite list.-and :: [Bool] -> Bool---- | <a>or</a> returns the disjunction of a Boolean list. For the result to--- be <a>False</a>, the list must be finite; <a>True</a>, however,--- results from a <a>True</a> value at a finite index of a finite or--- infinite list.-or :: [Bool] -> Bool---- | Applied to a predicate and a list, <a>any</a> determines if any--- element of the list satisfies the predicate. For the result to be--- <a>False</a>, the list must be finite; <a>True</a>, however, results--- from a <a>True</a> value for the predicate applied to an element at a--- finite index of a finite or infinite list.-any :: (a -> Bool) -> [a] -> Bool---- | Applied to a predicate and a list, <a>all</a> determines if all--- elements of the list satisfy the predicate. For the result to be--- <a>True</a>, the list must be finite; <a>False</a>, however, results--- from a <a>False</a> value for the predicate applied to an element at a--- finite index of a finite or infinite list.-all :: (a -> Bool) -> [a] -> Bool---- | <a>elem</a> is the list membership predicate, usually written in infix--- form, e.g., <tt>x `elem` xs</tt>. For the result to be <a>False</a>,--- the list must be finite; <a>True</a>, however, results from an element--- equal to <tt>x</tt> found at a finite index of a finite or infinite--- list.-elem :: Eq a => a -> [a] -> Bool---- | <a>notElem</a> is the negation of <a>elem</a>.-notElem :: Eq a => a -> [a] -> Bool---- | <a>lookup</a> <tt>key assocs</tt> looks up a key in an association--- list.-lookup :: Eq a => a -> [(a, b)] -> Maybe b---- | The <a>sum</a> function computes the sum of a finite list of numbers.-sum :: Num a => [a] -> a---- | The <a>product</a> function computes the product of a finite list of--- numbers.-product :: Num a => [a] -> a---- | <a>maximum</a> returns the maximum value from a list, which must be--- non-empty, finite, and of an ordered type. It is a special case of--- <a>maximumBy</a>, which allows the programmer to supply their own--- comparison function.-maximum :: Ord a => [a] -> a---- | <a>minimum</a> returns the minimum value from a list, which must be--- non-empty, finite, and of an ordered type. It is a special case of--- <a>minimumBy</a>, which allows the programmer to supply their own--- comparison function.-minimum :: Ord a => [a] -> a---- | Map a function over a list and concatenate the results.-concatMap :: (a -> [b]) -> [a] -> [b]---- | <a>zip</a> takes two lists and returns a list of corresponding pairs.--- If one input list is short, excess elements of the longer list are--- discarded.-zip :: [a] -> [b] -> [(a, b)]---- | <a>zip3</a> takes three lists and returns a list of triples, analogous--- to <a>zip</a>.-zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]---- | <a>zipWith</a> generalises <a>zip</a> by zipping with the function--- given as the first argument, instead of a tupling function. For--- example, <tt><a>zipWith</a> (+)</tt> is applied to two lists to--- produce the list of corresponding sums.-zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]---- | The <a>zipWith3</a> function takes a function which combines three--- elements, as well as three lists and returns a list of their--- point-wise combination, analogous to <a>zipWith</a>.-zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]---- | <a>unzip</a> transforms a list of pairs into a list of first--- components and a list of second components.-unzip :: [(a, b)] -> ([a], [b])---- | The <a>unzip3</a> function takes a list of triples and returns three--- lists, analogous to <a>unzip</a>.-unzip3 :: [(a, b, c)] -> ([a], [b], [c])--module System---- | Defines the exit codes that a program can return.-data ExitCode :: *---- | indicates successful termination;-ExitSuccess :: ExitCode---- | indicates program failure with an exit code. The exact interpretation--- of the code is operating-system dependent. In particular, some values--- may be prohibited (e.g. 0 on a POSIX-compliant system).-ExitFailure :: Int -> ExitCode---- | Computation <a>getArgs</a> returns a list of the program's command--- line arguments (not including the program name).-getArgs :: IO [String]---- | Computation <a>getProgName</a> returns the name of the program as it--- was invoked.--- --- However, this is hard-to-impossible to implement on some non-Unix--- OSes, so instead, for maximum portability, we just return the leafname--- of the program as invoked. Even then there are some differences--- between platforms: on Windows, for example, a program invoked as foo--- is probably really <tt>FOO.EXE</tt>, and that is what--- <a>getProgName</a> will return.-getProgName :: IO String---- | Computation <a>getEnv</a> <tt>var</tt> returns the value of the--- environment variable <tt>var</tt>.--- --- This computation may fail with:--- --- <ul>--- <li><tt>System.IO.Error.isDoesNotExistError</tt> if the environment--- variable does not exist.</li>--- </ul>-getEnv :: String -> IO String---- | Computation <tt>system cmd</tt> returns the exit code produced when--- the operating system runs the shell command <tt>cmd</tt>.--- --- This computation may fail with--- --- <ul>--- <li><tt>PermissionDenied</tt>: The process has insufficient privileges--- to perform the operation.</li>--- <li><tt>ResourceExhausted</tt>: Insufficient resources are available--- to perform the operation.</li>--- <li><tt>UnsupportedOperation</tt>: The implementation does not support--- system calls.</li>--- </ul>--- --- On Windows, <a>system</a> passes the command to the Windows command--- interpreter (<tt>CMD.EXE</tt> or <tt>COMMAND.COM</tt>), hence Unixy--- shell tricks will not work.-system :: String -> IO ExitCode---- | Computation <a>exitWith</a> <tt>code</tt> throws <a>ExitCode</a>--- <tt>code</tt>. Normally this terminates the program, returning--- <tt>code</tt> to the program's caller.--- --- On program termination, the standard <tt>Handle</tt>s <tt>stdout</tt>--- and <tt>stderr</tt> are flushed automatically; any other buffered--- <tt>Handle</tt>s need to be flushed manually, otherwise the buffered--- data will be discarded.--- --- A program that fails in any other way is treated as if it had called--- <a>exitFailure</a>. A program that terminates successfully without--- calling <a>exitWith</a> explicitly is treated as it it had called--- <a>exitWith</a> <a>ExitSuccess</a>.--- --- As an <a>ExitCode</a> is not an <a>IOError</a>, <a>exitWith</a>--- bypasses the error handling in the <a>IO</a> monad and cannot be--- intercepted by <a>catch</a> from the <a>Prelude</a>. However it is a--- <tt>SomeException</tt>, and can be caught using the functions of--- <a>Control.Exception</a>. This means that cleanup computations added--- with <tt>Control.Exception.bracket</tt> (from--- <a>Control.Exception</a>) are also executed properly on--- <a>exitWith</a>.--- --- Note: in GHC, <a>exitWith</a> should be called from the main program--- thread in order to exit the process. When called from another thread,--- <a>exitWith</a> will throw an <tt>ExitException</tt> as normal, but--- the exception will not cause the process itself to exit.-exitWith :: ExitCode -> IO a---- | The computation <a>exitFailure</a> is equivalent to <a>exitWith</a>--- <tt>(</tt><a>ExitFailure</a> <i>exitfail</i><tt>)</tt>, where--- <i>exitfail</i> is implementation-dependent.-exitFailure :: IO a--module CPUTime---- | Computation <a>getCPUTime</a> returns the number of picoseconds CPU--- time used by the current program. The precision of this result is--- implementation-dependent.-getCPUTime :: IO Integer---- | The <a>cpuTimePrecision</a> constant is the smallest measurable--- difference in CPU time that the implementation can record, and is--- given as an integral number of picoseconds.-cpuTimePrecision :: Integer--module Complex---- | Complex numbers are an algebraic type.--- --- For a complex number <tt>z</tt>, <tt><a>abs</a> z</tt> is a number--- with the magnitude of <tt>z</tt>, but oriented in the positive real--- direction, whereas <tt><a>signum</a> z</tt> has the phase of--- <tt>z</tt>, but unit magnitude.-data Complex a :: * -> *---- | forms a complex number from its real and imaginary rectangular--- components.-(:+) :: !a -> !a -> Complex a---- | Extracts the real part of a complex number.-realPart :: RealFloat a => Complex a -> a---- | Extracts the imaginary part of a complex number.-imagPart :: RealFloat a => Complex a -> a---- | The conjugate of a complex number.-conjugate :: RealFloat a => Complex a -> Complex a---- | Form a complex number from polar components of magnitude and phase.-mkPolar :: RealFloat a => a -> a -> Complex a---- | <tt><a>cis</a> t</tt> is a complex value with magnitude <tt>1</tt> and--- phase <tt>t</tt> (modulo <tt>2*<a>pi</a></tt>).-cis :: RealFloat a => a -> Complex a---- | The function <a>polar</a> takes a complex number and returns a--- (magnitude, phase) pair in canonical form: the magnitude is--- nonnegative, and the phase in the range <tt>(-<a>pi</a>,--- <a>pi</a>]</tt>; if the magnitude is zero, then so is the phase.-polar :: RealFloat a => Complex a -> (a, a)---- | The nonnegative magnitude of a complex number.-magnitude :: RealFloat a => Complex a -> a---- | The phase of a complex number, in the range <tt>(-<a>pi</a>,--- <a>pi</a>]</tt>. If the magnitude is zero, then so is the phase.-phase :: RealFloat a => Complex a -> a--module CString--module Storable--module Directory-data Permissions-Permissions :: Bool -> Bool -> Bool -> Bool -> Permissions-readable :: Permissions -> Bool-writable :: Permissions -> Bool-executable :: Permissions -> Bool-searchable :: Permissions -> Bool---- | <tt><a>createDirectory</a> dir</tt> creates a new directory--- <tt>dir</tt> which is initially empty, or as near to empty as the--- operating system allows.--- --- The operation may fail with:--- --- <ul>--- <li><a>isPermissionError</a> / <a>PermissionDenied</a> The process has--- insufficient privileges to perform the operation. <tt>[EROFS,--- EACCES]</tt></li>--- <li><a>isAlreadyExistsError</a> / <a>AlreadyExists</a> The operand--- refers to a directory that already exists. <tt> [EEXIST]</tt></li>--- <li><a>HardwareFault</a> A physical I/O error has occurred.--- <tt>[EIO]</tt></li>--- <li><a>InvalidArgument</a> The operand is not a valid directory name.--- <tt>[ENAMETOOLONG, ELOOP]</tt></li>--- <li><a>NoSuchThing</a> There is no path to the directory. <tt>[ENOENT,--- ENOTDIR]</tt></li>--- <li><a>ResourceExhausted</a> Insufficient resources (virtual memory,--- process file descriptors, physical disk space, etc.) are available to--- perform the operation. <tt>[EDQUOT, ENOSPC, ENOMEM, EMLINK]</tt></li>--- <li><a>InappropriateType</a> The path refers to an existing--- non-directory object. <tt>[EEXIST]</tt></li>--- </ul>-createDirectory :: FilePath -> IO ()---- | <tt><a>removeDirectory</a> dir</tt> removes an existing directory--- <i>dir</i>. The implementation may specify additional constraints--- which must be satisfied before a directory can be removed (e.g. the--- directory has to be empty, or may not be in use by other processes).--- It is not legal for an implementation to partially remove a directory--- unless the entire directory is removed. A conformant implementation--- need not support directory removal in all situations (e.g. removal of--- the root directory).--- --- The operation may fail with:--- --- <ul>--- <li><a>HardwareFault</a> A physical I/O error has occurred. EIO</li>--- <li><a>InvalidArgument</a> The operand is not a valid directory name.--- [ENAMETOOLONG, ELOOP]</li>--- <li><a>isDoesNotExistError</a> / <a>NoSuchThing</a> The directory does--- not exist. <tt>[ENOENT, ENOTDIR]</tt></li>--- <li><a>isPermissionError</a> / <a>PermissionDenied</a> The process has--- insufficient privileges to perform the operation. <tt>[EROFS, EACCES,--- EPERM]</tt></li>--- <li><a>UnsatisfiedConstraints</a> Implementation-dependent constraints--- are not satisfied. <tt>[EBUSY, ENOTEMPTY, EEXIST]</tt></li>--- <li><a>UnsupportedOperation</a> The implementation does not support--- removal in this situation. <tt>[EINVAL]</tt></li>--- <li><a>InappropriateType</a> The operand refers to an existing--- non-directory object. <tt>[ENOTDIR]</tt></li>--- </ul>-removeDirectory :: FilePath -> IO ()---- | <a>removeFile</a> <i>file</i> removes the directory entry for an--- existing file <i>file</i>, where <i>file</i> is not itself a--- directory. The implementation may specify additional constraints which--- must be satisfied before a file can be removed (e.g. the file may not--- be in use by other processes).--- --- The operation may fail with:--- --- <ul>--- <li><a>HardwareFault</a> A physical I/O error has occurred.--- <tt>[EIO]</tt></li>--- <li><a>InvalidArgument</a> The operand is not a valid file name.--- <tt>[ENAMETOOLONG, ELOOP]</tt></li>--- <li><a>isDoesNotExistError</a> / <a>NoSuchThing</a> The file does not--- exist. <tt>[ENOENT, ENOTDIR]</tt></li>--- <li><a>isPermissionError</a> / <a>PermissionDenied</a> The process has--- insufficient privileges to perform the operation. <tt>[EROFS, EACCES,--- EPERM]</tt></li>--- <li><a>UnsatisfiedConstraints</a> Implementation-dependent constraints--- are not satisfied. <tt>[EBUSY]</tt></li>--- <li><a>InappropriateType</a> The operand refers to an existing--- directory. <tt>[EPERM, EINVAL]</tt></li>--- </ul>-removeFile :: FilePath -> IO ()---- | <tt><a>renameDirectory</a> old new</tt> changes the name of an--- existing directory from <i>old</i> to <i>new</i>. If the <i>new</i>--- directory already exists, it is atomically replaced by the <i>old</i>--- directory. If the <i>new</i> directory is neither the <i>old</i>--- directory nor an alias of the <i>old</i> directory, it is removed as--- if by <a>removeDirectory</a>. A conformant implementation need not--- support renaming directories in all situations (e.g. renaming to an--- existing directory, or across different physical devices), but the--- constraints must be documented.--- --- On Win32 platforms, <tt>renameDirectory</tt> fails if the <i>new</i>--- directory already exists.--- --- The operation may fail with:--- --- <ul>--- <li><a>HardwareFault</a> A physical I/O error has occurred.--- <tt>[EIO]</tt></li>--- <li><a>InvalidArgument</a> Either operand is not a valid directory--- name. <tt>[ENAMETOOLONG, ELOOP]</tt></li>--- <li><a>isDoesNotExistError</a> / <a>NoSuchThing</a> The original--- directory does not exist, or there is no path to the target.--- <tt>[ENOENT, ENOTDIR]</tt></li>--- <li><a>isPermissionError</a> / <a>PermissionDenied</a> The process has--- insufficient privileges to perform the operation. <tt>[EROFS, EACCES,--- EPERM]</tt></li>--- <li><a>ResourceExhausted</a> Insufficient resources are available to--- perform the operation. <tt>[EDQUOT, ENOSPC, ENOMEM, EMLINK]</tt></li>--- <li><a>UnsatisfiedConstraints</a> Implementation-dependent constraints--- are not satisfied. <tt>[EBUSY, ENOTEMPTY, EEXIST]</tt></li>--- <li><a>UnsupportedOperation</a> The implementation does not support--- renaming in this situation. <tt>[EINVAL, EXDEV]</tt></li>--- <li><a>InappropriateType</a> Either path refers to an existing--- non-directory object. <tt>[ENOTDIR, EISDIR]</tt></li>--- </ul>-renameDirectory :: FilePath -> FilePath -> IO ()---- | <tt><a>renameFile</a> old new</tt> changes the name of an existing--- file system object from <i>old</i> to <i>new</i>. If the <i>new</i>--- object already exists, it is atomically replaced by the <i>old</i>--- object. Neither path may refer to an existing directory. A conformant--- implementation need not support renaming files in all situations (e.g.--- renaming across different physical devices), but the constraints must--- be documented.--- --- The operation may fail with:--- --- <ul>--- <li><a>HardwareFault</a> A physical I/O error has occurred.--- <tt>[EIO]</tt></li>--- <li><a>InvalidArgument</a> Either operand is not a valid file name.--- <tt>[ENAMETOOLONG, ELOOP]</tt></li>--- <li><a>isDoesNotExistError</a> / <a>NoSuchThing</a> The original file--- does not exist, or there is no path to the target. <tt>[ENOENT,--- ENOTDIR]</tt></li>--- <li><a>isPermissionError</a> / <a>PermissionDenied</a> The process has--- insufficient privileges to perform the operation. <tt>[EROFS, EACCES,--- EPERM]</tt></li>--- <li><a>ResourceExhausted</a> Insufficient resources are available to--- perform the operation. <tt>[EDQUOT, ENOSPC, ENOMEM, EMLINK]</tt></li>--- <li><a>UnsatisfiedConstraints</a> Implementation-dependent constraints--- are not satisfied. <tt>[EBUSY]</tt></li>--- <li><a>UnsupportedOperation</a> The implementation does not support--- renaming in this situation. <tt>[EXDEV]</tt></li>--- <li><a>InappropriateType</a> Either path refers to an existing--- directory. <tt>[ENOTDIR, EISDIR, EINVAL, EEXIST, ENOTEMPTY]</tt></li>--- </ul>-renameFile :: FilePath -> FilePath -> IO ()---- | <tt><a>getDirectoryContents</a> dir</tt> returns a list of <i>all</i>--- entries in <i>dir</i>.--- --- The operation may fail with:--- --- <ul>--- <li><a>HardwareFault</a> A physical I/O error has occurred.--- <tt>[EIO]</tt></li>--- <li><a>InvalidArgument</a> The operand is not a valid directory name.--- <tt>[ENAMETOOLONG, ELOOP]</tt></li>--- <li><a>isDoesNotExistError</a> / <a>NoSuchThing</a> The directory does--- not exist. <tt>[ENOENT, ENOTDIR]</tt></li>--- <li><a>isPermissionError</a> / <a>PermissionDenied</a> The process has--- insufficient privileges to perform the operation.--- <tt>[EACCES]</tt></li>--- <li><a>ResourceExhausted</a> Insufficient resources are available to--- perform the operation. <tt>[EMFILE, ENFILE]</tt></li>--- <li><a>InappropriateType</a> The path refers to an existing--- non-directory object. <tt>[ENOTDIR]</tt></li>--- </ul>-getDirectoryContents :: FilePath -> IO [FilePath]---- | If the operating system has a notion of current directories,--- <a>getCurrentDirectory</a> returns an absolute path to the current--- directory of the calling process.--- --- The operation may fail with:--- --- <ul>--- <li><a>HardwareFault</a> A physical I/O error has occurred.--- <tt>[EIO]</tt></li>--- <li><a>isDoesNotExistError</a> / <a>NoSuchThing</a> There is no path--- referring to the current directory. <tt>[EPERM, ENOENT,--- ESTALE...]</tt></li>--- <li><a>isPermissionError</a> / <a>PermissionDenied</a> The process has--- insufficient privileges to perform the operation.--- <tt>[EACCES]</tt></li>--- <li><a>ResourceExhausted</a> Insufficient resources are available to--- perform the operation.</li>--- <li><a>UnsupportedOperation</a> The operating system has no notion of--- current directory.</li>--- </ul>--- --- Note that in a concurrent program, the current directory is global--- state shared between all threads of the process. When using filesystem--- operations from multiple threads, it is therefore highly recommended--- to use absolute rather than relative <a>FilePath</a>s.-getCurrentDirectory :: IO FilePath---- | If the operating system has a notion of current directories,--- <tt><a>setCurrentDirectory</a> dir</tt> changes the current directory--- of the calling process to <i>dir</i>.--- --- The operation may fail with:--- --- <ul>--- <li><a>HardwareFault</a> A physical I/O error has occurred.--- <tt>[EIO]</tt></li>--- <li><a>InvalidArgument</a> The operand is not a valid directory name.--- <tt>[ENAMETOOLONG, ELOOP]</tt></li>--- <li><a>isDoesNotExistError</a> / <a>NoSuchThing</a> The directory does--- not exist. <tt>[ENOENT, ENOTDIR]</tt></li>--- <li><a>isPermissionError</a> / <a>PermissionDenied</a> The process has--- insufficient privileges to perform the operation.--- <tt>[EACCES]</tt></li>--- <li><a>UnsupportedOperation</a> The operating system has no notion of--- current directory, or the current directory cannot be dynamically--- changed.</li>--- <li><a>InappropriateType</a> The path refers to an existing--- non-directory object. <tt>[ENOTDIR]</tt></li>--- </ul>--- --- Note that in a concurrent program, the current directory is global--- state shared between all threads of the process. When using filesystem--- operations from multiple threads, it is therefore highly recommended--- to use absolute rather than relative <a>FilePath</a>s.-setCurrentDirectory :: FilePath -> IO ()---- | The operation <a>doesFileExist</a> returns <a>True</a> if the argument--- file exists and is not a directory, and <a>False</a> otherwise.-doesFileExist :: FilePath -> IO Bool---- | The operation <a>doesDirectoryExist</a> returns <a>True</a> if the--- argument file exists and is a directory, and <a>False</a> otherwise.-doesDirectoryExist :: FilePath -> IO Bool-getPermissions :: FilePath -> IO Permissions-setPermissions :: FilePath -> Permissions -> IO ()---- | The <a>getModificationTime</a> operation returns the clock time at--- which the file or directory was last modified.--- --- The operation may fail with:--- --- <ul>--- <li><a>isPermissionError</a> if the user is not permitted to access--- the modification time; or</li>--- <li><a>isDoesNotExistError</a> if the file or directory does not--- exist.</li>--- </ul>-getModificationTime :: FilePath -> IO ClockTime-instance Eq Permissions-instance Ord Permissions-instance Read Permissions-instance Show Permissions--module Bits--module Maybe---- | The <a>isJust</a> function returns <a>True</a> iff its argument is of--- the form <tt>Just _</tt>.-isJust :: Maybe a -> Bool---- | The <a>isNothing</a> function returns <a>True</a> iff its argument is--- <a>Nothing</a>.-isNothing :: Maybe a -> Bool---- | The <a>fromJust</a> function extracts the element out of a <a>Just</a>--- and throws an error if its argument is <a>Nothing</a>.-fromJust :: Maybe a -> a---- | The <a>fromMaybe</a> function takes a default value and and--- <a>Maybe</a> value. If the <a>Maybe</a> is <a>Nothing</a>, it returns--- the default values; otherwise, it returns the value contained in the--- <a>Maybe</a>.-fromMaybe :: a -> Maybe a -> a---- | The <a>listToMaybe</a> function returns <a>Nothing</a> on an empty--- list or <tt><a>Just</a> a</tt> where <tt>a</tt> is the first element--- of the list.-listToMaybe :: [a] -> Maybe a---- | The <a>maybeToList</a> function returns an empty list when given--- <a>Nothing</a> or a singleton list when not given <a>Nothing</a>.-maybeToList :: Maybe a -> [a]---- | The <a>catMaybes</a> function takes a list of <a>Maybe</a>s and--- returns a list of all the <a>Just</a> values.-catMaybes :: [Maybe a] -> [a]---- | The <a>mapMaybe</a> function is a version of <a>map</a> which can--- throw out elements. In particular, the functional argument returns--- something of type <tt><a>Maybe</a> b</tt>. If this is <a>Nothing</a>,--- no element is added on to the result list. If it just <tt><a>Just</a>--- b</tt>, then <tt>b</tt> is included in the result list.-mapMaybe :: (a -> Maybe b) -> [a] -> [b]---- | The <a>Maybe</a> type encapsulates an optional value. A value of type--- <tt><a>Maybe</a> a</tt> either contains a value of type <tt>a</tt>--- (represented as <tt><a>Just</a> a</tt>), or it is empty (represented--- as <a>Nothing</a>). Using <a>Maybe</a> is a good way to deal with--- errors or exceptional cases without resorting to drastic measures such--- as <a>error</a>.--- --- The <a>Maybe</a> type is also a monad. It is a simple kind of error--- monad, where all errors are represented by <a>Nothing</a>. A richer--- error monad can be built using the <tt>Data.Either.Either</tt> type.-data Maybe a :: * -> *-Nothing :: Maybe a-Just :: a -> Maybe a---- | The <a>maybe</a> function takes a default value, a function, and a--- <a>Maybe</a> value. If the <a>Maybe</a> value is <a>Nothing</a>, the--- function returns the default value. Otherwise, it applies the function--- to the value inside the <a>Just</a> and returns the result.-maybe :: b -> (a -> b) -> Maybe a -> b--module Random---- | The class <a>RandomGen</a> provides a common interface to random--- number generators.--- --- Minimal complete definition: <a>next</a> and <a>split</a>.-class RandomGen g-next :: RandomGen g => g -> (Int, g)-split :: RandomGen g => g -> (g, g)-genRange :: RandomGen g => g -> (Int, Int)---- | The <a>StdGen</a> instance of <a>RandomGen</a> has a <a>genRange</a>--- of at least 30 bits.--- --- The result of repeatedly using <a>next</a> should be at least as--- statistically robust as the <i>Minimal Standard Random Number--- Generator</i> described by [<a>System.Random#Park</a>,--- <a>System.Random#Carta</a>]. Until more is known about implementations--- of <a>split</a>, all we require is that <a>split</a> deliver--- generators that are (a) not identical and (b) independently robust in--- the sense just given.--- --- The <a>Show</a> and <a>Read</a> instances of <a>StdGen</a> provide a--- primitive way to save the state of a random number generator. It is--- required that <tt><a>read</a> (<a>show</a> g) == g</tt>.--- --- In addition, <a>reads</a> may be used to map an arbitrary string (not--- necessarily one produced by <a>show</a>) onto a value of type--- <a>StdGen</a>. In general, the <a>Read</a> instance of <a>StdGen</a>--- has the following properties:--- --- <ul>--- <li>It guarantees to succeed on any string.</li>--- <li>It guarantees to consume only a finite portion of the string.</li>--- <li>Different argument strings are likely to result in different--- results.</li>--- </ul>-data StdGen :: *---- | The function <a>mkStdGen</a> provides an alternative way of producing--- an initial generator, by mapping an <a>Int</a> into a generator.--- Again, distinct arguments should be likely to produce distinct--- generators.-mkStdGen :: Int -> StdGen---- | With a source of random number supply in hand, the <a>Random</a> class--- allows the programmer to extract random values of a variety of types.--- --- Minimal complete definition: <a>randomR</a> and <a>random</a>.-class Random a-randomR :: (Random a, RandomGen g) => (a, a) -> g -> (a, g)-random :: (Random a, RandomGen g) => g -> (a, g)-randomRs :: (Random a, RandomGen g) => (a, a) -> g -> [a]-randoms :: (Random a, RandomGen g) => g -> [a]-randomRIO :: Random a => (a, a) -> IO a-randomIO :: Random a => IO a---- | Uses the supplied function to get a value from the current global--- random generator, and updates the global generator with the new--- generator returned by the function. For example, <tt>rollDice</tt>--- gets a random integer between 1 and 6:--- --- <pre>--- rollDice :: IO Int--- rollDice = getStdRandom (randomR (1,6))--- </pre>-getStdRandom :: (StdGen -> (a, StdGen)) -> IO a---- | Gets the global random number generator.-getStdGen :: IO StdGen---- | Sets the global random number generator.-setStdGen :: StdGen -> IO ()---- | Applies <a>split</a> to the current global random generator, updates--- it with one of the results, and returns the other.-newStdGen :: IO StdGen--module Word--module Ptr--module StablePtr--module Monad---- | Monads that also support choice and failure.-class Monad m => MonadPlus m :: (* -> *)-mzero :: MonadPlus m => m a-mplus :: MonadPlus m => m a -> m a -> m a---- | The <a>join</a> function is the conventional monad join operator. It--- is used to remove one level of monadic structure, projecting its bound--- argument into the outer level.-join :: Monad m => m (m a) -> m a---- | <tt><a>guard</a> b</tt> is <tt><a>return</a> ()</tt> if <tt>b</tt> is--- <a>True</a>, and <a>mzero</a> if <tt>b</tt> is <a>False</a>.-guard :: MonadPlus m => Bool -> m ()---- | Conditional execution of monadic expressions. For example,--- --- <pre>--- when debug (putStr "Debugging\n")--- </pre>--- --- will output the string <tt>Debugging\n</tt> if the Boolean value--- <tt>debug</tt> is <a>True</a>, and otherwise do nothing.-when :: Monad m => Bool -> m () -> m ()---- | The reverse of <a>when</a>.-unless :: Monad m => Bool -> m () -> m ()---- | In many situations, the <a>liftM</a> operations can be replaced by--- uses of <a>ap</a>, which promotes function application.--- --- <pre>--- return f `ap` x1 `ap` ... `ap` xn--- </pre>--- --- is equivalent to--- --- <pre>--- liftMn f x1 x2 ... xn--- </pre>-ap :: Monad m => m (a -> b) -> m a -> m b---- | This generalizes the list-based <a>concat</a> function.-msum :: MonadPlus m => [m a] -> m a---- | This generalizes the list-based <a>filter</a> function.-filterM :: Monad m => (a -> m Bool) -> [a] -> m [a]---- | The <a>mapAndUnzipM</a> function maps its first argument over a list,--- returning the result as a pair of lists. This function is mainly used--- with complicated data structures or a state-transforming monad.-mapAndUnzipM :: Monad m => (a -> m (b, c)) -> [a] -> m ([b], [c])---- | The <a>zipWithM</a> function generalizes <a>zipWith</a> to arbitrary--- monads.-zipWithM :: Monad m => (a -> b -> m c) -> [a] -> [b] -> m [c]---- | <a>zipWithM_</a> is the extension of <a>zipWithM</a> which ignores the--- final result.-zipWithM_ :: Monad m => (a -> b -> m c) -> [a] -> [b] -> m ()---- | The <a>foldM</a> function is analogous to <a>foldl</a>, except that--- its result is encapsulated in a monad. Note that <a>foldM</a> works--- from left-to-right over the list arguments. This could be an issue--- where <tt>(<a>>></a>)</tt> and the `folded function' are not--- commutative.--- --- <pre>--- foldM f a1 [x1, x2, ..., xm]--- </pre>--- --- ==--- --- <pre>--- do--- a2 <- f a1 x1--- a3 <- f a2 x2--- ...--- f am xm--- </pre>--- --- If right-to-left evaluation is required, the input list should be--- reversed.-foldM :: Monad m => (a -> b -> m a) -> a -> [b] -> m a---- | Promote a function to a monad.-liftM :: Monad m => (a1 -> r) -> m a1 -> m r---- | Promote a function to a monad, scanning the monadic arguments from--- left to right. For example,--- --- <pre>--- liftM2 (+) [0,1] [0,2] = [0,2,1,3]--- liftM2 (+) (Just 1) Nothing = Nothing--- </pre>-liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r---- | Promote a function to a monad, scanning the monadic arguments from--- left to right (cf. <a>liftM2</a>).-liftM3 :: Monad m => (a1 -> a2 -> a3 -> r) -> m a1 -> m a2 -> m a3 -> m r---- | Promote a function to a monad, scanning the monadic arguments from--- left to right (cf. <a>liftM2</a>).-liftM4 :: Monad m => (a1 -> a2 -> a3 -> a4 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m r---- | Promote a function to a monad, scanning the monadic arguments from--- left to right (cf. <a>liftM2</a>).-liftM5 :: Monad m => (a1 -> a2 -> a3 -> a4 -> a5 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m a5 -> m r---- | The <a>Monad</a> class defines the basic operations over a--- <i>monad</i>, a concept from a branch of mathematics known as--- <i>category theory</i>. From the perspective of a Haskell programmer,--- however, it is best to think of a monad as an <i>abstract datatype</i>--- of actions. Haskell's <tt>do</tt> expressions provide a convenient--- syntax for writing monadic expressions.--- --- Minimal complete definition: <a>>>=</a> and <a>return</a>.--- --- Instances of <a>Monad</a> should satisfy the following laws:--- --- <pre>--- return a >>= k == k a--- m >>= return == m--- m >>= (\x -> k x >>= h) == (m >>= k) >>= h--- </pre>--- --- Instances of both <a>Monad</a> and <a>Functor</a> should additionally--- satisfy the law:--- --- <pre>--- fmap f xs == xs >>= return . f--- </pre>--- --- The instances of <a>Monad</a> for lists, <tt>Data.Maybe.Maybe</tt> and--- <tt>System.IO.IO</tt> defined in the <a>Prelude</a> satisfy these--- laws.-class Monad m :: (* -> *)-(>>=) :: Monad m => m a -> (a -> m b) -> m b-(>>) :: Monad m => m a -> m b -> m b-return :: Monad m => a -> m a-fail :: Monad m => String -> m a---- | The <a>Functor</a> class is used for types that can be mapped over.--- Instances of <a>Functor</a> should satisfy the following laws:--- --- <pre>--- fmap id == id--- fmap (f . g) == fmap f . fmap g--- </pre>--- --- The instances of <a>Functor</a> for lists, <tt>Data.Maybe.Maybe</tt>--- and <tt>System.IO.IO</tt> satisfy these laws.-class Functor f :: (* -> *)-fmap :: Functor f => (a -> b) -> f a -> f b---- | <tt><a>mapM</a> f</tt> is equivalent to <tt><a>sequence</a> .--- <a>map</a> f</tt>.-mapM :: Monad m => (a -> m b) -> [a] -> m [b]---- | <tt><a>mapM_</a> f</tt> is equivalent to <tt><a>sequence_</a> .--- <a>map</a> f</tt>.-mapM_ :: Monad m => (a -> m b) -> [a] -> m ()---- | Evaluate each action in the sequence from left to right, and collect--- the results.-sequence :: Monad m => [m a] -> m [a]---- | Evaluate each action in the sequence from left to right, and ignore--- the results.-sequence_ :: Monad m => [m a] -> m ()---- | Same as <a>>>=</a>, but with the arguments interchanged.-(=<<) :: Monad m => (a -> m b) -> m a -> m b--module Ratio---- | Rational numbers, with numerator and denominator of some--- <a>Integral</a> type.-data Ratio a :: * -> *---- | Arbitrary-precision rational numbers, represented as a ratio of two--- <a>Integer</a> values. A rational number may be constructed using the--- <a>%</a> operator.-type Rational = Ratio Integer---- | Forms the ratio of two integral numbers.-(%) :: Integral a => a -> a -> Ratio a---- | Extract the numerator of the ratio in reduced form: the numerator and--- denominator have no common factor and the denominator is positive.-numerator :: Integral a => Ratio a -> a---- | Extract the denominator of the ratio in reduced form: the numerator--- and denominator have no common factor and the denominator is positive.-denominator :: Integral a => Ratio a -> a---- | <a>approxRational</a>, applied to two real fractional numbers--- <tt>x</tt> and <tt>epsilon</tt>, returns the simplest rational number--- within <tt>epsilon</tt> of <tt>x</tt>. A rational number <tt>y</tt> is--- said to be <i>simpler</i> than another <tt>y'</tt> if--- --- <ul>--- <li><tt><a>abs</a> (<a>numerator</a> y) <= <a>abs</a>--- (<a>numerator</a> y')</tt>, and</li>--- <li><tt><a>denominator</a> y <= <a>denominator</a> y'</tt>.</li>--- </ul>--- --- Any real interval contains a unique simplest rational; in particular,--- note that <tt>0/1</tt> is the simplest rational of all.-approxRational :: RealFrac a => a -> a -> Rational--module ForeignPtr--module IO---- | Haskell defines operations to read and write characters from and to--- files, represented by values of type <tt>Handle</tt>. Each value of--- this type is a <i>handle</i>: a record used by the Haskell run-time--- system to <i>manage</i> I/O with file system objects. A handle has at--- least the following properties:--- --- <ul>--- <li>whether it manages input or output or both;</li>--- <li>whether it is <i>open</i>, <i>closed</i> or--- <i>semi-closed</i>;</li>--- <li>whether the object is seekable;</li>--- <li>whether buffering is disabled, or enabled on a line or block--- basis;</li>--- <li>a buffer (whose length may be zero).</li>--- </ul>--- --- Most handles will also have a current I/O position indicating where--- the next input or output operation will occur. A handle is--- <i>readable</i> if it manages only input or both input and output;--- likewise, it is <i>writable</i> if it manages only output or both--- input and output. A handle is <i>open</i> when first allocated. Once--- it is closed it can no longer be used for either input or output,--- though an implementation cannot re-use its storage while references--- remain to it. Handles are in the <a>Show</a> and <a>Eq</a> classes.--- The string produced by showing a handle is system dependent; it should--- include enough information to identify the handle for debugging. A--- handle is equal according to <a>==</a> only to itself; no attempt is--- made to compare the internal state of different handles for equality.-data Handle :: *-data HandlePosn :: *---- | See <tt>System.IO.openFile</tt>-data IOMode :: *-ReadMode :: IOMode-WriteMode :: IOMode-AppendMode :: IOMode-ReadWriteMode :: IOMode---- | Three kinds of buffering are supported: line-buffering,--- block-buffering or no-buffering. These modes have the following--- effects. For output, items are written out, or <i>flushed</i>, from--- the internal buffer according to the buffer mode:--- --- <ul>--- <li><i>line-buffering</i>: the entire output buffer is flushed--- whenever a newline is output, the buffer overflows, a--- <tt>System.IO.hFlush</tt> is issued, or the handle is closed.</li>--- <li><i>block-buffering</i>: the entire buffer is written out whenever--- it overflows, a <tt>System.IO.hFlush</tt> is issued, or the handle is--- closed.</li>--- <li><i>no-buffering</i>: output is written immediately, and never--- stored in the buffer.</li>--- </ul>--- --- An implementation is free to flush the buffer more frequently, but not--- less frequently, than specified above. The output buffer is emptied as--- soon as it has been written out.--- --- Similarly, input occurs according to the buffer mode for the handle:--- --- <ul>--- <li><i>line-buffering</i>: when the buffer for the handle is not--- empty, the next item is obtained from the buffer; otherwise, when the--- buffer is empty, characters up to and including the next newline--- character are read into the buffer. No characters are available until--- the newline character is available or the buffer is full.</li>--- <li><i>block-buffering</i>: when the buffer for the handle becomes--- empty, the next block of data is read into the buffer.</li>--- <li><i>no-buffering</i>: the next input item is read and returned. The--- <tt>System.IO.hLookAhead</tt> operation implies that even a--- no-buffered handle may require a one-character buffer.</li>--- </ul>--- --- The default buffering mode when a handle is opened is--- implementation-dependent and may depend on the file system object--- which is attached to that handle. For most implementations, physical--- files will normally be block-buffered and terminals will normally be--- line-buffered.-data BufferMode :: *---- | buffering is disabled if possible.-NoBuffering :: BufferMode---- | line-buffering should be enabled if possible.-LineBuffering :: BufferMode---- | block-buffering should be enabled if possible. The size of the buffer--- is <tt>n</tt> items if the argument is <a>Just</a> <tt>n</tt> and is--- otherwise implementation-dependent.-BlockBuffering :: Maybe Int -> BufferMode---- | A mode that determines the effect of <tt>hSeek</tt> <tt>hdl mode--- i</tt>.-data SeekMode :: *---- | the position of <tt>hdl</tt> is set to <tt>i</tt>.-AbsoluteSeek :: SeekMode---- | the position of <tt>hdl</tt> is set to offset <tt>i</tt> from the--- current position.-RelativeSeek :: SeekMode---- | the position of <tt>hdl</tt> is set to offset <tt>i</tt> from the end--- of the file.-SeekFromEnd :: SeekMode---- | A handle managing input from the Haskell program's standard input--- channel.-stdin :: Handle---- | A handle managing output to the Haskell program's standard output--- channel.-stdout :: Handle---- | A handle managing output to the Haskell program's standard error--- channel.-stderr :: Handle---- | Computation <a>openFile</a> <tt>file mode</tt> allocates and returns a--- new, open handle to manage the file <tt>file</tt>. It manages input if--- <tt>mode</tt> is <a>ReadMode</a>, output if <tt>mode</tt> is--- <a>WriteMode</a> or <a>AppendMode</a>, and both input and output if--- mode is <a>ReadWriteMode</a>.--- --- If the file does not exist and it is opened for output, it should be--- created as a new file. If <tt>mode</tt> is <a>WriteMode</a> and the--- file already exists, then it should be truncated to zero length. Some--- operating systems delete empty files, so there is no guarantee that--- the file will exist following an <a>openFile</a> with <tt>mode</tt>--- <a>WriteMode</a> unless it is subsequently written to successfully.--- The handle is positioned at the end of the file if <tt>mode</tt> is--- <a>AppendMode</a>, and otherwise at the beginning (in which case its--- internal position is 0). The initial buffer mode is--- implementation-dependent.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isAlreadyInUseError</tt> if the file is already open and--- cannot be reopened;</li>--- <li><tt>isDoesNotExistError</tt> if the file does not exist; or</li>--- <li><tt>isPermissionError</tt> if the user does not have permission to--- open the file.</li>--- </ul>--- --- Note: if you will be working with files containing binary data, you'll--- want to be using <a>openBinaryFile</a>.-openFile :: FilePath -> IOMode -> IO Handle---- | Computation <a>hClose</a> <tt>hdl</tt> makes handle <tt>hdl</tt>--- closed. Before the computation finishes, if <tt>hdl</tt> is writable--- its buffer is flushed as for <a>hFlush</a>. Performing <a>hClose</a>--- on a handle that has already been closed has no effect; doing so is--- not an error. All other operations on a closed handle will fail. If--- <a>hClose</a> fails for any reason, any further operations (apart from--- <a>hClose</a>) on the handle will still fail as if <tt>hdl</tt> had--- been successfully closed.-hClose :: Handle -> IO ()---- | For a handle <tt>hdl</tt> which attached to a physical file,--- <a>hFileSize</a> <tt>hdl</tt> returns the size of that file in 8-bit--- bytes.-hFileSize :: Handle -> IO Integer---- | For a readable handle <tt>hdl</tt>, <a>hIsEOF</a> <tt>hdl</tt> returns--- <a>True</a> if no further input can be taken from <tt>hdl</tt> or for--- a physical file, if the current I/O position is equal to the length of--- the file. Otherwise, it returns <a>False</a>.--- --- NOTE: <a>hIsEOF</a> may block, because it has to attempt to read from--- the stream to determine whether there is any more data to be read.-hIsEOF :: Handle -> IO Bool---- | The computation <a>isEOF</a> is identical to <a>hIsEOF</a>, except--- that it works only on <a>stdin</a>.-isEOF :: IO Bool---- | Computation <a>hSetBuffering</a> <tt>hdl mode</tt> sets the mode of--- buffering for handle <tt>hdl</tt> on subsequent reads and writes.--- --- If the buffer mode is changed from <a>BlockBuffering</a> or--- <a>LineBuffering</a> to <a>NoBuffering</a>, then--- --- <ul>--- <li>if <tt>hdl</tt> is writable, the buffer is flushed as for--- <a>hFlush</a>;</li>--- <li>if <tt>hdl</tt> is not writable, the contents of the buffer is--- discarded.</li>--- </ul>--- --- This operation may fail with:--- --- <ul>--- <li><tt>isPermissionError</tt> if the handle has already been used for--- reading or writing and the implementation does not allow the buffering--- mode to be changed.</li>--- </ul>-hSetBuffering :: Handle -> BufferMode -> IO ()---- | Computation <a>hGetBuffering</a> <tt>hdl</tt> returns the current--- buffering mode for <tt>hdl</tt>.-hGetBuffering :: Handle -> IO BufferMode---- | The action <a>hFlush</a> <tt>hdl</tt> causes any items buffered for--- output in handle <tt>hdl</tt> to be sent immediately to the operating--- system.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isFullError</tt> if the device is full;</li>--- <li><tt>isPermissionError</tt> if a system resource limit would be--- exceeded. It is unspecified whether the characters in the buffer are--- discarded or retained under these circumstances.</li>--- </ul>-hFlush :: Handle -> IO ()---- | Computation <a>hGetPosn</a> <tt>hdl</tt> returns the current I/O--- position of <tt>hdl</tt> as a value of the abstract type--- <a>HandlePosn</a>.-hGetPosn :: Handle -> IO HandlePosn---- | If a call to <a>hGetPosn</a> <tt>hdl</tt> returns a position--- <tt>p</tt>, then computation <a>hSetPosn</a> <tt>p</tt> sets the--- position of <tt>hdl</tt> to the position it held at the time of the--- call to <a>hGetPosn</a>.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isPermissionError</tt> if a system resource limit would be--- exceeded.</li>--- </ul>-hSetPosn :: HandlePosn -> IO ()---- | Computation <a>hSeek</a> <tt>hdl mode i</tt> sets the position of--- handle <tt>hdl</tt> depending on <tt>mode</tt>. The offset <tt>i</tt>--- is given in terms of 8-bit bytes.--- --- If <tt>hdl</tt> is block- or line-buffered, then seeking to a position--- which is not in the current buffer will first cause any items in the--- output buffer to be written to the device, and then cause the input--- buffer to be discarded. Some handles may not be seekable (see--- <a>hIsSeekable</a>), or only support a subset of the possible--- positioning operations (for instance, it may only be possible to seek--- to the end of a tape, or to a positive offset from the beginning or--- current position). It is not possible to set a negative I/O position,--- or for a physical file, an I/O position beyond the current--- end-of-file.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isIllegalOperationError</tt> if the Handle is not seekable, or--- does not support the requested seek mode.</li>--- <li><tt>isPermissionError</tt> if a system resource limit would be--- exceeded.</li>--- </ul>-hSeek :: Handle -> SeekMode -> Integer -> IO ()---- | Computation <a>hWaitForInput</a> <tt>hdl t</tt> waits until input is--- available on handle <tt>hdl</tt>. It returns <a>True</a> as soon as--- input is available on <tt>hdl</tt>, or <a>False</a> if no input is--- available within <tt>t</tt> milliseconds. Note that--- <a>hWaitForInput</a> waits until one or more full <i>characters</i>--- are available, which means that it needs to do decoding, and hence may--- fail with a decoding error.--- --- If <tt>t</tt> is less than zero, then <tt>hWaitForInput</tt> waits--- indefinitely.--- --- This operation may fail with:--- --- <ul>--- <li><a>isEOFError</a> if the end of file has been reached.</li>--- <li>a decoding error, if the input begins with an invalid byte--- sequence in this Handle's encoding.</li>--- </ul>--- --- NOTE for GHC users: unless you use the <tt>-threaded</tt> flag,--- <tt>hWaitForInput t</tt> where <tt>t >= 0</tt> will block all other--- Haskell threads for the duration of the call. It behaves like a--- <tt>safe</tt> foreign call in this respect.-hWaitForInput :: Handle -> Int -> IO Bool---- | Computation <a>hReady</a> <tt>hdl</tt> indicates whether at least one--- item is available for input from handle <tt>hdl</tt>.--- --- This operation may fail with:--- --- <ul>--- <li><tt>System.IO.Error.isEOFError</tt> if the end of file has been--- reached.</li>--- </ul>-hReady :: Handle -> IO Bool---- | Computation <a>hGetChar</a> <tt>hdl</tt> reads a character from the--- file or channel managed by <tt>hdl</tt>, blocking until a character is--- available.--- --- This operation may fail with:--- --- <ul>--- <li><a>isEOFError</a> if the end of file has been reached.</li>--- </ul>-hGetChar :: Handle -> IO Char---- | Computation <a>hGetLine</a> <tt>hdl</tt> reads a line from the file or--- channel managed by <tt>hdl</tt>.--- --- This operation may fail with:--- --- <ul>--- <li><a>isEOFError</a> if the end of file is encountered when reading--- the <i>first</i> character of the line.</li>--- </ul>--- --- If <a>hGetLine</a> encounters end-of-file at any other point while--- reading in a line, it is treated as a line terminator and the--- (partial) line is returned.-hGetLine :: Handle -> IO String---- | Computation <a>hLookAhead</a> returns the next character from the--- handle without removing it from the input buffer, blocking until a--- character is available.--- --- This operation may fail with:--- --- <ul>--- <li><tt>isEOFError</tt> if the end of file has been reached.</li>--- </ul>-hLookAhead :: Handle -> IO Char---- | Computation <a>hGetContents</a> <tt>hdl</tt> returns the list of--- characters corresponding to the unread portion of the channel or file--- managed by <tt>hdl</tt>, which is put into an intermediate state,--- <i>semi-closed</i>. In this state, <tt>hdl</tt> is effectively closed,--- but items are read from <tt>hdl</tt> on demand and accumulated in a--- special list returned by <a>hGetContents</a> <tt>hdl</tt>.--- --- Any operation that fails because a handle is closed, also fails if a--- handle is semi-closed. The only exception is <tt>hClose</tt>. A--- semi-closed handle becomes closed:--- --- <ul>--- <li>if <tt>hClose</tt> is applied to it;</li>--- <li>if an I/O error occurs when reading an item from the handle;</li>--- <li>or once the entire contents of the handle has been read.</li>--- </ul>--- --- Once a semi-closed handle becomes closed, the contents of the--- associated list becomes fixed. The contents of this final list is only--- partially specified: it will contain at least all the items of the--- stream that were evaluated prior to the handle becoming closed.--- --- Any I/O errors encountered while a handle is semi-closed are simply--- discarded.--- --- This operation may fail with:--- --- <ul>--- <li><a>isEOFError</a> if the end of file has been reached.</li>--- </ul>-hGetContents :: Handle -> IO String---- | Computation <a>hPutChar</a> <tt>hdl ch</tt> writes the character--- <tt>ch</tt> to the file or channel managed by <tt>hdl</tt>. Characters--- may be buffered if buffering is enabled for <tt>hdl</tt>.--- --- This operation may fail with:--- --- <ul>--- <li><a>isFullError</a> if the device is full; or</li>--- <li><a>isPermissionError</a> if another system resource limit would be--- exceeded.</li>--- </ul>-hPutChar :: Handle -> Char -> IO ()---- | Computation <a>hPutStr</a> <tt>hdl s</tt> writes the string <tt>s</tt>--- to the file or channel managed by <tt>hdl</tt>.--- --- This operation may fail with:--- --- <ul>--- <li><a>isFullError</a> if the device is full; or</li>--- <li><a>isPermissionError</a> if another system resource limit would be--- exceeded.</li>--- </ul>-hPutStr :: Handle -> String -> IO ()---- | The same as <a>hPutStr</a>, but adds a newline character.-hPutStrLn :: Handle -> String -> IO ()---- | Computation <a>hPrint</a> <tt>hdl t</tt> writes the string--- representation of <tt>t</tt> given by the <a>shows</a> function to the--- file or channel managed by <tt>hdl</tt> and appends a newline.--- --- This operation may fail with:--- --- <ul>--- <li><tt>System.IO.Error.isFullError</tt> if the device is full;--- or</li>--- <li><tt>System.IO.Error.isPermissionError</tt> if another system--- resource limit would be exceeded.</li>--- </ul>-hPrint :: Show a => Handle -> a -> IO ()-hIsOpen :: Handle -> IO Bool-hIsClosed :: Handle -> IO Bool-hIsReadable :: Handle -> IO Bool-hIsWritable :: Handle -> IO Bool-hIsSeekable :: Handle -> IO Bool---- | An error indicating that an <a>IO</a> operation failed because one of--- its arguments already exists.-isAlreadyExistsError :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because one of--- its arguments does not exist.-isDoesNotExistError :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because one of--- its arguments is a single-use resource, which is already being used--- (for example, opening the same file twice for writing might give this--- error).-isAlreadyInUseError :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because the--- device is full.-isFullError :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because the end--- of file has been reached.-isEOFError :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because the--- operation was not possible. Any computation which returns an <a>IO</a>--- result may fail with <a>isIllegalOperation</a>. In some cases, an--- implementation will not be able to distinguish between the possible--- error causes. In this case it should fail with--- <a>isIllegalOperation</a>.-isIllegalOperation :: IOError -> Bool---- | An error indicating that an <a>IO</a> operation failed because the--- user does not have sufficient operating system privilege to perform--- that operation.-isPermissionError :: IOError -> Bool---- | A programmer-defined error value constructed using <a>userError</a>.-isUserError :: IOError -> Bool-ioeGetErrorString :: IOError -> String-ioeGetHandle :: IOError -> Maybe Handle-ioeGetFileName :: IOError -> Maybe FilePath---- | The <a>try</a> function is deprecated. Please use the new exceptions--- variant, <tt>Control.Exception.try</tt> from <a>Control.Exception</a>,--- instead.-try :: IO a -> IO (Either IOError a)---- | The <a>bracket</a> function captures a common allocate, compute,--- deallocate idiom in which the deallocation step must occur even in the--- case of an error during computation. This is similar to--- try-catch-finally in Java.--- --- This version handles only IO errors, as defined by Haskell 98. The--- version of <tt>bracket</tt> in <a>Control.Exception</a> handles all--- exceptions, and should be used instead.-bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c---- | A variant of <a>bracket</a> where the middle computation doesn't want--- <tt>x</tt>.--- --- This version handles only IO errors, as defined by Haskell 98. The--- version of <tt>bracket_</tt> in <a>Control.Exception</a> handles all--- exceptions, and should be used instead.-bracket_ :: IO a -> (a -> IO b) -> IO c -> IO c---- | A value of type <tt><a>IO</a> a</tt> is a computation which, when--- performed, does some I/O before returning a value of type <tt>a</tt>.--- --- There is really only one way to "perform" an I/O action: bind it to--- <tt>Main.main</tt> in your program. When your program is run, the I/O--- will be performed. It isn't possible to perform I/O from an arbitrary--- function, unless that function is itself in the <a>IO</a> monad and--- called at some point, directly or indirectly, from <tt>Main.main</tt>.--- --- <a>IO</a> is a monad, so <a>IO</a> actions can be combined using--- either the do-notation or the <tt>>></tt> and <tt>>>=</tt>--- operations from the <tt>Monad</tt> class.-data IO a :: * -> *---- | File and directory names are values of type <a>String</a>, whose--- precise meaning is operating system dependent. Files can be opened,--- yielding a handle which can then be used to operate on the contents of--- that file.-type FilePath = String---- | The Haskell 98 type for exceptions in the <a>IO</a> monad. Any I/O--- operation may raise an <a>IOError</a> instead of returning a result.--- For a more general type of exception, including also those that arise--- in pure code, see <a>Control.Exception.Exception</a>.--- --- In Haskell 98, this is an opaque type.-type IOError = IOException---- | Raise an <a>IOError</a> in the <a>IO</a> monad.-ioError :: IOError -> IO a---- | Construct an <a>IOError</a> value with a string describing the error.--- The <a>fail</a> method of the <a>IO</a> instance of the <a>Monad</a>--- class raises a <a>userError</a>, thus:--- --- <pre>--- instance Monad IO where --- ...--- fail s = ioError (userError s)--- </pre>-userError :: String -> IOError---- | The <a>catch</a> function is deprecated. Please use the new exceptions--- variant, <tt>Control.Exception.catch</tt> from--- <a>Control.Exception</a>, instead.-catch :: IO a -> (IOError -> IO a) -> IO a---- | The <a>interact</a> function takes a function of type--- <tt>String->String</tt> as its argument. The entire input from the--- standard input device is passed to this function as its argument, and--- the resulting string is output on the standard output device.-interact :: (String -> String) -> IO ()---- | Write a character to the standard output device (same as--- <a>hPutChar</a> <a>stdout</a>).-putChar :: Char -> IO ()---- | Write a string to the standard output device (same as <a>hPutStr</a>--- <a>stdout</a>).-putStr :: String -> IO ()---- | The same as <a>putStr</a>, but adds a newline character.-putStrLn :: String -> IO ()---- | The <a>print</a> function outputs a value of any printable type to the--- standard output device. Printable types are those that are instances--- of class <a>Show</a>; <a>print</a> converts values to strings for--- output using the <a>show</a> operation and adds a newline.--- --- For example, a program to print the first 20 integers and their powers--- of 2 could be written as:--- --- <pre>--- main = print ([(n, 2^n) | n <- [0..19]])--- </pre>-print :: Show a => a -> IO ()---- | Read a character from the standard input device (same as--- <a>hGetChar</a> <a>stdin</a>).-getChar :: IO Char---- | Read a line from the standard input device (same as <a>hGetLine</a>--- <a>stdin</a>).-getLine :: IO String---- | The <a>getContents</a> operation returns all user input as a single--- string, which is read lazily as it is needed (same as--- <a>hGetContents</a> <a>stdin</a>).-getContents :: IO String---- | The <a>readFile</a> function reads a file and returns the contents of--- the file as a string. The file is read lazily, on demand, as with--- <a>getContents</a>.-readFile :: FilePath -> IO String---- | The computation <a>writeFile</a> <tt>file str</tt> function writes the--- string <tt>str</tt>, to the file <tt>file</tt>.-writeFile :: FilePath -> String -> IO ()---- | The computation <a>appendFile</a> <tt>file str</tt> function appends--- the string <tt>str</tt>, to the file <tt>file</tt>.--- --- Note that <a>writeFile</a> and <a>appendFile</a> write a literal--- string to a file. To write a value of any printable type, as with--- <a>print</a>, use the <a>show</a> function to convert the value to a--- string first.--- --- <pre>--- main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]])--- </pre>-appendFile :: FilePath -> String -> IO ()---- | The <a>readIO</a> function is similar to <a>read</a> except that it--- signals parse failure to the <a>IO</a> monad instead of terminating--- the program.-readIO :: Read a => String -> IO a---- | The <a>readLn</a> function combines <a>getLine</a> and <a>readIO</a>.-readLn :: Read a => IO a--module Char---- | Selects the first 128 characters of the Unicode character set,--- corresponding to the ASCII character set.-isAscii :: Char -> Bool---- | Selects the first 256 characters of the Unicode character set,--- corresponding to the ISO 8859-1 (Latin-1) character set.-isLatin1 :: Char -> Bool---- | Selects control characters, which are the non-printing characters of--- the Latin-1 subset of Unicode.-isControl :: Char -> Bool---- | Selects printable Unicode characters (letters, numbers, marks,--- punctuation, symbols and spaces).-isPrint :: Char -> Bool---- | Returns <a>True</a> for any Unicode space character, and the control--- characters <tt>\t</tt>, <tt>\n</tt>, <tt>\r</tt>, <tt>\f</tt>,--- <tt>\v</tt>.-isSpace :: Char -> Bool---- | Selects upper-case or title-case alphabetic Unicode characters--- (letters). Title case is used by a small number of letter ligatures--- like the single-character form of <i>Lj</i>.-isUpper :: Char -> Bool---- | Selects lower-case alphabetic Unicode characters (letters).-isLower :: Char -> Bool---- | Selects alphabetic Unicode characters (lower-case, upper-case and--- title-case letters, plus letters of caseless scripts and modifiers--- letters). This function is equivalent to <tt>Data.Char.isLetter</tt>.-isAlpha :: Char -> Bool---- | Selects ASCII digits, i.e. <tt>'0'</tt>..<tt>'9'</tt>.-isDigit :: Char -> Bool---- | Selects ASCII octal digits, i.e. <tt>'0'</tt>..<tt>'7'</tt>.-isOctDigit :: Char -> Bool---- | Selects ASCII hexadecimal digits, i.e. <tt>'0'</tt>..<tt>'9'</tt>,--- <tt>'a'</tt>..<tt>'f'</tt>, <tt>'A'</tt>..<tt>'F'</tt>.-isHexDigit :: Char -> Bool---- | Selects alphabetic or numeric digit Unicode characters.--- --- Note that numeric digits outside the ASCII range are selected by this--- function but not by <a>isDigit</a>. Such digits may be part of--- identifiers but are not used by the printer and reader to represent--- numbers.-isAlphaNum :: Char -> Bool---- | Convert a single digit <a>Char</a> to the corresponding <a>Int</a>.--- This function fails unless its argument satisfies <a>isHexDigit</a>,--- but recognises both upper and lower-case hexadecimal digits (i.e.--- <tt>'0'</tt>..<tt>'9'</tt>, <tt>'a'</tt>..<tt>'f'</tt>,--- <tt>'A'</tt>..<tt>'F'</tt>).-digitToInt :: Char -> Int---- | Convert an <a>Int</a> in the range <tt>0</tt>..<tt>15</tt> to the--- corresponding single digit <a>Char</a>. This function fails on other--- inputs, and generates lower-case hexadecimal digits.-intToDigit :: Int -> Char---- | Convert a letter to the corresponding upper-case letter, if any. Any--- other character is returned unchanged.-toUpper :: Char -> Char---- | Convert a letter to the corresponding lower-case letter, if any. Any--- other character is returned unchanged.-toLower :: Char -> Char---- | The <tt>Prelude.fromEnum</tt> method restricted to the type--- <tt>Data.Char.Char</tt>.-ord :: Char -> Int---- | The <tt>Prelude.toEnum</tt> method restricted to the type--- <tt>Data.Char.Char</tt>.-chr :: Int -> Char---- | Read a string representation of a character, using Haskell--- source-language escape conventions, and convert it to the character--- that it encodes. For example:--- --- <pre>--- readLitChar "\\nHello" = [('\n', "Hello")]--- </pre>-readLitChar :: ReadS Char---- | Convert a character to a string using only printable characters, using--- Haskell source-language escape conventions. For example:--- --- <pre>--- showLitChar '\n' s = "\\n" ++ s--- </pre>-showLitChar :: Char -> ShowS---- | Read a string representation of a character, using Haskell--- source-language escape conventions. For example:--- --- <pre>--- lexLitChar "\\nHello" = [("\\n", "Hello")]--- </pre>-lexLitChar :: ReadS String---- | The character type <a>Char</a> is an enumeration whose values--- represent Unicode (or equivalently ISO/IEC 10646) characters (see--- <a>http://www.unicode.org/</a> for details). This set extends the ISO--- 8859-1 (Latin-1) character set (the first 256 charachers), which is--- itself an extension of the ASCII character set (the first 128--- characters). A character literal in Haskell has type <a>Char</a>.--- --- To convert a <a>Char</a> to or from the corresponding <a>Int</a> value--- defined by Unicode, use <tt>Prelude.toEnum</tt> and--- <tt>Prelude.fromEnum</tt> from the <tt>Prelude.Enum</tt> class--- respectively (or equivalently <tt>ord</tt> and <tt>chr</tt>).-data Char :: *---- | A <a>String</a> is a list of characters. String constants in Haskell--- are values of type <a>String</a>.-type String = [Char]--module Int--module Ix---- | The <a>Ix</a> class is used to map a contiguous subrange of values in--- a type onto integers. It is used primarily for array indexing (see the--- array package).--- --- The first argument <tt>(l,u)</tt> of each of these operations is a--- pair specifying the lower and upper bounds of a contiguous subrange of--- values.--- --- An implementation is entitled to assume the following laws about these--- operations:--- --- <ul>--- <li><tt><a>inRange</a> (l,u) i == <a>elem</a> i (<a>range</a>--- (l,u))</tt> <tt> </tt></li>--- <li><tt><a>range</a> (l,u) <a>!!</a> <a>index</a> (l,u) i == i</tt>,--- when <tt><a>inRange</a> (l,u) i</tt></li>--- <li><tt><a>map</a> (<a>index</a> (l,u)) (<a>range</a> (l,u))) ==--- [0..<a>rangeSize</a> (l,u)-1]</tt> <tt> </tt></li>--- <li><tt><a>rangeSize</a> (l,u) == <a>length</a> (<a>range</a>--- (l,u))</tt> <tt> </tt></li>--- </ul>--- --- Minimal complete instance: <a>range</a>, <a>index</a> and--- <a>inRange</a>.-class Ord a => Ix a-range :: Ix a => (a, a) -> [a]-index :: Ix a => (a, a) -> a -> Int-inRange :: Ix a => (a, a) -> a -> Bool-rangeSize :: Ix a => (a, a) -> Int---- | The size of the subrange defined by a bounding pair.-rangeSize :: Ix a => (a, a) -> Int--module Array---- | The type of immutable non-strict (boxed) arrays with indices in--- <tt>i</tt> and elements in <tt>e</tt>.-data Array i e :: * -> * -> *---- | Construct an array with the specified bounds and containing values for--- given indices within these bounds.--- --- The array is undefined (i.e. bottom) if any index in the list is out--- of bounds. The Haskell 98 Report further specifies that if any two--- associations in the list have the same index, the value at that index--- is undefined (i.e. bottom). However in GHC's implementation, the value--- at such an index is the value part of the last association with that--- index in the list.--- --- Because the indices must be checked for these errors, <a>array</a> is--- strict in the bounds argument and in the indices of the association--- list, but non-strict in the values. Thus, recurrences such as the--- following are possible:--- --- <pre>--- a = array (1,100) ((1,1) : [(i, i * a!(i-1)) | i <- [2..100]])--- </pre>--- --- Not every index within the bounds of the array need appear in the--- association list, but the values associated with indices that do not--- appear will be undefined (i.e. bottom).--- --- If, in any dimension, the lower bound is greater than the upper bound,--- then the array is legal, but empty. Indexing an empty array always--- gives an array-bounds error, but <a>bounds</a> still yields the bounds--- with which the array was constructed.-array :: Ix i => (i, i) -> [(i, e)] -> Array i e---- | Construct an array from a pair of bounds and a list of values in index--- order.-listArray :: Ix i => (i, i) -> [e] -> Array i e---- | The value at the given index in an array.-(!) :: Ix i => Array i e -> i -> e---- | The bounds with which an array was constructed.-bounds :: Ix i => Array i e -> (i, i)---- | The list of indices of an array in ascending order.-indices :: Ix i => Array i e -> [i]---- | The list of elements of an array in index order.-elems :: Ix i => Array i e -> [e]---- | The list of associations of an array in index order.-assocs :: Ix i => Array i e -> [(i, e)]---- | The <a>accumArray</a> function deals with repeated indices in the--- association list using an <i>accumulating function</i> which combines--- the values of associations with the same index. For example, given a--- list of values of some index type, <tt>hist</tt> produces a histogram--- of the number of occurrences of each index within a specified range:--- --- <pre>--- hist :: (Ix a, Num b) => (a,a) -> [a] -> Array a b--- hist bnds is = accumArray (+) 0 bnds [(i, 1) | i<-is, inRange bnds i]--- </pre>--- --- If the accumulating function is strict, then <a>accumArray</a> is--- strict in the values, as well as the indices, in the association list.--- Thus, unlike ordinary arrays built with <a>array</a>, accumulated--- arrays should not in general be recursive.-accumArray :: Ix i => (e -> a -> e) -> e -> (i, i) -> [(i, a)] -> Array i e---- | Constructs an array identical to the first argument except that it has--- been updated by the associations in the right argument. For example,--- if <tt>m</tt> is a 1-origin, <tt>n</tt> by <tt>n</tt> matrix, then--- --- <pre>--- m//[((i,i), 0) | i <- [1..n]]--- </pre>--- --- is the same matrix, except with the diagonal zeroed.--- --- Repeated indices in the association list are handled as for--- <a>array</a>: Haskell 98 specifies that the resulting array is--- undefined (i.e. bottom), but GHC's implementation uses the last--- association for each index.-(//) :: Ix i => Array i e -> [(i, e)] -> Array i e---- | <tt><a>accum</a> f</tt> takes an array and an association list and--- accumulates pairs from the list into the array with the accumulating--- function <tt>f</tt>. Thus <a>accumArray</a> can be defined using--- <a>accum</a>:--- --- <pre>--- accumArray f z b = accum f (array b [(i, z) | i <- range b])--- </pre>-accum :: Ix i => (e -> a -> e) -> Array i e -> [(i, a)] -> Array i e---- | <a>ixmap</a> allows for transformations on array indices. It may be--- thought of as providing function composition on the right with the--- mapping that the original array embodies.--- --- A similar transformation of array values may be achieved using--- <a>fmap</a> from the <a>Array</a> instance of the <a>Functor</a>--- class.-ixmap :: (Ix i, Ix j) => (i, i) -> (i -> j) -> Array j e -> Array i e
− data/html.txt
@@ -1,272 +0,0 @@--- Hoogle documentation, generated by Haddock--- See Hoogle, http://www.haskell.org/hoogle/----- | HTML combinator library--- --- This package contains a combinator library for constructing HTML--- documents.-@package html-@version 1.0.1.2----- | An Html combinator library-module Text.Html.BlockTable-data BlockTable a-single :: a -> BlockTable a-empty :: BlockTable a-above :: BlockTable a -> BlockTable a -> BlockTable a-beside :: BlockTable a -> BlockTable a -> BlockTable a-getMatrix :: BlockTable a -> [[(a, (Int, Int))]]-showsTable :: Show a => BlockTable a -> ShowS-showTable :: Show a => BlockTable a -> String-instance Show a => Show (BlockTable a)----- | An Html combinator library-module Text.Html-data HtmlElement-HtmlString :: String -> HtmlElement-HtmlTag :: String -> [HtmlAttr] -> Html -> HtmlElement-markupTag :: HtmlElement -> String-markupAttrs :: HtmlElement -> [HtmlAttr]-markupContent :: HtmlElement -> Html-data HtmlAttr-HtmlAttr :: String -> String -> HtmlAttr-newtype Html-Html :: [HtmlElement] -> Html-getHtmlElements :: Html -> [HtmlElement]-class HTML a-toHtml :: HTML a => a -> Html-toHtmlFromList :: HTML a => [a] -> Html-class ADDATTRS a-(!) :: ADDATTRS a => a -> [HtmlAttr] -> a-(<<) :: HTML a => (Html -> b) -> a -> b-concatHtml :: HTML a => [a] -> Html-(+++) :: (HTML a, HTML b) => a -> b -> Html-noHtml :: Html-tag :: String -> Html -> Html-itag :: String -> Html-emptyAttr :: String -> HtmlAttr-intAttr :: String -> Int -> HtmlAttr-strAttr :: String -> String -> HtmlAttr-stringToHtmlString :: String -> String-type URL = String-primHtml :: String -> Html-stringToHtml :: String -> Html-lineToHtml :: String -> Html-address :: Html -> Html-anchor :: Html -> Html-applet :: Html -> Html-area :: Html-basefont :: Html-big :: Html -> Html-blockquote :: Html -> Html-body :: Html -> Html-bold :: Html -> Html-br :: Html-caption :: Html -> Html-center :: Html -> Html-cite :: Html -> Html-ddef :: Html -> Html-define :: Html -> Html-dlist :: Html -> Html-dterm :: Html -> Html-emphasize :: Html -> Html-fieldset :: Html -> Html-font :: Html -> Html-form :: Html -> Html-frame :: Html -> Html-frameset :: Html -> Html-h1 :: Html -> Html-h2 :: Html -> Html-h3 :: Html -> Html-h4 :: Html -> Html-h5 :: Html -> Html-h6 :: Html -> Html-header :: Html -> Html-hr :: Html-image :: Html-input :: Html-italics :: Html -> Html-keyboard :: Html -> Html-legend :: Html -> Html-li :: Html -> Html-meta :: Html-noframes :: Html -> Html-olist :: Html -> Html-option :: Html -> Html-paragraph :: Html -> Html-param :: Html-pre :: Html -> Html-sample :: Html -> Html-select :: Html -> Html-small :: Html -> Html-strong :: Html -> Html-style :: Html -> Html-sub :: Html -> Html-sup :: Html -> Html-table :: Html -> Html-td :: Html -> Html-textarea :: Html -> Html-th :: Html -> Html-thebase :: Html-thecode :: Html -> Html-thediv :: Html -> Html-thehtml :: Html -> Html-thelink :: Html -> Html-themap :: Html -> Html-thespan :: Html -> Html-thetitle :: Html -> Html-tr :: Html -> Html-tt :: Html -> Html-ulist :: Html -> Html-underline :: Html -> Html-variable :: Html -> Html-action :: String -> HtmlAttr-align :: String -> HtmlAttr-alink :: String -> HtmlAttr-alt :: String -> HtmlAttr-altcode :: String -> HtmlAttr-archive :: String -> HtmlAttr-background :: String -> HtmlAttr-base :: String -> HtmlAttr-bgcolor :: String -> HtmlAttr-border :: Int -> HtmlAttr-bordercolor :: String -> HtmlAttr-cellpadding :: Int -> HtmlAttr-cellspacing :: Int -> HtmlAttr-checked :: HtmlAttr-clear :: String -> HtmlAttr-code :: String -> HtmlAttr-codebase :: String -> HtmlAttr-color :: String -> HtmlAttr-cols :: String -> HtmlAttr-colspan :: Int -> HtmlAttr-compact :: HtmlAttr-content :: String -> HtmlAttr-coords :: String -> HtmlAttr-enctype :: String -> HtmlAttr-face :: String -> HtmlAttr-frameborder :: Int -> HtmlAttr-height :: Int -> HtmlAttr-href :: String -> HtmlAttr-hspace :: Int -> HtmlAttr-httpequiv :: String -> HtmlAttr-identifier :: String -> HtmlAttr-ismap :: HtmlAttr-lang :: String -> HtmlAttr-link :: String -> HtmlAttr-marginheight :: Int -> HtmlAttr-marginwidth :: Int -> HtmlAttr-maxlength :: Int -> HtmlAttr-method :: String -> HtmlAttr-multiple :: HtmlAttr-name :: String -> HtmlAttr-nohref :: HtmlAttr-noresize :: HtmlAttr-noshade :: HtmlAttr-nowrap :: HtmlAttr-rel :: String -> HtmlAttr-rev :: String -> HtmlAttr-rows :: String -> HtmlAttr-rowspan :: Int -> HtmlAttr-rules :: String -> HtmlAttr-scrolling :: String -> HtmlAttr-selected :: HtmlAttr-shape :: String -> HtmlAttr-size :: String -> HtmlAttr-src :: String -> HtmlAttr-start :: Int -> HtmlAttr-target :: String -> HtmlAttr-text :: String -> HtmlAttr-theclass :: String -> HtmlAttr-thestyle :: String -> HtmlAttr-thetype :: String -> HtmlAttr-title :: String -> HtmlAttr-usemap :: String -> HtmlAttr-valign :: String -> HtmlAttr-value :: String -> HtmlAttr-version :: String -> HtmlAttr-vlink :: String -> HtmlAttr-vspace :: Int -> HtmlAttr-width :: String -> HtmlAttr-validHtmlTags :: [String]-validHtmlITags :: [String]-validHtmlAttrs :: [String]-aqua :: String-black :: String-blue :: String-fuchsia :: String-gray :: String-green :: String-lime :: String-maroon :: String-navy :: String-olive :: String-purple :: String-red :: String-silver :: String-teal :: String-yellow :: String-white :: String-linesToHtml :: [String] -> Html-primHtmlChar :: String -> Html-copyright :: Html-spaceHtml :: Html-bullet :: Html-p :: Html -> Html-class HTMLTABLE ht-cell :: HTMLTABLE ht => ht -> HtmlTable-newtype HtmlTable-HtmlTable :: (BlockTable (Int -> Int -> Html)) -> HtmlTable-(</>, beside, <->, above) :: (HTMLTABLE ht1, HTMLTABLE ht2) => ht1 -> ht2 -> HtmlTable-aboves, besides :: HTMLTABLE ht => [ht] -> HtmlTable-simpleTable :: [HtmlAttr] -> [HtmlAttr] -> [[Html]] -> Html-mkHtmlTable :: BlockTable (Int -> Int -> Html) -> HtmlTable-renderTable :: BlockTable (Int -> Int -> Html) -> Html-data HtmlTree-HtmlLeaf :: Html -> HtmlTree-HtmlNode :: Html -> [HtmlTree] -> Html -> HtmlTree-treeHtml :: [String] -> HtmlTree -> Html-debugHtml :: HTML a => a -> Html-data HotLink-HotLink :: URL -> [Html] -> [HtmlAttr] -> HotLink-hotLinkURL :: HotLink -> URL-hotLinkContents :: HotLink -> [Html]-hotLinkAttributes :: HotLink -> [HtmlAttr]-hotlink :: URL -> [Html] -> HotLink-ordList :: HTML a => [a] -> Html-unordList :: HTML a => [a] -> Html-defList :: (HTML a, HTML b) => [(a, b)] -> Html-widget :: String -> String -> [HtmlAttr] -> Html-checkbox :: String -> String -> Html-hidden :: String -> String -> Html-radio :: String -> String -> Html-reset :: String -> String -> Html-submit :: String -> String -> Html-password :: String -> Html-textfield :: String -> Html-afile :: String -> Html-clickmap :: String -> Html-menu :: String -> [Html] -> Html-gui :: String -> Html -> Html-renderHtml :: HTML html => html -> String-prettyHtml :: HTML html => html -> String-renderHtml' :: Int -> HtmlElement -> ShowS-prettyHtml' :: HtmlElement -> [String]-renderTag :: Bool -> String -> [HtmlAttr] -> Int -> ShowS-instance Show HotLink-instance HTML HotLink-instance HTML HtmlTree-instance Show HtmlTable-instance HTML HtmlTable-instance HTMLTABLE Html-instance HTMLTABLE HtmlTable-instance Show HtmlAttr-instance Show Html-instance ADDATTRS Html-instance ADDATTRS b => ADDATTRS (a -> b)-instance HTML a => HTML [a]-instance HTML Char-instance HTML Html
− data/vector.txt
@@ -1,8948 +0,0 @@--- Hoogle documentation, generated by Haddock--- See Hoogle, http://www.haskell.org/hoogle/----- | Efficient Arrays--- --- An efficient implementation of Int-indexed arrays (both mutable and--- immutable), with a powerful loop optimisation framework .--- --- It is structured as follows:--- --- <ul>--- <li><i><a>Data.Vector</a></i> Boxed vectors of arbitrary types.</li>--- <li><i><a>Data.Vector.Unboxed</a></i> Unboxed vectors with an adaptive--- representation based on data type families.</li>--- <li><i><a>Data.Vector.Storable</a></i> Unboxed vectors of--- <a>Storable</a> types.</li>--- <li><i><a>Data.Vector.Primitive</a></i> Unboxed vectors of primitive--- types as defined by the <tt>primitive</tt> package.--- <a>Data.Vector.Unboxed</a> is more flexible at no performance--- cost.</li>--- <li><i><a>Data.Vector.Generic</a></i> Generic interface to the vector--- types.</li>--- </ul>--- --- Each module has a <tt>Safe</tt> version with is marked as--- <tt>Trustworthy</tt> (see--- <a>http://hackage.haskell.org/trac/ghc/wiki/SafeHaskell</a>).--- --- There is also a (draft) tutorial on common uses of vector.--- --- <ul>--- --- <li><a>http://haskell.org/haskellwiki/Numeric_Haskell:_A_Vector_Tutorial</a></li>--- </ul>--- --- Please use the project trac to submit bug reports and feature--- requests.--- --- <ul>--- <li><a>http://trac.haskell.org/vector</a></li>--- </ul>--- --- Changes in version 0.9--- --- <ul>--- <li><a>MonadPlus</a> instance for boxed vectors</li>--- <li>Export more <tt>construct</tt> and <tt>constructN</tt> from--- <tt>Safe</tt> modules</li>--- <li>Require <tt>primitive-0.4.0.1</tt></li>--- </ul>--- --- Changes in version 0.8--- --- <ul>--- <li>New functions: <tt>constructN</tt>, <tt>constructrN</tt></li>--- <li>Support for GHC 7.2 array copying primitives</li>--- <li>New fixity for <tt>(!)</tt></li>--- <li>Safe Haskell support (contributed by David Terei)</li>--- <li><a>Functor</a>, <a>Monad</a>, <a>Applicative</a>,--- <a>Alternative</a>, <a>Foldable</a> and <a>Traversable</a> instances--- for boxed vectors (<i>WARNING: they tend to be slow and are only--- provided for completeness</i>)</li>--- <li><a>Show</a> instances for immutable vectors follow containers--- conventions</li>--- <li><a>Read</a> instances for all immutable vector types</li>--- <li>Performance improvements</li>--- </ul>-@package vector-@version 0.9----- | Ugly internal utility functions for implementing <a>Storable</a>-based--- vectors.-module Data.Vector.Storable.Internal-getPtr :: ForeignPtr a -> Ptr a-setPtr :: ForeignPtr a -> Ptr a -> ForeignPtr a-updPtr :: (Ptr a -> Ptr a) -> ForeignPtr a -> ForeignPtr a----- | Fusion-related utility types-module Data.Vector.Fusion.Util---- | Identity monad-newtype Id a-Id :: a -> Id a-unId :: Id a -> a---- | Box monad-data Box a-Box :: a -> Box a-unBox :: Box a -> a---- | Delay inlining a function until late in the game (simplifier phase 0).-delay_inline :: (a -> b) -> a -> b---- | <a>min</a> inlined in phase 0-delayed_min :: Int -> Int -> Int-instance Monad Box-instance Functor Box-instance Monad Id-instance Functor Id----- | Size hints for streams.-module Data.Vector.Fusion.Stream.Size---- | Size hint-data Size---- | Exact size-Exact :: Int -> Size---- | Upper bound on the size-Max :: Int -> Size---- | Unknown size-Unknown :: Size---- | Minimum of two size hints-smaller :: Size -> Size -> Size---- | Maximum of two size hints-larger :: Size -> Size -> Size---- | Convert a size hint to an upper bound-toMax :: Size -> Size---- | Compute the maximum size from a size hint if possible-upperBound :: Size -> Maybe Int-instance Eq Size-instance Show Size-instance Num Size----- | Bounds checking infrastructure-module Data.Vector.Internal.Check-data Checks-Bounds :: Checks-Unsafe :: Checks-Internal :: Checks-doChecks :: Checks -> Bool-error :: String -> Int -> Checks -> String -> String -> a-emptyStream :: String -> Int -> Checks -> String -> a-check :: String -> Int -> Checks -> String -> String -> Bool -> a -> a-assert :: String -> Int -> Checks -> String -> Bool -> a -> a-checkIndex :: String -> Int -> Checks -> String -> Int -> Int -> a -> a-checkLength :: String -> Int -> Checks -> String -> Int -> a -> a-checkSlice :: String -> Int -> Checks -> String -> Int -> Int -> Int -> a -> a-instance Eq Checks----- | Monadic stream combinators.-module Data.Vector.Fusion.Stream.Monadic---- | Monadic streams-data Stream m a-Stream :: (s -> m (Step s a)) -> s -> Size -> Stream m a---- | Result of taking a single step in a stream-data Step s a---- | a new element and a new seed-Yield :: a -> s -> Step s a---- | just a new seed-Skip :: s -> Step s a---- | end of stream-Done :: Step s a---- | <a>Size</a> hint of a <a>Stream</a>-size :: Stream m a -> Size---- | Attach a <a>Size</a> hint to a <a>Stream</a>-sized :: Stream m a -> Size -> Stream m a---- | Length of a <a>Stream</a>-length :: Monad m => Stream m a -> m Int---- | Check if a <a>Stream</a> is empty-null :: Monad m => Stream m a -> m Bool---- | Empty <a>Stream</a>-empty :: Monad m => Stream m a---- | Singleton <a>Stream</a>-singleton :: Monad m => a -> Stream m a---- | Prepend an element-cons :: Monad m => a -> Stream m a -> Stream m a---- | Append an element-snoc :: Monad m => Stream m a -> a -> Stream m a---- | Replicate a value to a given length-replicate :: Monad m => Int -> a -> Stream m a---- | Yield a <a>Stream</a> of values obtained by performing the monadic--- action the given number of times-replicateM :: Monad m => Int -> m a -> Stream m a-generate :: Monad m => Int -> (Int -> a) -> Stream m a---- | Generate a stream from its indices-generateM :: Monad m => Int -> (Int -> m a) -> Stream m a---- | Concatenate two <a>Stream</a>s-(++) :: Monad m => Stream m a -> Stream m a -> Stream m a---- | First element of the <a>Stream</a> or error if empty-head :: Monad m => Stream m a -> m a---- | Last element of the <a>Stream</a> or error if empty-last :: Monad m => Stream m a -> m a---- | Element at the given position-(!!) :: Monad m => Stream m a -> Int -> m a---- | Element at the given position or <a>Nothing</a> if out of bounds-(!?) :: Monad m => Stream m a -> Int -> m (Maybe a)---- | Extract a substream of the given length starting at the given--- position.-slice :: Monad m => Int -> Int -> Stream m a -> Stream m a---- | All but the last element-init :: Monad m => Stream m a -> Stream m a---- | All but the first element-tail :: Monad m => Stream m a -> Stream m a---- | The first <tt>n</tt> elements-take :: Monad m => Int -> Stream m a -> Stream m a---- | All but the first <tt>n</tt> elements-drop :: Monad m => Int -> Stream m a -> Stream m a---- | Map a function over a <a>Stream</a>-map :: Monad m => (a -> b) -> Stream m a -> Stream m b---- | Map a monadic function over a <a>Stream</a>-mapM :: Monad m => (a -> m b) -> Stream m a -> Stream m b---- | Execute a monadic action for each element of the <a>Stream</a>-mapM_ :: Monad m => (a -> m b) -> Stream m a -> m ()---- | Transform a <a>Stream</a> to use a different monad-trans :: (Monad m, Monad m') => (forall a. m a -> m' a) -> Stream m a -> Stream m' a-unbox :: Monad m => Stream m (Box a) -> Stream m a-concatMap :: Monad m => (a -> Stream m b) -> Stream m a -> Stream m b---- | Create a <a>Stream</a> of values from a <a>Stream</a> of streamable--- things-flatten :: Monad m => (a -> m s) -> (s -> m (Step s b)) -> Size -> Stream m a -> Stream m b---- | Pair each element in a <a>Stream</a> with its index-indexed :: Monad m => Stream m a -> Stream m (Int, a)---- | Pair each element in a <a>Stream</a> with its index, starting from the--- right and counting down-indexedR :: Monad m => Int -> Stream m a -> Stream m (Int, a)-zipWithM_ :: Monad m => (a -> b -> m c) -> Stream m a -> Stream m b -> m ()---- | Zip two <a>Stream</a>s with the given monadic function-zipWithM :: Monad m => (a -> b -> m c) -> Stream m a -> Stream m b -> Stream m c-zipWith3M :: Monad m => (a -> b -> c -> m d) -> Stream m a -> Stream m b -> Stream m c -> Stream m d-zipWith4M :: Monad m => (a -> b -> c -> d -> m e) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e-zipWith5M :: Monad m => (a -> b -> c -> d -> e -> m f) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m f-zipWith6M :: Monad m => (a -> b -> c -> d -> e -> f -> m g) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m f -> Stream m g-zipWith :: Monad m => (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c-zipWith3 :: Monad m => (a -> b -> c -> d) -> Stream m a -> Stream m b -> Stream m c -> Stream m d-zipWith4 :: Monad m => (a -> b -> c -> d -> e) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e-zipWith5 :: Monad m => (a -> b -> c -> d -> e -> f) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m f-zipWith6 :: Monad m => (a -> b -> c -> d -> e -> f -> g) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m f -> Stream m g-zip :: Monad m => Stream m a -> Stream m b -> Stream m (a, b)-zip3 :: Monad m => Stream m a -> Stream m b -> Stream m c -> Stream m (a, b, c)-zip4 :: Monad m => Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m (a, b, c, d)-zip5 :: Monad m => Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m (a, b, c, d, e)-zip6 :: Monad m => Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m f -> Stream m (a, b, c, d, e, f)---- | Drop elements which do not satisfy the predicate-filter :: Monad m => (a -> Bool) -> Stream m a -> Stream m a---- | Drop elements which do not satisfy the monadic predicate-filterM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a---- | Longest prefix of elements that satisfy the predicate-takeWhile :: Monad m => (a -> Bool) -> Stream m a -> Stream m a---- | Longest prefix of elements that satisfy the monadic predicate-takeWhileM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a---- | Drop the longest prefix of elements that satisfy the predicate-dropWhile :: Monad m => (a -> Bool) -> Stream m a -> Stream m a---- | Drop the longest prefix of elements that satisfy the monadic predicate-dropWhileM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a---- | Check whether the <a>Stream</a> contains an element-elem :: (Monad m, Eq a) => a -> Stream m a -> m Bool---- | Inverse of <a>elem</a>-notElem :: (Monad m, Eq a) => a -> Stream m a -> m Bool---- | Yield <a>Just</a> the first element that satisfies the predicate or--- <a>Nothing</a> if no such element exists.-find :: Monad m => (a -> Bool) -> Stream m a -> m (Maybe a)---- | Yield <a>Just</a> the first element that satisfies the monadic--- predicate or <a>Nothing</a> if no such element exists.-findM :: Monad m => (a -> m Bool) -> Stream m a -> m (Maybe a)---- | Yield <a>Just</a> the index of the first element that satisfies the--- predicate or <a>Nothing</a> if no such element exists.-findIndex :: Monad m => (a -> Bool) -> Stream m a -> m (Maybe Int)---- | Yield <a>Just</a> the index of the first element that satisfies the--- monadic predicate or <a>Nothing</a> if no such element exists.-findIndexM :: Monad m => (a -> m Bool) -> Stream m a -> m (Maybe Int)---- | Left fold-foldl :: Monad m => (a -> b -> a) -> a -> Stream m b -> m a---- | Left fold with a monadic operator-foldlM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> m a---- | Left fold over a non-empty <a>Stream</a>-foldl1 :: Monad m => (a -> a -> a) -> Stream m a -> m a---- | Left fold over a non-empty <a>Stream</a> with a monadic operator-foldl1M :: Monad m => (a -> a -> m a) -> Stream m a -> m a---- | Same as <a>foldlM</a>-foldM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> m a---- | Same as <a>foldl1M</a>-fold1M :: Monad m => (a -> a -> m a) -> Stream m a -> m a---- | Left fold with a strict accumulator-foldl' :: Monad m => (a -> b -> a) -> a -> Stream m b -> m a---- | Left fold with a strict accumulator and a monadic operator-foldlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> m a---- | Left fold over a non-empty <a>Stream</a> with a strict accumulator-foldl1' :: Monad m => (a -> a -> a) -> Stream m a -> m a---- | Left fold over a non-empty <a>Stream</a> with a strict accumulator and--- a monadic operator-foldl1M' :: Monad m => (a -> a -> m a) -> Stream m a -> m a---- | Same as <a>foldlM'</a>-foldM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> m a---- | Same as <a>foldl1M'</a>-fold1M' :: Monad m => (a -> a -> m a) -> Stream m a -> m a---- | Right fold-foldr :: Monad m => (a -> b -> b) -> b -> Stream m a -> m b---- | Right fold with a monadic operator-foldrM :: Monad m => (a -> b -> m b) -> b -> Stream m a -> m b---- | Right fold over a non-empty stream-foldr1 :: Monad m => (a -> a -> a) -> Stream m a -> m a---- | Right fold over a non-empty stream with a monadic operator-foldr1M :: Monad m => (a -> a -> m a) -> Stream m a -> m a-and :: Monad m => Stream m Bool -> m Bool-or :: Monad m => Stream m Bool -> m Bool-concatMapM :: Monad m => (a -> m (Stream m b)) -> Stream m a -> Stream m b---- | Unfold-unfoldr :: Monad m => (s -> Maybe (a, s)) -> s -> Stream m a---- | Unfold with a monadic function-unfoldrM :: Monad m => (s -> m (Maybe (a, s))) -> s -> Stream m a---- | Unfold at most <tt>n</tt> elements-unfoldrN :: Monad m => Int -> (s -> Maybe (a, s)) -> s -> Stream m a---- | Unfold at most <tt>n</tt> elements with a monadic functions-unfoldrNM :: Monad m => Int -> (s -> m (Maybe (a, s))) -> s -> Stream m a---- | Apply function n times to value. Zeroth element is original value.-iterateN :: Monad m => Int -> (a -> a) -> a -> Stream m a---- | Apply monadic function n times to value. Zeroth element is original--- value.-iterateNM :: Monad m => Int -> (a -> m a) -> a -> Stream m a---- | Prefix scan-prescanl :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Prefix scan with a monadic operator-prescanlM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Prefix scan with strict accumulator-prescanl' :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Prefix scan with strict accumulator and a monadic operator-prescanlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Suffix scan-postscanl :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Suffix scan with a monadic operator-postscanlM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Suffix scan with strict accumulator-postscanl' :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Suffix scan with strict acccumulator and a monadic operator-postscanlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Haskell-style scan-scanl :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Haskell-style scan with a monadic operator-scanlM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Haskell-style scan with strict accumulator-scanl' :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Haskell-style scan with strict accumulator and a monadic operator-scanlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Scan over a non-empty <a>Stream</a>-scanl1 :: Monad m => (a -> a -> a) -> Stream m a -> Stream m a---- | Scan over a non-empty <a>Stream</a> with a monadic operator-scanl1M :: Monad m => (a -> a -> m a) -> Stream m a -> Stream m a---- | Scan over a non-empty <a>Stream</a> with a strict accumulator-scanl1' :: Monad m => (a -> a -> a) -> Stream m a -> Stream m a---- | Scan over a non-empty <a>Stream</a> with a strict accumulator and a--- monadic operator-scanl1M' :: Monad m => (a -> a -> m a) -> Stream m a -> Stream m a---- | Yield a <a>Stream</a> of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc.-enumFromStepN :: (Num a, Monad m) => a -> a -> Int -> Stream m a---- | Enumerate values--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromTo :: (Enum a, Monad m) => a -> a -> Stream m a---- | Enumerate values with a given step.--- --- <i>WARNING:</i> This operation is very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: (Enum a, Monad m) => a -> a -> a -> Stream m a---- | Convert a <a>Stream</a> to a list-toList :: Monad m => Stream m a -> m [a]---- | Convert a list to a <a>Stream</a>-fromList :: Monad m => [a] -> Stream m a---- | Convert the first <tt>n</tt> elements of a list to a <a>Stream</a>-fromListN :: Monad m => Int -> [a] -> Stream m a---- | Convert a list to a <a>Stream</a> with the given <a>Size</a> hint.-unsafeFromList :: Monad m => Size -> [a] -> Stream m a-instance Monad m => Functor (Stream m)----- | Streams for stream fusion-module Data.Vector.Fusion.Stream---- | Result of taking a single step in a stream-data Step s a---- | a new element and a new seed-Yield :: a -> s -> Step s a---- | just a new seed-Skip :: s -> Step s a---- | end of stream-Done :: Step s a---- | The type of pure streams-type Stream = Stream Id---- | Alternative name for monadic streams-type MStream = Stream-inplace :: (forall m. Monad m => Stream m a -> Stream m b) -> Stream a -> Stream b---- | <a>Size</a> hint of a <a>Stream</a>-size :: Stream a -> Size---- | Attach a <a>Size</a> hint to a <a>Stream</a>-sized :: Stream a -> Size -> Stream a---- | Length of a <a>Stream</a>-length :: Stream a -> Int---- | Check if a <a>Stream</a> is empty-null :: Stream a -> Bool---- | Empty <a>Stream</a>-empty :: Stream a---- | Singleton <a>Stream</a>-singleton :: a -> Stream a---- | Prepend an element-cons :: a -> Stream a -> Stream a---- | Append an element-snoc :: Stream a -> a -> Stream a---- | Replicate a value to a given length-replicate :: Int -> a -> Stream a---- | Generate a stream from its indices-generate :: Int -> (Int -> a) -> Stream a---- | Concatenate two <a>Stream</a>s-(++) :: Stream a -> Stream a -> Stream a---- | First element of the <a>Stream</a> or error if empty-head :: Stream a -> a---- | Last element of the <a>Stream</a> or error if empty-last :: Stream a -> a---- | Element at the given position-(!!) :: Stream a -> Int -> a---- | Element at the given position or <a>Nothing</a> if out of bounds-(!?) :: Stream a -> Int -> Maybe a---- | Extract a substream of the given length starting at the given--- position.-slice :: Int -> Int -> Stream a -> Stream a---- | All but the last element-init :: Stream a -> Stream a---- | All but the first element-tail :: Stream a -> Stream a---- | The first <tt>n</tt> elements-take :: Int -> Stream a -> Stream a---- | All but the first <tt>n</tt> elements-drop :: Int -> Stream a -> Stream a---- | Map a function over a <a>Stream</a>-map :: (a -> b) -> Stream a -> Stream b-concatMap :: (a -> Stream b) -> Stream a -> Stream b---- | Create a <a>Stream</a> of values from a <a>Stream</a> of streamable--- things-flatten :: (a -> s) -> (s -> Step s b) -> Size -> Stream a -> Stream b-unbox :: Stream (Box a) -> Stream a---- | Pair each element in a <a>Stream</a> with its index-indexed :: Stream a -> Stream (Int, a)---- | Pair each element in a <a>Stream</a> with its index, starting from the--- right and counting down-indexedR :: Int -> Stream a -> Stream (Int, a)---- | Zip two <a>Stream</a>s with the given function-zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c---- | Zip three <a>Stream</a>s with the given function-zipWith3 :: (a -> b -> c -> d) -> Stream a -> Stream b -> Stream c -> Stream d-zipWith4 :: (a -> b -> c -> d -> e) -> Stream a -> Stream b -> Stream c -> Stream d -> Stream e-zipWith5 :: (a -> b -> c -> d -> e -> f) -> Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream f-zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream f -> Stream g-zip :: Stream a -> Stream b -> Stream (a, b)-zip3 :: Stream a -> Stream b -> Stream c -> Stream (a, b, c)-zip4 :: Stream a -> Stream b -> Stream c -> Stream d -> Stream (a, b, c, d)-zip5 :: Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream (a, b, c, d, e)-zip6 :: Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream f -> Stream (a, b, c, d, e, f)---- | Drop elements which do not satisfy the predicate-filter :: (a -> Bool) -> Stream a -> Stream a---- | Longest prefix of elements that satisfy the predicate-takeWhile :: (a -> Bool) -> Stream a -> Stream a---- | Drop the longest prefix of elements that satisfy the predicate-dropWhile :: (a -> Bool) -> Stream a -> Stream a---- | Check whether the <a>Stream</a> contains an element-elem :: Eq a => a -> Stream a -> Bool---- | Inverse of <a>elem</a>-notElem :: Eq a => a -> Stream a -> Bool---- | Yield <a>Just</a> the first element matching the predicate or--- <a>Nothing</a> if no such element exists.-find :: (a -> Bool) -> Stream a -> Maybe a---- | Yield <a>Just</a> the index of the first element matching the--- predicate or <a>Nothing</a> if no such element exists.-findIndex :: (a -> Bool) -> Stream a -> Maybe Int---- | Left fold-foldl :: (a -> b -> a) -> a -> Stream b -> a---- | Left fold on non-empty <a>Stream</a>s-foldl1 :: (a -> a -> a) -> Stream a -> a---- | Left fold with strict accumulator-foldl' :: (a -> b -> a) -> a -> Stream b -> a---- | Left fold on non-empty <a>Stream</a>s with strict accumulator-foldl1' :: (a -> a -> a) -> Stream a -> a---- | Right fold-foldr :: (a -> b -> b) -> b -> Stream a -> b---- | Right fold on non-empty <a>Stream</a>s-foldr1 :: (a -> a -> a) -> Stream a -> a-and :: Stream Bool -> Bool-or :: Stream Bool -> Bool---- | Unfold-unfoldr :: (s -> Maybe (a, s)) -> s -> Stream a---- | Unfold at most <tt>n</tt> elements-unfoldrN :: Int -> (s -> Maybe (a, s)) -> s -> Stream a---- | Apply function n-1 times to value. Zeroth element is original value.-iterateN :: Int -> (a -> a) -> a -> Stream a---- | Prefix scan-prescanl :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Prefix scan with strict accumulator-prescanl' :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Suffix scan-postscanl :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Suffix scan with strict accumulator-postscanl' :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Haskell-style scan-scanl :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Haskell-style scan with strict accumulator-scanl' :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Scan over a non-empty <a>Stream</a>-scanl1 :: (a -> a -> a) -> Stream a -> Stream a---- | Scan over a non-empty <a>Stream</a> with a strict accumulator-scanl1' :: (a -> a -> a) -> Stream a -> Stream a---- | Yield a <a>Stream</a> of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc.-enumFromStepN :: Num a => a -> a -> Int -> Stream a---- | Enumerate values--- --- <i>WARNING:</i> This operations can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromTo :: Enum a => a -> a -> Stream a---- | Enumerate values with a given step.--- --- <i>WARNING:</i> This operations is very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: Enum a => a -> a -> a -> Stream a---- | Convert a <a>Stream</a> to a list-toList :: Stream a -> [a]---- | Create a <a>Stream</a> from a list-fromList :: [a] -> Stream a---- | Create a <a>Stream</a> from the first <tt>n</tt> elements of a list--- --- <pre>--- fromListN n xs = fromList (take n xs)--- </pre>-fromListN :: Int -> [a] -> Stream a-unsafeFromList :: Size -> [a] -> Stream a---- | Convert a pure stream to a monadic stream-liftStream :: Monad m => Stream a -> Stream m a---- | Apply a monadic action to each element of the stream, producing a--- monadic stream of results-mapM :: Monad m => (a -> m b) -> Stream a -> Stream m b---- | Apply a monadic action to each element of the stream-mapM_ :: Monad m => (a -> m b) -> Stream a -> m ()-zipWithM :: Monad m => (a -> b -> m c) -> Stream a -> Stream b -> Stream m c-zipWithM_ :: Monad m => (a -> b -> m c) -> Stream a -> Stream b -> m ()---- | Yield a monadic stream of elements that satisfy the monadic predicate-filterM :: Monad m => (a -> m Bool) -> Stream a -> Stream m a---- | Monadic fold-foldM :: Monad m => (a -> b -> m a) -> a -> Stream b -> m a---- | Monadic fold over non-empty stream-fold1M :: Monad m => (a -> a -> m a) -> Stream a -> m a---- | Monadic fold with strict accumulator-foldM' :: Monad m => (a -> b -> m a) -> a -> Stream b -> m a---- | Monad fold over non-empty stream with strict accumulator-fold1M' :: Monad m => (a -> a -> m a) -> Stream a -> m a---- | Check if two <a>Stream</a>s are equal-eq :: Eq a => Stream a -> Stream a -> Bool---- | Lexicographically compare two <a>Stream</a>s-cmp :: Ord a => Stream a -> Stream a -> Ordering-instance Ord a => Ord (Stream Id a)-instance Eq a => Eq (Stream Id a)----- | Safe interface to <a>Data.Vector.Fusion.Stream</a>-module Data.Vector.Fusion.Stream.Safe---- | Result of taking a single step in a stream-data Step s a---- | a new element and a new seed-Yield :: a -> s -> Step s a---- | just a new seed-Skip :: s -> Step s a---- | end of stream-Done :: Step s a---- | The type of pure streams-type Stream = Stream Id---- | Alternative name for monadic streams-type MStream = Stream-inplace :: (forall m. Monad m => Stream m a -> Stream m b) -> Stream a -> Stream b---- | <a>Size</a> hint of a <a>Stream</a>-size :: Stream a -> Size---- | Attach a <a>Size</a> hint to a <a>Stream</a>-sized :: Stream a -> Size -> Stream a---- | Length of a <a>Stream</a>-length :: Stream a -> Int---- | Check if a <a>Stream</a> is empty-null :: Stream a -> Bool---- | Empty <a>Stream</a>-empty :: Stream a---- | Singleton <a>Stream</a>-singleton :: a -> Stream a---- | Prepend an element-cons :: a -> Stream a -> Stream a---- | Append an element-snoc :: Stream a -> a -> Stream a---- | Replicate a value to a given length-replicate :: Int -> a -> Stream a---- | Generate a stream from its indices-generate :: Int -> (Int -> a) -> Stream a---- | Concatenate two <a>Stream</a>s-(++) :: Stream a -> Stream a -> Stream a---- | First element of the <a>Stream</a> or error if empty-head :: Stream a -> a---- | Last element of the <a>Stream</a> or error if empty-last :: Stream a -> a---- | Element at the given position-(!!) :: Stream a -> Int -> a---- | Extract a substream of the given length starting at the given--- position.-slice :: Int -> Int -> Stream a -> Stream a---- | All but the last element-init :: Stream a -> Stream a---- | All but the first element-tail :: Stream a -> Stream a---- | The first <tt>n</tt> elements-take :: Int -> Stream a -> Stream a---- | All but the first <tt>n</tt> elements-drop :: Int -> Stream a -> Stream a---- | Map a function over a <a>Stream</a>-map :: (a -> b) -> Stream a -> Stream b-concatMap :: (a -> Stream b) -> Stream a -> Stream b---- | Create a <a>Stream</a> of values from a <a>Stream</a> of streamable--- things-flatten :: (a -> s) -> (s -> Step s b) -> Size -> Stream a -> Stream b-unbox :: Stream (Box a) -> Stream a---- | Pair each element in a <a>Stream</a> with its index-indexed :: Stream a -> Stream (Int, a)---- | Pair each element in a <a>Stream</a> with its index, starting from the--- right and counting down-indexedR :: Int -> Stream a -> Stream (Int, a)---- | Zip two <a>Stream</a>s with the given function-zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c---- | Zip three <a>Stream</a>s with the given function-zipWith3 :: (a -> b -> c -> d) -> Stream a -> Stream b -> Stream c -> Stream d-zipWith4 :: (a -> b -> c -> d -> e) -> Stream a -> Stream b -> Stream c -> Stream d -> Stream e-zipWith5 :: (a -> b -> c -> d -> e -> f) -> Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream f-zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream f -> Stream g-zip :: Stream a -> Stream b -> Stream (a, b)-zip3 :: Stream a -> Stream b -> Stream c -> Stream (a, b, c)-zip4 :: Stream a -> Stream b -> Stream c -> Stream d -> Stream (a, b, c, d)-zip5 :: Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream (a, b, c, d, e)-zip6 :: Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream f -> Stream (a, b, c, d, e, f)---- | Drop elements which do not satisfy the predicate-filter :: (a -> Bool) -> Stream a -> Stream a---- | Longest prefix of elements that satisfy the predicate-takeWhile :: (a -> Bool) -> Stream a -> Stream a---- | Drop the longest prefix of elements that satisfy the predicate-dropWhile :: (a -> Bool) -> Stream a -> Stream a---- | Check whether the <a>Stream</a> contains an element-elem :: Eq a => a -> Stream a -> Bool---- | Inverse of <a>elem</a>-notElem :: Eq a => a -> Stream a -> Bool---- | Yield <a>Just</a> the first element matching the predicate or--- <a>Nothing</a> if no such element exists.-find :: (a -> Bool) -> Stream a -> Maybe a---- | Yield <a>Just</a> the index of the first element matching the--- predicate or <a>Nothing</a> if no such element exists.-findIndex :: (a -> Bool) -> Stream a -> Maybe Int---- | Left fold-foldl :: (a -> b -> a) -> a -> Stream b -> a---- | Left fold on non-empty <a>Stream</a>s-foldl1 :: (a -> a -> a) -> Stream a -> a---- | Left fold with strict accumulator-foldl' :: (a -> b -> a) -> a -> Stream b -> a---- | Left fold on non-empty <a>Stream</a>s with strict accumulator-foldl1' :: (a -> a -> a) -> Stream a -> a---- | Right fold-foldr :: (a -> b -> b) -> b -> Stream a -> b---- | Right fold on non-empty <a>Stream</a>s-foldr1 :: (a -> a -> a) -> Stream a -> a-and :: Stream Bool -> Bool-or :: Stream Bool -> Bool---- | Unfold-unfoldr :: (s -> Maybe (a, s)) -> s -> Stream a---- | Unfold at most <tt>n</tt> elements-unfoldrN :: Int -> (s -> Maybe (a, s)) -> s -> Stream a---- | Apply function n-1 times to value. Zeroth element is original value.-iterateN :: Int -> (a -> a) -> a -> Stream a---- | Prefix scan-prescanl :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Prefix scan with strict accumulator-prescanl' :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Suffix scan-postscanl :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Suffix scan with strict accumulator-postscanl' :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Haskell-style scan-scanl :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Haskell-style scan with strict accumulator-scanl' :: (a -> b -> a) -> a -> Stream b -> Stream a---- | Scan over a non-empty <a>Stream</a>-scanl1 :: (a -> a -> a) -> Stream a -> Stream a---- | Scan over a non-empty <a>Stream</a> with a strict accumulator-scanl1' :: (a -> a -> a) -> Stream a -> Stream a---- | Yield a <a>Stream</a> of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc.-enumFromStepN :: Num a => a -> a -> Int -> Stream a---- | Enumerate values--- --- <i>WARNING:</i> This operations can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromTo :: Enum a => a -> a -> Stream a---- | Enumerate values with a given step.--- --- <i>WARNING:</i> This operations is very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: Enum a => a -> a -> a -> Stream a---- | Convert a <a>Stream</a> to a list-toList :: Stream a -> [a]---- | Create a <a>Stream</a> from a list-fromList :: [a] -> Stream a---- | Create a <a>Stream</a> from the first <tt>n</tt> elements of a list--- --- <pre>--- fromListN n xs = fromList (take n xs)--- </pre>-fromListN :: Int -> [a] -> Stream a---- | Convert a pure stream to a monadic stream-liftStream :: Monad m => Stream a -> Stream m a---- | Apply a monadic action to each element of the stream, producing a--- monadic stream of results-mapM :: Monad m => (a -> m b) -> Stream a -> Stream m b---- | Apply a monadic action to each element of the stream-mapM_ :: Monad m => (a -> m b) -> Stream a -> m ()-zipWithM :: Monad m => (a -> b -> m c) -> Stream a -> Stream b -> Stream m c-zipWithM_ :: Monad m => (a -> b -> m c) -> Stream a -> Stream b -> m ()---- | Yield a monadic stream of elements that satisfy the monadic predicate-filterM :: Monad m => (a -> m Bool) -> Stream a -> Stream m a---- | Monadic fold-foldM :: Monad m => (a -> b -> m a) -> a -> Stream b -> m a---- | Monadic fold over non-empty stream-fold1M :: Monad m => (a -> a -> m a) -> Stream a -> m a---- | Monadic fold with strict accumulator-foldM' :: Monad m => (a -> b -> m a) -> a -> Stream b -> m a---- | Monad fold over non-empty stream with strict accumulator-fold1M' :: Monad m => (a -> a -> m a) -> Stream a -> m a---- | Check if two <a>Stream</a>s are equal-eq :: Eq a => Stream a -> Stream a -> Bool---- | Lexicographically compare two <a>Stream</a>s-cmp :: Ord a => Stream a -> Stream a -> Ordering----- | Safe interface to <a>Data.Vector.Fusion.Stream.Monadic</a>-module Data.Vector.Fusion.Stream.Monadic.Safe---- | Monadic streams-data Stream m a-Stream :: (s -> m (Step s a)) -> s -> Size -> Stream m a---- | Result of taking a single step in a stream-data Step s a---- | a new element and a new seed-Yield :: a -> s -> Step s a---- | just a new seed-Skip :: s -> Step s a---- | end of stream-Done :: Step s a---- | <a>Size</a> hint of a <a>Stream</a>-size :: Stream m a -> Size---- | Attach a <a>Size</a> hint to a <a>Stream</a>-sized :: Stream m a -> Size -> Stream m a---- | Length of a <a>Stream</a>-length :: Monad m => Stream m a -> m Int---- | Check if a <a>Stream</a> is empty-null :: Monad m => Stream m a -> m Bool---- | Empty <a>Stream</a>-empty :: Monad m => Stream m a---- | Singleton <a>Stream</a>-singleton :: Monad m => a -> Stream m a---- | Prepend an element-cons :: Monad m => a -> Stream m a -> Stream m a---- | Append an element-snoc :: Monad m => Stream m a -> a -> Stream m a---- | Replicate a value to a given length-replicate :: Monad m => Int -> a -> Stream m a---- | Yield a <a>Stream</a> of values obtained by performing the monadic--- action the given number of times-replicateM :: Monad m => Int -> m a -> Stream m a-generate :: Monad m => Int -> (Int -> a) -> Stream m a---- | Generate a stream from its indices-generateM :: Monad m => Int -> (Int -> m a) -> Stream m a---- | Concatenate two <a>Stream</a>s-(++) :: Monad m => Stream m a -> Stream m a -> Stream m a---- | First element of the <a>Stream</a> or error if empty-head :: Monad m => Stream m a -> m a---- | Last element of the <a>Stream</a> or error if empty-last :: Monad m => Stream m a -> m a---- | Element at the given position-(!!) :: Monad m => Stream m a -> Int -> m a---- | Extract a substream of the given length starting at the given--- position.-slice :: Monad m => Int -> Int -> Stream m a -> Stream m a---- | All but the last element-init :: Monad m => Stream m a -> Stream m a---- | All but the first element-tail :: Monad m => Stream m a -> Stream m a---- | The first <tt>n</tt> elements-take :: Monad m => Int -> Stream m a -> Stream m a---- | All but the first <tt>n</tt> elements-drop :: Monad m => Int -> Stream m a -> Stream m a---- | Map a function over a <a>Stream</a>-map :: Monad m => (a -> b) -> Stream m a -> Stream m b---- | Map a monadic function over a <a>Stream</a>-mapM :: Monad m => (a -> m b) -> Stream m a -> Stream m b---- | Execute a monadic action for each element of the <a>Stream</a>-mapM_ :: Monad m => (a -> m b) -> Stream m a -> m ()---- | Transform a <a>Stream</a> to use a different monad-trans :: (Monad m, Monad m') => (forall a. m a -> m' a) -> Stream m a -> Stream m' a-unbox :: Monad m => Stream m (Box a) -> Stream m a-concatMap :: Monad m => (a -> Stream m b) -> Stream m a -> Stream m b---- | Create a <a>Stream</a> of values from a <a>Stream</a> of streamable--- things-flatten :: Monad m => (a -> m s) -> (s -> m (Step s b)) -> Size -> Stream m a -> Stream m b---- | Pair each element in a <a>Stream</a> with its index-indexed :: Monad m => Stream m a -> Stream m (Int, a)---- | Pair each element in a <a>Stream</a> with its index, starting from the--- right and counting down-indexedR :: Monad m => Int -> Stream m a -> Stream m (Int, a)-zipWithM_ :: Monad m => (a -> b -> m c) -> Stream m a -> Stream m b -> m ()---- | Zip two <a>Stream</a>s with the given monadic function-zipWithM :: Monad m => (a -> b -> m c) -> Stream m a -> Stream m b -> Stream m c-zipWith3M :: Monad m => (a -> b -> c -> m d) -> Stream m a -> Stream m b -> Stream m c -> Stream m d-zipWith4M :: Monad m => (a -> b -> c -> d -> m e) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e-zipWith5M :: Monad m => (a -> b -> c -> d -> e -> m f) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m f-zipWith6M :: Monad m => (a -> b -> c -> d -> e -> f -> m g) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m f -> Stream m g-zipWith :: Monad m => (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c-zipWith3 :: Monad m => (a -> b -> c -> d) -> Stream m a -> Stream m b -> Stream m c -> Stream m d-zipWith4 :: Monad m => (a -> b -> c -> d -> e) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e-zipWith5 :: Monad m => (a -> b -> c -> d -> e -> f) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m f-zipWith6 :: Monad m => (a -> b -> c -> d -> e -> f -> g) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m f -> Stream m g-zip :: Monad m => Stream m a -> Stream m b -> Stream m (a, b)-zip3 :: Monad m => Stream m a -> Stream m b -> Stream m c -> Stream m (a, b, c)-zip4 :: Monad m => Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m (a, b, c, d)-zip5 :: Monad m => Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m (a, b, c, d, e)-zip6 :: Monad m => Stream m a -> Stream m b -> Stream m c -> Stream m d -> Stream m e -> Stream m f -> Stream m (a, b, c, d, e, f)---- | Drop elements which do not satisfy the predicate-filter :: Monad m => (a -> Bool) -> Stream m a -> Stream m a---- | Drop elements which do not satisfy the monadic predicate-filterM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a---- | Longest prefix of elements that satisfy the predicate-takeWhile :: Monad m => (a -> Bool) -> Stream m a -> Stream m a---- | Longest prefix of elements that satisfy the monadic predicate-takeWhileM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a---- | Drop the longest prefix of elements that satisfy the predicate-dropWhile :: Monad m => (a -> Bool) -> Stream m a -> Stream m a---- | Drop the longest prefix of elements that satisfy the monadic predicate-dropWhileM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a---- | Check whether the <a>Stream</a> contains an element-elem :: (Monad m, Eq a) => a -> Stream m a -> m Bool---- | Inverse of <a>elem</a>-notElem :: (Monad m, Eq a) => a -> Stream m a -> m Bool---- | Yield <a>Just</a> the first element that satisfies the predicate or--- <a>Nothing</a> if no such element exists.-find :: Monad m => (a -> Bool) -> Stream m a -> m (Maybe a)---- | Yield <a>Just</a> the first element that satisfies the monadic--- predicate or <a>Nothing</a> if no such element exists.-findM :: Monad m => (a -> m Bool) -> Stream m a -> m (Maybe a)---- | Yield <a>Just</a> the index of the first element that satisfies the--- predicate or <a>Nothing</a> if no such element exists.-findIndex :: Monad m => (a -> Bool) -> Stream m a -> m (Maybe Int)---- | Yield <a>Just</a> the index of the first element that satisfies the--- monadic predicate or <a>Nothing</a> if no such element exists.-findIndexM :: Monad m => (a -> m Bool) -> Stream m a -> m (Maybe Int)---- | Left fold-foldl :: Monad m => (a -> b -> a) -> a -> Stream m b -> m a---- | Left fold with a monadic operator-foldlM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> m a---- | Left fold over a non-empty <a>Stream</a>-foldl1 :: Monad m => (a -> a -> a) -> Stream m a -> m a---- | Left fold over a non-empty <a>Stream</a> with a monadic operator-foldl1M :: Monad m => (a -> a -> m a) -> Stream m a -> m a---- | Same as <a>foldlM</a>-foldM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> m a---- | Same as <a>foldl1M</a>-fold1M :: Monad m => (a -> a -> m a) -> Stream m a -> m a---- | Left fold with a strict accumulator-foldl' :: Monad m => (a -> b -> a) -> a -> Stream m b -> m a---- | Left fold with a strict accumulator and a monadic operator-foldlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> m a---- | Left fold over a non-empty <a>Stream</a> with a strict accumulator-foldl1' :: Monad m => (a -> a -> a) -> Stream m a -> m a---- | Left fold over a non-empty <a>Stream</a> with a strict accumulator and--- a monadic operator-foldl1M' :: Monad m => (a -> a -> m a) -> Stream m a -> m a---- | Same as <a>foldlM'</a>-foldM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> m a---- | Same as <a>foldl1M'</a>-fold1M' :: Monad m => (a -> a -> m a) -> Stream m a -> m a---- | Right fold-foldr :: Monad m => (a -> b -> b) -> b -> Stream m a -> m b---- | Right fold with a monadic operator-foldrM :: Monad m => (a -> b -> m b) -> b -> Stream m a -> m b---- | Right fold over a non-empty stream-foldr1 :: Monad m => (a -> a -> a) -> Stream m a -> m a---- | Right fold over a non-empty stream with a monadic operator-foldr1M :: Monad m => (a -> a -> m a) -> Stream m a -> m a-and :: Monad m => Stream m Bool -> m Bool-or :: Monad m => Stream m Bool -> m Bool-concatMapM :: Monad m => (a -> m (Stream m b)) -> Stream m a -> Stream m b---- | Unfold-unfoldr :: Monad m => (s -> Maybe (a, s)) -> s -> Stream m a---- | Unfold with a monadic function-unfoldrM :: Monad m => (s -> m (Maybe (a, s))) -> s -> Stream m a---- | Unfold at most <tt>n</tt> elements-unfoldrN :: Monad m => Int -> (s -> Maybe (a, s)) -> s -> Stream m a---- | Unfold at most <tt>n</tt> elements with a monadic functions-unfoldrNM :: Monad m => Int -> (s -> m (Maybe (a, s))) -> s -> Stream m a---- | Apply function n times to value. Zeroth element is original value.-iterateN :: Monad m => Int -> (a -> a) -> a -> Stream m a---- | Apply monadic function n times to value. Zeroth element is original--- value.-iterateNM :: Monad m => Int -> (a -> m a) -> a -> Stream m a---- | Prefix scan-prescanl :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Prefix scan with a monadic operator-prescanlM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Prefix scan with strict accumulator-prescanl' :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Prefix scan with strict accumulator and a monadic operator-prescanlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Suffix scan-postscanl :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Suffix scan with a monadic operator-postscanlM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Suffix scan with strict accumulator-postscanl' :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Suffix scan with strict acccumulator and a monadic operator-postscanlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Haskell-style scan-scanl :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Haskell-style scan with a monadic operator-scanlM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Haskell-style scan with strict accumulator-scanl' :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a---- | Haskell-style scan with strict accumulator and a monadic operator-scanlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a---- | Scan over a non-empty <a>Stream</a>-scanl1 :: Monad m => (a -> a -> a) -> Stream m a -> Stream m a---- | Scan over a non-empty <a>Stream</a> with a monadic operator-scanl1M :: Monad m => (a -> a -> m a) -> Stream m a -> Stream m a---- | Scan over a non-empty <a>Stream</a> with a strict accumulator-scanl1' :: Monad m => (a -> a -> a) -> Stream m a -> Stream m a---- | Scan over a non-empty <a>Stream</a> with a strict accumulator and a--- monadic operator-scanl1M' :: Monad m => (a -> a -> m a) -> Stream m a -> Stream m a---- | Yield a <a>Stream</a> of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc.-enumFromStepN :: (Num a, Monad m) => a -> a -> Int -> Stream m a---- | Enumerate values--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromTo :: (Enum a, Monad m) => a -> a -> Stream m a---- | Enumerate values with a given step.--- --- <i>WARNING:</i> This operation is very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: (Enum a, Monad m) => a -> a -> a -> Stream m a---- | Convert a <a>Stream</a> to a list-toList :: Monad m => Stream m a -> m [a]---- | Convert a list to a <a>Stream</a>-fromList :: Monad m => [a] -> Stream m a---- | Convert the first <tt>n</tt> elements of a list to a <a>Stream</a>-fromListN :: Monad m => Int -> [a] -> Stream m a----- | Generic interface to mutable vectors-module Data.Vector.Generic.Mutable---- | Class of mutable vectors parametrised with a primitive state token.-class MVector v a-basicLength :: MVector v a => v s a -> Int-basicUnsafeSlice :: MVector v a => Int -> Int -> v s a -> v s a-basicOverlaps :: MVector v a => v s a -> v s a -> Bool-basicUnsafeNew :: (MVector v a, PrimMonad m) => Int -> m (v (PrimState m) a)-basicUnsafeReplicate :: (MVector v a, PrimMonad m) => Int -> a -> m (v (PrimState m) a)-basicUnsafeRead :: (MVector v a, PrimMonad m) => v (PrimState m) a -> Int -> m a-basicUnsafeWrite :: (MVector v a, PrimMonad m) => v (PrimState m) a -> Int -> a -> m ()-basicClear :: (MVector v a, PrimMonad m) => v (PrimState m) a -> m ()-basicSet :: (MVector v a, PrimMonad m) => v (PrimState m) a -> a -> m ()-basicUnsafeCopy :: (MVector v a, PrimMonad m) => v (PrimState m) a -> v (PrimState m) a -> m ()-basicUnsafeMove :: (MVector v a, PrimMonad m) => v (PrimState m) a -> v (PrimState m) a -> m ()-basicUnsafeGrow :: (MVector v a, PrimMonad m) => v (PrimState m) a -> Int -> m (v (PrimState m) a)---- | Length of the mutable vector.-length :: MVector v a => v s a -> Int---- | Check whether the vector is empty-null :: MVector v a => v s a -> Bool---- | Yield a part of the mutable vector without copying it.-slice :: MVector v a => Int -> Int -> v s a -> v s a-init :: MVector v a => v s a -> v s a-tail :: MVector v a => v s a -> v s a-take :: MVector v a => Int -> v s a -> v s a-drop :: MVector v a => Int -> v s a -> v s a-splitAt :: MVector v a => Int -> v s a -> (v s a, v s a)---- | Yield a part of the mutable vector without copying it. No bounds--- checks are performed.-unsafeSlice :: MVector v a => Int -> Int -> v s a -> v s a-unsafeInit :: MVector v a => v s a -> v s a-unsafeTail :: MVector v a => v s a -> v s a-unsafeTake :: MVector v a => Int -> v s a -> v s a-unsafeDrop :: MVector v a => Int -> v s a -> v s a-overlaps :: MVector v a => v s a -> v s a -> Bool---- | Create a mutable vector of the given length.-new :: (PrimMonad m, MVector v a) => Int -> m (v (PrimState m) a)---- | Create a mutable vector of the given length. The length is not--- checked.-unsafeNew :: (PrimMonad m, MVector v a) => Int -> m (v (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with an initial value.-replicate :: (PrimMonad m, MVector v a) => Int -> a -> m (v (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with values produced by repeatedly executing the--- monadic action.-replicateM :: (PrimMonad m, MVector v a) => Int -> m a -> m (v (PrimState m) a)---- | Create a copy of a mutable vector.-clone :: (PrimMonad m, MVector v a) => v (PrimState m) a -> m (v (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive.-grow :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> m (v (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive but this is not checked.-unsafeGrow :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> m (v (PrimState m) a)---- | Reset all elements of the vector to some undefined value, clearing all--- references to external objects. This is usually a noop for unboxed--- vectors.-clear :: (PrimMonad m, MVector v a) => v (PrimState m) a -> m ()---- | Yield the element at the given position.-read :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> m a---- | Replace the element at the given position.-write :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions.-swap :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> Int -> m ()---- | Yield the element at the given position. No bounds checks are--- performed.-unsafeRead :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> m a---- | Replace the element at the given position. No bounds checks are--- performed.-unsafeWrite :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions. No bounds checks are--- performed.-unsafeSwap :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> Int -> m ()---- | Set all elements of the vector to the given value.-set :: (PrimMonad m, MVector v a) => v (PrimState m) a -> a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap.-copy :: (PrimMonad m, MVector v a) => v (PrimState m) a -> v (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length.--- --- If the vectors do not overlap, then this is equivalent to <a>copy</a>.--- Otherwise, the copying is performed as if the source vector were--- copied to a temporary vector and then the temporary vector was copied--- to the target vector.-move :: (PrimMonad m, MVector v a) => v (PrimState m) a -> v (PrimState m) a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap. This is not checked.-unsafeCopy :: (PrimMonad m, MVector v a) => v (PrimState m) a -> v (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length, but this is not checked.--- --- If the vectors do not overlap, then this is equivalent to--- <a>unsafeCopy</a>. Otherwise, the copying is performed as if the--- source vector were copied to a temporary vector and then the temporary--- vector was copied to the target vector.-unsafeMove :: (PrimMonad m, MVector v a) => v (PrimState m) a -> v (PrimState m) a -> m ()-mstream :: (PrimMonad m, MVector v a) => v (PrimState m) a -> MStream m a-mstreamR :: (PrimMonad m, MVector v a) => v (PrimState m) a -> MStream m a---- | Create a new mutable vector and fill it with elements from the--- <a>Stream</a>. The vector will grow exponentially if the maximum size--- of the <a>Stream</a> is unknown.-unstream :: (PrimMonad m, MVector v a) => Stream a -> m (v (PrimState m) a)---- | Create a new mutable vector and fill it with elements from the--- <a>Stream</a> from right to left. The vector will grow exponentially--- if the maximum size of the <a>Stream</a> is unknown.-unstreamR :: (PrimMonad m, MVector v a) => Stream a -> m (v (PrimState m) a)---- | Create a new mutable vector and fill it with elements from the monadic--- stream. The vector will grow exponentially if the maximum size of the--- stream is unknown.-munstream :: (PrimMonad m, MVector v a) => MStream m a -> m (v (PrimState m) a)---- | Create a new mutable vector and fill it with elements from the monadic--- stream from right to left. The vector will grow exponentially if the--- maximum size of the stream is unknown.-munstreamR :: (PrimMonad m, MVector v a) => MStream m a -> m (v (PrimState m) a)-transform :: (PrimMonad m, MVector v a) => (MStream m a -> MStream m a) -> v (PrimState m) a -> m (v (PrimState m) a)-transformR :: (PrimMonad m, MVector v a) => (MStream m a -> MStream m a) -> v (PrimState m) a -> m (v (PrimState m) a)-fill :: (PrimMonad m, MVector v a) => v (PrimState m) a -> MStream m a -> m (v (PrimState m) a)-fillR :: (PrimMonad m, MVector v a) => v (PrimState m) a -> MStream m a -> m (v (PrimState m) a)-unsafeAccum :: (PrimMonad m, MVector v a) => (a -> b -> a) -> v (PrimState m) a -> Stream (Int, b) -> m ()-accum :: (PrimMonad m, MVector v a) => (a -> b -> a) -> v (PrimState m) a -> Stream (Int, b) -> m ()-unsafeUpdate :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Stream (Int, a) -> m ()-update :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Stream (Int, a) -> m ()-reverse :: (PrimMonad m, MVector v a) => v (PrimState m) a -> m ()-unstablePartition :: (PrimMonad m, MVector v a) => (a -> Bool) -> v (PrimState m) a -> m Int-unstablePartitionStream :: (PrimMonad m, MVector v a) => (a -> Bool) -> Stream a -> m (v (PrimState m) a, v (PrimState m) a)-partitionStream :: (PrimMonad m, MVector v a) => (a -> Bool) -> Stream a -> m (v (PrimState m) a, v (PrimState m) a)----- | Safe interface to <a>Data.Vector.Generic.Mutable</a>-module Data.Vector.Generic.Mutable.Safe---- | Class of mutable vectors parametrised with a primitive state token.-class MVector v a---- | Length of the mutable vector.-length :: MVector v a => v s a -> Int---- | Check whether the vector is empty-null :: MVector v a => v s a -> Bool---- | Yield a part of the mutable vector without copying it.-slice :: MVector v a => Int -> Int -> v s a -> v s a-init :: MVector v a => v s a -> v s a-tail :: MVector v a => v s a -> v s a-take :: MVector v a => Int -> v s a -> v s a-drop :: MVector v a => Int -> v s a -> v s a-splitAt :: MVector v a => Int -> v s a -> (v s a, v s a)-overlaps :: MVector v a => v s a -> v s a -> Bool---- | Create a mutable vector of the given length.-new :: (PrimMonad m, MVector v a) => Int -> m (v (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with an initial value.-replicate :: (PrimMonad m, MVector v a) => Int -> a -> m (v (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with values produced by repeatedly executing the--- monadic action.-replicateM :: (PrimMonad m, MVector v a) => Int -> m a -> m (v (PrimState m) a)---- | Create a copy of a mutable vector.-clone :: (PrimMonad m, MVector v a) => v (PrimState m) a -> m (v (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive.-grow :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> m (v (PrimState m) a)---- | Reset all elements of the vector to some undefined value, clearing all--- references to external objects. This is usually a noop for unboxed--- vectors.-clear :: (PrimMonad m, MVector v a) => v (PrimState m) a -> m ()---- | Yield the element at the given position.-read :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> m a---- | Replace the element at the given position.-write :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions.-swap :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> Int -> m ()---- | Set all elements of the vector to the given value.-set :: (PrimMonad m, MVector v a) => v (PrimState m) a -> a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap.-copy :: (PrimMonad m, MVector v a) => v (PrimState m) a -> v (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length.--- --- If the vectors do not overlap, then this is equivalent to <a>copy</a>.--- Otherwise, the copying is performed as if the source vector were--- copied to a temporary vector and then the temporary vector was copied--- to the target vector.-move :: (PrimMonad m, MVector v a) => v (PrimState m) a -> v (PrimState m) a -> m ()---- | Create a new mutable vector and fill it with elements from the--- <a>Stream</a>. The vector will grow exponentially if the maximum size--- of the <a>Stream</a> is unknown.-unstream :: (PrimMonad m, MVector v a) => Stream a -> m (v (PrimState m) a)---- | Create a new mutable vector and fill it with elements from the--- <a>Stream</a> from right to left. The vector will grow exponentially--- if the maximum size of the <a>Stream</a> is unknown.-unstreamR :: (PrimMonad m, MVector v a) => Stream a -> m (v (PrimState m) a)---- | Create a new mutable vector and fill it with elements from the monadic--- stream. The vector will grow exponentially if the maximum size of the--- stream is unknown.-munstream :: (PrimMonad m, MVector v a) => MStream m a -> m (v (PrimState m) a)---- | Create a new mutable vector and fill it with elements from the monadic--- stream from right to left. The vector will grow exponentially if the--- maximum size of the stream is unknown.-munstreamR :: (PrimMonad m, MVector v a) => MStream m a -> m (v (PrimState m) a)-transform :: (PrimMonad m, MVector v a) => (MStream m a -> MStream m a) -> v (PrimState m) a -> m (v (PrimState m) a)-transformR :: (PrimMonad m, MVector v a) => (MStream m a -> MStream m a) -> v (PrimState m) a -> m (v (PrimState m) a)-fill :: (PrimMonad m, MVector v a) => v (PrimState m) a -> MStream m a -> m (v (PrimState m) a)-fillR :: (PrimMonad m, MVector v a) => v (PrimState m) a -> MStream m a -> m (v (PrimState m) a)-accum :: (PrimMonad m, MVector v a) => (a -> b -> a) -> v (PrimState m) a -> Stream (Int, b) -> m ()-update :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Stream (Int, a) -> m ()-reverse :: (PrimMonad m, MVector v a) => v (PrimState m) a -> m ()-unstablePartition :: (PrimMonad m, MVector v a) => (a -> Bool) -> v (PrimState m) a -> m Int-unstablePartitionStream :: (PrimMonad m, MVector v a) => (a -> Bool) -> Stream a -> m (v (PrimState m) a, v (PrimState m) a)-partitionStream :: (PrimMonad m, MVector v a) => (a -> Bool) -> Stream a -> m (v (PrimState m) a, v (PrimState m) a)----- | Purely functional interface to initialisation of mutable vectors-module Data.Vector.Generic.New-data New v a-New :: (forall s. ST s (Mutable v s a)) -> New v a-create :: (forall s. ST s (Mutable v s a)) -> New v a-run :: New v a -> ST s (Mutable v s a)-runPrim :: PrimMonad m => New v a -> m (Mutable v (PrimState m) a)-apply :: (forall s. Mutable v s a -> Mutable v s a) -> New v a -> New v a-modify :: (forall s. Mutable v s a -> ST s ()) -> New v a -> New v a-modifyWithStream :: (forall s. Mutable v s a -> Stream b -> ST s ()) -> New v a -> Stream b -> New v a-unstream :: Vector v a => Stream a -> New v a-transform :: Vector v a => (forall m. Monad m => MStream m a -> MStream m a) -> New v a -> New v a-unstreamR :: Vector v a => Stream a -> New v a-transformR :: Vector v a => (forall m. Monad m => MStream m a -> MStream m a) -> New v a -> New v a-slice :: Vector v a => Int -> Int -> New v a -> New v a-init :: Vector v a => New v a -> New v a-tail :: Vector v a => New v a -> New v a-take :: Vector v a => Int -> New v a -> New v a-drop :: Vector v a => Int -> New v a -> New v a-unsafeSlice :: Vector v a => Int -> Int -> New v a -> New v a-unsafeInit :: Vector v a => New v a -> New v a-unsafeTail :: Vector v a => New v a -> New v a----- | Generic interface to pure vectors.-module Data.Vector.Generic---- | Class of immutable vectors. Every immutable vector is associated with--- its mutable version through the <a>Mutable</a> type family. Methods of--- this class should not be used directly. Instead,--- <a>Data.Vector.Generic</a> and other Data.Vector modules provide safe--- and fusible wrappers.--- --- Minimum complete implementation:--- --- <ul>--- <li><a>basicUnsafeFreeze</a></li>--- <li><a>basicUnsafeThaw</a></li>--- <li><a>basicLength</a></li>--- <li><a>basicUnsafeSlice</a></li>--- <li><a>basicUnsafeIndexM</a></li>--- </ul>-class MVector (Mutable v) a => Vector v a-basicUnsafeFreeze :: (Vector v a, PrimMonad m) => Mutable v (PrimState m) a -> m (v a)-basicUnsafeThaw :: (Vector v a, PrimMonad m) => v a -> m (Mutable v (PrimState m) a)-basicLength :: Vector v a => v a -> Int-basicUnsafeSlice :: Vector v a => Int -> Int -> v a -> v a-basicUnsafeIndexM :: (Vector v a, Monad m) => v a -> Int -> m a-basicUnsafeCopy :: (Vector v a, PrimMonad m) => Mutable v (PrimState m) a -> v a -> m ()-elemseq :: Vector v a => v a -> a -> b -> b---- | <tt>Mutable v s a</tt> is the mutable version of the pure vector type--- <tt>v a</tt> with the state token <tt>s</tt>---- | <i>O(1)</i> Yield the length of the vector.-length :: Vector v a => v a -> Int---- | <i>O(1)</i> Test whether a vector if empty-null :: Vector v a => v a -> Bool---- | O(1) Indexing-(!) :: Vector v a => v a -> Int -> a---- | O(1) Safe indexing-(!?) :: Vector v a => v a -> Int -> Maybe a---- | <i>O(1)</i> First element-head :: Vector v a => v a -> a---- | <i>O(1)</i> Last element-last :: Vector v a => v a -> a---- | <i>O(1)</i> Unsafe indexing without bounds checking-unsafeIndex :: Vector v a => v a -> Int -> a---- | <i>O(1)</i> First element without checking if the vector is empty-unsafeHead :: Vector v a => v a -> a---- | <i>O(1)</i> Last element without checking if the vector is empty-unsafeLast :: Vector v a => v a -> a---- | <i>O(1)</i> Indexing in a monad.--- --- The monad allows operations to be strict in the vector when necessary.--- Suppose vector copying is implemented like this:--- --- <pre>--- copy mv v = ... write mv i (v ! i) ...--- </pre>--- --- For lazy vectors, <tt>v ! i</tt> would not be evaluated which means--- that <tt>mv</tt> would unnecessarily retain a reference to <tt>v</tt>--- in each element written.--- --- With <a>indexM</a>, copying can be implemented like this instead:--- --- <pre>--- copy mv v = ... do--- x <- indexM v i--- write mv i x--- </pre>--- --- Here, no references to <tt>v</tt> are retained because indexing (but--- <i>not</i> the elements) is evaluated eagerly.-indexM :: (Vector v a, Monad m) => v a -> Int -> m a---- | <i>O(1)</i> First element of a vector in a monad. See <a>indexM</a>--- for an explanation of why this is useful.-headM :: (Vector v a, Monad m) => v a -> m a---- | <i>O(1)</i> Last element of a vector in a monad. See <a>indexM</a> for--- an explanation of why this is useful.-lastM :: (Vector v a, Monad m) => v a -> m a---- | <i>O(1)</i> Indexing in a monad without bounds checks. See--- <a>indexM</a> for an explanation of why this is useful.-unsafeIndexM :: (Vector v a, Monad m) => v a -> Int -> m a---- | <i>O(1)</i> First element in a monad without checking for empty--- vectors. See <a>indexM</a> for an explanation of why this is useful.-unsafeHeadM :: (Vector v a, Monad m) => v a -> m a---- | <i>O(1)</i> Last element in a monad without checking for empty--- vectors. See <a>indexM</a> for an explanation of why this is useful.-unsafeLastM :: (Vector v a, Monad m) => v a -> m a---- | <i>O(1)</i> Yield a slice of the vector without copying it. The vector--- must contain at least <tt>i+n</tt> elements.-slice :: Vector v a => Int -> Int -> v a -> v a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty.-init :: Vector v a => v a -> v a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty.-tail :: Vector v a => v a -> v a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements without copying. The--- vector may contain less than <tt>n</tt> elements in which case it is--- returned unchanged.-take :: Vector v a => Int -> v a -> v a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector may contain less than <tt>n</tt> elements in which--- case an empty vector is returned.-drop :: Vector v a => Int -> v a -> v a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements paired with the--- remainder without copying.--- --- Note that <tt><a>splitAt</a> n v</tt> is equivalent to--- <tt>(<a>take</a> n v, <a>drop</a> n v)</tt> but slightly more--- efficient.-splitAt :: Vector v a => Int -> v a -> (v a, v a)---- | <i>O(1)</i> Yield a slice of the vector without copying. The vector--- must contain at least <tt>i+n</tt> elements but this is not checked.-unsafeSlice :: Vector v a => Int -> Int -> v a -> v a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty but this is not checked.-unsafeInit :: Vector v a => v a -> v a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty but this is not checked.-unsafeTail :: Vector v a => v a -> v a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements without copying. The--- vector must contain at least <tt>n</tt> elements but this is not--- checked.-unsafeTake :: Vector v a => Int -> v a -> v a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector must contain at least <tt>n</tt> elements but this--- is not checked.-unsafeDrop :: Vector v a => Int -> v a -> v a---- | <i>O(1)</i> Empty vector-empty :: Vector v a => v a---- | <i>O(1)</i> Vector with exactly one element-singleton :: Vector v a => a -> v a---- | <i>O(n)</i> Vector of the given length with the same value in each--- position-replicate :: Vector v a => Int -> a -> v a---- | <i>O(n)</i> Construct a vector of the given length by applying the--- function to each index-generate :: Vector v a => Int -> (Int -> a) -> v a---- | <i>O(n)</i> Apply function n times to value. Zeroth element is--- original value.-iterateN :: Vector v a => Int -> (a -> a) -> a -> v a---- | <i>O(n)</i> Execute the monadic action the given number of times and--- store the results in a vector.-replicateM :: (Monad m, Vector v a) => Int -> m a -> m (v a)---- | <i>O(n)</i> Construct a vector of the given length by applying the--- monadic action to each index-generateM :: (Monad m, Vector v a) => Int -> (Int -> m a) -> m (v a)---- | Execute the monadic action and freeze the resulting vector.--- --- <pre>--- create (do { v <- <a>new</a> 2; <a>write</a> v 0 'a'; <a>write</a> v 1 'b' }) = <<tt>a</tt>,<tt>b</tt>>--- </pre>-create :: Vector v a => (forall s. ST s (Mutable v s a)) -> v a---- | <i>O(n)</i> Construct a vector by repeatedly applying the generator--- function to a seed. The generator function yields <a>Just</a> the next--- element and the new seed or <a>Nothing</a> if there are no more--- elements.--- --- <pre>--- unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10--- = <10,9,8,7,6,5,4,3,2,1>--- </pre>-unfoldr :: Vector v a => (b -> Maybe (a, b)) -> b -> v a---- | <i>O(n)</i> Construct a vector with at most <tt>n</tt> by repeatedly--- applying the generator function to the a seed. The generator function--- yields <a>Just</a> the next element and the new seed or <a>Nothing</a>--- if there are no more elements.--- --- <pre>--- unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>--- </pre>-unfoldrN :: Vector v a => Int -> (b -> Maybe (a, b)) -> b -> v a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements by repeatedly--- applying the generator function to the already constructed part of the--- vector.--- --- <pre>--- constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>--- </pre>-constructN :: Vector v a => Int -> (v a -> a) -> v a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements from right to--- left by repeatedly applying the generator function to the already--- constructed part of the vector.--- --- <pre>--- constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>--- </pre>-constructrN :: Vector v a => Int -> (v a -> a) -> v a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+1</tt> etc. This operation is usually more efficient--- than <a>enumFromTo</a>.--- --- <pre>--- enumFromN 5 3 = <5,6,7>--- </pre>-enumFromN :: (Vector v a, Num a) => a -> Int -> v a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. This operations is--- usually more efficient than <a>enumFromThenTo</a>.--- --- <pre>--- enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>--- </pre>-enumFromStepN :: (Vector v a, Num a) => a -> a -> Int -> v a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromN</a> instead.-enumFromTo :: (Vector v a, Enum a) => a -> a -> v a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt> with a--- specific step <tt>z</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: (Vector v a, Enum a) => a -> a -> a -> v a---- | <i>O(n)</i> Prepend an element-cons :: Vector v a => a -> v a -> v a---- | <i>O(n)</i> Append an element-snoc :: Vector v a => v a -> a -> v a---- | <i>O(m+n)</i> Concatenate two vectors-(++) :: Vector v a => v a -> v a -> v a---- | <i>O(n)</i> Concatenate all vectors in the list-concat :: Vector v a => [v a] -> v a---- | <i>O(n)</i> Yield the argument but force it not to retain any extra--- memory, possibly by copying it.--- --- This is especially useful when dealing with slices. For example:--- --- <pre>--- force (slice 0 2 <huge vector>)--- </pre>--- --- Here, the slice retains a reference to the huge vector. Forcing it--- creates a copy of just the elements that belong to the slice and--- allows the huge vector to be garbage collected.-force :: Vector v a => v a -> v a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the--- vector element at position <tt>i</tt> by <tt>a</tt>.--- --- <pre>--- <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>--- </pre>-(//) :: Vector v a => v a -> [(Int, a)] -> v a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the vector of--- index/value pairs, replace the vector element at position <tt>i</tt>--- by <tt>a</tt>.--- --- <pre>--- update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>--- </pre>-update :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a) -> v a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>a</tt> from the value vector, replace--- the element of the initial vector at position <tt>i</tt> by--- <tt>a</tt>.--- --- <pre>--- update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>--- </pre>--- --- This function is useful for instances of <a>Vector</a> that cannot--- store pairs. Otherwise, <a>update</a> is probably more convenient.--- --- <pre>--- update_ xs is ys = <a>update</a> xs (<a>zip</a> is ys)--- </pre>-update_ :: (Vector v a, Vector v Int) => v a -> v Int -> v a -> v a---- | Same as (<a>//</a>) but without bounds checking.-unsafeUpd :: Vector v a => v a -> [(Int, a)] -> v a---- | Same as <a>update</a> but without bounds checking.-unsafeUpdate :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a) -> v a---- | Same as <a>update_</a> but without bounds checking.-unsafeUpdate_ :: (Vector v a, Vector v Int) => v a -> v Int -> v a -> v a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the--- vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.--- --- <pre>--- accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>--- </pre>-accum :: Vector v a => (a -> b -> a) -> v a -> [(Int, b)] -> v a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the vector of pairs,--- replace the vector element <tt>a</tt> at position <tt>i</tt> by <tt>f--- a b</tt>.--- --- <pre>--- accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>--- </pre>-accumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> v a -> v (Int, b) -> v a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>b</tt> from the the value vector,--- replace the element of the initial vector at position <tt>i</tt> by--- <tt>f a b</tt>.--- --- <pre>--- accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>--- </pre>--- --- This function is useful for instances of <a>Vector</a> that cannot--- store pairs. Otherwise, <a>accumulate</a> is probably more convenient:--- --- <pre>--- accumulate_ f as is bs = <a>accumulate</a> f as (<a>zip</a> is bs)--- </pre>-accumulate_ :: (Vector v a, Vector v Int, Vector v b) => (a -> b -> a) -> v a -> v Int -> v b -> v a---- | Same as <a>accum</a> but without bounds checking.-unsafeAccum :: Vector v a => (a -> b -> a) -> v a -> [(Int, b)] -> v a---- | Same as <a>accumulate</a> but without bounds checking.-unsafeAccumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> v a -> v (Int, b) -> v a---- | Same as <a>accumulate_</a> but without bounds checking.-unsafeAccumulate_ :: (Vector v a, Vector v Int, Vector v b) => (a -> b -> a) -> v a -> v Int -> v b -> v a---- | <i>O(n)</i> Reverse a vector-reverse :: Vector v a => v a -> v a---- | <i>O(n)</i> Yield the vector obtained by replacing each element--- <tt>i</tt> of the index vector by <tt>xs<a>!</a>i</tt>. This is--- equivalent to <tt><a>map</a> (xs<a>!</a>) is</tt> but is often much--- more efficient.--- --- <pre>--- backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>--- </pre>-backpermute :: (Vector v a, Vector v Int) => v a -> v Int -> v a---- | Same as <a>backpermute</a> but without bounds checking.-unsafeBackpermute :: (Vector v a, Vector v Int) => v a -> v Int -> v a---- | Apply a destructive operation to a vector. The operation will be--- performed in place if it is safe to do so and will modify a copy of--- the vector otherwise.--- --- <pre>--- modify (\v -> <a>write</a> v 0 'x') (<a>replicate</a> 3 'a') = <'x','a','a'>--- </pre>-modify :: Vector v a => (forall s. Mutable v s a -> ST s ()) -> v a -> v a---- | <i>O(n)</i> Pair each element in a vector with its index-indexed :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a)---- | <i>O(n)</i> Map a function over a vector-map :: (Vector v a, Vector v b) => (a -> b) -> v a -> v b---- | <i>O(n)</i> Apply a function to every element of a vector and its--- index-imap :: (Vector v a, Vector v b) => (Int -> a -> b) -> v a -> v b---- | Map a function over a vector and concatenate the results.-concatMap :: (Vector v a, Vector v b) => (a -> v b) -> v a -> v b---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results-mapM :: (Monad m, Vector v a, Vector v b) => (a -> m b) -> v a -> m (v b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results-mapM_ :: (Monad m, Vector v a) => (a -> m b) -> v a -> m ()---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.-forM :: (Monad m, Vector v a, Vector v b) => v a -> (a -> m b) -> m (v b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.-forM_ :: (Monad m, Vector v a) => v a -> (a -> m b) -> m ()---- | <i>O(min(m,n))</i> Zip two vectors with the given function.-zipWith :: (Vector v a, Vector v b, Vector v c) => (a -> b -> c) -> v a -> v b -> v c---- | Zip three vectors with the given function.-zipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (a -> b -> c -> d) -> v a -> v b -> v c -> v d-zipWith4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e) => (a -> b -> c -> d -> e) -> v a -> v b -> v c -> v d -> v e-zipWith5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f) => (a -> b -> c -> d -> e -> f) -> v a -> v b -> v c -> v d -> v e -> v f-zipWith6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v g) => (a -> b -> c -> d -> e -> f -> g) -> v a -> v b -> v c -> v d -> v e -> v f -> v g---- | <i>O(min(m,n))</i> Zip two vectors with a function that also takes the--- elements' indices.-izipWith :: (Vector v a, Vector v b, Vector v c) => (Int -> a -> b -> c) -> v a -> v b -> v c-izipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (Int -> a -> b -> c -> d) -> v a -> v b -> v c -> v d-izipWith4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e) => (Int -> a -> b -> c -> d -> e) -> v a -> v b -> v c -> v d -> v e-izipWith5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f) => (Int -> a -> b -> c -> d -> e -> f) -> v a -> v b -> v c -> v d -> v e -> v f-izipWith6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> v a -> v b -> v c -> v d -> v e -> v f -> v g---- | <i>O(min(m,n))</i> Zip two vectors-zip :: (Vector v a, Vector v b, Vector v (a, b)) => v a -> v b -> v (a, b)-zip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => v a -> v b -> v c -> v (a, b, c)-zip4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v (a, b, c, d)) => v a -> v b -> v c -> v d -> v (a, b, c, d)-zip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v (a, b, c, d, e)) => v a -> v b -> v c -> v d -> v e -> v (a, b, c, d, e)-zip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v (a, b, c, d, e, f)) => v a -> v b -> v c -> v d -> v e -> v f -> v (a, b, c, d, e, f)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- yield a vector of results-zipWithM :: (Monad m, Vector v a, Vector v b, Vector v c) => (a -> b -> m c) -> v a -> v b -> m (v c)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- ignore the results-zipWithM_ :: (Monad m, Vector v a, Vector v b) => (a -> b -> m c) -> v a -> v b -> m ()---- | <i>O(min(m,n))</i> Unzip a vector of pairs.-unzip :: (Vector v a, Vector v b, Vector v (a, b)) => v (a, b) -> (v a, v b)-unzip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => v (a, b, c) -> (v a, v b, v c)-unzip4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v (a, b, c, d)) => v (a, b, c, d) -> (v a, v b, v c, v d)-unzip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v (a, b, c, d, e)) => v (a, b, c, d, e) -> (v a, v b, v c, v d, v e)-unzip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v (a, b, c, d, e, f)) => v (a, b, c, d, e, f) -> (v a, v b, v c, v d, v e, v f)---- | <i>O(n)</i> Drop elements that do not satisfy the predicate-filter :: Vector v a => (a -> Bool) -> v a -> v a---- | <i>O(n)</i> Drop elements that do not satisfy the predicate which is--- applied to values and their indices-ifilter :: Vector v a => (Int -> a -> Bool) -> v a -> v a---- | <i>O(n)</i> Drop elements that do not satisfy the monadic predicate-filterM :: (Monad m, Vector v a) => (a -> m Bool) -> v a -> m (v a)---- | <i>O(n)</i> Yield the longest prefix of elements satisfying the--- predicate without copying.-takeWhile :: Vector v a => (a -> Bool) -> v a -> v a---- | <i>O(n)</i> Drop the longest prefix of elements that satisfy the--- predicate without copying.-dropWhile :: Vector v a => (a -> Bool) -> v a -> v a---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The relative order of the elements is preserved at the--- cost of a sometimes reduced performance compared to--- <a>unstablePartition</a>.-partition :: Vector v a => (a -> Bool) -> v a -> (v a, v a)---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The order of the elements is not preserved but the--- operation is often faster than <a>partition</a>.-unstablePartition :: Vector v a => (a -> Bool) -> v a -> (v a, v a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- satisfy the predicate and the rest without copying.-span :: Vector v a => (a -> Bool) -> v a -> (v a, v a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- do not satisfy the predicate and the rest without copying.-break :: Vector v a => (a -> Bool) -> v a -> (v a, v a)---- | <i>O(n)</i> Check if the vector contains an element-elem :: (Vector v a, Eq a) => a -> v a -> Bool---- | <i>O(n)</i> Check if the vector does not contain an element (inverse--- of <a>elem</a>)-notElem :: (Vector v a, Eq a) => a -> v a -> Bool---- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate--- or <a>Nothing</a> if no such element exists.-find :: Vector v a => (a -> Bool) -> v a -> Maybe a---- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching--- the predicate or <a>Nothing</a> if no such element exists.-findIndex :: Vector v a => (a -> Bool) -> v a -> Maybe Int---- | <i>O(n)</i> Yield the indices of elements satisfying the predicate in--- ascending order.-findIndices :: (Vector v a, Vector v Int) => (a -> Bool) -> v a -> v Int---- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the--- given element or <a>Nothing</a> if the vector does not contain the--- element. This is a specialised version of <a>findIndex</a>.-elemIndex :: (Vector v a, Eq a) => a -> v a -> Maybe Int---- | <i>O(n)</i> Yield the indices of all occurences of the given element--- in ascending order. This is a specialised version of--- <a>findIndices</a>.-elemIndices :: (Vector v a, Vector v Int, Eq a) => a -> v a -> v Int---- | <i>O(n)</i> Left fold-foldl :: Vector v b => (a -> b -> a) -> a -> v b -> a---- | <i>O(n)</i> Left fold on non-empty vectors-foldl1 :: Vector v a => (a -> a -> a) -> v a -> a---- | <i>O(n)</i> Left fold with strict accumulator-foldl' :: Vector v b => (a -> b -> a) -> a -> v b -> a---- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator-foldl1' :: Vector v a => (a -> a -> a) -> v a -> a---- | <i>O(n)</i> Right fold-foldr :: Vector v a => (a -> b -> b) -> b -> v a -> b---- | <i>O(n)</i> Right fold on non-empty vectors-foldr1 :: Vector v a => (a -> a -> a) -> v a -> a---- | <i>O(n)</i> Right fold with a strict accumulator-foldr' :: Vector v a => (a -> b -> b) -> b -> v a -> b---- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator-foldr1' :: Vector v a => (a -> a -> a) -> v a -> a---- | <i>O(n)</i> Left fold (function applied to each element and its index)-ifoldl :: Vector v b => (a -> Int -> b -> a) -> a -> v b -> a---- | <i>O(n)</i> Left fold with strict accumulator (function applied to--- each element and its index)-ifoldl' :: Vector v b => (a -> Int -> b -> a) -> a -> v b -> a---- | <i>O(n)</i> Right fold (function applied to each element and its--- index)-ifoldr :: Vector v a => (Int -> a -> b -> b) -> b -> v a -> b---- | <i>O(n)</i> Right fold with strict accumulator (function applied to--- each element and its index)-ifoldr' :: Vector v a => (Int -> a -> b -> b) -> b -> v a -> b---- | <i>O(n)</i> Check if all elements satisfy the predicate.-all :: Vector v a => (a -> Bool) -> v a -> Bool---- | <i>O(n)</i> Check if any element satisfies the predicate.-any :: Vector v a => (a -> Bool) -> v a -> Bool---- | <i>O(n)</i> Check if all elements are <a>True</a>-and :: Vector v Bool => v Bool -> Bool---- | <i>O(n)</i> Check if any element is <a>True</a>-or :: Vector v Bool => v Bool -> Bool---- | <i>O(n)</i> Compute the sum of the elements-sum :: (Vector v a, Num a) => v a -> a---- | <i>O(n)</i> Compute the produce of the elements-product :: (Vector v a, Num a) => v a -> a---- | <i>O(n)</i> Yield the maximum element of the vector. The vector may--- not be empty.-maximum :: (Vector v a, Ord a) => v a -> a---- | <i>O(n)</i> Yield the maximum element of the vector according to the--- given comparison function. The vector may not be empty.-maximumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a---- | <i>O(n)</i> Yield the minimum element of the vector. The vector may--- not be empty.-minimum :: (Vector v a, Ord a) => v a -> a---- | <i>O(n)</i> Yield the minimum element of the vector according to the--- given comparison function. The vector may not be empty.-minimumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a---- | <i>O(n)</i> Yield the index of the minimum element of the vector. The--- vector may not be empty.-minIndex :: (Vector v a, Ord a) => v a -> Int---- | <i>O(n)</i> Yield the index of the minimum element of the vector--- according to the given comparison function. The vector may not be--- empty.-minIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector. The--- vector may not be empty.-maxIndex :: (Vector v a, Ord a) => v a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector--- according to the given comparison function. The vector may not be--- empty.-maxIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int---- | <i>O(n)</i> Monadic fold-foldM :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m a---- | <i>O(n)</i> Monadic fold with strict accumulator-foldM' :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors-fold1M :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator-fold1M' :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m a---- | <i>O(n)</i> Monadic fold that discards the result-foldM_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m ()---- | <i>O(n)</i> Monadic fold with strict accumulator that discards the--- result-foldM'_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the--- result-fold1M_ :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m ()---- | <i>O(n)</i> Monad fold over non-empty vectors with strict accumulator--- that discards the result-fold1M'_ :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m ()---- | Evaluate each action and collect the results-sequence :: (Monad m, Vector v a, Vector v (m a)) => v (m a) -> m (v a)---- | Evaluate each action and discard the results-sequence_ :: (Monad m, Vector v (m a)) => v (m a) -> m ()---- | <i>O(n)</i> Prescan--- --- <pre>--- prescanl f z = <a>init</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>prescanl (+) 0 <1,2,3,4> = <0,1,3,6></tt>-prescanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Prescan with strict accumulator-prescanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Scan--- --- <pre>--- postscanl f z = <a>tail</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>postscanl (+) 0 <1,2,3,4> = <1,3,6,10></tt>-postscanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Scan with strict accumulator-postscanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Haskell-style scan--- --- <pre>--- scanl f z <x1,...,xn> = <y1,...,y(n+1)>--- where y1 = z--- yi = f y(i-1) x(i-1)--- </pre>--- --- Example: <tt>scanl (+) 0 <1,2,3,4> = <0,1,3,6,10></tt>-scanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Haskell-style scan with strict accumulator-scanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Scan over a non-empty vector--- --- <pre>--- scanl f <x1,...,xn> = <y1,...,yn>--- where y1 = x1--- yi = f y(i-1) xi--- </pre>-scanl1 :: Vector v a => (a -> a -> a) -> v a -> v a---- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator-scanl1' :: Vector v a => (a -> a -> a) -> v a -> v a---- | <i>O(n)</i> Right-to-left prescan--- --- <pre>--- prescanr f z = <a>reverse</a> . <a>prescanl</a> (flip f) z . <a>reverse</a>--- </pre>-prescanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left prescan with strict accumulator-prescanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left scan-postscanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left scan with strict accumulator-postscanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left Haskell-style scan-scanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator-scanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left scan over a non-empty vector-scanr1 :: Vector v a => (a -> a -> a) -> v a -> v a---- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict--- accumulator-scanr1' :: Vector v a => (a -> a -> a) -> v a -> v a---- | <i>O(n)</i> Convert a vector to a list-toList :: Vector v a => v a -> [a]---- | <i>O(n)</i> Convert a list to a vector-fromList :: Vector v a => [a] -> v a---- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a--- vector--- --- <pre>--- fromListN n xs = <a>fromList</a> (<a>take</a> n xs)--- </pre>-fromListN :: Vector v a => Int -> [a] -> v a---- | <i>O(n)</i> Convert different vector types-convert :: (Vector v a, Vector w a) => v a -> w a---- | <i>O(n)</i> Yield an immutable copy of the mutable vector.-freeze :: (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> m (v a)---- | <i>O(n)</i> Yield a mutable copy of the immutable vector.-thaw :: (PrimMonad m, Vector v a) => v a -> m (Mutable v (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length.-copy :: (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> v a -> m ()---- | <i>O(1)</i> Unsafe convert a mutable vector to an immutable one--- without copying. The mutable vector may not be used after this--- operation.-unsafeFreeze :: (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> m (v a)---- | <i>O(1)</i> Unsafely convert an immutable vector to a mutable one--- without copying. The immutable vector may not be used after this--- operation.-unsafeThaw :: (PrimMonad m, Vector v a) => v a -> m (Mutable v (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length. This is not checked.-unsafeCopy :: (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> v a -> m ()---- | <i>O(1)</i> Convert a vector to a <a>Stream</a>-stream :: Vector v a => v a -> Stream a---- | <i>O(n)</i> Construct a vector from a <a>Stream</a>-unstream :: Vector v a => Stream a -> v a---- | <i>O(1)</i> Convert a vector to a <a>Stream</a>, proceeding from right--- to left-streamR :: Vector v a => v a -> Stream a---- | <i>O(n)</i> Construct a vector from a <a>Stream</a>, proceeding from--- right to left-unstreamR :: Vector v a => Stream a -> v a---- | Construct a vector from a monadic initialiser.-new :: Vector v a => New v a -> v a---- | Convert a vector to an initialiser which, when run, produces a copy of--- the vector.-clone :: Vector v a => v a -> New v a---- | <i>O(n)</i> Check if two vectors are equal. All <a>Vector</a>--- instances are also instances of <a>Eq</a> and it is usually more--- appropriate to use those. This function is primarily intended for--- implementing <a>Eq</a> instances for new vector types.-eq :: (Vector v a, Eq a) => v a -> v a -> Bool---- | <i>O(n)</i> Compare two vectors lexicographically. All <a>Vector</a>--- instances are also instances of <a>Ord</a> and it is usually more--- appropriate to use those. This function is primarily intended for--- implementing <a>Ord</a> instances for new vector types.-cmp :: (Vector v a, Ord a) => v a -> v a -> Ordering---- | Generic definition of <tt>Prelude.showsPrec</tt>-showsPrec :: (Vector v a, Show a) => Int -> v a -> ShowS---- | Generic definition of <tt>Text.Read.readPrec</tt>-readPrec :: (Vector v a, Read a) => ReadPrec (v a)---- | Generic definion of <tt>Data.Data.gfoldl</tt> that views a--- <a>Vector</a> as a list.-gfoldl :: (Vector v a, Data a) => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> v a -> c (v a)-dataCast :: (Vector v a, Data a, Typeable1 v, Typeable1 t) => (forall d. Data d => c (t d)) -> Maybe (c (v a))-mkType :: String -> DataType----- | Safe interface to <a>Data.Vector.Generic</a>-module Data.Vector.Generic.Safe---- | Class of immutable vectors. Every immutable vector is associated with--- its mutable version through the <a>Mutable</a> type family. Methods of--- this class should not be used directly. Instead,--- <a>Data.Vector.Generic</a> and other Data.Vector modules provide safe--- and fusible wrappers.--- --- Minimum complete implementation:--- --- <ul>--- <li><a>basicUnsafeFreeze</a></li>--- <li><a>basicUnsafeThaw</a></li>--- <li><a>basicLength</a></li>--- <li><a>basicUnsafeSlice</a></li>--- <li><a>basicUnsafeIndexM</a></li>--- </ul>-class MVector (Mutable v) a => Vector v a---- | <tt>Mutable v s a</tt> is the mutable version of the pure vector type--- <tt>v a</tt> with the state token <tt>s</tt>---- | <i>O(1)</i> Yield the length of the vector.-length :: Vector v a => v a -> Int---- | <i>O(1)</i> Test whether a vector if empty-null :: Vector v a => v a -> Bool---- | O(1) Indexing-(!) :: Vector v a => v a -> Int -> a---- | O(1) Safe indexing-(!?) :: Vector v a => v a -> Int -> Maybe a---- | <i>O(1)</i> First element-head :: Vector v a => v a -> a---- | <i>O(1)</i> Last element-last :: Vector v a => v a -> a---- | <i>O(1)</i> Indexing in a monad.--- --- The monad allows operations to be strict in the vector when necessary.--- Suppose vector copying is implemented like this:--- --- <pre>--- copy mv v = ... write mv i (v ! i) ...--- </pre>--- --- For lazy vectors, <tt>v ! i</tt> would not be evaluated which means--- that <tt>mv</tt> would unnecessarily retain a reference to <tt>v</tt>--- in each element written.--- --- With <a>indexM</a>, copying can be implemented like this instead:--- --- <pre>--- copy mv v = ... do--- x <- indexM v i--- write mv i x--- </pre>--- --- Here, no references to <tt>v</tt> are retained because indexing (but--- <i>not</i> the elements) is evaluated eagerly.-indexM :: (Vector v a, Monad m) => v a -> Int -> m a---- | <i>O(1)</i> First element of a vector in a monad. See <a>indexM</a>--- for an explanation of why this is useful.-headM :: (Vector v a, Monad m) => v a -> m a---- | <i>O(1)</i> Last element of a vector in a monad. See <a>indexM</a> for--- an explanation of why this is useful.-lastM :: (Vector v a, Monad m) => v a -> m a---- | <i>O(1)</i> Yield a slice of the vector without copying it. The vector--- must contain at least <tt>i+n</tt> elements.-slice :: Vector v a => Int -> Int -> v a -> v a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty.-init :: Vector v a => v a -> v a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty.-tail :: Vector v a => v a -> v a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements without copying. The--- vector may contain less than <tt>n</tt> elements in which case it is--- returned unchanged.-take :: Vector v a => Int -> v a -> v a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector may contain less than <tt>n</tt> elements in which--- case an empty vector is returned.-drop :: Vector v a => Int -> v a -> v a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements paired with the--- remainder without copying.--- --- Note that <tt><a>splitAt</a> n v</tt> is equivalent to--- <tt>(<a>take</a> n v, <a>drop</a> n v)</tt> but slightly more--- efficient.-splitAt :: Vector v a => Int -> v a -> (v a, v a)---- | <i>O(1)</i> Empty vector-empty :: Vector v a => v a---- | <i>O(1)</i> Vector with exactly one element-singleton :: Vector v a => a -> v a---- | <i>O(n)</i> Vector of the given length with the same value in each--- position-replicate :: Vector v a => Int -> a -> v a---- | <i>O(n)</i> Construct a vector of the given length by applying the--- function to each index-generate :: Vector v a => Int -> (Int -> a) -> v a---- | <i>O(n)</i> Apply function n times to value. Zeroth element is--- original value.-iterateN :: Vector v a => Int -> (a -> a) -> a -> v a---- | <i>O(n)</i> Execute the monadic action the given number of times and--- store the results in a vector.-replicateM :: (Monad m, Vector v a) => Int -> m a -> m (v a)---- | <i>O(n)</i> Construct a vector of the given length by applying the--- monadic action to each index-generateM :: (Monad m, Vector v a) => Int -> (Int -> m a) -> m (v a)---- | Execute the monadic action and freeze the resulting vector.--- --- <pre>--- create (do { v <- <a>new</a> 2; <a>write</a> v 0 'a'; <a>write</a> v 1 'b' }) = <<tt>a</tt>,<tt>b</tt>>--- </pre>-create :: Vector v a => (forall s. ST s (Mutable v s a)) -> v a---- | <i>O(n)</i> Construct a vector by repeatedly applying the generator--- function to a seed. The generator function yields <a>Just</a> the next--- element and the new seed or <a>Nothing</a> if there are no more--- elements.--- --- <pre>--- unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10--- = <10,9,8,7,6,5,4,3,2,1>--- </pre>-unfoldr :: Vector v a => (b -> Maybe (a, b)) -> b -> v a---- | <i>O(n)</i> Construct a vector with at most <tt>n</tt> by repeatedly--- applying the generator function to the a seed. The generator function--- yields <a>Just</a> the next element and the new seed or <a>Nothing</a>--- if there are no more elements.--- --- <pre>--- unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>--- </pre>-unfoldrN :: Vector v a => Int -> (b -> Maybe (a, b)) -> b -> v a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+1</tt> etc. This operation is usually more efficient--- than <a>enumFromTo</a>.--- --- <pre>--- enumFromN 5 3 = <5,6,7>--- </pre>-enumFromN :: (Vector v a, Num a) => a -> Int -> v a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. This operations is--- usually more efficient than <a>enumFromThenTo</a>.--- --- <pre>--- enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>--- </pre>-enumFromStepN :: (Vector v a, Num a) => a -> a -> Int -> v a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromN</a> instead.-enumFromTo :: (Vector v a, Enum a) => a -> a -> v a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt> with a--- specific step <tt>z</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: (Vector v a, Enum a) => a -> a -> a -> v a---- | <i>O(n)</i> Prepend an element-cons :: Vector v a => a -> v a -> v a---- | <i>O(n)</i> Append an element-snoc :: Vector v a => v a -> a -> v a---- | <i>O(m+n)</i> Concatenate two vectors-(++) :: Vector v a => v a -> v a -> v a---- | <i>O(n)</i> Concatenate all vectors in the list-concat :: Vector v a => [v a] -> v a---- | <i>O(n)</i> Yield the argument but force it not to retain any extra--- memory, possibly by copying it.--- --- This is especially useful when dealing with slices. For example:--- --- <pre>--- force (slice 0 2 <huge vector>)--- </pre>--- --- Here, the slice retains a reference to the huge vector. Forcing it--- creates a copy of just the elements that belong to the slice and--- allows the huge vector to be garbage collected.-force :: Vector v a => v a -> v a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the--- vector element at position <tt>i</tt> by <tt>a</tt>.--- --- <pre>--- <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>--- </pre>-(//) :: Vector v a => v a -> [(Int, a)] -> v a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the vector of--- index/value pairs, replace the vector element at position <tt>i</tt>--- by <tt>a</tt>.--- --- <pre>--- update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>--- </pre>-update :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a) -> v a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>a</tt> from the value vector, replace--- the element of the initial vector at position <tt>i</tt> by--- <tt>a</tt>.--- --- <pre>--- update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>--- </pre>--- --- This function is useful for instances of <a>Vector</a> that cannot--- store pairs. Otherwise, <a>update</a> is probably more convenient.--- --- <pre>--- update_ xs is ys = <a>update</a> xs (<a>zip</a> is ys)--- </pre>-update_ :: (Vector v a, Vector v Int) => v a -> v Int -> v a -> v a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the--- vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.--- --- <pre>--- accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>--- </pre>-accum :: Vector v a => (a -> b -> a) -> v a -> [(Int, b)] -> v a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the vector of pairs,--- replace the vector element <tt>a</tt> at position <tt>i</tt> by <tt>f--- a b</tt>.--- --- <pre>--- accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>--- </pre>-accumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> v a -> v (Int, b) -> v a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>b</tt> from the the value vector,--- replace the element of the initial vector at position <tt>i</tt> by--- <tt>f a b</tt>.--- --- <pre>--- accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>--- </pre>--- --- This function is useful for instances of <a>Vector</a> that cannot--- store pairs. Otherwise, <a>accumulate</a> is probably more convenient:--- --- <pre>--- accumulate_ f as is bs = <a>accumulate</a> f as (<a>zip</a> is bs)--- </pre>-accumulate_ :: (Vector v a, Vector v Int, Vector v b) => (a -> b -> a) -> v a -> v Int -> v b -> v a---- | <i>O(n)</i> Reverse a vector-reverse :: Vector v a => v a -> v a---- | <i>O(n)</i> Yield the vector obtained by replacing each element--- <tt>i</tt> of the index vector by <tt>xs<a>!</a>i</tt>. This is--- equivalent to <tt><a>map</a> (xs<a>!</a>) is</tt> but is often much--- more efficient.--- --- <pre>--- backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>--- </pre>-backpermute :: (Vector v a, Vector v Int) => v a -> v Int -> v a---- | Apply a destructive operation to a vector. The operation will be--- performed in place if it is safe to do so and will modify a copy of--- the vector otherwise.--- --- <pre>--- modify (\v -> <a>write</a> v 0 'x') (<a>replicate</a> 3 'a') = <'x','a','a'>--- </pre>-modify :: Vector v a => (forall s. Mutable v s a -> ST s ()) -> v a -> v a---- | <i>O(n)</i> Pair each element in a vector with its index-indexed :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a)---- | <i>O(n)</i> Map a function over a vector-map :: (Vector v a, Vector v b) => (a -> b) -> v a -> v b---- | <i>O(n)</i> Apply a function to every element of a vector and its--- index-imap :: (Vector v a, Vector v b) => (Int -> a -> b) -> v a -> v b---- | Map a function over a vector and concatenate the results.-concatMap :: (Vector v a, Vector v b) => (a -> v b) -> v a -> v b---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results-mapM :: (Monad m, Vector v a, Vector v b) => (a -> m b) -> v a -> m (v b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results-mapM_ :: (Monad m, Vector v a) => (a -> m b) -> v a -> m ()---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.-forM :: (Monad m, Vector v a, Vector v b) => v a -> (a -> m b) -> m (v b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.-forM_ :: (Monad m, Vector v a) => v a -> (a -> m b) -> m ()---- | <i>O(min(m,n))</i> Zip two vectors with the given function.-zipWith :: (Vector v a, Vector v b, Vector v c) => (a -> b -> c) -> v a -> v b -> v c---- | Zip three vectors with the given function.-zipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (a -> b -> c -> d) -> v a -> v b -> v c -> v d-zipWith4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e) => (a -> b -> c -> d -> e) -> v a -> v b -> v c -> v d -> v e-zipWith5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f) => (a -> b -> c -> d -> e -> f) -> v a -> v b -> v c -> v d -> v e -> v f-zipWith6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v g) => (a -> b -> c -> d -> e -> f -> g) -> v a -> v b -> v c -> v d -> v e -> v f -> v g---- | <i>O(min(m,n))</i> Zip two vectors with a function that also takes the--- elements' indices.-izipWith :: (Vector v a, Vector v b, Vector v c) => (Int -> a -> b -> c) -> v a -> v b -> v c-izipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (Int -> a -> b -> c -> d) -> v a -> v b -> v c -> v d-izipWith4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e) => (Int -> a -> b -> c -> d -> e) -> v a -> v b -> v c -> v d -> v e-izipWith5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f) => (Int -> a -> b -> c -> d -> e -> f) -> v a -> v b -> v c -> v d -> v e -> v f-izipWith6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> v a -> v b -> v c -> v d -> v e -> v f -> v g---- | <i>O(min(m,n))</i> Zip two vectors-zip :: (Vector v a, Vector v b, Vector v (a, b)) => v a -> v b -> v (a, b)-zip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => v a -> v b -> v c -> v (a, b, c)-zip4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v (a, b, c, d)) => v a -> v b -> v c -> v d -> v (a, b, c, d)-zip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v (a, b, c, d, e)) => v a -> v b -> v c -> v d -> v e -> v (a, b, c, d, e)-zip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v (a, b, c, d, e, f)) => v a -> v b -> v c -> v d -> v e -> v f -> v (a, b, c, d, e, f)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- yield a vector of results-zipWithM :: (Monad m, Vector v a, Vector v b, Vector v c) => (a -> b -> m c) -> v a -> v b -> m (v c)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- ignore the results-zipWithM_ :: (Monad m, Vector v a, Vector v b) => (a -> b -> m c) -> v a -> v b -> m ()---- | <i>O(min(m,n))</i> Unzip a vector of pairs.-unzip :: (Vector v a, Vector v b, Vector v (a, b)) => v (a, b) -> (v a, v b)-unzip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => v (a, b, c) -> (v a, v b, v c)-unzip4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v (a, b, c, d)) => v (a, b, c, d) -> (v a, v b, v c, v d)-unzip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v (a, b, c, d, e)) => v (a, b, c, d, e) -> (v a, v b, v c, v d, v e)-unzip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v (a, b, c, d, e, f)) => v (a, b, c, d, e, f) -> (v a, v b, v c, v d, v e, v f)---- | <i>O(n)</i> Drop elements that do not satisfy the predicate-filter :: Vector v a => (a -> Bool) -> v a -> v a---- | <i>O(n)</i> Drop elements that do not satisfy the predicate which is--- applied to values and their indices-ifilter :: Vector v a => (Int -> a -> Bool) -> v a -> v a---- | <i>O(n)</i> Drop elements that do not satisfy the monadic predicate-filterM :: (Monad m, Vector v a) => (a -> m Bool) -> v a -> m (v a)---- | <i>O(n)</i> Yield the longest prefix of elements satisfying the--- predicate without copying.-takeWhile :: Vector v a => (a -> Bool) -> v a -> v a---- | <i>O(n)</i> Drop the longest prefix of elements that satisfy the--- predicate without copying.-dropWhile :: Vector v a => (a -> Bool) -> v a -> v a---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The relative order of the elements is preserved at the--- cost of a sometimes reduced performance compared to--- <a>unstablePartition</a>.-partition :: Vector v a => (a -> Bool) -> v a -> (v a, v a)---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The order of the elements is not preserved but the--- operation is often faster than <a>partition</a>.-unstablePartition :: Vector v a => (a -> Bool) -> v a -> (v a, v a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- satisfy the predicate and the rest without copying.-span :: Vector v a => (a -> Bool) -> v a -> (v a, v a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- do not satisfy the predicate and the rest without copying.-break :: Vector v a => (a -> Bool) -> v a -> (v a, v a)---- | <i>O(n)</i> Check if the vector contains an element-elem :: (Vector v a, Eq a) => a -> v a -> Bool---- | <i>O(n)</i> Check if the vector does not contain an element (inverse--- of <a>elem</a>)-notElem :: (Vector v a, Eq a) => a -> v a -> Bool---- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate--- or <a>Nothing</a> if no such element exists.-find :: Vector v a => (a -> Bool) -> v a -> Maybe a---- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching--- the predicate or <a>Nothing</a> if no such element exists.-findIndex :: Vector v a => (a -> Bool) -> v a -> Maybe Int---- | <i>O(n)</i> Yield the indices of elements satisfying the predicate in--- ascending order.-findIndices :: (Vector v a, Vector v Int) => (a -> Bool) -> v a -> v Int---- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the--- given element or <a>Nothing</a> if the vector does not contain the--- element. This is a specialised version of <a>findIndex</a>.-elemIndex :: (Vector v a, Eq a) => a -> v a -> Maybe Int---- | <i>O(n)</i> Yield the indices of all occurences of the given element--- in ascending order. This is a specialised version of--- <a>findIndices</a>.-elemIndices :: (Vector v a, Vector v Int, Eq a) => a -> v a -> v Int---- | <i>O(n)</i> Left fold-foldl :: Vector v b => (a -> b -> a) -> a -> v b -> a---- | <i>O(n)</i> Left fold on non-empty vectors-foldl1 :: Vector v a => (a -> a -> a) -> v a -> a---- | <i>O(n)</i> Left fold with strict accumulator-foldl' :: Vector v b => (a -> b -> a) -> a -> v b -> a---- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator-foldl1' :: Vector v a => (a -> a -> a) -> v a -> a---- | <i>O(n)</i> Right fold-foldr :: Vector v a => (a -> b -> b) -> b -> v a -> b---- | <i>O(n)</i> Right fold on non-empty vectors-foldr1 :: Vector v a => (a -> a -> a) -> v a -> a---- | <i>O(n)</i> Right fold with a strict accumulator-foldr' :: Vector v a => (a -> b -> b) -> b -> v a -> b---- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator-foldr1' :: Vector v a => (a -> a -> a) -> v a -> a---- | <i>O(n)</i> Left fold (function applied to each element and its index)-ifoldl :: Vector v b => (a -> Int -> b -> a) -> a -> v b -> a---- | <i>O(n)</i> Left fold with strict accumulator (function applied to--- each element and its index)-ifoldl' :: Vector v b => (a -> Int -> b -> a) -> a -> v b -> a---- | <i>O(n)</i> Right fold (function applied to each element and its--- index)-ifoldr :: Vector v a => (Int -> a -> b -> b) -> b -> v a -> b---- | <i>O(n)</i> Right fold with strict accumulator (function applied to--- each element and its index)-ifoldr' :: Vector v a => (Int -> a -> b -> b) -> b -> v a -> b---- | <i>O(n)</i> Check if all elements satisfy the predicate.-all :: Vector v a => (a -> Bool) -> v a -> Bool---- | <i>O(n)</i> Check if any element satisfies the predicate.-any :: Vector v a => (a -> Bool) -> v a -> Bool---- | <i>O(n)</i> Check if all elements are <a>True</a>-and :: Vector v Bool => v Bool -> Bool---- | <i>O(n)</i> Check if any element is <a>True</a>-or :: Vector v Bool => v Bool -> Bool---- | <i>O(n)</i> Compute the sum of the elements-sum :: (Vector v a, Num a) => v a -> a---- | <i>O(n)</i> Compute the produce of the elements-product :: (Vector v a, Num a) => v a -> a---- | <i>O(n)</i> Yield the maximum element of the vector. The vector may--- not be empty.-maximum :: (Vector v a, Ord a) => v a -> a---- | <i>O(n)</i> Yield the maximum element of the vector according to the--- given comparison function. The vector may not be empty.-maximumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a---- | <i>O(n)</i> Yield the minimum element of the vector. The vector may--- not be empty.-minimum :: (Vector v a, Ord a) => v a -> a---- | <i>O(n)</i> Yield the minimum element of the vector according to the--- given comparison function. The vector may not be empty.-minimumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a---- | <i>O(n)</i> Yield the index of the minimum element of the vector. The--- vector may not be empty.-minIndex :: (Vector v a, Ord a) => v a -> Int---- | <i>O(n)</i> Yield the index of the minimum element of the vector--- according to the given comparison function. The vector may not be--- empty.-minIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector. The--- vector may not be empty.-maxIndex :: (Vector v a, Ord a) => v a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector--- according to the given comparison function. The vector may not be--- empty.-maxIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int---- | <i>O(n)</i> Monadic fold-foldM :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m a---- | <i>O(n)</i> Monadic fold with strict accumulator-foldM' :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors-fold1M :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator-fold1M' :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m a---- | <i>O(n)</i> Monadic fold that discards the result-foldM_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m ()---- | <i>O(n)</i> Monadic fold with strict accumulator that discards the--- result-foldM'_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the--- result-fold1M_ :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m ()---- | <i>O(n)</i> Monad fold over non-empty vectors with strict accumulator--- that discards the result-fold1M'_ :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m ()---- | Evaluate each action and collect the results-sequence :: (Monad m, Vector v a, Vector v (m a)) => v (m a) -> m (v a)---- | Evaluate each action and discard the results-sequence_ :: (Monad m, Vector v (m a)) => v (m a) -> m ()---- | <i>O(n)</i> Prescan--- --- <pre>--- prescanl f z = <a>init</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>prescanl (+) 0 <1,2,3,4> = <0,1,3,6></tt>-prescanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Prescan with strict accumulator-prescanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Scan--- --- <pre>--- postscanl f z = <a>tail</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>postscanl (+) 0 <1,2,3,4> = <1,3,6,10></tt>-postscanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Scan with strict accumulator-postscanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Haskell-style scan--- --- <pre>--- scanl f z <x1,...,xn> = <y1,...,y(n+1)>--- where y1 = z--- yi = f y(i-1) x(i-1)--- </pre>--- --- Example: <tt>scanl (+) 0 <1,2,3,4> = <0,1,3,6,10></tt>-scanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Haskell-style scan with strict accumulator-scanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a---- | <i>O(n)</i> Scan over a non-empty vector--- --- <pre>--- scanl f <x1,...,xn> = <y1,...,yn>--- where y1 = x1--- yi = f y(i-1) xi--- </pre>-scanl1 :: Vector v a => (a -> a -> a) -> v a -> v a---- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator-scanl1' :: Vector v a => (a -> a -> a) -> v a -> v a---- | <i>O(n)</i> Right-to-left prescan--- --- <pre>--- prescanr f z = <a>reverse</a> . <a>prescanl</a> (flip f) z . <a>reverse</a>--- </pre>-prescanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left prescan with strict accumulator-prescanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left scan-postscanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left scan with strict accumulator-postscanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left Haskell-style scan-scanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator-scanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b---- | <i>O(n)</i> Right-to-left scan over a non-empty vector-scanr1 :: Vector v a => (a -> a -> a) -> v a -> v a---- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict--- accumulator-scanr1' :: Vector v a => (a -> a -> a) -> v a -> v a---- | <i>O(n)</i> Convert a vector to a list-toList :: Vector v a => v a -> [a]---- | <i>O(n)</i> Convert a list to a vector-fromList :: Vector v a => [a] -> v a---- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a--- vector--- --- <pre>--- fromListN n xs = <a>fromList</a> (<a>take</a> n xs)--- </pre>-fromListN :: Vector v a => Int -> [a] -> v a---- | <i>O(n)</i> Convert different vector types-convert :: (Vector v a, Vector w a) => v a -> w a---- | <i>O(n)</i> Yield an immutable copy of the mutable vector.-freeze :: (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> m (v a)---- | <i>O(n)</i> Yield a mutable copy of the immutable vector.-thaw :: (PrimMonad m, Vector v a) => v a -> m (Mutable v (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length.-copy :: (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> v a -> m ()---- | <i>O(1)</i> Convert a vector to a <a>Stream</a>-stream :: Vector v a => v a -> Stream a---- | <i>O(n)</i> Construct a vector from a <a>Stream</a>-unstream :: Vector v a => Stream a -> v a---- | <i>O(1)</i> Convert a vector to a <a>Stream</a>, proceeding from right--- to left-streamR :: Vector v a => v a -> Stream a---- | <i>O(n)</i> Construct a vector from a <a>Stream</a>, proceeding from--- right to left-unstreamR :: Vector v a => Stream a -> v a---- | Construct a vector from a monadic initialiser.-new :: Vector v a => New v a -> v a---- | Convert a vector to an initialiser which, when run, produces a copy of--- the vector.-clone :: Vector v a => v a -> New v a---- | <i>O(n)</i> Check if two vectors are equal. All <a>Vector</a>--- instances are also instances of <a>Eq</a> and it is usually more--- appropriate to use those. This function is primarily intended for--- implementing <a>Eq</a> instances for new vector types.-eq :: (Vector v a, Eq a) => v a -> v a -> Bool---- | <i>O(n)</i> Compare two vectors lexicographically. All <a>Vector</a>--- instances are also instances of <a>Ord</a> and it is usually more--- appropriate to use those. This function is primarily intended for--- implementing <a>Ord</a> instances for new vector types.-cmp :: (Vector v a, Ord a) => v a -> v a -> Ordering---- | Generic definion of <tt>Data.Data.gfoldl</tt> that views a--- <a>Vector</a> as a list.-gfoldl :: (Vector v a, Data a) => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> v a -> c (v a)-dataCast :: (Vector v a, Data a, Typeable1 v, Typeable1 t) => (forall d. Data d => c (t d)) -> Maybe (c (v a))-mkType :: String -> DataType----- | Safe interface to <a>Data.Vector.Generic.New</a>-module Data.Vector.Generic.New.Safe-data New v a-New :: (forall s. ST s (Mutable v s a)) -> New v a-create :: (forall s. ST s (Mutable v s a)) -> New v a-run :: New v a -> ST s (Mutable v s a)-apply :: (forall s. Mutable v s a -> Mutable v s a) -> New v a -> New v a-modify :: (forall s. Mutable v s a -> ST s ()) -> New v a -> New v a-modifyWithStream :: (forall s. Mutable v s a -> Stream b -> ST s ()) -> New v a -> Stream b -> New v a-unstream :: Vector v a => Stream a -> New v a-transform :: Vector v a => (forall m. Monad m => MStream m a -> MStream m a) -> New v a -> New v a-unstreamR :: Vector v a => Stream a -> New v a-transformR :: Vector v a => (forall m. Monad m => MStream m a -> MStream m a) -> New v a -> New v a-slice :: Vector v a => Int -> Int -> New v a -> New v a-init :: Vector v a => New v a -> New v a-tail :: Vector v a => New v a -> New v a-take :: Vector v a => Int -> New v a -> New v a-drop :: Vector v a => Int -> New v a -> New v a----- | Mutable primitive vectors.-module Data.Vector.Primitive.Mutable---- | Mutable vectors of primitive types.-data MVector s a-MVector :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !MutableByteArray s -> MVector s a-type IOVector = MVector RealWorld-type STVector s = MVector s---- | Class of types supporting primitive array operations-class Prim a---- | Length of the mutable vector.-length :: Prim a => MVector s a -> Int---- | Check whether the vector is empty-null :: Prim a => MVector s a -> Bool---- | Yield a part of the mutable vector without copying it.-slice :: Prim a => Int -> Int -> MVector s a -> MVector s a-init :: Prim a => MVector s a -> MVector s a-tail :: Prim a => MVector s a -> MVector s a-take :: Prim a => Int -> MVector s a -> MVector s a-drop :: Prim a => Int -> MVector s a -> MVector s a-splitAt :: Prim a => Int -> MVector s a -> (MVector s a, MVector s a)---- | Yield a part of the mutable vector without copying it. No bounds--- checks are performed.-unsafeSlice :: Prim a => Int -> Int -> MVector s a -> MVector s a-unsafeInit :: Prim a => MVector s a -> MVector s a-unsafeTail :: Prim a => MVector s a -> MVector s a-unsafeTake :: Prim a => Int -> MVector s a -> MVector s a-unsafeDrop :: Prim a => Int -> MVector s a -> MVector s a-overlaps :: Prim a => MVector s a -> MVector s a -> Bool---- | Create a mutable vector of the given length.-new :: (PrimMonad m, Prim a) => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length. The length is not--- checked.-unsafeNew :: (PrimMonad m, Prim a) => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with an initial value.-replicate :: (PrimMonad m, Prim a) => Int -> a -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with values produced by repeatedly executing the--- monadic action.-replicateM :: (PrimMonad m, Prim a) => Int -> m a -> m (MVector (PrimState m) a)---- | Create a copy of a mutable vector.-clone :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive.-grow :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive but this is not checked.-unsafeGrow :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Reset all elements of the vector to some undefined value, clearing all--- references to external objects. This is usually a noop for unboxed--- vectors.-clear :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> m ()---- | Yield the element at the given position.-read :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position.-write :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions.-swap :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> Int -> m ()---- | Yield the element at the given position. No bounds checks are--- performed.-unsafeRead :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position. No bounds checks are--- performed.-unsafeWrite :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions. No bounds checks are--- performed.-unsafeSwap :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> Int -> m ()---- | Set all elements of the vector to the given value.-set :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap.-copy :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length.--- --- If the vectors do not overlap, then this is equivalent to <a>copy</a>.--- Otherwise, the copying is performed as if the source vector were--- copied to a temporary vector and then the temporary vector was copied--- to the target vector.-move :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap. This is not checked.-unsafeCopy :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length, but this is not checked.--- --- If the vectors do not overlap, then this is equivalent to--- <a>unsafeCopy</a>. Otherwise, the copying is performed as if the--- source vector were copied to a temporary vector and then the temporary--- vector was copied to the target vector.-unsafeMove :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()-instance Typeable2 MVector-instance Prim a => MVector MVector a----- | Unboxed vectors of primitive types. The use of this module is not--- recommended except in very special cases. Adaptive unboxed vectors--- defined in <a>Data.Vector.Unboxed</a> are significantly more flexible--- at no performance cost.-module Data.Vector.Primitive---- | Unboxed vectors of primitive types-data Vector a---- | Mutable vectors of primitive types.-data MVector s a-MVector :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !MutableByteArray s -> MVector s a---- | Class of types supporting primitive array operations-class Prim a---- | <i>O(1)</i> Yield the length of the vector.-length :: Prim a => Vector a -> Int---- | <i>O(1)</i> Test whether a vector if empty-null :: Prim a => Vector a -> Bool---- | O(1) Indexing-(!) :: Prim a => Vector a -> Int -> a---- | O(1) Safe indexing-(!?) :: Prim a => Vector a -> Int -> Maybe a---- | <i>O(1)</i> First element-head :: Prim a => Vector a -> a---- | <i>O(1)</i> Last element-last :: Prim a => Vector a -> a---- | <i>O(1)</i> Unsafe indexing without bounds checking-unsafeIndex :: Prim a => Vector a -> Int -> a---- | <i>O(1)</i> First element without checking if the vector is empty-unsafeHead :: Prim a => Vector a -> a---- | <i>O(1)</i> Last element without checking if the vector is empty-unsafeLast :: Prim a => Vector a -> a---- | <i>O(1)</i> Indexing in a monad.--- --- The monad allows operations to be strict in the vector when necessary.--- Suppose vector copying is implemented like this:--- --- <pre>--- copy mv v = ... write mv i (v ! i) ...--- </pre>--- --- For lazy vectors, <tt>v ! i</tt> would not be evaluated which means--- that <tt>mv</tt> would unnecessarily retain a reference to <tt>v</tt>--- in each element written.--- --- With <a>indexM</a>, copying can be implemented like this instead:--- --- <pre>--- copy mv v = ... do--- x <- indexM v i--- write mv i x--- </pre>--- --- Here, no references to <tt>v</tt> are retained because indexing (but--- <i>not</i> the elements) is evaluated eagerly.-indexM :: (Prim a, Monad m) => Vector a -> Int -> m a---- | <i>O(1)</i> First element of a vector in a monad. See <a>indexM</a>--- for an explanation of why this is useful.-headM :: (Prim a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Last element of a vector in a monad. See <a>indexM</a> for--- an explanation of why this is useful.-lastM :: (Prim a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Indexing in a monad without bounds checks. See--- <a>indexM</a> for an explanation of why this is useful.-unsafeIndexM :: (Prim a, Monad m) => Vector a -> Int -> m a---- | <i>O(1)</i> First element in a monad without checking for empty--- vectors. See <a>indexM</a> for an explanation of why this is useful.-unsafeHeadM :: (Prim a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Last element in a monad without checking for empty--- vectors. See <a>indexM</a> for an explanation of why this is useful.-unsafeLastM :: (Prim a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Yield a slice of the vector without copying it. The vector--- must contain at least <tt>i+n</tt> elements.-slice :: Prim a => Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty.-init :: Prim a => Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty.-tail :: Prim a => Vector a -> Vector a---- | <i>O(1)</i> Yield at the first <tt>n</tt> elements without copying.--- The vector may contain less than <tt>n</tt> elements in which case it--- is returned unchanged.-take :: Prim a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector may contain less than <tt>n</tt> elements in which--- case an empty vector is returned.-drop :: Prim a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements paired with the--- remainder without copying.--- --- Note that <tt><a>splitAt</a> n v</tt> is equivalent to--- <tt>(<a>take</a> n v, <a>drop</a> n v)</tt> but slightly more--- efficient.-splitAt :: Prim a => Int -> Vector a -> (Vector a, Vector a)---- | <i>O(1)</i> Yield a slice of the vector without copying. The vector--- must contain at least <tt>i+n</tt> elements but this is not checked.-unsafeSlice :: Prim a => Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty but this is not checked.-unsafeInit :: Prim a => Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty but this is not checked.-unsafeTail :: Prim a => Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements without copying. The--- vector must contain at least <tt>n</tt> elements but this is not--- checked.-unsafeTake :: Prim a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector must contain at least <tt>n</tt> elements but this--- is not checked.-unsafeDrop :: Prim a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Empty vector-empty :: Prim a => Vector a---- | <i>O(1)</i> Vector with exactly one element-singleton :: Prim a => a -> Vector a---- | <i>O(n)</i> Vector of the given length with the same value in each--- position-replicate :: Prim a => Int -> a -> Vector a---- | <i>O(n)</i> Construct a vector of the given length by applying the--- function to each index-generate :: Prim a => Int -> (Int -> a) -> Vector a---- | <i>O(n)</i> Apply function n times to value. Zeroth element is--- original value.-iterateN :: Prim a => Int -> (a -> a) -> a -> Vector a---- | <i>O(n)</i> Execute the monadic action the given number of times and--- store the results in a vector.-replicateM :: (Monad m, Prim a) => Int -> m a -> m (Vector a)---- | <i>O(n)</i> Construct a vector of the given length by applying the--- monadic action to each index-generateM :: (Monad m, Prim a) => Int -> (Int -> m a) -> m (Vector a)---- | Execute the monadic action and freeze the resulting vector.--- --- <pre>--- create (do { v <- new 2; write v 0 'a'; write v 1 'b' }) = <<tt>a</tt>,<tt>b</tt>>--- </pre>-create :: Prim a => (forall s. ST s (MVector s a)) -> Vector a---- | <i>O(n)</i> Construct a vector by repeatedly applying the generator--- function to a seed. The generator function yields <a>Just</a> the next--- element and the new seed or <a>Nothing</a> if there are no more--- elements.--- --- <pre>--- unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10--- = <10,9,8,7,6,5,4,3,2,1>--- </pre>-unfoldr :: Prim a => (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with at most <tt>n</tt> by repeatedly--- applying the generator function to the a seed. The generator function--- yields <a>Just</a> the next element and the new seed or <a>Nothing</a>--- if there are no more elements.--- --- <pre>--- unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>--- </pre>-unfoldrN :: Prim a => Int -> (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements by repeatedly--- applying the generator function to the already constructed part of the--- vector.--- --- <pre>--- constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>--- </pre>-constructN :: Prim a => Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements from right to--- left by repeatedly applying the generator function to the already--- constructed part of the vector.--- --- <pre>--- constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>--- </pre>-constructrN :: Prim a => Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+1</tt> etc. This operation is usually more efficient--- than <a>enumFromTo</a>.--- --- <pre>--- enumFromN 5 3 = <5,6,7>--- </pre>-enumFromN :: (Prim a, Num a) => a -> Int -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. This operations is--- usually more efficient than <a>enumFromThenTo</a>.--- --- <pre>--- enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>--- </pre>-enumFromStepN :: (Prim a, Num a) => a -> a -> Int -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromN</a> instead.-enumFromTo :: (Prim a, Enum a) => a -> a -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt> with a--- specific step <tt>z</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: (Prim a, Enum a) => a -> a -> a -> Vector a---- | <i>O(n)</i> Prepend an element-cons :: Prim a => a -> Vector a -> Vector a---- | <i>O(n)</i> Append an element-snoc :: Prim a => Vector a -> a -> Vector a---- | <i>O(m+n)</i> Concatenate two vectors-(++) :: Prim a => Vector a -> Vector a -> Vector a---- | <i>O(n)</i> Concatenate all vectors in the list-concat :: Prim a => [Vector a] -> Vector a---- | <i>O(n)</i> Yield the argument but force it not to retain any extra--- memory, possibly by copying it.--- --- This is especially useful when dealing with slices. For example:--- --- <pre>--- force (slice 0 2 <huge vector>)--- </pre>--- --- Here, the slice retains a reference to the huge vector. Forcing it--- creates a copy of just the elements that belong to the slice and--- allows the huge vector to be garbage collected.-force :: Prim a => Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the--- vector element at position <tt>i</tt> by <tt>a</tt>.--- --- <pre>--- <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>--- </pre>-(//) :: Prim a => Vector a -> [(Int, a)] -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>a</tt> from the value vector, replace--- the element of the initial vector at position <tt>i</tt> by--- <tt>a</tt>.--- --- <pre>--- update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>--- </pre>-update_ :: Prim a => Vector a -> Vector Int -> Vector a -> Vector a---- | Same as (<a>//</a>) but without bounds checking.-unsafeUpd :: Prim a => Vector a -> [(Int, a)] -> Vector a---- | Same as <a>update_</a> but without bounds checking.-unsafeUpdate_ :: Prim a => Vector a -> Vector Int -> Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the--- vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.--- --- <pre>--- accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>--- </pre>-accum :: Prim a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>b</tt> from the the value vector,--- replace the element of the initial vector at position <tt>i</tt> by--- <tt>f a b</tt>.--- --- <pre>--- accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>--- </pre>-accumulate_ :: (Prim a, Prim b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | Same as <a>accum</a> but without bounds checking.-unsafeAccum :: Prim a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | Same as <a>accumulate_</a> but without bounds checking.-unsafeAccumulate_ :: (Prim a, Prim b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | <i>O(n)</i> Reverse a vector-reverse :: Prim a => Vector a -> Vector a---- | <i>O(n)</i> Yield the vector obtained by replacing each element--- <tt>i</tt> of the index vector by <tt>xs<a>!</a>i</tt>. This is--- equivalent to <tt><a>map</a> (xs<a>!</a>) is</tt> but is often much--- more efficient.--- --- <pre>--- backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>--- </pre>-backpermute :: Prim a => Vector a -> Vector Int -> Vector a---- | Same as <a>backpermute</a> but without bounds checking.-unsafeBackpermute :: Prim a => Vector a -> Vector Int -> Vector a---- | Apply a destructive operation to a vector. The operation will be--- performed in place if it is safe to do so and will modify a copy of--- the vector otherwise.--- --- <pre>--- modify (\v -> write v 0 'x') (<a>replicate</a> 3 'a') = <'x','a','a'>--- </pre>-modify :: Prim a => (forall s. MVector s a -> ST s ()) -> Vector a -> Vector a---- | <i>O(n)</i> Map a function over a vector-map :: (Prim a, Prim b) => (a -> b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply a function to every element of a vector and its--- index-imap :: (Prim a, Prim b) => (Int -> a -> b) -> Vector a -> Vector b---- | Map a function over a vector and concatenate the results.-concatMap :: (Prim a, Prim b) => (a -> Vector b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results-mapM :: (Monad m, Prim a, Prim b) => (a -> m b) -> Vector a -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results-mapM_ :: (Monad m, Prim a) => (a -> m b) -> Vector a -> m ()---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.-forM :: (Monad m, Prim a, Prim b) => Vector a -> (a -> m b) -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.-forM_ :: (Monad m, Prim a) => Vector a -> (a -> m b) -> m ()---- | <i>O(min(m,n))</i> Zip two vectors with the given function.-zipWith :: (Prim a, Prim b, Prim c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors with the given function.-zipWith3 :: (Prim a, Prim b, Prim c, Prim d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-zipWith4 :: (Prim a, Prim b, Prim c, Prim d, Prim e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-zipWith5 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-zipWith6 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f, Prim g) => (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(min(m,n))</i> Zip two vectors with a function that also takes the--- elements' indices.-izipWith :: (Prim a, Prim b, Prim c) => (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors and their indices with the given function.-izipWith3 :: (Prim a, Prim b, Prim c, Prim d) => (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-izipWith4 :: (Prim a, Prim b, Prim c, Prim d, Prim e) => (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-izipWith5 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-izipWith6 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f, Prim g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- yield a vector of results-zipWithM :: (Monad m, Prim a, Prim b, Prim c) => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- ignore the results-zipWithM_ :: (Monad m, Prim a, Prim b) => (a -> b -> m c) -> Vector a -> Vector b -> m ()---- | <i>O(n)</i> Drop elements that do not satisfy the predicate-filter :: Prim a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the predicate which is--- applied to values and their indices-ifilter :: Prim a => (Int -> a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the monadic predicate-filterM :: (Monad m, Prim a) => (a -> m Bool) -> Vector a -> m (Vector a)---- | <i>O(n)</i> Yield the longest prefix of elements satisfying the--- predicate without copying.-takeWhile :: Prim a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop the longest prefix of elements that satisfy the--- predicate without copying.-dropWhile :: Prim a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The relative order of the elements is preserved at the--- cost of a sometimes reduced performance compared to--- <a>unstablePartition</a>.-partition :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The order of the elements is not preserved but the--- operation is often faster than <a>partition</a>.-unstablePartition :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- satisfy the predicate and the rest without copying.-span :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- do not satisfy the predicate and the rest without copying.-break :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Check if the vector contains an element-elem :: (Prim a, Eq a) => a -> Vector a -> Bool---- | <i>O(n)</i> Check if the vector does not contain an element (inverse--- of <a>elem</a>)-notElem :: (Prim a, Eq a) => a -> Vector a -> Bool---- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate--- or <a>Nothing</a> if no such element exists.-find :: Prim a => (a -> Bool) -> Vector a -> Maybe a---- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching--- the predicate or <a>Nothing</a> if no such element exists.-findIndex :: Prim a => (a -> Bool) -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of elements satisfying the predicate in--- ascending order.-findIndices :: Prim a => (a -> Bool) -> Vector a -> Vector Int---- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the--- given element or <a>Nothing</a> if the vector does not contain the--- element. This is a specialised version of <a>findIndex</a>.-elemIndex :: (Prim a, Eq a) => a -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of all occurences of the given element--- in ascending order. This is a specialised version of--- <a>findIndices</a>.-elemIndices :: (Prim a, Eq a) => a -> Vector a -> Vector Int---- | <i>O(n)</i> Left fold-foldl :: Prim b => (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors-foldl1 :: Prim a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold with strict accumulator-foldl' :: Prim b => (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator-foldl1' :: Prim a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold-foldr :: Prim a => (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors-foldr1 :: Prim a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold with a strict accumulator-foldr' :: Prim a => (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator-foldr1' :: Prim a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold (function applied to each element and its index)-ifoldl :: Prim b => (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold with strict accumulator (function applied to--- each element and its index)-ifoldl' :: Prim b => (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Right fold (function applied to each element and its--- index)-ifoldr :: Prim a => (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold with strict accumulator (function applied to--- each element and its index)-ifoldr' :: Prim a => (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Check if all elements satisfy the predicate.-all :: Prim a => (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if any element satisfies the predicate.-any :: Prim a => (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Compute the sum of the elements-sum :: (Prim a, Num a) => Vector a -> a---- | <i>O(n)</i> Compute the produce of the elements-product :: (Prim a, Num a) => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector. The vector may--- not be empty.-maximum :: (Prim a, Ord a) => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector according to the--- given comparison function. The vector may not be empty.-maximumBy :: Prim a => (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector. The vector may--- not be empty.-minimum :: (Prim a, Ord a) => Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector according to the--- given comparison function. The vector may not be empty.-minimumBy :: Prim a => (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the index of the minimum element of the vector. The--- vector may not be empty.-minIndex :: (Prim a, Ord a) => Vector a -> Int---- | <i>O(n)</i> Yield the index of the minimum element of the vector--- according to the given comparison function. The vector may not be--- empty.-minIndexBy :: Prim a => (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector. The--- vector may not be empty.-maxIndex :: (Prim a, Ord a) => Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector--- according to the given comparison function. The vector may not be--- empty.-maxIndexBy :: Prim a => (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Monadic fold-foldM :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold with strict accumulator-foldM' :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors-fold1M :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator-fold1M' :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold that discards the result-foldM_ :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold with strict accumulator that discards the--- result-foldM'_ :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the--- result-fold1M_ :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator that discards the result-fold1M'_ :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Prescan--- --- <pre>--- prescanl f z = <a>init</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>prescanl (+) 0 <1,2,3,4> = <0,1,3,6></tt>-prescanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Prescan with strict accumulator-prescanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan--- --- <pre>--- postscanl f z = <a>tail</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>postscanl (+) 0 <1,2,3,4> = <1,3,6,10></tt>-postscanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan with strict accumulator-postscanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan--- --- <pre>--- scanl f z <x1,...,xn> = <y1,...,y(n+1)>--- where y1 = z--- yi = f y(i-1) x(i-1)--- </pre>--- --- Example: <tt>scanl (+) 0 <1,2,3,4> = <0,1,3,6,10></tt>-scanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan with strict accumulator-scanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector--- --- <pre>--- scanl f <x1,...,xn> = <y1,...,yn>--- where y1 = x1--- yi = f y(i-1) xi--- </pre>-scanl1 :: Prim a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator-scanl1' :: Prim a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left prescan--- --- <pre>--- prescanr f z = <a>reverse</a> . <a>prescanl</a> (flip f) z . <a>reverse</a>--- </pre>-prescanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left prescan with strict accumulator-prescanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan-postscanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan with strict accumulator-postscanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan-scanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator-scanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan over a non-empty vector-scanr1 :: Prim a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict--- accumulator-scanr1' :: Prim a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Convert a vector to a list-toList :: Prim a => Vector a -> [a]---- | <i>O(n)</i> Convert a list to a vector-fromList :: Prim a => [a] -> Vector a---- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a--- vector--- --- <pre>--- fromListN n xs = <a>fromList</a> (<a>take</a> n xs)--- </pre>-fromListN :: Prim a => Int -> [a] -> Vector a---- | <i>O(n)</i> Convert different vector types-convert :: (Vector v a, Vector w a) => v a -> w a---- | <i>O(n)</i> Yield an immutable copy of the mutable vector.-freeze :: (Prim a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)---- | <i>O(n)</i> Yield a mutable copy of the immutable vector.-thaw :: (Prim a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length.-copy :: (Prim a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()---- | <i>O(1)</i> Unsafe convert a mutable vector to an immutable one--- without copying. The mutable vector may not be used after this--- operation.-unsafeFreeze :: (Prim a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)---- | <i>O(1)</i> Unsafely convert an immutable vector to a mutable one--- without copying. The immutable vector may not be used after this--- operation.-unsafeThaw :: (Prim a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length. This is not checked.-unsafeCopy :: (Prim a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()-instance Typeable1 Vector-instance Prim a => Monoid (Vector a)-instance (Prim a, Ord a) => Ord (Vector a)-instance (Prim a, Eq a) => Eq (Vector a)-instance Prim a => Vector Vector a-instance (Data a, Prim a) => Data (Vector a)-instance (Read a, Prim a) => Read (Vector a)-instance (Show a, Prim a) => Show (Vector a)----- | Safe interface to <a>Data.Vector.Primitive</a>-module Data.Vector.Primitive.Safe---- | Unboxed vectors of primitive types-data Vector a---- | Mutable vectors of primitive types.-data MVector s a---- | Class of types supporting primitive array operations-class Prim a---- | <i>O(1)</i> Yield the length of the vector.-length :: Prim a => Vector a -> Int---- | <i>O(1)</i> Test whether a vector if empty-null :: Prim a => Vector a -> Bool---- | O(1) Indexing-(!) :: Prim a => Vector a -> Int -> a---- | O(1) Safe indexing-(!?) :: Prim a => Vector a -> Int -> Maybe a---- | <i>O(1)</i> First element-head :: Prim a => Vector a -> a---- | <i>O(1)</i> Last element-last :: Prim a => Vector a -> a---- | <i>O(1)</i> Indexing in a monad.--- --- The monad allows operations to be strict in the vector when necessary.--- Suppose vector copying is implemented like this:--- --- <pre>--- copy mv v = ... write mv i (v ! i) ...--- </pre>--- --- For lazy vectors, <tt>v ! i</tt> would not be evaluated which means--- that <tt>mv</tt> would unnecessarily retain a reference to <tt>v</tt>--- in each element written.--- --- With <a>indexM</a>, copying can be implemented like this instead:--- --- <pre>--- copy mv v = ... do--- x <- indexM v i--- write mv i x--- </pre>--- --- Here, no references to <tt>v</tt> are retained because indexing (but--- <i>not</i> the elements) is evaluated eagerly.-indexM :: (Prim a, Monad m) => Vector a -> Int -> m a---- | <i>O(1)</i> First element of a vector in a monad. See <a>indexM</a>--- for an explanation of why this is useful.-headM :: (Prim a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Last element of a vector in a monad. See <a>indexM</a> for--- an explanation of why this is useful.-lastM :: (Prim a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Yield a slice of the vector without copying it. The vector--- must contain at least <tt>i+n</tt> elements.-slice :: Prim a => Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty.-init :: Prim a => Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty.-tail :: Prim a => Vector a -> Vector a---- | <i>O(1)</i> Yield at the first <tt>n</tt> elements without copying.--- The vector may contain less than <tt>n</tt> elements in which case it--- is returned unchanged.-take :: Prim a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector may contain less than <tt>n</tt> elements in which--- case an empty vector is returned.-drop :: Prim a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements paired with the--- remainder without copying.--- --- Note that <tt><a>splitAt</a> n v</tt> is equivalent to--- <tt>(<a>take</a> n v, <a>drop</a> n v)</tt> but slightly more--- efficient.-splitAt :: Prim a => Int -> Vector a -> (Vector a, Vector a)---- | <i>O(1)</i> Empty vector-empty :: Prim a => Vector a---- | <i>O(1)</i> Vector with exactly one element-singleton :: Prim a => a -> Vector a---- | <i>O(n)</i> Vector of the given length with the same value in each--- position-replicate :: Prim a => Int -> a -> Vector a---- | <i>O(n)</i> Construct a vector of the given length by applying the--- function to each index-generate :: Prim a => Int -> (Int -> a) -> Vector a---- | <i>O(n)</i> Apply function n times to value. Zeroth element is--- original value.-iterateN :: Prim a => Int -> (a -> a) -> a -> Vector a---- | <i>O(n)</i> Execute the monadic action the given number of times and--- store the results in a vector.-replicateM :: (Monad m, Prim a) => Int -> m a -> m (Vector a)---- | <i>O(n)</i> Construct a vector of the given length by applying the--- monadic action to each index-generateM :: (Monad m, Prim a) => Int -> (Int -> m a) -> m (Vector a)---- | Execute the monadic action and freeze the resulting vector.--- --- <pre>--- create (do { v <- new 2; write v 0 'a'; write v 1 'b' }) = <<tt>a</tt>,<tt>b</tt>>--- </pre>-create :: Prim a => (forall s. ST s (MVector s a)) -> Vector a---- | <i>O(n)</i> Construct a vector by repeatedly applying the generator--- function to a seed. The generator function yields <a>Just</a> the next--- element and the new seed or <a>Nothing</a> if there are no more--- elements.--- --- <pre>--- unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10--- = <10,9,8,7,6,5,4,3,2,1>--- </pre>-unfoldr :: Prim a => (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with at most <tt>n</tt> by repeatedly--- applying the generator function to the a seed. The generator function--- yields <a>Just</a> the next element and the new seed or <a>Nothing</a>--- if there are no more elements.--- --- <pre>--- unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>--- </pre>-unfoldrN :: Prim a => Int -> (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements by repeatedly--- applying the generator function to the already constructed part of the--- vector.--- --- <pre>--- constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>--- </pre>-constructN :: Prim a => Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements from right to--- left by repeatedly applying the generator function to the already--- constructed part of the vector.--- --- <pre>--- constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>--- </pre>-constructrN :: Prim a => Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+1</tt> etc. This operation is usually more efficient--- than <a>enumFromTo</a>.--- --- <pre>--- enumFromN 5 3 = <5,6,7>--- </pre>-enumFromN :: (Prim a, Num a) => a -> Int -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. This operations is--- usually more efficient than <a>enumFromThenTo</a>.--- --- <pre>--- enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>--- </pre>-enumFromStepN :: (Prim a, Num a) => a -> a -> Int -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromN</a> instead.-enumFromTo :: (Prim a, Enum a) => a -> a -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt> with a--- specific step <tt>z</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: (Prim a, Enum a) => a -> a -> a -> Vector a---- | <i>O(n)</i> Prepend an element-cons :: Prim a => a -> Vector a -> Vector a---- | <i>O(n)</i> Append an element-snoc :: Prim a => Vector a -> a -> Vector a---- | <i>O(m+n)</i> Concatenate two vectors-(++) :: Prim a => Vector a -> Vector a -> Vector a---- | <i>O(n)</i> Concatenate all vectors in the list-concat :: Prim a => [Vector a] -> Vector a---- | <i>O(n)</i> Yield the argument but force it not to retain any extra--- memory, possibly by copying it.--- --- This is especially useful when dealing with slices. For example:--- --- <pre>--- force (slice 0 2 <huge vector>)--- </pre>--- --- Here, the slice retains a reference to the huge vector. Forcing it--- creates a copy of just the elements that belong to the slice and--- allows the huge vector to be garbage collected.-force :: Prim a => Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the--- vector element at position <tt>i</tt> by <tt>a</tt>.--- --- <pre>--- <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>--- </pre>-(//) :: Prim a => Vector a -> [(Int, a)] -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>a</tt> from the value vector, replace--- the element of the initial vector at position <tt>i</tt> by--- <tt>a</tt>.--- --- <pre>--- update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>--- </pre>-update_ :: Prim a => Vector a -> Vector Int -> Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the--- vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.--- --- <pre>--- accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>--- </pre>-accum :: Prim a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>b</tt> from the the value vector,--- replace the element of the initial vector at position <tt>i</tt> by--- <tt>f a b</tt>.--- --- <pre>--- accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>--- </pre>-accumulate_ :: (Prim a, Prim b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | <i>O(n)</i> Reverse a vector-reverse :: Prim a => Vector a -> Vector a---- | <i>O(n)</i> Yield the vector obtained by replacing each element--- <tt>i</tt> of the index vector by <tt>xs<a>!</a>i</tt>. This is--- equivalent to <tt><a>map</a> (xs<a>!</a>) is</tt> but is often much--- more efficient.--- --- <pre>--- backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>--- </pre>-backpermute :: Prim a => Vector a -> Vector Int -> Vector a---- | Apply a destructive operation to a vector. The operation will be--- performed in place if it is safe to do so and will modify a copy of--- the vector otherwise.--- --- <pre>--- modify (\v -> write v 0 'x') (<a>replicate</a> 3 'a') = <'x','a','a'>--- </pre>-modify :: Prim a => (forall s. MVector s a -> ST s ()) -> Vector a -> Vector a---- | <i>O(n)</i> Map a function over a vector-map :: (Prim a, Prim b) => (a -> b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply a function to every element of a vector and its--- index-imap :: (Prim a, Prim b) => (Int -> a -> b) -> Vector a -> Vector b---- | Map a function over a vector and concatenate the results.-concatMap :: (Prim a, Prim b) => (a -> Vector b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results-mapM :: (Monad m, Prim a, Prim b) => (a -> m b) -> Vector a -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results-mapM_ :: (Monad m, Prim a) => (a -> m b) -> Vector a -> m ()---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.-forM :: (Monad m, Prim a, Prim b) => Vector a -> (a -> m b) -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.-forM_ :: (Monad m, Prim a) => Vector a -> (a -> m b) -> m ()---- | <i>O(min(m,n))</i> Zip two vectors with the given function.-zipWith :: (Prim a, Prim b, Prim c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors with the given function.-zipWith3 :: (Prim a, Prim b, Prim c, Prim d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-zipWith4 :: (Prim a, Prim b, Prim c, Prim d, Prim e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-zipWith5 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-zipWith6 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f, Prim g) => (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(min(m,n))</i> Zip two vectors with a function that also takes the--- elements' indices.-izipWith :: (Prim a, Prim b, Prim c) => (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors and their indices with the given function.-izipWith3 :: (Prim a, Prim b, Prim c, Prim d) => (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-izipWith4 :: (Prim a, Prim b, Prim c, Prim d, Prim e) => (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-izipWith5 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-izipWith6 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f, Prim g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- yield a vector of results-zipWithM :: (Monad m, Prim a, Prim b, Prim c) => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- ignore the results-zipWithM_ :: (Monad m, Prim a, Prim b) => (a -> b -> m c) -> Vector a -> Vector b -> m ()---- | <i>O(n)</i> Drop elements that do not satisfy the predicate-filter :: Prim a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the predicate which is--- applied to values and their indices-ifilter :: Prim a => (Int -> a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the monadic predicate-filterM :: (Monad m, Prim a) => (a -> m Bool) -> Vector a -> m (Vector a)---- | <i>O(n)</i> Yield the longest prefix of elements satisfying the--- predicate without copying.-takeWhile :: Prim a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop the longest prefix of elements that satisfy the--- predicate without copying.-dropWhile :: Prim a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The relative order of the elements is preserved at the--- cost of a sometimes reduced performance compared to--- <a>unstablePartition</a>.-partition :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The order of the elements is not preserved but the--- operation is often faster than <a>partition</a>.-unstablePartition :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- satisfy the predicate and the rest without copying.-span :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- do not satisfy the predicate and the rest without copying.-break :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Check if the vector contains an element-elem :: (Prim a, Eq a) => a -> Vector a -> Bool---- | <i>O(n)</i> Check if the vector does not contain an element (inverse--- of <a>elem</a>)-notElem :: (Prim a, Eq a) => a -> Vector a -> Bool---- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate--- or <a>Nothing</a> if no such element exists.-find :: Prim a => (a -> Bool) -> Vector a -> Maybe a---- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching--- the predicate or <a>Nothing</a> if no such element exists.-findIndex :: Prim a => (a -> Bool) -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of elements satisfying the predicate in--- ascending order.-findIndices :: Prim a => (a -> Bool) -> Vector a -> Vector Int---- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the--- given element or <a>Nothing</a> if the vector does not contain the--- element. This is a specialised version of <a>findIndex</a>.-elemIndex :: (Prim a, Eq a) => a -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of all occurences of the given element--- in ascending order. This is a specialised version of--- <a>findIndices</a>.-elemIndices :: (Prim a, Eq a) => a -> Vector a -> Vector Int---- | <i>O(n)</i> Left fold-foldl :: Prim b => (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors-foldl1 :: Prim a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold with strict accumulator-foldl' :: Prim b => (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator-foldl1' :: Prim a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold-foldr :: Prim a => (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors-foldr1 :: Prim a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold with a strict accumulator-foldr' :: Prim a => (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator-foldr1' :: Prim a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold (function applied to each element and its index)-ifoldl :: Prim b => (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold with strict accumulator (function applied to--- each element and its index)-ifoldl' :: Prim b => (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Right fold (function applied to each element and its--- index)-ifoldr :: Prim a => (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold with strict accumulator (function applied to--- each element and its index)-ifoldr' :: Prim a => (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Check if all elements satisfy the predicate.-all :: Prim a => (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if any element satisfies the predicate.-any :: Prim a => (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Compute the sum of the elements-sum :: (Prim a, Num a) => Vector a -> a---- | <i>O(n)</i> Compute the produce of the elements-product :: (Prim a, Num a) => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector. The vector may--- not be empty.-maximum :: (Prim a, Ord a) => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector according to the--- given comparison function. The vector may not be empty.-maximumBy :: Prim a => (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector. The vector may--- not be empty.-minimum :: (Prim a, Ord a) => Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector according to the--- given comparison function. The vector may not be empty.-minimumBy :: Prim a => (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the index of the minimum element of the vector. The--- vector may not be empty.-minIndex :: (Prim a, Ord a) => Vector a -> Int---- | <i>O(n)</i> Yield the index of the minimum element of the vector--- according to the given comparison function. The vector may not be--- empty.-minIndexBy :: Prim a => (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector. The--- vector may not be empty.-maxIndex :: (Prim a, Ord a) => Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector--- according to the given comparison function. The vector may not be--- empty.-maxIndexBy :: Prim a => (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Monadic fold-foldM :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold with strict accumulator-foldM' :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors-fold1M :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator-fold1M' :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold that discards the result-foldM_ :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold with strict accumulator that discards the--- result-foldM'_ :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the--- result-fold1M_ :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator that discards the result-fold1M'_ :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Prescan--- --- <pre>--- prescanl f z = <a>init</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>prescanl (+) 0 <1,2,3,4> = <0,1,3,6></tt>-prescanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Prescan with strict accumulator-prescanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan--- --- <pre>--- postscanl f z = <a>tail</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>postscanl (+) 0 <1,2,3,4> = <1,3,6,10></tt>-postscanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan with strict accumulator-postscanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan--- --- <pre>--- scanl f z <x1,...,xn> = <y1,...,y(n+1)>--- where y1 = z--- yi = f y(i-1) x(i-1)--- </pre>--- --- Example: <tt>scanl (+) 0 <1,2,3,4> = <0,1,3,6,10></tt>-scanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan with strict accumulator-scanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector--- --- <pre>--- scanl f <x1,...,xn> = <y1,...,yn>--- where y1 = x1--- yi = f y(i-1) xi--- </pre>-scanl1 :: Prim a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator-scanl1' :: Prim a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left prescan--- --- <pre>--- prescanr f z = <a>reverse</a> . <a>prescanl</a> (flip f) z . <a>reverse</a>--- </pre>-prescanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left prescan with strict accumulator-prescanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan-postscanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan with strict accumulator-postscanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan-scanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator-scanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan over a non-empty vector-scanr1 :: Prim a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict--- accumulator-scanr1' :: Prim a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Convert a vector to a list-toList :: Prim a => Vector a -> [a]---- | <i>O(n)</i> Convert a list to a vector-fromList :: Prim a => [a] -> Vector a---- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a--- vector--- --- <pre>--- fromListN n xs = <a>fromList</a> (<a>take</a> n xs)--- </pre>-fromListN :: Prim a => Int -> [a] -> Vector a---- | <i>O(n)</i> Convert different vector types-convert :: (Vector v a, Vector w a) => v a -> w a---- | <i>O(n)</i> Yield an immutable copy of the mutable vector.-freeze :: (Prim a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)---- | <i>O(n)</i> Yield a mutable copy of the immutable vector.-thaw :: (Prim a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length.-copy :: (Prim a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()----- | Safe interface to <a>Data.Vector.Primitive.Mutable</a>-module Data.Vector.Primitive.Mutable.Safe---- | Mutable vectors of primitive types.-data MVector s a-type IOVector = MVector RealWorld-type STVector s = MVector s---- | Class of types supporting primitive array operations-class Prim a---- | Length of the mutable vector.-length :: Prim a => MVector s a -> Int---- | Check whether the vector is empty-null :: Prim a => MVector s a -> Bool---- | Yield a part of the mutable vector without copying it.-slice :: Prim a => Int -> Int -> MVector s a -> MVector s a-init :: Prim a => MVector s a -> MVector s a-tail :: Prim a => MVector s a -> MVector s a-take :: Prim a => Int -> MVector s a -> MVector s a-drop :: Prim a => Int -> MVector s a -> MVector s a-splitAt :: Prim a => Int -> MVector s a -> (MVector s a, MVector s a)-overlaps :: Prim a => MVector s a -> MVector s a -> Bool---- | Create a mutable vector of the given length.-new :: (PrimMonad m, Prim a) => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with an initial value.-replicate :: (PrimMonad m, Prim a) => Int -> a -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with values produced by repeatedly executing the--- monadic action.-replicateM :: (PrimMonad m, Prim a) => Int -> m a -> m (MVector (PrimState m) a)---- | Create a copy of a mutable vector.-clone :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive.-grow :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Reset all elements of the vector to some undefined value, clearing all--- references to external objects. This is usually a noop for unboxed--- vectors.-clear :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> m ()---- | Yield the element at the given position.-read :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position.-write :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions.-swap :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> Int -> Int -> m ()---- | Set all elements of the vector to the given value.-set :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap.-copy :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length.--- --- If the vectors do not overlap, then this is equivalent to <a>copy</a>.--- Otherwise, the copying is performed as if the source vector were--- copied to a temporary vector and then the temporary vector was copied--- to the target vector.-move :: (PrimMonad m, Prim a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()----- | Mutable vectors based on Storable.-module Data.Vector.Storable.Mutable---- | Mutable <a>Storable</a>-based vectors-data MVector s a-MVector :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !ForeignPtr a -> MVector s a-type IOVector = MVector RealWorld-type STVector s = MVector s---- | The member functions of this class facilitate writing values of--- primitive types to raw memory (which may have been allocated with the--- above mentioned routines) and reading values from blocks of raw--- memory. The class, furthermore, includes support for computing the--- storage requirements and alignment restrictions of storable types.--- --- Memory addresses are represented as values of type <tt><a>Ptr</a>--- a</tt>, for some <tt>a</tt> which is an instance of class--- <a>Storable</a>. The type argument to <a>Ptr</a> helps provide some--- valuable type safety in FFI code (you can't mix pointers of different--- types without an explicit cast), while helping the Haskell type system--- figure out which marshalling method is needed for a given pointer.--- --- All marshalling between Haskell and a foreign language ultimately--- boils down to translating Haskell data structures into the binary--- representation of a corresponding data structure of the foreign--- language and vice versa. To code this marshalling in Haskell, it is--- necessary to manipulate primitive data types stored in unstructured--- memory blocks. The class <a>Storable</a> facilitates this manipulation--- on all types for which it is instantiated, which are the standard--- basic types of Haskell, the fixed size <tt>Int</tt> types--- (<a>Int8</a>, <a>Int16</a>, <a>Int32</a>, <a>Int64</a>), the fixed--- size <tt>Word</tt> types (<a>Word8</a>, <a>Word16</a>, <a>Word32</a>,--- <a>Word64</a>), <a>StablePtr</a>, all types from--- <a>Foreign.C.Types</a>, as well as <a>Ptr</a>.--- --- Minimal complete definition: <a>sizeOf</a>, <a>alignment</a>, one of--- <a>peek</a>, <a>peekElemOff</a> and <a>peekByteOff</a>, and one of--- <a>poke</a>, <a>pokeElemOff</a> and <a>pokeByteOff</a>.-class Storable a---- | Length of the mutable vector.-length :: Storable a => MVector s a -> Int---- | Check whether the vector is empty-null :: Storable a => MVector s a -> Bool---- | Yield a part of the mutable vector without copying it.-slice :: Storable a => Int -> Int -> MVector s a -> MVector s a-init :: Storable a => MVector s a -> MVector s a-tail :: Storable a => MVector s a -> MVector s a-take :: Storable a => Int -> MVector s a -> MVector s a-drop :: Storable a => Int -> MVector s a -> MVector s a-splitAt :: Storable a => Int -> MVector s a -> (MVector s a, MVector s a)---- | Yield a part of the mutable vector without copying it. No bounds--- checks are performed.-unsafeSlice :: Storable a => Int -> Int -> MVector s a -> MVector s a-unsafeInit :: Storable a => MVector s a -> MVector s a-unsafeTail :: Storable a => MVector s a -> MVector s a-unsafeTake :: Storable a => Int -> MVector s a -> MVector s a-unsafeDrop :: Storable a => Int -> MVector s a -> MVector s a-overlaps :: Storable a => MVector s a -> MVector s a -> Bool---- | Create a mutable vector of the given length.-new :: (PrimMonad m, Storable a) => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length. The length is not--- checked.-unsafeNew :: (PrimMonad m, Storable a) => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with an initial value.-replicate :: (PrimMonad m, Storable a) => Int -> a -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with values produced by repeatedly executing the--- monadic action.-replicateM :: (PrimMonad m, Storable a) => Int -> m a -> m (MVector (PrimState m) a)---- | Create a copy of a mutable vector.-clone :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive.-grow :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive but this is not checked.-unsafeGrow :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Reset all elements of the vector to some undefined value, clearing all--- references to external objects. This is usually a noop for unboxed--- vectors.-clear :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> m ()---- | Yield the element at the given position.-read :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position.-write :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions.-swap :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> Int -> Int -> m ()---- | Yield the element at the given position. No bounds checks are--- performed.-unsafeRead :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position. No bounds checks are--- performed.-unsafeWrite :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions. No bounds checks are--- performed.-unsafeSwap :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> Int -> Int -> m ()---- | Set all elements of the vector to the given value.-set :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap.-copy :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length.--- --- If the vectors do not overlap, then this is equivalent to <a>copy</a>.--- Otherwise, the copying is performed as if the source vector were--- copied to a temporary vector and then the temporary vector was copied--- to the target vector.-move :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap. This is not checked.-unsafeCopy :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length, but this is not checked.--- --- If the vectors do not overlap, then this is equivalent to--- <a>unsafeCopy</a>. Otherwise, the copying is performed as if the--- source vector were copied to a temporary vector and then the temporary--- vector was copied to the target vector.-unsafeMove :: (PrimMonad m, Storable a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | <i>O(1)</i> Unsafely cast a mutable vector from one element type to--- another. The operation just changes the type of the underlying pointer--- and does not modify the elements.--- --- The resulting vector contains as many elements as can fit into the--- underlying memory block.-unsafeCast :: (Storable a, Storable b) => MVector s a -> MVector s b---- | Create a mutable vector from a <a>ForeignPtr</a> with an offset and a--- length. Modifying data through the <a>ForeignPtr</a> afterwards is--- unsafe if the vector could have been frozen before the modification.-unsafeFromForeignPtr :: Storable a => ForeignPtr a -> Int -> Int -> MVector s a---- | Yield the underlying <a>ForeignPtr</a> together with the offset to the--- data and its length. Modifying the data through the <a>ForeignPtr</a>--- is unsafe if the vector could have frozen before the modification.-unsafeToForeignPtr :: Storable a => MVector s a -> (ForeignPtr a, Int, Int)---- | Pass a pointer to the vector's data to the IO action. Modifying data--- through the pointer is unsafe if the vector could have been frozen--- before the modification.-unsafeWith :: Storable a => IOVector a -> (Ptr a -> IO b) -> IO b-instance Typeable2 MVector-instance Storable a => MVector MVector a----- | <a>Storable</a>-based vectors.-module Data.Vector.Storable---- | <a>Storable</a>-based vectors-data Vector a---- | Mutable <a>Storable</a>-based vectors-data MVector s a-MVector :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !ForeignPtr a -> MVector s a---- | The member functions of this class facilitate writing values of--- primitive types to raw memory (which may have been allocated with the--- above mentioned routines) and reading values from blocks of raw--- memory. The class, furthermore, includes support for computing the--- storage requirements and alignment restrictions of storable types.--- --- Memory addresses are represented as values of type <tt><a>Ptr</a>--- a</tt>, for some <tt>a</tt> which is an instance of class--- <a>Storable</a>. The type argument to <a>Ptr</a> helps provide some--- valuable type safety in FFI code (you can't mix pointers of different--- types without an explicit cast), while helping the Haskell type system--- figure out which marshalling method is needed for a given pointer.--- --- All marshalling between Haskell and a foreign language ultimately--- boils down to translating Haskell data structures into the binary--- representation of a corresponding data structure of the foreign--- language and vice versa. To code this marshalling in Haskell, it is--- necessary to manipulate primitive data types stored in unstructured--- memory blocks. The class <a>Storable</a> facilitates this manipulation--- on all types for which it is instantiated, which are the standard--- basic types of Haskell, the fixed size <tt>Int</tt> types--- (<a>Int8</a>, <a>Int16</a>, <a>Int32</a>, <a>Int64</a>), the fixed--- size <tt>Word</tt> types (<a>Word8</a>, <a>Word16</a>, <a>Word32</a>,--- <a>Word64</a>), <a>StablePtr</a>, all types from--- <a>Foreign.C.Types</a>, as well as <a>Ptr</a>.--- --- Minimal complete definition: <a>sizeOf</a>, <a>alignment</a>, one of--- <a>peek</a>, <a>peekElemOff</a> and <a>peekByteOff</a>, and one of--- <a>poke</a>, <a>pokeElemOff</a> and <a>pokeByteOff</a>.-class Storable a---- | <i>O(1)</i> Yield the length of the vector.-length :: Storable a => Vector a -> Int---- | <i>O(1)</i> Test whether a vector if empty-null :: Storable a => Vector a -> Bool---- | O(1) Indexing-(!) :: Storable a => Vector a -> Int -> a---- | O(1) Safe indexing-(!?) :: Storable a => Vector a -> Int -> Maybe a---- | <i>O(1)</i> First element-head :: Storable a => Vector a -> a---- | <i>O(1)</i> Last element-last :: Storable a => Vector a -> a---- | <i>O(1)</i> Unsafe indexing without bounds checking-unsafeIndex :: Storable a => Vector a -> Int -> a---- | <i>O(1)</i> First element without checking if the vector is empty-unsafeHead :: Storable a => Vector a -> a---- | <i>O(1)</i> Last element without checking if the vector is empty-unsafeLast :: Storable a => Vector a -> a---- | <i>O(1)</i> Indexing in a monad.--- --- The monad allows operations to be strict in the vector when necessary.--- Suppose vector copying is implemented like this:--- --- <pre>--- copy mv v = ... write mv i (v ! i) ...--- </pre>--- --- For lazy vectors, <tt>v ! i</tt> would not be evaluated which means--- that <tt>mv</tt> would unnecessarily retain a reference to <tt>v</tt>--- in each element written.--- --- With <a>indexM</a>, copying can be implemented like this instead:--- --- <pre>--- copy mv v = ... do--- x <- indexM v i--- write mv i x--- </pre>--- --- Here, no references to <tt>v</tt> are retained because indexing (but--- <i>not</i> the elements) is evaluated eagerly.-indexM :: (Storable a, Monad m) => Vector a -> Int -> m a---- | <i>O(1)</i> First element of a vector in a monad. See <a>indexM</a>--- for an explanation of why this is useful.-headM :: (Storable a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Last element of a vector in a monad. See <a>indexM</a> for--- an explanation of why this is useful.-lastM :: (Storable a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Indexing in a monad without bounds checks. See--- <a>indexM</a> for an explanation of why this is useful.-unsafeIndexM :: (Storable a, Monad m) => Vector a -> Int -> m a---- | <i>O(1)</i> First element in a monad without checking for empty--- vectors. See <a>indexM</a> for an explanation of why this is useful.-unsafeHeadM :: (Storable a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Last element in a monad without checking for empty--- vectors. See <a>indexM</a> for an explanation of why this is useful.-unsafeLastM :: (Storable a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Yield a slice of the vector without copying it. The vector--- must contain at least <tt>i+n</tt> elements.-slice :: Storable a => Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty.-init :: Storable a => Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty.-tail :: Storable a => Vector a -> Vector a---- | <i>O(1)</i> Yield at the first <tt>n</tt> elements without copying.--- The vector may contain less than <tt>n</tt> elements in which case it--- is returned unchanged.-take :: Storable a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector may contain less than <tt>n</tt> elements in which--- case an empty vector is returned.-drop :: Storable a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements paired with the--- remainder without copying.--- --- Note that <tt><a>splitAt</a> n v</tt> is equivalent to--- <tt>(<a>take</a> n v, <a>drop</a> n v)</tt> but slightly more--- efficient.-splitAt :: Storable a => Int -> Vector a -> (Vector a, Vector a)---- | <i>O(1)</i> Yield a slice of the vector without copying. The vector--- must contain at least <tt>i+n</tt> elements but this is not checked.-unsafeSlice :: Storable a => Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty but this is not checked.-unsafeInit :: Storable a => Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty but this is not checked.-unsafeTail :: Storable a => Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements without copying. The--- vector must contain at least <tt>n</tt> elements but this is not--- checked.-unsafeTake :: Storable a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector must contain at least <tt>n</tt> elements but this--- is not checked.-unsafeDrop :: Storable a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Empty vector-empty :: Storable a => Vector a---- | <i>O(1)</i> Vector with exactly one element-singleton :: Storable a => a -> Vector a---- | <i>O(n)</i> Vector of the given length with the same value in each--- position-replicate :: Storable a => Int -> a -> Vector a---- | <i>O(n)</i> Construct a vector of the given length by applying the--- function to each index-generate :: Storable a => Int -> (Int -> a) -> Vector a---- | <i>O(n)</i> Apply function n times to value. Zeroth element is--- original value.-iterateN :: Storable a => Int -> (a -> a) -> a -> Vector a---- | <i>O(n)</i> Execute the monadic action the given number of times and--- store the results in a vector.-replicateM :: (Monad m, Storable a) => Int -> m a -> m (Vector a)---- | <i>O(n)</i> Construct a vector of the given length by applying the--- monadic action to each index-generateM :: (Monad m, Storable a) => Int -> (Int -> m a) -> m (Vector a)---- | Execute the monadic action and freeze the resulting vector.--- --- <pre>--- create (do { v <- new 2; write v 0 'a'; write v 1 'b' }) = <<tt>a</tt>,<tt>b</tt>>--- </pre>-create :: Storable a => (forall s. ST s (MVector s a)) -> Vector a---- | <i>O(n)</i> Construct a vector by repeatedly applying the generator--- function to a seed. The generator function yields <a>Just</a> the next--- element and the new seed or <a>Nothing</a> if there are no more--- elements.--- --- <pre>--- unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10--- = <10,9,8,7,6,5,4,3,2,1>--- </pre>-unfoldr :: Storable a => (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with at most <tt>n</tt> by repeatedly--- applying the generator function to the a seed. The generator function--- yields <a>Just</a> the next element and the new seed or <a>Nothing</a>--- if there are no more elements.--- --- <pre>--- unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>--- </pre>-unfoldrN :: Storable a => Int -> (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements by repeatedly--- applying the generator function to the already constructed part of the--- vector.--- --- <pre>--- constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>--- </pre>-constructN :: Storable a => Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements from right to--- left by repeatedly applying the generator function to the already--- constructed part of the vector.--- --- <pre>--- constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>--- </pre>-constructrN :: Storable a => Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+1</tt> etc. This operation is usually more efficient--- than <a>enumFromTo</a>.--- --- <pre>--- enumFromN 5 3 = <5,6,7>--- </pre>-enumFromN :: (Storable a, Num a) => a -> Int -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. This operations is--- usually more efficient than <a>enumFromThenTo</a>.--- --- <pre>--- enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>--- </pre>-enumFromStepN :: (Storable a, Num a) => a -> a -> Int -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromN</a> instead.-enumFromTo :: (Storable a, Enum a) => a -> a -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt> with a--- specific step <tt>z</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: (Storable a, Enum a) => a -> a -> a -> Vector a---- | <i>O(n)</i> Prepend an element-cons :: Storable a => a -> Vector a -> Vector a---- | <i>O(n)</i> Append an element-snoc :: Storable a => Vector a -> a -> Vector a---- | <i>O(m+n)</i> Concatenate two vectors-(++) :: Storable a => Vector a -> Vector a -> Vector a---- | <i>O(n)</i> Concatenate all vectors in the list-concat :: Storable a => [Vector a] -> Vector a---- | <i>O(n)</i> Yield the argument but force it not to retain any extra--- memory, possibly by copying it.--- --- This is especially useful when dealing with slices. For example:--- --- <pre>--- force (slice 0 2 <huge vector>)--- </pre>--- --- Here, the slice retains a reference to the huge vector. Forcing it--- creates a copy of just the elements that belong to the slice and--- allows the huge vector to be garbage collected.-force :: Storable a => Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the--- vector element at position <tt>i</tt> by <tt>a</tt>.--- --- <pre>--- <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>--- </pre>-(//) :: Storable a => Vector a -> [(Int, a)] -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>a</tt> from the value vector, replace--- the element of the initial vector at position <tt>i</tt> by--- <tt>a</tt>.--- --- <pre>--- update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>--- </pre>-update_ :: Storable a => Vector a -> Vector Int -> Vector a -> Vector a---- | Same as (<a>//</a>) but without bounds checking.-unsafeUpd :: Storable a => Vector a -> [(Int, a)] -> Vector a---- | Same as <a>update_</a> but without bounds checking.-unsafeUpdate_ :: Storable a => Vector a -> Vector Int -> Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the--- vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.--- --- <pre>--- accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>--- </pre>-accum :: Storable a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>b</tt> from the the value vector,--- replace the element of the initial vector at position <tt>i</tt> by--- <tt>f a b</tt>.--- --- <pre>--- accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>--- </pre>-accumulate_ :: (Storable a, Storable b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | Same as <a>accum</a> but without bounds checking.-unsafeAccum :: Storable a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | Same as <a>accumulate_</a> but without bounds checking.-unsafeAccumulate_ :: (Storable a, Storable b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | <i>O(n)</i> Reverse a vector-reverse :: Storable a => Vector a -> Vector a---- | <i>O(n)</i> Yield the vector obtained by replacing each element--- <tt>i</tt> of the index vector by <tt>xs<a>!</a>i</tt>. This is--- equivalent to <tt><a>map</a> (xs<a>!</a>) is</tt> but is often much--- more efficient.--- --- <pre>--- backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>--- </pre>-backpermute :: Storable a => Vector a -> Vector Int -> Vector a---- | Same as <a>backpermute</a> but without bounds checking.-unsafeBackpermute :: Storable a => Vector a -> Vector Int -> Vector a---- | Apply a destructive operation to a vector. The operation will be--- performed in place if it is safe to do so and will modify a copy of--- the vector otherwise.--- --- <pre>--- modify (\v -> write v 0 'x') (<a>replicate</a> 3 'a') = <'x','a','a'>--- </pre>-modify :: Storable a => (forall s. MVector s a -> ST s ()) -> Vector a -> Vector a---- | <i>O(n)</i> Map a function over a vector-map :: (Storable a, Storable b) => (a -> b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply a function to every element of a vector and its--- index-imap :: (Storable a, Storable b) => (Int -> a -> b) -> Vector a -> Vector b---- | Map a function over a vector and concatenate the results.-concatMap :: (Storable a, Storable b) => (a -> Vector b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results-mapM :: (Monad m, Storable a, Storable b) => (a -> m b) -> Vector a -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results-mapM_ :: (Monad m, Storable a) => (a -> m b) -> Vector a -> m ()---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.-forM :: (Monad m, Storable a, Storable b) => Vector a -> (a -> m b) -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.-forM_ :: (Monad m, Storable a) => Vector a -> (a -> m b) -> m ()---- | <i>O(min(m,n))</i> Zip two vectors with the given function.-zipWith :: (Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors with the given function.-zipWith3 :: (Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-zipWith4 :: (Storable a, Storable b, Storable c, Storable d, Storable e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-zipWith5 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-zipWith6 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f, Storable g) => (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(min(m,n))</i> Zip two vectors with a function that also takes the--- elements' indices.-izipWith :: (Storable a, Storable b, Storable c) => (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors and their indices with the given function.-izipWith3 :: (Storable a, Storable b, Storable c, Storable d) => (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-izipWith4 :: (Storable a, Storable b, Storable c, Storable d, Storable e) => (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-izipWith5 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-izipWith6 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f, Storable g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- yield a vector of results-zipWithM :: (Monad m, Storable a, Storable b, Storable c) => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- ignore the results-zipWithM_ :: (Monad m, Storable a, Storable b) => (a -> b -> m c) -> Vector a -> Vector b -> m ()---- | <i>O(n)</i> Drop elements that do not satisfy the predicate-filter :: Storable a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the predicate which is--- applied to values and their indices-ifilter :: Storable a => (Int -> a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the monadic predicate-filterM :: (Monad m, Storable a) => (a -> m Bool) -> Vector a -> m (Vector a)---- | <i>O(n)</i> Yield the longest prefix of elements satisfying the--- predicate without copying.-takeWhile :: Storable a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop the longest prefix of elements that satisfy the--- predicate without copying.-dropWhile :: Storable a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The relative order of the elements is preserved at the--- cost of a sometimes reduced performance compared to--- <a>unstablePartition</a>.-partition :: Storable a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The order of the elements is not preserved but the--- operation is often faster than <a>partition</a>.-unstablePartition :: Storable a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- satisfy the predicate and the rest without copying.-span :: Storable a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- do not satisfy the predicate and the rest without copying.-break :: Storable a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Check if the vector contains an element-elem :: (Storable a, Eq a) => a -> Vector a -> Bool---- | <i>O(n)</i> Check if the vector does not contain an element (inverse--- of <a>elem</a>)-notElem :: (Storable a, Eq a) => a -> Vector a -> Bool---- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate--- or <a>Nothing</a> if no such element exists.-find :: Storable a => (a -> Bool) -> Vector a -> Maybe a---- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching--- the predicate or <a>Nothing</a> if no such element exists.-findIndex :: Storable a => (a -> Bool) -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of elements satisfying the predicate in--- ascending order.-findIndices :: Storable a => (a -> Bool) -> Vector a -> Vector Int---- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the--- given element or <a>Nothing</a> if the vector does not contain the--- element. This is a specialised version of <a>findIndex</a>.-elemIndex :: (Storable a, Eq a) => a -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of all occurences of the given element--- in ascending order. This is a specialised version of--- <a>findIndices</a>.-elemIndices :: (Storable a, Eq a) => a -> Vector a -> Vector Int---- | <i>O(n)</i> Left fold-foldl :: Storable b => (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors-foldl1 :: Storable a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold with strict accumulator-foldl' :: Storable b => (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator-foldl1' :: Storable a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold-foldr :: Storable a => (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors-foldr1 :: Storable a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold with a strict accumulator-foldr' :: Storable a => (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator-foldr1' :: Storable a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold (function applied to each element and its index)-ifoldl :: Storable b => (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold with strict accumulator (function applied to--- each element and its index)-ifoldl' :: Storable b => (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Right fold (function applied to each element and its--- index)-ifoldr :: Storable a => (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold with strict accumulator (function applied to--- each element and its index)-ifoldr' :: Storable a => (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Check if all elements satisfy the predicate.-all :: Storable a => (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if any element satisfies the predicate.-any :: Storable a => (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if all elements are <a>True</a>-and :: Vector Bool -> Bool---- | <i>O(n)</i> Check if any element is <a>True</a>-or :: Vector Bool -> Bool---- | <i>O(n)</i> Compute the sum of the elements-sum :: (Storable a, Num a) => Vector a -> a---- | <i>O(n)</i> Compute the produce of the elements-product :: (Storable a, Num a) => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector. The vector may--- not be empty.-maximum :: (Storable a, Ord a) => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector according to the--- given comparison function. The vector may not be empty.-maximumBy :: Storable a => (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector. The vector may--- not be empty.-minimum :: (Storable a, Ord a) => Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector according to the--- given comparison function. The vector may not be empty.-minimumBy :: Storable a => (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the index of the minimum element of the vector. The--- vector may not be empty.-minIndex :: (Storable a, Ord a) => Vector a -> Int---- | <i>O(n)</i> Yield the index of the minimum element of the vector--- according to the given comparison function. The vector may not be--- empty.-minIndexBy :: Storable a => (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector. The--- vector may not be empty.-maxIndex :: (Storable a, Ord a) => Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector--- according to the given comparison function. The vector may not be--- empty.-maxIndexBy :: Storable a => (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Monadic fold-foldM :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold with strict accumulator-foldM' :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors-fold1M :: (Monad m, Storable a) => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator-fold1M' :: (Monad m, Storable a) => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold that discards the result-foldM_ :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold with strict accumulator that discards the--- result-foldM'_ :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the--- result-fold1M_ :: (Monad m, Storable a) => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator that discards the result-fold1M'_ :: (Monad m, Storable a) => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Prescan--- --- <pre>--- prescanl f z = <a>init</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>prescanl (+) 0 <1,2,3,4> = <0,1,3,6></tt>-prescanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Prescan with strict accumulator-prescanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan--- --- <pre>--- postscanl f z = <a>tail</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>postscanl (+) 0 <1,2,3,4> = <1,3,6,10></tt>-postscanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan with strict accumulator-postscanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan--- --- <pre>--- scanl f z <x1,...,xn> = <y1,...,y(n+1)>--- where y1 = z--- yi = f y(i-1) x(i-1)--- </pre>--- --- Example: <tt>scanl (+) 0 <1,2,3,4> = <0,1,3,6,10></tt>-scanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan with strict accumulator-scanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector--- --- <pre>--- scanl f <x1,...,xn> = <y1,...,yn>--- where y1 = x1--- yi = f y(i-1) xi--- </pre>-scanl1 :: Storable a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator-scanl1' :: Storable a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left prescan--- --- <pre>--- prescanr f z = <a>reverse</a> . <a>prescanl</a> (flip f) z . <a>reverse</a>--- </pre>-prescanr :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left prescan with strict accumulator-prescanr' :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan-postscanr :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan with strict accumulator-postscanr' :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan-scanr :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator-scanr' :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan over a non-empty vector-scanr1 :: Storable a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict--- accumulator-scanr1' :: Storable a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Convert a vector to a list-toList :: Storable a => Vector a -> [a]---- | <i>O(n)</i> Convert a list to a vector-fromList :: Storable a => [a] -> Vector a---- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a--- vector--- --- <pre>--- fromListN n xs = <a>fromList</a> (<a>take</a> n xs)--- </pre>-fromListN :: Storable a => Int -> [a] -> Vector a---- | <i>O(n)</i> Convert different vector types-convert :: (Vector v a, Vector w a) => v a -> w a---- | <i>O(1)</i> Unsafely cast a vector from one element type to another.--- The operation just changes the type of the underlying pointer and does--- not modify the elements.--- --- The resulting vector contains as many elements as can fit into the--- underlying memory block.-unsafeCast :: (Storable a, Storable b) => Vector a -> Vector b---- | <i>O(n)</i> Yield an immutable copy of the mutable vector.-freeze :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)---- | <i>O(n)</i> Yield a mutable copy of the immutable vector.-thaw :: (Storable a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length.-copy :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()---- | <i>O(1)</i> Unsafe convert a mutable vector to an immutable one--- without copying. The mutable vector may not be used after this--- operation.-unsafeFreeze :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)---- | <i>O(1)</i> Unsafely convert an immutable vector to a mutable one--- without copying. The immutable vector may not be used after this--- operation.-unsafeThaw :: (Storable a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length. This is not checked.-unsafeCopy :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()---- | <i>O(1)</i> Create a vector from a <a>ForeignPtr</a> with an offset--- and a length. The data may not be modified through the--- <a>ForeignPtr</a> afterwards.-unsafeFromForeignPtr :: Storable a => ForeignPtr a -> Int -> Int -> Vector a---- | <i>O(1)</i> Yield the underlying <a>ForeignPtr</a> together with the--- offset to the data and its length. The data may not be modified--- through the <a>ForeignPtr</a>.-unsafeToForeignPtr :: Storable a => Vector a -> (ForeignPtr a, Int, Int)---- | Pass a pointer to the vector's data to the IO action. The data may not--- be modified through the 'Ptr.-unsafeWith :: Storable a => Vector a -> (Ptr a -> IO b) -> IO b-instance Typeable1 Vector-instance Storable a => Monoid (Vector a)-instance (Storable a, Ord a) => Ord (Vector a)-instance (Storable a, Eq a) => Eq (Vector a)-instance Storable a => Vector Vector a-instance (Data a, Storable a) => Data (Vector a)-instance (Read a, Storable a) => Read (Vector a)-instance (Show a, Storable a) => Show (Vector a)----- | Adaptive unboxed vectors. The implementation is based on type families--- and picks an efficient, specialised representation for every element--- type. In particular, unboxed vectors of pairs are represented as pairs--- of unboxed vectors.--- --- Implementing unboxed vectors for new data types can be very easy. Here--- is how the library does this for <tt>Complex</tt> by simply wrapping--- vectors of pairs.--- --- <pre>--- newtype instance <a>MVector</a> s (<tt>Complex</tt> a) = MV_Complex (<a>MVector</a> s (a,a))--- newtype instance <a>Vector</a> (<tt>Complex</tt> a) = V_Complex (<a>Vector</a> (a,a))--- --- instance (<a>RealFloat</a> a, <a>Unbox</a> a) => <tt>Data.Vector.Generic.Mutable.MVector</tt> <a>MVector</a> (<tt>Complex</tt> a) where--- {-# INLINE basicLength #-}--- basicLength (MV_Complex v) = <tt>Data.Vector.Generic.Mutable.basicLength</tt> v--- ...--- --- instance (<a>RealFloat</a> a, <a>Unbox</a> a) => Data.Vector.Generic.Vector <a>Vector</a> (<tt>Complex</tt> a) where--- {-# INLINE basicLength #-}--- basicLength (V_Complex v) = Data.Vector.Generic.basicLength v--- ...--- --- instance (<a>RealFloat</a> a, <a>Unbox</a> a) => <a>Unbox</a> (<tt>Complex</tt> a)--- </pre>-module Data.Vector.Unboxed-class (Vector Vector a, MVector MVector a) => Unbox a---- | <i>O(1)</i> Yield the length of the vector.-length :: Unbox a => Vector a -> Int---- | <i>O(1)</i> Test whether a vector if empty-null :: Unbox a => Vector a -> Bool---- | O(1) Indexing-(!) :: Unbox a => Vector a -> Int -> a---- | O(1) Safe indexing-(!?) :: Unbox a => Vector a -> Int -> Maybe a---- | <i>O(1)</i> First element-head :: Unbox a => Vector a -> a---- | <i>O(1)</i> Last element-last :: Unbox a => Vector a -> a---- | <i>O(1)</i> Unsafe indexing without bounds checking-unsafeIndex :: Unbox a => Vector a -> Int -> a---- | <i>O(1)</i> First element without checking if the vector is empty-unsafeHead :: Unbox a => Vector a -> a---- | <i>O(1)</i> Last element without checking if the vector is empty-unsafeLast :: Unbox a => Vector a -> a---- | <i>O(1)</i> Indexing in a monad.--- --- The monad allows operations to be strict in the vector when necessary.--- Suppose vector copying is implemented like this:--- --- <pre>--- copy mv v = ... write mv i (v ! i) ...--- </pre>--- --- For lazy vectors, <tt>v ! i</tt> would not be evaluated which means--- that <tt>mv</tt> would unnecessarily retain a reference to <tt>v</tt>--- in each element written.--- --- With <a>indexM</a>, copying can be implemented like this instead:--- --- <pre>--- copy mv v = ... do--- x <- indexM v i--- write mv i x--- </pre>--- --- Here, no references to <tt>v</tt> are retained because indexing (but--- <i>not</i> the elements) is evaluated eagerly.-indexM :: (Unbox a, Monad m) => Vector a -> Int -> m a---- | <i>O(1)</i> First element of a vector in a monad. See <a>indexM</a>--- for an explanation of why this is useful.-headM :: (Unbox a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Last element of a vector in a monad. See <a>indexM</a> for--- an explanation of why this is useful.-lastM :: (Unbox a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Indexing in a monad without bounds checks. See--- <a>indexM</a> for an explanation of why this is useful.-unsafeIndexM :: (Unbox a, Monad m) => Vector a -> Int -> m a---- | <i>O(1)</i> First element in a monad without checking for empty--- vectors. See <a>indexM</a> for an explanation of why this is useful.-unsafeHeadM :: (Unbox a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Last element in a monad without checking for empty--- vectors. See <a>indexM</a> for an explanation of why this is useful.-unsafeLastM :: (Unbox a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Yield a slice of the vector without copying it. The vector--- must contain at least <tt>i+n</tt> elements.-slice :: Unbox a => Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty.-init :: Unbox a => Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty.-tail :: Unbox a => Vector a -> Vector a---- | <i>O(1)</i> Yield at the first <tt>n</tt> elements without copying.--- The vector may contain less than <tt>n</tt> elements in which case it--- is returned unchanged.-take :: Unbox a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector may contain less than <tt>n</tt> elements in which--- case an empty vector is returned.-drop :: Unbox a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements paired with the--- remainder without copying.--- --- Note that <tt><a>splitAt</a> n v</tt> is equivalent to--- <tt>(<a>take</a> n v, <a>drop</a> n v)</tt> but slightly more--- efficient.-splitAt :: Unbox a => Int -> Vector a -> (Vector a, Vector a)---- | <i>O(1)</i> Yield a slice of the vector without copying. The vector--- must contain at least <tt>i+n</tt> elements but this is not checked.-unsafeSlice :: Unbox a => Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty but this is not checked.-unsafeInit :: Unbox a => Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty but this is not checked.-unsafeTail :: Unbox a => Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements without copying. The--- vector must contain at least <tt>n</tt> elements but this is not--- checked.-unsafeTake :: Unbox a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector must contain at least <tt>n</tt> elements but this--- is not checked.-unsafeDrop :: Unbox a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Empty vector-empty :: Unbox a => Vector a---- | <i>O(1)</i> Vector with exactly one element-singleton :: Unbox a => a -> Vector a---- | <i>O(n)</i> Vector of the given length with the same value in each--- position-replicate :: Unbox a => Int -> a -> Vector a---- | <i>O(n)</i> Construct a vector of the given length by applying the--- function to each index-generate :: Unbox a => Int -> (Int -> a) -> Vector a---- | <i>O(n)</i> Apply function n times to value. Zeroth element is--- original value.-iterateN :: Unbox a => Int -> (a -> a) -> a -> Vector a---- | <i>O(n)</i> Execute the monadic action the given number of times and--- store the results in a vector.-replicateM :: (Monad m, Unbox a) => Int -> m a -> m (Vector a)---- | <i>O(n)</i> Construct a vector of the given length by applying the--- monadic action to each index-generateM :: (Monad m, Unbox a) => Int -> (Int -> m a) -> m (Vector a)---- | Execute the monadic action and freeze the resulting vector.--- --- <pre>--- create (do { v <- new 2; write v 0 'a'; write v 1 'b' }) = <<tt>a</tt>,<tt>b</tt>>--- </pre>-create :: Unbox a => (forall s. ST s (MVector s a)) -> Vector a---- | <i>O(n)</i> Construct a vector by repeatedly applying the generator--- function to a seed. The generator function yields <a>Just</a> the next--- element and the new seed or <a>Nothing</a> if there are no more--- elements.--- --- <pre>--- unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10--- = <10,9,8,7,6,5,4,3,2,1>--- </pre>-unfoldr :: Unbox a => (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with at most <tt>n</tt> by repeatedly--- applying the generator function to the a seed. The generator function--- yields <a>Just</a> the next element and the new seed or <a>Nothing</a>--- if there are no more elements.--- --- <pre>--- unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>--- </pre>-unfoldrN :: Unbox a => Int -> (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements by repeatedly--- applying the generator function to the already constructed part of the--- vector.--- --- <pre>--- constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>--- </pre>-constructN :: Unbox a => Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements from right to--- left by repeatedly applying the generator function to the already--- constructed part of the vector.--- --- <pre>--- constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>--- </pre>-constructrN :: Unbox a => Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+1</tt> etc. This operation is usually more efficient--- than <a>enumFromTo</a>.--- --- <pre>--- enumFromN 5 3 = <5,6,7>--- </pre>-enumFromN :: (Unbox a, Num a) => a -> Int -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. This operations is--- usually more efficient than <a>enumFromThenTo</a>.--- --- <pre>--- enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>--- </pre>-enumFromStepN :: (Unbox a, Num a) => a -> a -> Int -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromN</a> instead.-enumFromTo :: (Unbox a, Enum a) => a -> a -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt> with a--- specific step <tt>z</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: (Unbox a, Enum a) => a -> a -> a -> Vector a---- | <i>O(n)</i> Prepend an element-cons :: Unbox a => a -> Vector a -> Vector a---- | <i>O(n)</i> Append an element-snoc :: Unbox a => Vector a -> a -> Vector a---- | <i>O(m+n)</i> Concatenate two vectors-(++) :: Unbox a => Vector a -> Vector a -> Vector a---- | <i>O(n)</i> Concatenate all vectors in the list-concat :: Unbox a => [Vector a] -> Vector a---- | <i>O(n)</i> Yield the argument but force it not to retain any extra--- memory, possibly by copying it.--- --- This is especially useful when dealing with slices. For example:--- --- <pre>--- force (slice 0 2 <huge vector>)--- </pre>--- --- Here, the slice retains a reference to the huge vector. Forcing it--- creates a copy of just the elements that belong to the slice and--- allows the huge vector to be garbage collected.-force :: Unbox a => Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the--- vector element at position <tt>i</tt> by <tt>a</tt>.--- --- <pre>--- <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>--- </pre>-(//) :: Unbox a => Vector a -> [(Int, a)] -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the vector of--- index/value pairs, replace the vector element at position <tt>i</tt>--- by <tt>a</tt>.--- --- <pre>--- update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>--- </pre>-update :: Unbox a => Vector a -> Vector (Int, a) -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>a</tt> from the value vector, replace--- the element of the initial vector at position <tt>i</tt> by--- <tt>a</tt>.--- --- <pre>--- update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>--- </pre>--- --- The function <a>update</a> provides the same functionality and is--- usually more convenient.--- --- <pre>--- update_ xs is ys = <a>update</a> xs (<a>zip</a> is ys)--- </pre>-update_ :: Unbox a => Vector a -> Vector Int -> Vector a -> Vector a---- | Same as (<a>//</a>) but without bounds checking.-unsafeUpd :: Unbox a => Vector a -> [(Int, a)] -> Vector a---- | Same as <a>update</a> but without bounds checking.-unsafeUpdate :: Unbox a => Vector a -> Vector (Int, a) -> Vector a---- | Same as <a>update_</a> but without bounds checking.-unsafeUpdate_ :: Unbox a => Vector a -> Vector Int -> Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the--- vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.--- --- <pre>--- accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>--- </pre>-accum :: Unbox a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the vector of pairs,--- replace the vector element <tt>a</tt> at position <tt>i</tt> by <tt>f--- a b</tt>.--- --- <pre>--- accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>--- </pre>-accumulate :: (Unbox a, Unbox b) => (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>b</tt> from the the value vector,--- replace the element of the initial vector at position <tt>i</tt> by--- <tt>f a b</tt>.--- --- <pre>--- accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>--- </pre>--- --- The function <a>accumulate</a> provides the same functionality and is--- usually more convenient.--- --- <pre>--- accumulate_ f as is bs = <a>accumulate</a> f as (<a>zip</a> is bs)--- </pre>-accumulate_ :: (Unbox a, Unbox b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | Same as <a>accum</a> but without bounds checking.-unsafeAccum :: Unbox a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | Same as <a>accumulate</a> but without bounds checking.-unsafeAccumulate :: (Unbox a, Unbox b) => (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a---- | Same as <a>accumulate_</a> but without bounds checking.-unsafeAccumulate_ :: (Unbox a, Unbox b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | <i>O(n)</i> Reverse a vector-reverse :: Unbox a => Vector a -> Vector a---- | <i>O(n)</i> Yield the vector obtained by replacing each element--- <tt>i</tt> of the index vector by <tt>xs<a>!</a>i</tt>. This is--- equivalent to <tt><a>map</a> (xs<a>!</a>) is</tt> but is often much--- more efficient.--- --- <pre>--- backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>--- </pre>-backpermute :: Unbox a => Vector a -> Vector Int -> Vector a---- | Same as <a>backpermute</a> but without bounds checking.-unsafeBackpermute :: Unbox a => Vector a -> Vector Int -> Vector a---- | Apply a destructive operation to a vector. The operation will be--- performed in place if it is safe to do so and will modify a copy of--- the vector otherwise.--- --- <pre>--- modify (\v -> write v 0 'x') (<a>replicate</a> 3 'a') = <'x','a','a'>--- </pre>-modify :: Unbox a => (forall s. MVector s a -> ST s ()) -> Vector a -> Vector a---- | <i>O(n)</i> Pair each element in a vector with its index-indexed :: Unbox a => Vector a -> Vector (Int, a)---- | <i>O(n)</i> Map a function over a vector-map :: (Unbox a, Unbox b) => (a -> b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply a function to every element of a vector and its--- index-imap :: (Unbox a, Unbox b) => (Int -> a -> b) -> Vector a -> Vector b---- | Map a function over a vector and concatenate the results.-concatMap :: (Unbox a, Unbox b) => (a -> Vector b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results-mapM :: (Monad m, Unbox a, Unbox b) => (a -> m b) -> Vector a -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results-mapM_ :: (Monad m, Unbox a) => (a -> m b) -> Vector a -> m ()---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.-forM :: (Monad m, Unbox a, Unbox b) => Vector a -> (a -> m b) -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.-forM_ :: (Monad m, Unbox a) => Vector a -> (a -> m b) -> m ()---- | <i>O(min(m,n))</i> Zip two vectors with the given function.-zipWith :: (Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors with the given function.-zipWith3 :: (Unbox a, Unbox b, Unbox c, Unbox d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-zipWith4 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-zipWith5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-zipWith6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f, Unbox g) => (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(min(m,n))</i> Zip two vectors with a function that also takes the--- elements' indices.-izipWith :: (Unbox a, Unbox b, Unbox c) => (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors and their indices with the given function.-izipWith3 :: (Unbox a, Unbox b, Unbox c, Unbox d) => (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-izipWith4 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-izipWith5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-izipWith6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f, Unbox g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(1)</i> Zip 2 vectors-zip :: (Unbox a, Unbox b) => Vector a -> Vector b -> Vector (a, b)---- | <i>O(1)</i> Zip 3 vectors-zip3 :: (Unbox a, Unbox b, Unbox c) => Vector a -> Vector b -> Vector c -> Vector (a, b, c)---- | <i>O(1)</i> Zip 4 vectors-zip4 :: (Unbox a, Unbox b, Unbox c, Unbox d) => Vector a -> Vector b -> Vector c -> Vector d -> Vector (a, b, c, d)---- | <i>O(1)</i> Zip 5 vectors-zip5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector (a, b, c, d, e)---- | <i>O(1)</i> Zip 6 vectors-zip6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector (a, b, c, d, e, f)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- yield a vector of results-zipWithM :: (Monad m, Unbox a, Unbox b, Unbox c) => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- ignore the results-zipWithM_ :: (Monad m, Unbox a, Unbox b) => (a -> b -> m c) -> Vector a -> Vector b -> m ()---- | <i>O(1)</i> Unzip 2 vectors-unzip :: (Unbox a, Unbox b) => Vector (a, b) -> (Vector a, Vector b)---- | <i>O(1)</i> Unzip 3 vectors-unzip3 :: (Unbox a, Unbox b, Unbox c) => Vector (a, b, c) -> (Vector a, Vector b, Vector c)---- | <i>O(1)</i> Unzip 4 vectors-unzip4 :: (Unbox a, Unbox b, Unbox c, Unbox d) => Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d)---- | <i>O(1)</i> Unzip 5 vectors-unzip5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => Vector (a, b, c, d, e) -> (Vector a, Vector b, Vector c, Vector d, Vector e)---- | <i>O(1)</i> Unzip 6 vectors-unzip6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => Vector (a, b, c, d, e, f) -> (Vector a, Vector b, Vector c, Vector d, Vector e, Vector f)---- | <i>O(n)</i> Drop elements that do not satisfy the predicate-filter :: Unbox a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the predicate which is--- applied to values and their indices-ifilter :: Unbox a => (Int -> a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the monadic predicate-filterM :: (Monad m, Unbox a) => (a -> m Bool) -> Vector a -> m (Vector a)---- | <i>O(n)</i> Yield the longest prefix of elements satisfying the--- predicate without copying.-takeWhile :: Unbox a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop the longest prefix of elements that satisfy the--- predicate without copying.-dropWhile :: Unbox a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The relative order of the elements is preserved at the--- cost of a sometimes reduced performance compared to--- <a>unstablePartition</a>.-partition :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The order of the elements is not preserved but the--- operation is often faster than <a>partition</a>.-unstablePartition :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- satisfy the predicate and the rest without copying.-span :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- do not satisfy the predicate and the rest without copying.-break :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Check if the vector contains an element-elem :: (Unbox a, Eq a) => a -> Vector a -> Bool---- | <i>O(n)</i> Check if the vector does not contain an element (inverse--- of <a>elem</a>)-notElem :: (Unbox a, Eq a) => a -> Vector a -> Bool---- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate--- or <a>Nothing</a> if no such element exists.-find :: Unbox a => (a -> Bool) -> Vector a -> Maybe a---- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching--- the predicate or <a>Nothing</a> if no such element exists.-findIndex :: Unbox a => (a -> Bool) -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of elements satisfying the predicate in--- ascending order.-findIndices :: Unbox a => (a -> Bool) -> Vector a -> Vector Int---- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the--- given element or <a>Nothing</a> if the vector does not contain the--- element. This is a specialised version of <a>findIndex</a>.-elemIndex :: (Unbox a, Eq a) => a -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of all occurences of the given element--- in ascending order. This is a specialised version of--- <a>findIndices</a>.-elemIndices :: (Unbox a, Eq a) => a -> Vector a -> Vector Int---- | <i>O(n)</i> Left fold-foldl :: Unbox b => (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors-foldl1 :: Unbox a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold with strict accumulator-foldl' :: Unbox b => (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator-foldl1' :: Unbox a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold-foldr :: Unbox a => (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors-foldr1 :: Unbox a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold with a strict accumulator-foldr' :: Unbox a => (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator-foldr1' :: Unbox a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold (function applied to each element and its index)-ifoldl :: Unbox b => (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold with strict accumulator (function applied to--- each element and its index)-ifoldl' :: Unbox b => (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Right fold (function applied to each element and its--- index)-ifoldr :: Unbox a => (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold with strict accumulator (function applied to--- each element and its index)-ifoldr' :: Unbox a => (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Check if all elements satisfy the predicate.-all :: Unbox a => (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if any element satisfies the predicate.-any :: Unbox a => (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if all elements are <a>True</a>-and :: Vector Bool -> Bool---- | <i>O(n)</i> Check if any element is <a>True</a>-or :: Vector Bool -> Bool---- | <i>O(n)</i> Compute the sum of the elements-sum :: (Unbox a, Num a) => Vector a -> a---- | <i>O(n)</i> Compute the produce of the elements-product :: (Unbox a, Num a) => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector. The vector may--- not be empty.-maximum :: (Unbox a, Ord a) => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector according to the--- given comparison function. The vector may not be empty.-maximumBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector. The vector may--- not be empty.-minimum :: (Unbox a, Ord a) => Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector according to the--- given comparison function. The vector may not be empty.-minimumBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the index of the minimum element of the vector. The--- vector may not be empty.-minIndex :: (Unbox a, Ord a) => Vector a -> Int---- | <i>O(n)</i> Yield the index of the minimum element of the vector--- according to the given comparison function. The vector may not be--- empty.-minIndexBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector. The--- vector may not be empty.-maxIndex :: (Unbox a, Ord a) => Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector--- according to the given comparison function. The vector may not be--- empty.-maxIndexBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Monadic fold-foldM :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold with strict accumulator-foldM' :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors-fold1M :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator-fold1M' :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold that discards the result-foldM_ :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold with strict accumulator that discards the--- result-foldM'_ :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the--- result-fold1M_ :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator that discards the result-fold1M'_ :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Prescan--- --- <pre>--- prescanl f z = <a>init</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>prescanl (+) 0 <1,2,3,4> = <0,1,3,6></tt>-prescanl :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Prescan with strict accumulator-prescanl' :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan--- --- <pre>--- postscanl f z = <a>tail</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>postscanl (+) 0 <1,2,3,4> = <1,3,6,10></tt>-postscanl :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan with strict accumulator-postscanl' :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan--- --- <pre>--- scanl f z <x1,...,xn> = <y1,...,y(n+1)>--- where y1 = z--- yi = f y(i-1) x(i-1)--- </pre>--- --- Example: <tt>scanl (+) 0 <1,2,3,4> = <0,1,3,6,10></tt>-scanl :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan with strict accumulator-scanl' :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector--- --- <pre>--- scanl f <x1,...,xn> = <y1,...,yn>--- where y1 = x1--- yi = f y(i-1) xi--- </pre>-scanl1 :: Unbox a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator-scanl1' :: Unbox a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left prescan--- --- <pre>--- prescanr f z = <a>reverse</a> . <a>prescanl</a> (flip f) z . <a>reverse</a>--- </pre>-prescanr :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left prescan with strict accumulator-prescanr' :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan-postscanr :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan with strict accumulator-postscanr' :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan-scanr :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator-scanr' :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan over a non-empty vector-scanr1 :: Unbox a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict--- accumulator-scanr1' :: Unbox a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Convert a vector to a list-toList :: Unbox a => Vector a -> [a]---- | <i>O(n)</i> Convert a list to a vector-fromList :: Unbox a => [a] -> Vector a---- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a--- vector--- --- <pre>--- fromListN n xs = <a>fromList</a> (<a>take</a> n xs)--- </pre>-fromListN :: Unbox a => Int -> [a] -> Vector a---- | <i>O(n)</i> Convert different vector types-convert :: (Vector v a, Vector w a) => v a -> w a---- | <i>O(n)</i> Yield an immutable copy of the mutable vector.-freeze :: (Unbox a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)---- | <i>O(n)</i> Yield a mutable copy of the immutable vector.-thaw :: (Unbox a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length.-copy :: (Unbox a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()---- | <i>O(1)</i> Unsafe convert a mutable vector to an immutable one--- without copying. The mutable vector may not be used after this--- operation.-unsafeFreeze :: (Unbox a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)---- | <i>O(1)</i> Unsafely convert an immutable vector to a mutable one--- without copying. The immutable vector may not be used after this--- operation.-unsafeThaw :: (Unbox a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length. This is not checked.-unsafeCopy :: (Unbox a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()-instance (Read a, Unbox a) => Read (Vector a)-instance (Show a, Unbox a) => Show (Vector a)-instance Unbox a => Monoid (Vector a)-instance (Unbox a, Ord a) => Ord (Vector a)-instance (Unbox a, Eq a) => Eq (Vector a)----- | Safe interface to <a>Data.Vector.Unboxed</a>-module Data.Vector.Unboxed.Safe-class (Vector Vector a, MVector MVector a) => Unbox a---- | <i>O(1)</i> Yield the length of the vector.-length :: Unbox a => Vector a -> Int---- | <i>O(1)</i> Test whether a vector if empty-null :: Unbox a => Vector a -> Bool---- | O(1) Indexing-(!) :: Unbox a => Vector a -> Int -> a---- | O(1) Safe indexing-(!?) :: Unbox a => Vector a -> Int -> Maybe a---- | <i>O(1)</i> First element-head :: Unbox a => Vector a -> a---- | <i>O(1)</i> Last element-last :: Unbox a => Vector a -> a---- | <i>O(1)</i> Indexing in a monad.--- --- The monad allows operations to be strict in the vector when necessary.--- Suppose vector copying is implemented like this:--- --- <pre>--- copy mv v = ... write mv i (v ! i) ...--- </pre>--- --- For lazy vectors, <tt>v ! i</tt> would not be evaluated which means--- that <tt>mv</tt> would unnecessarily retain a reference to <tt>v</tt>--- in each element written.--- --- With <a>indexM</a>, copying can be implemented like this instead:--- --- <pre>--- copy mv v = ... do--- x <- indexM v i--- write mv i x--- </pre>--- --- Here, no references to <tt>v</tt> are retained because indexing (but--- <i>not</i> the elements) is evaluated eagerly.-indexM :: (Unbox a, Monad m) => Vector a -> Int -> m a---- | <i>O(1)</i> First element of a vector in a monad. See <a>indexM</a>--- for an explanation of why this is useful.-headM :: (Unbox a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Last element of a vector in a monad. See <a>indexM</a> for--- an explanation of why this is useful.-lastM :: (Unbox a, Monad m) => Vector a -> m a---- | <i>O(1)</i> Yield a slice of the vector without copying it. The vector--- must contain at least <tt>i+n</tt> elements.-slice :: Unbox a => Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty.-init :: Unbox a => Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty.-tail :: Unbox a => Vector a -> Vector a---- | <i>O(1)</i> Yield at the first <tt>n</tt> elements without copying.--- The vector may contain less than <tt>n</tt> elements in which case it--- is returned unchanged.-take :: Unbox a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector may contain less than <tt>n</tt> elements in which--- case an empty vector is returned.-drop :: Unbox a => Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements paired with the--- remainder without copying.--- --- Note that <tt><a>splitAt</a> n v</tt> is equivalent to--- <tt>(<a>take</a> n v, <a>drop</a> n v)</tt> but slightly more--- efficient.-splitAt :: Unbox a => Int -> Vector a -> (Vector a, Vector a)---- | <i>O(1)</i> Empty vector-empty :: Unbox a => Vector a---- | <i>O(1)</i> Vector with exactly one element-singleton :: Unbox a => a -> Vector a---- | <i>O(n)</i> Vector of the given length with the same value in each--- position-replicate :: Unbox a => Int -> a -> Vector a---- | <i>O(n)</i> Construct a vector of the given length by applying the--- function to each index-generate :: Unbox a => Int -> (Int -> a) -> Vector a---- | <i>O(n)</i> Apply function n times to value. Zeroth element is--- original value.-iterateN :: Unbox a => Int -> (a -> a) -> a -> Vector a---- | <i>O(n)</i> Execute the monadic action the given number of times and--- store the results in a vector.-replicateM :: (Monad m, Unbox a) => Int -> m a -> m (Vector a)---- | <i>O(n)</i> Construct a vector of the given length by applying the--- monadic action to each index-generateM :: (Monad m, Unbox a) => Int -> (Int -> m a) -> m (Vector a)---- | Execute the monadic action and freeze the resulting vector.--- --- <pre>--- create (do { v <- new 2; write v 0 'a'; write v 1 'b' }) = <<tt>a</tt>,<tt>b</tt>>--- </pre>-create :: Unbox a => (forall s. ST s (MVector s a)) -> Vector a---- | <i>O(n)</i> Construct a vector by repeatedly applying the generator--- function to a seed. The generator function yields <a>Just</a> the next--- element and the new seed or <a>Nothing</a> if there are no more--- elements.--- --- <pre>--- unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10--- = <10,9,8,7,6,5,4,3,2,1>--- </pre>-unfoldr :: Unbox a => (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with at most <tt>n</tt> by repeatedly--- applying the generator function to the a seed. The generator function--- yields <a>Just</a> the next element and the new seed or <a>Nothing</a>--- if there are no more elements.--- --- <pre>--- unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>--- </pre>-unfoldrN :: Unbox a => Int -> (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements by repeatedly--- applying the generator function to the already constructed part of the--- vector.--- --- <pre>--- constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>--- </pre>-constructN :: Unbox a => Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements from right to--- left by repeatedly applying the generator function to the already--- constructed part of the vector.--- --- <pre>--- constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>--- </pre>-constructrN :: Unbox a => Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+1</tt> etc. This operation is usually more efficient--- than <a>enumFromTo</a>.--- --- <pre>--- enumFromN 5 3 = <5,6,7>--- </pre>-enumFromN :: (Unbox a, Num a) => a -> Int -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. This operations is--- usually more efficient than <a>enumFromThenTo</a>.--- --- <pre>--- enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>--- </pre>-enumFromStepN :: (Unbox a, Num a) => a -> a -> Int -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromN</a> instead.-enumFromTo :: (Unbox a, Enum a) => a -> a -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt> with a--- specific step <tt>z</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: (Unbox a, Enum a) => a -> a -> a -> Vector a---- | <i>O(n)</i> Prepend an element-cons :: Unbox a => a -> Vector a -> Vector a---- | <i>O(n)</i> Append an element-snoc :: Unbox a => Vector a -> a -> Vector a---- | <i>O(m+n)</i> Concatenate two vectors-(++) :: Unbox a => Vector a -> Vector a -> Vector a---- | <i>O(n)</i> Concatenate all vectors in the list-concat :: Unbox a => [Vector a] -> Vector a---- | <i>O(n)</i> Yield the argument but force it not to retain any extra--- memory, possibly by copying it.--- --- This is especially useful when dealing with slices. For example:--- --- <pre>--- force (slice 0 2 <huge vector>)--- </pre>--- --- Here, the slice retains a reference to the huge vector. Forcing it--- creates a copy of just the elements that belong to the slice and--- allows the huge vector to be garbage collected.-force :: Unbox a => Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the--- vector element at position <tt>i</tt> by <tt>a</tt>.--- --- <pre>--- <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>--- </pre>-(//) :: Unbox a => Vector a -> [(Int, a)] -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the vector of--- index/value pairs, replace the vector element at position <tt>i</tt>--- by <tt>a</tt>.--- --- <pre>--- update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>--- </pre>-update :: Unbox a => Vector a -> Vector (Int, a) -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>a</tt> from the value vector, replace--- the element of the initial vector at position <tt>i</tt> by--- <tt>a</tt>.--- --- <pre>--- update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>--- </pre>--- --- The function <a>update</a> provides the same functionality and is--- usually more convenient.--- --- <pre>--- update_ xs is ys = <a>update</a> xs (<a>zip</a> is ys)--- </pre>-update_ :: Unbox a => Vector a -> Vector Int -> Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the--- vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.--- --- <pre>--- accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>--- </pre>-accum :: Unbox a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the vector of pairs,--- replace the vector element <tt>a</tt> at position <tt>i</tt> by <tt>f--- a b</tt>.--- --- <pre>--- accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>--- </pre>-accumulate :: (Unbox a, Unbox b) => (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>b</tt> from the the value vector,--- replace the element of the initial vector at position <tt>i</tt> by--- <tt>f a b</tt>.--- --- <pre>--- accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>--- </pre>--- --- The function <a>accumulate</a> provides the same functionality and is--- usually more convenient.--- --- <pre>--- accumulate_ f as is bs = <a>accumulate</a> f as (<a>zip</a> is bs)--- </pre>-accumulate_ :: (Unbox a, Unbox b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | <i>O(n)</i> Reverse a vector-reverse :: Unbox a => Vector a -> Vector a---- | <i>O(n)</i> Yield the vector obtained by replacing each element--- <tt>i</tt> of the index vector by <tt>xs<a>!</a>i</tt>. This is--- equivalent to <tt><a>map</a> (xs<a>!</a>) is</tt> but is often much--- more efficient.--- --- <pre>--- backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>--- </pre>-backpermute :: Unbox a => Vector a -> Vector Int -> Vector a---- | Apply a destructive operation to a vector. The operation will be--- performed in place if it is safe to do so and will modify a copy of--- the vector otherwise.--- --- <pre>--- modify (\v -> write v 0 'x') (<a>replicate</a> 3 'a') = <'x','a','a'>--- </pre>-modify :: Unbox a => (forall s. MVector s a -> ST s ()) -> Vector a -> Vector a---- | <i>O(n)</i> Pair each element in a vector with its index-indexed :: Unbox a => Vector a -> Vector (Int, a)---- | <i>O(n)</i> Map a function over a vector-map :: (Unbox a, Unbox b) => (a -> b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply a function to every element of a vector and its--- index-imap :: (Unbox a, Unbox b) => (Int -> a -> b) -> Vector a -> Vector b---- | Map a function over a vector and concatenate the results.-concatMap :: (Unbox a, Unbox b) => (a -> Vector b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results-mapM :: (Monad m, Unbox a, Unbox b) => (a -> m b) -> Vector a -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results-mapM_ :: (Monad m, Unbox a) => (a -> m b) -> Vector a -> m ()---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.-forM :: (Monad m, Unbox a, Unbox b) => Vector a -> (a -> m b) -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.-forM_ :: (Monad m, Unbox a) => Vector a -> (a -> m b) -> m ()---- | <i>O(min(m,n))</i> Zip two vectors with the given function.-zipWith :: (Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors with the given function.-zipWith3 :: (Unbox a, Unbox b, Unbox c, Unbox d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-zipWith4 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-zipWith5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-zipWith6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f, Unbox g) => (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(min(m,n))</i> Zip two vectors with a function that also takes the--- elements' indices.-izipWith :: (Unbox a, Unbox b, Unbox c) => (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors and their indices with the given function.-izipWith3 :: (Unbox a, Unbox b, Unbox c, Unbox d) => (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-izipWith4 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-izipWith5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-izipWith6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f, Unbox g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(1)</i> Zip 2 vectors-zip :: (Unbox a, Unbox b) => Vector a -> Vector b -> Vector (a, b)---- | <i>O(1)</i> Zip 3 vectors-zip3 :: (Unbox a, Unbox b, Unbox c) => Vector a -> Vector b -> Vector c -> Vector (a, b, c)---- | <i>O(1)</i> Zip 4 vectors-zip4 :: (Unbox a, Unbox b, Unbox c, Unbox d) => Vector a -> Vector b -> Vector c -> Vector d -> Vector (a, b, c, d)---- | <i>O(1)</i> Zip 5 vectors-zip5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector (a, b, c, d, e)---- | <i>O(1)</i> Zip 6 vectors-zip6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector (a, b, c, d, e, f)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- yield a vector of results-zipWithM :: (Monad m, Unbox a, Unbox b, Unbox c) => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- ignore the results-zipWithM_ :: (Monad m, Unbox a, Unbox b) => (a -> b -> m c) -> Vector a -> Vector b -> m ()---- | <i>O(1)</i> Unzip 2 vectors-unzip :: (Unbox a, Unbox b) => Vector (a, b) -> (Vector a, Vector b)---- | <i>O(1)</i> Unzip 3 vectors-unzip3 :: (Unbox a, Unbox b, Unbox c) => Vector (a, b, c) -> (Vector a, Vector b, Vector c)---- | <i>O(1)</i> Unzip 4 vectors-unzip4 :: (Unbox a, Unbox b, Unbox c, Unbox d) => Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d)---- | <i>O(1)</i> Unzip 5 vectors-unzip5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => Vector (a, b, c, d, e) -> (Vector a, Vector b, Vector c, Vector d, Vector e)---- | <i>O(1)</i> Unzip 6 vectors-unzip6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => Vector (a, b, c, d, e, f) -> (Vector a, Vector b, Vector c, Vector d, Vector e, Vector f)---- | <i>O(n)</i> Drop elements that do not satisfy the predicate-filter :: Unbox a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the predicate which is--- applied to values and their indices-ifilter :: Unbox a => (Int -> a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the monadic predicate-filterM :: (Monad m, Unbox a) => (a -> m Bool) -> Vector a -> m (Vector a)---- | <i>O(n)</i> Yield the longest prefix of elements satisfying the--- predicate without copying.-takeWhile :: Unbox a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop the longest prefix of elements that satisfy the--- predicate without copying.-dropWhile :: Unbox a => (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The relative order of the elements is preserved at the--- cost of a sometimes reduced performance compared to--- <a>unstablePartition</a>.-partition :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The order of the elements is not preserved but the--- operation is often faster than <a>partition</a>.-unstablePartition :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- satisfy the predicate and the rest without copying.-span :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- do not satisfy the predicate and the rest without copying.-break :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Check if the vector contains an element-elem :: (Unbox a, Eq a) => a -> Vector a -> Bool---- | <i>O(n)</i> Check if the vector does not contain an element (inverse--- of <a>elem</a>)-notElem :: (Unbox a, Eq a) => a -> Vector a -> Bool---- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate--- or <a>Nothing</a> if no such element exists.-find :: Unbox a => (a -> Bool) -> Vector a -> Maybe a---- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching--- the predicate or <a>Nothing</a> if no such element exists.-findIndex :: Unbox a => (a -> Bool) -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of elements satisfying the predicate in--- ascending order.-findIndices :: Unbox a => (a -> Bool) -> Vector a -> Vector Int---- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the--- given element or <a>Nothing</a> if the vector does not contain the--- element. This is a specialised version of <a>findIndex</a>.-elemIndex :: (Unbox a, Eq a) => a -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of all occurences of the given element--- in ascending order. This is a specialised version of--- <a>findIndices</a>.-elemIndices :: (Unbox a, Eq a) => a -> Vector a -> Vector Int---- | <i>O(n)</i> Left fold-foldl :: Unbox b => (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors-foldl1 :: Unbox a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold with strict accumulator-foldl' :: Unbox b => (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator-foldl1' :: Unbox a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold-foldr :: Unbox a => (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors-foldr1 :: Unbox a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold with a strict accumulator-foldr' :: Unbox a => (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator-foldr1' :: Unbox a => (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold (function applied to each element and its index)-ifoldl :: Unbox b => (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold with strict accumulator (function applied to--- each element and its index)-ifoldl' :: Unbox b => (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Right fold (function applied to each element and its--- index)-ifoldr :: Unbox a => (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold with strict accumulator (function applied to--- each element and its index)-ifoldr' :: Unbox a => (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Check if all elements satisfy the predicate.-all :: Unbox a => (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if any element satisfies the predicate.-any :: Unbox a => (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if all elements are <a>True</a>-and :: Vector Bool -> Bool---- | <i>O(n)</i> Check if any element is <a>True</a>-or :: Vector Bool -> Bool---- | <i>O(n)</i> Compute the sum of the elements-sum :: (Unbox a, Num a) => Vector a -> a---- | <i>O(n)</i> Compute the produce of the elements-product :: (Unbox a, Num a) => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector. The vector may--- not be empty.-maximum :: (Unbox a, Ord a) => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector according to the--- given comparison function. The vector may not be empty.-maximumBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector. The vector may--- not be empty.-minimum :: (Unbox a, Ord a) => Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector according to the--- given comparison function. The vector may not be empty.-minimumBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the index of the minimum element of the vector. The--- vector may not be empty.-minIndex :: (Unbox a, Ord a) => Vector a -> Int---- | <i>O(n)</i> Yield the index of the minimum element of the vector--- according to the given comparison function. The vector may not be--- empty.-minIndexBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector. The--- vector may not be empty.-maxIndex :: (Unbox a, Ord a) => Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector--- according to the given comparison function. The vector may not be--- empty.-maxIndexBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Monadic fold-foldM :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold with strict accumulator-foldM' :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors-fold1M :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator-fold1M' :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold that discards the result-foldM_ :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold with strict accumulator that discards the--- result-foldM'_ :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the--- result-fold1M_ :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator that discards the result-fold1M'_ :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Prescan--- --- <pre>--- prescanl f z = <a>init</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>prescanl (+) 0 <1,2,3,4> = <0,1,3,6></tt>-prescanl :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Prescan with strict accumulator-prescanl' :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan--- --- <pre>--- postscanl f z = <a>tail</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>postscanl (+) 0 <1,2,3,4> = <1,3,6,10></tt>-postscanl :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan with strict accumulator-postscanl' :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan--- --- <pre>--- scanl f z <x1,...,xn> = <y1,...,y(n+1)>--- where y1 = z--- yi = f y(i-1) x(i-1)--- </pre>--- --- Example: <tt>scanl (+) 0 <1,2,3,4> = <0,1,3,6,10></tt>-scanl :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan with strict accumulator-scanl' :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector--- --- <pre>--- scanl f <x1,...,xn> = <y1,...,yn>--- where y1 = x1--- yi = f y(i-1) xi--- </pre>-scanl1 :: Unbox a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator-scanl1' :: Unbox a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left prescan--- --- <pre>--- prescanr f z = <a>reverse</a> . <a>prescanl</a> (flip f) z . <a>reverse</a>--- </pre>-prescanr :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left prescan with strict accumulator-prescanr' :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan-postscanr :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan with strict accumulator-postscanr' :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan-scanr :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator-scanr' :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan over a non-empty vector-scanr1 :: Unbox a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict--- accumulator-scanr1' :: Unbox a => (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Convert a vector to a list-toList :: Unbox a => Vector a -> [a]---- | <i>O(n)</i> Convert a list to a vector-fromList :: Unbox a => [a] -> Vector a---- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a--- vector--- --- <pre>--- fromListN n xs = <a>fromList</a> (<a>take</a> n xs)--- </pre>-fromListN :: Unbox a => Int -> [a] -> Vector a---- | <i>O(n)</i> Convert different vector types-convert :: (Vector v a, Vector w a) => v a -> w a---- | <i>O(n)</i> Yield an immutable copy of the mutable vector.-freeze :: (Unbox a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)---- | <i>O(n)</i> Yield a mutable copy of the immutable vector.-thaw :: (Unbox a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length.-copy :: (Unbox a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()----- | Mutable adaptive unboxed vectors-module Data.Vector.Unboxed.Mutable-type IOVector = MVector RealWorld-type STVector s = MVector s-class (Vector Vector a, MVector MVector a) => Unbox a---- | Length of the mutable vector.-length :: Unbox a => MVector s a -> Int---- | Check whether the vector is empty-null :: Unbox a => MVector s a -> Bool---- | Yield a part of the mutable vector without copying it.-slice :: Unbox a => Int -> Int -> MVector s a -> MVector s a-init :: Unbox a => MVector s a -> MVector s a-tail :: Unbox a => MVector s a -> MVector s a-take :: Unbox a => Int -> MVector s a -> MVector s a-drop :: Unbox a => Int -> MVector s a -> MVector s a-splitAt :: Unbox a => Int -> MVector s a -> (MVector s a, MVector s a)---- | Yield a part of the mutable vector without copying it. No bounds--- checks are performed.-unsafeSlice :: Unbox a => Int -> Int -> MVector s a -> MVector s a-unsafeInit :: Unbox a => MVector s a -> MVector s a-unsafeTail :: Unbox a => MVector s a -> MVector s a-unsafeTake :: Unbox a => Int -> MVector s a -> MVector s a-unsafeDrop :: Unbox a => Int -> MVector s a -> MVector s a-overlaps :: Unbox a => MVector s a -> MVector s a -> Bool---- | Create a mutable vector of the given length.-new :: (PrimMonad m, Unbox a) => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length. The length is not--- checked.-unsafeNew :: (PrimMonad m, Unbox a) => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with an initial value.-replicate :: (PrimMonad m, Unbox a) => Int -> a -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with values produced by repeatedly executing the--- monadic action.-replicateM :: (PrimMonad m, Unbox a) => Int -> m a -> m (MVector (PrimState m) a)---- | Create a copy of a mutable vector.-clone :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive.-grow :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive but this is not checked.-unsafeGrow :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Reset all elements of the vector to some undefined value, clearing all--- references to external objects. This is usually a noop for unboxed--- vectors.-clear :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> m ()---- | <i>O(1)</i> Zip 2 vectors-zip :: (Unbox a, Unbox b) => MVector s a -> MVector s b -> MVector s (a, b)---- | <i>O(1)</i> Zip 3 vectors-zip3 :: (Unbox a, Unbox b, Unbox c) => MVector s a -> MVector s b -> MVector s c -> MVector s (a, b, c)---- | <i>O(1)</i> Zip 4 vectors-zip4 :: (Unbox a, Unbox b, Unbox c, Unbox d) => MVector s a -> MVector s b -> MVector s c -> MVector s d -> MVector s (a, b, c, d)---- | <i>O(1)</i> Zip 5 vectors-zip5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => MVector s a -> MVector s b -> MVector s c -> MVector s d -> MVector s e -> MVector s (a, b, c, d, e)---- | <i>O(1)</i> Zip 6 vectors-zip6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => MVector s a -> MVector s b -> MVector s c -> MVector s d -> MVector s e -> MVector s f -> MVector s (a, b, c, d, e, f)---- | <i>O(1)</i> Unzip 2 vectors-unzip :: (Unbox a, Unbox b) => MVector s (a, b) -> (MVector s a, MVector s b)---- | <i>O(1)</i> Unzip 3 vectors-unzip3 :: (Unbox a, Unbox b, Unbox c) => MVector s (a, b, c) -> (MVector s a, MVector s b, MVector s c)---- | <i>O(1)</i> Unzip 4 vectors-unzip4 :: (Unbox a, Unbox b, Unbox c, Unbox d) => MVector s (a, b, c, d) -> (MVector s a, MVector s b, MVector s c, MVector s d)---- | <i>O(1)</i> Unzip 5 vectors-unzip5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => MVector s (a, b, c, d, e) -> (MVector s a, MVector s b, MVector s c, MVector s d, MVector s e)---- | <i>O(1)</i> Unzip 6 vectors-unzip6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => MVector s (a, b, c, d, e, f) -> (MVector s a, MVector s b, MVector s c, MVector s d, MVector s e, MVector s f)---- | Yield the element at the given position.-read :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position.-write :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions.-swap :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> Int -> m ()---- | Yield the element at the given position. No bounds checks are--- performed.-unsafeRead :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position. No bounds checks are--- performed.-unsafeWrite :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions. No bounds checks are--- performed.-unsafeSwap :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> Int -> m ()---- | Set all elements of the vector to the given value.-set :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap.-copy :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length.--- --- If the vectors do not overlap, then this is equivalent to <a>copy</a>.--- Otherwise, the copying is performed as if the source vector were--- copied to a temporary vector and then the temporary vector was copied--- to the target vector.-move :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap. This is not checked.-unsafeCopy :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length, but this is not checked.--- --- If the vectors do not overlap, then this is equivalent to--- <a>unsafeCopy</a>. Otherwise, the copying is performed as if the--- source vector were copied to a temporary vector and then the temporary--- vector was copied to the target vector.-unsafeMove :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()----- | Safe interface to <a>Data.Vector.Unboxed.Mutable</a>-module Data.Vector.Unboxed.Mutable.Safe-type IOVector = MVector RealWorld-type STVector s = MVector s-class (Vector Vector a, MVector MVector a) => Unbox a---- | Length of the mutable vector.-length :: Unbox a => MVector s a -> Int---- | Check whether the vector is empty-null :: Unbox a => MVector s a -> Bool---- | Yield a part of the mutable vector without copying it.-slice :: Unbox a => Int -> Int -> MVector s a -> MVector s a-init :: Unbox a => MVector s a -> MVector s a-tail :: Unbox a => MVector s a -> MVector s a-take :: Unbox a => Int -> MVector s a -> MVector s a-drop :: Unbox a => Int -> MVector s a -> MVector s a-splitAt :: Unbox a => Int -> MVector s a -> (MVector s a, MVector s a)-overlaps :: Unbox a => MVector s a -> MVector s a -> Bool---- | Create a mutable vector of the given length.-new :: (PrimMonad m, Unbox a) => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with an initial value.-replicate :: (PrimMonad m, Unbox a) => Int -> a -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with values produced by repeatedly executing the--- monadic action.-replicateM :: (PrimMonad m, Unbox a) => Int -> m a -> m (MVector (PrimState m) a)---- | Create a copy of a mutable vector.-clone :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive.-grow :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Reset all elements of the vector to some undefined value, clearing all--- references to external objects. This is usually a noop for unboxed--- vectors.-clear :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> m ()---- | <i>O(1)</i> Zip 2 vectors-zip :: (Unbox a, Unbox b) => MVector s a -> MVector s b -> MVector s (a, b)---- | <i>O(1)</i> Zip 3 vectors-zip3 :: (Unbox a, Unbox b, Unbox c) => MVector s a -> MVector s b -> MVector s c -> MVector s (a, b, c)---- | <i>O(1)</i> Zip 4 vectors-zip4 :: (Unbox a, Unbox b, Unbox c, Unbox d) => MVector s a -> MVector s b -> MVector s c -> MVector s d -> MVector s (a, b, c, d)---- | <i>O(1)</i> Zip 5 vectors-zip5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => MVector s a -> MVector s b -> MVector s c -> MVector s d -> MVector s e -> MVector s (a, b, c, d, e)---- | <i>O(1)</i> Zip 6 vectors-zip6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => MVector s a -> MVector s b -> MVector s c -> MVector s d -> MVector s e -> MVector s f -> MVector s (a, b, c, d, e, f)---- | <i>O(1)</i> Unzip 2 vectors-unzip :: (Unbox a, Unbox b) => MVector s (a, b) -> (MVector s a, MVector s b)---- | <i>O(1)</i> Unzip 3 vectors-unzip3 :: (Unbox a, Unbox b, Unbox c) => MVector s (a, b, c) -> (MVector s a, MVector s b, MVector s c)---- | <i>O(1)</i> Unzip 4 vectors-unzip4 :: (Unbox a, Unbox b, Unbox c, Unbox d) => MVector s (a, b, c, d) -> (MVector s a, MVector s b, MVector s c, MVector s d)---- | <i>O(1)</i> Unzip 5 vectors-unzip5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => MVector s (a, b, c, d, e) -> (MVector s a, MVector s b, MVector s c, MVector s d, MVector s e)---- | <i>O(1)</i> Unzip 6 vectors-unzip6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => MVector s (a, b, c, d, e, f) -> (MVector s a, MVector s b, MVector s c, MVector s d, MVector s e, MVector s f)---- | Yield the element at the given position.-read :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position.-write :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions.-swap :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> Int -> Int -> m ()---- | Set all elements of the vector to the given value.-set :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap.-copy :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length.--- --- If the vectors do not overlap, then this is equivalent to <a>copy</a>.--- Otherwise, the copying is performed as if the source vector were--- copied to a temporary vector and then the temporary vector was copied--- to the target vector.-move :: (PrimMonad m, Unbox a) => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()----- | Mutable boxed vectors.-module Data.Vector.Mutable---- | Mutable boxed vectors keyed on the monad they live in (<a>IO</a> or--- <tt><tt>ST</tt> s</tt>).-data MVector s a-MVector :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !MutableArray s a -> MVector s a-type IOVector = MVector RealWorld-type STVector s = MVector s---- | Length of the mutable vector.-length :: MVector s a -> Int---- | Check whether the vector is empty-null :: MVector s a -> Bool---- | Yield a part of the mutable vector without copying it.-slice :: Int -> Int -> MVector s a -> MVector s a-init :: MVector s a -> MVector s a-tail :: MVector s a -> MVector s a-take :: Int -> MVector s a -> MVector s a-drop :: Int -> MVector s a -> MVector s a-splitAt :: Int -> MVector s a -> (MVector s a, MVector s a)---- | Yield a part of the mutable vector without copying it. No bounds--- checks are performed.-unsafeSlice :: Int -> Int -> MVector s a -> MVector s a-unsafeInit :: MVector s a -> MVector s a-unsafeTail :: MVector s a -> MVector s a-unsafeTake :: Int -> MVector s a -> MVector s a-unsafeDrop :: Int -> MVector s a -> MVector s a-overlaps :: MVector s a -> MVector s a -> Bool---- | Create a mutable vector of the given length.-new :: PrimMonad m => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length. The length is not--- checked.-unsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with an initial value.-replicate :: PrimMonad m => Int -> a -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with values produced by repeatedly executing the--- monadic action.-replicateM :: PrimMonad m => Int -> m a -> m (MVector (PrimState m) a)---- | Create a copy of a mutable vector.-clone :: PrimMonad m => MVector (PrimState m) a -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive.-grow :: PrimMonad m => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive but this is not checked.-unsafeGrow :: PrimMonad m => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Reset all elements of the vector to some undefined value, clearing all--- references to external objects. This is usually a noop for unboxed--- vectors.-clear :: PrimMonad m => MVector (PrimState m) a -> m ()---- | Yield the element at the given position.-read :: PrimMonad m => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position.-write :: PrimMonad m => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions.-swap :: PrimMonad m => MVector (PrimState m) a -> Int -> Int -> m ()---- | Yield the element at the given position. No bounds checks are--- performed.-unsafeRead :: PrimMonad m => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position. No bounds checks are--- performed.-unsafeWrite :: PrimMonad m => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions. No bounds checks are--- performed.-unsafeSwap :: PrimMonad m => MVector (PrimState m) a -> Int -> Int -> m ()---- | Set all elements of the vector to the given value.-set :: PrimMonad m => MVector (PrimState m) a -> a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap.-copy :: PrimMonad m => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length.--- --- If the vectors do not overlap, then this is equivalent to <a>copy</a>.--- Otherwise, the copying is performed as if the source vector were--- copied to a temporary vector and then the temporary vector was copied--- to the target vector.-move :: PrimMonad m => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap. This is not checked.-unsafeCopy :: PrimMonad m => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length, but this is not checked.--- --- If the vectors do not overlap, then this is equivalent to--- <a>unsafeCopy</a>. Otherwise, the copying is performed as if the--- source vector were copied to a temporary vector and then the temporary--- vector was copied to the target vector.-unsafeMove :: PrimMonad m => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()-instance Typeable2 MVector-instance MVector MVector a----- | A library for boxed vectors (that is, polymorphic arrays capable of--- holding any Haskell value). The vectors come in two flavours:--- --- <ul>--- <li>mutable</li>--- <li>immutable</li>--- </ul>--- --- and support a rich interface of both list-like operations, and bulk--- array operations.--- --- For unboxed arrays, use <a>Data.Vector.Unboxed</a>-module Data.Vector---- | Boxed vectors, supporting efficient slicing.-data Vector a---- | Mutable boxed vectors keyed on the monad they live in (<a>IO</a> or--- <tt><tt>ST</tt> s</tt>).-data MVector s a---- | <i>O(1)</i> Yield the length of the vector.-length :: Vector a -> Int---- | <i>O(1)</i> Test whether a vector if empty-null :: Vector a -> Bool---- | O(1) Indexing-(!) :: Vector a -> Int -> a---- | O(1) Safe indexing-(!?) :: Vector a -> Int -> Maybe a---- | <i>O(1)</i> First element-head :: Vector a -> a---- | <i>O(1)</i> Last element-last :: Vector a -> a---- | <i>O(1)</i> Unsafe indexing without bounds checking-unsafeIndex :: Vector a -> Int -> a---- | <i>O(1)</i> First element without checking if the vector is empty-unsafeHead :: Vector a -> a---- | <i>O(1)</i> Last element without checking if the vector is empty-unsafeLast :: Vector a -> a---- | <i>O(1)</i> Indexing in a monad.--- --- The monad allows operations to be strict in the vector when necessary.--- Suppose vector copying is implemented like this:--- --- <pre>--- copy mv v = ... write mv i (v ! i) ...--- </pre>--- --- For lazy vectors, <tt>v ! i</tt> would not be evaluated which means--- that <tt>mv</tt> would unnecessarily retain a reference to <tt>v</tt>--- in each element written.--- --- With <a>indexM</a>, copying can be implemented like this instead:--- --- <pre>--- copy mv v = ... do--- x <- indexM v i--- write mv i x--- </pre>--- --- Here, no references to <tt>v</tt> are retained because indexing (but--- <i>not</i> the elements) is evaluated eagerly.-indexM :: Monad m => Vector a -> Int -> m a---- | <i>O(1)</i> First element of a vector in a monad. See <a>indexM</a>--- for an explanation of why this is useful.-headM :: Monad m => Vector a -> m a---- | <i>O(1)</i> Last element of a vector in a monad. See <a>indexM</a> for--- an explanation of why this is useful.-lastM :: Monad m => Vector a -> m a---- | <i>O(1)</i> Indexing in a monad without bounds checks. See--- <a>indexM</a> for an explanation of why this is useful.-unsafeIndexM :: Monad m => Vector a -> Int -> m a---- | <i>O(1)</i> First element in a monad without checking for empty--- vectors. See <a>indexM</a> for an explanation of why this is useful.-unsafeHeadM :: Monad m => Vector a -> m a---- | <i>O(1)</i> Last element in a monad without checking for empty--- vectors. See <a>indexM</a> for an explanation of why this is useful.-unsafeLastM :: Monad m => Vector a -> m a---- | <i>O(1)</i> Yield a slice of the vector without copying it. The vector--- must contain at least <tt>i+n</tt> elements.-slice :: Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty.-init :: Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty.-tail :: Vector a -> Vector a---- | <i>O(1)</i> Yield at the first <tt>n</tt> elements without copying.--- The vector may contain less than <tt>n</tt> elements in which case it--- is returned unchanged.-take :: Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector may contain less than <tt>n</tt> elements in which--- case an empty vector is returned.-drop :: Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements paired with the--- remainder without copying.--- --- Note that <tt><a>splitAt</a> n v</tt> is equivalent to--- <tt>(<a>take</a> n v, <a>drop</a> n v)</tt> but slightly more--- efficient.-splitAt :: Int -> Vector a -> (Vector a, Vector a)---- | <i>O(1)</i> Yield a slice of the vector without copying. The vector--- must contain at least <tt>i+n</tt> elements but this is not checked.-unsafeSlice :: Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty but this is not checked.-unsafeInit :: Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty but this is not checked.-unsafeTail :: Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements without copying. The--- vector must contain at least <tt>n</tt> elements but this is not--- checked.-unsafeTake :: Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector must contain at least <tt>n</tt> elements but this--- is not checked.-unsafeDrop :: Int -> Vector a -> Vector a---- | <i>O(1)</i> Empty vector-empty :: Vector a---- | <i>O(1)</i> Vector with exactly one element-singleton :: a -> Vector a---- | <i>O(n)</i> Vector of the given length with the same value in each--- position-replicate :: Int -> a -> Vector a---- | <i>O(n)</i> Construct a vector of the given length by applying the--- function to each index-generate :: Int -> (Int -> a) -> Vector a---- | <i>O(n)</i> Apply function n times to value. Zeroth element is--- original value.-iterateN :: Int -> (a -> a) -> a -> Vector a---- | <i>O(n)</i> Execute the monadic action the given number of times and--- store the results in a vector.-replicateM :: Monad m => Int -> m a -> m (Vector a)---- | <i>O(n)</i> Construct a vector of the given length by applying the--- monadic action to each index-generateM :: Monad m => Int -> (Int -> m a) -> m (Vector a)---- | Execute the monadic action and freeze the resulting vector.--- --- <pre>--- create (do { v <- new 2; write v 0 'a'; write v 1 'b' }) = <<tt>a</tt>,<tt>b</tt>>--- </pre>-create :: (forall s. ST s (MVector s a)) -> Vector a---- | <i>O(n)</i> Construct a vector by repeatedly applying the generator--- function to a seed. The generator function yields <a>Just</a> the next--- element and the new seed or <a>Nothing</a> if there are no more--- elements.--- --- <pre>--- unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10--- = <10,9,8,7,6,5,4,3,2,1>--- </pre>-unfoldr :: (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with at most <tt>n</tt> by repeatedly--- applying the generator function to the a seed. The generator function--- yields <a>Just</a> the next element and the new seed or <a>Nothing</a>--- if there are no more elements.--- --- <pre>--- unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>--- </pre>-unfoldrN :: Int -> (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements by repeatedly--- applying the generator function to the already constructed part of the--- vector.--- --- <pre>--- constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>--- </pre>-constructN :: Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements from right to--- left by repeatedly applying the generator function to the already--- constructed part of the vector.--- --- <pre>--- constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>--- </pre>-constructrN :: Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+1</tt> etc. This operation is usually more efficient--- than <a>enumFromTo</a>.--- --- <pre>--- enumFromN 5 3 = <5,6,7>--- </pre>-enumFromN :: Num a => a -> Int -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. This operations is--- usually more efficient than <a>enumFromThenTo</a>.--- --- <pre>--- enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>--- </pre>-enumFromStepN :: Num a => a -> a -> Int -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromN</a> instead.-enumFromTo :: Enum a => a -> a -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt> with a--- specific step <tt>z</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: Enum a => a -> a -> a -> Vector a---- | <i>O(n)</i> Prepend an element-cons :: a -> Vector a -> Vector a---- | <i>O(n)</i> Append an element-snoc :: Vector a -> a -> Vector a---- | <i>O(m+n)</i> Concatenate two vectors-(++) :: Vector a -> Vector a -> Vector a---- | <i>O(n)</i> Concatenate all vectors in the list-concat :: [Vector a] -> Vector a---- | <i>O(n)</i> Yield the argument but force it not to retain any extra--- memory, possibly by copying it.--- --- This is especially useful when dealing with slices. For example:--- --- <pre>--- force (slice 0 2 <huge vector>)--- </pre>--- --- Here, the slice retains a reference to the huge vector. Forcing it--- creates a copy of just the elements that belong to the slice and--- allows the huge vector to be garbage collected.-force :: Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the--- vector element at position <tt>i</tt> by <tt>a</tt>.--- --- <pre>--- <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>--- </pre>-(//) :: Vector a -> [(Int, a)] -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the vector of--- index/value pairs, replace the vector element at position <tt>i</tt>--- by <tt>a</tt>.--- --- <pre>--- update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>--- </pre>-update :: Vector a -> Vector (Int, a) -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>a</tt> from the value vector, replace--- the element of the initial vector at position <tt>i</tt> by--- <tt>a</tt>.--- --- <pre>--- update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>--- </pre>--- --- The function <a>update</a> provides the same functionality and is--- usually more convenient.--- --- <pre>--- update_ xs is ys = <a>update</a> xs (<a>zip</a> is ys)--- </pre>-update_ :: Vector a -> Vector Int -> Vector a -> Vector a---- | Same as (<a>//</a>) but without bounds checking.-unsafeUpd :: Vector a -> [(Int, a)] -> Vector a---- | Same as <a>update</a> but without bounds checking.-unsafeUpdate :: Vector a -> Vector (Int, a) -> Vector a---- | Same as <a>update_</a> but without bounds checking.-unsafeUpdate_ :: Vector a -> Vector Int -> Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the--- vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.--- --- <pre>--- accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>--- </pre>-accum :: (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the vector of pairs,--- replace the vector element <tt>a</tt> at position <tt>i</tt> by <tt>f--- a b</tt>.--- --- <pre>--- accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>--- </pre>-accumulate :: (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>b</tt> from the the value vector,--- replace the element of the initial vector at position <tt>i</tt> by--- <tt>f a b</tt>.--- --- <pre>--- accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>--- </pre>--- --- The function <a>accumulate</a> provides the same functionality and is--- usually more convenient.--- --- <pre>--- accumulate_ f as is bs = <a>accumulate</a> f as (<a>zip</a> is bs)--- </pre>-accumulate_ :: (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | Same as <a>accum</a> but without bounds checking.-unsafeAccum :: (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | Same as <a>accumulate</a> but without bounds checking.-unsafeAccumulate :: (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a---- | Same as <a>accumulate_</a> but without bounds checking.-unsafeAccumulate_ :: (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | <i>O(n)</i> Reverse a vector-reverse :: Vector a -> Vector a---- | <i>O(n)</i> Yield the vector obtained by replacing each element--- <tt>i</tt> of the index vector by <tt>xs<a>!</a>i</tt>. This is--- equivalent to <tt><a>map</a> (xs<a>!</a>) is</tt> but is often much--- more efficient.--- --- <pre>--- backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>--- </pre>-backpermute :: Vector a -> Vector Int -> Vector a---- | Same as <a>backpermute</a> but without bounds checking.-unsafeBackpermute :: Vector a -> Vector Int -> Vector a---- | Apply a destructive operation to a vector. The operation will be--- performed in place if it is safe to do so and will modify a copy of--- the vector otherwise.--- --- <pre>--- modify (\v -> write v 0 'x') (<a>replicate</a> 3 'a') = <'x','a','a'>--- </pre>-modify :: (forall s. MVector s a -> ST s ()) -> Vector a -> Vector a---- | <i>O(n)</i> Pair each element in a vector with its index-indexed :: Vector a -> Vector (Int, a)---- | <i>O(n)</i> Map a function over a vector-map :: (a -> b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply a function to every element of a vector and its--- index-imap :: (Int -> a -> b) -> Vector a -> Vector b---- | Map a function over a vector and concatenate the results.-concatMap :: (a -> Vector b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results-mapM :: Monad m => (a -> m b) -> Vector a -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results-mapM_ :: Monad m => (a -> m b) -> Vector a -> m ()---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.-forM :: Monad m => Vector a -> (a -> m b) -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.-forM_ :: Monad m => Vector a -> (a -> m b) -> m ()---- | <i>O(min(m,n))</i> Zip two vectors with the given function.-zipWith :: (a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors with the given function.-zipWith3 :: (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-zipWith4 :: (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-zipWith5 :: (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(min(m,n))</i> Zip two vectors with a function that also takes the--- elements' indices.-izipWith :: (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors and their indices with the given function.-izipWith3 :: (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-izipWith4 :: (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-izipWith5 :: (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-izipWith6 :: (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | Elementwise pairing of array elements.-zip :: Vector a -> Vector b -> Vector (a, b)---- | zip together three vectors into a vector of triples-zip3 :: Vector a -> Vector b -> Vector c -> Vector (a, b, c)-zip4 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector (a, b, c, d)-zip5 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector (a, b, c, d, e)-zip6 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector (a, b, c, d, e, f)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- yield a vector of results-zipWithM :: Monad m => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- ignore the results-zipWithM_ :: Monad m => (a -> b -> m c) -> Vector a -> Vector b -> m ()---- | <i>O(min(m,n))</i> Unzip a vector of pairs.-unzip :: Vector (a, b) -> (Vector a, Vector b)-unzip3 :: Vector (a, b, c) -> (Vector a, Vector b, Vector c)-unzip4 :: Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d)-unzip5 :: Vector (a, b, c, d, e) -> (Vector a, Vector b, Vector c, Vector d, Vector e)-unzip6 :: Vector (a, b, c, d, e, f) -> (Vector a, Vector b, Vector c, Vector d, Vector e, Vector f)---- | <i>O(n)</i> Drop elements that do not satisfy the predicate-filter :: (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the predicate which is--- applied to values and their indices-ifilter :: (Int -> a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the monadic predicate-filterM :: Monad m => (a -> m Bool) -> Vector a -> m (Vector a)---- | <i>O(n)</i> Yield the longest prefix of elements satisfying the--- predicate without copying.-takeWhile :: (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop the longest prefix of elements that satisfy the--- predicate without copying.-dropWhile :: (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The relative order of the elements is preserved at the--- cost of a sometimes reduced performance compared to--- <a>unstablePartition</a>.-partition :: (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The order of the elements is not preserved but the--- operation is often faster than <a>partition</a>.-unstablePartition :: (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- satisfy the predicate and the rest without copying.-span :: (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- do not satisfy the predicate and the rest without copying.-break :: (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Check if the vector contains an element-elem :: Eq a => a -> Vector a -> Bool---- | <i>O(n)</i> Check if the vector does not contain an element (inverse--- of <a>elem</a>)-notElem :: Eq a => a -> Vector a -> Bool---- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate--- or <a>Nothing</a> if no such element exists.-find :: (a -> Bool) -> Vector a -> Maybe a---- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching--- the predicate or <a>Nothing</a> if no such element exists.-findIndex :: (a -> Bool) -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of elements satisfying the predicate in--- ascending order.-findIndices :: (a -> Bool) -> Vector a -> Vector Int---- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the--- given element or <a>Nothing</a> if the vector does not contain the--- element. This is a specialised version of <a>findIndex</a>.-elemIndex :: Eq a => a -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of all occurences of the given element--- in ascending order. This is a specialised version of--- <a>findIndices</a>.-elemIndices :: Eq a => a -> Vector a -> Vector Int---- | <i>O(n)</i> Left fold-foldl :: (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors-foldl1 :: (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold with strict accumulator-foldl' :: (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator-foldl1' :: (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold-foldr :: (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors-foldr1 :: (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold with a strict accumulator-foldr' :: (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator-foldr1' :: (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold (function applied to each element and its index)-ifoldl :: (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold with strict accumulator (function applied to--- each element and its index)-ifoldl' :: (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Right fold (function applied to each element and its--- index)-ifoldr :: (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold with strict accumulator (function applied to--- each element and its index)-ifoldr' :: (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Check if all elements satisfy the predicate.-all :: (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if any element satisfies the predicate.-any :: (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if all elements are <a>True</a>-and :: Vector Bool -> Bool---- | <i>O(n)</i> Check if any element is <a>True</a>-or :: Vector Bool -> Bool---- | <i>O(n)</i> Compute the sum of the elements-sum :: Num a => Vector a -> a---- | <i>O(n)</i> Compute the produce of the elements-product :: Num a => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector. The vector may--- not be empty.-maximum :: Ord a => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector according to the--- given comparison function. The vector may not be empty.-maximumBy :: (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector. The vector may--- not be empty.-minimum :: Ord a => Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector according to the--- given comparison function. The vector may not be empty.-minimumBy :: (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the index of the minimum element of the vector. The--- vector may not be empty.-minIndex :: Ord a => Vector a -> Int---- | <i>O(n)</i> Yield the index of the minimum element of the vector--- according to the given comparison function. The vector may not be--- empty.-minIndexBy :: (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector. The--- vector may not be empty.-maxIndex :: Ord a => Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector--- according to the given comparison function. The vector may not be--- empty.-maxIndexBy :: (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Monadic fold-foldM :: Monad m => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold with strict accumulator-foldM' :: Monad m => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors-fold1M :: Monad m => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator-fold1M' :: Monad m => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold that discards the result-foldM_ :: Monad m => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold with strict accumulator that discards the--- result-foldM'_ :: Monad m => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the--- result-fold1M_ :: Monad m => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator that discards the result-fold1M'_ :: Monad m => (a -> a -> m a) -> Vector a -> m ()---- | Evaluate each action and collect the results-sequence :: Monad m => Vector (m a) -> m (Vector a)---- | Evaluate each action and discard the results-sequence_ :: Monad m => Vector (m a) -> m ()---- | <i>O(n)</i> Prescan--- --- <pre>--- prescanl f z = <a>init</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>prescanl (+) 0 <1,2,3,4> = <0,1,3,6></tt>-prescanl :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Prescan with strict accumulator-prescanl' :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan--- --- <pre>--- postscanl f z = <a>tail</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>postscanl (+) 0 <1,2,3,4> = <1,3,6,10></tt>-postscanl :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan with strict accumulator-postscanl' :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan--- --- <pre>--- scanl f z <x1,...,xn> = <y1,...,y(n+1)>--- where y1 = z--- yi = f y(i-1) x(i-1)--- </pre>--- --- Example: <tt>scanl (+) 0 <1,2,3,4> = <0,1,3,6,10></tt>-scanl :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan with strict accumulator-scanl' :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector--- --- <pre>--- scanl f <x1,...,xn> = <y1,...,yn>--- where y1 = x1--- yi = f y(i-1) xi--- </pre>-scanl1 :: (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator-scanl1' :: (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left prescan--- --- <pre>--- prescanr f z = <a>reverse</a> . <a>prescanl</a> (flip f) z . <a>reverse</a>--- </pre>-prescanr :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left prescan with strict accumulator-prescanr' :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan-postscanr :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan with strict accumulator-postscanr' :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan-scanr :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator-scanr' :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan over a non-empty vector-scanr1 :: (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict--- accumulator-scanr1' :: (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Convert a vector to a list-toList :: Vector a -> [a]---- | <i>O(n)</i> Convert a list to a vector-fromList :: [a] -> Vector a---- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a--- vector--- --- <pre>--- fromListN n xs = <a>fromList</a> (<a>take</a> n xs)--- </pre>-fromListN :: Int -> [a] -> Vector a---- | <i>O(n)</i> Convert different vector types-convert :: (Vector v a, Vector w a) => v a -> w a---- | <i>O(n)</i> Yield an immutable copy of the mutable vector.-freeze :: PrimMonad m => MVector (PrimState m) a -> m (Vector a)---- | <i>O(n)</i> Yield a mutable copy of the immutable vector.-thaw :: PrimMonad m => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length.-copy :: PrimMonad m => MVector (PrimState m) a -> Vector a -> m ()---- | <i>O(1)</i> Unsafe convert a mutable vector to an immutable one--- without copying. The mutable vector may not be used after this--- operation.-unsafeFreeze :: PrimMonad m => MVector (PrimState m) a -> m (Vector a)---- | <i>O(1)</i> Unsafely convert an immutable vector to a mutable one--- without copying. The immutable vector may not be used after this--- operation.-unsafeThaw :: PrimMonad m => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length. This is not checked.-unsafeCopy :: PrimMonad m => MVector (PrimState m) a -> Vector a -> m ()-instance Typeable1 Vector-instance Traversable Vector-instance Foldable Vector-instance Alternative Vector-instance Applicative Vector-instance MonadPlus Vector-instance Monad Vector-instance Functor Vector-instance Monoid (Vector a)-instance Ord a => Ord (Vector a)-instance Eq a => Eq (Vector a)-instance Vector Vector a-instance Data a => Data (Vector a)-instance Read a => Read (Vector a)-instance Show a => Show (Vector a)----- | Safe interface to <a>Data.Vector</a>-module Data.Vector.Safe---- | Boxed vectors, supporting efficient slicing.-data Vector a---- | Mutable boxed vectors keyed on the monad they live in (<a>IO</a> or--- <tt><tt>ST</tt> s</tt>).-data MVector s a---- | <i>O(1)</i> Yield the length of the vector.-length :: Vector a -> Int---- | <i>O(1)</i> Test whether a vector if empty-null :: Vector a -> Bool---- | O(1) Indexing-(!) :: Vector a -> Int -> a---- | O(1) Safe indexing-(!?) :: Vector a -> Int -> Maybe a---- | <i>O(1)</i> First element-head :: Vector a -> a---- | <i>O(1)</i> Last element-last :: Vector a -> a---- | <i>O(1)</i> Indexing in a monad.--- --- The monad allows operations to be strict in the vector when necessary.--- Suppose vector copying is implemented like this:--- --- <pre>--- copy mv v = ... write mv i (v ! i) ...--- </pre>--- --- For lazy vectors, <tt>v ! i</tt> would not be evaluated which means--- that <tt>mv</tt> would unnecessarily retain a reference to <tt>v</tt>--- in each element written.--- --- With <a>indexM</a>, copying can be implemented like this instead:--- --- <pre>--- copy mv v = ... do--- x <- indexM v i--- write mv i x--- </pre>--- --- Here, no references to <tt>v</tt> are retained because indexing (but--- <i>not</i> the elements) is evaluated eagerly.-indexM :: Monad m => Vector a -> Int -> m a---- | <i>O(1)</i> First element of a vector in a monad. See <a>indexM</a>--- for an explanation of why this is useful.-headM :: Monad m => Vector a -> m a---- | <i>O(1)</i> Last element of a vector in a monad. See <a>indexM</a> for--- an explanation of why this is useful.-lastM :: Monad m => Vector a -> m a---- | <i>O(1)</i> Yield a slice of the vector without copying it. The vector--- must contain at least <tt>i+n</tt> elements.-slice :: Int -> Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the last element without copying. The vector--- may not be empty.-init :: Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first element without copying. The--- vector may not be empty.-tail :: Vector a -> Vector a---- | <i>O(1)</i> Yield at the first <tt>n</tt> elements without copying.--- The vector may contain less than <tt>n</tt> elements in which case it--- is returned unchanged.-take :: Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield all but the first <tt>n</tt> elements without--- copying. The vector may contain less than <tt>n</tt> elements in which--- case an empty vector is returned.-drop :: Int -> Vector a -> Vector a---- | <i>O(1)</i> Yield the first <tt>n</tt> elements paired with the--- remainder without copying.--- --- Note that <tt><a>splitAt</a> n v</tt> is equivalent to--- <tt>(<a>take</a> n v, <a>drop</a> n v)</tt> but slightly more--- efficient.-splitAt :: Int -> Vector a -> (Vector a, Vector a)---- | <i>O(1)</i> Empty vector-empty :: Vector a---- | <i>O(1)</i> Vector with exactly one element-singleton :: a -> Vector a---- | <i>O(n)</i> Vector of the given length with the same value in each--- position-replicate :: Int -> a -> Vector a---- | <i>O(n)</i> Construct a vector of the given length by applying the--- function to each index-generate :: Int -> (Int -> a) -> Vector a---- | <i>O(n)</i> Apply function n times to value. Zeroth element is--- original value.-iterateN :: Int -> (a -> a) -> a -> Vector a---- | <i>O(n)</i> Execute the monadic action the given number of times and--- store the results in a vector.-replicateM :: Monad m => Int -> m a -> m (Vector a)---- | <i>O(n)</i> Construct a vector of the given length by applying the--- monadic action to each index-generateM :: Monad m => Int -> (Int -> m a) -> m (Vector a)---- | Execute the monadic action and freeze the resulting vector.--- --- <pre>--- create (do { v <- new 2; write v 0 'a'; write v 1 'b' }) = <<tt>a</tt>,<tt>b</tt>>--- </pre>-create :: (forall s. ST s (MVector s a)) -> Vector a---- | <i>O(n)</i> Construct a vector by repeatedly applying the generator--- function to a seed. The generator function yields <a>Just</a> the next--- element and the new seed or <a>Nothing</a> if there are no more--- elements.--- --- <pre>--- unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10--- = <10,9,8,7,6,5,4,3,2,1>--- </pre>-unfoldr :: (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with at most <tt>n</tt> by repeatedly--- applying the generator function to the a seed. The generator function--- yields <a>Just</a> the next element and the new seed or <a>Nothing</a>--- if there are no more elements.--- --- <pre>--- unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>--- </pre>-unfoldrN :: Int -> (b -> Maybe (a, b)) -> b -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements by repeatedly--- applying the generator function to the already constructed part of the--- vector.--- --- <pre>--- constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>--- </pre>-constructN :: Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Construct a vector with <tt>n</tt> elements from right to--- left by repeatedly applying the generator function to the already--- constructed part of the vector.--- --- <pre>--- constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>--- </pre>-constructrN :: Int -> (Vector a -> a) -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+1</tt> etc. This operation is usually more efficient--- than <a>enumFromTo</a>.--- --- <pre>--- enumFromN 5 3 = <5,6,7>--- </pre>-enumFromN :: Num a => a -> Int -> Vector a---- | <i>O(n)</i> Yield a vector of the given length containing the values--- <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. This operations is--- usually more efficient than <a>enumFromThenTo</a>.--- --- <pre>--- enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>--- </pre>-enumFromStepN :: Num a => a -> a -> Int -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromN</a> instead.-enumFromTo :: Enum a => a -> a -> Vector a---- | <i>O(n)</i> Enumerate values from <tt>x</tt> to <tt>y</tt> with a--- specific step <tt>z</tt>.--- --- <i>WARNING:</i> This operation can be very inefficient. If at all--- possible, use <a>enumFromStepN</a> instead.-enumFromThenTo :: Enum a => a -> a -> a -> Vector a---- | <i>O(n)</i> Prepend an element-cons :: a -> Vector a -> Vector a---- | <i>O(n)</i> Append an element-snoc :: Vector a -> a -> Vector a---- | <i>O(m+n)</i> Concatenate two vectors-(++) :: Vector a -> Vector a -> Vector a---- | <i>O(n)</i> Concatenate all vectors in the list-concat :: [Vector a] -> Vector a---- | <i>O(n)</i> Yield the argument but force it not to retain any extra--- memory, possibly by copying it.--- --- This is especially useful when dealing with slices. For example:--- --- <pre>--- force (slice 0 2 <huge vector>)--- </pre>--- --- Here, the slice retains a reference to the huge vector. Forcing it--- creates a copy of just the elements that belong to the slice and--- allows the huge vector to be garbage collected.-force :: Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the--- vector element at position <tt>i</tt> by <tt>a</tt>.--- --- <pre>--- <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>--- </pre>-(//) :: Vector a -> [(Int, a)] -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the vector of--- index/value pairs, replace the vector element at position <tt>i</tt>--- by <tt>a</tt>.--- --- <pre>--- update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>--- </pre>-update :: Vector a -> Vector (Int, a) -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>a</tt> from the value vector, replace--- the element of the initial vector at position <tt>i</tt> by--- <tt>a</tt>.--- --- <pre>--- update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>--- </pre>--- --- The function <a>update</a> provides the same functionality and is--- usually more convenient.--- --- <pre>--- update_ xs is ys = <a>update</a> xs (<a>zip</a> is ys)--- </pre>-update_ :: Vector a -> Vector Int -> Vector a -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the--- vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.--- --- <pre>--- accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>--- </pre>-accum :: (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a---- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the vector of pairs,--- replace the vector element <tt>a</tt> at position <tt>i</tt> by <tt>f--- a b</tt>.--- --- <pre>--- accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>--- </pre>-accumulate :: (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a---- | <i>O(m+min(n1,n2))</i> For each index <tt>i</tt> from the index vector--- and the corresponding value <tt>b</tt> from the the value vector,--- replace the element of the initial vector at position <tt>i</tt> by--- <tt>f a b</tt>.--- --- <pre>--- accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>--- </pre>--- --- The function <a>accumulate</a> provides the same functionality and is--- usually more convenient.--- --- <pre>--- accumulate_ f as is bs = <a>accumulate</a> f as (<a>zip</a> is bs)--- </pre>-accumulate_ :: (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a---- | <i>O(n)</i> Reverse a vector-reverse :: Vector a -> Vector a---- | <i>O(n)</i> Yield the vector obtained by replacing each element--- <tt>i</tt> of the index vector by <tt>xs<a>!</a>i</tt>. This is--- equivalent to <tt><a>map</a> (xs<a>!</a>) is</tt> but is often much--- more efficient.--- --- <pre>--- backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>--- </pre>-backpermute :: Vector a -> Vector Int -> Vector a---- | Apply a destructive operation to a vector. The operation will be--- performed in place if it is safe to do so and will modify a copy of--- the vector otherwise.--- --- <pre>--- modify (\v -> write v 0 'x') (<a>replicate</a> 3 'a') = <'x','a','a'>--- </pre>-modify :: (forall s. MVector s a -> ST s ()) -> Vector a -> Vector a---- | <i>O(n)</i> Pair each element in a vector with its index-indexed :: Vector a -> Vector (Int, a)---- | <i>O(n)</i> Map a function over a vector-map :: (a -> b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply a function to every element of a vector and its--- index-imap :: (Int -> a -> b) -> Vector a -> Vector b---- | Map a function over a vector and concatenate the results.-concatMap :: (a -> Vector b) -> Vector a -> Vector b---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results-mapM :: Monad m => (a -> m b) -> Vector a -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results-mapM_ :: Monad m => (a -> m b) -> Vector a -> m ()---- | <i>O(n)</i> Apply the monadic action to all elements of the vector,--- yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.-forM :: Monad m => Vector a -> (a -> m b) -> m (Vector b)---- | <i>O(n)</i> Apply the monadic action to all elements of a vector and--- ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.-forM_ :: Monad m => Vector a -> (a -> m b) -> m ()---- | <i>O(min(m,n))</i> Zip two vectors with the given function.-zipWith :: (a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors with the given function.-zipWith3 :: (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-zipWith4 :: (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-zipWith5 :: (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | <i>O(min(m,n))</i> Zip two vectors with a function that also takes the--- elements' indices.-izipWith :: (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c---- | Zip three vectors and their indices with the given function.-izipWith3 :: (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d-izipWith4 :: (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e-izipWith5 :: (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f-izipWith6 :: (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g---- | Elementwise pairing of array elements.-zip :: Vector a -> Vector b -> Vector (a, b)---- | zip together three vectors into a vector of triples-zip3 :: Vector a -> Vector b -> Vector c -> Vector (a, b, c)-zip4 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector (a, b, c, d)-zip5 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector (a, b, c, d, e)-zip6 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector (a, b, c, d, e, f)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- yield a vector of results-zipWithM :: Monad m => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)---- | <i>O(min(m,n))</i> Zip the two vectors with the monadic action and--- ignore the results-zipWithM_ :: Monad m => (a -> b -> m c) -> Vector a -> Vector b -> m ()---- | <i>O(min(m,n))</i> Unzip a vector of pairs.-unzip :: Vector (a, b) -> (Vector a, Vector b)-unzip3 :: Vector (a, b, c) -> (Vector a, Vector b, Vector c)-unzip4 :: Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d)-unzip5 :: Vector (a, b, c, d, e) -> (Vector a, Vector b, Vector c, Vector d, Vector e)-unzip6 :: Vector (a, b, c, d, e, f) -> (Vector a, Vector b, Vector c, Vector d, Vector e, Vector f)---- | <i>O(n)</i> Drop elements that do not satisfy the predicate-filter :: (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the predicate which is--- applied to values and their indices-ifilter :: (Int -> a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop elements that do not satisfy the monadic predicate-filterM :: Monad m => (a -> m Bool) -> Vector a -> m (Vector a)---- | <i>O(n)</i> Yield the longest prefix of elements satisfying the--- predicate without copying.-takeWhile :: (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Drop the longest prefix of elements that satisfy the--- predicate without copying.-dropWhile :: (a -> Bool) -> Vector a -> Vector a---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The relative order of the elements is preserved at the--- cost of a sometimes reduced performance compared to--- <a>unstablePartition</a>.-partition :: (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector in two parts, the first one containing--- those elements that satisfy the predicate and the second one those--- that don't. The order of the elements is not preserved but the--- operation is often faster than <a>partition</a>.-unstablePartition :: (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- satisfy the predicate and the rest without copying.-span :: (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Split the vector into the longest prefix of elements that--- do not satisfy the predicate and the rest without copying.-break :: (a -> Bool) -> Vector a -> (Vector a, Vector a)---- | <i>O(n)</i> Check if the vector contains an element-elem :: Eq a => a -> Vector a -> Bool---- | <i>O(n)</i> Check if the vector does not contain an element (inverse--- of <a>elem</a>)-notElem :: Eq a => a -> Vector a -> Bool---- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate--- or <a>Nothing</a> if no such element exists.-find :: (a -> Bool) -> Vector a -> Maybe a---- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching--- the predicate or <a>Nothing</a> if no such element exists.-findIndex :: (a -> Bool) -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of elements satisfying the predicate in--- ascending order.-findIndices :: (a -> Bool) -> Vector a -> Vector Int---- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the--- given element or <a>Nothing</a> if the vector does not contain the--- element. This is a specialised version of <a>findIndex</a>.-elemIndex :: Eq a => a -> Vector a -> Maybe Int---- | <i>O(n)</i> Yield the indices of all occurences of the given element--- in ascending order. This is a specialised version of--- <a>findIndices</a>.-elemIndices :: Eq a => a -> Vector a -> Vector Int---- | <i>O(n)</i> Left fold-foldl :: (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors-foldl1 :: (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold with strict accumulator-foldl' :: (a -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator-foldl1' :: (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold-foldr :: (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors-foldr1 :: (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Right fold with a strict accumulator-foldr' :: (a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator-foldr1' :: (a -> a -> a) -> Vector a -> a---- | <i>O(n)</i> Left fold (function applied to each element and its index)-ifoldl :: (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Left fold with strict accumulator (function applied to--- each element and its index)-ifoldl' :: (a -> Int -> b -> a) -> a -> Vector b -> a---- | <i>O(n)</i> Right fold (function applied to each element and its--- index)-ifoldr :: (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Right fold with strict accumulator (function applied to--- each element and its index)-ifoldr' :: (Int -> a -> b -> b) -> b -> Vector a -> b---- | <i>O(n)</i> Check if all elements satisfy the predicate.-all :: (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if any element satisfies the predicate.-any :: (a -> Bool) -> Vector a -> Bool---- | <i>O(n)</i> Check if all elements are <a>True</a>-and :: Vector Bool -> Bool---- | <i>O(n)</i> Check if any element is <a>True</a>-or :: Vector Bool -> Bool---- | <i>O(n)</i> Compute the sum of the elements-sum :: Num a => Vector a -> a---- | <i>O(n)</i> Compute the produce of the elements-product :: Num a => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector. The vector may--- not be empty.-maximum :: Ord a => Vector a -> a---- | <i>O(n)</i> Yield the maximum element of the vector according to the--- given comparison function. The vector may not be empty.-maximumBy :: (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector. The vector may--- not be empty.-minimum :: Ord a => Vector a -> a---- | <i>O(n)</i> Yield the minimum element of the vector according to the--- given comparison function. The vector may not be empty.-minimumBy :: (a -> a -> Ordering) -> Vector a -> a---- | <i>O(n)</i> Yield the index of the minimum element of the vector. The--- vector may not be empty.-minIndex :: Ord a => Vector a -> Int---- | <i>O(n)</i> Yield the index of the minimum element of the vector--- according to the given comparison function. The vector may not be--- empty.-minIndexBy :: (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector. The--- vector may not be empty.-maxIndex :: Ord a => Vector a -> Int---- | <i>O(n)</i> Yield the index of the maximum element of the vector--- according to the given comparison function. The vector may not be--- empty.-maxIndexBy :: (a -> a -> Ordering) -> Vector a -> Int---- | <i>O(n)</i> Monadic fold-foldM :: Monad m => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold with strict accumulator-foldM' :: Monad m => (a -> b -> m a) -> a -> Vector b -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors-fold1M :: Monad m => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator-fold1M' :: Monad m => (a -> a -> m a) -> Vector a -> m a---- | <i>O(n)</i> Monadic fold that discards the result-foldM_ :: Monad m => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold with strict accumulator that discards the--- result-foldM'_ :: Monad m => (a -> b -> m a) -> a -> Vector b -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the--- result-fold1M_ :: Monad m => (a -> a -> m a) -> Vector a -> m ()---- | <i>O(n)</i> Monadic fold over non-empty vectors with strict--- accumulator that discards the result-fold1M'_ :: Monad m => (a -> a -> m a) -> Vector a -> m ()---- | Evaluate each action and collect the results-sequence :: Monad m => Vector (m a) -> m (Vector a)---- | Evaluate each action and discard the results-sequence_ :: Monad m => Vector (m a) -> m ()---- | <i>O(n)</i> Prescan--- --- <pre>--- prescanl f z = <a>init</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>prescanl (+) 0 <1,2,3,4> = <0,1,3,6></tt>-prescanl :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Prescan with strict accumulator-prescanl' :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan--- --- <pre>--- postscanl f z = <a>tail</a> . <a>scanl</a> f z--- </pre>--- --- Example: <tt>postscanl (+) 0 <1,2,3,4> = <1,3,6,10></tt>-postscanl :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan with strict accumulator-postscanl' :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan--- --- <pre>--- scanl f z <x1,...,xn> = <y1,...,y(n+1)>--- where y1 = z--- yi = f y(i-1) x(i-1)--- </pre>--- --- Example: <tt>scanl (+) 0 <1,2,3,4> = <0,1,3,6,10></tt>-scanl :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Haskell-style scan with strict accumulator-scanl' :: (a -> b -> a) -> a -> Vector b -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector--- --- <pre>--- scanl f <x1,...,xn> = <y1,...,yn>--- where y1 = x1--- yi = f y(i-1) xi--- </pre>-scanl1 :: (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator-scanl1' :: (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left prescan--- --- <pre>--- prescanr f z = <a>reverse</a> . <a>prescanl</a> (flip f) z . <a>reverse</a>--- </pre>-prescanr :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left prescan with strict accumulator-prescanr' :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan-postscanr :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan with strict accumulator-postscanr' :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan-scanr :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator-scanr' :: (a -> b -> b) -> b -> Vector a -> Vector b---- | <i>O(n)</i> Right-to-left scan over a non-empty vector-scanr1 :: (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict--- accumulator-scanr1' :: (a -> a -> a) -> Vector a -> Vector a---- | <i>O(n)</i> Convert a vector to a list-toList :: Vector a -> [a]---- | <i>O(n)</i> Convert a list to a vector-fromList :: [a] -> Vector a---- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a--- vector--- --- <pre>--- fromListN n xs = <a>fromList</a> (<a>take</a> n xs)--- </pre>-fromListN :: Int -> [a] -> Vector a---- | <i>O(n)</i> Convert different vector types-convert :: (Vector v a, Vector w a) => v a -> w a---- | <i>O(n)</i> Yield an immutable copy of the mutable vector.-freeze :: PrimMonad m => MVector (PrimState m) a -> m (Vector a)---- | <i>O(n)</i> Yield a mutable copy of the immutable vector.-thaw :: PrimMonad m => Vector a -> m (MVector (PrimState m) a)---- | <i>O(n)</i> Copy an immutable vector into a mutable one. The two--- vectors must have the same length.-copy :: PrimMonad m => MVector (PrimState m) a -> Vector a -> m ()----- | Safe interface to <a>Data.Vector.Mutable</a>-module Data.Vector.Mutable.Safe---- | Mutable boxed vectors keyed on the monad they live in (<a>IO</a> or--- <tt><tt>ST</tt> s</tt>).-data MVector s a-type IOVector = MVector RealWorld-type STVector s = MVector s---- | Length of the mutable vector.-length :: MVector s a -> Int---- | Check whether the vector is empty-null :: MVector s a -> Bool---- | Yield a part of the mutable vector without copying it.-slice :: Int -> Int -> MVector s a -> MVector s a-init :: MVector s a -> MVector s a-tail :: MVector s a -> MVector s a-take :: Int -> MVector s a -> MVector s a-drop :: Int -> MVector s a -> MVector s a-splitAt :: Int -> MVector s a -> (MVector s a, MVector s a)-overlaps :: MVector s a -> MVector s a -> Bool---- | Create a mutable vector of the given length.-new :: PrimMonad m => Int -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with an initial value.-replicate :: PrimMonad m => Int -> a -> m (MVector (PrimState m) a)---- | Create a mutable vector of the given length (0 if the length is--- negative) and fill it with values produced by repeatedly executing the--- monadic action.-replicateM :: PrimMonad m => Int -> m a -> m (MVector (PrimState m) a)---- | Create a copy of a mutable vector.-clone :: PrimMonad m => MVector (PrimState m) a -> m (MVector (PrimState m) a)---- | Grow a vector by the given number of elements. The number must be--- positive.-grow :: PrimMonad m => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a)---- | Reset all elements of the vector to some undefined value, clearing all--- references to external objects. This is usually a noop for unboxed--- vectors.-clear :: PrimMonad m => MVector (PrimState m) a -> m ()---- | Yield the element at the given position.-read :: PrimMonad m => MVector (PrimState m) a -> Int -> m a---- | Replace the element at the given position.-write :: PrimMonad m => MVector (PrimState m) a -> Int -> a -> m ()---- | Swap the elements at the given positions.-swap :: PrimMonad m => MVector (PrimState m) a -> Int -> Int -> m ()---- | Set all elements of the vector to the given value.-set :: PrimMonad m => MVector (PrimState m) a -> a -> m ()---- | Copy a vector. The two vectors must have the same length and may not--- overlap.-copy :: PrimMonad m => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()---- | Move the contents of a vector. The two vectors must have the same--- length.--- --- If the vectors do not overlap, then this is equivalent to <a>copy</a>.--- Otherwise, the copying is performed as if the source vector were--- copied to a temporary vector and then the temporary vector was copied--- to the target vector.-move :: PrimMonad m => MVector (PrimState m) a -> MVector (PrimState m) a -> m ()
− data/wai.txt
@@ -1,127 +0,0 @@--- Hoogle documentation, generated by Haddock--- See Hoogle, http://www.haskell.org/hoogle/----- | Web Application Interface.--- --- Provides a common protocol for communication between web aplications--- and web servers.-@package wai-@version 0.4.1----- | This module defines a generic web application interface. It is a--- common protocol between web servers and web applications.--- --- The overriding design principles here are performance and generality .--- To address performance, this library is built on top of the enumerator--- and blaze-builder packages. The advantages of enumerators over lazy IO--- have been debated elsewhere and so will not be addressed here.--- However, helper functions like <a>responseLBS</a> allow you to--- continue using lazy IO if you so desire.--- --- Generality is achieved by removing many variables commonly found in--- similar projects that are not universal to all servers. The goal is--- that the <a>Request</a> object contains only data which is meaningful--- in all circumstances.--- --- Please remember when using this package that, while your application--- may compile without a hitch against many different servers, there are--- other considerations to be taken when moving to a new backend. For--- example, if you transfer from a CGI application to a FastCGI one, you--- might suddenly find you have a memory leak. Conversely, a FastCGI--- application would be well served to preload all templates from disk--- when first starting; this would kill the performance of a CGI--- application.--- --- This package purposely provides very little functionality. You can--- find various middlewares, backends and utilities on Hackage. Some of--- the most commonly used include:--- --- <ul>--- <li><i>warp</i> <a>http://hackage.haskell.org/package/warp</a></li>--- <li><i>wai-extra</i>--- <a>http://hackage.haskell.org/package/wai-extra</a></li>--- <li><i>wai-test</i>--- <a>http://hackage.haskell.org/package/wai-test</a></li>--- </ul>-module Network.Wai---- | Information on the request sent by the client. This abstracts away the--- details of the underlying implementation.-data Request-Request :: Method -> HttpVersion -> ByteString -> ByteString -> ByteString -> Int -> RequestHeaders -> Bool -> SockAddr -> [Text] -> Query -> Request-requestMethod :: Request -> Method-httpVersion :: Request -> HttpVersion---- | Extra path information sent by the client. The meaning varies slightly--- depending on backend; in a standalone server setting, this is most--- likely all information after the domain name. In a CGI application,--- this would be the information following the path to the CGI executable--- itself. Do not modify this raw value- modify pathInfo instead.-rawPathInfo :: Request -> ByteString---- | If no query string was specified, this should be empty. This value--- <i>will</i> include the leading question mark. Do not modify this raw--- value- modify queryString instead.-rawQueryString :: Request -> ByteString---- | Generally the host requested by the user via the Host request header.--- Backends are free to provide alternative values as necessary. This--- value should not be used to construct URLs.-serverName :: Request -> ByteString---- | The listening port that the server received this request on. It is--- possible for a server to listen on a non-numeric port (i.e., Unix--- named socket), in which case this value will be arbitrary. Like--- <a>serverName</a>, this value should not be used in URL construction.-serverPort :: Request -> Int-requestHeaders :: Request -> RequestHeaders---- | Was this request made over an SSL connection?-isSecure :: Request -> Bool---- | The client's host information.-remoteHost :: Request -> SockAddr---- | Path info in individual pieces- the url without a hostname/port and--- without a query string, split on forward slashes,-pathInfo :: Request -> [Text]---- | Parsed query string information-queryString :: Request -> Query-data Response-ResponseFile :: Status -> ResponseHeaders -> FilePath -> (Maybe FilePart) -> Response-ResponseBuilder :: Status -> ResponseHeaders -> Builder -> Response-ResponseEnumerator :: (forall a. ResponseEnumerator a) -> Response-type ResponseEnumerator a = (Status -> ResponseHeaders -> Iteratee Builder IO a) -> IO a-responseEnumerator :: Response -> ResponseEnumerator a-type Application = Request -> Iteratee ByteString IO Response---- | Middleware is a component that sits between the server and--- application. It can do such tasks as GZIP encoding or response--- caching. What follows is the general definition of middleware, though--- a middleware author should feel free to modify this.--- --- As an example of an alternate type for middleware, suppose you write a--- function to load up session information. The session information is--- simply a string map [(String, String)]. A logical type signatures for--- this middleware might be:--- --- <pre>--- loadSession :: ([(String, String)] -> Application) -> Application--- </pre>--- --- Here, instead of taking a standard <a>Application</a> as its first--- argument, the middleware takes a function which consumes the session--- information as well.-type Middleware = Application -> Application-data FilePart-FilePart :: Integer -> Integer -> FilePart-filePartOffset :: FilePart -> Integer-filePartByteCount :: FilePart -> Integer-responseLBS :: Status -> ResponseHeaders -> ByteString -> Response-instance Typeable Request-instance Typeable Response-instance Show Request-instance Show FilePart
− data/warp.txt
@@ -1,91 +0,0 @@--- Hoogle documentation, generated by Haddock--- See Hoogle, http://www.haskell.org/hoogle/----- | A fast, light-weight web server for WAI applications.--- --- The premier WAI handler. For more information, see--- <a>http://steve.vinoski.net/blog/2011/05/01/warp-a-haskell-web-server/</a>.-@package warp-@version 0.4.4----- | A fast, light-weight HTTP server handler for WAI. Some random notes (a--- FAQ, if you will):--- --- <ul>--- <li>When a <a>ResponseFile</a> indicates a file which does not exist,--- an exception is thrown. This will close the connection to the client--- as well. You should handle file existance checks at the application--- level.</li>--- </ul>-module Network.Wai.Handler.Warp---- | Run an <a>Application</a> on the given port. This calls--- <a>runSettings</a> with <a>defaultSettings</a>.-run :: Port -> Application -> IO ()---- | Run a Warp server with the given settings.-runSettings :: Settings -> Application -> IO ()---- | Same as <a>runSettings</a>, but uses a user-supplied socket instead of--- opening one. This allows the user to provide, for example, Unix named--- socket, which can be used when reverse HTTP proxying into your--- application.--- --- Note that the <a>settingsPort</a> will still be passed to--- <a>Application</a>s via the <a>serverPort</a> record.-runSettingsSocket :: Settings -> Socket -> Application -> IO ()---- | Various Warp server settings. This is purposely kept as an abstract--- data type so that new settings can be added without breaking backwards--- compatibility. In order to create a <a>Settings</a> value, use--- <a>defaultSettings</a> and record syntax to modify individual records.--- For example:--- --- <pre>--- defaultSettings { settingsTimeout = 20 }--- </pre>-data Settings---- | The default settings for the Warp server. See the individual settings--- for the default value.-defaultSettings :: Settings---- | Port to listen on. Default value: 3000-settingsPort :: Settings -> Int---- | Host to bind to, or * for all. Default value: *-settingsHost :: Settings -> String---- | What to do with exceptions thrown by either the application or server.--- Default: ignore server-generated exceptions (see--- <a>InvalidRequest</a>) and print application-generated applications to--- stderr.-settingsOnException :: Settings -> SomeException -> IO ()---- | Timeout value in seconds. Default value: 30-settingsTimeout :: Settings -> Int-type Port = Int-data InvalidRequest-NotEnoughLines :: [String] -> InvalidRequest-BadFirstLine :: String -> InvalidRequest-NonHttp :: InvalidRequest-IncompleteHeaders :: InvalidRequest-OverLargeHeader :: InvalidRequest---- | A timeout manager-data Manager---- | Call the inner function with a timeout manager.-withManager :: Int -> (Manager -> IO a) -> IO a-parseRequest :: Port -> SockAddr -> Iteratee ByteString IO (Integer, Request)-sendResponse :: Handle -> Request -> Socket -> Response -> IO Bool-registerKillThread :: Manager -> IO Handle-bindPort :: Int -> String -> IO Socket-enumSocket :: Handle -> Int -> Socket -> Enumerator ByteString IO a-resume, pause :: Handle -> IO ()-instance Typeable InvalidRequest-instance Show InvalidRequest-instance Eq InvalidRequest-instance Exception InvalidRequest
scion-browser.cabal view
@@ -1,5 +1,5 @@ name: scion-browser-version: 0.1.3+version: 0.1.3.1 cabal-version: >= 1.8 build-type: Simple license: BSD3@@ -31,7 +31,7 @@ zlib == 0.5.*, HTTP >= 4000 && < 5000, deepseq >= 1.1 && < 2,- aeson >= 0.3.2,+ aeson-native >= 0.3.2, parallel-io >= 0.3, utf8-string , -- For Scion.packages (provisional)@@ -86,7 +86,7 @@ zlib == 0.5.*, HTTP >= 4000 && < 5000, deepseq >= 1.1 && < 2,- aeson >= 0.3.2,+ aeson-native >= 0.3.2, parallel-io >= 0.3, utf8-string , -- For Scion.packages (provisional)
scion-browser.cabal~ view
@@ -1,5 +1,5 @@ name: scion-browser-version: 0.1.3+version: 0.1.3.1 cabal-version: >= 1.8 build-type: Simple license: BSD3@@ -31,7 +31,7 @@ zlib == 0.5.*, HTTP >= 4000 && < 5000, deepseq >= 1.1 && < 2,- aeson >= 0.3.2,+ aeson-native >= 0.3.2, parallel-io >= 0.3, utf8-string , -- For Scion.packages (provisional)@@ -86,7 +86,7 @@ zlib == 0.5.*, HTTP >= 4000 && < 5000, deepseq >= 1.1 && < 2,- aeson >= 0.3.2,+ aeson-native >= 0.3.2, parallel-io >= 0.3, utf8-string , -- For Scion.packages (provisional)@@ -118,6 +118,7 @@ test-suite BrowserTests main-is: Test.hs type: exitcode-stdio-1.0+ x-uses-tf: true ghc-options: -Wall -rtsopts hs-source-dirs: src, test other-modules: Scion.Browser.Parser.Documentable, Scion.Browser.Parser.Internal, Scion.Browser.Parser, Scion.Browser.ParserTests@@ -145,7 +146,7 @@ zlib == 0.5.*, HTTP >= 4000 && < 5000, deepseq >= 1.1 && < 2,- aeson >= 0.3.2,+ aeson-native >= 0.3.2, parallel-io >= 0.3, utf8-string , -- For Scion.packages (provisional)
− test/Scion/Browser/ParserTests.hs
@@ -1,84 +0,0 @@--module Scion.Browser.ParserTests where--import Scion.Browser.Parser-import Scion.Browser.Types-import Scion.Browser.Util-import qualified Data.Map as M-import Test.HUnit-import Language.Haskell.Exts.Annotated.Syntax-import System.Directory-import System.FilePath-import Data.Serialize-import Data.List-import qualified Data.Aeson as A-import qualified Data.ByteString.Lazy.UTF8 as LBS-import qualified Data.ByteString.Lazy.Char8 as LBS-import qualified Language.Haskell.Exts.Parser as Parser-import Language.Haskell.Exts.Extension-import Data.List.Split---import Scion.Browser.FileUtil--parserTests :: [Test]-parserTests = checkTypeParse:checkValids--checkValids :: [Test]-checkValids=map (\(f,exps)->TestLabel ("Testing parsing "++f) (TestCase (checkValid f exps))) [- ("warp",[("Network.Wai.Handler.Warp",["run","resume,pause","Settings","Manager"])])- ,("wai",[("Network.Wai",[])])- ,("vector",[("Data.Vector.Storable.Internal",["getPtr"]),("Data.Vector",["Vector","length"])])- ,("ghc-mtl",[("Control.Monad.Ghc",["runGhc","Ghc"])])- ,("html",[("Text.Html",["HtmlElement","markupContent"])])- ,("containers",[("Data.Tree",["Tree","drawTree"])])- ,("haskell98",[("Maybe",["Maybe","isJust"])])- ,("haskell2010",[("Data.Array",["Array","ixmap"]),("Data.Complex",["(:+)"])])- ,("ghc-prim",[])- ,("base-unicode-symbols",[("Data.Ord.Unicode",["(≯)"]),("Control.Arrow.Unicode",["(⋙)"])])- ]--checkValid :: String -> [(String,[String])] -> IO()-checkValid name exps=do- let f="data" </> addExtension name "txt"- fe<-doesFileExist f- assertBool (f++" does not exist") fe- --Just txt<-downloadHoogleFile "http://hackage.haskell.org/packages/archive/warp/0.4.4/doc/html/warp.txt"- --- --let res=parseHoogleString "<package>" txt- res<-parseHoogleFile f- case res of- Right p@(Package _ pid m)->do- mapM_ (checkPresence m) exps- let db=pkgListToDb [p]- let bs=encode db- case ((decode bs)::Either String Database) of- Left _ -> assertFailure "cannot decode db"- Right db2 ->do- let mp=M.lookup pid db2- case mp of- Just (Package _ _ m2) -> mapM_ (checkPresence m2) exps- Nothing -> assertFailure "cannot find pkg"- Left e->assertFailure $ show e--checkPresence :: (M.Map String (Documented Module)) -> (String,[String]) -> IO()-checkPresence m (modName,exps)=do- let mmod=M.lookup modName m- case mmod of- Nothing->assertFailure ("module not found:" ++ modName)- Just (Module _ _ _ _ decls)->do- let names=map getName decls- mapM_ (\e->assertBool e (elem e names)) exps- let res=A.toJSON decls- let output=LBS.toString (A.encode res)- assertBool modName (not $ isInfixOf "not parsed" output)- mapM_ (\e->mapM_ (\e2->assertBool e2 (isInfixOf e2 output))(splitOn "," e)) exps- return ()- -checkTypeParse :: Test-checkTypeParse= TestLabel "Testing checkTypeParse" (TestCase (do- let parseString="Category (⇝) => (α ⇝ β) -> (β ⇝ γ) -> (α ⇝ γ)" -- does not work if I remove the brackets around the first squiggly arrow- let parseTypeMode=Parser.ParseMode "" knownExtensions False False Nothing- let parsed = Parser.parseTypeWithMode parseTypeMode parseString - case parsed of- Parser.ParseFailed _ msg -> assertFailure msg- Parser.ParseOk _ -> return ()- ))
− test/Test.hs
@@ -1,9 +0,0 @@--import Scion.Browser.ParserTests--import Test.Framework (defaultMain, testGroup)-import Test.Framework.Providers.HUnit--main = defaultMain tests--tests = [testGroup "Parser Tests" (concatMap (hUnitTestToTests) parserTests)]