Skip to content

Instantly share code, notes, and snippets.

@paf31
Created May 18, 2014 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paf31/9c1d4708c074480870ea to your computer and use it in GitHub Desktop.
Save paf31/9c1d4708c074480870ea to your computer and use it in GitHub Desktop.
module LLC
consume : Nat -> List (Maybe Nat) -> List (Maybe Nat)
consume vid (Nothing :: vs) = Nothing :: consume vid vs
consume vid (Just v :: vs) with (vid == v)
| True = Nothing :: vs
| False = Just v :: consume vid vs
data Lolli : Type -> Type -> Type where
mkLolli : (a -> b) -> Lolli a b
data Lin : Nat -> List (Maybe Nat) -> List (Maybe Nat) -> Type -> Type where
llam : (((v : Nat) -> (i : List (Maybe Nat)) -> Lin v i (consume vid i) a) ->
Lin (S vid) (Just vid :: hi) (Nothing :: ho) b
) ->
Lin vid hi ho (Lolli a b)
lapp : Lin vid hi h (Lolli a b) -> Lin vid h ho a -> Lin vid hi ho b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment