diff --git a/README.md b/README.md
index a4f0505..417830a 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,6 @@
-
## Installation
```sh
@@ -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!" })
@@ -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 .
@@ -138,3 +134,9 @@ Further documentation can be found at .
gleam run # Run the project
gleam test # Run the tests
```
+
+### Run examples
+
+```sh
+gleam run --module given/internal/examples
+```
diff --git a/src/given/internal/examples.gleam b/src/given/internal/examples.gleam
index a7263a7..0953487 100644
--- a/src/given/internal/examples.gleam
+++ b/src/given/internal/examples.gleam
@@ -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!" })
@@ -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"
+}