@@ -2007,15 +2007,27 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2007 getRetTy (Bind _ (Pi _ _ _) sc) = getRetTy sc
2007 getRetTy (Bind _ (Pi _ _ _) sc) = getRetTy sc
2008 getRetTy ty = ty
2008 getRetTy ty = ty
2010+ elabScriptStuck :: Term -> ElabD a
2011+ elabScriptStuck x = lift . tfail $ ElabScriptStuck x
2014+ -- Should be dependent
2015+ tacTmArgs :: Int -> Term -> [Term] -> ElabD [Term]
2016+ tacTmArgs l t args | length args == l = return args
2017+ | otherwise = elabScriptStuck t -- Probably should be an argument size mismatch internal error
2010 -- | Do a step in the reflected elaborator monad. The input is the
2020 -- | Do a step in the reflected elaborator monad. The input is the
2011 -- step, the output is the (reflected) term returned.
2021 -- step, the output is the (reflected) term returned.
2012 runTacTm :: Term -> ElabD Term
2022 runTacTm :: Term -> ElabD Term
2013− runTacTm (unApply -> tac@(P _ n _, args))
2023+ runTacTm tac@(unApply -> (P _ n _, args))
2014− | n == tacN "Prim__Solve", [] <- args
2024+ | n == tacN "Prim__Solve"
2025+ = do ~[] <- tacTmArgs 0 tac args -- patterns are irrefutable because `tacTmArgs` returns lists of exactly the size given to it as first argument
2015− = do solve
2026+ solve
2016 returnUnit
2027 returnUnit
2017− | n == tacN "Prim__Goal", [] <- args
2028+ | n == tacN "Prim__Goal"
2029+ = do ~[] <- tacTmArgs 0 tac args
2018− = do hs <- get_holes
2030+ hs <- get_holes
2019 case hs of
2031 case hs of
2020 (h : _) -> do t <- goal
2032 (h : _) -> do t <- goal
2021 fmap fst . checkClosed $
2033 fmap fst . checkClosed $
@@ -2024,15 +2036,18 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2024 [] -> lift . tfail . Msg $
2036 [] -> lift . tfail . Msg $
2025 "Elaboration is complete. There are no goals."
2037 "Elaboration is complete. There are no goals."
2027− | n == tacN "Prim__Holes", [] <- args
2039+ | n == tacN "Prim__Holes"
2040+ = do ~[] <- tacTmArgs 0 tac args
2028− = do hs <- get_holes
2041+ hs <- get_holes
2029 fmap fst . checkClosed $
2042 fmap fst . checkClosed $
2030 mkList (Var $ reflm "TTName") (map reflectName hs)
2043 mkList (Var $ reflm "TTName") (map reflectName hs)
2031− | n == tacN "Prim__Guess", [] <- args
2044+ | n == tacN "Prim__Guess"
2045+ = do ~[] <- tacTmArgs 0 tac args
2032− = do g <- get_guess
2046+ g <- get_guess
2033 fmap fst . checkClosed $ reflect g
2047 fmap fst . checkClosed $ reflect g
2034− | n == tacN "Prim__LookupTy", [n] <- args
2048+ | n == tacN "Prim__LookupTy"
2049+ = do ~[name] <- tacTmArgs 1 tac args
2035− = do n' <- reifyTTName n
2050+ n' <- reifyTTName name
2036 ctxt <- get_context
2051 ctxt <- get_context
2037 let getNameTypeAndType = \case Function ty _ -> (Ref, ty)
2052 let getNameTypeAndType = \case Function ty _ -> (Ref, ty)
2038 TyDecl nt ty -> (nt, ty)
2053 TyDecl nt ty -> (nt, ty)
@@ -2053,20 +2068,23 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2053 , raw_apply (Var pairTy) [ Var (reflm "NameType")
2068 , raw_apply (Var pairTy) [ Var (reflm "NameType")
2054 , Var (reflm "TT")]])
2069 , Var (reflm "TT")]])
2056− | n == tacN "Prim__LookupDatatype", [name] <- args
2071+ | n == tacN "Prim__LookupDatatype"
2072+ = do ~[name] <- tacTmArgs 1 tac args
2057− = do n' <- reifyTTName name
2073+ n' <- reifyTTName name
2058 datatypes <- get_datatypes
2074 datatypes <- get_datatypes
2059 ctxt <- get_context
2075 ctxt <- get_context
2060 fmap fst . checkClosed $
2076 fmap fst . checkClosed $
2061 rawList (Var (tacN "Datatype"))
2077 rawList (Var (tacN "Datatype"))
2062 (map reflectDatatype (buildDatatypes ist n'))
2078 (map reflectDatatype (buildDatatypes ist n'))
2063− | n == tacN "Prim__LookupFunDefn", [name] <- args
2079+ | n == tacN "Prim__LookupFunDefn"
2080+ = do ~[name] <- tacTmArgs 1 tac args
2064− = do n' <- reifyTTName name
2081+ n' <- reifyTTName name
2065 fmap fst . checkClosed $
2082 fmap fst . checkClosed $
2066 rawList (RApp (Var $ tacN "FunDefn") (Var $ reflm "TT"))
2083 rawList (RApp (Var $ tacN "FunDefn") (Var $ reflm "TT"))
2067 (map reflectFunDefn (buildFunDefns ist n'))
2084 (map reflectFunDefn (buildFunDefns ist n'))
2068− | n == tacN "Prim__LookupArgs", [name] <- args
2085+ | n == tacN "Prim__LookupArgs"
2086+ = do ~[name] <- tacTmArgs 1 tac args
2069− = do n' <- reifyTTName name
2087+ n' <- reifyTTName name
2070 let listTy = Var (sNS (sUN "List") ["List", "Prelude"])
2088 let listTy = Var (sNS (sUN "List") ["List", "Prelude"])
2071 listFunArg = RApp listTy (Var (tacN "FunArg"))
2089 listFunArg = RApp listTy (Var (tacN "FunArg"))
2072 -- Idris tuples nest to the right
2090 -- Idris tuples nest to the right
@@ -2089,37 +2107,45 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2089 (Var (tacN "FunArg"))
2107 (Var (tacN "FunArg"))
2090 , Var (reflm "Raw")]])
2108 , Var (reflm "Raw")]])
2092− | n == tacN "Prim__SourceLocation", [] <- args
2110+ | n == tacN "Prim__SourceLocation"
2111+ = do ~[] <- tacTmArgs 0 tac args
2093− = fmap fst . checkClosed $
2112+ fmap fst . checkClosed $
2094− reflectFC fc
2113+ reflectFC fc
2095− | n == tacN "Prim__Namespace", [] <- args
2114+ | n == tacN "Prim__Namespace"
2115+ = do ~[] <- tacTmArgs 0 tac args
2096− = fmap fst . checkClosed $
2116+ fmap fst . checkClosed $
2097− rawList (RConstant StrType) (map (RConstant . Str) ns)
2117+ rawList (RConstant StrType) (map (RConstant . Str) ns)
2098− | n == tacN "Prim__Env", [] <- args
2118+ | n == tacN "Prim__Env"
2119+ = do ~[] <- tacTmArgs 0 tac args
2099− = do env <- get_env
2120+ env <- get_env
2100 fmap fst . checkClosed $ reflectEnv env
2121 fmap fst . checkClosed $ reflectEnv env
2101− | n == tacN "Prim__Fail", [_a, errs] <- args
2122+ | n == tacN "Prim__Fail"
2123+ = do ~[_a, errs] <- tacTmArgs 2 tac args
2102− = do errs' <- eval errs
2124+ errs' <- eval errs
2103 parts <- reifyReportParts errs'
2125 parts <- reifyReportParts errs'
2104 lift . tfail $ ReflectionError [parts] (Msg "")
2126 lift . tfail $ ReflectionError [parts] (Msg "")
2105− | n == tacN "Prim__PureElab", [_a, tm] <- args
2127+ | n == tacN "Prim__PureElab"
2128+ = do ~[_a, tm] <- tacTmArgs 2 tac args
2106− = return tm
2129+ return tm
2107− | n == tacN "Prim__BindElab", [_a, _b, first, andThen] <- args
2130+ | n == tacN "Prim__BindElab"
2131+ = do ~[_a, _b, first, andThen] <- tacTmArgs 4 tac args
2108− = do first' <- eval first
2132+ first' <- eval first
2109 res <- eval =<< runTacTm first'
2133 res <- eval =<< runTacTm first'
2110 next <- eval (App Complete andThen res)
2134 next <- eval (App Complete andThen res)
2111 runTacTm next
2135 runTacTm next
2112− | n == tacN "Prim__Try", [_a, first, alt] <- args
2136+ | n == tacN "Prim__Try"
2137+ = do ~[_a, first, alt] <- tacTmArgs 3 tac args
2113− = do first' <- eval first
2138+ first' <- eval first
2114 alt' <- eval alt
2139 alt' <- eval alt
2115 try' (runTacTm first') (runTacTm alt') True
2140 try' (runTacTm first') (runTacTm alt') True
2116− | n == tacN "Prim__Fill", [raw] <- args
2141+ | n == tacN "Prim__Fill"
2142+ = do ~[raw] <- tacTmArgs 1 tac args
2117− = do raw' <- reifyRaw =<< eval raw
2143+ raw' <- reifyRaw =<< eval raw
2118 apply raw' []
2144 apply raw' []
2119 returnUnit
2145 returnUnit
2120 | n == tacN "Prim__Apply" || n == tacN "Prim__MatchApply"
2146 | n == tacN "Prim__Apply" || n == tacN "Prim__MatchApply"
2121− , [raw, argSpec] <- args
2147+ = do ~[raw, argSpec] <- tacTmArgs 2 tac args
2122− = do raw' <- reifyRaw =<< eval raw
2148+ raw' <- reifyRaw =<< eval raw
2123 argSpec' <- map (\b -> (b, 0)) <$> reifyList reifyBool argSpec
2149 argSpec' <- map (\b -> (b, 0)) <$> reifyList reifyBool argSpec
2124 let op = if n == tacN "Prim__Apply"
2150 let op = if n == tacN "Prim__Apply"
2125 then apply
2151 then apply
@@ -2131,89 +2157,105 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2131 (reflectName n1, reflectName n2)
2157 (reflectName n1, reflectName n2)
2132 | (n1, n2) <- ns
2158 | (n1, n2) <- ns
2134− | n == tacN "Prim__Gensym", [hint] <- args
2160+ | n == tacN "Prim__Gensym"
2161+ = do ~[hint] <- tacTmArgs 1 tac args
2135− = do hintStr <- eval hint
2162+ hintStr <- eval hint
2136 case hintStr of
2163 case hintStr of
2137 Constant (Str h) -> do
2164 Constant (Str h) -> do
2138 n <- getNameFrom (sMN 0 h)
2165 n <- getNameFrom (sMN 0 h)
2139 fmap fst $ get_type_val (reflectName n)
2166 fmap fst $ get_type_val (reflectName n)
2140 _ -> fail "no hint"
2167 _ -> fail "no hint"
2141− | n == tacN "Prim__Claim", [n, ty] <- args
2168+ | n == tacN "Prim__Claim"
2169+ = do ~[n, ty] <- tacTmArgs 2 tac args
2142− = do n' <- reifyTTName n
2170+ n' <- reifyTTName n
2143 ty' <- reifyRaw ty
2171 ty' <- reifyRaw ty
2144 claim n' ty'
2172 claim n' ty'
2145 returnUnit
2173 returnUnit
2146− | n == tacN "Prim__Check", [env', raw] <- args
2174+ | n == tacN "Prim__Check"
2175+ = do ~[env', raw] <- tacTmArgs 2 tac args
2147− = do env <- reifyEnv env'
2176+ env <- reifyEnv env'
2148 raw' <- reifyRaw =<< eval raw
2177 raw' <- reifyRaw =<< eval raw
2149 ctxt <- get_context
2178 ctxt <- get_context
2150 (tm, ty) <- lift $ check ctxt env raw'
2179 (tm, ty) <- lift $ check ctxt env raw'
2151 fmap fst . checkClosed $
2180 fmap fst . checkClosed $
2152 rawPair (Var (reflm "TT"), Var (reflm "TT"))
2181 rawPair (Var (reflm "TT"), Var (reflm "TT"))
2153 (reflect tm, reflect ty)
2182 (reflect tm, reflect ty)
2154− | n == tacN "Prim__Attack", [] <- args
2183+ | n == tacN "Prim__Attack"
2184+ = do ~[] <- tacTmArgs 0 tac args
2155− = do attack
2185+ attack
2156 returnUnit
2186 returnUnit
2157− | n == tacN "Prim__Rewrite", [rule] <- args
2187+ | n == tacN "Prim__Rewrite"
2188+ = do ~[rule] <- tacTmArgs 1 tac args
2158− = do r <- reifyRaw rule
2189+ r <- reifyRaw rule
2159 rewrite r
2190 rewrite r
2160 returnUnit
2191 returnUnit
2161− | n == tacN "Prim__Focus", [what] <- args
2192+ | n == tacN "Prim__Focus"
2193+ = do ~[what] <- tacTmArgs 1 tac args
2162− = do n' <- reifyTTName what
2194+ n' <- reifyTTName what
2163 hs <- get_holes
2195 hs <- get_holes
2164 if elem n' hs
2196 if elem n' hs
2165 then focus n' >> returnUnit
2197 then focus n' >> returnUnit
2166 else lift . tfail . Msg $ "The name " ++ show n' ++ " does not denote a hole"
2198 else lift . tfail . Msg $ "The name " ++ show n' ++ " does not denote a hole"
2167− | n == tacN "Prim__Unfocus", [what] <- args
2199+ | n == tacN "Prim__Unfocus"
2200+ = do ~[what] <- tacTmArgs 1 tac args
2168− = do n' <- reifyTTName what
2201+ n' <- reifyTTName what
2169 movelast n'
2202 movelast n'
2170 returnUnit
2203 returnUnit
2171− | n == tacN "Prim__Intro", [mn] <- args
2204+ | n == tacN "Prim__Intro"
2205+ = do ~[mn] <- tacTmArgs 1 tac args
2172− = do n <- case fromTTMaybe mn of
2206+ n <- case fromTTMaybe mn of
2173 Nothing -> return Nothing
2207 Nothing -> return Nothing
2174 Just name -> fmap Just $ reifyTTName name
2208 Just name -> fmap Just $ reifyTTName name
2176 returnUnit
2210 returnUnit
2177− | n == tacN "Prim__Forall", [n, ty] <- args
2211+ | n == tacN "Prim__Forall"
2212+ = do ~[n, ty] <- tacTmArgs 2 tac args
2178− = do n' <- reifyTTName n
2213+ n' <- reifyTTName n
2179 ty' <- reifyRaw ty
2214 ty' <- reifyRaw ty
2180 forall n' Nothing ty'
2215 forall n' Nothing ty'
2181 returnUnit
2216 returnUnit
2182− | n == tacN "Prim__PatVar", [n] <- args
2217+ | n == tacN "Prim__PatVar"
2218+ = do ~[n] <- tacTmArgs 1 tac args
2183− = do n' <- reifyTTName n
2219+ n' <- reifyTTName n
2184 patvar' n'
2220 patvar' n'
2185 returnUnit
2221 returnUnit
2186− | n == tacN "Prim__PatBind", [n] <- args
2222+ | n == tacN "Prim__PatBind"
2223+ = do ~[n] <- tacTmArgs 1 tac args
2187− = do n' <- reifyTTName n
2224+ n' <- reifyTTName n
2188 patbind n'
2225 patbind n'
2189 returnUnit
2226 returnUnit
2190− | n == tacN "Prim__LetBind", [n, ty, tm] <- args
2227+ | n == tacN "Prim__LetBind"
2228+ = do ~[n, ty, tm] <- tacTmArgs 3 tac args
2191− = do n' <- reifyTTName n
2229+ n' <- reifyTTName n
2192 ty' <- reifyRaw ty
2230 ty' <- reifyRaw ty
2193 tm' <- reifyRaw tm
2231 tm' <- reifyRaw tm
2194 letbind n' ty' tm'
2232 letbind n' ty' tm'
2195 returnUnit
2233 returnUnit
2196− | n == tacN "Prim__Compute", [] <- args
2234+ | n == tacN "Prim__Compute"
2197− = do compute ; returnUnit
2235+ = do ~[] <- tacTmArgs 0 tac args; compute ; returnUnit
2198− | n == tacN "Prim__Normalise", [env, tm] <- args
2236+ | n == tacN "Prim__Normalise"
2237+ = do ~[env, tm] <- tacTmArgs 2 tac args
2199− = do env' <- reifyEnv env
2238+ env' <- reifyEnv env
2200 tm' <- reifyTT tm
2239 tm' <- reifyTT tm
2201 ctxt <- get_context
2240 ctxt <- get_context
2202 let out = normaliseAll ctxt env' (finalise tm')
2241 let out = normaliseAll ctxt env' (finalise tm')
2203 fmap fst . checkClosed $ reflect out
2242 fmap fst . checkClosed $ reflect out
2204− | n == tacN "Prim__Whnf", [tm] <- args
2243+ | n == tacN "Prim__Whnf"
2244+ = do ~[tm] <- tacTmArgs 1 tac args
2205− = do tm' <- reifyTT tm
2245+ tm' <- reifyTT tm
2206 ctxt <- get_context
2246 ctxt <- get_context
2207 fmap fst . checkClosed . reflect $ whnf ctxt tm'
2247 fmap fst . checkClosed . reflect $ whnf ctxt tm'
2208− | n == tacN "Prim__Converts", [env, tm1, tm2] <- args
2248+ | n == tacN "Prim__Converts"
2249+ = do ~[env, tm1, tm2] <- tacTmArgs 3 tac args
2209− = do env' <- reifyEnv env
2250+ env' <- reifyEnv env
2210 tm1' <- reifyTT tm1
2251 tm1' <- reifyTT tm1
2211 tm2' <- reifyTT tm2
2252 tm2' <- reifyTT tm2
2212 ctxt <- get_context
2253 ctxt <- get_context
2213 lift $ converts ctxt env' tm1' tm2'
2254 lift $ converts ctxt env' tm1' tm2'
2214 returnUnit
2255 returnUnit
2215− | n == tacN "Prim__DeclareType", [decl] <- args
2256+ | n == tacN "Prim__DeclareType"
2257+ = do ~[decl] <- tacTmArgs 1 tac args
2216− = do (RDeclare n args res) <- reifyTyDecl decl
2258+ (RDeclare n args res) <- reifyTyDecl decl
2217 ctxt <- get_context
2259 ctxt <- get_context
2218 let rty = foldr mkPi res args
2260 let rty = foldr mkPi res args
2219 (checked, ty') <- lift $ check ctxt [] rty
2261 (checked, ty') <- lift $ check ctxt [] rty
@@ -2225,12 +2267,14 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2225 updateAux $ \e -> e { new_tyDecls = (RTyDeclInstrs n fc (map rFunArgToPArg args) checked) :
2267 updateAux $ \e -> e { new_tyDecls = (RTyDeclInstrs n fc (map rFunArgToPArg args) checked) :
2226 new_tyDecls e }
2268 new_tyDecls e }
2227 returnUnit
2269 returnUnit
2228− | n == tacN "Prim__DefineFunction", [decl] <- args
2270+ | n == tacN "Prim__DefineFunction"
2271+ = do ~[decl] <- tacTmArgs 1 tac args
2229− = do defn <- reifyFunDefn decl
2272+ defn <- reifyFunDefn decl
2230 defineFunction defn
2273 defineFunction defn
2231 returnUnit
2274 returnUnit
2232− | n == tacN "Prim__DeclareDatatype", [decl] <- args
2275+ | n == tacN "Prim__DeclareDatatype"
2276+ = do ~[decl] <- tacTmArgs 1 tac args
2233− = do RDeclare n args resTy <- reifyTyDecl decl
2277+ RDeclare n args resTy <- reifyTyDecl decl
2234 ctxt <- get_context
2278 ctxt <- get_context
2235 let tcTy = foldr mkPi resTy args
2279 let tcTy = foldr mkPi resTy args
2236 (checked, ty') <- lift $ check ctxt [] tcTy
2280 (checked, ty') <- lift $ check ctxt [] tcTy
@@ -2240,8 +2284,9 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2240 set_context ctxt'
2284 set_context ctxt'
2241 updateAux $ \e -> e { new_tyDecls = RDatatypeDeclInstrs n (map rFunArgToPArg args) : new_tyDecls e }
2285 updateAux $ \e -> e { new_tyDecls = RDatatypeDeclInstrs n (map rFunArgToPArg args) : new_tyDecls e }
2242 returnUnit
2286 returnUnit
2243− | n == tacN "Prim__DefineDatatype", [defn] <- args
2287+ | n == tacN "Prim__DefineDatatype"
2288+ = do ~[defn] <- tacTmArgs 1 tac args
2244− = do RDefineDatatype n ctors <- reifyRDataDefn defn
2289+ RDefineDatatype n ctors <- reifyRDataDefn defn
2245 ctxt <- get_context
2290 ctxt <- get_context
2246 tyconTy <- case lookupTyExact n ctxt of
2291 tyconTy <- case lookupTyExact n ctxt of
2247 Just t -> return t
2292 Just t -> return t
@@ -2264,24 +2309,28 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2264 -- the rest happens in a bit
2309 -- the rest happens in a bit
2265 updateAux $ \e -> e { new_tyDecls = RDatatypeDefnInstrs n tyconTy ctors' : new_tyDecls e }
2310 updateAux $ \e -> e { new_tyDecls = RDatatypeDefnInstrs n tyconTy ctors' : new_tyDecls e }
2266 returnUnit
2311 returnUnit
2267− | n == tacN "Prim__AddInstance", [cls, inst] <- args
2312+ | n == tacN "Prim__AddInstance"
2313+ = do ~[cls, inst] <- tacTmArgs 2 tac args
2268− = do className <- reifyTTName cls
2314+ className <- reifyTTName cls
2269 instName <- reifyTTName inst
2315 instName <- reifyTTName inst
2270 updateAux $ \e -> e { new_tyDecls = RAddInstance className instName :
2316 updateAux $ \e -> e { new_tyDecls = RAddInstance className instName :
2271 new_tyDecls e }
2317 new_tyDecls e }
2272 returnUnit
2318 returnUnit
2273− | n == tacN "Prim__IsTCName", [n] <- args
2319+ | n == tacN "Prim__IsTCName"
2320+ = do ~[n] <- tacTmArgs 1 tac args
2274− = do n' <- reifyTTName n
2321+ n' <- reifyTTName n
2275 case lookupCtxtExact n' (idris_classes ist) of
2322 case lookupCtxtExact n' (idris_classes ist) of
2276 Just _ -> fmap fst . checkClosed $ Var (sNS (sUN "True") ["Bool", "Prelude"])
2323 Just _ -> fmap fst . checkClosed $ Var (sNS (sUN "True") ["Bool", "Prelude"])
2277 Nothing -> fmap fst . checkClosed $ Var (sNS (sUN "False") ["Bool", "Prelude"])
2324 Nothing -> fmap fst . checkClosed $ Var (sNS (sUN "False") ["Bool", "Prelude"])
2278− | n == tacN "Prim__ResolveTC", [fn] <- args
2325+ | n == tacN "Prim__ResolveTC"
2326+ = do ~[fn] <- tacTmArgs 1 tac args
2279− = do g <- goal
2327+ g <- goal
2280 fn <- reifyTTName fn
2328 fn <- reifyTTName fn
2281 resolveTC' False True 100 g fn ist
2329 resolveTC' False True 100 g fn ist
2282 returnUnit
2330 returnUnit
2283− | n == tacN "Prim__Search", [depth, hints] <- args
2331+ | n == tacN "Prim__Search"
2332+ = do ~[depth, hints] <- tacTmArgs 2 tac args
2284− = do d <- eval depth
2333+ d <- eval depth
2285 hints' <- eval hints
2334 hints' <- eval hints
2286 case (d, unList hints') of
2335 case (d, unList hints') of
2287 (Constant (I i), Just hs) ->
2336 (Constant (I i), Just hs) ->
@@ -2293,8 +2342,9 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2293 (Constant (I _), Nothing ) ->
2342 (Constant (I _), Nothing ) ->
2294 lift . tfail . InternalMsg $ "Not a list: " ++ show hints'
2343 lift . tfail . InternalMsg $ "Not a list: " ++ show hints'
2295 (_, _) -> lift . tfail . InternalMsg $ "Can't reify int " ++ show d
2344 (_, _) -> lift . tfail . InternalMsg $ "Can't reify int " ++ show d
2296− | n == tacN "Prim__RecursiveElab", [goal, script] <- args
2345+ | n == tacN "Prim__RecursiveElab"
2346+ = do ~[goal, script] <- tacTmArgs 2 tac args
2297− = do goal' <- reifyRaw goal
2347+ goal' <- reifyRaw goal
2298 ctxt <- get_context
2348 ctxt <- get_context
2299 script <- eval script
2349 script <- eval script
2300 (goalTT, goalTy) <- lift $ check ctxt [] goal'
2350 (goalTT, goalTy) <- lift $ check ctxt [] goal'
@@ -2327,8 +2377,9 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2327 fmap fst . checkClosed $
2377 fmap fst . checkClosed $
2328 rawPair (Var $ reflm "TT", Var $ reflm "TT")
2378 rawPair (Var $ reflm "TT", Var $ reflm "TT")
2329 (tm', ty')
2379 (tm', ty')
2330− | n == tacN "Prim__Metavar", [n] <- args
2380+ | n == tacN "Prim__Metavar"
2381+ = do ~[n] <- tacTmArgs 1 tac args
2331− = do n' <- reifyTTName n
2382+ n' <- reifyTTName n
2332 ctxt <- get_context
2383 ctxt <- get_context
2333 ptm <- get_term
2384 ptm <- get_term
2334 -- See documentation above in the elab case for PMetavar
2385 -- See documentation above in the elab case for PMetavar
@@ -2338,8 +2389,9 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2338 defer unique_used mvn
2389 defer unique_used mvn
2340 returnUnit
2391 returnUnit
2341− | n == tacN "Prim__Fixity", [op'] <- args
2392+ | n == tacN "Prim__Fixity"
2393+ = do ~[op'] <- tacTmArgs 1 tac args
2342− = do opTm <- eval op'
2394+ opTm <- eval op'
2343 case opTm of
2395 case opTm of
2344 Constant (Str op) ->
2396 Constant (Str op) ->
2345 let opChars = ":!#$%&*+./<=>?@\\^|-~"
2397 let opChars = ":!#$%&*+./<=>?@\\^|-~"
@@ -2352,11 +2404,12 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
2352 [f] -> fmap fst . checkClosed $ reflectFixity f
2404 [f] -> fmap fst . checkClosed $ reflectFixity f
2353 many -> lift . tfail . InternalMsg $ "Ambiguous fixity for '" ++ op ++ "'! Found " ++ show many
2405 many -> lift . tfail . InternalMsg $ "Ambiguous fixity for '" ++ op ++ "'! Found " ++ show many
2354 _ -> lift . tfail . Msg $ "Not a constant string for an operator name: " ++ show opTm
2406 _ -> lift . tfail . Msg $ "Not a constant string for an operator name: " ++ show opTm
2355− | n == tacN "Prim__Debug", [ty, msg] <- args
2407+ | n == tacN "Prim__Debug"
2408+ = do ~[ty, msg] <- tacTmArgs 2 tac args
2356− = do msg' <- eval msg
2409+ msg' <- eval msg
2357 parts <- reifyReportParts msg
2410 parts <- reifyReportParts msg
2358 debugElaborator parts
2411 debugElaborator parts
2359− runTacTm x = lift . tfail $ ElabScriptStuck x
2412+ runTacTm x = elabScriptStuck x
2361-- Running tactics directly
2414-- Running tactics directly
2362-- if a tactic adds unification problems, return an error
2415-- if a tactic adds unification problems, return an error