This file contains hidden or 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
| /** | |
| * Binary Search Tree in Scala with ADT | |
| */ | |
| sealed trait Tree[+T] | |
| case object Leaf extends Tree[Nothing] | |
| case class Branch[T](value: T, left: Tree[T], right: Tree[T]) extends Tree[T] | |
| object Tree { | |
| def showTree[T](tree: Tree[T]): String = tree match { |
This file contains hidden or 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
| export GHC_DOT_APP="/Applications/ghc-7.8.4.app" | |
| export PATH="${HOME}/.cabal/bin:${GHC_DOT_APP}/Contents/bin:${PATH}" | |
| export PATH=$HOME/.cabal/bin:$PATH |
This file contains hidden or 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 |
This file contains hidden or 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
| {-# OPTIONS_GHC -Wall -O2 -threaded -with-rtsopts="-N" #-} | |
| import Control.Concurrent | |
| import Control.Concurrent.Async | |
| import Control.Lens | |
| import Control.Monad | |
| import Data.ByteString.Lazy hiding (replicate) | |
| import Data.List.Split | |
| import Network.Wreq hiding (getWith) | |
| import Network.Wreq.Session |
This file contains hidden or 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 hidden or 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
| cabal install GLUT --ghc-options="-optl-Wl,-framework,GLUT" --reinstall --jobs=1 |
This file contains hidden or 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
| defrnaqEQG1JcjUVIiz)YawePwesLlrrKpHcPmksjlkfQSkcK8kcenle5wkc7cH(ffHggfLJrfTmkQEgrW0icDnfjBtrPVru04iIAXPqsVdPQ5HcP6EKIdsuYcvK6HerMivOlIOAJOq8rsPgjfrDscyLeAMevotkuQDIc(jrPgkfPokku0sjk8uknveCvffBLaHZIcLCkIQUPIiEybsTxL(lkny4WkSyfr9yKYKPkxwvBMG(SIQrJOCAvA1OqHxtrYSjv3MQA3K8BQ0WjshNIGLJKNtHPJQRRITJI(oku14jq15iq515syT(R1BTElH1k0vXTxgLFzW8PwR31qQ(WbcVGZxRjPwl1p)6Qi4G0FT8xW5R9QUCwAU(s1F(7Tm4CTdA8RRYyjSwHx11GSLWA9CzPDm4U(70RL2XG76V2XHAW(kMeP5Eu8NkOjyg9lFTx1LVewRNllTJb31FNET0ogCx)1ooud2xXKOuTNrahdAcZOUCTNrah1IoP6dhEk6KN(ehhQb7RysKM7rXFQGMGz0NyIJd1G9vmjAqBO0(hubnbHhfn(1vPL8jgcHGqxQWvJtjqYPedEUjgcHqiec6U0g6b9RYubnbTFUakMVI7s5Ga83xURYuArNu9HdpfDKcx5PpXqiecHq4kmOFvMkWj7vjgcHqiecHqiO7sBOhud)NuGLuGLu4k3Z81dAcA)Cb4VVakHUAPFvMsE6tmecHqiecHWvyqn8)Ggnb6KKRY7vgd(FOcEmQtAgBbnJZ)nOlWj7vjgcHqiecHqiecHW4qnyFftIVjCUsL(Ebnbo15PpXqiecHqiecHqieghQb7Rys0)OZVs1VpvqtWzqqgmJO5ZktzgeubNeDovtkT06k3Z81NywbBk5nrNtjp9jgcHqiecHqiecHa1Zpuk6tmecHqiecHq4vEjgcHqiecVYlXqieELxIHqimoud2xXK4BcNRuPVxqtq4q34PpXx5LyIJd1G9vmjAqBO0(huAjp9lF5R96Twj5Q8ELXG)hQGhJMG |
This file contains hidden or 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 hidden or 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 hidden or 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. |