Skip to content

Commit a67792e

Browse files
author
DeviousStoat
committed
Rename tyThingToType
1 parent f4393e6 commit a67792e

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
@@ -315,16 +315,18 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
315315
where
316316
instancesForName :: IO (Maybe [ClsInst])
317317
instancesForName = runMaybeT $ do
318-
typ <- MaybeT . pure $ lookupNameEnv km n >>= tyThingToType
318+
typ <- MaybeT . pure $ lookupNameEnv km n >>= tyThingAsDataType
319319
liftIO $ evalGhcEnv env $ getInstancesForType typ
320320

321-
tyThingToType :: TyThing -> Maybe Type
322-
tyThingToType (AnId _) = Nothing
323-
tyThingToType (ACoAxiom _) = Nothing
324-
tyThingToType (AConLike cl) = case cl of
321+
-- | Gets the datatype `Type` corresponding to a TyThing, if it repressents a datatype or
322+
-- a data constructor.
323+
tyThingAsDataType :: TyThing -> Maybe Type
324+
tyThingAsDataType (AnId _) = Nothing
325+
tyThingAsDataType (ACoAxiom _) = Nothing
326+
tyThingAsDataType (AConLike cl) = case cl of
325327
PatSynCon _ -> Nothing
326328
RealDataCon dc -> Just $ mkTyConTy $ dataConTyCon dc
327-
tyThingToType (ATyCon tc) = Just $ mkTyConTy tc
329+
tyThingAsDataType (ATyCon tc) = Just $ mkTyConTy tc
328330
prettyInstances (Left _, _) = pure Nothing
329331

330332
typeLocationsAtPoint

0 commit comments

Comments
 (0)