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
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
module RB where | |
import Data.Functor.Contravariant | |
newtype O f g e = Comp { deComp :: f (g e) } | |
newtype Square f a = Square { unSquare :: f (f 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
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
module RB where | |
data F a | |
= Lam a (a -> a) | |
| Pi a (a -> a) | |
| App a 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 Nat ( | |
-- types | |
Algebra | |
, Coalgebra | |
, NatF | |
-- data | |
, Fix | |
, N | |
, Nat | |
-- methods |
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
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE RankNTypes #-} | |
module AlaCarte ( | |
-- newtypes | |
Expr, | |
-- types | |
IntExpr, | |
AddExpr, | |
Algebra, |
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
;; includes | |
(add-to-list 'load-path "~/.emacs.d/znc.el") | |
;; Initialize | |
(package-initialize) | |
;; global variables | |
(setq | |
inhibit-startup-screen t | |
create-lockfiles nil |
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 Foo | |
public export | |
data Foo = Try Int | Again Int | |
implementation Show Foo where | |
show (Try n) = "(Try " ++ (show n) ++ ")" | |
show (Again n) = "(Again " ++ (show n) ++ ")" | |
export |
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 FFree[F[_], A] { | |
def map[B](f: A => B): FFree[F, B] = | |
flatMap[B](a => FFree.pure[F, B](f(a))) | |
def flatMap[B](k: A => FFree[F, B]): FFree[F, B] = | |
this match { | |
case FFree.Pure(a) => k(a) | |
case FFree.Impure(ff, rs) => FFree.impure(ff, rs.:+(Kleisli.wrapKleisli(k))) | |
} |
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
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module Codensity where | |
newtype Codensity m a = Codensity { runCodensity :: forall b. (a -> m b) -> m b } | |
abs :: Monad m => (a -> m b) -> Codensity m a -> m b | |
abs k (Codensity c) = c k |
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 CodensityModule { | |
type Codensity[M[_], A] | |
def abs[M[_], A](c: Codensity[M, A])(implicit M: Monad[M]): M[A] | |
def rep[M[_], A](ma: M[A])(implicit M: Monad[M]): Codensity[M, A] | |
} | |
private[data] object CodensityImpl extends CodensityModule with CodensityInstances { |
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
package cohomolo.gy.generalized | |
import scalaz.Prelude.{<~<, IsCovariant} | |
import scalaz.data.{As, Identity, ~>, ∀} | |
//final case class Mu[F[_]](unMu: Algebra[F, ?] ~> Identity) | |
trait MuModule { | |
type Mu[F[_]] |