wai-handler-snap 0.0.0.1 → 0.1.0
raw patch · 2 files changed
+17/−18 lines, 2 filesdep +enumeratordep −iterateedep ~containersdep ~snap-coredep ~snap-serverPVP ok
version bump matches the API change (PVP)
Dependencies added: enumerator
Dependencies removed: iteratee
Dependency ranges changed: containers, snap-core, snap-server
API changes (from Hackage documentation)
Files
- Network/Wai/Handler/Snap.hs +12/−13
- wai-handler-snap.cabal +5/−5
Network/Wai/Handler/Snap.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE OverloadedStrings #-} module Network.Wai.Handler.Snap ( run ) where@@ -11,12 +12,12 @@ import Data.CIByteString import Control.Arrow (first, (***)) import qualified Data.Map as Map-import Data.Iteratee.Base hiding (run)-import Data.Iteratee.WrappedByteString+import Data.Monoid (mempty)+import qualified Data.Enumerator as E+import Control.Applicative ((<$>)) run :: Int -> W.Application -> IO ()-run port = httpServe (S8.pack "*") port (S8.pack "localhost")- Nothing Nothing . waiToSnap+run port = httpServe (addListen (ListenHttp "*" port) mempty) . waiToSnap waiToSnap :: W.Application -> Snap () waiToSnap wapp = do@@ -73,13 +74,11 @@ newHeaders = Map.fromList $ map (go *** return) $ W.responseHeaders wres go = toCI . W.ciOriginal -toSnapEnum :: W.Enumerator -> Enumerator a-toSnapEnum (W.Enumerator enum) initIter =- either id id `fmap` enum go initIter+toSnapEnum :: W.Enumerator -> Enumerator S8.ByteString IO a+toSnapEnum (W.Enumerator enum) step0 = do+ E.Iteratee $ either id id <$> enum go step0 where- go (IterateeG iter) bs = do- res <- iter $ Chunk $ WrapBS bs- case res of- Done a s -> return $ Left $ IterateeG $ const $ return- $ Done a s- Cont iter' _ -> return $ Right iter'+ go (E.Continue k) bs = do+ step' <- E.runIteratee $ k $ E.Chunks [bs]+ return $ Right step'+ go step _ = return $ Left step
wai-handler-snap.cabal view
@@ -1,5 +1,5 @@ Name: wai-handler-snap-Version: 0.0.0.1+Version: 0.1.0 Synopsis: Web Application Interface handler using snap-server. License: BSD3 License-file: LICENSE@@ -19,10 +19,10 @@ Build-Depends: base >= 3 && < 5, bytestring >= 0.9 && < 0.10, wai >= 0.2.0 && < 0.3,- snap-core >= 0.2.8.1 && < 0.3,- snap-server >= 0.2.8.1 && < 0.3,- containers >= 0.2 && < 0.4,+ snap-core >= 0.3 && < 0.4,+ snap-server >= 0.3 && < 0.4,+ containers >= 0.2 && < 0.5, transformers >= 0.2.1 && < 0.3,- iteratee >= 0.3.5 && < 0.4+ enumerator >= 0.4.2 && < 0.5 Exposed-modules: Network.Wai.Handler.Snap ghc-options: -Wall