packages feed

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

raw patch · 6 files changed

+223/−0 lines, 6 filesdep +data-default-classdep +vectorsetup-changed

Dependencies added: data-default-class, vector

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-vector-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,61 @@+# data-default-instances-vector++[![Hackage](http://img.shields.io/hackage/v/data-default-instances-vector.svg)][data-default-instances-vector]+[![Hackage Dependencies](https://img.shields.io/hackage-deps/v/data-default-instances-vector.svg)](http://packdeps.haskellers.com/reverse/data-default-instances-vector)+[![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 in [vector][] package:++```Haskell+instance Default (Vector a) where+    def = empty++instance Storable a => Default (Storable.Vector a) where+    def = Storable.empty++instance Unbox a => Default (Unboxed.Vector a) where+    def = Unboxed.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.+++[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-vector]:+  https://hackage.haskell.org/package/data-default-instances-vector+  "Package data-default-instances-vector on Hackage"+[Haskell.org]:+  http://www.haskell.org+  "The Haskell Programming Language"+[LICENSE]:+  https://github.com/trskop/data-default-extra/blob/master/instances-vector/LICENSE+  "License of data-default-instances-vector package."+[tl;dr Legal: BSD3]:+  https://tldrlegal.com/license/bsd-3-clause-license-%28revised%29+  "BSD 3-Clause License (Revised)"+[vector]:+  https://hackage.haskell.org/package/vector+  "Package vector on Hackage"
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ data-default-instances-vector.cabal view
@@ -0,0 +1,55 @@+name:                   data-default-instances-vector+version:                0.0.1+synopsis:               Default instances for types defined in vector package+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:+  .+  > instance Default (Vector a) where+  >     def = empty+  >+  > -- Storable Vector:+  > instance Storable a => Default (Vector a) where+  >     def = empty+  >+  > -- Unboxed Vector:+  > instance Unbox a => Default (Vector a) 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) 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.Vector+  -- other-modules:++  default-language:     Haskell2010+  other-extensions:     NoImplicitPrelude++  build-depends:+      vector >=0.5 && <1+    , 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:                  vector-v0.0.1
+ src/Data/Default/Instances/Vector.hs view
@@ -0,0 +1,62 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+-- |+-- Module:       $HEADER$+-- Description:  Default instances for types defined in vector package.+-- Copyright:    (c) 2015-2016, Peter Trško+-- License:      BSD3+--+-- Maintainer:   peter.trsko@gmail.com+-- Stability:    stable+-- Portability:  NoImplicitPrelude+--+-- 'Default' instances for types+-- <https://hackage.haskell.org/package/vector vector> package.+module Data.Default.Instances.Vector+    ( -- $providedInstances+    )+  where++import Data.Vector (Vector, empty)+import Data.Vector.Unboxed (Unbox)+import qualified Data.Vector.Unboxed as Unboxed (Vector, empty)+import Data.Vector.Storable (Storable)+import qualified Data.Vector.Storable as Storable (Vector, empty)++import Data.Default.Class (Default(def))+++-- All "empty" functions we import from Vector are actually implemented using+-- the same generic function, but using it like this provides us with more+-- robust code.++instance Default (Vector a) where+    def = empty+    {-# INLINE def #-}+    -- Function empty is also inlined and we need to preserve low-level+    -- optimizations that are done in vector package.++instance Storable a => Default (Storable.Vector a) where+    def = Storable.empty+    {-# INLINE def #-}+    -- Function Storable.empty is also inlined and we need to preserve+    -- low-level optimizations that are done in vector package.++instance Unbox a => Default (Unboxed.Vector a) where+    def = Unboxed.empty+    {-# INLINE def #-}+    -- Function Unboxed.empty is also inlined and we need to preserve low-level+    -- optimizations that are done in vector package.++-- $providedInstances+--+-- @+-- instance 'Default' ('Vector' a) where+--     'def' = 'empty'+--+-- instance 'Storable' a => 'Default' ('Storable.Vector' a) where+--     'def' = 'Storable.empty'+--+-- instance 'Unbox' a => 'Default' ('Unboxed.Vector' a) where+--     'def' = 'Unboxed.empty'+-- @