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
(function(window, d3){ | |
var gb = window.gb = window.gb || {}; | |
gb.arc = gb.arc || {}; | |
gb.arc.radialScale = function(r, e, o){ | |
var extent = e || 2 * Math.PI; | |
var offset = o || 0; | |
var radius = r || 350; | |
var rScale = d3.scale.sqrt() |
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
from tornado.web import RequestHandler | |
#Really not much to this. Json validation and parsing can be done using another library. | |
class EventRequestHandler(ReqestHandler): | |
SUPPORTED_METHODS = ['POST'] | |
def initialize(self, inserter): #Really? By side-effect? Ugh... | |
self.act = inserter | |
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
//Define the traits | |
trait DepF[A]{ | |
type Out | |
def apply(x: A): Out | |
} | |
trait Super[A]{ | |
def dep: DepF[A] | |
} | |
//Define real instances |
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 HZero[P <: Poly, A1, A2]{ | |
type Out | |
val value: Out | |
} | |
object HZero{ | |
implicit def apply[P <: Poly, A1, A2](implicit z: Zero[P, A1, A2]): Aux[P, A1, A2, z.Out] = z | |
type Aux[P <: Poly, A1, A2, Out0] = HZero[P, A1, A2]{ type Out = Out0 } |
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 Projection[P <: Poly]{ | |
def apply[A, B](a: A, b: B)(implicit law:Law[P, A, B]): law.Out = law(a, b) | |
} | |
//Witnessing that P can handle AxB -> O, AxO, BxO | |
//i.e. P is a projection onto a line | |
trait Law[P <: Poly, A, B]{ | |
type Out | |
def apply(a: A, b: B): Out |
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 PolyDefns extends Case { | |
//...rest of the code | |
//..start of what I did | |
class Curried[F, N <: Nat, L <: HList](f: F, l: L) extends Poly1{ | |
implicit def op[H](implicit curry: Curry[F, N, H, L]): curry.Out = curry(f, l) | |
} | |
class CurriedBuilder[N <: Nat]{ | |
import hl._ |
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
//This is all I'm adding... | |
object PolyDefns extends Cases{ | |
//stuff | |
//. | |
//. | |
//. | |
//my stuff | |
class OrElse[F, G](f: F, g: G) extends Poly |
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
class Curried[P, N <: Nat, L <: HList](p: P, args: L) extends Poly1{ | |
def yo[H](h: H)(implicit step: Step[P, L, H]) = h //aaarrrggg!! | |
} | |
trait Step[P, L <: HList, H] | |
object Step{ | |
def apply[P, L <: HList, H](implicit step: Step[P, L, H]) = step | |
implicit def first[P, R <: HList](implicit ev: Case[P, R], cons: hl.IsHCons[R]): Step[P, HNil, cons.H] = |
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 shapeless._ | |
import Nat._ | |
import ops.nat._ | |
/* | |
preventing | |
r | |
/ \ | |
a b |
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
type Capture struct{ | |
closer *Closer | |
err error | |
} | |
func (cap Capture) Close() error { | |
cap.err = cap.closer.Close() | |
return cap.err | |
} |