summaryrefslogtreecommitdiff
path: root/VectorRing.hs
diff options
context:
space:
mode:
Diffstat (limited to 'VectorRing.hs')
-rw-r--r--VectorRing.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/VectorRing.hs b/VectorRing.hs
new file mode 100644
index 0000000..2ddac72
--- /dev/null
+++ b/VectorRing.hs
@@ -0,0 +1,17 @@
1module VectorRing where
2
3import Data.Vector.Unboxed.Mutable
4import RingBuffer
5
6-- | Typical usage:
7--
8-- > ringBuffer <- newRing capacity (VectorRing.new capacity)
9new :: Unbox a => Int -> IO (TargetBuffer a)
10new sz = do
11 v <- unsafeNew sz
12 return () :: IO ()
13 return TargetBuffer
14 { syncBuffer = \_ -> return ()
15 , updateBuffer = \i u -> write v i u
16 }
17