Skip to content

Instantly share code, notes, and snippets.

View Rydgel's full-sized avatar
😂
💯 🔥

Jérôme Mahuet Rydgel

😂
💯 🔥
View GitHub Profile
@Rydgel
Rydgel / FreeCoFree.hs
Created January 4, 2017 16:35 — forked from queertypes/FreeCoFree.hs
Exploring Free Monads, Cofree Comonads, and Pairings: DSLs and Interpreters
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-
Explores Free Monads (DSLs) and Cofree Comonads (interpreters) and
their relationship.
Most of the code in this file comes from (1) below. Only minor
modifications are made - semantics are preserved.
@Rydgel
Rydgel / free-monad-example.hs
Created January 4, 2017 01:14 — forked from danstn/free-monad-example.hs
An example of using Free Monads for writing custom AST/DSL and its interpreters.
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveFunctor #-}
import Prelude
import Data.String
import Control.Monad.Free
type Program a r = Free (AST a) r
data AST a next =
@Rydgel
Rydgel / minimal-http.hs
Created November 30, 2016 10:41 — forked from aaronlevin/minimal-http.hs
Minimal Haskell HTTP server written on top of warp via the Web Application Interface (no frameworks)
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.Wai (pathInfo, Request, requestMethod, Response, responseLBS, ResponseReceived)
import Network.Wai.Handler.Warp (run)
import Network.HTTP.Types (status200, status401)
-- note: type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
application :: Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
@Rydgel
Rydgel / gist:15390ee158fbad881b13
Last active August 29, 2015 14:27 — forked from hyone/gist:3950460
Multiple async HTTP requests by Haskell
{-# LANGUAGE FlexibleContexts #-}
import Data.Conduit
import qualified Data.Conduit.List as CL
import Network.HTTP.Conduit
import Control.Concurrent.Async (mapConcurrently)
import Control.Concurrent.MVar
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Control (MonadBaseControl)
#! /bin/bash
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db