Welcome! Got a question? Do you have -Ypartial-unification turned on? Other FAQs: http://typelevel.org/cats/faq.html
foldMap
is
foldMap
on List
, Coyoneda
, Free
and FreeApplicative
List/Coyoneda/Free/FreeApplicative
as programs of a specific shape, which are parameterised by their instructions, then foldMap
says: "give me a translation between instructions, and I'll give you a translation between programs "
foldMap
on List
, Free
, FreeApplicative
and Coyoneda
- List
def foldMap[A, B](fa: List[A])(f: A => B)(implicit B: Monoid[B]): B
- Free
final def foldMap[M[_]](f: S ~> M)(implicit M: Monad[M]): M[A]
- ApplicativeFree
final def foldMap[G[_]](f: F ~> G)(implicit G: Applicative[G]): G[A]
- Coyoneda
final def foldMap[G[_]](trans: F ~> G)(implicit G: Functor[G]): G[A]
"give me a translation between instructions, and I'll give you a translation between programs "
I am familiar to using Free monads as interpreters of grammars written as GADTs
put
, which represents the concept of outputting a String
Put
trait Put[A] {
def put(s: String): A
}
Put
program in the tagless representation above?
def foo[F[_]: Monad: Db]: F[Int]
, take F[_]
, return F
, so in this case you need to return A
)
A