It would be cool to have some way to do search + replace on Text values and the simplest way to do it I can think of is a Text/split primitive.
let split : Text -> Text -> List Text = \sep -> \input -> Text/split sep input
with this, replacing a character (or a longer sequence) can be defined in dhall (could be added to the prelude):
let replace = \(old : Text) -> \(new : Text) -> \(input : Text) ->
prelude.`Text`.concatSep new (Text/split old input)
I don't have time right now to implement this myself, so I am opening this issue
I've been holding off as long as possible on standardizing support for parsing and introspection on Text values. The main reason is to catch more input failures at type-checking time rather than at run time (i.e. via Optional values). Also, I prefer requiring that the input is a more structured representation than a string in order to ensure that invalid inputs are unrepresentable
However, I do maintain a wiki page explaining how you can add your own built-ins if necessary here: https://github.com/dhall-lang/dhall-lang/wiki/Built-in-types,-functions,-and-operators
Yeah, I think the current design works well and I agree that this should be held off
Most helpful comment
I've been holding off as long as possible on standardizing support for parsing and introspection on
Textvalues. The main reason is to catch more input failures at type-checking time rather than at run time (i.e. viaOptionalvalues). Also, I prefer requiring that the input is a more structured representation than a string in order to ensure that invalid inputs are unrepresentableHowever, I do maintain a wiki page explaining how you can add your own built-ins if necessary here: https://github.com/dhall-lang/dhall-lang/wiki/Built-in-types,-functions,-and-operators