All Downloads are FREE. Search and download functionalities are using the official Maven repository.

wei-k.iarray_2.11.0.4.0.source-code.IArray1ZipApply.scala Maven / Gradle / Ivy

There is a newer version: 0.7.1
Show newest version
package iarray

import scalaz._

private object IArray1ZipApply extends Apply[IArray1] {

  override val applyApplicative = super.applyApplicative

  override def map[A, B](fa: IArray1[A])(f: A => B) =
    fa map f

  override def ap[A, B](fa: => IArray1[A])(f: => IArray1[A => B]) =
    fa.zipWith(f)((a, g) => g(a))

  override def apply2[A, B, C](fa: => IArray1[A], fb: => IArray1[B])(f: (A, B) => C) =
    fa.zipWith(fb)(f)

  override def apply3[A, B, C, D](fa: => IArray1[A], fb: => IArray1[B], fc: => IArray1[C])(f: (A, B, C) => D) =
    IArray1.zipWith3(fa, fb, fc)(f)

  override def apply4[A, B, C, D, E](fa: => IArray1[A], fb: => IArray1[B], fc: => IArray1[C], fd: => IArray1[D])(
    f: (A, B, C, D) => E) =
    IArray1.zipWith4(fa, fb, fc, fd)(f)

  override def apply5[A, B, C, D, E, F](fa: => IArray1[A],
                                        fb: => IArray1[B],
                                        fc: => IArray1[C],
                                        fd: => IArray1[D],
                                        fe: => IArray1[E])(f: (A, B, C, D, E) => F) =
    IArray1.zipWith5(fa, fb, fc, fd, fe)(f)

  override def tuple2[A, B](fa: => IArray1[A], fb: => IArray1[B]) =
    fa.zip(fb)

  override def tuple3[A, B, C](fa: => IArray1[A], fb: => IArray1[B], fc: => IArray1[C]) =
    IArray1.zip3(fa, fb, fc)

  override def tuple4[A, B, C, D](fa: => IArray1[A], fb: => IArray1[B], fc: => IArray1[C], fd: => IArray1[D]) =
    IArray1.zip4(fa, fb, fc, fd)

  override def tuple5[A, B, C, D, E](fa: => IArray1[A],
                                     fb: => IArray1[B],
                                     fc: => IArray1[C],
                                     fd: => IArray1[D],
                                     fe: => IArray1[E]) =
    IArray1.zip5(fa, fb, fc, fd, fe)

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy