metar-http 0.0.3 → 0.0.4
raw patch · 3 files changed
+40/−39 lines, 3 filesdep ~QuickCheckdep ~checkersdep ~lensPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck, checkers, lens, metar, semigroupoids, semigroups, tasty, tasty-hunit, tasty-quickcheck, text, transformers, wai, warp
API changes (from Hackage documentation)
Files
- changelog.md +7/−0
- metar-http.cabal +24/−22
- src/Data/Aviation/Metar/Http.hs +9/−17
changelog.md view
@@ -1,3 +1,10 @@+0.0.4++* Update to GHC 9.6.7 compatibility+* Update to metar-0.0.4 library (uses getNOAAMETAR)+* Remove TAF support (not available in metar-0.0.4)+* Relax dependency upper bounds for modern GHC+ 0.0.3 * refactor of code to allow more options
metar-http.cabal view
@@ -1,5 +1,5 @@ name: metar-http-version: 0.0.3+version: 0.0.4 license: BSD3 license-file: LICENCE author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@sıɹɹoɯʇ>@@ -25,23 +25,24 @@ build-depends: base >= 4.8 && < 5 , http-types >= 0.9 && < 1- , lens >= 4 && < 5- , metar >= 0.0.1 && < 1.0+ , lens >= 4 && < 6+ , metar >= 0.0.4 && < 1.0 , network-uri >= 2.6 && < 3- , text >= 1.2 && < 1.3- , semigroups >= 0.9 && < 0.19- , semigroupoids >= 5.2 && < 6- , transformers >= 0.5 && < 0.6+ , text >= 1.2 && < 3+ , semigroups >= 0.9 && < 1+ , semigroupoids >= 5.2 && < 7+ , transformers >= 0.5 && < 0.7 , utf8-string >= 1.0 && < 2- , warp >= 3.2 && < 3.3- , wai >= 3.2 && < 3.3+ , warp >= 3.2 && < 4+ , wai >= 3.2 && < 4 - + ghc-options: -Wall+ -threaded default-extensions:- + NoImplicitPrelude hs-source-dirs:@@ -63,6 +64,7 @@ ghc-options: -Wall+ -threaded default-extensions: NoImplicitPrelude@@ -72,26 +74,26 @@ test-suite tests - build-depends: QuickCheck >=2.9.2 && <2.13+ build-depends: QuickCheck >=2.9.2 , base >=4.8 && < 5- , checkers >=0.4.6 && <0.5+ , checkers >=0.4.6 , metar-http- , lens >=4 && <4.18- , tasty >=0.11 && <1.2- , tasty-hunit >=0.9 && <0.11- , tasty-quickcheck >=0.8.4 && <0.11+ , lens >=4+ , tasty >=0.11+ , tasty-hunit >=0.9+ , tasty-quickcheck >=0.8.4 - type: + type: exitcode-stdio-1.0 - main-is: + main-is: Tests.hs - hs-source-dirs: + hs-source-dirs: test - default-language: + default-language: Haskell2010 - ghc-options: + ghc-options: -Wall
src/Data/Aviation/Metar/Http.hs view
@@ -8,8 +8,8 @@ import Control.Category((.), id) import Control.Lens((^.), (^?), _Wrapped, folded)-import Data.Aviation.Metar(getAllMETAR, getAllTAF)-import Data.Aviation.Metar.TAFResult(_TAFResultValue)+import Data.Aviation.Metar(getNOAAMETAR)+import Data.Aviation.Metar.METARResult(_METARResultValue) import Data.ByteString.Lazy.UTF8 hiding (take, splitAt) import Data.Eq(Eq) import Data.Functor((<$>))@@ -24,7 +24,7 @@ import Network.HTTP.Types.Header(hContentType) import Network.HTTP.Types.Status(status404, status200) import Network.Wai(Application, responseLBS, pathInfo)-import Network.Wai.Handler.Warp(setPort, runSettings, defaultSettings)+import Network.Wai.Handler.Warp(setPort, setTimeout, runSettings, defaultSettings) import System.Environment(getArgs) import System.IO(IO) import Text.Read(Read, reads)@@ -173,14 +173,6 @@ "metar for station <icao> all on one line truncated at <maxchars>" <//> "/metar/<icao>/*/<maxchars>/<appendstr>" </> "metar for station <icao> all on one line truncated at <maxchars> and if truncation occurs, append <appendstr>" <//>- "/taf/<icao>" </>- "raw taf for station <icao>" <//>- "/taf/<icao>/*" </>- "taf for station <icao> all on one line" <//>- "/taf/<icao>/*/<maxchars>" </>- "taf for station <icao> all on one line truncated at <maxchars>" <//>- "/taf/<icao>/*/<maxchars>/<appendstr>" </>- "taf for station <icao> all on one line truncated at <maxchars> and if truncation occurs, append <appendstr>" <//> "" _404 = responseLBS@@ -199,9 +191,9 @@ mt = case toLower rpt of "metar" ->- Just ("METAR", getAllMETAR xxxx')+ Just ("METAR", getNOAAMETAR xxxx') "taf" ->- Just ("TAF", getAllTAF xxxx')+ Nothing _ -> Nothing in case mt of@@ -210,8 +202,8 @@ Just (mtt, mtf) -> do t <- mtf ^. _Wrapped withResp $- case t ^? _TAFResultValue of- Nothing -> + case t ^? _METARResultValue of+ Nothing -> responseLBS status404 []@@ -220,7 +212,7 @@ responseLBS status200 [(hContentType, "text/plain")]- (fromString (modifyOutput x))+ (fromString (modifyOutput [x])) [] -> withResp $ responseLBS@@ -244,4 +236,4 @@ id Just n -> setPort n- runSettings (p defaultSettings) metarHTTPapp+ runSettings (setTimeout 6 (p defaultSettings)) metarHTTPapp