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 RoseTree where | |
open import Level | |
open import Data.List as List | |
open import Data.Unit | |
open import Data.Product | |
data RoseTree {ℓ : Level} (A : Set ℓ) : Set ℓ where | |
node : (a : A) (ts : List (RoseTree A)) → RoseTree 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
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE PolyKinds #-} | |
module ImperativeDSL where |
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 State where | |
open import Data.Unit | |
open import Data.Product | |
open import Function | |
open import Relation.Binary.PropositionalEquality | |
_⟶_ : {I : Set} (X Y : I → Set) → Set | |
X ⟶ Y = ∀ {i} → X i → Y i |
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
-- Slight variant of https://gist.github.com/AndrasKovacs/9597994 | |
{- | |
Copyright (C) 2014 András Kovács | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TO |
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 STLC (Atom : Set) (_≠_ : Atom → Atom → Set) where | |
open import Data.Empty | |
open import Data.Product as P hiding (_,_) | |
open import Data.List | |
open import Function hiding (_∋_) | |
data ★ : Set where | |
ι : ★ | |
_⊳_ : ★ → ★ → ★ |
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 Sums where | |
open import Data.Nat | |
open import Data.Fin using (Fin; module Fin) | |
open import Function | |
sum : (k : ℕ) (f : Fin k → ℕ) → ℕ | |
sum zero f = 0 | |
sum (suc k) f = f Fin.zero + sum k (f ∘ Fin.suc) |
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 MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE PolyKinds #-} |
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 RecordWildCards #-} | |
module AllContexts where | |
import Data.List | |
data Context a = Context | |
{ before :: [a] | |
, focus :: a | |
, after :: [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
(* | |
We don't really care about the data constructors here | |
but they are needed, cf: | |
https://sympa.inria.fr/sympa/arc/caml-list/2013-10/msg00190.html | |
*) | |
type zero = Zero | |
type 'a succ = Succ | |
(* | |
[] has length 0 |
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
{-# OPTIONS_GHC -fdefer-type-errors #-} | |
{-# LANGUAGE RankNTypes #-} | |
module NumList where | |
import Data.Void | |
type NumList a = Num a => [a] | |
first :: NumList a -> a |