@@ -18,17 +18,17 @@ ermod = sNS (sUN "Error") ["Providers"]
1818prmod = sNS (sUN "Provide") ["Providers"]
1919
2020-- | Handle an error, if the type provider returned an error. Otherwise return the provided term.
21−getProvided :: TT Name -> Idris (TT Name)
22−getProvided tm | (P _ pioret _, [tp, result]) <- unApply tm
23− , (P _ nm _, [_, err]) <- unApply result
24− , pioret == ioret && nm == ermod
25− = case err of
26− Constant (Str msg) -> ierror . ProviderError $ msg
27− _ -> ifail "Internal error in type provider, non-normalised error"
28− | (P _ pioret _, [tp, result]) <- unApply tm
29− , (P _ nm _, [_, res]) <- unApply result
30− , pioret == ioret && nm == prmod
31− = return res
32− | otherwise = ifail $ "Internal type provider error: result was not " ++
33− "IO (Provider a), or perhaps missing normalisation."
21+getProvided :: FC -> TT Name -> Idris (TT Name)
22+getProvided fc tm | (P _ pioret _, [tp, result]) <- unApply tm
23+ , (P _ nm _, [_, err]) <- unApply result
24+ , pioret == ioret && nm == ermod
25+ = case err of
26+ Constant (Str msg) -> ierror . At fc . ProviderError $ msg
27+ _ -> ifail "Internal error in type provider, non-normalised error"
28+ | (P _ pioret _, [tp, result]) <- unApply tm
29+ , (P _ nm _, [_, res]) <- unApply result
30+ , pioret == ioret && nm == prmod
31+ = return res
32+ | otherwise = ifail $ "Internal type provider error: result was not " ++
33+ "IO (Provider a), or perhaps missing normalisation."
3434