Skip to content

Commit 1ef4430

Browse files
author
DeviousStoat
committed
Rename tyThingToType
1 parent 0b2b639 commit 1ef4430

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ghcide/src/Development/IDE/Spans/AtPoint.hs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,16 +317,18 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
317317
where
318318
instancesForName :: IO (Maybe [ClsInst])
319319
instancesForName = runMaybeT $ do
320-
typ <- MaybeT . pure $ lookupNameEnv km n >>= tyThingToType
320+
typ <- MaybeT . pure $ lookupNameEnv km n >>= tyThingAsDataType
321321
liftIO $ evalGhcEnv env $ getInstancesForType typ
322322

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
327329
PatSynCon _ -> Nothing
328330
RealDataCon dc -> Just $ mkTyConTy $ dataConTyCon dc
329-
tyThingToType (ATyCon tc) = Just $ mkTyConTy tc
331+
tyThingAsDataType (ATyCon tc) = Just $ mkTyConTy tc
330332
prettyInstances (Left _, _) = pure Nothing
331333

332334
typeLocationsAtPoint

0 commit comments

Comments
 (0)