Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,35 @@ to each field. For example:

```purescript
type Config =
( greeting :: String <: "GREETING"
, count :: Int <: "COUNT"
( "GREETING" :: String
, "COUNT" :: Int
)
```

Its `fromEnv` function can now read the configuration from the environment with relative ease:

```purescript
readConfig env = lmap envErrorMessage $ TypedEnv.fromEnv (RProxy :: RProxy Config) env
readConfig env =
bimap
envErrorMessage
(\r -> { greeting: r."GREETING", count: r."COUNT" })
$ TypedEnv.fromEnv (Proxy :: _ Config) env
```

For more, see the [examples](#examples) section below.

### Installation

via [spago](https://github.com/spacchetti/spago):
```
```bash
spago install typedenv
```

### Examples

To run the [examples](example), clone the repository and run one of the following depending on your package manager and build tool, replacing `<example-name>` with the name of one of the examples.
To run one of the [examples](example), clone the repository and run the following command, replacing `<example-name>` with the name of the example.

[bower](https://github.com/bower/bower) + [pulp](http://github.com/purescript-contrib/pulp):
```
bower install
pulp run -I example -m Example.<example-name>
```

[spago](https://github.com/spacchetti/spago):
```
```bash
spago run -p example/<example-name>.purs -m Example.<example-name>
```

Expand Down