Skip to content

Instantly share code, notes, and snippets.

@gakuzzzz
Last active January 8, 2016 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gakuzzzz/736b8a37931c346b26fe to your computer and use it in GitHub Desktop.
Save gakuzzzz/736b8a37931c346b26fe to your computer and use it in GitHub Desktop.
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

おお、わかりやすい

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