MARK P. JONES
Pacific Software Research Center
Department of Computer Science and Engineering
Oregon Graduate Institute of Science and Technology
console.log("\033[39mRunning tests…"); | |
function assertEquals(actual, expected, description) { | |
if(typeof(actual) === "undefined") { | |
console.error("\033[31m" + description + " not implemented\033[39m"); | |
} else { | |
if(actual !== expected) { | |
console.error("\033[31m" + description + " failed, expected " + expected + ", got " + actual + "\033[39m"); | |
} else { | |
console.log(description + " \033[32m ok\033[39m"); | |
} |
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function (name, fn) { | |
this.addEventListener(name, fn); | |
} | |
NodeList.prototype.__proto__ = Array.prototype; |
{-# LANGUAGE MagicHash, TupleSections, TemplateHaskell #-} | |
module Data.Vector.Storable.Bake(bake, unsafeFromAddrLen) where | |
import Data.Typeable | |
import qualified Data.Vector.Storable as VS | |
import Foreign | |
import GHC.Prim | |
import GHC.Ptr | |
import Language.Haskell.TH |
Numbers in Haskell are typed of course. They also exist as instances of a numeric typeclass hierarchy. I was confused with converting and working with numbers of different types, and not being sure which functions were polymorphic and could work with different numeric types. So I created a little diagram. Do note that the typeclass hierarchy of Haskell actually does somewhat follow the hierarchy of numbers in Math.
This is just a quick list of resourses on TDA that I put together for @rickasaurus after he was asking for links to papers, books, etc on Twitter and is by no means an exhaustive list.
Both Carlsson's and Ghrist's survey papers offer a very good introduction to the subject
Mapper
algorithm.{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
import Prelude hiding (succ) | |
newtype Fix f = Fix (f (Fix f)) | |
deriving instance (Show (f (Fix f))) => Show (Fix f) |
{-# LANGUAGE TypeSynonymInstances #-} | |
import Data.Monoid | |
import Data.Maybe | |
-- How much water does a "histogram" hold? | |
-- | |
-- Inspired by Guy Steele's talk "Four Solutions to a Trivial Problem" | |
-- https://www.youtube.com/watch?v=ftcIcn8AmSY |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
An expression beginning with a left arrow (<-
) inside a do
block statement is desugared to a monadic binding. This is syntactically a superset of existing Haskell, including extensions. It admits a clean notation that subsumes existing patterns and comes with few downsides.
do
f (<- x) (<- y)
-- ===