Skip to content

Instantly share code, notes, and snippets.

Alistair AlistairB

View GitHub Profile
View TypeclassStuff.hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
class Zomg a where
zomg :: a -> String
data Errr a = Errr a
instance Zomg (Errr a) where
zomg a = "ROckin"
View 1-before-refactor.hs
-- a huge number of imports above
main :: IO ()
main = do
createDirectoryIfMissing True "output"
env <- getAppEnv
let connInfo = dbConnectInfo env
db <- dbConnection connInfo
queryText <- BS.readFile "db/errors.sql"
results <- query_ db (Query queryText)
AlistairB / interesting-monad.hs
Created Apr 22, 2017
I found it surprising how this worked :) But it helped me understand monads and do
View interesting-monad.hs
twiceWhenEven :: [Integer] -> [Integer]
twiceWhenEven xs = do
x <- xs
if even x
then [x*x, x*x]
else [x*x]
-- Prelude> twiceWhenEven [1..3]
-- [1,4,4,9]
AlistairB /
Last active Nov 28, 2015 — forked from jbhannah/
Dropbox setup on a headless Ubuntu Server (
# Dropbox setup on a headless Ubuntu Server
# Script written by Jesse B. Hannah ( <>
# Based on
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
You can’t perform that action at this time.