Z-MessagePack

MessagePack codec


Keywords
data, library, Propose Tags , Z.Data.MessagePack, Z.Data.MessagePack.Base, Z.Data.MessagePack.Builder, Z.Data.MessagePack.Value
License
BSD-3-Clause
Install
cabal install Z-MessagePack

Documentation

Z-MessagePack

This package is part of Z project, provides MessagePack codecs.

Requirements

  • A working haskell compiler system, GHC(>=8.6), cabal-install(>=2.4), hsc2hs.

  • Tests need hspec-discover.

Example usage

{-# LANGUAGE DeriveGeneric, DeriveAnyClass, DerivingStrategies, TypeApplication #-}

import           GHC.Generics
import qualified Z.MessagePack as MessagePack
import           Z.MessagePack (MessagePack)
import qualified Z.Data.Text as T

data Person = Person
    { name  :: T.Text
    , age   :: Int
    , magic :: Bool
    }
  deriving (Show, Generic)
  deriving anyclass MessagePack

> MessagePack.encode [Person {name = "Erik Weisz", age = 52, magic = True}]
> [145,131,164,110,97,109,101,170,69,114,105,107,32,87,101,105,115,122,163,97,103,101,52,165,109,97,103,105,99,195]