start new:
tmux
start new with session name:
tmux new -s myname
/** | |
* Part Zero : 10:15 Saturday Night | |
* | |
* (In which we will see how to let the type system help you handle failure)... | |
* | |
* First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0) | |
*/ | |
import scalaz._ | |
import Scalaz._ |
import scala.collection.mutable._ | |
// Binary tree ADT. | |
abstract class BinaryTree | |
case class Node (value : Int, | |
left : BinaryTree, right : BinaryTree) extends BinaryTree | |
case class Leaf (value : Int) extends BinaryTree | |
// An obvious recursive solution. Can cause a stack overflow if the tree is | |
// very tall. |
trait ActorStack extends Actor { | |
/** Actor classes should implement this partialFunction for standard | |
* actor message handling | |
*/ | |
def wrappedReceive: Receive | |
/** Stackable traits should override and call super.receive(x) for | |
* stacking functionality | |
*/ | |
def receive: Receive = { |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE OverlappingInstances #-} | |
module Main where | |
import Control.Monad.Free |
Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x