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 Strict, BangPatterns #-} | |
data Tm = Var Int | App Tm Tm | Lam Tm | Fix Tm deriving (Show, Eq) | |
data Val = VVar Int | VApp Val Val | VLam [Val] Tm | VFix [Val] Tm | |
isCanonical :: Val -> Bool | |
isCanonical VLam{} = True | |
isCanonical _ = False | |
eval :: [Val] -> Tm -> Val |
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 | |
TypeInType, UndecidableInstances, TypeOperators, GADTs, TypeFamilies #-} | |
import Data.Kind | |
import GHC.Prim | |
import Data.Proxy | |
data Fun a b | |
type a ~> b = Fun a b -> Type | |
infixr 0 ~> |
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 OverloadedStrings, UnicodeSyntax, LambdaCase, | |
ViewPatterns, NoMonomorphismRestriction #-} | |
{-# options_ghc -fwarn-incomplete-patterns #-} | |
{- Minimal bidirectional dependent type checker with type-in-type. Related to Coquand's | |
algorithm. #-} | |
import Prelude hiding (all) |
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 | |
UndecidableInstances, RankNTypes, TypeOperators, TypeFamilies, | |
StandaloneDeriving, DataKinds, PolyKinds, DeriveFunctor, DeriveFoldable, | |
DeriveTraversable, LambdaCase, PatternSynonyms, TemplateHaskell #-} | |
import Control.Monad | |
import Control.Applicative | |
import Data.Singletons.TH | |
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
-- Examples | |
data Foo = A | B | C | |
foo :: Foo -> Int | |
foo A = 10 | |
foo B | |
foo C = 20 | |
foo :: Foo -> Int |
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 LambdaCase, Strict, OverloadedStrings, DerivingVia #-} | |
{-# options_ghc -Wincomplete-patterns #-} | |
{-| | |
Simple universe polymorphism. Features: | |
- Non-first-class levels: there is a distinct Pi, lambda and application for | |
levels. Levels are distinct from terms in syntax/values. | |
- The surface language only allows abstraction over finite levels. Internally, |
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 Strict, LambdaCase, BlockArguments #-} | |
{-# options_ghc -Wincomplete-patterns #-} | |
{- | |
Minimal demo of "glued" evaluation in the style of Olle Fredriksson: | |
https://github.com/ollef/sixty | |
The main idea is that during elaboration, we need different evaluation |
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
{-# OPTIONS --type-in-type #-} | |
open import Relation.Binary.PropositionalEquality | |
renaming (cong to ap; sym to infixl 6 _⁻¹; subst to tr; trans to infixr 4 _◾_) | |
open import Data.Product | |
renaming (proj₁ to ₁; proj₂ to ₂) | |
-------------------------------------------------------------------------------- | |
NatAlg : Set |
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 Algebra | |
open import Data.Bool | |
open import Data.Empty | |
open import Data.List | |
open import Data.List.Properties | |
open import Data.Nat | |
open import Data.Product | |
open import Data.Unit | |
open import Function |