@@ -11,7 +11,7 @@ module Idris.Core.Evaluate(normalise, normaliseTrace, normaliseC, normaliseAll,
1111 lookupNames, lookupTyName, lookupTyNameExact, lookupTy, lookupTyExact,
1212 lookupP, lookupDef, lookupNameDef, lookupDefExact, lookupDefAcc, lookupDefAccExact, lookupVal,
1313 mapDefCtxt,
14− lookupTotal, lookupNameTotal, lookupMetaInformation, lookupTyEnv, isTCDict, isDConName, isTConName, isConName, isFnName,
14+ lookupTotal, lookupNameTotal, lookupMetaInformation, lookupTyEnv, isTCDict, isDConName, canBeDConName, isTConName, isConName, isFnName,
1515 Value(..), Quote(..), initEval, uniqueNameCtxt, uniqueBindersCtxt, definitions,
1616 isUniverse) where
1717
@@ -975,12 +975,21 @@ isTConName n ctxt
975975 Just (TyDecl (TCon _ _) _) -> True
976976 _ -> False
977977
978+-- | Check whether a resolved name is certainly a data constructor
978979isDConName :: Name -> Context -> Bool
979980isDConName n ctxt
980981 = case lookupDefExact n ctxt of
981982 Just (TyDecl (DCon _ _ _) _) -> True
982983 _ -> False
983984
985+-- | Check whether any overloading of a name is a data constructor
986+canBeDConName :: Name -> Context -> Bool
987+canBeDConName n ctxt
988+ = or $ do def <- lookupCtxt n (definitions ctxt)
989+ case tfst def of
990+ (TyDecl (DCon _ _ _) _) -> return True
991+ _ -> return False
992+
984993isFnName :: Name -> Context -> Bool
985994isFnName n ctxt
986995 = case lookupDefExact n ctxt of