Skip to content

Instantly share code, notes, and snippets.

@bohde
Created April 18, 2017 21:00
Show Gist options
  • Save bohde/bdd90e96dbdfc6bfdcc693b8fc718d7a to your computer and use it in GitHub Desktop.
Save bohde/bdd90e96dbdfc6bfdcc693b8fc718d7a to your computer and use it in GitHub Desktop.
join for a hypothetical ziplist monad is the diagonal of the product
-- https://en.wikibooks.org/wiki/Haskell/Category_theory#The_second_law
join . fmap return = join . return = id
return = repeat
join . fmap repeat = join . repeat = id
-- let's try it on some arbitrary list
join [repeat a, repeat b, ...] = join (repeat [a, b, c, ...]) = [a, b, c, ...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment