ngx-export-tools 0.4.2.0 → 0.4.2.1
raw patch · 2 files changed
+32/−33 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- NgxExport/Tools.hs +31/−32
- ngx-export-tools.cabal +1/−1
NgxExport/Tools.hs view
@@ -156,7 +156,7 @@ -- There are a number of functions to support /typed/ exchange between Nginx -- and Haskell handlers. Functions 'readFromByteString' and -- 'readFromByteStringAsJSON' expect serialized values of custom types deriving--- or implementing 'Read' and 'FromJSON' respectively. Functions+-- or implementing instances of 'Read' and 'FromJSON' respectively. Functions -- 'readFromByteStringWithRPtr' and 'readFromByteStringWithRPtrAsJSON' -- additionally expect a binary value of a C pointer size marshalled in front -- of the value of the custom type. This pointer should correspond to the value@@ -287,21 +287,22 @@ -- > hs_testReadConfWithRPtrHandler: (0x00000000016fc790,Just (Conf 21)) -- > hs_testReadConfWithRPtrJSONHandler: (0x00000000016fc790,Just (ConfJSONCon1 4)) --- | Reads an object of a custom type implementing 'Read' from a 'ByteString'.+-- | Reads an object of a custom type implementing an instance of 'Read'+-- from a 'ByteString'. -- -- Returns 'Nothing' if reading fails. readFromByteString :: Read a => ByteString -> Maybe a readFromByteString = fromByteString (Nothing :: Maybe (Readable a)) --- | Reads an object of a custom type implementing 'FromJSON' from--- a 'ByteString'.+-- | Reads an object of a custom type implementing an instance of 'FromJSON'+-- from a 'ByteString'. -- -- Returns 'Nothing' if reading fails. readFromByteStringAsJSON :: FromJSON a => ByteString -> Maybe a readFromByteStringAsJSON = fromByteString (Nothing :: Maybe (ReadableAsJSON a)) -- | Reads a pointer to the Nginx request object followed by an object of--- a custom type implementing 'Read' from a 'ByteString'.+-- a custom type implementing an instance of 'Read' from a 'ByteString'. -- -- Throws an exception if unmarshalling of the request pointer fails. In the -- second element of the tuple returns 'Nothing' if reading of the custom@@ -311,7 +312,7 @@ readFromByteStringWithRPtr = ngxRequestPtr &&& readFromByteString . skipRPtr -- | Reads a pointer to the Nginx request object followed by an object of--- a custom type implementing 'FromJSON' from a 'ByteString'.+-- a custom type implementing an instance of 'FromJSON' from a 'ByteString'. -- -- Throws an exception if unmarshalling of the request pointer fails. In the -- second element of the tuple returns 'Nothing' if decoding of the custom@@ -522,11 +523,10 @@ hasConf = isJust c (sNameC, typeC, readConf, unreadableConfMsg) = if hasConf- then let c' = fromJust c- tName = nameBase $ fst c'+ then let (tName, isJSON) = first nameBase $ fromJust c in (mkName $ "storage_" ++ tName ++ '_' : nameF ,conT $ mkName tName- ,if snd c'+ ,if isJSON then [|readFromByteStringAsJSON|] else [|readFromByteString|] ,"Configuration " ++ tName ++ " is not readable"@@ -585,14 +585,11 @@ [sequence $ (if hasConf then [sigD sNameC [t|IORef (Maybe $(typeC))|]- ,funD sNameC [clause []- (normalB- [|unsafePerformIO $- newIORef Nothing- |]- )- []- ]+ ,funD sNameC+ [clause []+ (normalB [|unsafePerformIO $ newIORef Nothing|])+ []+ ] ,pragInlD sNameC NoInline FunLike AllPhases ] else []@@ -605,7 +602,8 @@ conf_data_ <- fromJust <$> $(initConf) $(waitTime) conf_data_ $(runService) conf_data_- |])+ |]+ ) [] ] ]@@ -633,13 +631,13 @@ -- -- with specified name and service mode. ----- The service expects an object of a custom type implementing 'Read' at its--- first argument. For the sake of efficiency, this object gets deserialized--- into a global 'IORef' data storage on the first service run to be further--- accessed directly from this storage. The storage can be accessed from--- elsewhere by a name comprised of the name of the custom type and the name of--- the service connected by an underscore and prefixed as a whole word with--- __/storage_/__. The stored data is wrapped in 'Maybe' container.+-- The service expects an object of a custom type implementing an instance of+-- 'Read' at its first argument. For the sake of efficiency, this object gets+-- deserialized into a global 'IORef' data storage on the first service run to+-- be further accessed directly from this storage. The storage can be accessed+-- from elsewhere by a name comprised of the name of the custom type and the+-- name of the service connected by an underscore and prefixed as a whole word+-- with __/storage_/__. The stored data is wrapped in 'Maybe' container. -- -- When reading of the custom object fails on the first service run, the -- service terminates the worker process by throwing an exception@@ -659,13 +657,14 @@ -- -- with specified name and service mode. ----- The service expects an object of a custom type implementing 'FromJSON' at its--- first argument. For the sake of efficiency, this object gets deserialized--- into a global 'IORef' data storage on the first service run to be further--- accessed directly from this storage. The storage can be accessed from--- elsewhere by a name comprised of the name of the custom type and the name of--- the service connected by an underscore and prefixed as a whole word with--- __/storage_/__. The stored data is wrapped in 'Maybe' container.+-- The service expects an object of a custom type implementing an instance of+-- 'FromJSON' at its first argument. For the sake of efficiency, this object+-- gets deserialized into a global 'IORef' data storage on the first service+-- run to be further accessed directly from this storage. The storage can be+-- accessed from elsewhere by a name comprised of the name of the custom type+-- and the name of the service connected by an underscore and prefixed as a+-- whole word with __/storage_/__. The stored data is wrapped in 'Maybe'+-- container. -- -- When reading of the custom object fails on the first service run, the -- service terminates the worker process by throwing an exception
ngx-export-tools.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-tools-version: 0.4.2.0+version: 0.4.2.1 synopsis: Extra tools for Nginx haskell module description: Extra tools for <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>.