Modadic Type 的特色之一是支援多種 Category,可根據對應 Category 使用適合 Function。
Version
Fantasy Land 5.0.0
Monadic Type
Type Class | Pair | Maybe | Either | Future |
---|---|---|---|---|
Setoid | ✅ | ✅ | ✅ | ❌ |
Ord | ✅ | ✅ | ✅ | ❌ |
Semigroupoid | ✅ | ❌ | ❌ | ❌ |
Category | ❌ | ❌ | ❌ | ❌ |
Semigroup | ✅ | ✅ | ✅ | ❌ |
Monoid | ❌ | ✅ | ❌ | ❌ |
Group | ❌ | ❌ | ❌ | ❌ |
Filterable | ❌ | ✅ | ❌ | ❌ |
Functor | ✅ | ✅ | ✅ | ✅ |
Bifunctor | ✅ | ❌ | ✅ | ✅ |
Profunctor | ❌ | ❌ | ❌ | ❌ |
Apply | ✅ | ✅ | ✅ | ✅ |
Applicative | ❌ | ✅ | ✅ | ✅ |
Chain | ✅ | ✅ | ✅ | ✅ |
ChainRec | ❌ | ✅ | ✅ | ✅ |
Monad | ❌ | ✅ | ✅ | ✅ |
Alt | ❌ | ✅ | ✅ | ✅ |
Plus | ❌ | ✅ | ❌ | ❌ |
Alternative | ❌ | ✅ | ❌ | ❌ |
Foldable | ✅ | ✅ | ✅ | ❌ |
Traversable | ✅ | ✅ | ✅ | ❌ |
Extend | ✅ | ✅ | ✅ | ❌ |
Comonad | ✅ | ❌ | ❌ | ❌ |
Contravariant | ❌ | ❌ | ❌ | ❌ |
Conclusion
- Sanctuary function 的 type signature 都有明確指出適用什麼 category,因此特別適合搭配 Pair、Maybe、Either 與 Future