airship 0.9.3 → 0.9.4
raw patch · 7 files changed
+30/−19 lines, 7 filesdep +semigroupsdep ~bytestring-triedep ~tastydep ~tasty-hunitPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: semigroups
Dependency ranges changed: bytestring-trie, tasty, tasty-hunit, tasty-quickcheck, wai, wai-extra
API changes (from Hackage documentation)
- Airship.Route: (#>) :: MonadWriter [(ByteString, (RouteLeaf a))] m => Route -> Resource a -> m ()
+ Airship.Route: (#>) :: MonadWriter [(ByteString, RouteLeaf a)] m => Route -> Resource a -> m ()
- Airship.Route: (#>=) :: MonadWriter [(ByteString, (RouteLeaf a))] m => Route -> m (Resource a) -> m ()
+ Airship.Route: (#>=) :: MonadWriter [(ByteString, RouteLeaf a)] m => Route -> m (Resource a) -> m ()
- Airship.Route: data Trie a :: * -> *
+ Airship.Route: data Trie a
- Airship.Types: ResponseFile :: FilePath -> (Maybe FilePart) -> ResponseBody
+ Airship.Types: ResponseFile :: FilePath -> Maybe FilePart -> ResponseBody
- Airship.Types: data Request :: *
+ Airship.Types: data Request
Files
- Changes.md +3/−0
- README.md +9/−3
- airship.cabal +11/−8
- src/Airship/Internal/Helpers.hs +2/−2
- src/Airship/Internal/Route.hs +3/−2
- src/Airship/Types.hs +0/−1
- test/unit/test.hs +2/−3
Changes.md view
@@ -1,3 +1,6 @@+* 0.9.4+ - Bump upper bounds on bytestring-trie+ - Support GHC 8.4 and 8.6 * 0.9.3 - Bump upper bound on http-types due to stackage. * 0.9.0
README.md view
@@ -4,11 +4,16 @@ [](https://travis-ci.org/helium/airship) -Airship is a Haskell library for handling and serving HTTP requests in a RESTful fashion. It is heavily inspired by [Webmachine](https://github.com/basho/webmachine) and works with any [WAI](https://hackage.haskell.org/package/wai)-compatible web server such as [Warp](https://hackage.haskell.org/package/warp). It aims to be small, fast, and flexible.+Airship is a Haskell library for handling and serving HTTP requests in a RESTful fashion. It is heavily inspired by [Webmachine](https://github.com/basho/webmachine)+and works with any [WAI](https://hackage.haskell.org/package/wai)-compatible web server such as [Warp](https://hackage.haskell.org/package/warp). +It aims to be small, fast, and flexible.+ # How does it work? -Airship resources are represented with a [`Resource` record type](https://github.com/helium/airship/blob/master/src/Airship/Resource.hs#L39-L117). Each field in `Resource` corresponds to an action taken in the [Webmachine decision tree](https://raw.githubusercontent.com/wiki/Webmachine/webmachine/images/http-headers-status-v3.png). Airship provides a `defaultResource` with sensible defaults for each of these actions; you build web services by overriding fields in the default resource with your own.+Airship resources are represented with a [`Resource` record type](https://github.com/helium/airship/blob/master/airship/src/Airship/Resource.hs#L39-L117).+Each field in `Resource` corresponds to an action taken in the [Webmachine decision tree](https://raw.githubusercontent.com/wiki/Webmachine/webmachine/images/http-headers-status-v3.png).+Airship provides a `defaultResource` with sensible defaults for each of these actions; you build web services by overriding fields in the default resource with your own. Routes are declared with a simple monadic syntax: @@ -18,6 +23,7 @@ "account" </> var "name" #> accountResource ``` -For a simple example that handles HTTP GET and POST requests, please check [`example/Basic.hs`](https://github.com/helium/airship/blob/master/example/Basic.hs). For a slightly more involved example that generates HTML and manages a pool of resources, please check the [blimp](https://github.com/patrickt/blimp) repository.+For a simple example that handles HTTP GET and POST requests, please check [`example/Basic.hs`](https://github.com/helium/airship/blob/master/example/Basic.hs).+For a slightly more involved example that generates HTML and manages a pool of resources, please check the [blimp](https://github.com/patrickt/blimp) repository. Airship is copyright © 2015 Helium Systems, Inc., and released to the public under the terms of the MIT license.
airship.cabal view
@@ -2,17 +2,18 @@ synopsis: A Webmachine-inspired HTTP library homepage: https://github.com/helium/airship/ Bug-reports: https://github.com/helium/airship/issues-version: 0.9.3+version: 0.9.4 license: MIT license-file: LICENSE author: Reid Draper and Patrick Thomson-maintainer: Tim McGilchrist <timmcgil@gmail.com>, reid@helium.com+maintainer: Tim McGilchrist <timmcgil@gmail.com> category: Web build-type: Simple cabal-version: >=1.10 description: A Webmachine-inspired HTTP library based off ideas from the original Erlang project <https://github.com/webmachine/webmachine> . A number of examples can be found in <https://github.com/helium/airship/tree/master/example> illustrating how to build airship based services.+tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.3 extra-source-files: README.md Changes.md@@ -46,7 +47,7 @@ , base64-bytestring == 1.0.* , blaze-builder >= 0.3 && < 0.5 , bytestring- , bytestring-trie == 0.2.4.*+ , bytestring-trie >= 0.2.4 && < 0.2.6 , case-insensitive , containers , cryptohash == 0.11.*@@ -65,14 +66,16 @@ , network , old-locale , random+ , semigroups == 0.18.* , text , time , transformers , transformers-base , unix == 2.7.* , unordered-containers- , wai >= 3.0 && < 3.3- , wai-extra == 3.0.*+ , wai >= 3.0.3.0 && < 3.2.2+ -- https://github.com/yesodweb/wai/pull/726+ , wai-extra >= 3.0 && < 3.0.26 test-suite unit default-language: Haskell2010@@ -83,9 +86,9 @@ , airship , text == 1.2.* , bytestring >= 0.9.1 && < 0.11- , tasty >= 0.10.1 && < 0.12- , tasty-quickcheck >= 0.8.3 && < 0.10- , tasty-hunit >= 0.9.1 && < 0.10+ , tasty >= 0.10.1 && < 1.3+ , tasty-quickcheck >= 0.8.3 && < 0.11+ , tasty-hunit >= 0.9.1 && < 0.11 , transformers , wai >= 3.0 && < 3.3
src/Airship/Internal/Helpers.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-}-+{-# LANGUAGE MonoLocalBinds #-} module Airship.Internal.Helpers ( parseFormData , contentTypeMatches@@ -121,7 +121,7 @@ -- | Like 'resourceToWaiT', but expects the 'RoutingSpec' to have been -- evaluated with 'runRouter'. This is more efficient than 'resourceToWaiT', as -- the routes will not be evaluated on every request.--- +-- -- Given @routes :: RoutingSpec IO ()@, 'resourceToWaiT'' can be invoked like so: -- -- > resourceToWaiT' cfg (const id) (runRouter routes) errors
src/Airship/Internal/Route.hs view
@@ -31,7 +31,8 @@ import Data.HashMap.Strict (HashMap, fromList) import qualified Data.List as L (foldl') import Data.Maybe (isNothing)-import Data.Monoid+import Data.Semigroup (Semigroup, (<>))+import Data.Monoid (Monoid) import Data.Text (Text) import qualified Data.Text as T (intercalate, cons) import Data.Text.Encoding (encodeUtf8, decodeUtf8)@@ -49,7 +50,7 @@ -- | 'Route's represent chunks of text used to match over URLs. -- You match hardcoded paths with string literals (and the @-XOverloadedStrings@ extension), -- named variables with the 'var' combinator, and wildcards with 'star'.-newtype Route = Route { getRoute :: [BoundOrUnbound] } deriving (Show, Monoid)+newtype Route = Route { getRoute :: [BoundOrUnbound] } deriving (Show, Semigroup, Monoid) routeText :: Route -> Text routeText (Route parts) =
src/Airship/Types.hs view
@@ -72,7 +72,6 @@ defaultRequest) import qualified Network.Wai as Wai - -- | Reads the entirety of the request body in a single string. -- This turns the chunks obtained from repeated invocations of 'requestBody' into a lazy 'ByteString'. entireRequestBody :: MonadIO m => Request -> m LB.ByteString
test/unit/test.hs view
@@ -1,9 +1,8 @@ {-# LANGUAGE OverloadedStrings #-}- module Main where -import Airship-import Control.Concurrent+import Airship (requestBody, entireRequestBody, defaultRequest)+import Control.Concurrent (newMVar, modifyMVar) import Data.ByteString (ByteString) import Test.Tasty