Skip to content

Instantly share code, notes, and snippets.

@freckletonj
freckletonj / ConstrainedVinylRecords.hs
Last active August 7, 2017 14:59
Attempting to get values out of constrained Vinyl/Composite Extensible Records
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module ConstrainedVinylRecords where
@adamwespiser
adamwespiser / free-mtl-notes
Last active February 4, 2018 21:54
A comparison of performance between Free Monad and mtl transformers
Objective: A comparison of performance between Free Monad and mtl transformers
```Haskell
Free f a = { unFree :: f (Free f a) }
```
http://softwareengineering.stackexchange.com/questions/242795/what-is-the-free-monad-interpreter-pattern
# construction of free monad via individual functions
http://www.atamo.com/articles/free-monads-wont-detox-your-colon/
@freckletonj
freckletonj / mytime.py
Created October 8, 2016 00:58
MyTime - Records a Log of My Active Window And Mouse Coordinates
"""
The MIT License (MIT)
Copyright (c) 2016 Josh Freckleton
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 copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT
@NathanHowell
NathanHowell / gist:5435345
Last active September 17, 2022 20:39
Simple Warp server that can be gracefully shutdown over HTTP.
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Control.Concurrent (forkIO)
import Control.Concurrent.STM
import Control.Monad (when)
import Control.Monad.Trans (liftIO)
import Network.HTTP.Types
import Network.Wai as Wai
@qzchenwl
qzchenwl / OAuth2.hs
Created April 10, 2012 12:34
Simple oauth2.0 implementation in Haskell
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable #-}
import Data.Aeson
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import Data.ByteString.Lazy (toChunks)
import Data.List
import Data.Maybe
import Data.Typeable (Typeable)