Skip to content

Commit

Permalink
Rename package to msgpack-binary.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Mar 26, 2020
1 parent d6247ab commit 3feeb68
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/.cabal-sandbox
/cabal.sandbox.config
/.stack-work
/stack.yaml.lock

# Temporary files.
*~
Expand Down
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
---
language: generic
dist: xenial
os: linux

cache:
directories:
- $HOME/.stack

before_install:
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://github.com/TokTok/hs-tools/releases/download/v0.1/hs-tools-v0.1.tar.gz | tar xz -C $HOME
- travis_retry curl -L https://github.com/TokTok/hs-tools/releases/download/v0.6/hs-tools-v0.6.tar.gz | tar xz -C $HOME

script:
- hlint .
- stylish-haskell-lhs -i .
- git diff --exit-code
- travis_wait stack --no-terminal test --coverage
- shc data-msgpack testsuite
- shc msgpack-binary testsuite
13 changes: 6 additions & 7 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ load("@rules_haskell//haskell:defs.bzl", "haskell_library")
load("//third_party/haskell/hspec-discover:build_defs.bzl", "hspec_test")
load("//tools/project:build_defs.bzl", "project")

project(
license = "hs-msgpack",
)
project(license = "hs-msgpack")

haskell_library(
name = "hs-msgpack",
name = "hs-msgpack-binary",
srcs = glob(["src/**/*.*hs"]),
compiler_flags = ["-Wno-unused-imports"],
src_strip_prefix = "src",
version = "0.0.12",
version = "0.0.14",
visibility = ["//visibility:public"],
deps = [
"//hs-msgpack-types",
Expand All @@ -25,10 +23,11 @@ haskell_library(
)

hspec_test(
name = "test",
name = "testsuite",
size = "small",
compiler_flags = ["-Wno-unused-imports"],
deps = [
":hs-msgpack",
":hs-msgpack-binary",
"//hs-msgpack-types",
hazel_library("QuickCheck"),
hazel_library("base"),
Expand Down
17 changes: 8 additions & 9 deletions data-msgpack.cabal → msgpack-binary.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: data-msgpack
version: 0.0.13
name: msgpack-binary
version: 0.0.14
synopsis: A Haskell implementation of MessagePack
homepage: http://msgpack.org/
license: BSD3
Expand Down Expand Up @@ -39,7 +39,7 @@ library
, binary >= 0.7.0.0
, bytestring
, data-binary-ieee754
, data-msgpack-types >= 0.0.1 && < 0.1.0
, msgpack-types >= 0.0.1 && < 0.1.0
, text

executable msgpack-parser
Expand All @@ -49,12 +49,12 @@ executable msgpack-parser
ghc-options:
-Wall
-fno-warn-unused-imports
main-is: msgpack-parser.hs
build-depends:
base < 5
, bytestring
, groom
, data-msgpack
main-is: msgpack-parser.hs
, msgpack-binary

test-suite testsuite
type: exitcode-stdio-1.0
Expand All @@ -71,14 +71,13 @@ test-suite testsuite
, QuickCheck
, bytestring
, containers
, data-msgpack
, data-msgpack-types
, hashable
, hspec
, msgpack-binary
, msgpack-types
, text
, unordered-containers
, vector
, void

benchmark benchmark
type: exitcode-stdio-1.0
Expand All @@ -96,5 +95,5 @@ benchmark benchmark
, QuickCheck
, bytestring
, criterion
, data-msgpack
, deepseq
, msgpack-binary
5 changes: 2 additions & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
packages: [.]
resolver: lts-6.27
resolver: lts-14.27
extra-deps:
- QuickCheck-2.9.2
- data-msgpack-types-0.0.2
- msgpack-types-0.0.4
44 changes: 21 additions & 23 deletions test/Data/MessagePackSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ module Data.MessagePackSpec where

import Test.Hspec
import Test.QuickCheck
import qualified Test.QuickCheck.Gen as Gen

import Control.Applicative ((<$>), (<*>))
import qualified Data.ByteString.Char8 as S
import qualified Data.ByteString.Lazy as L8
import qualified Data.ByteString.Lazy.Char8 as L
import Data.Hashable (Hashable)
import qualified Data.HashMap.Strict as HashMap
import Data.Int (Int16, Int32, Int64, Int8)
import qualified Data.IntMap as IntMap
import qualified Data.Map as Map
import qualified Data.Maybe as Maybe
import qualified Data.Text.Lazy as LT
import qualified Data.Vector as V
import qualified Data.Vector.Storable as VS
import qualified Data.Vector.Unboxed as VU
import Data.Void (Void)
import Data.Word (Word, Word16, Word32, Word64,
Word8)
import GHC.Generics (Generic)
import qualified Test.QuickCheck.Gen as Gen

import Control.Applicative ((<$>), (<*>))
import qualified Data.ByteString.Char8 as S
import qualified Data.ByteString.Lazy as L8
import qualified Data.ByteString.Lazy.Char8 as L
import Data.Hashable (Hashable)
import qualified Data.HashMap.Strict as HashMap
import Data.Int (Int16, Int32, Int64, Int8)
import qualified Data.IntMap as IntMap
import qualified Data.Map as Map
import qualified Data.Maybe as Maybe
import qualified Data.Result as R
import qualified Data.Text.Lazy as LT
import qualified Data.Vector as V
import qualified Data.Vector.Storable as VS
import qualified Data.Vector.Unboxed as VU
import Data.Void (Void)
import Data.Word (Word, Word16, Word32, Word64,
Word8)
import GHC.Generics (Generic)

import Data.MessagePack
import qualified Data.MessagePack.Types.Result as R


data Unit = Unit
Expand Down Expand Up @@ -324,8 +324,6 @@ spec = do
property $ \(a :: IntMap.IntMap Int) -> a `shouldBe` mid a
it "HashMap String Int" $
property $ \(a :: HashMap.HashMap String Int) -> a `shouldBe` mid a
it "Option Int" $
property $ \(a :: Option Int) -> a `shouldBe` mid a
it "maybe int" $
property $ \(a :: Maybe Int) -> a `shouldBe` mid a
it "maybe nil" $
Expand Down
30 changes: 30 additions & 0 deletions test/Data/Result.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE Safe #-}
module Data.Result
( Result (..)
) where

import Control.Applicative (Applicative (..), (<$>), (<*>))
import Control.Monad.Fail (MonadFail (..))

data Result a
= Success a
| Failure String
deriving (Read, Show, Eq, Functor)

instance Applicative Result where
pure = Success

Success f <*> x = fmap f x
Failure msg <*> _ = Failure msg

instance Monad Result where
return = Success
fail = Failure

Success x >>= f = f x
Failure msg >>= _ = Failure msg

instance MonadFail Result where
fail = Failure
2 changes: 1 addition & 1 deletion tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ haskell_binary(
srcs = ["msgpack-parser.hs"],
compiler_flags = ["-Wno-unused-imports"],
deps = [
"//hs-msgpack",
"//hs-msgpack-binary",
hazel_library("base"),
hazel_library("bytestring"),
hazel_library("groom"),
Expand Down

0 comments on commit 3feeb68

Please sign in to comment.