Skip to content

Instantly share code, notes, and snippets.

View sampeprima's full-sized avatar

mkay sampeprima

View GitHub Profile
@sampeprima
sampeprima / haskell-app-layers.md
Created January 16, 2018 08:55 — forked from parsonsmatt/haskell-app-layers.md
A basic draft of a future blog post

The question of "How do I design my application in Haskell?" comes up a lot. There's a bunch of perspectives and choices, so it makes sense that it's difficult to choose just one. Do I use plain monad transformers, mtl, just pass the parameters manually and use IO for everything, the ReaderT design pattern, free monads, freer monads, some other kind of algebraic effect system?!

The answer is: why not both/all?

Lately, I've been centering on a n application design architecture with roughly three layers:

Layer 1:

newtype AppT m a = AppT { unAppT :: ReaderT YourStuff m a } deriving ............ The ReaderT Design Pattern, essentially. This is what everything gets boiled down to, and what everything eventually gets interpreted in. This type is the backbone of your app. For some components, you carry around some info/state (consider [MonadMetrics](https://hackage

@sampeprima
sampeprima / Dockerfile
Last active December 20, 2017 10:20
bash-otp
FROM ubuntu
RUN apt-get update && apt-get install -y oathtool git-core bc && git clone https://github.com/poolpog/bash-otp
WORKDIR "/bash-otp"
# docker run -it -v /home/marco/dev/bash-otp/tokenfiles:/bash-otp/tokenfiles bash-otp
@sampeprima
sampeprima / typing.md
Created September 5, 2017 09:26 — forked from chrisdone/typing.md
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology