| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ptr.PokeAndPeek
Synopsis
- data PokeAndPeek input output = PokeAndPeek !Int (Ptr Word8 -> input -> IO ()) (Ptr Word8 -> IO output)
- type InvPokeAndPeek value = PokeAndPeek value value
- word8 :: InvPokeAndPeek Word8
- leWord16 :: InvPokeAndPeek Word16
- leWord32 :: InvPokeAndPeek Word32
- leWord64 :: InvPokeAndPeek Word64
- beWord16 :: InvPokeAndPeek Word16
- beWord32 :: InvPokeAndPeek Word32
- beWord64 :: InvPokeAndPeek Word64
- bytes :: Int -> InvPokeAndPeek ByteString
Documentation
data PokeAndPeek input output Source #
Encoder and decoder of the same binary representation.
You can compose both the covariant and contravariant parameters of PokeAndPeek using Applicative and Profunctor. E.g.,
word8AndWord32 :: PokeAndPeek (Word8, Word32) (Word8, Word32) word8AndWord32 = (,) <$> lmap fst word8 <*> lmap snd beWord32
Constructors
| PokeAndPeek !Int (Ptr Word8 -> input -> IO ()) (Ptr Word8 -> IO output) |
Instances
| Profunctor PokeAndPeek Source # | |
Defined in Ptr.PokeAndPeek Methods dimap :: (a -> b) -> (c -> d) -> PokeAndPeek b c -> PokeAndPeek a d lmap :: (a -> b) -> PokeAndPeek b c -> PokeAndPeek a c rmap :: (b -> c) -> PokeAndPeek a b -> PokeAndPeek a c (#.) :: forall a b c q. Coercible c b => q b c -> PokeAndPeek a b -> PokeAndPeek a c (.#) :: forall a b c q. Coercible b a => PokeAndPeek b c -> q a b -> PokeAndPeek a c | |
| Functor (PokeAndPeek input) Source # | |
Defined in Ptr.PokeAndPeek Methods fmap :: (a -> b) -> PokeAndPeek input a -> PokeAndPeek input b (<$) :: a -> PokeAndPeek input b -> PokeAndPeek input a | |
| Applicative (PokeAndPeek input) Source # | |
Defined in Ptr.PokeAndPeek Methods pure :: a -> PokeAndPeek input a (<*>) :: PokeAndPeek input (a -> b) -> PokeAndPeek input a -> PokeAndPeek input b liftA2 :: (a -> b -> c) -> PokeAndPeek input a -> PokeAndPeek input b -> PokeAndPeek input c (*>) :: PokeAndPeek input a -> PokeAndPeek input b -> PokeAndPeek input b (<*) :: PokeAndPeek input a -> PokeAndPeek input b -> PokeAndPeek input a | |
type InvPokeAndPeek value = PokeAndPeek value value Source #
A codec, which encodes and decodes the same type. E.g.,
word8AndWord32 :: InvPokeAndPeek (Word8, Word32) word8AndWord32 = (,) <$> lmap fst word8 <*> lmap snd beWord32
word8 :: InvPokeAndPeek Word8 Source #
leWord16 :: InvPokeAndPeek Word16 Source #
leWord32 :: InvPokeAndPeek Word32 Source #
leWord64 :: InvPokeAndPeek Word64 Source #
beWord16 :: InvPokeAndPeek Word16 Source #
beWord32 :: InvPokeAndPeek Word32 Source #
beWord64 :: InvPokeAndPeek Word64 Source #
bytes :: Int -> InvPokeAndPeek ByteString Source #