Create an executable file that copies stdin to stdout, or else a script that does so through the invocation of an interpreter at the command line.

 
 
:- module stdin_to_stdout.
:- interface.
 
:- import_module io.
 
:- pred main(io::di, io::uo) is det.
 
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
 
:- implementation.
 
:- import_module char.
:- import_module list.
:- import_module string.
 
%-----------------------------------------------------------------------------%
 
 
 
main(!IO) :-
    io.read_line_as_string(Result, !IO),
    (
        Result = ok(Line),
        io.write_string(Line, !IO),
        main(!IO)
    ;
        Result = eof
    ;
        Result = error(Error),
        io.error_message(Error, Message),
        io.input_stream_name(StreamName, !IO),
        io.progname("stdin_to_stdout", ProgName, !IO),
        io.write_strings([
            ProgName, ": ",
            "error reading from `", StreamName, "': \n\t",
            Message, "\n"
        ], !IO)
    ).
 
%-----------------------------------------------------------------------------%
 