summaryrefslogtreecommitdiff
path: root/VectorRing.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-05-30 00:09:21 -0400
committerJoe Crayne <joe@jerkface.net>2019-05-30 00:09:21 -0400
commit315d96fb6f76985ec9269a434039f3afca983d5a (patch)
tree8c681a071207f3d7cc8c08a9464eccf9c95a04f1 /VectorRing.hs
parent8e735080a3f45a90f9952f1ff883260b1230fdf1 (diff)
Factored gpu-backend out of RingBuffer, wrote vector-backend.
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