Skip to content

Instantly share code, notes, and snippets.

Alistair AlistairB

Block or report user

Report or block AlistairB

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
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
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
AlistairB / dropbox-setup.sh
Last active Nov 28, 2015 — forked from jbhannah/dropbox-setup.sh
Dropbox setup on a headless Ubuntu Server (http://wp.me/pnbL6-5F)
View dropbox-setup.sh
#!/bin/sh
# Dropbox setup on a headless Ubuntu Server
# Script written by Jesse B. Hannah (http://jbhannah.net) <jesse@jbhannah.net>
# Based on http://wiki.dropbox.com/TipsAndTricks/UbuntuServerInstall
###
# 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.