Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 00a101d

Browse files
committed
Add comment
1 parent 678a327 commit 00a101d

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

hie-plugin-api/Haskell/Ide/Engine/TypeMap.hs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ import qualified Desugar
2323

2424
import Haskell.Ide.Engine.ArtifactMap
2525

26+
-- | Generate a mapping from an Interval to types.
27+
-- Intervals may overlap and return more specific results.
2628
genTypeMap :: GHC.GhcMonad m => TypecheckedModule -> m TypeMap
2729
genTypeMap tm = do
2830
let typecheckedSource = GHC.tm_typechecked_source tm
29-
hs_env <- GHC.getSession
31+
hs_env <- GHC.getSession
3032
liftIO $ types hs_env typecheckedSource
3133

3234
collectAllSpansTypes'
@@ -40,8 +42,8 @@ types hs_env = everythingInTypecheckedSourceM (ty `combineM` fun)
4042
ty :: forall a . Data a => a -> IO TypeMap
4143
ty term = case cast term of
4244
(Just lhsExprGhc@(GHC.L (GHC.RealSrcSpan spn) _)) ->
43-
getType hs_env lhsExprGhc >>= \case
44-
Nothing -> return IM.empty
45+
getType hs_env lhsExprGhc >>= \case
46+
Nothing -> return IM.empty
4547
Just (_, typ) -> return (IM.singleton (rspToInt spn) typ)
4648
_ -> return IM.empty
4749

@@ -53,18 +55,15 @@ types hs_env = everythingInTypecheckedSourceM (ty `combineM` fun)
5355

5456

5557
everythingInTypecheckedSourceM
56-
:: Data x
57-
=> (forall a . Data a => a -> IO TypeMap)
58-
-> x
59-
-> IO TypeMap
58+
:: Data x => (forall a . Data a => a -> IO TypeMap) -> x -> IO TypeMap
6059
everythingInTypecheckedSourceM f = everythingButTypeM @GHC.Id f
6160

6261
-- | Combine two queries into one using alternative combinator.
6362
combineM
64-
:: (forall a. Data a => a -> IO TypeMap)
65-
-> (forall a. Data a => a -> IO TypeMap)
66-
-> (forall a. Data a => a -> IO TypeMap)
67-
combineM f g x = do
63+
:: (forall a . Data a => a -> IO TypeMap)
64+
-> (forall a . Data a => a -> IO TypeMap)
65+
-> (forall a . Data a => a -> IO TypeMap)
66+
combineM f g x = do
6867
a <- f x
6968
b <- g x
7069
return (a `IM.union` b)

0 commit comments

Comments
 (0)