{-# LANGUAGE GADTs, MultiParamTypeClasses #-} {-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-} module Data.Cursor.CLASE.Bound( Bound(..), inBindingScope ) where import Data.Cursor.CLASE.Language class (Language l) => Bound l t where bindingHook :: Context l from to -> t -> t inBindingScope :: (Bound l t) => (a -> t) -> Cursor l x a -> t inBindingScope fn (Cursor it ctx _) = foldUp (fn it) ctx foldUp :: (Bound l t) => t -> Path l (Context l) a b -> t foldUp t Stop = t foldUp t (Step ctx nxt) = foldUp (bindingHook ctx t) nxt