Stability | experimental |
---|---|

Maintainer | Lars Petersen <info@lars-petersen.net> |

You can build your own type-specific stacks. For example the default stack looks like this, whereas the ordering determines, which function matches first for a specific type. This especially allows you to override the default choices:

getExtDefault :: Typeable a => Get a -> Get a getExtDefault = getExtInteger . getExtChar . getExtWord . getExtInt . getExtFloat . getExtText . getExtByteString putExtDefault :: Typeable a => (a -> Put) -> a -> Put putExtDefault = putExtInteger . putExtChar . putExtWord . putExtInt . putExtFloat . putExtText . putExtByteString

Notice that these stacks have to be grounded, ideally with something
that handles algebraic types.
Have a look at `Data.Binary.Generic`

how this is done for the default
stack.

IMPORTANT: You cannot simply apply an extension to `getGeneric`

or
`putGeneric`

, since these do a recursive call at the bottom level
which points to the top of the stack.

# Documentation

getExtDefault :: Typeable a => Get a -> Get aSource

putExtDefault :: Typeable a => (a -> Put) -> a -> PutSource

getExtInteger :: Typeable a => Get a -> Get aSource

putExtInteger :: Typeable a => (a -> Put) -> a -> PutSource

getExtChar :: Typeable a => Get a -> Get aSource

putExtChar :: Typeable a => (a -> Put) -> a -> PutSource

getExtWord :: Typeable a => Get a -> Get aSource

putExtWord :: Typeable a => (a -> Put) -> a -> PutSource

getExtFloat :: Typeable a => Get a -> Get aSource

putExtFloat :: Typeable a => (a -> Put) -> a -> PutSource

getExtText :: Typeable a => Get a -> Get aSource

putExtText :: Typeable a => (a -> Put) -> a -> PutSource

getExtByteString :: Typeable a => Get a -> Get aSource

putExtByteString :: Typeable a => (a -> Put) -> a -> PutSource