Skip to content

Commit 2f54c85

Browse files
committed
Revert http-client-0.5 change
1 parent 08355da commit 2f54c85

File tree

3 files changed

+26
-31
lines changed

3 files changed

+26
-31
lines changed

purescript.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ library
119119
fsnotify >= 0.2.1,
120120
Glob >= 0.7 && < 0.8,
121121
haskeline >= 0.7.0.0,
122-
http-client >= 0.4.30 && <0.6,
122+
http-client >= 0.4.30 && <0.5,
123123
http-types -any,
124124
language-javascript == 0.6.*,
125125
lifted-base >= 0.2.3 && < 0.2.4,

src/Language/PureScript/Ide/Pursuit.hs

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,37 +35,41 @@ import qualified Pipes.Prelude as P
3535
-- TODO: remove this when the issue is fixed at Pursuit
3636
queryPursuit :: Text -> IO ByteString
3737
queryPursuit q = do
38-
let qClean = T.dropWhileEnd (== '.') q
39-
req' <- parseRequest "http://pursuit.purescript.org/search"
40-
let req = req'
41-
{ queryString= "q=" <> (fromString . T.unpack) qClean
42-
, requestHeaders=[(hAccept, "application/json")]
43-
}
44-
m <- newManager tlsManagerSettings
45-
withHTTP req m $ \resp ->
46-
P.fold (<>) "" identity (responseBody resp)
38+
let qClean = T.dropWhileEnd (== '.') q
39+
req' <- parseRequest "http://pursuit.purescript.org/search"
40+
let req = req'
41+
{ queryString= "q=" <> (fromString . T.unpack) qClean
42+
, requestHeaders=[(hAccept, "application/json")]
43+
}
44+
m <- newManager tlsManagerSettings
45+
withHTTP req m $ \resp ->
46+
P.fold (<>) "" identity (responseBody resp)
47+
4748

4849
handler :: HttpException -> IO [a]
50+
handler StatusCodeException{} = pure []
4951
handler _ = pure []
5052

5153
searchPursuitForDeclarations :: Text -> IO [PursuitResponse]
52-
searchPursuitForDeclarations query = E.handle handler $ do
53-
r <- queryPursuit query
54-
let results' = decode (fromStrict r) :: Maybe Array
55-
case results' of
56-
Nothing -> pure []
57-
Just results -> pure (mapMaybe (isDeclarationResponse . fromJSON) (toList results))
54+
searchPursuitForDeclarations query =
55+
(do r <- queryPursuit query
56+
let results' = decode (fromStrict r) :: Maybe Array
57+
case results' of
58+
Nothing -> pure []
59+
Just results -> pure (mapMaybe (isDeclarationResponse . fromJSON) (toList results))) `E.catch`
60+
handler
5861
where
5962
isDeclarationResponse (Success a@DeclarationResponse{}) = Just a
6063
isDeclarationResponse _ = Nothing
6164

6265
findPackagesForModuleIdent :: Text -> IO [PursuitResponse]
63-
findPackagesForModuleIdent query = E.handle handler $ do
64-
r <- queryPursuit query
65-
let results' = decode (fromStrict r) :: Maybe Array
66-
case results' of
66+
findPackagesForModuleIdent query =
67+
(do r <- queryPursuit query
68+
let results' = decode (fromStrict r) :: Maybe Array
69+
case results' of
6770
Nothing -> pure []
68-
Just results -> pure (mapMaybe (isModuleResponse . fromJSON) (toList results))
71+
Just results -> pure (mapMaybe (isModuleResponse . fromJSON) (toList results))) `E.catch`
72+
handler
6973
where
7074
isModuleResponse (Success a@ModuleResponse{}) = Just a
7175
isModuleResponse _ = Nothing

stack.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
resolver: lts-6.13
1+
resolver: lts-6.10
22
packages:
33
- '.'
4-
extra-deps:
5-
# - aeson-1.0.0.0
6-
- http-client-0.5.1
7-
- http-client-tls-0.3.0
8-
- pipes-http-1.0.4
9-
# - semigroups-0.18.2
10-
# flags:
11-
# semigroups:
12-
# bytestring-builder: false

0 commit comments

Comments
 (0)