Add a useful helper function to the instantiation state
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
b13cdea15d
commit
7d78db96d6
|
@ -1,4 +1,9 @@
|
|||
module Bergamot.Syntax exposing (Term(..), instantiate, emptyInstantiationState, unify, emptyUnificationState, reify)
|
||||
module Bergamot.Syntax exposing
|
||||
( Term(..), Metavariable, UnificationVar
|
||||
, instantiate, instantiateList, InstantiationState, emptyInstantiationState, resetVars
|
||||
, unify, unifyList, UnificationState, emptyUnificationState
|
||||
, reify
|
||||
)
|
||||
|
||||
import Set exposing (Set)
|
||||
import Dict exposing (Dict)
|
||||
|
@ -23,6 +28,9 @@ type alias InstantiationState =
|
|||
|
||||
emptyInstantiationState = { counter = 0, vars = Dict.empty }
|
||||
|
||||
resetVars : InstantiationState -> InstantiationState
|
||||
resetVars is = { is | vars = Dict.empty }
|
||||
|
||||
metavariable : Metavariable -> InstantiationState -> (UnificationVar, InstantiationState)
|
||||
metavariable mv is =
|
||||
case Dict.get mv is.vars of
|
||||
|
|
Loading…
Reference in New Issue
Block a user