oeis 0.3.10 → 0.3.10.1
raw patch · 2 files changed
+19/−22 lines, 2 filesdep +http-clientdep +http-client-tlsdep +http-typesdep −HTTPdep ~networkdep ~network-urinew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: http-client, http-client-tls, http-types, utf8-string
Dependencies removed: HTTP
Dependency ranges changed: network, network-uri
API changes (from Hackage documentation)
- Math.OEIS.Internal: request :: URI -> Request String
Files
- Math/OEIS/Internal.hs +12/−16
- oeis.cabal +7/−6
Math/OEIS/Internal.hs view
@@ -8,15 +8,19 @@ import Control.Arrow (second, (***)) import Data.Char (isSpace, toUpper, toLower) import Data.List (intercalate, isPrefixOf, foldl')-import Network.HTTP (simpleHTTP, rspBody, rspCode, rqBody, rqHeaders, rqMethod, rqURI, Request(..), RequestMethod(GET)) import Network.URI (parseURI, URI) +import qualified Network.HTTP.Client as HTTP+import qualified Network.HTTP.Client.TLS as HTTP+import qualified Network.HTTP.Types as HTTP+import qualified Data.ByteString.Lazy.UTF8 as U+ import Math.OEIS.Types -------------------------------------------------------------------------------- baseSearchURI :: String-baseSearchURI = "http://oeis.org/search?fmt=text&q="+baseSearchURI = "https://oeis.org/search?fmt=text&q=" idSearchURI :: String -> String idSearchURI n = baseSearchURI ++ "id:" ++ n@@ -34,20 +38,12 @@ get :: URI -> IO (Maybe String) get uri = do- ersp <- simpleHTTP (request uri)- return $ case ersp of- Left _ -> Nothing- Right rsp- | rspCode rsp == (2,0,0) -> Just $ rspBody rsp- | otherwise -> Nothing--request :: URI -> Request String-request uri = Request- { rqURI = uri- , rqMethod = GET- , rqHeaders = []- , rqBody = ""- }+ httpman <- HTTP.newManager HTTP.tlsManagerSettings+ let request = HTTP.requestFromURI_ uri+ response <- HTTP.httpLbs request httpman+ return $ case HTTP.statusIsSuccessful (HTTP.responseStatus response) of+ False -> Nothing+ True -> Just (U.toString (HTTP.responseBody response)) readKeyword :: String -> Keyword readKeyword = read . capitalize
oeis.cabal view
@@ -1,5 +1,5 @@ name: oeis-version: 0.3.10+version: 0.3.10.1 category: Math stability: experimental @@ -41,7 +41,6 @@ library default-language: Haskell2010 - ghc-options: -Wall -O2 if impl(ghc >= 6.8) ghc-options: -fwarn-tabs @@ -53,11 +52,14 @@ Math.OEIS.Types build-depends:- HTTP >= 4000.2 && < 4000.4,+ http-client >= 0.7 && < 0.8,+ http-client-tls >= 0.3 && < 0.4,+ http-types >= 0.12 && < 0.13,+ utf8-string >= 1.0 && < 1.1, base >= 3 && < 5 if flag(network-uri)- build-depends: network-uri >= 2.6, network >= 2.6+ build-depends: network-uri >= 2.6 && < 2.7, network >= 2.6 && < 4.0 else build-depends: network-uri < 2.6, network < 2.6 @@ -66,7 +68,6 @@ test-suite main default-language: Haskell2010 - ghc-options: -Wall -O2 if impl(ghc >= 6.8) ghc-options: -fwarn-tabs @@ -86,4 +87,4 @@ source-repository head type: git- location: git://github.com/niteria/oeis.git+ location: https://github.com/niteria/oeis.git