1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 16:02:43 +03:00

Define instantiation of Core terms.

This commit is contained in:
Rob Rix 2019-06-25 18:31:28 -04:00
parent bde447c040
commit 9790468ada
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -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