Skip to content

Instantly share code, notes, and snippets.

View boj's full-sized avatar

Brian Jones boj

View GitHub Profile
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Control.Lens
import GHC.Generics
@boj
boj / Main.hs
Last active March 27, 2020 21:42
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
import Data.Coerce
@boj
boj / Main.hs
Last active March 27, 2020 21:07
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
import Data.Coerce
import Data.Tagged
data Validated
module Main where
import Data.Coerce
data Validated
data Unvalidated
class AbstractError e
data MyError = MyError String deriving (Show)
@boj
boj / shell.nix
Created February 29, 2020 00:38
Shell for hacking on Haskell Servant
{ compiler ? "ghc844" }:
let
nixpkgs = import <nixpkgs> {};
inherit (nixpkgs) pkgs stdenv;
in
# Make a new "derivation" that represents our shell
stdenv.mkDerivation {
name = "servant-dev";
@boj
boj / TypeSafe.hs
Last active February 3, 2020 22:30
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RecordWildCards #-}
module Main where
--------------------------------------------------------------------------------
import Data.Coerce
import Data.Foldable
--------------------------------------------------------------------------------
@boj
boj / shell.nix
Created July 18, 2019 18:06
Example shell.nix for Haskell dev
{ compiler ? "ghc865" }:
let
nixpkgs = import <nixpkgs> {};
inherit (nixpkgs) pkgs stdenv;
in
# Make a new "derivation" that represents our shell
stdenv.mkDerivation {
name = "communication-dev";
# don't trigger on branch
trigger:
branches:
exclude:
- '*'
# trigger on pr
pr:
autoCancel: true
branches:
@boj
boj / Main.asm
Created May 22, 2019 17:31
ghc -ddump-asm Main.hs
==================== Asm code ====================
.section .rodata.str,"aMS",@progbits,1
.align 1
.align 1
$trModule1_r1Lj_bytes:
.asciz "main"
==================== Asm code ====================
@boj
boj / Monoid.hs
Created May 17, 2019 17:00
Prove something is a Monoid
{-# LANGUAGE OverloadedStrings #-}
module Service.TypesSpec where
--------------------------------------------------------------------------------
import Test.Hspec
import Test.QuickCheck
--------------------------------------------------------------------------------
import Data.List (nub)
import Data.Text (Text)