{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
module Numeric.Rounded.Hardware.Internal.Rounding
( RoundingMode(..)
, oppositeRoundingMode
, Rounding
, rounding
, reifyRounding
, Rounded(..)
, VUM.MVector(MV_Rounded)
, VU.Vector(V_Rounded)
) where
import Control.DeepSeq (NFData (..))
import Data.Coerce
import Data.Proxy
import Data.Tagged
import qualified Data.Vector.Generic as VG
import qualified Data.Vector.Generic.Mutable as VGM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Foreign.Storable (Storable)
import GHC.Generics (Generic)
data RoundingMode
= ToNearest
| TowardNegInf
| TowardInf
| TowardZero
deriving (RoundingMode -> RoundingMode -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RoundingMode -> RoundingMode -> Bool
$c/= :: RoundingMode -> RoundingMode -> Bool
== :: RoundingMode -> RoundingMode -> Bool
$c== :: RoundingMode -> RoundingMode -> Bool
Eq, Eq RoundingMode
RoundingMode -> RoundingMode -> Bool
RoundingMode -> RoundingMode -> Ordering
RoundingMode -> RoundingMode -> RoundingMode
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: RoundingMode -> RoundingMode -> RoundingMode
$cmin :: RoundingMode -> RoundingMode -> RoundingMode
max :: RoundingMode -> RoundingMode -> RoundingMode
$cmax :: RoundingMode -> RoundingMode -> RoundingMode
>= :: RoundingMode -> RoundingMode -> Bool
$c>= :: RoundingMode -> RoundingMode -> Bool
> :: RoundingMode -> RoundingMode -> Bool
$c> :: RoundingMode -> RoundingMode -> Bool
<= :: RoundingMode -> RoundingMode -> Bool
$c<= :: RoundingMode -> RoundingMode -> Bool
< :: RoundingMode -> RoundingMode -> Bool
$c< :: RoundingMode -> RoundingMode -> Bool
compare :: RoundingMode -> RoundingMode -> Ordering
$ccompare :: RoundingMode -> RoundingMode -> Ordering
Ord, ReadPrec [RoundingMode]
ReadPrec RoundingMode
Int -> ReadS RoundingMode
ReadS [RoundingMode]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RoundingMode]
$creadListPrec :: ReadPrec [RoundingMode]
readPrec :: ReadPrec RoundingMode
$creadPrec :: ReadPrec RoundingMode
readList :: ReadS [RoundingMode]
$creadList :: ReadS [RoundingMode]
readsPrec :: Int -> ReadS RoundingMode
$creadsPrec :: Int -> ReadS RoundingMode
Read, Int -> RoundingMode -> ShowS
[RoundingMode] -> ShowS
RoundingMode -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RoundingMode] -> ShowS
$cshowList :: [RoundingMode] -> ShowS
show :: RoundingMode -> String
$cshow :: RoundingMode -> String
showsPrec :: Int -> RoundingMode -> ShowS
$cshowsPrec :: Int -> RoundingMode -> ShowS
Show, Int -> RoundingMode
RoundingMode -> Int
RoundingMode -> [RoundingMode]
RoundingMode -> RoundingMode
RoundingMode -> RoundingMode -> [RoundingMode]
RoundingMode -> RoundingMode -> RoundingMode -> [RoundingMode]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: RoundingMode -> RoundingMode -> RoundingMode -> [RoundingMode]
$cenumFromThenTo :: RoundingMode -> RoundingMode -> RoundingMode -> [RoundingMode]
enumFromTo :: RoundingMode -> RoundingMode -> [RoundingMode]
$cenumFromTo :: RoundingMode -> RoundingMode -> [RoundingMode]
enumFromThen :: RoundingMode -> RoundingMode -> [RoundingMode]
$cenumFromThen :: RoundingMode -> RoundingMode -> [RoundingMode]
enumFrom :: RoundingMode -> [RoundingMode]
$cenumFrom :: RoundingMode -> [RoundingMode]
fromEnum :: RoundingMode -> Int
$cfromEnum :: RoundingMode -> Int
toEnum :: Int -> RoundingMode
$ctoEnum :: Int -> RoundingMode
pred :: RoundingMode -> RoundingMode
$cpred :: RoundingMode -> RoundingMode
succ :: RoundingMode -> RoundingMode
$csucc :: RoundingMode -> RoundingMode
Enum, RoundingMode
forall a. a -> a -> Bounded a
maxBound :: RoundingMode
$cmaxBound :: RoundingMode
minBound :: RoundingMode
$cminBound :: RoundingMode
Bounded, forall x. Rep RoundingMode x -> RoundingMode
forall x. RoundingMode -> Rep RoundingMode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RoundingMode x -> RoundingMode
$cfrom :: forall x. RoundingMode -> Rep RoundingMode x
Generic)
instance NFData RoundingMode
oppositeRoundingMode :: RoundingMode -> RoundingMode
oppositeRoundingMode :: RoundingMode -> RoundingMode
oppositeRoundingMode RoundingMode
ToNearest = RoundingMode
ToNearest
oppositeRoundingMode RoundingMode
TowardZero = RoundingMode
TowardZero
oppositeRoundingMode RoundingMode
TowardInf = RoundingMode
TowardNegInf
oppositeRoundingMode RoundingMode
TowardNegInf = RoundingMode
TowardInf
class Rounding (r :: RoundingMode) where
roundingT :: Tagged r RoundingMode
instance Rounding 'ToNearest where
roundingT :: Tagged 'ToNearest RoundingMode
roundingT = forall {k} (s :: k) b. b -> Tagged s b
Tagged RoundingMode
ToNearest
instance Rounding 'TowardInf where
roundingT :: Tagged 'TowardInf RoundingMode
roundingT = forall {k} (s :: k) b. b -> Tagged s b
Tagged RoundingMode
TowardInf
instance Rounding 'TowardNegInf where
roundingT :: Tagged 'TowardNegInf RoundingMode
roundingT = forall {k} (s :: k) b. b -> Tagged s b
Tagged RoundingMode
TowardNegInf
instance Rounding 'TowardZero where
roundingT :: Tagged 'TowardZero RoundingMode
roundingT = forall {k} (s :: k) b. b -> Tagged s b
Tagged RoundingMode
TowardZero
rounding :: Rounding r => proxy r -> RoundingMode
rounding :: forall (r :: RoundingMode) (proxy :: RoundingMode -> *).
Rounding r =>
proxy r -> RoundingMode
rounding = forall {k} (s :: k) a (proxy :: k -> *). Tagged s a -> proxy s -> a
Data.Tagged.proxy forall (r :: RoundingMode). Rounding r => Tagged r RoundingMode
roundingT
{-# INLINE rounding #-}
reifyRounding :: RoundingMode -> (forall s. Rounding s => Proxy s -> a) -> a
reifyRounding :: forall a.
RoundingMode
-> (forall (s :: RoundingMode). Rounding s => Proxy s -> a) -> a
reifyRounding RoundingMode
ToNearest forall (s :: RoundingMode). Rounding s => Proxy s -> a
f = forall (s :: RoundingMode). Rounding s => Proxy s -> a
f (forall {k} (t :: k). Proxy t
Proxy :: Proxy 'ToNearest)
reifyRounding RoundingMode
TowardInf forall (s :: RoundingMode). Rounding s => Proxy s -> a
f = forall (s :: RoundingMode). Rounding s => Proxy s -> a
f (forall {k} (t :: k). Proxy t
Proxy :: Proxy 'TowardInf)
reifyRounding RoundingMode
TowardNegInf forall (s :: RoundingMode). Rounding s => Proxy s -> a
f = forall (s :: RoundingMode). Rounding s => Proxy s -> a
f (forall {k} (t :: k). Proxy t
Proxy :: Proxy 'TowardNegInf)
reifyRounding RoundingMode
TowardZero forall (s :: RoundingMode). Rounding s => Proxy s -> a
f = forall (s :: RoundingMode). Rounding s => Proxy s -> a
f (forall {k} (t :: k). Proxy t
Proxy :: Proxy 'TowardZero)
{-# INLINE reifyRounding #-}
newtype Rounded (r :: RoundingMode) a = Rounded { forall (r :: RoundingMode) a. Rounded r a -> a
getRounded :: a }
deriving (Rounded r a -> Rounded r a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (r :: RoundingMode) a.
Eq a =>
Rounded r a -> Rounded r a -> Bool
/= :: Rounded r a -> Rounded r a -> Bool
$c/= :: forall (r :: RoundingMode) a.
Eq a =>
Rounded r a -> Rounded r a -> Bool
== :: Rounded r a -> Rounded r a -> Bool
$c== :: forall (r :: RoundingMode) a.
Eq a =>
Rounded r a -> Rounded r a -> Bool
Eq, Rounded r a -> Rounded r a -> Bool
Rounded r a -> Rounded r a -> Ordering
Rounded r a -> Rounded r a -> Rounded r a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {r :: RoundingMode} {a}. Ord a => Eq (Rounded r a)
forall (r :: RoundingMode) a.
Ord a =>
Rounded r a -> Rounded r a -> Bool
forall (r :: RoundingMode) a.
Ord a =>
Rounded r a -> Rounded r a -> Ordering
forall (r :: RoundingMode) a.
Ord a =>
Rounded r a -> Rounded r a -> Rounded r a
min :: Rounded r a -> Rounded r a -> Rounded r a
$cmin :: forall (r :: RoundingMode) a.
Ord a =>
Rounded r a -> Rounded r a -> Rounded r a
max :: Rounded r a -> Rounded r a -> Rounded r a
$cmax :: forall (r :: RoundingMode) a.
Ord a =>
Rounded r a -> Rounded r a -> Rounded r a
>= :: Rounded r a -> Rounded r a -> Bool
$c>= :: forall (r :: RoundingMode) a.
Ord a =>
Rounded r a -> Rounded r a -> Bool
> :: Rounded r a -> Rounded r a -> Bool
$c> :: forall (r :: RoundingMode) a.
Ord a =>
Rounded r a -> Rounded r a -> Bool
<= :: Rounded r a -> Rounded r a -> Bool
$c<= :: forall (r :: RoundingMode) a.
Ord a =>
Rounded r a -> Rounded r a -> Bool
< :: Rounded r a -> Rounded r a -> Bool
$c< :: forall (r :: RoundingMode) a.
Ord a =>
Rounded r a -> Rounded r a -> Bool
compare :: Rounded r a -> Rounded r a -> Ordering
$ccompare :: forall (r :: RoundingMode) a.
Ord a =>
Rounded r a -> Rounded r a -> Ordering
Ord, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (r :: RoundingMode) a x. Rep (Rounded r a) x -> Rounded r a
forall (r :: RoundingMode) a x. Rounded r a -> Rep (Rounded r a) x
$cto :: forall (r :: RoundingMode) a x. Rep (Rounded r a) x -> Rounded r a
$cfrom :: forall (r :: RoundingMode) a x. Rounded r a -> Rep (Rounded r a) x
Generic, forall a b. a -> Rounded r b -> Rounded r a
forall a b. (a -> b) -> Rounded r a -> Rounded r b
forall (r :: RoundingMode) a b. a -> Rounded r b -> Rounded r a
forall (r :: RoundingMode) a b.
(a -> b) -> Rounded r a -> Rounded r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Rounded r b -> Rounded r a
$c<$ :: forall (r :: RoundingMode) a b. a -> Rounded r b -> Rounded r a
fmap :: forall a b. (a -> b) -> Rounded r a -> Rounded r b
$cfmap :: forall (r :: RoundingMode) a b.
(a -> b) -> Rounded r a -> Rounded r b
Functor, Ptr (Rounded r a) -> IO (Rounded r a)
Ptr (Rounded r a) -> Int -> IO (Rounded r a)
Ptr (Rounded r a) -> Int -> Rounded r a -> IO ()
Ptr (Rounded r a) -> Rounded r a -> IO ()
Rounded r a -> Int
forall b. Ptr b -> Int -> IO (Rounded r a)
forall b. Ptr b -> Int -> Rounded r a -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
forall (r :: RoundingMode) a.
Storable a =>
Ptr (Rounded r a) -> IO (Rounded r a)
forall (r :: RoundingMode) a.
Storable a =>
Ptr (Rounded r a) -> Int -> IO (Rounded r a)
forall (r :: RoundingMode) a.
Storable a =>
Ptr (Rounded r a) -> Int -> Rounded r a -> IO ()
forall (r :: RoundingMode) a.
Storable a =>
Ptr (Rounded r a) -> Rounded r a -> IO ()
forall (r :: RoundingMode) a. Storable a => Rounded r a -> Int
forall (r :: RoundingMode) a b.
Storable a =>
Ptr b -> Int -> IO (Rounded r a)
forall (r :: RoundingMode) a b.
Storable a =>
Ptr b -> Int -> Rounded r a -> IO ()
poke :: Ptr (Rounded r a) -> Rounded r a -> IO ()
$cpoke :: forall (r :: RoundingMode) a.
Storable a =>
Ptr (Rounded r a) -> Rounded r a -> IO ()
peek :: Ptr (Rounded r a) -> IO (Rounded r a)
$cpeek :: forall (r :: RoundingMode) a.
Storable a =>
Ptr (Rounded r a) -> IO (Rounded r a)
pokeByteOff :: forall b. Ptr b -> Int -> Rounded r a -> IO ()
$cpokeByteOff :: forall (r :: RoundingMode) a b.
Storable a =>
Ptr b -> Int -> Rounded r a -> IO ()
peekByteOff :: forall b. Ptr b -> Int -> IO (Rounded r a)
$cpeekByteOff :: forall (r :: RoundingMode) a b.
Storable a =>
Ptr b -> Int -> IO (Rounded r a)
pokeElemOff :: Ptr (Rounded r a) -> Int -> Rounded r a -> IO ()
$cpokeElemOff :: forall (r :: RoundingMode) a.
Storable a =>
Ptr (Rounded r a) -> Int -> Rounded r a -> IO ()
peekElemOff :: Ptr (Rounded r a) -> Int -> IO (Rounded r a)
$cpeekElemOff :: forall (r :: RoundingMode) a.
Storable a =>
Ptr (Rounded r a) -> Int -> IO (Rounded r a)
alignment :: Rounded r a -> Int
$calignment :: forall (r :: RoundingMode) a. Storable a => Rounded r a -> Int
sizeOf :: Rounded r a -> Int
$csizeOf :: forall (r :: RoundingMode) a. Storable a => Rounded r a -> Int
Storable)
instance (Rounding r, Show a) => Show (Rounded r a) where
showsPrec :: Int -> Rounded r a -> ShowS
showsPrec Int
prec rx :: Rounded r a
rx@(Rounded a
x) = Bool -> ShowS -> ShowS
showParen (Int
prec forall a. Ord a => a -> a -> Bool
> Int
10) forall a b. (a -> b) -> a -> b
$ String -> ShowS
showString String
"Rounded @" forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
rs forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 a
x
where
toProxy :: Rounded r a -> Proxy r
toProxy :: forall (r :: RoundingMode) a. Rounded r a -> Proxy r
toProxy Rounded r a
_ = forall {k} (t :: k). Proxy t
Proxy
rs :: ShowS
rs = forall a. Show a => a -> ShowS
shows (forall (r :: RoundingMode) (proxy :: RoundingMode -> *).
Rounding r =>
proxy r -> RoundingMode
rounding (forall (r :: RoundingMode) a. Rounded r a -> Proxy r
toProxy Rounded r a
rx))
instance NFData a => NFData (Rounded r a)
newtype instance VUM.MVector s (Rounded r a) = MV_Rounded (VUM.MVector s a)
newtype instance VU.Vector (Rounded r a) = V_Rounded (VU.Vector a)
instance VU.Unbox a => VGM.MVector VUM.MVector (Rounded r a) where
basicLength :: forall s. MVector s (Rounded r a) -> Int
basicLength (MV_Rounded MVector s a
mv) = forall (v :: * -> * -> *) a s. MVector v a => v s a -> Int
VGM.basicLength MVector s a
mv
basicUnsafeSlice :: forall s.
Int -> Int -> MVector s (Rounded r a) -> MVector s (Rounded r a)
basicUnsafeSlice Int
i Int
l (MV_Rounded MVector s a
mv) = forall s (r :: RoundingMode) a.
MVector s a -> MVector s (Rounded r a)
MV_Rounded (forall (v :: * -> * -> *) a s.
MVector v a =>
Int -> Int -> v s a -> v s a
VGM.basicUnsafeSlice Int
i Int
l MVector s a
mv)
basicOverlaps :: forall s.
MVector s (Rounded r a) -> MVector s (Rounded r a) -> Bool
basicOverlaps (MV_Rounded MVector s a
mv) (MV_Rounded MVector s a
mv') = forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> v s a -> Bool
VGM.basicOverlaps MVector s a
mv MVector s a
mv'
basicUnsafeNew :: forall s. Int -> ST s (MVector s (Rounded r a))
basicUnsafeNew Int
l = forall s (r :: RoundingMode) a.
MVector s a -> MVector s (Rounded r a)
MV_Rounded forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (v :: * -> * -> *) a s. MVector v a => Int -> ST s (v s a)
VGM.basicUnsafeNew Int
l
basicInitialize :: forall s. MVector s (Rounded r a) -> ST s ()
basicInitialize (MV_Rounded MVector s a
mv) = forall (v :: * -> * -> *) a s. MVector v a => v s a -> ST s ()
VGM.basicInitialize MVector s a
mv
basicUnsafeReplicate :: forall s. Int -> Rounded r a -> ST s (MVector s (Rounded r a))
basicUnsafeReplicate Int
i Rounded r a
x = forall s (r :: RoundingMode) a.
MVector s a -> MVector s (Rounded r a)
MV_Rounded forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (v :: * -> * -> *) a s.
MVector v a =>
Int -> a -> ST s (v s a)
VGM.basicUnsafeReplicate Int
i (coerce :: forall a b. Coercible a b => a -> b
coerce Rounded r a
x)
basicUnsafeRead :: forall s. MVector s (Rounded r a) -> Int -> ST s (Rounded r a)
basicUnsafeRead (MV_Rounded MVector s a
mv) Int
i = coerce :: forall a b. Coercible a b => a -> b
coerce forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> ST s a
VGM.basicUnsafeRead MVector s a
mv Int
i
basicUnsafeWrite :: forall s. MVector s (Rounded r a) -> Int -> Rounded r a -> ST s ()
basicUnsafeWrite (MV_Rounded MVector s a
mv) Int
i Rounded r a
x = forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> a -> ST s ()
VGM.basicUnsafeWrite MVector s a
mv Int
i (coerce :: forall a b. Coercible a b => a -> b
coerce Rounded r a
x)
basicClear :: forall s. MVector s (Rounded r a) -> ST s ()
basicClear (MV_Rounded MVector s a
mv) = forall (v :: * -> * -> *) a s. MVector v a => v s a -> ST s ()
VGM.basicClear MVector s a
mv
basicSet :: forall s. MVector s (Rounded r a) -> Rounded r a -> ST s ()
basicSet (MV_Rounded MVector s a
mv) Rounded r a
x = forall (v :: * -> * -> *) a s. MVector v a => v s a -> a -> ST s ()
VGM.basicSet MVector s a
mv (coerce :: forall a b. Coercible a b => a -> b
coerce Rounded r a
x)
basicUnsafeCopy :: forall s.
MVector s (Rounded r a) -> MVector s (Rounded r a) -> ST s ()
basicUnsafeCopy (MV_Rounded MVector s a
mv) (MV_Rounded MVector s a
mv') = forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> v s a -> ST s ()
VGM.basicUnsafeCopy MVector s a
mv MVector s a
mv'
basicUnsafeMove :: forall s.
MVector s (Rounded r a) -> MVector s (Rounded r a) -> ST s ()
basicUnsafeMove (MV_Rounded MVector s a
mv) (MV_Rounded MVector s a
mv') = forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> v s a -> ST s ()
VGM.basicUnsafeMove MVector s a
mv MVector s a
mv'
basicUnsafeGrow :: forall s.
MVector s (Rounded r a) -> Int -> ST s (MVector s (Rounded r a))
basicUnsafeGrow (MV_Rounded MVector s a
mv) Int
n = forall s (r :: RoundingMode) a.
MVector s a -> MVector s (Rounded r a)
MV_Rounded forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> ST s (v s a)
VGM.basicUnsafeGrow MVector s a
mv Int
n
instance VU.Unbox a => VG.Vector VU.Vector (Rounded r a) where
basicUnsafeFreeze :: forall s.
Mutable Vector s (Rounded r a) -> ST s (Vector (Rounded r a))
basicUnsafeFreeze (MV_Rounded MVector s a
mv) = forall (r :: RoundingMode) a. Vector a -> Vector (Rounded r a)
V_Rounded forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (v :: * -> *) a s. Vector v a => Mutable v s a -> ST s (v a)
VG.basicUnsafeFreeze MVector s a
mv
basicUnsafeThaw :: forall s.
Vector (Rounded r a) -> ST s (Mutable Vector s (Rounded r a))
basicUnsafeThaw (V_Rounded Vector a
v) = forall s (r :: RoundingMode) a.
MVector s a -> MVector s (Rounded r a)
MV_Rounded forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (v :: * -> *) a s. Vector v a => v a -> ST s (Mutable v s a)
VG.basicUnsafeThaw Vector a
v
basicLength :: Vector (Rounded r a) -> Int
basicLength (V_Rounded Vector a
v) = forall (v :: * -> *) a. Vector v a => v a -> Int
VG.basicLength Vector a
v
basicUnsafeSlice :: Int -> Int -> Vector (Rounded r a) -> Vector (Rounded r a)
basicUnsafeSlice Int
i Int
l (V_Rounded Vector a
v) = forall (r :: RoundingMode) a. Vector a -> Vector (Rounded r a)
V_Rounded (forall (v :: * -> *) a. Vector v a => Int -> Int -> v a -> v a
VG.basicUnsafeSlice Int
i Int
l Vector a
v)
basicUnsafeIndexM :: Vector (Rounded r a) -> Int -> Box (Rounded r a)
basicUnsafeIndexM (V_Rounded Vector a
v) Int
i = coerce :: forall a b. Coercible a b => a -> b
coerce forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (v :: * -> *) a. Vector v a => v a -> Int -> Box a
VG.basicUnsafeIndexM Vector a
v Int
i
basicUnsafeCopy :: forall s.
Mutable Vector s (Rounded r a) -> Vector (Rounded r a) -> ST s ()
basicUnsafeCopy (MV_Rounded MVector s a
mv) (V_Rounded Vector a
v) = forall (v :: * -> *) a s.
Vector v a =>
Mutable v s a -> v a -> ST s ()
VG.basicUnsafeCopy MVector s a
mv Vector a
v
elemseq :: forall b. Vector (Rounded r a) -> Rounded r a -> b -> b
elemseq (V_Rounded Vector a
v) Rounded r a
x b
y = forall (v :: * -> *) a b. Vector v a => v a -> a -> b -> b
VG.elemseq Vector a
v (coerce :: forall a b. Coercible a b => a -> b
coerce Rounded r a
x) b
y
instance VU.Unbox a => VU.Unbox (Rounded r a)