Skip to content

Instantly share code, notes, and snippets.

@magthe
magthe / Free1.hs
Created June 18, 2016 21:25
Free play 2
{-# LANGUAGE DeriveFunctor#-}
-- Simple example of using Free with a single algebra/API.
module Free1 where
import Control.Monad.Free
data SimpleFileF a
= LoadFile FilePath (String -> a)
@magthe
magthe / keybase.md
Created July 30, 2017 06:07
keybase.md

Keybase proof

I hereby claim:

  • I am magthe on github.
  • I am magthe (https://keybase.io/magthe) on keybase.
  • I have a public key ASCF3PyaMhJU-BVsk0bF9gjQ7DSJv5NYmbYFRvBjwJtWlgo

To claim this, I am signing this object:

@magthe
magthe / Part1.hs
Created December 18, 2017 17:02
AoC 2017, day 16
import Control.Applicative
import Data.Monoid
import Data.Vector as V
import Prelude as P
import Text.ParserCombinators.ReadP
spinList :: Int -> Vector Char -> Vector Char
spinList n xs = let (h, t) = V.splitAt (l - n) xs
l = V.length xs
in t <> h