Skip to content

Instantly share code, notes, and snippets.

View sellout's full-sized avatar
🍌
semper φ

Greg Pfeil sellout

🍌
semper φ
View GitHub Profile
#|@
This is a simple capabilities implementation
that provides most of the properties described in
[_Capability Myths Demolished_](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.6.3660).
The only one missing (I think) is _A: No Designation Without Authority_.
I need to read more about the capabilities that exist in other systems,
but it seems like they wrap two things into the authority:
the designator and the operation (read, write, etc.).
However, our operations can match arbitrary patterns
/** A composition of dunces^Wfunctors */
trait ◦[F[_], G[_]] { type λ[A] = F[G[A]] }
object ◦ extends CompositionInstances0 {
implicit def composeFunctor[F[_]: Functor, G[_]: Functor]:
Functor[(F ◦ G)#λ] =
new Functor[(F ◦ G)#λ] {
def map[A, B](fa: F[G[A]])(f: A => B) = fa.map(_.map(f))
}
}
abstract class CompositionInstances0 {
def toCofree[F [_]: Functor, A](fa: Fix[F]): Cofree[F, Unit] =
Cofree((), fa.unFix.map(_.toCofree))
// can be written as either of these
fa.cata(Cofree((), _))
fa.convertTo[Cofree[?[_], Unit]]
// extendP → attributeTopDown ... ish
// extendPM → attributeTopDownM
def extendP[F[_]: Functor, A, B]
@sellout
sellout / config.nix
Last active February 1, 2016 11:16
{
packageOverrides = super: let self = super.pkgs; in
rec {
emacsMacPackages = self.emacsPackagesNgGen self.emacs24Macport;
emacs = emacsMacPackages.emacsWithPackages (with emacsMacPackages.melpaPackages; [
ace-jump-mode
ac-slime
...
]);
};
Verifying that +sellout is my blockchain ID. https://onename.com/sellout
2 files changed, 23 insertions(+), 10 deletions(-)
core/src/main/scala/slamdata/fp/package.scala | 21 ++++++++++++++++-----
web/src/main/scala/slamdata/engine/api/server.scala | 12 +++++++-----
modified core/src/main/scala/slamdata/fp/package.scala
@@ -21,6 +21,7 @@ import slamdata.RenderTree.ops._
import scalaz._; import Liskov._; import Scalaz._
import scalaz.concurrent.Task
+import scalaz.effect._
// from
@data sealed trait Meh[+A]
object Meh {
final case class Yep[A](mep: A) extends Meh[A]
final case class Nope[A]() extends Meh[A]
}
// I generate
sealed abstract trait Meh[+A] extends scala.AnyRef;
object Meh extends scala.AnyRef {
@sellout
sellout / gist:7863be253457557c488e
Created March 13, 2015 20:49
This is what happens when you try to Haskell Scala.
[error] /Users/greg/Documents/SlamData/slamengine/core/src/main/scala/slamdata/engine/analysis/fixplate.scala:271: type mismatch;
[error] found : scalaz.~>[[α(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)]F[slamdata.engine.analysis.EnvT[(term.this.Term[F], B),Term.this.CofreeF,α(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)]],[α(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)]slamdata.engine.analysis.EnvT[B,Term.this.CofreeF,F[α(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)]]]
[error] (which expands to) scalaz.NaturalTransformation[[α(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)]F[slamdata.engine.analysis.EnvT[(term.this.Term[F], B),Term.this.CofreeF,α(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)(in type λ)]],[α(in type λ)(in type λ)(in type λ)(in type λ)(in type λ
@sellout
sellout / gist:b3326cbb01164f5cebcf
Last active August 29, 2015 14:16
Is `data` a feasible macro?
// Does this look like a reasonable approach?
// What parts of this syntax aren’t going to work, etc.?
// What is missing?
package object logicalPlan {
data(LogicalPlan[A])(
Read[Path],
Constant[Data],
Invoke[Func, List[A]],
Join[A, A, JoinType, BinOp, A, A],
db.slamengine_commits.mapReduce(
function () {
(function (key, value) {
function clone(src) {
if (((typeof src) != "object") || (src == null)) return src;
var dest = src.constructor();
for (var i in (src)) dest[i] = clone(src[i]);
return dest;
};
var rez = [];