-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Extras for the "primitive" library -- -- Extras for the "primitive" library @package primitive-extras @version 0.6 module PrimitiveExtras.SmallArray -- | A workaround for the weird forcing of undefined values int -- newSmallArray newEmptySmallArray :: PrimMonad m => Int -> m (SmallMutableArray (PrimState m) a) list :: [a] -> SmallArray a -- | Remove an element. unset :: Int -> SmallArray a -> SmallArray a set :: Int -> a -> SmallArray a -> SmallArray a insert :: Int -> a -> SmallArray a -> SmallArray a cons :: a -> SmallArray a -> SmallArray a orderedPair :: Int -> e -> Int -> e -> SmallArray e find :: (a -> Bool) -> SmallArray a -> Maybe a findWithIndex :: (a -> Bool) -> SmallArray a -> Maybe (Int, a) elementsUnfoldM :: Monad m => SmallArray e -> UnfoldM m e onFoundElementFocus :: Monad m => (a -> Bool) -> (a -> Bool) -> Focus a m b -> Focus (SmallArray a) m b focusOnFoundElement :: Monad m => Focus a m b -> (a -> Bool) -> (a -> Bool) -> SmallArray a -> m (b, SmallArray a) toList :: forall a. SmallArray a -> [a] module PrimitiveExtras.PrimArray oneHot :: Prim a => Int -> Int -> a -> PrimArray a generate :: Prim a => Int -> (Int -> IO a) -> IO (PrimArray a) replicate :: Prim a => Int -> IO a -> IO (PrimArray a) -- | Please notice that this function is highly untested replicateM :: (Monad m, Prim element) => Int -> m element -> m (PrimArray element) traverse_ :: (Applicative f, Prim a) => a -> f b -> PrimArray a -> f () traverseWithIndexInRange_ :: Prim a => PrimArray a -> Int -> Int -> (Int -> a -> IO ()) -> IO () toElementsUnfold :: Prim prim => PrimArray prim -> Unfold prim toElementsUnfoldM :: (Monad m, Prim prim) => PrimArray prim -> UnfoldM m prim toByteArray :: PrimArray a -> ByteArray toPrimitiveVector :: Prim a => PrimArray a -> Vector a toUnboxedVector :: Prim a => PrimArray a -> Vector a cerealGet :: Prim element => Get Int -> Get element -> Get (PrimArray element) cerealPut :: Prim element => Putter Int -> Putter element -> Putter (PrimArray element) module PrimitiveExtras.Bitmap -- | A word-size set of ints. data Bitmap empty :: Bitmap singleton :: Int -> Bitmap insert :: Int -> Bitmap -> Bitmap invert :: Int -> Bitmap -> Bitmap indexList :: [Int] -> Bitmap boolList :: [Bool] -> Bitmap pair :: Int -> Int -> Bitmap -- | A number of non-zero bits, preceding this one. populatedIndex :: Int -> Bitmap -> Int isPopulated :: Int -> Bitmap -> Bool population :: Bitmap -> Int null :: Bitmap -> Bool bits :: Bitmap -> [Int] populatedIndicesList :: Bitmap -> [Int] int :: Bitmap -> Int allBitsList :: [Int] allBitsUnfold :: Unfold Int populatedBitsUnfold :: Bitmap -> Unfold Int indicesAmongstPopulatedBitsUnfold :: Bitmap -> Unfold Int instance GHC.Classes.Eq PrimitiveExtras.Types.Bitmap module PrimitiveExtras.SparseSmallArray -- | An immutable space-efficient sparse array, which can only store not -- more than 32 or 64 elements depending on the system architecure. data SparseSmallArray e empty :: SparseSmallArray e -- | An array with a single element at the specified index. singleton :: Int -> e -> SparseSmallArray e maybeList :: [Maybe e] -> SparseSmallArray e pair :: Int -> e -> Int -> e -> SparseSmallArray e -- | Insert an element value at the index. It's your obligation to ensure -- that the index is empty before the operation. insert :: Int -> e -> SparseSmallArray e -> SparseSmallArray e replace :: Int -> e -> SparseSmallArray e -> SparseSmallArray e -- | Remove an element. unset :: Int -> SparseSmallArray e -> SparseSmallArray e -- | Lookup an item at the index. lookup :: Int -> SparseSmallArray e -> Maybe e focusAt :: Monad m => Focus a m b -> Int -> SparseSmallArray a -> m (b, SparseSmallArray a) -- | Convert into a list representation. toMaybeList :: SparseSmallArray e -> [Maybe e] elementsUnfold :: SparseSmallArray e -> Unfold e elementsUnfoldM :: Monad m => SparseSmallArray a -> UnfoldM m a onElementAtFocus :: Monad m => Int -> Focus a m b -> Focus (SparseSmallArray a) m b null :: SparseSmallArray a -> Bool instance GHC.Classes.Eq a => GHC.Classes.Eq (PrimitiveExtras.Types.SparseSmallArray a) instance GHC.Show.Show a => GHC.Show.Show (PrimitiveExtras.Types.SparseSmallArray a) instance Data.Foldable.Foldable PrimitiveExtras.Types.SparseSmallArray module PrimitiveExtras.UnliftedArray at :: PrimUnlifted element => UnliftedArray element -> Int -> forall result. result -> (element -> result) -> result replicateIO :: PrimUnlifted a => Int -> IO a -> IO (UnliftedArray a) generate :: PrimUnlifted a => Int -> (Int -> IO a) -> IO (UnliftedArray a) traverse_ :: (Monad m, PrimUnlifted a) => (a -> m ()) -> UnliftedArray a -> m () module PrimitiveExtras.TVarArray data TVarArray a new :: a -> Int -> IO (TVarArray a) freezeAsPrimArray :: Prim a => TVarArray a -> IO (PrimArray a) modifyAt :: TVarArray a -> Int -> (a -> a) -> IO () module PrimitiveExtras.PrimMultiArray data PrimMultiArray a -- | Given a size of the outer array and a function, which executes a fold -- over indexed elements in a monad, constructs a prim multi-array create :: (Monad m, Prim element) => Int -> (forall x. Fold (Int, element) x -> m x) -> m (PrimMultiArray element) replicateM :: (Monad m, Prim a) => Int -> m (PrimArray a) -> m (PrimMultiArray a) -- | Get length of the outer dimension of a primitive multi array outerLength :: PrimMultiArray a -> Int toAssocsUnfold :: Prim a => PrimMultiArray a -> Unfold (Int, a) toIndicesUnfold :: PrimMultiArray a -> Unfold Int toUnfoldAt :: Prim prim => PrimMultiArray prim -> Int -> Unfold prim toAssocsUnfoldM :: (Monad m, Prim a) => PrimMultiArray a -> UnfoldM m (Int, a) toIndicesUnfoldM :: Monad m => PrimMultiArray a -> UnfoldM m Int toUnfoldAtM :: (Monad m, Prim prim) => PrimMultiArray prim -> Int -> UnfoldM m prim cerealGet :: Prim element => Get Int -> Get element -> Get (PrimMultiArray element) cerealPut :: Prim element => Putter Int -> Putter element -> Putter (PrimMultiArray element) instance (GHC.Classes.Eq a, Data.Primitive.Types.Prim a) => GHC.Classes.Eq (PrimitiveExtras.Types.PrimMultiArray a) instance (GHC.Classes.Ord a, Data.Primitive.Types.Prim a) => GHC.Classes.Ord (PrimitiveExtras.Types.PrimMultiArray a) instance (GHC.Show.Show a, Data.Primitive.Types.Prim a) => GHC.Show.Show (PrimitiveExtras.Types.PrimMultiArray a)