forked from msgpack/msgpack-haskell
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
73 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
/.cabal-sandbox | ||
/cabal.sandbox.config | ||
/.stack-work | ||
/stack.yaml.lock | ||
|
||
# Temporary files. | ||
*~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters