{-# LANGUAGE ViewPatterns #-}
module Clash.Core.Subst where
import Unbound.Generics.LocallyNameless (embed, subst, substs, unembed)
import Clash.Core.Term (LetBinding, Term, TmOccName)
import {-# SOURCE #-} Clash.Core.Type (KiOccName, Kind, TyOccName, Type)
substTys :: [(TyOccName,Type)]
-> Type
-> Type
substTys = substs
substTy :: TyOccName
-> Type
-> Type
-> Type
substTy = subst
substKindWith :: [(KiOccName,Kind)]
-> Kind
-> Kind
substKindWith = substs
substTyInTm :: TyOccName
-> Type
-> Term
-> Term
substTyInTm = subst
substTysinTm :: [(TyOccName,Type)]
-> Term
-> Term
substTysinTm = substs
substTm :: TmOccName
-> Term
-> Term
-> Term
substTm = subst
substTms :: [(TmOccName,Term)]
-> Term
-> Term
substTms = substs
substBndr :: TmOccName -> Term -> LetBinding -> LetBinding
substBndr nm tm (id_,unembed -> tm') = (id_,embed (substTm nm tm tm'))