@@ -9,6 +9,7 @@ module Idris.Core.Evaluate(normalise, normaliseTrace, normaliseC, normaliseAll,
9 addToCtxt, setAccess, setTotal, setMetaInformation, addCtxtDef, addTyDecl,
9 addToCtxt, setAccess, setTotal, setMetaInformation, addCtxtDef, addTyDecl,
10 addDatatype, addCasedef, simplifyCasedef, addOperator,
10 addDatatype, addCasedef, simplifyCasedef, addOperator,
11 lookupNames, lookupTy, lookupP, lookupDef, lookupDefAcc, lookupVal,
11 lookupNames, lookupTy, lookupP, lookupDef, lookupDefAcc, lookupVal,
12 lookupTotal, lookupNameTotal, lookupMetaInformation, lookupTyEnv, isDConName, isTConName, isConName, isFnName,
13 lookupTotal, lookupNameTotal, lookupMetaInformation, lookupTyEnv, isDConName, isTConName, isConName, isFnName,
13 Value(..), Quote(..), initEval, uniqueNameCtxt) where
14 Value(..), Quote(..), initEval, uniqueNameCtxt) where
@@ -696,6 +697,10 @@ data Context = MkContext {
696-- | The initial empty context
697-- | The initial empty context
697initContext = MkContext [] 0 emptyContext
698initContext = MkContext [] 0 emptyContext
700+mapDefCtxt :: (Def -> Def) -> Context -> Context
701+mapDefCtxt f (MkContext c t defs) = MkContext c t (mapCtxt f' defs)
702+ where f' (d, a, t, m) = f' (f d, a, t, m)
699-- | Get the definitions from a context
704-- | Get the definitions from a context
700ctxtAlist :: Context -> [(Name, Def)]
705ctxtAlist :: Context -> [(Name, Def)]
701ctxtAlist ctxt = map (\(n, (d, a, t, m)) -> (n, d)) $ toAlist (definitions ctxt)
706ctxtAlist ctxt = map (\(n, (d, a, t, m)) -> (n, d)) $ toAlist (definitions ctxt)