Skip to content

Commit

Permalink
docs: improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vknabel committed Oct 14, 2021
1 parent 4356ae6 commit 8c32ef3
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

## v0.0.5

- docs: improved docs
- runtime: better print of functions
- runtime: improved runtime error messages
- compiler: type-expressions with `Any` to match multiple cases
Expand Down
4 changes: 4 additions & 0 deletions stdlib/prelude/bool.lithia
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module prelude

/**
* Represents boolean values like `True` and `False`.
* Typically used for conditionals and flags.
*/
enum Bool {
data True
data False
Expand Down
8 changes: 8 additions & 0 deletions stdlib/prelude/if.lithia
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
module prelude

/**
* When the given condition evaluates to `True`, returns `then`. Otherwise `false`.
* Both, `then` and `else` are evaluted lazily.
*
* ```
* if True, print "Succeeded", exit 1
* ```
*/
func if { condition, then, else =>
with condition, type Bool {
True: { _ => then },
Expand Down
8 changes: 8 additions & 0 deletions stdlib/strings/concat.lithia
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ module strings

import lists

/**
* Concatenates a list of given strings in order.
*
* ```
* strings.concat ["Hello ", "World", "!"]
* // "Hello World!"
* ```
*/
func concat { listOfStrings =>
lists.reduce { into, next => into.append next }, "", listOfStrings
}
10 changes: 10 additions & 0 deletions stdlib/strings/join.lithia
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ module strings

import lists

/**
* Joins a list of strings with a given separator.
* The separator will only be inserted between two elements.
* If there are none or just one element, there won't be any separator.
*
* ```
* strings.join " ", ["Hello", "World!"]
* // "Hello World!"
* ```
*/
func join { separator, listOfStrings =>
with listOfStrings, type List {
Cons: { first =>
Expand Down

0 comments on commit 8c32ef3

Please sign in to comment.