This repository was archived by the owner on Oct 7, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
src/Haskell/Ide/Engine/Plugin Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change 1
1
{-# LANGUAGE TupleSections #-}
2
+ {-# LANGUAGE LambdaCase #-}
2
3
{-# LANGUAGE CPP #-}
3
4
{-# LANGUAGE OverloadedStrings #-}
4
5
module Haskell.Ide.Engine.Plugin.Hoogle where
@@ -99,11 +100,9 @@ infoCmd = CmdSync $ \expr -> do
99
100
infoCmd' :: T. Text -> IdeM (Either HoogleError T. Text )
100
101
infoCmd' expr = do
101
102
HoogleDb mdb <- get
102
- liftIO $ runHoogleQuery mdb expr $ \ res ->
103
- if null res then
104
- Left NoResults
105
- else
106
- return $ renderTargetInfo $ head res
103
+ liftIO $ runHoogleQuery mdb expr $ \ case
104
+ [] -> Left NoResults
105
+ h: _ -> return $ renderTargetInfo h
107
106
108
107
renderTargetInfo :: Target -> T. Text
109
108
renderTargetInfo t =
@@ -124,11 +123,9 @@ renderTargetInfo t =
124
123
infoCmdFancyRender :: T. Text -> IdeM (Either HoogleError T. Text )
125
124
infoCmdFancyRender expr = do
126
125
HoogleDb mdb <- get
127
- liftIO $ runHoogleQuery mdb expr $ \ res ->
128
- if null res then
129
- Left NoResults
130
- else
131
- return $ renderTarget $ head res
126
+ liftIO $ runHoogleQuery mdb expr $ \ case
127
+ [] -> Left NoResults
128
+ h: _ -> return $ renderTarget h
132
129
133
130
-- | Render the target in valid markdown.
134
131
-- Transform haddock documentation into markdown.
You can’t perform that action at this time.
0 commit comments