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
open import Data.Nat | |
open import Data.Maybe | |
open import Data.Product | |
-- An implementation of infinite queues fashioned after the von Neuman ordinals | |
module Queue where | |
infixl 5 _⊕_ |
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 dotty.tools.dotc.ast.tpd.TypeTree | |
import dotty.tools.dotc.core.Contexts.Context | |
import dotty.tools.dotc.core.Symbols.defn | |
import dotty.tools.dotc.plugins.{PluginPhase, StandardPlugin} | |
import dotty.tools.dotc.typer.FrontEnd | |
import dotty.tools.dotc.report | |
class InferenceMatchablePlugin extends StandardPlugin { | |
override def name = "inference-matchable-plugin" |
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 AllowAmbiguousTypes #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE QuantifiedConstraints #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeOperators #-} |
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, GADTs #-} | |
import Data.Functor.Adjunction | |
import Data.Functor.Identity | |
import Data.Functor.Product | |
import Data.Functor.Const | |
newtype Left f g = L (forall l. (f l -> g l) -> l) | |
cata :: (f a -> g a) -> Left f g -> 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 GADTs #-} | |
import Data.Functor.HCofree | |
import Data.Vec.Lazy | |
import Data.Fin | |
import Data.Type.Nat | |
data Cotra f a where | |
Cotra :: SNat n -> f (Fin n) -> Vec n a -> Cotra f a | |
to :: Functor f => Cotra f a -> HCofree Traversable 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
import scala.language.existentials | |
class A { class E } | |
class B extends A { class E } | |
trait CD { type E } | |
trait C extends CD { type E = Int } | |
trait D extends CD { type E = String } | |
object Test { | |
type EE[+X <: { type E }] = X#E |
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
(* An initial attempt at universal algebra in Coq. | |
Author: Andrej Bauer <[email protected]> | |
If someone knows of a less painful way of doing this, please let me know. | |
We would like to define the notion of an algebra with given operations satisfying given | |
equations. For example, a group has of three operations (unit, multiplication, inverse) | |
and five equations (associativity, unit left, unit right, inverse left, inverse right). | |
*) |
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 scala.language.higherKinds | |
trait LeftContravariant[F[_,_]] { | |
def contramap[A,AA,B](fa: F[A,B])(f: AA => A): F[AA,B] | |
} | |
trait RightCovariant[F[_,_]] { | |
def map[A,B,BB](fa: F[A,B])(g: B => BB): F[A,BB] | |
} |
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 Wizard.ConstUnit | |
import Wizard.Id | |
import scala.language.higherKinds | |
/* | |
Are there any constructions in Category Theory something like: | |
Given: | |
C category |
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.{Comonad, Monad} | |
import scalaz.{Arrow, Contravariant, Profunctor} | |
import scalaz.{Lan, Ran} | |
object AnyAndNothingInstances { | |
// Monad | |
// https://twitter.com/runarorama/status/1085383309969014784 | |
type FYea[A] = Any |
NewerOlder