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
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](http://hackage.haskell.org/package/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
lindaliukas / gist:53429e85e1d36ae81e20
Last active Aug 29, 2015
Principles of play links
View gist:53429e85e1d36ae81e20
@paf31
paf31 / node-haskell.md
Last active Apr 22, 2019
Reimplementing a NodeJS Service in Haskell
View node-haskell.md

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

View sortedlist.ml
(* 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
end
@avdi
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
end
def run(board) do
IO.write("\e[H\e[2J")
Life.print_board board
:timer.sleep 1000
board = next_board(board)
@markhibberd
markhibberd / characters.md
Last active Nov 27, 2017
Haskell Character Data
View characters.md

Overview

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.

Types

@juandazapata
juandazapata / mountain_lion_home_brew.md
Created Jul 26, 2012
Get Mountain Lion and Homebrew to Be Happy
View mountain_lion_home_brew.md

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
them0nk / rspec_rails_cheetsheet.rb
Created Mar 23, 2012
Rspec Rails cheatsheet (include capybara matchers)
View rspec_rails_cheetsheet.rb
#Model
@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
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
You can’t perform that action at this time.