linear 1.15.3 → 1.15.4
raw patch · 3 files changed
+33/−12 lines, 3 filesdep −base-orphansdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies removed: base-orphans
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Linear.V: instance (Dim n, Typeable n, Data a) => Data (V n a)
+ Linear.V: instance Typeable V
Files
- CHANGELOG.markdown +4/−0
- linear.cabal +1/−1
- src/Linear/V.hs +28/−11
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+1.15.4+------+* Added Typeable and Data instances for V+ 1.15.3 ------ * Added missing `FunctorWithIndex`, `FoldableWithIndex` and `TraversableWithIndex Int (V n)` instances for `V`
linear.cabal view
@@ -1,6 +1,6 @@ name: linear category: Math, Algebra-version: 1.15.3+version: 1.15.4 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE
src/Linear/V.hs view
@@ -6,16 +6,15 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, UndecidableInstances #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE DeriveDataTypeable #-}+#if __GLASGOW_HASKELL__ >= 707 {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE RoleAnnotations #-} #define USE_TYPE_LITS 1 #endif-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} {-# LANGUAGE DeriveGeneric #-}-#endif #ifndef MIN_VERSION_reflection #define MIN_VERSION_reflection(x,y,z) 1@@ -47,11 +46,14 @@ import Control.Monad.Fix import Control.Monad.Zip import Control.Lens as Lens+import Data.Data import Data.Distributive import Data.Foldable as Foldable import Data.Functor.Bind import Data.Functor.Rep as Rep+#if __GLASGOW_HASKELL__ < 708 import Data.Proxy+#endif import Data.Reflection as R import Data.Vector as V import Foreign.Ptr@@ -59,10 +61,10 @@ #ifdef USE_TYPE_LITS import GHC.TypeLits #endif-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+#if __GLASGOW_HASKELL__ >= 702 import GHC.Generics (Generic) #endif-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707+#if __GLASGOW_HASKELL__ >= 707 import GHC.Generics (Generic1) #endif #if !(MIN_VERSION_reflection(1,3,0))@@ -75,16 +77,14 @@ class Dim n where reflectDim :: p n -> Int -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707+#if __GLASGOW_HASKELL__ >= 707 type role V nominal representational #endif -newtype V n a = V { toVector :: V.Vector a } deriving (Eq,Ord,Show,Read-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702- ,Generic-#endif+newtype V n a = V { toVector :: V.Vector a } deriving (Eq,Ord,Show,Read,Typeable+ , Generic -- GHC bug: https://ghc.haskell.org/trac/ghc/ticket/8468-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707+#if __GLASGOW_HASKELL__ >= 707 ,Generic1 #endif )@@ -310,3 +310,20 @@ {-# INLINE minBound #-} maxBound = pure maxBound {-# INLINE maxBound #-}++vConstr :: Constr+vConstr = mkConstr vDataType "variadic" [] Prefix+{-# NOINLINE vConstr #-}++vDataType :: DataType+vDataType = mkDataType "Linear.V.V" [vConstr]+{-# NOINLINE vDataType #-}++instance (Dim n, Typeable n, Data a) => Data (V n a) where+ gfoldl f z (V as) = z (V . fromList) `f` V.toList as+ toConstr _ = vConstr+ gunfold k z c = case constrIndex c of+ 1 -> k (z (V . fromList))+ _ -> error "gunfold"+ dataTypeOf _ = vDataType+ dataCast1 f = gcast1 f