Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
inoas committed Dec 16, 2024
1 parent 36f0e7b commit 67bcea5
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 44 deletions.
50 changes: 26 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<br>
<br>


## Installation

```sh
Expand All @@ -39,29 +38,6 @@ import given.{given, not_given}
import gleam/io
import gleam/option.{None, Some}
pub fn main() {
given_example() |> io.debug()
// "🤯 Woof!"
not_given_example() |> io.debug()
// "👌 Access granted..."
given_ok_in_example() |> io.debug()
// "Hello Joe!"
given_error_in_example() |> io.debug()
// "Memory exhausted!"
given_some_in_example() |> io.debug()
// "One Penny"
given_none_in_example() |> io.debug()
// "Nothing at all"
given_none_in_another_example() |> io.debug()
// "None here"
}
pub fn given_example() {
let user_understood = False
use <- given(user_understood, return: fn() { "💡 Bright!" })
Expand Down Expand Up @@ -128,6 +104,26 @@ pub fn given_none_in_another_example() {
else_some_value
}
pub fn main() {
given_example() |> io.debug()
// "🤯 Woof!"
not_given_example() |> io.debug()
// "👌 Access granted..."
given_ok_in_example() |> io.debug()
// "Hello Joe!"
given_error_in_example() |> io.debug()
// "Memory exhausted!"
given_some_in_example() |> io.debug()
// "One Penny"
given_none_in_example() |> io.debug()
// "Nothing at all"
}
```

Further documentation can be found at <https://hexdocs.pm/given>.
Expand All @@ -138,3 +134,9 @@ Further documentation can be found at <https://hexdocs.pm/given>.
gleam run # Run the project
gleam test # Run the tests
```

### Run examples

```sh
gleam run --module given/internal/examples
```
40 changes: 20 additions & 20 deletions src/given/internal/examples.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,6 @@ import given.{given, not_given}
import gleam/io
import gleam/option.{None, Some}

pub fn main() {
given_example() |> io.debug()
// "🤯 Woof!"

not_given_example() |> io.debug()
// "👌 Access granted..."

given_ok_in_example() |> io.debug()
// "Hello Joe!"

given_error_in_example() |> io.debug()
// "Memory exhausted!"

given_some_in_example() |> io.debug()
// "One Penny"

given_none_in_example() |> io.debug()
// "Nothing at all"
}

pub fn given_example() {
let user_understood = False
use <- given(user_understood, return: fn() { "💡 Bright!" })
Expand Down Expand Up @@ -88,3 +68,23 @@ pub fn given_none_in_another_example() {

else_some_value
}

pub fn main() {
given_example() |> io.debug()
// "🤯 Woof!"

not_given_example() |> io.debug()
// "👌 Access granted..."

given_ok_in_example() |> io.debug()
// "Hello Joe!"

given_error_in_example() |> io.debug()
// "Memory exhausted!"

given_some_in_example() |> io.debug()
// "One Penny"

given_none_in_example() |> io.debug()
// "Nothing at all"
}

0 comments on commit 67bcea5

Please sign in to comment.