I am working inside a sandbox with ghc 7.10.3 and I have this simple code:
main :: IO ()
main = do
args <- getArgs
case args of
[ newOauthConsumerKey, newOauthConsumerSecret ] -> do
let appOauth = newOAuth { oauthServerName = "api.twitter.com"
, oauthConsumerKey = newOauthConsumerKey
, oauthConsumerSecret = newOauthConsumerSecret
}
...
when I compile it with these dependencies in my cabal file:
base
, authenticate-oauth
, http-conduit
, aeson
, text
I keep on get (after cleaning and rebuilding the sandbox) the following errors:
src/Test/Main.hs:60:55:
Couldn't match type ‘[Char]’
with ‘bytestring-0.10.6.0:Data.ByteString.Internal.ByteString’
Expected type: bytestring-0.10.6.0:Data.ByteString.Internal.ByteString
Actual type: String
In the ‘oauthConsumerKey’ field of a record
In the expression:
newOAuth
{oauthServerName = "api.twitter.com",
oauthConsumerKey = newOauthConsumerKey,
oauthConsumerSecret = newOauthConsumerSecret}
src/Test/Main.hs:61:55:
Couldn't match type ‘[Char]’
with ‘bytestring-0.10.6.0:Data.ByteString.Internal.ByteString’
Expected type: bytestring-0.10.6.0:Data.ByteString.Internal.ByteString
Actual type: String
In the ‘oauthConsumerSecret’ field of a record
In the expression:
newOAuth
{oauthServerName = "api.twitter.com",
oauthConsumerKey = newOauthConsumerKey,
oauthConsumerSecret = newOauthConsumerSecret}
I have already googled and checked different similar answers but I cannot make it work. Any idea?
Solution
The problem was due to the fact that in the code there was an import for import Data.Text
that includes a pack
which is different from the pack
required for Data.ByteString.Char8
. Once I have included it, it worked.