Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 dojo | |
/** | |
* Created with IntelliJ IDEA. | |
* User: Jim Collins | |
* Date: 17/09/2015 | |
*/ | |
trait Lcd { | |
val contents: List[String] | |
override def toString = contents mkString "\n" |
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 dojo | |
import slick.driver.H2Driver.api._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
object HelloSlick { | |
val db = Database.forURL("jdbc:h2:mem:test1;DB_CLOSE_DELAY=-1", driver="org.h2.Driver") | |
val emps = TableQuery[Emp] |
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 state | |
import State._ | |
case class State[S,+A](run: S => (A,S)) { | |
def map[B](f: A => B): State[S, B] = | |
flatMap(a => unit(f(a))) | |
def map2[B,C](sb: State[S, B])(f: (A, B) => C): State[S, C] = | |
flatMap(a => sb.map(b => f(a, b))) |