@@ -626,8 +626,8 @@ elabPrims = do mapM_ (elabDecl EAll toplevel)
628-- | Elaborate a type provider
628-- | Elaborate a type provider
629−elabProvider :: ElabInfo -> SyntaxInfo -> FC -> Name -> PTerm -> PTerm -> Idris ()
629+elabProvider :: ElabInfo -> SyntaxInfo -> FC -> ProvideWhat -> Name -> PTerm -> PTerm -> Idris ()
630−elabProvider info syn fc n ty tm
630+elabProvider info syn fc what n ty tm
631 = do i <- getIState
631 = do i <- getIState
632 -- Ensure that the experimental extension is enabled
632 -- Ensure that the experimental extension is enabled
633 unless (TypeProviders `elem` idris_language_extensions i) $
633 unless (TypeProviders `elem` idris_language_extensions i) $
@@ -659,15 +659,21 @@ elabProvider info syn fc n ty tm
659 provided <- getProvided fc rhs'
659 provided <- getProvided fc rhs'
661 case provided of
661 case provided of
662− Provide tm ->
662+ Provide tm
663+ | what `elem` [ProvTerm, ProvAny] ->
663− do -- Finally add a top-level definition of the provided term
664+ do -- Finally add a top-level definition of the provided term
664− elabType info syn "" fc [] n ty
665+ elabType info syn "" fc [] n ty
665− elabClauses info fc [] n [PClause fc n (PApp fc (PRef fc n) []) [] (delab i tm) []]
666+ elabClauses info fc [] n [PClause fc n (PApp fc (PRef fc n) []) [] (delab i tm) []]
666− logLvl 1 $ "Elaborated provider " ++ show n ++ " as: " ++ show tm
667+ logLvl 1 $ "Elaborated provider " ++ show n ++ " as: " ++ show tm
669+ ierror . Msg $ "Attempted to provide a term where a postulate was expected."
667− Postulate ->
670+ Postulate
671+ | what `elem` [ProvPostulate, ProvAny] ->
668− do -- Add the postulate
672+ do -- Add the postulate
669− elabPostulate info syn "Provided postulate" fc [] n ty
673+ elabPostulate info syn "Provided postulate" fc [] n ty
670− logLvl 1 $ "Elaborated provided postulate " ++ show n
674+ logLvl 1 $ "Elaborated provided postulate " ++ show n
676+ ierror . Msg $ "Attempted to provide a postulate where a term was expected."
672 where isTType :: TT Name -> Bool
678 where isTType :: TT Name -> Bool
673 isTType (TType _) = True
679 isTType (TType _) = True
@@ -2228,10 +2234,10 @@ elabDecl' _ info (PDSL n dsl)
2228 addIBC (IBCDSL n)
2234 addIBC (IBCDSL n)
2229elabDecl' what info (PDirective i)
2235elabDecl' what info (PDirective i)
2230 | what /= EDefns = i
2236 | what /= EDefns = i
2231−elabDecl' what info (PProvider syn fc n tp tm)
2237+elabDecl' what info (PProvider syn fc provWhat n tp tm)
2232 | what /= EDefns
2238 | what /= EDefns
2233 = do iLOG $ "Elaborating type provider " ++ show n
2239 = do iLOG $ "Elaborating type provider " ++ show n
2234− elabProvider info syn fc n tp tm
2240+ elabProvider info syn fc provWhat n tp tm
2235elabDecl' what info (PTransform fc safety old new)
2241elabDecl' what info (PTransform fc safety old new)
2236 = elabTransform info fc safety old new
2242 = elabTransform info fc safety old new
2237elabDecl' _ _ _ = return () -- skipped this time
2243elabDecl' _ _ _ = return () -- skipped this time