Skip to content

Instantly share code, notes, and snippets.

View steshaw's full-sized avatar
👨‍💻
Loves programming languages

Steven Shaw steshaw

👨‍💻
Loves programming languages
View GitHub Profile
@runarorama
runarorama / gist:33986541f0f1ddf4a3c7
Created May 7, 2015 14:06
Higher-kinded types encoded as path-dependent types
trait λ {
type α
}
trait Functor extends λ {
type α <: λ
def map[A,B](x: α { type α = A })(f: A => B): α { type α = B }
}
@mbrcknl
mbrcknl / after.agda
Last active August 29, 2015 14:17
Before and after live-coding some Agda at BFPG
-- Matthew Brecknell @mbrcknl
-- BFPG.org, March 2015
open import Agda.Primitive using (_⊔_)
postulate
String : Set
{-# BUILTIN STRING String #-}
@nalabjp
nalabjp / rails_helper.rb
Created March 24, 2015 16:54
rspec-rails + test-queue + simplecov
if ENV['COVERAGE']
require 'simplecov'
require 'simplecov-rcov'
SimpleCov.merge_timeout 3600
SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::RcovFormatter
]
SimpleCov.start 'rails'
end
@neel-krishnaswami
neel-krishnaswami / abt
Last active June 15, 2021 21:17
Abstract binding trees implementation
(* -*- mode: ocaml; -*- *)
module type FUNCTOR = sig
type 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
end
type 'a monoid = {unit : 'a ; join : 'a -> 'a -> 'a}
type var = string
@techtangents
techtangents / join-bimap.hs
Last active March 9, 2020 01:02
join bimap explanation
-- Consider the function type constructor "->" in infix form:
-- e.g. "a -> b" is the same as "(->) a b"
-- Partially applied, "(->) a" is the "reader" type,
-- i.e. functions that "read" an 'a'. "(->) a" is a Monad - the Reader Monad.
-- Consider the join function:
join :: Monad m => m (m a) -> m a
@aaronlevin
aaronlevin / haskell-project.nix
Last active August 29, 2015 14:13
Nix n00b templates
# This template will give you a prompt with:
# - ghc
# - cabal
# - ghc-mod
# - the libraries: free, mtl, transformers
#
# to run: nix-shell haskell-project.nix
#
# to specify specific version of haskell, you can:
# nix-shell --arg haskellPackages 'with import <nixpkgs> {}; haskellPackages_ghc783_profiling'
@paf31
paf31 / 24days.md
Last active August 8, 2023 05:53
24 Days of PureScript

This blog post series has moved here.

You might also be interested in the 2016 version.

Authors: Merijn Verstraaten
Date: 2014/11/22

So You Want to Be a Super Cool GHC Hacker?

So you have a pet peeve/bug/feature request that you'd like to see added to GHC. You made sure there was a Trac_ ticket for it, but despite your patient waiting no one is solving your problem. Those selfish GHC hackers!

@paf31
paf31 / node-haskell.md
Last active May 14, 2024 03:51
Reimplementing a NodeJS Service in Haskell

Introduction

At DICOM Grid, we recently made the decision to use Haskell for some of our newer projects, mostly small, independent web services. This isn't the first time I've had the opportunity to use Haskell at work - I had previously used Haskell to write tools to automate some processes like generation of documentation for TypeScript code - but this is the first time we will be deploying Haskell code into production.

Over the past few months, I have been working on two Haskell services:

  • A reimplementation of an existing socket.io service, previously written for NodeJS using TypeScript.
  • A new service, which would interact with third-party components using standard data formats from the medical industry.

I will write here mostly about the first project, since it is a self-contained project which provides a good example of the power of Haskell. Moreover, the proces