Skip to content

Instantly share code, notes, and snippets.

@rblaze
Last active December 11, 2015 01:07
Show Gist options
  • Save rblaze/00c6c12662a4a4117d8f to your computer and use it in GitHub Desktop.
Save rblaze/00c6c12662a4a4117d8f to your computer and use it in GitHub Desktop.
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import qualified Data.Binary.Get as G
type BGetM = ReaderT SchemaDef G.Get
newtype BGet t a = BGet (BGetM a)
deriving (Functor, Applicative, Monad)
class Proto t where
bGetInt32 :: BGet t Int32
class Serializable a where
bGet :: Proto t => BGet t a
instance Serializable Int32 where
bGet = bGetInt32
newtype Modifier = Modifier Int32 deriving Serializable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment