data-default-instances-text (empty) → 0.0.1
raw patch · 6 files changed
+262/−0 lines, 6 filesdep +basedep +data-default-classdep +textsetup-changed
Dependencies added: base, data-default-class, text
Files
- ChangeLog.md +13/−0
- LICENSE +30/−0
- README.md +70/−0
- Setup.hs +2/−0
- data-default-instances-text.cabal +66/−0
- src/Data/Default/Instances/Text.hs +81/−0
+ 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-text-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,70 @@+# data-default-instances-text++[][data-default-instances-text]+[](http://packdeps.haskellers.com/reverse/data-default-instances-text)+[][Haskell.org]+[][tl;dr Legal: BSD3]++[](https://travis-ci.org/trskop/data-default-extra)+++# Description++`Default` instances for types defined in [text][] package:++```Haskell+instance Default Strict.Text where+ def = Strict.Text.empty++instance Default Lazy.Text where+ def = Lazy.Text.empty++-- For text >=0.8+instance Default Builder where+ def = mempty+```++Following instances are provided only for [text][] >=0.8, since that+it the version that introduced `Builder`:++```Haskell+instance Default Builder where+ def = mempty+```++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.+++[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-text]:+ https://hackage.haskell.org/package/data-default-instances-text+ "Package data-default-instances-text on Hackage"+[Haskell.org]:+ http://www.haskell.org+ "The Haskell Programming Language"+[LICENSE]:+ https://github.com/trskop/data-default-extra/blob/master/instances-text/LICENSE+ "License of data-default-instances-text package."+[text]:+ https://hackage.haskell.org/package/text+ "Package text on Hackage"+[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-text.cabal view
@@ -0,0 +1,66 @@+name: data-default-instances-text+version: 0.0.1+synopsis:+ Default instances for (lazy and strict) Text and Text Builder.+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 Text:+ > instance Default Text where+ > def = empty+ >+ > -- Lazy Text:+ > instance Default Text where+ > def = empty+ .+ Following instances are provided only for+ <https://hackage.haskell.org/package/text text> >=0.8, since that it the+ version that introduced @Builder@:+ .+ > instance Default Builder where+ > def = mempty++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.Text++ 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.+ , text >=0.2 && <2+ -- ^ Version 0.2 is the first that provided both strict and lazy Text.++ , 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: text-v0.0.1
+ src/Data/Default/Instances/Text.hs view
@@ -0,0 +1,81 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+-- |+-- Module: $HEADER$+-- Description: Default instances for (strict and lazy) Text and Text Builder.+-- Copyright: (c) 2016, Peter Trško+-- License: BSD3+--+-- Maintainer: peter.trsko@gmail.com+-- Stability: stable+-- Portability: CPP, NoImplicitPrelude+--+-- 'Default' instances for (strict) 'Strict.Text', (lazy) 'Lazy.Text' and+-- 'Builder' from+-- <https://hackage.haskell.org/package/text text> package.+module Data.Default.Instances.Text+ ( -- $providedInstances+ )+ where++import Data.Monoid (Monoid(mempty))++import qualified Data.Text as Strict (Text)+import qualified Data.Text as Strict.Text (empty)+import qualified Data.Text.Lazy as Lazy (Text)+import qualified Data.Text.Lazy as Lazy.Text (empty)++#if MIN_VERSION_text(0,8,0)+-- Version 0.8.0.0 is the first that introduced Builder.+import Data.Text.Lazy.Builder (Builder)+#endif++import Data.Default.Class (Default(def))+++-- | @'def' = 'Strict.Text.empty'@+instance Default Strict.Text where+ def = Strict.Text.empty+ {-# INLINE def #-}++-- | @'def' = 'Lazy.Text.empty'@+instance Default Lazy.Text where+ def = Lazy.Text.empty+ {-# INLINE def #-}++#if MIN_VERSION_text(0,8,0)+-- Version 0.8.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 text package. Considering the first+ -- option to be the lesser of two evils.+ def = mempty+ {-# INLINE def #-}+#endif+++-- $providedInstances+--+-- Following instances are provided:+--+-- @+-- -- Strict Text:+-- instance 'Default' 'Strict.Text' where+-- 'def' = 'Strict.Text.empty'+--+-- -- Lazy Text:+-- instance 'Default' 'Lazy.Text' where+-- 'def' = 'Lazy.Text.empty'+-- @+--+-- Following instances are provided only for+-- <https://hackage.haskell.org/package/text text> >=0.8, since that it the+-- version that introduced 'Builder':+--+-- @+-- instance 'Default' 'Builder' where+-- 'def' = 'mempty'+-- @