vector-read-instances (empty) → 0.0.1.0
raw patch · 4 files changed
+86/−0 lines, 4 filesdep +basedep +vectorsetup-changed
Dependencies added: base, vector
Files
- Data/Vector/Unboxed/Read.hs +24/−0
- LICENSE +30/−0
- Setup.hs +2/−0
- vector-read-instances.cabal +30/−0
+ Data/Vector/Unboxed/Read.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE ScopedTypeVariables #-}++-- | Read instance for unboxed vectors.++module Data.Vector.Unboxed.Read where++import qualified Data.Vector.Unboxed as VU+import qualified Text.Read.Lex as L+import GHC.Show+import Text.Read+import Text.ParserCombinators.ReadP++instance (VU.Unbox a, Read a) => Read (VU.Vector a) where+ readPrec =+ parens $ do+ L.Ident "fromList" <- lexP+ (vals :: [a]) <- readPrec+ lift $ skipSpaces+ lift $ string "::"+ lift $ skipSpaces+ lift $ string "Data.Vector.Unboxed.Vector"+ return $ VU.fromList vals+ readListPrec = readListPrecDefault+ readList = readListDefault
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Christian Hoener zu Siederdissen 2010++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 Christian Hoener zu Siederdissen 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
+ vector-read-instances.cabal view
@@ -0,0 +1,30 @@+name: vector-read-instances+version: 0.0.1.0+author: Christian Hoener zu Siederdissen+maintainer: choener@tbi.univie.ac.at+copyright: Christian Hoener zu Siederdissen, 2011+homepage: http://www.tbi.univie.ac.at/~choener/+category: Data, Data Structures+synopsis: Read instances for 'Data.Vector'+license: BSD3+license-file: LICENSE+build-type: Simple+stability: experimental+cabal-version: >= 1.4.0+description:+ Read instances for 'Data.Vector'. Right now, only for unboxed+ vectors. Others should be easy to implement, though.+ .+ It is planned to have read instances included in the vector+ library in the future. This release is only temporary.++library+ build-depends:+ base >= 4 && < 5,+ vector++ exposed-modules:+ Data.Vector.Unboxed.Read++ ghc-options:+ -O2