n-tuple 0.0.1.1 → 0.0.2.0
raw patch · 2 files changed
+43/−28 lines, 2 filesdep ~basedep ~singletonsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, singletons
API changes (from Hackage documentation)
- Data.NTuple: instance (Data.Data.Data a, Data.Typeable.Internal.Typeable size) => Data.Data.Data (Data.NTuple.NTuple size a)
- Data.NTuple: instance GHC.Generics.Constructor Data.NTuple.C1_0NTuple
- Data.NTuple: instance GHC.Generics.Datatype Data.NTuple.D1NTuple
- Data.NTuple: instance GHC.Generics.Selector Data.NTuple.S1_0_0NTuple
+ Data.NTuple: instance (Data.Data.Data a, GHC.TypeNats.KnownNat size) => Data.Data.Data (Data.NTuple.NTuple size a)
- Data.NTuple: incl :: (n <= (size + 1), (n :> 0) ~ True, KnownNat n, size' ~ If (n :== (size + 1)) (size + 1) size) => Proxy n -> a -> NTuple size a -> NTuple size' a
+ Data.NTuple: incl :: (n <= (size + 1), (n :> 0) ~ 'True, KnownNat n, size' ~ If (n :== (size + 1)) (size + 1) size) => Proxy n -> a -> NTuple size a -> NTuple size' a
- Data.NTuple: proj :: (n <= size, (n :> 0) ~ True, KnownNat n) => Proxy n -> NTuple size a -> a
+ Data.NTuple: proj :: (n <= size, (n :> 0) ~ 'True, KnownNat n) => Proxy n -> NTuple size a -> a
Files
- n-tuple.cabal +36/−22
- src/Data/NTuple.hs +7/−6
n-tuple.cabal view
@@ -1,26 +1,40 @@-name: n-tuple-version: 0.0.1.1-synopsis: Homogeneous tuples of arbitrary length.--- description:-homepage: https://github.com/athanclark/n-tuple#readme-license: BSD3-license-file: LICENSE-author: Athan Clark-maintainer: athan.clark@gmail.com-copyright: 2017 Athan Clark-category: Data-build-type: Simple-extra-source-files: README.md-cabal-version: >=1.10+-- This file has been generated from package.yaml by hpack version 0.21.2.+--+-- see: https://github.com/sol/hpack+--+-- hash: 17c9efc57c5bc53e00f65b0975640b32118c7241bde8b404e1aaef40ab7ae29e -library- hs-source-dirs: src- exposed-modules: Data.NTuple- build-depends: base >= 4.7 && < 5- , singletons- , vector- default-language: Haskell2010+name: n-tuple+version: 0.0.2.0+synopsis: Homogeneous tuples of arbitrary length.+description: Please see the README on Github at <https://github.com/athanclark/sparrow-server#readme>+homepage: https://github.com/athanclark/n-tuple#readme+bug-reports: https://github.com/athanclark/n-tuple/issues+author: Athan Clark+maintainer: athan.clark@gmail.com+copyright: BSD-3+license: BSD3+license-file: LICENSE+build-type: Simple+cabal-version: >= 1.10 +extra-source-files:+ README.md+ source-repository head- type: git+ type: git location: https://github.com/athanclark/n-tuple++library+ exposed-modules:+ Data.NTuple+ other-modules:+ Paths_n_tuple+ hs-source-dirs:+ src+ ghc-options: -Wall+ build-depends:+ base ==4.10.*+ , singletons >=2.3 && <2.4+ , vector+ default-language: Haskell2010
src/Data/NTuple.hs view
@@ -30,14 +30,15 @@ , _10 ) where -import Data.Vector (Vector, (!))+import Data.Vector (Vector) import qualified Data.Vector as V import GHC.TypeLits import Data.Proxy (Proxy (..)) import Data.List (intercalate)-import Data.Singletons.Prelude-import Data.Singletons.Prelude.Ord+import Data.Singletons.Prelude (If)+import Data.Singletons.Prelude.Eq (PEq ((:==)))+import Data.Singletons.Prelude.Ord (POrd ((:>))) import Data.Data (Data, Typeable) import GHC.Generics (Generic)@@ -58,7 +59,7 @@ -- | Project an element out of the tuple proj :: ( n <= size- , (n :> 0) ~ True+ , (n :> 0) ~ 'True , KnownNat n ) => Proxy n -- ^ The index@@ -69,7 +70,7 @@ -- | Include an element to the tuple, overwriting on an existing index incl :: ( n <= (size + 1)- , (n :> 0) ~ True+ , (n :> 0) ~ 'True , KnownNat n , size' ~ If (n :== (size + 1)) (size + 1) size )@@ -81,7 +82,7 @@ let n = fromInteger (natVal p) - 1 (l,r) = V.splitAt n xs - in l V.++ (x `V.cons` (tail' r))+ in l V.++ (x `V.cons` tail' r) where tail' r | V.null r = V.empty