module LetInline where

open import Data.List.Base
open import Data.Product
open import environment
open import Language
open import Generic.Semantics
open import Generic.Semantics.Syntactic
open import Function

open Internal

LetInline : Sem typed LetFree LetFree
Sem.th^π“₯ LetInline = th^Tm
Sem.var   LetInline = id
Sem.alg   LetInline = Ξ» t β†’ case letView t of Ξ» where
  (Let r e b) β†’ extract b (Ξ΅ βˆ™ e)
  (Β¬Let p)    β†’ Sem.alg Substitution p

let-inline : βˆ€ {Οƒ} β†’ Typed Οƒ [] β†’ LetFree Οƒ []
let-inline = Sem.closed LetInline