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
0x0cb4405A1c6d8e9344304a3353279bB301e9343a |
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
import Bool._ | |
import Equality._ | |
sealed trait Bool { | |
type V <: Bool | |
type ACT[T <: Up, F <: Up, Up] | |
} | |
trait True extends Bool { | |
type V = True |
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
/** | |
* Created by ariwaranosai on 2017/1/3. | |
* | |
*/ | |
trait ExpAlg[T] { | |
def lit(n: Int): T | |
def add(x: T, y: T): T | |
} |
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 ExpAlg[T] { | |
def lit(n: Int): T | |
def add(x: T, y: T): T | |
} | |
object ExpAlg { | |
implicit def toIntExpOps[T](n: Int)(implicit m: ExpAlg[T]): ToIntExpOps[T] = | |
new ToIntExpOps[T](n)(m) |
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
abstract class Exp | |
case class Lit(n: Int) extends Exp | |
case class Neg(e: Exp) extends Exp | |
case class Add(e1: Exp, e2: Exp) extends Exp | |
object Exp { | |
implicit def toLit(n: Int): Lit = Lit(n) | |
def eval(e: Exp): Int = e match { | |
case Lit(n) => n | |
case Neg(e) => -eval(e) |
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
# coding=utf-8 | |
__author__ = 'shiheng' | |
from functools import partial | |
class Bangumi(object): | |
u''' | |
Bangumi的一个查询 | |
''' | |
def __init__(self, dic): | |
self.obj = dic | |
def __getattr__(self, item): |
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
/** | |
* Created by ariwaranosai on 16/8/28. | |
* | |
*/ | |
import ST._ | |
case class World[S]() | |
case class ST[S, A](f: World[S] => (World[S], 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
import scalaz.{Monad} | |
import scalaz.OptionT | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scalaz.std.scalaFuture._ | |
import scala.language.existentials | |
import scala.language.experimental.macros | |
import scala.language.higherKinds |
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 TypeLevel { | |
def main(args: Array[String]) { | |
import scala.language.higherKinds | |
sealed trait Bool { | |
type IF[T <: Up, F <: Up, Up] | |
} | |
sealed trait True extends Bool { | |
type IF[T <: Up, F <: Up, Up] = T |
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
sealed abstract class <%<[-From, +To] extends (From => To) with Serializable | |
object <%< { | |
implicit def conformsOrViewsAs[A <% B, B]: A <%< B = new (A <%< B) {def apply(x: A) = x} | |
} |
NewerOlder