dynobud 1.9.0.0 → 1.9.1.0
raw patch · 2 files changed
+15/−1 lines, 2 files
Files
- dynobud.cabal +1/−1
- src/Dyno/Vectorize.hs +14/−0
dynobud.cabal view
@@ -1,5 +1,5 @@ name: dynobud-version: 1.9.0.0+version: 1.9.1.0 synopsis: your dynamic optimization buddy description: See readme at <http://www.github.com/ghorn/dynobud http://www.github.com/ghorn/dynobud> license: LGPL-3
src/Dyno/Vectorize.hs view
@@ -24,6 +24,7 @@ , Id(..) , Tuple(..) , Triple(..)+ , Quad(..) , vlength , vzipWith , vzipWith3@@ -96,6 +97,19 @@ Applicative f, Applicative g, Applicative h) => Linear.Additive (Triple f g h) where zero = Triple (fill 0) (fill 0) (fill 0)+++-- | a length-4 vectorizable type+data Quad f g h i a = Quad { unFst4 :: f a, unSnd4 :: g a, unThd4 :: h a, unFth4 :: i a }+ deriving (Eq, Ord, Generic, Generic1, Functor, F.Foldable, T.Traversable, Show)+instance (Vectorize f, Vectorize g, Vectorize h, Vectorize i) => Vectorize (Quad f g h i)+instance (Applicative f, Applicative g, Applicative h, Applicative i) => Applicative (Quad f g h i) where+ pure x = Quad (pure x) (pure x) (pure x) (pure x)+ Quad fx fy fz fw <*> Quad x y z w = Quad (fx <*> x) (fy <*> y) (fz <*> z) (fw <*> w)+instance (Vectorize f, Vectorize g, Vectorize h, Vectorize i,+ Applicative f, Applicative g, Applicative h, Applicative i)+ => Linear.Additive (Quad f g h i) where+ zero = Quad (fill 0) (fill 0) (fill 0) (fill 0) instance Lookup (None a)