Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.
chrislewis edited this page Sep 6, 2011 · 3 revisions

Output Operators

The output operators are all prefixed with : for consistency and equal precedence. They are as follows:

:#|, :|, ::| :>, :>>

The first three are called the general, string, and string list pipes, and the other two are the file redirect and concatenating redirect.

The most important of these is :#|, in terms of which all other output operators can be defined.

:#|

The :#| or general pipe operator, as its name suggests, is the most general of the pipe operators. At a glance, the DSL appears to invoke some magic to get the output of a remote command into the format required by the function at the other end of the pipe. For example:

ssh("echo 5" :#| { (_:Int) + 1 })

It isn't immediately obvious, but :#| requires a special implicit function with a compatible type to be in scope. These functions are StreamProcessorS, which are nothing more than impure functions of type InputStream => A, where A is some arbitrary type. StreamProcessor is a type class of which common instances are implicitly provided as members of the base rugu package object.

Input Operator

Command instances provide the input pipe operator |:; a right associative operator that takes a string to be used as input to the command.

Clone this wiki locally