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
object Start extends App { | |
val l = 1 :: "s" :: HNil | |
val res = l.run{i => s => i+s} | |
println(res) | |
} | |
trait HList { |
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
trait Functor[F[_]] { | |
def unit[A](a: A): F[A] | |
def map[A, B](f: A => B): F[A] => F[B] // ma => flatMap((a: A) => unit(f(a)))(ma) | |
} | |
trait Applicative[F[_]] extends Functor[F] { |
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
package net | |
object Main extends App { | |
import Iteratee._ | |
val l = Enumerator.traverse(List[Input[Int]](Data(4), Data(5), EOF))(Iteratee.fold(1) { | |
case (a, e) => a * e | |
}) | |
println(l) |
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
package test.zipper | |
object TreeZipper extends App { | |
println("hello") | |
// exp 2 * 3 + 4 * 6 | |
val _2 = Node("2", Nil) | |
val _3 = Node("3", Nil) |
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
package formlets | |
import scala.xml._ | |
object Main extends App { | |
case class Person (name: String, age: Int) | |
case class Subject(person: Person, userName: String) | |
val person = (Person(_, _)).curried |