Copyright | (c) 2019-2021 Edward Kmett |
---|---|
License | BSD-2-Clause OR Apache-2.0 |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- newtype Diff a b = Diff {}
- inv :: Diff a b -> Diff b a
- next :: forall a. Storable a => Diff a a
- prev :: Storable a => Diff a a
- (.*) :: Int -> Diff a a -> Diff a a
- advance :: Storable a => Int -> Diff a a
- class DiffTorsor t where
- peekDiffOff :: (MonadIO m, Storable b) => Ptr a -> Diff a b -> m b
- pokeDiffOff :: (MonadIO m, Storable b) => Ptr a -> Diff a b -> b -> m ()
Documentation
Instances
Category Diff Source # | |
Eq (Diff a b) Source # | |
(Data a, Data b) => Data (Diff a b) Source # | |
Defined in Foreign.Ptr.Diff gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Diff a b -> c (Diff a b) # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Diff a b) # toConstr :: Diff a b -> Constr # dataTypeOf :: Diff a b -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Diff a b)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Diff a b)) # gmapT :: (forall b0. Data b0 => b0 -> b0) -> Diff a b -> Diff a b # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Diff a b -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Diff a b -> r # gmapQ :: (forall d. Data d => d -> u) -> Diff a b -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Diff a b -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Diff a b -> m (Diff a b) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Diff a b -> m (Diff a b) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Diff a b -> m (Diff a b) # | |
Ord (Diff a b) Source # | |
Defined in Foreign.Ptr.Diff | |
Read (Diff a b) Source # | |
Show (Diff a b) Source # | |
Generic (Diff a b) Source # | |
type Rep (Diff a b) Source # | |
Defined in Foreign.Ptr.Diff |
inv :: Diff a b -> Diff b a Source #
Invert a pointer Diff
, e.g. convert a pointer to a field member to one that computes the location
of the parent, or one that computes the offset of the next item into one that computes the offset of
the previous element.
next :: forall a. Storable a => Diff a a Source #
Calculate the position of the next elment of a given type when they are packed in densely.
prev :: Storable a => Diff a a Source #
Calculate the position of the previous element of a given type when they are packed in densely.
(.*) :: Int -> Diff a a -> Diff a a infixr 6 Source #
Diff
is a groupoid, so Diff a a
is a group, and as such it forms a module over the integers
advance :: Storable a => Int -> Diff a a Source #
Advance n
(possibly negative) items in a dense packing.
class DiffTorsor t where Source #
Instances
DiffTorsor Ptr Source # | |
DiffTorsor FunPtr Source # | |
DiffTorsor ForeignPtr Source # | due to finalizers this doesn't _quite_ satisfy ForeignPtr a * Diff a b - ForeignPtr a * ForeignPtr b |
Defined in Foreign.Ptr.Diff act :: Diff a b -> ForeignPtr a -> ForeignPtr b Source # diff :: ForeignPtr b -> ForeignPtr a -> Diff a b Source # |