vext-0.1.5.0: src/Vector/Int8.hs
{-# language DataKinds #-}
{-# language MagicHash #-}
{-# language NumericUnderscores #-}
{-# language BangPatterns #-}
{-# language TypeApplications #-}
{-# language TypeOperators #-}
module Vector.Int8
( -- Types
Vector(..)
, Vector#
, MutableVector(..)
, MutableVector#
, Bounded(..)
, Vector_(..)
-- * Primitives
, write#
, write
, read#
, index#
, index
, unlift
, substitute
, initialized
, unsafeCoerceLength
, expose
, expose#
-- * Ranges
, set
, setSlice
-- * Freeze
, unsafeShrinkFreeze
, unsafeFreeze
, freeze
, freezeSlice
-- * Copy
, thaw
-- * Composite
, any
, all
, map
, ifoldl'
, ifoldlSlice'
, replicate
, construct1
, construct3
, construct4
, construct5
, construct6
, construct7
, append
, clone
, cloneSlice
-- * Index
, index0
, index1
, index2
, index3
, index4
, index5
, index6
, index7
, index8
-- * Ordered
, unique
, equals
, elem
, findIndexEq
, maximum
, maximumSlice
, maximumSliceInitial
, bubbleSort
, bubbleSortSlice
, bubbleSortSliceInPlace
, mapEq
-- * Hide Length
, vector_
-- * Show
, show
-- * Interop with primitive
, cloneFromByteArray
) where
import Prelude hiding (replicate,map,maximum,Bounded,all,any,elem,show)
import Arithmetic.Types (Nat#)
import Data.Primitive (ByteArray)
import GHC.Exts (Int8#)
import GHC.Int (Int8(I8#))
import Vector.Std.Int8
import Vector.Ord.Int8
import Vector.Eq.Int8
import qualified Vector.Prim.Int8
-- | Crashes the program if the range is out of bounds. That is,
-- behavior is always well defined.
--
-- Interprets the bytes in a native-endian fashion.
cloneFromByteArray ::
Int -- ^ Offset into byte array, units are elements, not bytes
-> Nat# n -- ^ Length of the vector, units are elements, not bytes
-> ByteArray
-> Vector n Int8#
cloneFromByteArray = Vector.Prim.Int8.unsafeCloneFromByteArray
show :: Nat# n -> Vector n Int8# -> String
show n v = liftShows (\i s -> shows (I8# i) s) n v ""