@@ -245,7 +245,7 @@ elab :: IState
245elab ist info emode opts fn tm
245elab ist info emode opts fn tm
246 = do let loglvl = opt_logLevel (idris_options ist)
246 = do let loglvl = opt_logLevel (idris_options ist)
247 when (loglvl > 5) $ unifyLog True
247 when (loglvl > 5) $ unifyLog True
248− compute -- expand type synonyms, etc
248+ whnf_compute_args -- expand type synonyms, etc
249 let fc = maybe "(unknown)"
249 let fc = maybe "(unknown)"
250 elabE initElabCtxt (elabFC info) tm -- (in argument, guarded, in type, in qquote)
250 elabE initElabCtxt (elabFC info) tm -- (in argument, guarded, in type, in qquote)
251 est <- getAux
251 est <- getAux
@@ -387,7 +387,7 @@ elab ist info emode opts fn tm
387 highlightSource fc' (AnnConst c)
387 highlightSource fc' (AnnConst c)
388 elab' ina fc (PQuote r) = do fill r; solve
388 elab' ina fc (PQuote r) = do fill r; solve
389 elab' ina _ (PTrue fc _) =
389 elab' ina _ (PTrue fc _) =
390− do compute
390+ do whnf_compute
391 g <- goal
391 g <- goal
392 case g of
392 case g of
393 TType _ -> elab' ina (Just fc) (PRef fc [] unitTy)
393 TType _ -> elab' ina (Just fc) (PRef fc [] unitTy)
@@ -421,7 +421,7 @@ elab ist info emode opts fn tm
421 pexp l, pexp r]))
421 pexp l, pexp r]))
423 elab' ina _ (PPair fc hls _ l r)
423 elab' ina _ (PPair fc hls _ l r)
424− = do compute
424+ = do whnf_compute
425 g <- goal
425 g <- goal
426 let (tc, _) = unApply g
426 let (tc, _) = unApply g
427 case g of
427 case g of
@@ -444,7 +444,7 @@ elab ist info emode opts fn tm
444 IsType -> asType
444 IsType -> asType
445 IsTerm -> asValue
445 IsTerm -> asValue
446 TypeOrTerm ->
446 TypeOrTerm ->
447− do compute
447+ do whnf_compute
448 g <- goal
448 g <- goal
449 case g of
449 case g of
450 TType _ -> asType
450 TType _ -> asType
@@ -502,7 +502,7 @@ elab ist info emode opts fn tm
502 ty <- goal
502 ty <- goal
503 ctxt <- get_context
503 ctxt <- get_context
504 env <- get_env
504 env <- get_env
505− let ty' = unDelay ty
505+ let ty' = normalise ctxt env (unDelay ty)
506 let (tc, _) = unApply ty'
506 let (tc, _) = unApply ty'
507 return $ pruneByType env tc ty' ist as
507 return $ pruneByType env tc ty' ist as
@@ -534,7 +534,7 @@ elab ist info emode opts fn tm
534 (trySeq' deferr xs) True
534 (trySeq' deferr xs) True
535 elab' ina fc (PAlternative ms TryImplicit (orig : alts)) = do
535 elab' ina fc (PAlternative ms TryImplicit (orig : alts)) = do
536 env <- get_env
536 env <- get_env
537− compute
537+ whnf_compute
538 ty <- goal
538 ty <- goal
539 let doelab = elab' ina fc orig
539 let doelab = elab' ina fc orig
540 tryCatch doelab
540 tryCatch doelab
@@ -658,7 +658,7 @@ elab ist info emode opts fn tm
658 do fty <- get_type (Var n) -- check for implicits
658 do fty <- get_type (Var n) -- check for implicits
659 ctxt <- get_context
659 ctxt <- get_context
660 env <- get_env
660 env <- get_env
661− let a' = insertScopedImps fc (normalise ctxt env fty) []
661+ let a' = insertScopedImps fc (whnfArgs ctxt env fty) []
662 if null a'
662 if null a'
663 then erun fc $
663 then erun fc $
664 do apply (Var n) []
664 do apply (Var n) []