@@ -17,7 +17,7 @@ import Idris.Core.Evaluate (Def(TyDecl), initContext, lookupDefExact, lookupTyEx
17import Idris.Core.TT
17import Idris.Core.TT
19import Idris.AbsSyntaxTree (ArgOpt(..),ElabD, IState(tt_ctxt, idris_implicits,idris_datatypes),
19import Idris.AbsSyntaxTree (ArgOpt(..),ElabD, IState(tt_ctxt, idris_implicits,idris_datatypes),
20− PArg'(..), PArg, PTactic, PTactic'(..), PTerm(..),
20+ PArg'(..), PArg, PTactic, PTactic'(..), PTerm(..), Fixity (..),
21 initEState, pairCon, pairTy)
21 initEState, pairCon, pairTy)
22import Idris.Delaborate (delab)
22import Idris.Delaborate (delab)
@@ -398,6 +398,19 @@ claimTy n ty = do n' <- getNameFrom n
398 claim n' ty
398 claim n' ty
399 return n'
399 return n'
401+intToReflectedNat :: Int -> Raw
402+intToReflectedNat i = if i <= 0
404+ else RApp (Var (natN "S")) (intToReflectedNat (i - 1))
405+ where natN :: String -> Name
406+ natN n = sNS (sUN n) ["Nat", "Prelude"]
408+reflectFixity :: Fixity -> Raw
409+reflectFixity (Infixl p) = RApp (Var (tacN "Infixl")) (intToReflectedNat p)
410+reflectFixity (Infixr p) = RApp (Var (tacN "Infixr")) (intToReflectedNat p)
411+reflectFixity (InfixN p) = RApp (Var (tacN "InfixN")) (intToReflectedNat p)
412+reflectFixity (PrefixN p) = RApp (Var (tacN "PrefixN")) (intToReflectedNat p)
401-- | Convert a reflected term to a more suitable form for pattern-matching.
414-- | Convert a reflected term to a more suitable form for pattern-matching.
402-- In particular, the less-interesting bits are elaborated to _ patterns. This
415-- In particular, the less-interesting bits are elaborated to _ patterns. This
403-- happens to NameTypes, universe levels, names that are bound but not used,
416-- happens to NameTypes, universe levels, names that are bound but not used,