Skip to content

Commit

Permalink
Reexport PrimMonad from mutable vectors (#320)
Browse files Browse the repository at this point in the history
* Reexport PrimMonad from mutable vectors

This allows to avoid extra import from primitive (and adding it to cabal file)
It's also in line with reexposrt of Storable and Prim type classes

Fixes #262

* Reexport RealWorld per @lehins suggestion

Also move reexports to bottom of module per @Bodigrim suggestion
  • Loading branch information
Shimuuar committed Jun 23, 2020
1 parent 3f6f737 commit c7858a7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Data/Vector/Generic/Mutable.hs
Expand Up @@ -57,7 +57,9 @@ module Data.Vector.Generic.Mutable (
fill, fillR,
unsafeAccum, accum, unsafeUpdate, update, reverse,
unstablePartition, unstablePartitionBundle, partitionBundle,
partitionWithBundle
partitionWithBundle,
-- * Reexports
PrimMonad(..), RealWorld
) where

import Data.Vector.Generic.Mutable.Base
Expand All @@ -71,7 +73,7 @@ import qualified Data.Vector.Fusion.Stream.Monadic as Stream
import Data.Vector.Fusion.Bundle.Size
import Data.Vector.Fusion.Util ( delay_inline )

import Control.Monad.Primitive ( PrimMonad, PrimState )
import Control.Monad.Primitive ( PrimMonad(..), RealWorld )

import Prelude hiding ( length, null, replicate, reverse, map, read,
take, drop, splitAt, init, tail )
Expand Down
5 changes: 4 additions & 1 deletion Data/Vector/Mutable.hs
Expand Up @@ -47,7 +47,10 @@ module Data.Vector.Mutable (
nextPermutation,

-- ** Filling and copying
set, copy, move, unsafeCopy, unsafeMove
set, copy, move, unsafeCopy, unsafeMove,

-- * Reexports
PrimMonad(..), RealWorld
) where

import Control.Monad (when)
Expand Down
4 changes: 3 additions & 1 deletion Data/Vector/Primitive/Mutable.hs
Expand Up @@ -50,7 +50,9 @@ module Data.Vector.Primitive.Mutable (
set, copy, move, unsafeCopy, unsafeMove,

-- * Unsafe conversions
unsafeCoerceMVector
unsafeCoerceMVector,
-- * Reexports
PrimMonad(..), RealWorld
) where

import qualified Data.Vector.Generic.Mutable as G
Expand Down
4 changes: 3 additions & 1 deletion Data/Vector/Storable/Mutable.hs
Expand Up @@ -55,7 +55,9 @@ module Data.Vector.Storable.Mutable(
-- * Raw pointers
unsafeFromForeignPtr, unsafeFromForeignPtr0,
unsafeToForeignPtr, unsafeToForeignPtr0,
unsafeWith
unsafeWith,
-- * Reexports
PrimMonad(..), RealWorld,
) where

import Control.DeepSeq ( NFData(rnf)
Expand Down
4 changes: 3 additions & 1 deletion Data/Vector/Unboxed/Mutable.hs
Expand Up @@ -51,7 +51,9 @@ module Data.Vector.Unboxed.Mutable (
nextPermutation,

-- ** Filling and copying
set, copy, move, unsafeCopy, unsafeMove
set, copy, move, unsafeCopy, unsafeMove,
-- * Reexports
PrimMonad(..), RealWorld,
) where

import Data.Vector.Unboxed.Base
Expand Down

0 comments on commit c7858a7

Please sign in to comment.