You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
569 B
Plaintext
24 lines
569 B
Plaintext
10 months ago
|
app "crash-me"
|
||
|
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" }
|
||
|
imports [pf.Stdout]
|
||
|
provides [main] to pf
|
||
|
|
||
|
main =
|
||
|
fn1 = bind Num.sub 2
|
||
|
fn2 = compose fn1 fn1
|
||
|
|
||
|
results =
|
||
|
[fn1, fn2]
|
||
|
|> List.map \f -> f 2
|
||
|
|> List.map Num.toStr
|
||
|
|> Str.joinWith "\n"
|
||
|
Stdout.line "$(results)"
|
||
|
|
||
|
bind : (a, b -> c), a -> (b -> c)
|
||
|
bind = \fn, a ->
|
||
|
\b -> fn a b
|
||
|
|
||
|
compose : (a -> b), (b -> c) -> (a -> c)
|
||
|
compose = \fn1, fn2 ->
|
||
|
\a -> fn1 a |> fn2
|