module Data.Repa.Array.Material.Auto.InstText
( A (..)
, Name (..)
, Array (..))
where
import Data.Repa.Array.Material.Auto.Base as A
import Data.Repa.Array.Material.Boxed as A
import Data.Repa.Array.Meta.Window as A
import Data.Repa.Array.Internals.Bulk as A
import Data.Repa.Array.Internals.Target as A
import Data.Repa.Array.Internals.Layout as A
import Control.Monad
import Data.Text (Text)
#include "repa-array.h"
instance Bulk A Text where
data Array A Text = AArray_Text !(Array B Text)
layout (AArray_Text arr) = Auto (A.length arr)
index (AArray_Text arr) ix = A.index arr ix
deriving instance Show (Array A Text)
instance Windowable A Text where
window st len (AArray_Text arr)
= AArray_Text (window st len arr)
instance Target A Text where
data Buffer A Text
= ABuffer_Text !(Buffer B Text)
unsafeNewBuffer (Auto len)
= liftM ABuffer_Text $ unsafeNewBuffer (Boxed len)
unsafeReadBuffer (ABuffer_Text arr) ix
= unsafeReadBuffer arr ix
unsafeWriteBuffer (ABuffer_Text arr) ix x
= unsafeWriteBuffer arr ix x
unsafeGrowBuffer (ABuffer_Text arr) bump
= liftM ABuffer_Text $ unsafeGrowBuffer arr bump
unsafeFreezeBuffer (ABuffer_Text arr)
= liftM AArray_Text $ unsafeFreezeBuffer arr
unsafeThawBuffer (AArray_Text arr)
= liftM ABuffer_Text $ unsafeThawBuffer arr
unsafeSliceBuffer st len (ABuffer_Text buf)
= liftM ABuffer_Text $ unsafeSliceBuffer st len buf
touchBuffer (ABuffer_Text buf)
= touchBuffer buf
bufferLayout (ABuffer_Text buf)
= Auto $ A.extent $ bufferLayout buf
instance Eq (Array A Text) where
(==) (AArray_Text arr1) (AArray_Text arr2) = arr1 == arr2