This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |