[Haskell-cafe] ByteString typechecking issues....
Galchin, Vasili
vigalchin at gmail.com
Sat Dec 27 12:42:35 EST 2008
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 <ekirpichov at gmail.com>wrote:
> 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 <vigalchin at gmail.com>:
> > Hi Luke,
> >
> > join :: ByteString -> [ByteString] -> ByteString ???
> >
> > Vasili
> >
> > On Sat, Dec 27, 2008 at 1:58 AM, Luke Palmer <lrpalmer at gmail.com> wrote:
> >>
> >> 2008/12/26 Galchin, Vasili <vigalchin at gmail.com>
> >>>
> >>> 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 at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081227/b9106051/attachment.htm
More information about the Haskell-Cafe
mailing list