-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Fast unboxed arrays with a flexible interface
--
-- Fast unboxed arrays with a flexible interface. The library is built of
-- fusible combinators, as described in the paper /Stream Fusion: From
-- Lists to Streams to Nothing at All/.
--
-- For best results, compile with your user programs with -O2 -fvia-C
-- -optc-O2.
@package uvector
@version 0.1.0.2
module Data.Array.Vector
-- | Basic operations on representation types
-- -----------------------------------------
--
-- This type class determines the types that can be elements immutable
-- unboxed arrays. The representation type of these arrays is defined by
-- way of an associated type. All representation-dependent functions are
-- methods of this class.
class UA e where { data family UArr e; data family MUArr e :: * -> *; }
sliceU :: (UA e) => UArr e -> Int -> Int -> UArr e
lengthMU :: (UA e) => MUArr e s -> Int
newMU :: (UA e) => Int -> ST s (MUArr e s)
readMU :: (UA e) => MUArr e s -> Int -> ST s e
writeMU :: (UA e) => MUArr e s -> Int -> e -> ST s ()
copyMU :: (UA e) => MUArr e s -> Int -> UArr e -> ST s ()
unsafeFreezeMU :: (UA e) => MUArr e s -> Int -> ST s (UArr e)
-- | Generate a stream from an array, from left to right
streamU :: (UA a) => UArr a -> Stream a
-- | Create an array from a stream, filling it from left to right
unstreamU :: (UA a) => Stream a -> UArr a
-- | Conversion -----------
--
-- Turn a list into a parallel array
toU :: (UA e) => [e] -> UArr e
-- | Collect the elements of a parallel array in a list
fromU :: (UA e) => UArr e -> [e]
-- | Yield an empty array
emptyU :: (UA e) => UArr e
-- | Yield a singleton array
singletonU :: (UA e) => e -> UArr e
-- | Prepend an element to an array
consU :: (UA e) => e -> UArr e -> UArr e
-- | Append an element to an array
snocU :: (UA e) => UArr e -> e -> UArr e
-- | Concatenate two arrays
appendU :: (UA e) => UArr e -> UArr e -> UArr e
headU :: (UA e) => UArr e -> e
lastU :: (UA e) => UArr e -> e
tailU :: (UA e) => UArr e -> UArr e
initU :: (UA e) => UArr e -> UArr e
-- | Test whether the given array is empty
nullU :: (UA e) => UArr e -> Bool
-- | Basic operations on unboxed arrays -----------------------------------
--
-- Yield an array of units
unitsU :: Int -> UArr ()
-- | O(1), length returns the length of a UArr as an
-- Int.
lengthU :: (UA e) => UArr e -> Int
-- | Map a function over an array
mapU :: (UA e, UA e') => (e -> e') -> UArr e -> UArr e'
-- | Array reduction that requires an associative combination function with
-- its unit
foldU :: (UA a) => (a -> a -> a) -> a -> UArr a -> a
-- | Reduction of a non-empty array which requires an associative
-- combination function
fold1U :: (UA a) => (a -> a -> a) -> UArr a -> a
fold1MaybeU :: (UA a) => (a -> a -> a) -> UArr a -> MaybeS a
-- | Array reduction proceeding from the left
foldlU :: (UA a) => (b -> a -> b) -> b -> UArr a -> b
-- | Array reduction proceeding from the left for non-empty arrays
--
-- FIXME: Rewrite for Streams.
--
-- foldl1U :: UA a => (a -> a -> a) -> UArr a -> a {--}
-- foldl1U f arr = checkNotEmpty (here foldl1U) (lengthU arr) $
-- foldlU f (arr indexU 0) (sliceU arr 1 (lengthU arr - 1))
foldl1U :: (UA a) => (a -> a -> a) -> UArr a -> a
foldl1MaybeU :: (UA a) => (a -> a -> a) -> UArr a -> MaybeS a
andU :: UArr Bool -> Bool
orU :: UArr Bool -> Bool
anyU :: (UA e) => (e -> Bool) -> UArr e -> Bool
allU :: (UA e) => (e -> Bool) -> UArr e -> Bool
-- | Compute the sum of an array of numerals
sumU :: (Num e, UA e) => UArr e -> e
-- | Compute the product of an array of numerals
productU :: (Num e, UA e) => UArr e -> e
-- | Determine the maximum element in an array
maximumU :: (Ord e, UA e) => UArr e -> e
-- | Determine the minimum element in an array
minimumU :: (Ord e, UA e) => UArr e -> e
-- | Determine the maximum element in an array under the given ordering
maximumByU :: (UA e) => (e -> e -> Ordering) -> UArr e -> e
-- | Determine the minimum element in an array under the given ordering
minimumByU :: (UA e) => (e -> e -> Ordering) -> UArr e -> e
-- | Prefix scan proceedings from left to right
scanlU :: (UA a, UA b) => (b -> a -> b) -> b -> UArr a -> UArr b
-- | Prefix scan of a non-empty array proceeding from left to right
scanl1U :: (UA a) => (a -> a -> a) -> UArr a -> UArr a
-- | Prefix scan proceeding from left to right that needs an associative
-- combination function with its unit
scanU :: (UA a) => (a -> a -> a) -> a -> UArr a -> UArr a
-- | Prefix scan of a non-empty array proceeding from left to right that
-- needs an associative combination function
scan1U :: (UA a) => (a -> a -> a) -> UArr a -> UArr a
scanResU :: (UA a) => (a -> a -> a) -> a -> UArr a -> UArr a :*: a
-- | Accumulating map from left to right. Does not return the accumulator.
--
-- FIXME: Naming inconsistent with lists.
mapAccumLU :: (UA a, UA b) => (c -> a -> c :*: b) -> c -> UArr a -> UArr b
-- | Yield an array where all elements contain the same value
replicateU :: (UA e) => Int -> e -> UArr e
replicateEachU :: (UA e) => Int -> UArr Int -> UArr e -> UArr e
takeU :: (UA e) => Int -> UArr e -> UArr e
dropU :: (UA e) => Int -> UArr e -> UArr e
-- | Split an array into two halves at the given index
splitAtU :: (UA e) => Int -> UArr e -> (UArr e, UArr e)
-- | takeWhile, applied to a predicate p and a UArr
-- xs, returns the longest prefix (possibly empty) of
-- xs of elements that satisfy p.
takeWhileU :: (UA e) => (e -> Bool) -> UArr e -> UArr e
-- | dropWhile p xs returns the suffix remaining after
-- takeWhile p xs.
dropWhileU :: (UA e) => (e -> Bool) -> UArr e -> UArr e
-- | Determine whether the given element is in an array
elemU :: (Eq e, UA e) => e -> UArr e -> Bool
-- | Negation of elemU
notElemU :: (Eq e, UA e) => e -> UArr e -> Bool
-- | Extract all elements from an array that meet the given predicate
filterU :: (UA e) => (e -> Bool) -> UArr e -> UArr e
-- | O(n),fusion. The find function takes a predicate and an
-- array and returns the first element in the list matching the
-- predicate, or Nothing if there is no such element.
findU :: (UA a) => (a -> Bool) -> UArr a -> Maybe a
-- | Array indexing
indexU :: (UA e) => UArr e -> Int -> e
-- | O(n), fusion, The findIndex function takes a predicate
-- and an array and returns the index of the first element in the array
-- satisfying the predicate, or Nothing if there is no such
-- element.
findIndexU :: (UA a) => (a -> Bool) -> UArr a -> Maybe Int
-- | O(n),fusion. lookup key assocs looks up
-- a key in an array of pairs treated as an association table.
lookupU :: (Eq a, UA a, UA b) => a -> UArr (a :*: b) -> Maybe b
-- | Elementwise pairing of array elements.
zipU :: (UA a, UA b) => UArr a -> UArr b -> UArr (a :*: b)
zip3U :: (UA e1, UA e2, UA e3) => UArr e1 -> UArr e2 -> UArr e3 -> UArr ((e1 :*: e2) :*: e3)
-- | Elementwise unpairing of array elements.
unzipU :: (UA a, UA b) => UArr (a :*: b) -> (UArr a :*: UArr b)
unzip3U :: (UA e1, UA e2, UA e3) => UArr ((e1 :*: e2) :*: e3) -> ((UArr e1 :*: UArr e2) :*: UArr e3)
zipWithU :: (UA a, UA b, UA c) => (a -> b -> c) -> UArr a -> UArr b -> UArr c
zipWith3U :: (UA a, UA b, UA c, UA d) => (a -> b -> c -> d) -> UArr a -> UArr b -> UArr c -> UArr d
-- | Yield the first components of an array of pairs.
fstU :: (UA a, UA b) => UArr (a :*: b) -> UArr a
-- | Yield the second components of an array of pairs.
sndU :: (UA a, UA b) => UArr (a :*: b) -> UArr b
-- | Yield an enumerated array
--
-- FIXME: See comments about enumFromThenToS
enumFromToU :: (UA a, Integral a) => a -> a -> UArr a
enumFromToFracU :: (UA a, RealFrac a) => a -> a -> UArr a
-- | Yield an enumerated array using a specific step
--
-- FIXME: See comments about enumFromThenToS
enumFromThenToU :: Int -> Int -> Int -> UArr Int
enumFromStepLenU :: Int -> Int -> Int -> UArr Int
enumFromToEachU :: Int -> UArr (Int :*: Int) -> UArr Int
combineU :: (UA a) => UArr Bool -> UArr a -> UArr a -> UArr a
-- | Extract all elements from an array according to a given flag array
packU :: (UA e) => UArr e -> UArr Bool -> UArr e
-- | Indexing ---------
--
-- Associate each element of the array with its index
indexedU :: (UA e) => UArr e -> UArr (Int :*: e)
-- | Repeat an array n times
repeatU :: (UA e) => Int -> UArr e -> UArr e
unfoldU :: (UA a) => Int -> (b -> MaybeS (a :*: b)) -> b -> UArr a
class (UA a) => UIO a
hPutU :: (UIO a) => Handle -> UArr a -> IO ()
hGetU :: (UIO a) => Handle -> IO (UArr a)
-- | Creating unboxed arrays ------------------------
newU :: (UA e) => Int -> (forall s. MUArr e s -> ST s ()) -> UArr e
unsafeFreezeAllMU :: (UA e) => MUArr e s -> ST s (UArr e)
-- | Permutations -------------
permuteMU :: (UA e) => MUArr e s -> UArr e -> UArr Int -> ST s ()
atomicUpdateMU :: (UA e) => MUArr e s -> UArr (Int :*: e) -> ST s ()
-- | Fill a mutable array from a stream from left to right and yield the
-- number of elements written.
unstreamMU :: (UA a) => MUArr a s -> Stream a -> ST s Int
-- | Strict pair
data (:*:) a b
(:*:) :: !a -> !b -> :*: a b
-- | Strict sum
data EitherS a b
LeftS :: !a -> EitherS a b
RightS :: !b -> EitherS a b
fstS :: a :*: b -> a
sndS :: a :*: b -> b
pairS :: (a, b) -> a :*: b
unpairS :: a :*: b -> (a, b)
unsafe_pairS :: (a, b) -> a :*: b
unsafe_unpairS :: a :*: b -> (a, b)
curryS :: (a :*: b -> c) -> a -> b -> c
uncurryS :: (a -> b -> c) -> a :*: b -> c
-- | Strict Maybe
data MaybeS a
NothingS :: MaybeS a
JustS :: !a -> MaybeS a
maybeS :: b -> (a -> b) -> MaybeS a -> b
fromMaybeS :: a -> MaybeS a -> a