Re: [Haskell-cafe] ByteString typechecking issues....

Not in scope: `Data.ByteString.join'
when
Data.ByteString.join $
encode (buildHeader ss) --
ByteString
-- []
(map encode (buildEntries (sequenceListExtract ss)))
-- [ByteString]
??
Thanks, guys
On Sat, Dec 27, 2008 at 3:13 AM, Eugene Kirpichov
I think Luke meant that you forgot to qualify the import for join, and the compiler guessed that you are meaning the monad one, thus the error.
2008/12/27 Galchin, Vasili
: Hi Luke,
join :: ByteString -> [ByteString] -> ByteString ???
Vasili
On Sat, Dec 27, 2008 at 1:58 AM, Luke Palmer
wrote: 2008/12/26 Galchin, Vasili
Hello,
I have a ByteString -> [ByteString] -> ByteString situation, i.e. concatenation .....
-- marshall into ByteString representation join (encode (buildHeader ss)) -- ByteString (map encode (buildEntries (sequenceListExtract ss))) -- [ByteString]
I get the following typecheck error which is vexing me ....
Couldn't match expected type `t -> t -> B.ByteString' against inferred type `B.ByteString'
???
join is not a function in Data.ByteString. By the error I'm guessing you're getting the join from Control.Monad, instantiated to (->). You are looking for "concat"; i.e. concat $ encode (buildHeader ss) : -- ByteString map encode (buildEntries (sequenceListExtract ss)) -- [ByteString]
(Control.Monad.join does end up meaning"concat" when working on lists of lists, but it does not generalize to lists of other things). Luke
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Am Samstag, 27. Dezember 2008 18:42 schrieb Galchin, Vasili:
Not in scope: `Data.ByteString.join'
when
Data.ByteString.join $ encode (buildHeader ss) -- ByteString -- [] (map encode (buildEntries (sequenceListExtract ss))) -- [ByteString]
??
Maybe you're looking for Data.ByteString.intercalate?

On 2008 Dec 27, at 12:42, Galchin, Vasili wrote:
Not in scope: `Data.ByteString.join'
Why are you trying to use join? It's not a string function; it's a function on lists which accidentally does something useful on normal Strings because they're implemented as lists. ByteStrings aren't lists, so there is no useful join, and ghc finds an instantiation of join somewhere else and does something unexpected as a result. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

2008/12/27 Brandon S. Allbery KF8NH
On 2008 Dec 27, at 12:42, Galchin, Vasili wrote:
Not in scope: `Data.ByteString.join'
Why are you trying to use join? It's not a string function; it's a function on lists which accidentally does something useful on normal Strings because they're implemented as lists. ByteStrings aren't lists, so there is no useful join, and ghc finds an instantiation of join somewhere else and does something unexpected as a result.
It looks like in the docs he is looking athttp://cvs.haskell.org/Hugs/pages/libraries/base/Data-ByteString.html#v%3Ajo..., join is the name of intercalate. Use intercalate. Luke

Brandon, I am solely operating based on the type signatures of function .. hence I picked Data.ByteString.Join :: ByteString -> [ByteString] -> ByteString ....... Vasili On Sat, Dec 27, 2008 at 2:21 PM, Brandon S. Allbery KF8NH < allbery@ece.cmu.edu> wrote:
On 2008 Dec 27, at 12:42, Galchin, Vasili wrote:
Not in scope: `Data.ByteString.join'
Why are you trying to use join? It's not a string function; it's a function on lists which accidentally does something useful on normal Strings because they're implemented as lists. ByteStrings aren't lists, so there is no useful join, and ghc finds an instantiation of join somewhere else and does something unexpected as a result.
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
participants (4)
-
Brandon S. Allbery KF8NH
-
Daniel Fischer
-
Galchin, Vasili
-
Luke Palmer