This file contains hidden or 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 FlexibleContexts, TypeOperators #-} | |
| import qualified Control.Monad.State.Strict as SS | |
| import qualified CState as CS | |
| import qualified Control.Eff.State.Strict as ES | |
| import Criterion.Main | |
| import Control.Monad | |
| import Control.Monad.State.Class | |
| import Data.Functor.Identity | |
| import Control.Eff | |
| import Data.Typeable |
This file contains hidden or 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 Control.Applicative | |
| import Control.Monad.State | |
| import Text.ParserCombinators.Parsec hiding ((<|>), State) | |
| import qualified Data.Map as M | |
| data OpA = (:+:) | (:-:) | (:*:) | (:/:) deriving (Eq,Show) | |
| data OpB = And | Or deriving (Eq,Show) | |
| data OpR = (:>) | (:<) deriving (Eq,Show) | |
| newtype Var = Var String deriving (Eq,Ord,Show) | |
| data AExp = VarExp Var | Numeral Integer | ApplyA OpA AExp AExp |
This file contains hidden or 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 ExistentialQuantification, PackageImports #-} | |
| {-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
| import Control.Applicative | |
| import Text.Trifecta | |
| import "mtl" Control.Monad.State | |
| import qualified Data.Map as M | |
| import Data.Monoid | |
| import Data.Ratio | |
| newtype Var = Var String deriving (Eq, Ord, Show) |
This file contains hidden or 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
| Require Import ssreflect. | |
| Class Monad (M : Type -> Type) := | |
| { | |
| mreturn : forall {A}, A -> M A | |
| ; mbind : forall {A B}, M A -> (A -> M B) -> M B | |
| ; left_return : forall A B (a : A) (k : A -> M B), mbind (mreturn a) k = k a | |
| ; right_return : forall A (m : M A), mbind m mreturn = m | |
| ; composite : forall A B (m : M A) (k : A -> M A) (h : A -> M B), |
This file contains hidden or 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
| Require Import FunctionalExtensionality. | |
| Module Category. | |
| Axiom proof_irrelevance : forall (P : Prop) (u v : P), u = v. | |
| Reserved Notation "a ~> b" (at level 90). | |
| Reserved Notation "a o; b" (at level 45, right associativity). | |
| Class Category : Type := |
This file contains hidden or 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 CatScratch where | |
| open import Function hiding (_∘_; id) | |
| open import Level | |
| open import Data.Product | |
| open import Relation.Binary | |
| open import Relation.Binary.Core using (_≡_) | |
| open import Relation.Binary.PropositionalEquality using (setoid) | |
| import Relation.Binary.EqReasoning as EqR | |
| import Relation.Binary.SetoidReasoning as SetR |
This file contains hidden or 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 Set-Syntax where | |
| Σ-syntax′ : ∀ {a b} (A : Set a) → (A → Set b) → Set (a ⊔ b) | |
| Σ-syntax′ = Σ | |
| syntax Σ-syntax′ A (\x → B) = [ x ∈ A ∣ B ] | |
| Σ-type : ∀{a b} → Set a → Set b → Set _ | |
| Σ-type A B = Σ A (\_ → B) | |
| syntax Σ-type A P = P ⊆ A |
This file contains hidden or 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
| infix 4 _∈_ _∉_ | |
| data _∈_ {f} {A : Set f} (x : A) (B : Set f) : Set (suc f) where | |
| in-eq : A ≡ B → x ∈ B | |
| _∉_ : {B : Set} → B → Set → Set₁ | |
| X ∉ A = (X ∈ A) → ⊥ | |
| module elem-lemmas where | |
| elem-∈ : {A B : Set} → ∀{x : B} → x ∈ A → A | |
| elem-∈ {x = x} (in-eq ≡-refl) = x |
This file contains hidden or 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 Codensity where | |
| open import Level | |
| open import Function | |
| open import Category.Functor | |
| open import Category.Monad | |
| open import Relation.Binary.PropositionalEquality | |
| record Functor {a b} (F : Set a → Set b) : Set (suc (a ⊔ b)) where | |
| field |
This file contains hidden or 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
| theory CommRing | |
| imports Main | |
| begin | |
| no_notation plus (infixl "+" 65) | |
| no_notation minus (infixl "-" 65) | |
| no_notation times (infixl "*" 70) | |
| no_notation zero_class.zero ("0") | |
| no_notation one_class.one ("1") |