Skip to content

Instantly share code, notes, and snippets.

type IO<A> = () => Promise<A>
function retry<A>(x: IO<A>, p: (a: A) => Boolean, retries: number): IO<A> {
return () => {
if (retries <= 0) {
return x()
}
return x().then(xx => {
if (p(xx)) {
return Promise.resolve(xx)
<!DOCTYPE html>
<!-- https://www.youtube.com/watch?v=6iVXaqUfHi4 -->
<html>
<body>
<div id="player"></div>
<br>
<button id="prev">&lt;</button>
<button id="next">&gt;</button>
<button id="save">s</button>
// Lambda World 2019 - A categorical view of computational effects - Emily Riehl
// https://www.youtube.com/watch?v=Ssx2_JKpB3U
object EugenioMoggi {
// normal functions
type Function[A, B] = A => B
// they compose
def composeFunctions[A, B, C]:
(Function[A, B], Function[B, C]) => Function[A, C] =
# https://www.srid.ca/1948201.html
let
pkgs = import <nixpkgs> { };
compilerVersion = "ghc865";
compiler = pkgs.haskell.packages."${compilerVersion}";
in
compiler.developPackage {
root = ./.;
source-overrides = {
let
pkgs = import <nixpkgs> { inherit config; };
config = {
packageOverrides = pkgs: {
haskellPackages = pkgs.haskellPackages.override {
overrides = self: super: {
tmp-postgres = pkgs.haskell.lib.unmarkBroken super.tmp-postgres;
};
};
let
pkgs = import <nixpkgs> { inherit config; };
config = {
packageOverrides = pkgs: {
haskellPackages = pkgs.haskellPackages.override {
overrides = self: super: {
};
};
};
let
config = {
packageOverrides = pkgs: with pkgs.haskell.lib; {
haskellPackages = pkgs.haskellPackages.override {
overrides = self: super: {
docrecords = pkgs.haskell.lib.unmarkBroken super.docrecords;
funflow = dontCheck (unmarkBroken super.funflow);
reader-soup = pkgs.haskell.lib.unmarkBroken super.reader-soup;
vinyl = doJailbreak (unmarkBroken super.vinyl);
let
pkgs = import <nixpkgs> {};
pythonPackages = p: with p; [ numpy jupyter matplotlib pandas seaborn ];
p = pkgs.python3.withPackages pythonPackages;
in
p.env
@mebubo
mebubo / hpmor.md
Last active October 20, 2019 18:46
/*
* Copyright (c) 2011-18 Miles Sabin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software