on master help sign in
Add example usage to preamble, reference from README.
ae29023Xavier Shay
Data/Yaml.hs+17
@@ -16,6 +16,23 @@
16--
16--
17-- For documentation on the @aeson@ types, functions, classes, and
17-- For documentation on the @aeson@ types, functions, classes, and
18-- operators, please see the @Data.Aeson@ module of the @aeson@ package.
18-- operators, please see the @Data.Aeson@ module of the @aeson@ package.
19+--
20+-- == Examples
21+--
22+-- Decode into a data structure by specifying the desired type to the 'decode'
23+-- method.
24+--
25+-- > {-# LANGUAGE OverloadedStrings #-}
26+-- >
27+-- > import qualified Data.Yaml as Y
28+-- >
29+-- > main = do
30+-- > putStrLn . show $ (Y.decode "[1,2,3]" :: Maybe [Integer])
31+--
32+-- You can go one step further and decode into a custom type by implementing
33+-- 'FromJSON' for that type. This is also appropriate where extra
34+-- normalization, formatting or manipulation of the YAML is required on decode.
35+
19#if (defined (ghcjs_HOST_OS))
36#if (defined (ghcjs_HOST_OS))
20module Data.Yaml {-# WARNING "GHCJS is not supported yet (will break at runtime once called)." #-}
37module Data.Yaml {-# WARNING "GHCJS is not supported yet (will break at runtime once called)." #-}
21#else
38#else
README.md+2
@@ -12,6 +12,8 @@ around the JSON datatypes provided by the @aeson@
12package. "Text.Libyaml" provides a lower-level,
12package. "Text.Libyaml" provides a lower-level,
13streaming interface. For most users, "Data.Yaml" is recommended.
13streaming interface. For most users, "Data.Yaml" is recommended.
14
14
15+Usage examples can be found in the "Data.Yaml" documentation.
16+
15Additional modules:
17Additional modules:
16
18
17* Data.Yaml.Include supports adding `!include` directives to your YAML files.
19* Data.Yaml.Include supports adding `!include` directives to your YAML files.