I'm trying to fint the Haskell equivalent of the Python:
>>>"This is a test"[5:9]
'is a'
I'm using the Data.Text
module, if that makes any difference.
Also, you can define the function in terms of Data.Text.take
and drop
, both functions from Data.Text
library:
slice :: Int -> Int -> Text -> Text
slice a b = (Data.Text.take (b - a)) . (Data.Text.drop a)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With