serokell-util 0.1.1.1 → 0.1.2.0
raw patch · 3 files changed
+9/−13 lines, 3 filesnew-uploader
Files
- serokell-util.cabal +4/−4
- src/Serokell/Data/Variant/Serialization.hs +4/−8
- src/Serokell/Util/I18N.hs +1/−1
serokell-util.cabal view
@@ -1,5 +1,5 @@ name: serokell-util-version: 0.1.1.1+version: 0.1.2.0 synopsis: General-purpose functions by Serokell homepage: https://github.com/serokell/serokell-util license: MIT@@ -52,8 +52,8 @@ Serokell.Util.Parse.Network build-depends: QuickCheck >= 2.8.1 , acid-state- , aeson- , aeson-extra+ , aeson >= 0.11.0.0 && <= 1.0.0.0+ , aeson-extra >= 0.4.0.0 , base >= 4.8 && < 5 , base16-bytestring , base64-bytestring@@ -106,7 +106,7 @@ Test.Serokell.Util.TextSpec Spec type: exitcode-stdio-1.0- build-depends: aeson+ build-depends: aeson >= 0.11.0.0 && <= 1.0.0.0 , base >=4.8 , binary , bytestring
src/Serokell/Data/Variant/Serialization.hs view
@@ -104,12 +104,8 @@ -- —————————MessagePack serialization————————— -- -- MessagePack data structure is very close to Variant. However, note that:--- 1. We are using strange library where Object type doesn't cover all--- possible objects. For example, there is only `Int` for integers.--- So every integer number is converted to `Int` (which may be imprecise).--- Decoding checks sign of input (like JSON).--- 2. MessagePack distinguishes between Float and Double while we don't.--- 3. ObjectExt can't be decoded.+-- 1. MessagePack distinguishes between Float and Double while we don't.+-- 2. ObjectExt can't be decoded. instance MP.MessagePack Variant where toObject VarNone = MP.ObjectNil@@ -126,8 +122,8 @@ v fromObject MP.ObjectNil = pure VarNone fromObject (MP.ObjectBool v) = pure . VarBool $ v- fromObject (MP.ObjectInt v) | v < 0 = pure . VarInt . fromIntegral $ v- | otherwise = pure . VarUInt . fromIntegral $ v+ fromObject (MP.ObjectInt v) = pure . VarInt $ v+ fromObject (MP.ObjectWord v) = pure . VarUInt $ v fromObject (MP.ObjectFloat v) = pure . VarFloat . realToFrac $ v fromObject (MP.ObjectDouble v) = pure . VarFloat $ v fromObject (MP.ObjectStr v) = pure . VarString $ v
src/Serokell/Util/I18N.hs view
@@ -53,7 +53,7 @@ toReplaceToken = (\(AT.String s) -> s) . genericToJSON defaultOptions replaceTranslations- :: (ToReplaceToken token, Eq lang, Ord lang)+ :: (ToReplaceToken token, Ord lang) => Translations lang token -> lang -> T.Text -> Maybe T.Text replaceTranslations translations lang text = M.foldrWithKey