Skip to content

Instantly share code, notes, and snippets.

View bitemyapp's full-sized avatar
🐺
aroo

Chris A. bitemyapp

🐺
aroo
View GitHub Profile
module Transformer where
import Control.Monad.Reader
import Control.Monad.Trans
data Config = Config { filename :: String } deriving (Show)
c = Config { filename = "a.txt" }
loadFile :: ReaderT Config IO String
@bitemyapp
bitemyapp / Parsing.md
Created May 4, 2017 15:41 — forked from chrisdone/Parsing.md
Good parser messages with Parsec

Intro

I've been working on a parser for a Haskell-like syntax called Duet. In the implementation I've taken particular care to make an awesome tokenizer and parser that is super helpful to learners.

Jasper Van der Jeugt made a talk about producing good error messages recently, which coincides nicely with my parallel work on this. So I thought I'd also share my

@bitemyapp
bitemyapp / reclaimWindows10.ps1
Created January 8, 2017 00:21 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
@bitemyapp
bitemyapp / all-cabal-tool.yaml
Created October 1, 2016 18:06 — forked from snoyberg/all-cabal-tool.yaml
Kubernetes files for Hackage mirroring
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: all-cabal-tool
labels:
app: all-cabal-tool
spec:
replicas: 1
minReadySeconds: 5
template:
@bitemyapp
bitemyapp / pid1.hs
Created September 25, 2016 16:09 — forked from snoyberg/pid1.hs
A Haskell pid1. Work in progress, needs more testing!
-- This is a valid PID 1 process in Haskell, intended as a Docker
-- entrypoint. It will handle reaping orphans and handling TERM and
-- INT signals. This is a work in progress, please do not use it in
-- production!
{-# OPTIONS_GHC -Wall -Werror #-}
import Control.Concurrent (forkIO, newEmptyMVar, takeMVar, threadDelay,
tryPutMVar)
import Control.Exception (assert, catch, throwIO)
import Control.Monad (forever, void)
@bitemyapp
bitemyapp / foo.hs
Created April 22, 2016 04:32 — forked from jtobin/foo.hs
Independence and Applicativeness
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE LambdaCase #-}
import Control.Applicative.Free
import Control.Monad
import Control.Monad.Free
import Control.Monad.Primitive
import System.Random.MWC.Probability (Prob)
import qualified System.Random.MWC.Probability as MWC
module-template: ! 'module MODULE_NAME where
'
extensions: {}
environment: default
cabal-file: project.cabal
version: 1
ghc-args: []
excluded-modules: []
@bitemyapp
bitemyapp / redis-yesod.md
Created February 29, 2016 22:23 — forked from MaxGabriel/redis-yesod.md
Connecting to Redis from Yesod

Connecting to Redis from Yesod

This is a quick run-through of how I connected to Redis from a Yesod site (which used the default scaffolding). There isn't much specific to Redis here, so this information should apply to connecting to any database or service from Yesod.

Background: Basics of Hedis

First, a brief intro of the basics of Hedis:

{-# LANGUAGE OverloadedStrings #-}
@bitemyapp
bitemyapp / haskell-mode-indent.md
Created February 15, 2016 23:06 — forked from ttuegel/haskell-mode-indent.md
Indentation pains in haskell-mode for Emacs

Electric indentation for parentheses, brackets, braces, commas, semicolons...

This isn't an issue of what I want, but rather when I want it. haskell-mode knows how to indent these things correctly, but I had to turn off electric indentation in haskell-mode because it does stupid things the rest of the time.

Concretely, I want a haskell-mode that knows how to be electric when there's only one "right" choice and that doesn't do stupid things when there are multiple possibilities.

@bitemyapp
bitemyapp / binary.hs
Created February 3, 2016 08:58 — forked from sinelaw/binary.hs
Binary encode/decode of Fixed
-- run it like:
-- stack ghc --package criterion -- binary.hs -Wall -O2 && ./binary
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE BangPatterns #-}
module Main where
import Data.ByteString.Lazy (ByteString)
import Data.Binary
import Data.Fixed