Skip to content

Instantly share code, notes, and snippets.

View minad's full-sized avatar

Daniel Mendler minad

  • Germany
View GitHub Profile

Monads and delimited control are very closely related, so it isn’t too hard to understand them in terms of one another. From a monadic point of view, the big idea is that if you have the computation m >>= f, then f is m’s continuation. It’s the function that is called with m’s result to continue execution after m returns.

If you have a long chain of binds, the continuation is just the composition of all of them. So, for example, if you have

m >>= f >>= g >>= h

then the continuation of m is f >=> g >=> h. Likewise, the continuation of m >>= f is g >=> h.

Introduction

I was recently asked to explain why I felt disappointed by Haskell, as a language. And, well. Crucified for crucified, I might as well criticise Haskell publicly.

First though, I need to make it explicit that I claim no particular skill with the language - I will in fact vehemently (and convincingly!) argue that I'm a terrible Haskell programmer. And what I'm about to explain is not meant as The Truth, but my current understanding, potentially flawed, incomplete, or flat out incorrect. I welcome any attempt at proving me wrong, because when I dislike something that so many clever people worship, it's usually because I missed an important detail.

Another important point is that this is not meant to convey the idea that Haskell is a bad language. I do feel, however, that the vocal, and sometimes aggressive, reverence in which it's held might lead people to have unreasonable expectations. It certainly was my case, and the reason I'm writing this.

Type classes

I love the concept of type class

@puffnfresh
puffnfresh / reornament.idr
Last active September 15, 2018 21:20
Algebraic Ornaments!
module reornament
-- Idris translation of Agda code:
-- https://gist.github.com/gallais/e507832abc6c91ac7cb9
-- Which follows Conor McBride's Ornaments paper:
-- https://personal.cis.strath.ac.uk/conor.mcbride/pub/OAAO/Ornament.pdf
ListAlg : Type -> Type -> Type
ListAlg A B = (B, A -> B -> B)
@mgiraldo
mgiraldo / polygonfix writeup.ipynb
Last active August 29, 2015 14:04
Finding shape consensus among multiple geo polygons. See: http://nbviewer.ipython.org/gist/mgiraldo/a68b53175ce5892531bc
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
anonymous
anonymous / shared.rb
Created December 20, 2012 01:51
Shared Juno store Implement your own key value server in 50 lines!
require 'drb'
module Juno
class Shared < Base
def initialize(options = {}, &block)
options[:port] ||= 9000
@uri = options[:uri] || (options[:socket] ? "drbunix://#{options[:socket]}" :
"druby
@jvranish
jvranish / valueLevelClasses.hs
Created May 2, 2012 17:28
An experiment with mixing value level typeclasses and implicit parameters
{-# LANGUAGE Rank2Types
, RebindableSyntax
, ImplicitParams
, NoMonomorphismRestriction #-}
import Data.Maybe
import Data.Function
import Data.String
import Prelude (undefined, error, String, (++))
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
Rails CMS alternatives
======================
Note: project activity was checked on 11/26/09.
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09