descriptive 0.4.1 → 0.4.2
raw patch · 2 files changed
+17/−5 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Descriptive.JSON: Info :: !Text -> Doc
+ Descriptive.JSON: info :: Text -> Consumer s Doc a -> Consumer s Doc a
Files
- descriptive.cabal +1/−1
- src/Descriptive/JSON.hs +16/−4
descriptive.cabal view
@@ -1,5 +1,5 @@ name: descriptive-version: 0.4.1+version: 0.4.2 synopsis: Self-describing consumers/parsers; forms, cmd-line args, JSON, etc. description: Self-describing consumers/parsers. See the README.md for more information. It is currently EXPERIMENTAL. stability: Experimental
src/Descriptive/JSON.hs view
@@ -11,7 +11,7 @@ -- | A JSON API which describes itself. module Descriptive.JSON- (-- * Combinators+ (-- * Consumers object ,key ,keyMaybe@@ -21,7 +21,9 @@ ,double ,bool ,null+ -- * Annotations ,label+ ,info -- * Description ,Doc(..) )@@ -54,6 +56,7 @@ | Key !Text | Array !Text | Label !Text+ | Info !Text deriving (Eq,Show,Typeable,Data) -- | Consume an object.@@ -195,11 +198,20 @@ _ -> (Failed d,s)) where d = Unit (Null doc) --- | Wrap a consumer with a label containing additional description.-label :: Text -- ^ Some label.- -> Consumer s Doc a -- ^ An object consumer.+-- | Wrap a consumer with a label e.g. a type tag.+label :: Text -- ^ Some label.+ -> Consumer s Doc a -- ^ A value consumer. -> Consumer s Doc a label desc = wrap (\s d -> (Wrap doc (fst (d s)),s)) (\s _ p -> p s) where doc = Label desc++-- | Wrap a consumer with some handy information.+info :: Text -- ^ Some information.+ -> Consumer s Doc a -- ^ A value consumer.+ -> Consumer s Doc a+info desc =+ wrap (\s d -> (Wrap doc (fst (d s)),s))+ (\s _ p -> p s)+ where doc = Info desc