If you know that the string is a valid integer, or you don’t mind it blowing up if that’s not the case, read will work. If you are unfamiliar with Haskell’s typeclasses, just know that you might have to tell Haskell what type you want to read it as:
main :: IO ()
main = do
let x = read "271" :: Integer
print x
You don’t always have to do this, if Haskell has some other way of knowing what type you want, like if you proceed to do arithmetic with it.
If you don’t know for sure that the string is a valid number, recent versions of base (not sure since when) include a function readMaybe that will safely return Nothing if it is not a readable integer.