diff --git a/semantic-core/src/Data/Core.hs b/semantic-core/src/Data/Core.hs index 7ff8dc307..75a4a9473 100644 --- a/semantic-core/src/Data/Core.hs +++ b/semantic-core/src/Data/Core.hs @@ -11,6 +11,7 @@ module Data.Core , block , ann , annWith +, instantiate ) where import Control.Applicative (Alternative (..)) @@ -139,3 +140,7 @@ gfoldT var let' seq' lam app unit bool if' string load edge frame dot assign ann -- | Bind occurrences of a name in a 'Core' term, producing a 'Core' in which the name is bound. bind :: Eq a => a -> Core a -> Core (Incr a) bind name = fmap (match name) + +-- | Substitute a 'Core' term for the free variable in a given 'Core', producing a closed 'Core' term. +instantiate :: Core a -> Core (Incr a) -> Core a +instantiate t b = b >>= subst t . fmap pure