ngx-export 0.3.0.0 → 0.3.1.0
raw patch · 3 files changed
+29/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Changelog.md +4/−0
- NgxExport.hs +23/−8
- ngx-export.cabal +2/−1
Changelog.md view
@@ -1,3 +1,7 @@+### 0.3.1.0++- added versioning support to test for compatibility in C code.+ ### 0.3.0.0 - added an asynchronous client request body handler exported with
NgxExport.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE TemplateHaskell, ViewPatterns, PatternSynonyms #-}+{-# LANGUAGE TemplateHaskell, ForeignFunctionInterface #-}+{-# LANGUAGE ViewPatterns, PatternSynonyms #-} ----------------------------------------------------------------------------- -- |@@ -53,6 +54,8 @@ import qualified Data.ByteString.Unsafe as B import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy.Char8 as C8L+import Paths_ngx_export (version)+import Data.Version pattern I l <- (fromIntegral -> l) pattern PtrLen s l <- (s, I l)@@ -73,13 +76,15 @@ | UnsafeHandler (B.ByteString -> (B.ByteString, B.ByteString, Int)) -let name = mkName "exportType" in sequence- [sigD name [t|NgxExport -> IO CInt|],- funD name $- map (\(c, i) -> clause [conP c [wildP]] (normalB [|return i|]) [])- (zip ['SS, 'SSS, 'SLS, 'BS, 'BSS, 'BLS, 'YY, 'BY, 'IOYY, 'IOYYY,- 'Handler, 'UnsafeHandler] [1 ..] :: [(Name, Int)])- ]+let name = mkName "exportType" in do+ TyConI (DataD _ _ _ _ cs _) <- reify ''NgxExport+ let cons = map (\(NormalC con _) -> con) cs+ sequence+ [sigD name [t|NgxExport -> IO CInt|],+ funD name $+ map (\(c, i) -> clause [conP c [wildP]] (normalB [|return i|]) [])+ (zip cons [1 ..] :: [(Name, Int)])+ ] ngxExport' :: (Name -> Q Exp) -> Name -> Name -> Q Type -> Name -> Q [Dec] ngxExport' m e h t f = sequence@@ -179,6 +184,9 @@ -- | Exports a function of type -- /'L.ByteString' -> 'B.ByteString' -> 'IO' 'L.ByteString'/ -- for using in directive /haskell_run_async_on_request_body/.+--+-- The first argument of the exported function contains buffers of the client+-- request body. ngxExportAsyncOnReqBody = ngxExport 'IOYYY 'asyncIOYYY [t|Ptr NgxStrType -> CInt -> CString -> CInt ->@@ -433,4 +441,11 @@ PtrLen smt lmt <- B.unsafeUseAsCStringLen mt return pokeCStringLen smt lmt pt plt return st++foreign export ccall ngxExportVersion :: Ptr CInt -> IO CInt++ngxExportVersion :: Ptr CInt -> IO CInt+ngxExportVersion x = fromIntegral <$>+ foldM (\k (I v) -> pokeElemOff x k v >> return (k + 1)) 0+ (take 4 $ versionBranch version)
ngx-export.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-version: 0.3.0.0+version: 0.3.1.0 synopsis: Helper module for Nginx haskell module description: Helper module for <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>@@ -22,4 +22,5 @@ , unix , async >= 2.0 exposed-modules: NgxExport+ other-modules: Paths_ngx_export