scalaz.example

Type members

Classlikes

case
object A extends Token
object ApplyUsage extends App
object ArrowUsage extends App
case
object B extends Token
object BifunctorUsage extends App

A Bifunctor is very similar to a Functor, which you are hopefully already familiar with. Whereas a Functor operates on a * → * and has a single operation map which takes a function from A => B to map a F[A] to a F[B], a Bifunctor operates on a , → * and has a single operation bimap which takes two functions: A => C and a B => D to map a F[A,B] to a F[C,D]:

A Bifunctor is very similar to a Functor, which you are hopefully already familiar with. Whereas a Functor operates on a * → * and has a single operation map which takes a function from A => B to map a F[A] to a F[B], a Bifunctor operates on a , → * and has a single operation bimap which takes two functions: A => C and a B => D to map a F[A,B] to a F[C,D]:

def bimap[A, B, C, D](fab: F[A, B])(f: A => C, g: B => D): F[C, D]

some examples of common types for which we have Bifunctor instances are Either, Validation, /, Tuple2

case
object C extends Token
object CaseInsensitiveUsage extends App
object CodensityUsage extends SafeApp
object ContTUsage extends App
object ContravariantCoyonedaUsage extends App
object DirectTypeClassUsage extends App
object EndoUsage extends App
object EnumUsage extends App
object FibStateExample extends App
object FingerTreeUsage extends App
object Foldable1Usage extends App
object FoldableUsage extends App
object FreeApUsage extends App
object FreeUsage extends App
object FunctorUsage extends App

A Functor is a ubiquitous typeclass involving type constructors of kind * -> *, which is another way of saying types that have a single type variable. Examples might be Option, List, Future.

A Functor is a ubiquitous typeclass involving type constructors of kind * -> *, which is another way of saying types that have a single type variable. Examples might be Option, List, Future.

The Functor category involves a single operation, named map:

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

This method takes a Function from A => B and turns an F[A] into an F[B]

object IListUsage extends App
object IsomorphismUsage extends App
object IterateeUsage extends App
object KleisliUsage extends App
object LaunchburyInterpreter extends App

Simple call-by-need (i.e. lazy) interpreter for Lambda Calculus based off of John Launchbury's "A Natural Semantics for Lazy Evaluation" Uses the "Barendregt convention": All variable names are globally unique (i.e. you cannot shadow variable names), and renames variables after substitution to maintain this invariant.

Simple call-by-need (i.e. lazy) interpreter for Lambda Calculus based off of John Launchbury's "A Natural Semantics for Lazy Evaluation" Uses the "Barendregt convention": All variable names are globally unique (i.e. you cannot shadow variable names), and renames variables after substitution to maintain this invariant.

object MixedBag extends App
object MonadTransUsage extends App
object NameNeedValueUsage extends App
object NewTypeUsage extends App
object PartiallyApplied extends App
object ReaderWriterStateTUsage extends App
object STUsage extends App
object StateTUsage extends App
object StringUsage extends App
object TagUsage extends App

scalaz contains a way to simulate something similar to a Haskell newtype, where we can take an existing type, and create a new type from it, and allow us to create new typeclass instances for our newly created type to get different behaviors. The same thing could be done with scala 2.10's Value Classes: https://docs.scala-lang.org/overviews/core/value-classes.html however one has to be very careful when using value classes, because there are a lot of instances in which using a value class will incur a runtime boxing/unboxing of your value, which incurs a runtime cost. The scalaz tagged types will never cause boxing of a value that is already AnyRef.

scalaz contains a way to simulate something similar to a Haskell newtype, where we can take an existing type, and create a new type from it, and allow us to create new typeclass instances for our newly created type to get different behaviors. The same thing could be done with scala 2.10's Value Classes: https://docs.scala-lang.org/overviews/core/value-classes.html however one has to be very careful when using value classes, because there are a lot of instances in which using a value class will incur a runtime boxing/unboxing of your value, which incurs a runtime cost. The scalaz tagged types will never cause boxing of a value that is already AnyRef.

sealed
trait Token
Companion
object
object Token
Companion
class
object TrampolineUsage extends App
object TraverseUsage extends App
object WordCount

Character/Line/Word Count from "The Essence of the Iterator Pattern".

Character/Line/Word Count from "The Essence of the Iterator Pattern".

See also
object WriterUsage extends App