\import Debug.Meta
\import Meta
\import Data.String
-- Prints a String as raw text and returns the optional continuation, or Unit if it is omitted.
\meta putStrLn s => putStrLnMaterialized (materialize s)
\where \private {
-- Converts any evaluable String to the constructor representation expected by the printing primitive.
\func materialize (s : String) : String
=> \new String { | bytes => materializeBytes s.bytes }
\func materializeBytes (bytes : Array Byte) : Array Byte \elim bytes
| nil => nil
| byte :: bytes => byte :: materializeBytes bytes
}
\meta runTimed m => run {
\let t => time,
\let x => nf m,
println (time Nat.- t),
x
}