@@ -20,6 +20,7 @@ import Control.Applicative hiding (Const)
20import Control.Monad.State -- not Strict!
20import Control.Monad.State -- not Strict!
21import qualified Data.Binary as B
21import qualified Data.Binary as B
22import Data.Binary hiding (get, put)
22import Data.Binary hiding (get, put)
23+import Data.Maybe (listToMaybe)
24import Idris.Core.TT
25import Idris.Core.TT
25import Idris.Core.CaseTree
26import Idris.Core.CaseTree
@@ -952,9 +953,7 @@ lookupTyName n ctxt = do
953-- | Get the pair of a fully-qualified name and its type, if there is a unique one matching the name used as a key.
954-- | Get the pair of a fully-qualified name and its type, if there is a unique one matching the name used as a key.
954lookupTyNameExact :: Name -> Context -> Maybe (Name, Type)
955lookupTyNameExact :: Name -> Context -> Maybe (Name, Type)
955−lookupTyNameExact n ctxt = case lookupTyName n ctxt of
956+lookupTyNameExact n ctxt = listToMaybe [ (nm, v) | (nm, v) <- lookupTyName n ctxt, nm == n ]
959-- | Get the types that match some name
958-- | Get the types that match some name
960lookupTy :: Name -> Context -> [Type]
959lookupTy :: Name -> Context -> [Type]
@@ -962,9 +961,7 @@ lookupTy n ctxt = map snd (lookupTyName n ctxt)
963-- | Get the single type that matches some name precisely
962-- | Get the single type that matches some name precisely
964lookupTyExact :: Name -> Context -> Maybe Type
963lookupTyExact :: Name -> Context -> Maybe Type
965−lookupTyExact n ctxt = case lookupTy n ctxt of
964+lookupTyExact n ctxt = fmap snd (lookupTyNameExact n ctxt)
969isConName :: Name -> Context -> Bool
966isConName :: Name -> Context -> Bool
970isConName n ctxt = isTConName n ctxt || isDConName n ctxt
967isConName n ctxt = isTConName n ctxt || isDConName n ctxt