Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data PokeAndPeek input output = PokeAndPeek !Int (Ptr Word8 -> input -> IO ()) (Ptr Word8 -> IO output)
- type InvPokeAndPeek value = PokeAndPeek value value
- word8 :: InvPokeAndPeek Word8
- 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
Profunctor PokeAndPeek Source # | |
Functor (PokeAndPeek input) Source # | |
Applicative (PokeAndPeek input) Source # | |
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
bytes :: Int -> InvPokeAndPeek ByteString Source #