@@ -626,8 +626,8 @@ elabPrims = do mapM_ (elabDecl EAll toplevel)
626626
627627
628628-- | Elaborate a type provider
629−elabProvider :: ElabInfo -> SyntaxInfo -> FC -> Name -> PTerm -> PTerm -> Idris ()
630−elabProvider info syn fc n ty tm
629+elabProvider :: ElabInfo -> SyntaxInfo -> FC -> ProvideWhat -> Name -> PTerm -> PTerm -> Idris ()
630+elabProvider info syn fc what n ty tm
631631 = do i <- getIState
632632 -- Ensure that the experimental extension is enabled
633633 unless (TypeProviders `elem` idris_language_extensions i) $
@@ -659,15 +659,21 @@ elabProvider info syn fc n ty tm
659659 provided <- getProvided fc rhs'
660660
661661 case provided of
662− Provide tm ->
663− do -- Finally add a top-level definition of the provided term
664− elabType info syn "" fc [] n ty
665− 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− Postulate ->
668− do -- Add the postulate
669− elabPostulate info syn "Provided postulate" fc [] n ty
670− logLvl 1 $ "Elaborated provided postulate " ++ show n
662+ Provide tm
663+ | what `elem` [ProvTerm, ProvAny] ->
664+ do -- Finally add a top-level definition of the provided term
665+ elabType info syn "" fc [] n ty
666+ elabClauses info fc [] n [PClause fc n (PApp fc (PRef fc n) []) [] (delab i tm) []]
667+ logLvl 1 $ "Elaborated provider " ++ show n ++ " as: " ++ show tm
668+ | otherwise ->
669+ ierror . Msg $ "Attempted to provide a term where a postulate was expected."
670+ Postulate
671+ | what `elem` [ProvPostulate, ProvAny] ->
672+ do -- Add the postulate
673+ elabPostulate info syn "Provided postulate" fc [] n ty
674+ logLvl 1 $ "Elaborated provided postulate " ++ show n
675+ | otherwise ->
676+ ierror . Msg $ "Attempted to provide a postulate where a term was expected."
671677
672678 where isTType :: TT Name -> Bool
673679 isTType (TType _) = True
@@ -2228,10 +2234,10 @@ elabDecl' _ info (PDSL n dsl)
22282234 addIBC (IBCDSL n)
22292235elabDecl' what info (PDirective i)
22302236 | what /= EDefns = i
2231−elabDecl' what info (PProvider syn fc n tp tm)
2237+elabDecl' what info (PProvider syn fc provWhat n tp tm)
22322238 | what /= EDefns
22332239 = do iLOG $ "Elaborating type provider " ++ show n
2234− elabProvider info syn fc n tp tm
2240+ elabProvider info syn fc provWhat n tp tm
22352241elabDecl' what info (PTransform fc safety old new)
22362242 = elabTransform info fc safety old new
22372243elabDecl' _ _ _ = return () -- skipped this time