The best way I've come up with so far to make a list that traverses a Text backwards is:
import Data.Text (Text, unsnoc)
unpackReverse :: Text -> String
unpackReverse = maybe [] (\(xs, x) -> x : unpackReverse xs) . unsnoc
Is there a way to make this substantially more efficient? Would it be worth adding to the library?
The best way I've come up with so far to make a list that traverses a
Textbackwards is:Is there a way to make this substantially more efficient? Would it be worth adding to the library?