Skip to content

Instantly share code, notes, and snippets.

@gakuzzzz
Last active Jan 8, 2016
Embed
What would you like to do?
Foldable&Monoid と Traverse&Applicative の関係

Monoid[G]G に入る型は型引数をとらない kind が * の型だけど、仮に * の型にダミーの型引数 [.] をつけて G[.] と表現してみると

Method Constraint Signature
Foldable#foldMap Monoid[G] F[A] => (A => G[.]) => G[....]
Traverse#traverse Applicative[G] F[A] => (A => G[B]) => G[F[B]]
Foldable#fold Monoid[G] F[G[.]] => G[....]
Traverse#sequence Applicative[G] F[G[A]] => G[F[A]]

よく似ているのがお分かりいただけるだろうか

@xuwei-k
Copy link

xuwei-k commented Sep 11, 2015

@gakuzzzz
Copy link
Author

gakuzzzz commented Sep 11, 2015

おお、わかりやすい

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment