module Data.Vector.Fixed.Generic (
mapG
, imapG
, mapMG
, imapMG
, zipWithG
, izipWithG
, zipWithMG
, izipWithMG
) where
import Control.Monad (liftM)
import Data.Vector.Fixed.Cont (Vector,Dim)
import qualified Data.Vector.Fixed.Cont as C
mapG :: (Vector v a, Vector w b, Dim v ~ Dim w)
=> (a -> b) -> v a -> w b
mapG f = C.vector
. C.map f
. C.cvec
imapG :: (Vector v a, Vector w b, Dim v ~ Dim w)
=> (Int -> a -> b) -> v a -> w b
imapG f = C.vector
. C.imap f
. C.cvec
mapMG :: (Vector v a, Vector w b, Dim w ~ Dim v, Monad m)
=> (a -> m b) -> v a -> m (w b)
mapMG f = liftM C.vector
. C.mapM f
. C.cvec
imapMG :: (Vector v a, Vector w b, Dim w ~ Dim v, Monad m)
=> (Int -> a -> m b) -> v a -> m (w b)
imapMG f = liftM C.vector
. C.imapM f
. C.cvec
zipWithG :: (Vector v a, Vector w b, Vector u c, Dim v ~ Dim u, Dim v ~ Dim w)
=> (a -> b -> c) -> v a -> w b -> u c
zipWithG f v u = C.vector
$ C.zipWith f (C.cvec v) (C.cvec u)
zipWithMG :: (Vector v a, Vector w b, Vector u c, Dim v ~ Dim u, Dim v ~ Dim w, Monad m)
=> (a -> b -> m c) -> v a -> w b -> m (u c)
zipWithMG f v u = liftM C.vector
$ C.zipWithM f (C.cvec v) (C.cvec u)
izipWithG :: (Vector v a, Vector w b, Vector u c, Dim v ~ Dim u, Dim v ~ Dim w)
=> (Int -> a -> b -> c) -> v a -> w b -> u c
izipWithG f v u = C.vector
$ C.izipWith f (C.cvec v) (C.cvec u)
izipWithMG :: (Vector v a, Vector w b, Vector u c, Dim v ~ Dim u, Dim v ~ Dim w, Monad m)
=> (Int -> a -> b -> m c) -> v a -> w b -> m (u c)
izipWithMG f v u = liftM C.vector
$ C.izipWithM f (C.cvec v) (C.cvec u)