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
/* | |
Based on the second part of the talk "Dead-Simple Dependency Injection in Scala" by @runarorama at NEScala 2012 | |
http://marakana.com/s/dependency_injection_in_scala,1108/index.html | |
*/ | |
sealed trait KVS[A] | |
case class Put[A](key: String, value: String, a: A) extends KVS[A] | |
case class Get[A](key: String, h: String => A) extends KVS[A] | |
case class Delete[A](key: String, a: A) extends KVS[A] |
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
---------------------------------------------------------------- | |
-- Free Monad example agaist RWH 15.8 | |
-- | |
-- Original code: http://ideone.com/F49k71 | |
import Control.Applicative | |
import Control.Monad.Free | |
import System.IO (Handle, IOMode(..), stdout) | |
import qualified System.IO as IO | |
import System.IO.Unsafe |
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
svn co http://svn.apache.org/repos/asf/hadoop/common/trunk hadoop-trunk -r 1178440 | |
cd hadoop-trunk/ | |
mvn clean install package -Dtar -Pdist -DskipTests -P-cbuild | |
cd hadoop-mapreduce-project/ | |
mvn clean install package -Dtar -Pdist -DskipTests -P-cbuild assembly:assembly | |
mkdir ~/HADOOP_MAPREDUCE | |
cp ./../../hadoop-trunk/hadoop-common-project/hadoop-common/target/hadoop-common-0.24.0-SNAPSHOT.tar.gz ~/HADOOP_MAPREDUCE/. | |
cp ./../../hadoop-trunk/hadoop-mapreduce-project/target/hadoop-mapreduce-0.24.0-SNAPSHOT-all.tar.gz ~/HADOOP_MAPREDUCE/. | |
cd ~/HADOOP_MAPREDUCE | |
tar xvfz hadoop-common-0.24.0-SNAPSHOT.tar.gz ; mv hadoop-common-0.24.0-SNAPSHOT common |
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
-- Inspired by the writings of Edward Kmett, Edward Yang and Gabriel Gonzalez | |
-- concerning free monads and the codensity transformation. | |
-- | |
-- http://comonad.com/reader/2011/free-monads-for-less/ | |
-- http://blog.ezyang.com/2012/01/problem-set-the-codensity-transformation/ | |
-- http://www.haskellforall.com/2012/06/you-could-have-invented-free-monads.html | |
-- | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} |
NewerOlder