This is not currently possible with the existing Dhall built-in functions. The Text
type is conceptually opaque, similar to Double
. The only thing you can do with values of type Text
is concatenate them, but you cannot introspect, parse, or compare them for equality.
My original rationale for limiting Text
in this way is that the language encourages upstreaming strongly typed representations into its inputs. For example, instead of splitting the string, require that the string has already been split (i.e. expect an input of type List Text
instead of Text
). However, this could change at some point because the standard is not set in stone and evolves over time through the process outlined here:
Also, even without making changes to the language you can still experiment by extending the language with your own built-ins using the Haskell API by following this guide:
Edit: One thing changed since writing this comment, which is that the language now supports a Text/replace
builtin, so even though you still can't split a string you can replace one delimiter with another one. For example:
⊢ Text/replace " " "," "Foo Bar Baz"
"Foo,Bar,Baz"