Skip to content

Instantly share code, notes, and snippets.

Tim McGilchrist tmcgilchrist

Block or report user

Report or block tmcgilchrist

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ChrisPenner / Battleship.lhs
Last active Jul 5, 2019
Hit! You sunk my Adjunction!
View Battleship.lhs
Today we'll be looking into Kmett's
[adjunctions]( library,
particularly the meat of the library in Data.Functor.Adjunction.
This post is a literate haskell file, which means you can load it right up in
ghci and play around with it! Like any good haskell file we need half a dozen
language pragmas and imports before we get started.
> {-# language DeriveFunctor #-}
> {-# language TypeFamilies #-}
lindaliukas / gist:53429e85e1d36ae81e20
Last active Aug 29, 2015
Principles of play links
View gist:53429e85e1d36ae81e20
paf31 /
Last active Apr 22, 2019
Reimplementing a NodeJS Service in Haskell


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 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

(* Functor SortedList.Make resembling Map.Make and Set.Make
it is an artificial data structure similar to the normal list, but keeps elements sorted
module type ORD = sig
type t
val compare : t -> t -> int
avdi / gol.exs
Last active Jun 3, 2016
Game of life in Elixir (take 1)
View gol.exs
defmodule Life do
def run(board) when is_binary(board) do
board |> parse_board |> run
def run(board) do
Life.print_board board
:timer.sleep 1000
board = next_board(board)
markhibberd /
Last active Nov 27, 2017
Haskell Character Data


There are lots of representations for strings. In most languages they pick one set of tradeoffs and run with it. In haskell the "default" implementation (at least the one in the prelude) is a pretty bad choice, but unlike most other languages (really) good implementations exist for pretty much every way you can twist these things. This can be a good thing, but it also leads to confusion, and frustration to find the right types and how to convert them.


juandazapata /
Created Jul 26, 2012
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

After upgrading to Mountain Lion, I got this message when trying to run my local rails server:

Installing rmagick (2.13.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    Users/user/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby extconf.rb
them0nk / rspec_rails_cheetsheet.rb
Created Mar 23, 2012
Rspec Rails cheatsheet (include capybara matchers)
View rspec_rails_cheetsheet.rb
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
response.should render_template(:index)
response.should redirect_to(movies_path)
You can’t perform that action at this time.