gdritter repos config-ini / 102f486
Split examples into separate project to avoid polluting Hackage package Getty Ritter 6 years ago
4 changed file(s) with 77 addition(s) and 52 deletion(s). Collapse all Expand all
1616
1717 license: BSD3
1818 license-file: LICENSE
19 author: Getty Ritter <gettyritter@gmail.com>
20 maintainer: Getty Ritter <gettyritter@gmail.com>
21 copyright: ©2016 Getty Ritter
19 author: Getty Ritter <config-ini@infinitenegativeutility.com>
20 maintainer: Getty Ritter <config-ini@infinitenegativeutility.com>
21 copyright: ©2017 Getty Ritter
2222 category: Configuration
2323 build-type: Simple
24 cabal-version: >= 1.10
25 extra-source-files: CHANGELOG.md
24 cabal-version: >= 1.18
25 bug-reports: https://github.com/aisamanra/config-ini/issues
26 extra-source-files:
27 README.md,
28 CHANGELOG.md
2629
2730 source-repository head
2831 type: git
2932 location: git://github.com/aisamanra/config-ini.git
30
31 flag build-examples
32 description: Build example applications
33 default: False
3433
3534 library
3635 hs-source-dirs: src
3837 , Data.Ini.Config.Bidir
3938 , Data.Ini.Config.Raw
4039 ghc-options: -Wall
41 build-depends: base >=4.8 && <5
42 , containers
40 build-depends: base >=4.8 && <5
41 , containers >=0.5 && <0.6
4342 , text >=1.2.2 && <1.3
4443 , unordered-containers >=0.2.7 && <0.3
4544 , transformers >=0.4.1 && <0.6
4645 , megaparsec >=6 && <7
4746 default-language: Haskell2010
48
49 executable basic-example
50 if !flag(build-examples)
51 buildable: False
52 hs-source-dirs: examples/basic-example
53 main-is: Main.hs
54 ghc-options: -Wall
55 build-depends: base >=4.8 && <5
56 , text
57 , config-ini
58 default-language: Haskell2010
59
60 executable bidir-example
61 if !flag(build-examples)
62 buildable: False
63 hs-source-dirs: examples/bidir-example
64 main-is: Main.hs
65 ghc-options: -Wall
66 build-depends: base >=4.8 && <5
67 , text
68 , config-ini
69 , microlens-th
70 default-language: Haskell2010
71
72 executable config-example
73 if !flag(build-examples)
74 buildable: False
75 hs-source-dirs: examples/config-example
76 main-is: Main.hs
77 ghc-options: -Wall
78 build-depends: base >=4.8 && <5
79 , text
80 , config-ini
81 , microlens-platform
82 default-language: Haskell2010
8347
8448 test-suite test-ini-compat
8549 type: exitcode-stdio-1.0
1 Copyright (c) 2016, Getty Ritter
2 All rights reserved.
3
4 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
6 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
8 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
10 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
12 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 name: config-ini-examples
2 version: 0.2.0.0
3 synopsis: Example config-ini programs
4 homepage: https://github.com/aisamanra/config-ini
5 bug-reports: https://github.com/aisamanra/config-ini/issues
6 description: Test programs associated with config-ini
7 license: BSD3
8 license-file: LICENSE
9 author: Getty Ritter <config-ini@infinitenegativeutility.com>
10 maintainer: Getty Ritter <config-ini@infinitenegativeutility.com>
11 copyright: ©2017 Getty Ritter
12 category: Configuration
13 build-type: Simple
14 cabal-version: >= 1.18
15 bug-reports: https://github.com/aisamanra/config-ini/issues
16
17 source-repository head
18 type: git
19 location: git://github.com/aisamanra/config-ini.git
20
21 executable basic-example
22 hs-source-dirs: basic-example
23 main-is: Main.hs
24 ghc-options: -Wall
25 build-depends: base >=4.8 && <5
26 , text
27 , config-ini
28 default-language: Haskell2010
29
30 executable bidir-example
31 hs-source-dirs: bidir-example
32 main-is: Main.hs
33 ghc-options: -Wall
34 build-depends: base >=4.8 && <5
35 , text
36 , config-ini
37 , microlens-th
38 default-language: Haskell2010
39
40 executable config-example
41 hs-source-dirs: config-example
42 main-is: Main.hs
43 ghc-options: -Wall
44 build-depends: base >=4.8 && <5
45 , text
46 , config-ini
47 , microlens-platform
48 default-language: Haskell2010
9090 'section' \"NETWORK\" $ do
9191 cfHost '.=' 'field' \"host\" 'string'
9292 & 'comment' [\"The desired hostname (optional)\"]
93 & 'skipIfMissing'
93 & 'optional'
9494 cfPost '.=' 'field' \"port\" 'number'
9595 & 'comment' [\"The port number\"]
9696 'sectionOpt' \"LOCAL\" $ do
471471 -- placeholder text as a value, so a spec that includes
472472 --
473473 -- @
474 -- myLens .=? field "x" & placeholderValue "<val>"
474 -- myLens .=? field "x" & placeholderValue "\<val\>"
475475 -- @
476476 --
477477 -- will serialize into an INI file that contains the line
478478 --
479479 -- @
480 -- # x = <val>
480 -- # x = \<val\>
481481 -- @
482482 --
483 -- A placeholder value will only appear in the serialized output
484 -- if the field is optional, but will be preferred over serializing
485 -- a "defaultValue". If a "placeholderValue" is not
483 -- A placeholder value will only appear in the serialized output if
484 -- the field is optional, but will be preferred over serializing the
485 -- default value for an optional field. This will not affect INI
486 -- file updates.
486487 placeholderValue :: Text -> FieldDescription t -> FieldDescription t
487488 placeholderValue t fd = fd { fdDummy = Just t }
488489