@@ -2,7 +2,7 @@
22 PatternGuards #-}
33{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
44
5−module Idris.Core.Evaluate(normalise, normaliseTrace, normaliseC, normaliseAll,
5+module Idris.Core.Evaluate(normalise, normaliseTrace, normaliseC, normaliseAll, toValue, quoteTerm,
66 rt_simplify, simplify, specialise, hnf, convEq, convEq',
77 Def(..), CaseInfo(..), CaseDefs(..),
88 Accessibility(..), Totality(..), PReason(..), MetaInformation(..),
@@ -13,7 +13,7 @@ module Idris.Core.Evaluate(normalise, normaliseTrace, normaliseC, normaliseAll,
1313 lookupP, lookupP_all, lookupDef, lookupNameDef, lookupDefExact, lookupDefAcc, lookupDefAccExact, lookupVal,
1414 mapDefCtxt,
1515 lookupTotal, lookupNameTotal, lookupMetaInformation, lookupTyEnv, isTCDict, isDConName, canBeDConName, isTConName, isConName, isFnName,
16− Value(..), initEval, uniqueNameCtxt, uniqueBindersCtxt, definitions,
16+ Value(..), Quote(..), initEval, uniqueNameCtxt, uniqueBindersCtxt, definitions,
1717 isUniverse) where
1818
1919import Debug.Trace
@@ -92,6 +92,13 @@ normaliseTrace tr ctxt env t
9292 = evalState (do val <- eval tr ctxt [] (map finalEntry env) (finalise t) []
9393 quote 0 val) initEval
9494
95+toValue :: Context -> Env -> TT Name -> Value
96+toValue ctxt env t
97+ = evalState (eval False ctxt [] (map finalEntry env) t []) initEval
98+
99+quoteTerm :: Value -> TT Name
100+quoteTerm val = evalState (quote 0 val) initEval
101+
95102-- Return a specialised name, and an updated list of reductions available,
96103-- so that the caller can tell how much specialisation was achieved.
97104specialise :: Context -> Env -> [(Name, Int)] -> TT Name ->