aboutsummaryrefslogtreecommitdiff
path: root/src/content/chapter1_functions/lesson09_documentation_comments/code.gleam
blob: a84dce617c60ce980ffbefead38594d9a3fcc352 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//// A module containing some unusual functions and types.

/// A type where the value can never be constructed.
/// Can you work out why?
pub type Never {
  Never(Never)
}

/// Call a function twice with an initial value.
///
pub fn twice(argument: value, function: fn(value) -> value) -> value {
  function(function(argument))
}

/// Call a function three times with an initial value.
///
pub fn thrice(argument: value, function: fn(value) -> value) -> value {
  function(function(function(argument)))
}