Scala type classes workshop
See the LICENSE file.
- Define the
ComparatorInt
instance. - Define the
min
method, which should calculate the smallest collection element. - Define the
max
method, which should calculate the greatest collection element. - Define the
ComparatorString
instance. - Define the
ComparatorAbsInt
instance (which compares absolute values). - Define the
ComparatorStringIgnoreCase
instance (which ignores the distinction between uppercase and lowercase characters). - Add the
+
method to theTree
class. - Add the
contains
method to theTree
class.
- Define the
MonoidString
instance. - Define the
msum
method, which has the following signature:def msum[T](list: T*)(implicit m: Monoid[T]): T
- Define the
MonoidSum
instance. - Define the
MonoidProduct
instance. - Define the
MonoidAnything
instancee. - Define the
MonoidAll
instance. - Define the
MonoidList
instance. - Define the
MonoidTuple2
instance. - Define the
MonoidMap
instance.
- Define the
FunctorOption
instance. - Define the
FunctorList
instance. - Define the
FunctorTree
instance.
- Define the
FoldableList
instance. - Define the
FoldableTree
instance. - Define the
fold
method, which has the following signature:def fold[A:Monoid,F[A]:Foldable](f: F[A]): A
- Define the
toList
method converting a foldable into a list. - Define the
size
method calculating the foldable size.
- Define the
ApplicId
instance. - Define the
ApplicOption
instance. - Implement the
map
method. - Define the
lift2
method, which has the following signature:def lift2[F[_],A,B,C](a: F[A], b: F[B])(g: (A,B) => C)(implicit applic: Applic[F]): F[C]
- Define the
lift3
method, which has the following signature:def lift3[F[_],A,B,C,D](a: F[A], b: F[B], c: F[C])(g: (A,B,C) => D)(implicit applic: Applic[F]): F[D]
- Define the
ApplicList
instance. - Define the
ApplicZipList
instance.
- Define the
MonadOption
instance. - Implement the
map
method. - Implement the
ap
method. - Define the
foldM
method, which has the following signature:def foldM[M[_],A,B](list: List[A])(v: B)(g: (B,A) => M[B])(implicit m: Monad[M]): M[B]
- Define the
MonadList
instance. - Define the
join
method, which has the following signature:def join[M[_],A,B](mm: M[M[A]])(implicit m: Monad[M]): M[A]
- Define the
TraversId
instance. - Implement the
map
method. - Define the
TraversOption
instance. - Define the
sequence
method, which has the following signature:def sequence[T[_]:Travers,F[_]:Applic,A](t: T[F[A]]): F[T[A]]
- Define the
TraversList
instance. - Implement the
foldMap
method.