Logo

Programming-Idioms

History of Idiom 46 > diff from v14 to v15

Edit summary for version 15 by :

Version 14

2015-09-02, 16:54:32

Version 15

2015-09-02, 16:55:48

Idiom #46 Extract beginning of string (prefix)

Create string t consisting of the 5 first characters of string s.

Idiom #46 Extract beginning of string (prefix)

Create string t consisting of the 5 first characters of string s.

Imports
import qualified Data.Text as T
Imports
import qualified Data.Text as T
Code
t :: T.Text
t = T.take 5 s
Code
t :: T.Text
t = T.take 5 s
Comments bubble
This implementation uses the Text type, imported as suggested in the Text library documentation.
Comments bubble
This implementation uses the Text type, imported as suggested in the Text library documentation.
Doc URL
https://hackage.haskell.org/package/text