| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (StreamOps.scala)

This example Scala source code file (StreamOps.scala) is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Scala by Example" TM.

Learn more about this Scala project at its project page.

Java - Scala tags/keywords

anyval, monad, option, stream, streamops, tostreamopsfromstream

The StreamOps.scala Scala example source code

package scalaz
package syntax
package std

import scalaz.std.{stream => s}

final class StreamOps[A](val self: Stream[A]) extends AnyVal {
  final def interleave(other: Stream[A]): Stream[A] = s.interleave(self, other)
  final def toZipper: Option[Zipper[A]] = s.toZipper(self)
  final def zipperEnd: Option[Zipper[A]] = s.zipperEnd(self)
  final def heads: Stream[Stream[A]] = s.heads(self)
  final def tails: Stream[Stream[A]] = s.tails(self)
  final def zapp[B, C](f: Stream[A => B => C]): Stream[B => C] = s.zapp(self)(f)
  final def unfoldForest[B](f: A => (B, () => Stream[A])): Stream[Tree[B]] = s.unfoldForest(self)(f)
  final def unfoldForestM[B, M[_] : Monad](f: A => M[(B, Stream[A])]): M[Stream[Tree[B]]] = s.unfoldForestM(self)(f)
  final def intersperse(a: A): Stream[A] = s.intersperse(self, a)

trait ToStreamOps {
  implicit def ToStreamOpsFromStream[A](a: Stream[A]): StreamOps[A] = new StreamOps(a)

Other Scala examples (source code examples)

Here is a short list of links related to this Scala StreamOps.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.