aeson-serialize (empty) → 0.0.0
raw patch · 6 files changed
+88/−0 lines, 6 filesdep +HUnitdep +aesondep +basesetup-changed
Dependencies added: HUnit, aeson, base, cereal, hspec
Files
- LICENSE +30/−0
- Setup.hs +2/−0
- aeson-serialize.cabal +37/−0
- src/Data/Aeson/Serialize.hs +15/−0
- src/Data/Aeson/Serialize/Internal.hs +3/−0
- test/Spec.hs +1/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2014, Kevin Cotrone++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Kevin Cotrone nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ aeson-serialize.cabal view
@@ -0,0 +1,37 @@+Name: aeson-serialize+Version: 0.0.0+Author: Kevin Cotrone <kevincotrone@gmail.com>+Maintainer: Kevin Cotrone <kevincotrone@gmail.com>+License: BSD3+License-File: LICENSE+Synopsis: Simple serialization functions for aeson types+Description: Serialize a type using json instances+Cabal-Version: >= 1.10+Build-Type: Simple++Library+ Default-Language: Haskell2010+ HS-Source-Dirs: src+ GHC-Options: -Wall+ Exposed-Modules: Data.Aeson.Serialize+ Other-Modules: Data.Aeson.Serialize.Internal+ Build-Depends: base >= 4 && < 5+ , aeson+ , cereal++Test-Suite spec+ Type: exitcode-stdio-1.0+ Default-Language: Haskell2010+ Hs-Source-Dirs: src+ , test+ Ghc-Options: -Wall+ Main-Is: Spec.hs+ Build-Depends: base+ , hspec+ , aeson+ , cereal+ , HUnit++Source-Repository head+ Type: git+ Location: git@github.com:plow-technologies/aeson-serialize.git
+ src/Data/Aeson/Serialize.hs view
@@ -0,0 +1,15 @@+module Data.Aeson.Serialize where++import Data.Aeson+import Data.Serialize hiding (decode, encode)++-- | put function for all serialization of a json type+putToJSON :: (ToJSON a) => Putter a+putToJSON = put . encode++-- | get function for all deserialization of a json type+getFromJSON :: (FromJSON a) => Get a+getFromJSON = get >>= (either fail return) . eitherDecode+++-- The intended use is to define an instance of Serialize where get and put are putToJSON and getFromJSON respectively
+ src/Data/Aeson/Serialize/Internal.hs view
@@ -0,0 +1,3 @@+module Data.Aeson.Serialize.Internal+ (+ ) where
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}