Skip to content

Instantly share code, notes, and snippets.

@YoEight
Created February 5, 2013 15:56
Show Gist options
  • Save YoEight/4715348 to your computer and use it in GitHub Desktop.
Save YoEight/4715348 to your computer and use it in GitHub Desktop.
def foo[F[_], A](xs: F[A], f: A => String)(implicit F: Foldable[F], P: Pure[F], M: Monoid[F[A]]): Map[String, F[A]] = {
F.foldMap[A, Map[String, F[A]]](xs, a => Map(f(a) -> F.pure(a)))
}
foo[List, BreakDownRow](xs: List[BreakDownRow])(f: BreakDownRow => String): Map[String, List[BreakDownRow]]
foo[Id, SummaryRow](xs: Id[SummaryRow])(f: SummaryRow => String): Map[String, Id[SummaryRow]]
bar[A <: Json, B <: Json](l: Map[String, A], r: Map[String, B]): Map[String, Json]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment