In the "text" package, the signature of Data.Text.replace always sends me looking into the haddocks:
replace :: Text -> Text -> Text -> Text
Which argument is the text to replace, which is the replacement and which is the text that should be scanned?
Imagine a generalized version of replace that 1) works on streams, and 2) allows replacing a sequence of texts (like, say, chapter headers) instead of replacing the same text repeatedly. It could have the following signature:
replace' :: Stream (Stream (Of Text) m) m ()
-> Stream (Stream (Of Text) m) m Void
-> Stream (Of Text) m r
-> Stream (Of Text) m r
Do you find easy to intuit, just by looking at that signature, which is the function of each argument?