File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
ghcide/src/Development/IDE/Spans Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -317,16 +317,18 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
317
317
where
318
318
instancesForName :: IO (Maybe [ClsInst ])
319
319
instancesForName = runMaybeT $ do
320
- typ <- MaybeT . pure $ lookupNameEnv km n >>= tyThingToType
320
+ typ <- MaybeT . pure $ lookupNameEnv km n >>= tyThingAsDataType
321
321
liftIO $ evalGhcEnv env $ getInstancesForType typ
322
322
323
- tyThingToType :: TyThing -> Maybe Type
324
- tyThingToType (AnId _) = Nothing
325
- tyThingToType (ACoAxiom _) = Nothing
326
- tyThingToType (AConLike cl) = case cl of
323
+ -- | Gets the datatype `Type` corresponding to a TyThing, if it repressents a datatype or
324
+ -- a data constructor.
325
+ tyThingAsDataType :: TyThing -> Maybe Type
326
+ tyThingAsDataType (AnId _) = Nothing
327
+ tyThingAsDataType (ACoAxiom _) = Nothing
328
+ tyThingAsDataType (AConLike cl) = case cl of
327
329
PatSynCon _ -> Nothing
328
330
RealDataCon dc -> Just $ mkTyConTy $ dataConTyCon dc
329
- tyThingToType (ATyCon tc) = Just $ mkTyConTy tc
331
+ tyThingAsDataType (ATyCon tc) = Just $ mkTyConTy tc
330
332
prettyInstances (Left _, _) = pure Nothing
331
333
332
334
typeLocationsAtPoint
You can’t perform that action at this time.
0 commit comments