packages feed

data-default-instances-new-base (empty) → 0.0.1

raw patch · 6 files changed

+440/−0 lines, 6 filesdep +basedep +data-default-classdep +data-default-instances-basesetup-changed

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

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-new-base-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) 2015-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,110 @@+# data-default-instances-new-base++[![Hackage](http://img.shields.io/hackage/v/data-default-instances-new-base.svg)][data-default-instances-new-base]+[![Hackage Dependencies](https://img.shields.io/hackage-deps/v/data-default-instances-new-base.svg)](http://packdeps.haskellers.com/reverse/data-default-instances-new-base)+[![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++Orphan instances for `Default` type class, which is defined in package+[data-default-class][].++In addition to instances reexported from [data-default-instances-base][]+package, following `Default` instances are provided:++```Haskell+instance Default a => Default (Const a b) where+    def = Const def++instance Monad m => Default (Kleisli m a b) where+    def = Kleisli return++instance Default Version where+    def = Version [] []+```++Following instances are available only for [base][] >= 4.7.0.0:++```Haskell+instance Default (Proxy a) where+    def = Proxy++instance Default SomeNat where+    def = SomeNat (Proxy :: Proxy 0)++instance Default SomeNat where+    def = SomeSymbol (Proxy :: Proxy "")+```++Following instances are available only for [base][] >= 4.8.0.0:++```Haskell+instance Alternative f => Default (Alt f a) where+    def = Alt empty++instance Default a => Default (Identity a) where+    def = Identity def++instance Default Natural where+    def = 0+```++Following instances are available only for [base][] >= 4.9.0.0:++```Haskell+instance Default a => Default (NonEmpty a) where+    def = def :| []++instance 'Bounded' a => Default (Min a) where+    def = minBound++instance Bounded a => Default (Max a) where+    def = maxBound++instance 'Default' ('Option' a) where+    def = Option Nothing+```++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.+++[base]:+  https://hackage.haskell.org/package/base+  "Package base 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-base]:+  https://hackage.haskell.org/package/data-default-instances-base+  "Package data-default-instances-base on Hackage"+[data-default-instances-new-base]:+  https://hackage.haskell.org/package/data-default-instances-new-base+  "Package data-default-instances-new-base on Hackage"+[Haskell.org]:+  http://www.haskell.org+  "The Haskell Programming Language"+[LICENSE]:+  https://github.com/trskop/data-default-extra/blob/master/instances-new-base/LICENSE+  "License of data-default-instances-new-base 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-new-base.cabal view
@@ -0,0 +1,95 @@+name:                   data-default-instances-new-base+version:                0.0.1++synopsis:+  Default instances for types in newer versions of base package.+description:+  Orphan instances for @Default@ type class, which is defined in package+  <https://hackage.haskell.org/package/data-default-class data-default-class>.+  .+  In addition to instances reexported from+  <https://hackage.haskell.org/package/data-default-instances-base data-default-instances-base>+  package, following @Default@ instances are provided:+  .+  > instance Default a => Default (Const a b) where+  >     def = Const def+  >+  > instance Monad m => Default (Kleisli m a b) where+  >     def = Kleisli return+  >+  > instance Default Version where+  >     def = Version [] []+  .+  Following instances are available only for base >= 4.7.0.0:+  .+  > instance Default (Proxy a) where+  >     def = Proxy+  >+  > instance Default SomeNat where+  >     def = SomeNat (Proxy :: Proxy 0)+  >+  > instance Default SomeNat where+  >     def = SomeSymbol (Proxy :: Proxy "")+  .+  Following instances are available only for base >= 4.8.0.0:+  .+  > instance Alternative f => Default (Alt f a) where+  >     def = Alt empty+  >+  > instance Default a => Default (Identity a) where+  >     def = Identity def+  >+  > instance Default Natural where+  >     def = 0+  .+  Following instances are available only for base >= 4.9.0.0:+  .+  > instance Default a => Default (NonEmpty a) where+  >     def = def :| []+  >+  > instance Bounded a => Default (Min a) where+  >     def = minBound+  >+  > instance Bounded a => Default (Max a) where+  >     def = maxBound+  >+  > instance Default (Option a) where+  >     def = Option Nothing++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) 2015-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.Base.New+  -- other-modules:++  default-language:     Haskell2010+  other-extensions:     CPP, NoImplicitPrelude, DataKinds++  build-depends:+      base >=4 && <5+    -- ^ Probably even lower version of base could be supported.+    , data-default-class ==0.0.*+    , data-default-instances-base ==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:                  new-base-v0.0.1
+ src/Data/Default/Instances/Base/New.hs view
@@ -0,0 +1,190 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}++#if MIN_VERSION_base(4,7,0)+{-# LANGUAGE DataKinds #-}+#endif++-- |+-- Module:       $HEADER$+-- Description:  Default instances for types in newer versions of base package.+-- Copyright:    (c) 2015-2016, Peter Trško+-- License:      BSD3+--+-- Maintainer:   peter.trsko@gmail.com+-- Stability:    stable+-- Portability:  CPP, DataKinds (for base >=4.7.0.0), FlexibleInstances,+--               NoImplicitPrelude+--+-- 'Default' instances for types in newer versions of+-- <https://hackage.haskell.org/package/base base> package.+module Data.Default.Instances.Base.New+    ( -- $providedInstances+    )+  where++import Control.Arrow (Kleisli(Kleisli))+import Control.Monad (Monad(return))++#if MIN_VERSION_base(4,7,0)+import Data.Proxy (Proxy(Proxy))+import GHC.TypeLits (SomeNat(SomeNat), SomeSymbol(SomeSymbol))+#endif++#if MIN_VERSION_base(4,8,0)+import Control.Applicative (Alternative)+import Data.Functor.Identity (Identity(Identity))+import Data.Monoid (Alt, Monoid(mempty))+import Data.Version (Version, makeVersion)+import Numeric.Natural (Natural)+#else+import Data.Version (Version(Version))+#endif++#if MIN_VERSION_base(4,9,0)+import Prelude (Bounded(maxBound, minBound))++import Data.Functor.Const+    -- Const was moved from "Control.Applicative" in to its own module.+import Data.List.NonEmpty (NonEmpty((:|)))+import Data.Maybe (Maybe(Nothing))+import Data.Semigroup+    ( Min+    , Max+    , Option(Option)+    )+#else+import Control.Applicative (Const(Const))+#endif++import Data.Default.Class (Default(def))+import Data.Default.Instances.Base ()+++-- | @'def' = 'Const' 'def'@+instance Default a => Default (Const a b) where+    def = Const def++-- | @'def' = 'Kleisli' 'return'@+instance Monad m => Default (Kleisli m a a) where+    def = Kleisli return++#if MIN_VERSION_base(4,8,0)+-- | @'def' = 'makeVersion' []@+#else+-- | @'def' = 'Version' [] []@+#endif+instance Default Version where+    def =+#if MIN_VERSION_base(4,8,0)+        makeVersion []+#else+        Version [] []+#endif++#if MIN_VERSION_base(4,7,0)+-- | @'def' = 'Proxy'@+instance Default (Proxy a) where+    def = Proxy++-- | @'def' = 'SomeNat' ('Proxy' :: 'Proxy' 0)@+instance Default SomeNat where+    def = SomeNat (Proxy :: Proxy 0)++-- | @'def' = 'SomeSymbol' ('Proxy' :: 'Proxy' \"\")@+instance Default SomeSymbol where+    def = SomeSymbol (Proxy :: Proxy "")+#endif++#if MIN_VERSION_base(4,8,0)+-- | @'def' = 'mempty'@+instance Alternative f => Default (Alt f a) where+    def = mempty++-- | @'def' = 'Identity' 'def'@+instance Default a => Default (Identity a) where+    def = Identity def++-- | @'def' = 0@+instance Default Natural where+    def = 0+#endif++#if MIN_VERSION_base(4,9,0)+-- | @'def' = 'def' ':|' []@+instance Default a => Default (NonEmpty a) where+    def = def :| []++-- | @'def' = 'minBound'@+instance Bounded a => Default (Min a) where+    def = minBound++-- | @'def' = 'maxBound'@+instance Bounded a => Default (Max a) where+    def = maxBound++-- | @'def' = 'Option' 'Nothing'@+instance Default (Option a) where+    def = Option Nothing+#endif++-- $providedInstances+--+-- Following 'Default' instances are provided:+--+-- @+-- instance 'Default' a => 'Default' ('Const' a b) where+--     'def' = 'Const' 'def'+--+-- instance 'Monad' m => 'Default' ('Kleisli' m a b) where+--     'def' = 'Kleisli' 'return'+--+-- instance 'Default' 'Version' where+--     'def' = 'Version' [] []+-- @+--+-- Following instances are available only for base >= 4.7.0.0:+--+-- @+-- instance 'Default' ('Proxy' a) where+--     'def' = 'Proxy'+--+-- instance 'Default' 'SomeNat' where+--     'def' = 'SomeNat' ('Proxy' :: 'Proxy' 0)+--+-- instance 'Default' 'SomeNat' where+--     'def' = 'SomeSymbol' ('Proxy' :: 'Proxy' \"\")+-- @+--+-- Following instances are available only for base >= 4.8.0.0:+--+-- @+-- instance 'Alternative' f => 'Default' ('Alt' f a) where+--     'def' = 'Data.Monoid.Alt' 'Control.Applicative.empty'+--+-- instance 'Default' a => 'Default' ('Identity' a) where+--     'def' = 'Identity' 'def'+--+-- instance 'Default' 'Natural' where+--     'def' = 0+-- @+--+-- Following instances are available only for base >= 4.9.0.0:+--+-- @+-- instance 'Default' a => 'Default' ('NonEmpty' a) where+--     'def' = 'def' ':|' []+--+-- instance 'Bounded' a => 'Default' ('Min' a) where+--     'def' = 'minBound'+--+-- instance 'Bounded' a => 'Default' ('Max' a) where+--     'def' = maxBound+--+-- instance 'Default' ('Option' a) where+--     'def' = 'Option' 'Nothing'+-- @+--+-- This module also reexporting instances from "Data.Default.Instances.Base".