Skip to content

Instantly share code, notes, and snippets.

View azm-gh's full-sized avatar

Jakub azm-gh

  • Prague
  • 01:11 (UTC -12:00)
View GitHub Profile
@fatcerberus
fatcerberus / monads4all.md
Last active February 24, 2024 07:58
Monads for the Rest of Us

Monads for the Rest of Us

by Bruce Pascoe - 1 May, 2019

"A monad is just a monoid in the category of endofunctors. What's the problem?" ~James Iry[^1]

The problem... is that there are several problems.

It's been said that monads bear a dreadful curse. Once you finally understand what they are, you begin to see them everywhere--but somehow become completely incapable of explaining them to anyone else. Many tutorial writers have tried to break the Great Curse--the Web is lousy with bold attempts and half successes that attest to this--and just as many have failed. Well, I'm here to address the elephant in the room[^2] and tell you that I intend to break the Great Curse once and for all.

There are basically two ways a monad tutorial tends to go. One is a paragraph or two of minimal descriptions of one or two common monads (Haskell's Maybe in particular is very popular), followed by a lot of intimidating Haskell syntax trying to explain--precisely--how it all fits together. This is well

@kenial
kenial / csfbc_sqlalchemy.py
Last active July 23, 2023 18:10
Cheat Sheet For Busy Coders: SQLAlchemy #SQL #mysql
#! /usr/bin/python
# 02/27/2015, Kenial
# Just simple scripts for instant use of SQLAlchemy.
import sqlalchemy as sa
sa.__version__ # '0.9.4' for me
# Sample DB connection string
# engine = sa.create_engine('postgresql://scott:tiger@localhost/mydatabase')