packages feed

descript-lang-0.2.0.0: src/Descript/BasicInj/Read/Resolve/Subst/Subst.hs

{-# LANGUAGE TypeFamilies #-}

module Descript.BasicInj.Read.Resolve.Subst.Subst
  ( SubstPart (..)
  , Subst (..)
  , substDeclHead
  ) where

import Descript.BasicInj.Data
import Core.Data.List.Assoc

data SubstPart
  = SubstFrom
  | SubstTo

data Subst = Subst SubstPart (FSymbol ()) (FSymbol ())

instance AssocPair Subst where
  type Key Subst = FSymbol ()
  type Value Subst = FSymbol ()

  getKey (Subst SubstFrom from _) = from
  getKey (Subst SubstTo _ to) = to
  getValue (Subst SubstFrom _ to) = to
  getValue (Subst SubstTo from _) = from

substDeclHead :: Subst -> FSymbol ()
substDeclHead = getKey