Skip to content

Commit

Permalink
Add pipeline operator
Browse files Browse the repository at this point in the history
  • Loading branch information
minoki committed Feb 22, 2024
1 parent daec602 commit 292e86b
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ Output type:
* [Interface to Lua](doc/LuaInterface.md)
* [Interface to JavaScript](doc/JavaScriptInterface.md)
* [Delimited continuations](doc/DelimitedContinuations.md) (experimental)
* [Other libraries](doc/OtherLibraries.md)
1 change: 1 addition & 0 deletions doc/MLBasisSystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The default value for an annotation could be specified by `--default-ann` option
* `$(SML_LIB)/basis/lunarml.mlb`: The [LunarML](LunarMLStructure.md) structure
* `$(SML_LIB)/basis/lua.mlb`: The [Lua](LuaInterface.md) structure
* `$(SML_LIB)/basis/javascript.mlb`: The [JavaScript](JavaScriptInterface.md) structure
* `$(SML_LIB)/basis/pipeline.mlb`: The pipeline operator `|>`. See [OtherLibraries](OtherLibraries.md).

The following libraries are available if `make -C thirdparty install` is run:

Expand Down
16 changes: 16 additions & 0 deletions doc/OtherLibraries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Pipeline operators (`$(SML_LIB)/basis/pipeline.mlb`)

`$(SML_LIB)/basis/pipeline.mlb` contains the following declarations:

```sml
infix 0 |>
fun x |> f = f x
```

## Other libraries

* `$(SML_LIB)/basis/basis.mlb`: The [Basis Library](BasisLibrary.md)
* `$(SML_LIB)/basis/unsafe.mlb`: The [Unsafe](UnsafeStructure.md) structure
* `$(SML_LIB)/basis/lunarml.mlb`: The [LunarML](LunarMLStructure.md) structure
* `$(SML_LIB)/basis/lua.mlb`: The [Lua](LuaInterface.md) structure
* `$(SML_LIB)/basis/javascript.mlb`: The [JavaScript](JavaScriptInterface.md) structure
3 changes: 3 additions & 0 deletions example/pipeline.mlb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$(SML_LIB)/basis/basis.mlb
$(SML_LIB)/basis/pipeline.mlb
pipeline.sml
1 change: 1 addition & 0 deletions example/pipeline.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"Hello world!\n" |> print;
1 change: 1 addition & 0 deletions lib/lunarml/ml/basis/pipeline.mlb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pipeline.sml
2 changes: 2 additions & 0 deletions lib/lunarml/ml/basis/pipeline.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
infix 0 |>
fun x |> f = f x;

0 comments on commit 292e86b

Please sign in to comment.