git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #2365 from purescript/revert-http-client
7894cadPhil Freeman
purescript.cabal+1−1
@@ -119,7 +119,7 @@ library
119 fsnotify >= 0.2.1,
119 fsnotify >= 0.2.1,
120 Glob >= 0.7 && < 0.8,
120 Glob >= 0.7 && < 0.8,
121 haskeline >= 0.7.0.0,
121 haskeline >= 0.7.0.0,
122− http-client >= 0.4.30 && <0.6,
122+ http-client >= 0.4.30 && <0.5,
123 http-types -any,
123 http-types -any,
124 language-javascript == 0.6.*,
124 language-javascript == 0.6.*,
125 lifted-base >= 0.2.3 && < 0.2.4,
125 lifted-base >= 0.2.3 && < 0.2.4,
src/Language/PureScript/Ide/Pursuit.hs+24−20
@@ -35,37 +35,41 @@ import qualified Pipes.Prelude as P
35-- TODO: remove this when the issue is fixed at Pursuit
35-- TODO: remove this when the issue is fixed at Pursuit
36queryPursuit :: Text -> IO ByteString
36queryPursuit :: Text -> IO ByteString
37queryPursuit q = do
37queryPursuit q = do
38− let qClean = T.dropWhileEnd (== '.') q
38+ let qClean = T.dropWhileEnd (== '.') q
39− req' <- parseRequest "http://pursuit.purescript.org/search"
39+ req' <- parseRequest "http://pursuit.purescript.org/search"
40− let req = req'
40+ let req = req'
41− { queryString= "q=" <> (fromString . T.unpack) qClean
41+ { queryString= "q=" <> (fromString . T.unpack) qClean
42− , requestHeaders=[(hAccept, "application/json")]
42+ , requestHeaders=[(hAccept, "application/json")]
43− }
43+ }
44− m <- newManager tlsManagerSettings
44+ m <- newManager tlsManagerSettings
45− withHTTP req m $ \resp ->
45+ withHTTP req m $ \resp ->
46− P.fold (<>) "" identity (responseBody resp)
46+ P.fold (<>) "" identity (responseBody resp)
47+
47
48
48handler :: HttpException -> IO [a]
49handler :: HttpException -> IO [a]
50+handler StatusCodeException{} = pure []
49handler _ = pure []
51handler _ = pure []
50
52
51searchPursuitForDeclarations :: Text -> IO [PursuitResponse]
53searchPursuitForDeclarations :: Text -> IO [PursuitResponse]
52−searchPursuitForDeclarations query = E.handle handler $ do
54+searchPursuitForDeclarations query =
53− r <- queryPursuit query
55+ (do r <- queryPursuit query
54− let results' = decode (fromStrict r) :: Maybe Array
56+ let results' = decode (fromStrict r) :: Maybe Array
55− case results' of
57+ case results' of
56− Nothing -> pure []
58+ Nothing -> pure []
57− Just results -> pure (mapMaybe (isDeclarationResponse . fromJSON) (toList results))
59+ Just results -> pure (mapMaybe (isDeclarationResponse . fromJSON) (toList results))) `E.catch`
60+ handler
58 where
61 where
59 isDeclarationResponse (Success a@DeclarationResponse{}) = Just a
62 isDeclarationResponse (Success a@DeclarationResponse{}) = Just a
60 isDeclarationResponse _ = Nothing
63 isDeclarationResponse _ = Nothing
61
64
62findPackagesForModuleIdent :: Text -> IO [PursuitResponse]
65findPackagesForModuleIdent :: Text -> IO [PursuitResponse]
63−findPackagesForModuleIdent query = E.handle handler $ do
66+findPackagesForModuleIdent query =
64− r <- queryPursuit query
67+ (do r <- queryPursuit query
65− let results' = decode (fromStrict r) :: Maybe Array
68+ let results' = decode (fromStrict r) :: Maybe Array
66− case results' of
69+ case results' of
67 Nothing -> pure []
70 Nothing -> pure []
68− Just results -> pure (mapMaybe (isModuleResponse . fromJSON) (toList results))
71+ Just results -> pure (mapMaybe (isModuleResponse . fromJSON) (toList results))) `E.catch`
72+ handler
69 where
73 where
70 isModuleResponse (Success a@ModuleResponse{}) = Just a
74 isModuleResponse (Success a@ModuleResponse{}) = Just a
71 isModuleResponse _ = Nothing
75 isModuleResponse _ = Nothing
stack.yaml+1−10
@@ -1,12 +1,3 @@
1−resolver: lts-6.13
1+resolver: lts-6.10
2packages:
2packages:
3- '.'
3- '.'
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