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 LambdaCase #-} | |
module LambdaPi where | |
import Control.Applicative hiding (Const) | |
import Control.Monad (guard) | |
import Control.Monad.Gen | |
import Control.Monad.Trans | |
import qualified Data.Map as M | |
data IExpr = Var Int | |
| App IExpr CExpr |
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 LambdaCase, DeriveFunctor #-} | |
module LambdaPi where | |
import Bound | |
import Control.Applicative | |
import Control.Monad | |
import Control.Monad.Gen | |
import Control.Monad.Reader | |
import qualified Data.Map as M | |
import Data.Maybe | |
import Prelude.Extras |
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 ImpredicativeTypes #-} | |
{-# LANGUAGE RankNTypes #-} | |
module Tail where | |
type CL a = forall c. (a -> c -> c) -> c -> c | |
t :: CL a -> (forall c. (a -> (Bool -> c) -> (Bool -> c)) | |
-> (Bool -> c) | |
-> (Bool -> c)) | |
t fold cons nil = fold myCons myNil |
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
nat : type. | |
s : nat -> nat. | |
z : nat. | |
bool : type. | |
true : bool. | |
false : bool. | |
plus : nat -> nat -> nat -> type. | |
%mode plus +N +M -R. |
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 queue | |
import Data.Vect | |
-- Here's the port of the Liquid Haskell blog post on amortized | |
-- queues. The tricksy bit is that the "amortized" bit depends on | |
-- laziness. This means that while in the REPL (where Idris is lazy) | |
-- this is reasonably efficient. It compiles absolutely horribly | |
-- though because each time push or pop something we rotate the whole | |
-- damned thing. |
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 DeriveFunctor, GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE FlexibleContexts, LambdaCase #-} | |
-- | A humane representation of binding. | |
module ABT ( FreeVar (..) | |
, Operator (..) | |
, ABT | |
, View (..) | |
, view | |
, fold |
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
signature TYPEINFER = | |
sig | |
type tvar = int | |
datatype monotype = TBool | |
| TArr of monotype * monotype | |
| TVar of tvar | |
datatype polytype = PolyType of int list * monotype | |
datatype exp = True | |
| False | |
| Var of int |
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
signature UNION_FIND = | |
sig | |
type t | |
eqtype set | |
val new : t -> set | |
val union : set -> set -> unit | |
val repr : set -> set | |
val same : set -> set -> bool | |
end |
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
signature KEY = | |
sig | |
type t | |
val compare : t * t -> order | |
end | |
signature PQUEUE = | |
sig | |
type t | |
type key |
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 wat | |
data Wat : Type where | |
foo : (Wat -> Wat) -> Wat | |
sapply : Wat -> Wat | |
sapply (foo x) = x (foo x) | |
u : Wat | |
u = sapply (foo (\x => sapply x)) |