Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
tests: True
packages: */*.cabal

packages:
msgpack
msgpack-aeson
msgpack-rpc
-- msgpack-idl
-- msgpack-idl-web
22 changes: 0 additions & 22 deletions cabal.project.floor-ghc-7.8.4

This file was deleted.

23 changes: 11 additions & 12 deletions msgpack-aeson/msgpack-aeson.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ library
hs-source-dirs: src
exposed-modules: Data.MessagePack.Aeson

build-depends: base >= 4.7 && < 4.14
, aeson >= 0.8.0.2 && < 0.12
|| >= 1.0 && < 1.5
, bytestring >= 0.10.4 && < 0.11
, msgpack >= 1.1.0 && < 1.2
, scientific >= 0.3.2 && < 0.4
, text >= 1.2.3 && < 1.3
, unordered-containers >= 0.2.5 && < 0.3
, vector >= 0.10.11 && < 0.13
, deepseq >= 1.3 && < 1.5
build-depends: base
, aeson
, bytestring
, msgpack
, scientific
, text
, unordered-containers
, vector
, deepseq

default-language: Haskell2010

Expand All @@ -48,7 +47,7 @@ test-suite msgpack-aeson-test
, aeson
, msgpack
-- test-specific dependencies
, tasty == 1.2.*
, tasty-hunit == 0.10.*
, tasty
, tasty-hunit

default-language: Haskell2010
10 changes: 8 additions & 2 deletions msgpack-aeson/src/Data/MessagePack/Aeson.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import Control.Arrow
import Control.DeepSeq
import Control.Exception
import Data.Aeson as A
import Data.Aeson.KeyMap as KM (fromList, toList)
import Data.Aeson.Key as K (toText, fromText, Key)
import qualified Data.ByteString.Lazy as L (ByteString)
import Data.Data
import qualified Data.HashMap.Strict as HM
Expand All @@ -50,7 +52,7 @@ toAeson = \case
ObjectBin b -> fail $ "ObjectBin is not supported by JSON"
ObjectArray v -> Array <$> V.mapM toAeson v
ObjectMap m ->
A.Object . HM.fromList . V.toList
A.Object . KM.fromList . V.toList
<$> V.mapM (\(k, v) -> (,) <$> from k <*> toAeson v) m
where from = mpResult fail pure . MP.fromObject
ObjectExt _ _ -> fail "ObjectExt is not supported by JSON"
Expand All @@ -68,7 +70,7 @@ fromAeson = \case
Right _ -> fail "number out of bounds"
String t -> pure $ ObjectStr t
Array v -> ObjectArray <$> traverse fromAeson v
A.Object o -> (ObjectMap . V.fromList) <$> traverse fromEntry (HM.toList o)
A.Object o -> (ObjectMap . V.fromList) <$> traverse fromEntry ((\(k, v) -> (K.toText k, v)) <$> KM.toList o)
where
fromEntry (k, v) = (\a -> (ObjectStr k, a)) <$> fromAeson v

Expand Down Expand Up @@ -111,6 +113,10 @@ instance MessagePack a => FromJSON (AsAeson a) where
MP.Error e -> fail e
MP.Success a -> mpResult fail (pure . AsAeson) $ fromObject a

instance MessagePack K.Key where
fromObject o = K.fromText <$> fromObject o
toObject = toObject . K.toText

-- | Encode to MessagePack via "Data.Aeson"'s 'ToJSON' instances
packAeson :: ToJSON a => a -> MP.Result L.ByteString
packAeson a = pack <$> (fromAeson $ toJSON a)
Expand Down
25 changes: 0 additions & 25 deletions msgpack-idl-web/LICENSE

This file was deleted.

Binary file removed msgpack-idl-web/config/favicon.ico
Binary file not shown.
11 changes: 0 additions & 11 deletions msgpack-idl-web/config/models

This file was deleted.

1 change: 0 additions & 1 deletion msgpack-idl-web/config/robots.txt

This file was deleted.

7 changes: 0 additions & 7 deletions msgpack-idl-web/config/routes

This file was deleted.

21 changes: 0 additions & 21 deletions msgpack-idl-web/config/settings.yml

This file was deleted.

20 changes: 0 additions & 20 deletions msgpack-idl-web/config/sqlite.yml

This file was deleted.

97 changes: 0 additions & 97 deletions msgpack-idl-web/deploy/Procfile

This file was deleted.

1 change: 0 additions & 1 deletion msgpack-idl-web/messages/en.msg

This file was deleted.

Loading