on master help sign in
Ignore default class methods in :search
f91051abmsherman
src/Idris/TypeSearch.hs+4−1
@@ -14,6 +14,7 @@ import Data.Maybe (catMaybes, fromMaybe, isJust)
14import Data.Monoid (Monoid (mempty, mappend))
14import Data.Monoid (Monoid (mempty, mappend))
15import Data.Set (Set)
15import Data.Set (Set)
16import qualified Data.Set as S
16import qualified Data.Set as S
17+import qualified Data.Text as T (pack, isPrefixOf)
17
18
18import Idris.AbsSyntax (addUsingConstraints, addImpl, getContext, getIState, putIState, implicit)
19import Idris.AbsSyntax (addUsingConstraints, addImpl, getContext, getIState, putIState, implicit)
19import Idris.AbsSyntaxTree (class_instances, defaultSyntax, Idris,
20import Idris.AbsSyntaxTree (class_instances, defaultSyntax, Idris,
@@ -76,7 +77,9 @@ searchUsing pred istate ty =
76 get (CaseOp _ ty _ _ _ _) = Just ty
77 get (CaseOp _ ty _ _ _ _) = Just ty
77 get _ = Nothing
78 get _ = Nothing
78 special :: Name -> Bool
79 special :: Name -> Bool
80+ special (NS n ns) = special n
79 special (SN _) = True
81 special (SN _) = True
82+ special (UN n) = T.pack "default#" `T.isPrefixOf` n
80 special _ = False
83 special _ = False
81
84
82-- Our default search predicate.
85-- Our default search predicate.
@@ -181,7 +184,7 @@ data State = State
181 , args1 :: !ArgsDAG -- ^ arguments for the left type which have yet to be resolved
184 , args1 :: !ArgsDAG -- ^ arguments for the left type which have yet to be resolved
182 , args2 :: !ArgsDAG -- ^ arguments for the right type which have yet to be resolved
185 , args2 :: !ArgsDAG -- ^ arguments for the right type which have yet to be resolved
183 , classes1 :: ![(Name, Type)] -- ^ typeclass arguments for the left type which haven't been resolved
186 , classes1 :: ![(Name, Type)] -- ^ typeclass arguments for the left type which haven't been resolved
184− , classes2 :: ![(Name, Type)] -- & typeclass arguments for the right type which haven't been resolved
187+ , classes2 :: ![(Name, Type)] -- ^ typeclass arguments for the right type which haven't been resolved
185 , score :: !Score -- ^ the score so far
188 , score :: !Score -- ^ the score so far
186 , usedNames :: ![Name] -- ^ all names that have been used
189 , usedNames :: ![Name] -- ^ all names that have been used
187 } deriving Show
190 } deriving Show