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
/** | |
* Defines an equivalence between types A and B. | |
* | |
* Let ~_A be an equivalence relation on A, and ~_B be an equivalence relation | |
* on B. | |
* | |
* Let [a] denote the equivalence class of a in A ({a' | a ~_A a'}), and [b] | |
* denote the equivalence class of b in B ({b' | b ~_B b'}). | |
* | |
* Let `f: {[a] | a in A} -> {[b] | b in B]`, 'g: {[b] | b in B} -> {[a] | a in 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
// ####### If you use a more generic lens you can transform types along the way. | |
case class Lens[S, A](get: S => A, set: (S, A) => S) | |
case class Prism[S, A](get: S => Option[A], unget: A => S) extends (A => S) { | |
def apply(a: A): S = unget(a) | |
def unapply(s: S): Option[A] = get(s) | |
} | |
// ####### Sum type |
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
[error] /Users/John/Documents/github/slamdata/slamengine/src/main/scala/slamdata/engine/physical/mongodb/planner.scala:468: type mismatch; | |
[error] found : slamdata.engine.analysis.fixplate.PhaseE[slamdata.engine.LogicalPlan2,slamdata.engine.PlannerError,Option[slamdata.engine.physical.mongodb.BsonField],Option[slamdata.engine.physical.mongodb.Selector]] | |
[error] (which expands to) slamdata.engine.analysis.fixplate.PhaseM[[X]scalaz.\/[slamdata.engine.PlannerError,X],slamdata.engine.LogicalPlan2,Option[slamdata.engine.physical.mongodb.BsonField],Option[slamdata.engine.physical.mongodb.Selector]] | |
[error] required: slamdata.engine.analysis.fixplate.PhaseM[EitherE,slamdata.engine.LogicalPlan2,Option[slamdata.engine.physical.mongodb.BsonField],?] | |
[error] val AllPhases = (FieldPhase[Unit]).fork(SelectorPhase, ExprPhase) >>> PipelinePhase |
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
[error] found : (slamdata.engine.analysis.fixplate.Term[[b]slamdata.engine.analysis.fixplate.Ann[slamdata.engine.LogicalPlan,A(in method apply)(in method apply)(in method apply)(in method apply)(in method apply)(in method apply)(in method apply)(in method apply),b]], slamdata.engine.analysis.fixplate.Term[[b]slamdata.engine.analysis.fixplate.Ann[slamdata.engine.LogicalPlan,A(in method apply)(in method apply)(in method apply)(in method apply)(in method apply)(in method apply)(in method apply)(in method apply),b]], slamdata.engine.LogicalPlan.JoinType, slamdata.engine.LogicalPlan.JoinRel, slamdata.engine.analysis.fixplate.Term[[b]slamdata.engine.analysis.fixplate.Ann[slamdata.engine.LogicalPlan,A(in method apply)(in method apply)(in method apply)(in method apply)(in method apply)(in method apply)(in method apply)(in method apply),b]], slamdata.engine.analysis.fixplate.Term[[b]slamdata.engine.analysis.fixplate.Ann[slamdata.engine.LogicalPlan,A(in method apply)(in method apply)(in method apply)(in method app |
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
def scan[F[_], A, B](b: B, p: Process[F, A])(f: (B, A) => B): Process[F, B] = { | |
import Process._ | |
def scan0(b: B, p: Process[F, A]) = scan(b, p)(f) | |
p match { | |
case h @ Halt(e) => h | |
case await : Await[F, Any, A] => | |
Process.await[F, Any, B](await.req)( |
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
implicit class AnyOps[A](value: A) { | |
def ?: [B](left: Option[B]): A \/ B = left.map(\/-(_)).getOrElse(-\/(value)) | |
} |
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._ | |
import Scalaz._ | |
object cogroup { | |
import \&/._ | |
sealed trait Instr[A] { | |
def emit: List[A] | |
} | |
case class ConsumeLeft [A](emit: List[A]) extends Instr[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
module Main where | |
import Debug.Trace | |
import Prelude (flip, const, id, ($), (+), (<<<), show) | |
type Tuple a b = forall z. (a -> b -> z) -> z | |
mkTuple :: forall a b. a -> b -> Tuple a b | |
mkTuple a b = \f -> f 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
-- booleans as a partition on a set | |
type Bool a = a -> Either a a | |
true' :: forall a. Bool a | |
true' = Right | |
false' :: forall a. Bool a | |
false' = Left | |
not' :: forall a. Bool a -> Bool 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
reify :: forall eff. ComponentClass (FileSystemTreeProps eff) FileSystemTreeState | |
reify = createClass spec | |
{ displayName = "FileSystemTree" | |
, getInitialState = \_ -> pure {collapsed: true} | |
, render = \this -> case this.props.files of | |
(FileType {"type" = "file", name = n}) -> pure $ D.div {} | |
[D.span {} | |
[ dataFileIcon | |
, D.rawText n | |
] |