mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-04-27 15:05:13 +00:00
f3408d9bb6
* explicit exports * more empty exports * add exports * reorder * use correct ControlProtocol type for xftp router --------- Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
28 lines
719 B
Haskell
28 lines
719 B
Haskell
module Simplex.Messaging.Version.Internal
|
|
( Version (..),
|
|
) where
|
|
|
|
import Data.Aeson (FromJSON (..), ToJSON (..))
|
|
import Data.Word (Word16)
|
|
import Simplex.Messaging.Encoding
|
|
import Simplex.Messaging.Encoding.String
|
|
|
|
-- Do not use constructor of this type directry
|
|
newtype Version v = Version Word16
|
|
deriving (Eq, Ord, Show)
|
|
|
|
instance Encoding (Version v) where
|
|
smpEncode (Version v) = smpEncode v
|
|
smpP = Version <$> smpP
|
|
|
|
instance StrEncoding (Version v) where
|
|
strEncode (Version v) = strEncode v
|
|
strP = Version <$> strP
|
|
|
|
instance ToJSON (Version v) where
|
|
toEncoding (Version v) = toEncoding v
|
|
toJSON (Version v) = toJSON v
|
|
|
|
instance FromJSON (Version v) where
|
|
parseJSON v = Version <$> parseJSON v
|