title: Data.ByteString.Lazy.Internal.ByteString to string?
body: <p>Trying to write a module which returns the external IP address of my computer.
  Using <code>Network.Wreq</code> <code>get</code> function, then applying a lense to obtain <code>responseBody</code>, the type I end up with is <code>Data.ByteString.Lazy.Internal.ByteString</code>. As I want to filter out the trailing "\n" of the result body, I want to use this for a regular expression subsequently.
  Problem: That seemingly very specific ByteString type is not accepted by regex library and I found no way to convert it to a <code>String</code>.</p>
  
  <p>Here is my feeble attempt so far (not compiling).</p>
  
  <pre><code>{-# LANGUAGE OverloadedStrings #-}
  
  module ExtIp (getExtIp) where
  import Network.Wreq
  import Control.Lens
  import Data.BytesString.Lazy
  import Text.Regex.Posix
  
  getExtIp :: IO String
  getExtIp = do
      r &lt;- get "http://myexternalip.com/raw"
      let body = r ^. responseBody
      let addr = body =~ "[^\n]*\n"
      return (addr)
  </code></pre>
  
  <p>So my question is obviously: How to convert that funny special ByteString to a <code>String</code>? Explaining how I can approach such a problem myself is also appreciated. I tried to use <code>unpack</code> and <code>toString</code> but have no idea what to import to get those functions if they exist.</p>
  
  <p>Being a very sporadic haskell user, I also wonder if someone could show me the idiomatic haskell way of defining such a function. The version I show here does not account for possible runtime errors/exceptions, after all.</p>