Skip to content

Instantly share code, notes, and snippets.

oplaxity cell

Greg Pfeil sellout

oplaxity cell
Block or report user

Report or block sellout

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Polys.idr
module Polys
import Control.Monad.Identity
import Data.Morphisms
data ProductMeh: (Type -> Type) -> (Type -> Type) -> Type -> Type where
Prod: (f a, g a) -> ProductMeh f g a
data NaturalTransformation : (Type -> Type) -> (Type -> Type) -> Type where
NT : (f a -> g a) -> NaturalTransformation f g
View gist:0010114b0a93a31665b4a5eb79676dde
> darwin-rebuild switch ~/.nix-defexpr/darwin
building the system configuration...
error: file ‘darwin’ was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:1
error: Changed <darwin> but target does not exist, aborting activation
Add the darwin repo as a channel or set NIX_PATH:
$ sudo nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
$ sudo nix-channel --update
or set
View example.idr
module Example
interface Base (f : x -> Type) where
base : (x -> Type) -> x -> Type
interface Base f => Corecursive (f : x -> Type) where
cbase : (x -> Type) -> x -> Type
cbase {f} = base {f}
-- When checking right hand side of Example.default#cbase with expected type
View gist:b5c313aa92ee894d11a4e985c85cbdb4
@typeclass trait ExpandMapFunc[IN[_]] {
type T[_[_]]
type OUT[_]
def expand: Algebra[IN, T[OUT]]
}
object ExpandMapFunc extends ExpandMapFuncInstances {
type Aux[Tʹ[_[_]], IN[_], OUTʹ[_]] = ExpandMapFunc[IN] {
type T[F[_]] = Tʹ[F]
View gist:5a814ef52aa4eefce6fef0ba6107eec3
> nix-channel --update
downloading Nix expressions from ‘https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.09pre106045.7369fd0b51/nixexprs.tar.xz’...
downloading ‘https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.09pre106045.7369fd0b51/nixexprs.tar.xz’... [7471/8550 KiB, 7391.9 KiB/s]
error: cannot connect to daemon at ‘/nix/var/nix/daemon-socket/socket’: Connection refused
cannot fetch ‘https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.09pre106045.7369fd0b51/nixexprs.tar.xz’
> nix-daemon
error: cannot bind to socket ‘/nix/var/nix/daemon-socket/socket’: Address already in use
View moving-from-scalaz.md

Porting from Scalaz to Cats (and friends)

Mappings

There are a lot of cases where things simply differ by name. These are the easiest changes to make.

  • scalaz.Zip -> cats.Cartesian (with the primary operation zip -> product)
  • scalaz.Unzip -> cats.MonadCombine ... sort of
  • scalaz.Task -> fs2.Task (or monix.Task)
@sellout
sellout / plugins.sbt
Created Jan 6, 2017
This is in ~/.sbt/0.13/plugins/
View plugins.sbt
resolvers += Resolver.bintrayRepo("tek", "maven")
addCompilerPlugin("tryp" %% "splain" % "0.1.11")
addSbtPlugin("org.ensime" % "sbt-ensime" % "1.12.4")
addSbtPlugin("com.softwaremill.clippy" % "plugin-sbt" % "0.3.4")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.5")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.10")
View multipleImplicits.scala
trait Ops[T, F[_]] {
// currently
object transCata {
def apply[U] = new PartiallyApplied[U] // PartiallyApplied
final class PartiallyApplied[U] {
def apply[G[_]: Functor] // unnecessary type param, and seductive constraint syntax
(f: F[U] => G[U])
(implicit U: Corecursive.Aux[U, G], BF: Functor[F]) // Aux
: U =
typeClassInstance.transCata(self)(f)
View abstractTypeClass.scala
trait A[T] {
type F[_]
}
trait B1[T] extends A[T]
object B1 {
type Aux[T, Fʹ[_]] = B1[T] { type F[A] = Fʹ[A] }
}
View polykindrecursion.scala
object Test {
abstract class Recursive[T <: AnyKind] {
type Base[_ <: AnyKind] <: AnyKind
type ~~>[_ <: AnyKind, _ <: AnyKind]
def project: T ~~> Base[T]
}
object Recursive {
You can’t perform that action at this time.