packages feed

data-default-instances-bytestring (empty) → 0.0.1

raw patch · 6 files changed

+297/−0 lines, 6 filesdep +basedep +bytestringdep +data-default-classsetup-changed

Dependencies added: base, bytestring, data-default-class

Files

+ ChangeLog.md view
@@ -0,0 +1,13 @@+# ChangeLog / ReleaseNotes+++## Version 0.0.1++* First public release.+* Uploaded to [Hackage][]: <http://hackage.haskell.org/package/data-default-instances-bytestring-0.0.1>++++[Hackage]:+  http://hackage.haskell.org/+  "HackageDB (or just Hackage) is a collection of releases of Haskell packages."
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2016, Peter Trško++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 Peter Trško 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.
+ README.md view
@@ -0,0 +1,66 @@+# data-default-instances-bytestring++[![Hackage](http://img.shields.io/hackage/v/data-default-instances-bytestring.svg)][data-default-instances-bytestring]+[![Hackage Dependencies](https://img.shields.io/hackage-deps/v/data-default-instances-bytestring.svg)](http://packdeps.haskellers.com/reverse/data-default-instances-bytestring)+[![Haskell Programming Language](https://img.shields.io/badge/language-Haskell-blue.svg)][Haskell.org]+[![BSD3 License](http://img.shields.io/badge/license-BSD3-brightgreen.svg)][tl;dr Legal: BSD3]++[![Build](https://travis-ci.org/trskop/data-default-extra.svg)](https://travis-ci.org/trskop/data-default-extra)+++# Description++`Default` instances for types defined in [bytestring][] package:++```Haskell+instance Default Strict.ByteString where+    def = Strict.ByteString.empty++instance Default Lazy.ByteString where+    def = Lazy.ByteString.empty++-- For bytestring >=0.10.+instance Default Builder where+    def = mempty++-- For bytestring >=0.10.4.+instance Default ShortByteString where+    def = ShortByteString.empty+```++This package is intended to be used in conjunction with [data-default][]+package or directly with [data-default-class][] package.+++## License++The BSD 3-Clause License, see [LICENSE][] file for details.+++## Contributions++Contributions, pull requests and bug reports are welcome! Please don't be+afraid to contact author using GitHub or by e-mail.+++[bytestring]:+  https://hackage.haskell.org/package/bytestring+  "Package bytestring on Hackage"+[data-default]:+  https://hackage.haskell.org/package/data-default+  "Package data-default on Hackage"+[data-default-class]:+  https://hackage.haskell.org/package/data-default-class+  "Package data-default-class on Hackage"+[data-default-instances-bytestring]:+  https://hackage.haskell.org/package/data-default-instances-bytestring+  "Package data-default-instances-bytestring on Hackage"+[Haskell.org]:+  http://www.haskell.org+  "The Haskell Programming Language"+[LICENSE]:+  https://github.com/trskop/data-default-extra/blob/master/instances-bytestring/LICENSE+  "License of data-default-instances-bytestring package."+[tl;dr Legal: BSD3]:+  https://tldrlegal.com/license/bsd-3-clause-license-%28revised%29+  "BSD 3-Clause License (Revised)"
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ data-default-instances-bytestring.cabal view
@@ -0,0 +1,74 @@+name:                   data-default-instances-bytestring+version:                0.0.1+synopsis:+  Default instances for (lazy and strict) ByteString, Builder and+  ShortByteString.+description:+  Orphan instances for @Default@ type class, which is defined in package+  <https://hackage.haskell.org/package/data-default-class data-default-class>.+  .+  Following @Default@ instances are provided:+  .+  > -- Strict ByteString:+  > instance Default ByteString where+  >     def = empty+  >+  > -- Lazy ByteString:+  > instance Default ByteString where+  >     def = empty+  .+  Following instance is provided only for+  <https://hackage.haskell.org/package/bytestring bytestring> >=0.10, since+  that it the version that introduced @Builder@:+  .+  > instance Default Builder where+  >     def = mempty+  .+  Following instance is provided only for+  <https://hackage.haskell.org/package/bytestring bytestring> >=0.10.4, since+  that it the version that introduced @ShortByteString@:+  .+  > instance Default ShortByteString where+  >     def = empty++homepage:               https://github.com/trskop/data-default-extra+bug-reports:            https://github.com/trskop/data-default-extra/issues+license:                BSD3+license-file:           LICENSE+author:                 Peter Trško+maintainer:             peter.trsko@gmail.com+copyright:              (c) 2016, Peter Trško+category:               Data+build-type:             Simple+cabal-version:          >=1.10++extra-source-files:+    ChangeLog.md+  , README.md++library+  hs-source-dirs:       src+  exposed-modules:      Data.Default.Instances.ByteString++  default-language:     Haskell2010+  other-extensions:     CPP, NoImplicitPrelude++  build-depends:+      base <6+    -- ^ Only using mempty method of Monoid class, therefore the bounds do not+    -- really matter, unless Monoid class is drastically changed.+    , bytestring >=0.9 && <1+    -- ^ Version 0.9 is the oldest available on Hackage.++    , data-default-class ==0.0.*++  ghc-options:          -Wall -fwarn-tabs++source-repository head+  type:                 git+  location:             git://github.com/trskop/data-default-extra.git++source-repository this+  type:                 git+  location:             git://github.com/trskop/data-default-extra.git+  tag:                  bytestring-v0.0.1
+ src/Data/Default/Instances/ByteString.hs view
@@ -0,0 +1,112 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+-- |+-- Module:       $HEADER$+-- Description:  Default instances for (strict and lazy) ByteString and+--               ByteString Builder.+-- Copyright:    (c) 2016, Peter Trško+-- License:      BSD3+--+-- Maintainer:   peter.trsko@gmail.com+-- Stability:    stable+-- Portability:  CPP, NoImplicitPrelude+--+-- 'Default' instances for (strict) 'Strict.ByteString', (lazy)+-- 'Lazy.ByteString' and 'Builder' from+-- <https://hackage.haskell.org/package/bytestring bytestring> package.+module Data.Default.Instances.ByteString+    ( -- $providedInstances+    )+  where++#if MIN_VERSION_bytestring(0,10,0)+-- Importing mempty only for Builder instance. Builder is not available before+-- bytestring ==0.10.+import Data.Monoid (Monoid(mempty))+#endif++import qualified Data.ByteString as Strict (ByteString)+import qualified Data.ByteString as Strict.ByteString (empty)+import qualified Data.ByteString.Lazy as Lazy (ByteString)+import qualified Data.ByteString.Lazy as Lazy.ByteString (empty)++#if MIN_VERSION_bytestring(0,10,2)+-- Builder moved from Data.ByteString.Lazy.Builder to Data.ByteString.Builder+-- module in version 0.10.2.0.+import Data.ByteString.Builder (Builder)+#elif MIN_VERSION_bytestring(0,10,0)+import Data.ByteString.Lazy.Builder (Builder)+#endif++#if MIN_VERSION_bytestring(0,10,4)+import Data.ByteString.Short (ShortByteString)+import qualified Data.ByteString.Short as ShortByteString (empty)+#endif++import Data.Default.Class (Default(def))+++-- | @'def' = 'Strict.ByteString.empty'@+instance Default Strict.ByteString where+    def = Strict.ByteString.empty+    {-# INLINE def #-}++-- | @'def' = 'Lazy.ByteString.empty'@+instance Default Lazy.ByteString where+    def = Lazy.ByteString.empty+    {-# INLINE def #-}++#if MIN_VERSION_bytestring(0,10,0)+-- Version 0.10.0.0 is the first that introduced Builder.++-- | @'def' = 'mempty'@+instance Default Builder where+    -- Using mempty implies that we need dependency on base, other option would+    -- be to depend on internal module of bytestring package. Considering the+    -- first option to be the lesser of two evils.+    def = mempty+    {-# INLINE def #-}+#endif++#if MIN_VERSION_bytestring(0,10,4)+-- Version 0.10.4.0 is the first that introduced ShortByteString.++-- | @'def' = 'ShortByteString.empty'@+instance Default ShortByteString where+    def = ShortByteString.empty+    {-# INLINE def #-}+#endif+++-- $providedInstances+--+-- Following instances are provided:+--+-- @+-- -- Strict ByteString:+-- instance 'Default' 'Strict.ByteString' where+--     'def' = 'Strict.ByteString.empty'+--+-- -- Lazy ByteString:+-- instance 'Default' 'Lazy.ByteString' where+--     'def' = 'Lazy.ByteString.empty'+-- @+--+-- Following instance is provided only for+-- <https://hackage.haskell.org/package/bytestring bytestring> >=0.10, since+-- that it the version that introduced 'Builder':+--+-- @+-- instance 'Default' 'Builder' where+--     'def' = 'mempty'+-- @+--+-- Following instance is provided only for+-- <https://hackage.haskell.org/package/bytestring bytestring> >=0.10.4, since+-- that it the version that introduced 'ShortByteString':+--+-- @+-- instance 'Default' 'ShortByteString' where+--     'def' = 'ShortByteString.empty'+-- @