Skip to content

Instantly share code, notes, and snippets.

@jdnavarro
Last active June 20, 2021 14:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdnavarro/ee9677a665cab1232540 to your computer and use it in GitHub Desktop.
Save jdnavarro/ee9677a665cab1232540 to your computer and use it in GitHub Desktop.
Idealized Haskell type class lattice

This is a personal mental model of how I would classify Haskell main type classes if semigroupoids were first-class.

Functor: <$>

  • Apply: <*>, <.>
    • Applicative: pure, return
    • Bind: join, =<<, <=<
  • Alternative (Alt): <|>, <!>
    • Zero (Alternative): zero, empty
  • CoApply: <@>
    • CoApplicative: copure, extract
    • Extend: duplicate
  • SemiGroup: <>
    • Monoid: empty, mempty
  • SemiGroupoid: >>>
    • Category: id
      • Arrow: arr first
  • Plus -> Apply + Zero: <+>, mplus (Left Distribution)

  • Or -> Applicative + Zero: <!>, morelse (Left Catch)

  • Monad -> Bind + Applicative

  • MonadPlus -> Monad + Plus

  • MonadOr -> Monad + Or

  • CoMonad -> Extend + CoApplicative

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