Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| /** | |
| * A silly example using Kleisli composition of DB operations | |
| * Based on an idea from Runar Bjarnason found here: | |
| * https://groups.google.com/d/msg/scala-debate/xYlUlQAnkmE/FteqYKgo2zUJ | |
| * | |
| * Uses Scalaz7 | |
| * | |
| * @author <a href="mailto:[email protected]">Jim Powers</a> | |
| */ | |
| object Monadic { |
| name := "DES and AES encryption in Scala" | |
| version := "1.0" | |
| scalaVersion := "2.9.1" | |
| libraryDependencies += "commons-codec" % "commons-codec" % "1.6" |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| import spray.json._ | |
| import reactivemongo.bson._ | |
| import reactivemongo.bson.handlers.{ BSONReader, BSONWriter, RawBSONWriter } | |
| import scala.util.{ Try, Success, Failure } | |
| import org.apache.commons.codec.binary.Hex | |
| import org.joda.time.format.ISODateTimeFormat | |
| import org.joda.time.{ DateTime, DateTimeZone } | |
| import java.nio.ByteBuffer | |
| import org.jboss.netty.buffer.ChannelBuffers |
| trait ConsoleAlg[F[_]] { | |
| def readLine: F[Option[String]] | |
| def printLine(line: String): F[Unit] | |
| } | |
| trait Console[+A] { | |
| def run[F[+_]](F: ConsoleAlg[F]): F[A] | |
| } | |
| object Console { |
| sealed trait Interact[A] | |
| case class Ask(prompt: String) | |
| extends Interact[String] | |
| case class Tell(msg: String) | |
| extends Interact[Unit] | |
| trait Monad[M[_]] { | |
| def pure[A](a: A): M[A] |
Picking the right architecture = Picking the right battles + Managing trade-offs
| ;; Enable ligatures without prettify-symbols | |
| (provide 'add-pragmatapro-symbol-keywords) | |
| (defconst pragmatapro-fontlock-keywords-alist | |
| (mapcar (lambda (regex-char-pair) | |
| `(,(car regex-char-pair) | |
| (0 (prog1 () | |
| (compose-region (match-beginning 1) | |
| (match-end 1) |
| -- A sequential series of parallel program fragments in `f`: | |
| type SeqPar f a = Free (FreeAp f) a | |
| liftFA :: forall f a. f a -> SeqPar f a | |
| liftFA = pure >>> pure | |
| liftSeq :: forall f a. Free f a -> SeqPar f a | |
| liftSeq fa = foldFree fa liftFA | |
| liftPar :: forall f a. FreeAp f a -> SeqPar f a |
| // originally by @SethTisue, see http://stackoverflow.com/questions/40622878/how-do-i-tell-sbt-to-use-a-nightly-build-of-scala-2-11-or-2-12/40622879#40622879 | |
| resolvers += "nightlies" at "https://scala-ci.typesafe.com/artifactory/scala-release-temp/" | |
| scalaVersion := { | |
| val propsUrl = new URL("https://scala-ci.typesafe.com/job/scala-2.12.x-integrate-bootstrap/lastSuccessfulBuild/artifact/jenkins.properties/*view*/") | |
| val props = new java.util.Properties | |
| props.load(propsUrl.openStream) | |
| props.getProperty("version") | |
| } | |
| scalaBinaryVersion := "2.12" |