redirectable print for f#
| Library.fs | ||
| Readme.md | ||
| rprint.fsproj | ||
rprint - redirectable print
This emulates with-output-to-string from scheme in f# using AsyncLocal.
open Rprint.rprint
let sayHi name =
rprint "Hi, %s" name
rprintn "this prints like usual"
rprint "%s %d" "this uses a format string" 5
withOutputToString
(fun () -> rprint "this ends up in a string, and so does this"
sayHi "banana")
The source code is short enough that you should not need any documentation.
There might be async workflows where this does not do what you expect. You have been warned.
Licensed under the 0-clause BSD license.
Copyright (C) 2026 by Linus Björnstam <linus.internet@fastmail.se>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.