parameterized-data 0.1.4 → 0.1.5
raw patch · 2 files changed
+17/−8 lines, 2 filesdep −syb
Dependencies removed: syb
Files
- parameterized-data.cabal +6/−6
- src/Data/Param/FSVec.hs +11/−2
parameterized-data.cabal view
@@ -1,14 +1,14 @@ name: parameterized-data-version: 0.1.4+version: 0.1.5 cabal-version: >= 1.2 build-type: Simple license: BSD3 license-file: LICENSE copyright: - Copyright (c) 2008 Alfonso Acosta, Oleg Kiselyov, Wolfgang Jeltsch+ Copyright (c) 2008-2010 Alfonso Acosta, Oleg Kiselyov, Wolfgang Jeltsch and KTH's SAM group-author: Alfonso Acosta-maintainer: alfonso.acosta@gmail.com+author: Alfonso Acosta (alfonso.acosta@gmail.com)+maintainer: Hosein Attarzadeh (shan2@kth.se) homepage: http://code.haskell.org/parameterized-data stability: alpha package-url: http://code.haskell.org/parameterized-data@@ -22,13 +22,13 @@ Right now only fixed-sized vectors are provided. A tutorial on how to use them can be found at <http://www.ict.kth.se/forsyde/files/tutorial/tutorial.html#FSVec> category: Data-tested-with: GHC==6.10.4+tested-with: GHC==6.12.3 extra-source-files: LICENSE, README -- depends on ghc due to the use of Template Haskell Library- build-depends: base>=4 && <6, type-level, template-haskell > 2.0, syb+ build-depends: base>=4 && <6, type-level, template-haskell > 2.0 hs-source-dirs: src exposed-modules: Data.Param, Data.Param.FSVec
src/Data/Param/FSVec.hs view
@@ -32,7 +32,8 @@ import Data.TypeLevel.Num hiding ((-),(+),(*),(>),(<),(>=),(<=),(==)) import Data.TypeLevel.Num.Aliases.TH (dec2TypeLevel) -import Data.Generics (Data, Typeable)+import Data.Data (Data, Typeable, dataTypeOf, toConstr, gunfold, gfoldl,+ mkConstr, mkDataType, Fixity(..)) import qualified Prelude as P import Prelude hiding ( null, length, head, tail, last, init, take, drop, @@ -51,7 +52,15 @@ -- | Fixed-Sized Vector data type, indexed with type-level naturals, the -- first index for all vectors is 0 newtype Nat s => FSVec s a = FSVec {unFSVec :: [a]}- deriving (Eq, Typeable, Data)+ deriving (Eq, Typeable)++instance (Data a, Typeable s) => Data (FSVec s a) where+ dataTypeOf (_) = tFSVec+ toConstr (FSVec _) = cFSVec+ gunfold k z (_) = k (z FSVec)+ gfoldl k z (FSVec a1) = (z FSVec `k` a1) +cFSVec = mkConstr tFSVec "FSVec" ["unFSVec"] Prefix+tFSVec = mkDataType "Data.Param.FSVec" [cFSVec] instance Show a => Show (FSVec s a) where showsPrec _ = showV.unFSVec