implicit StreasmReader

25 views
Skip to first unread message

Alexandre Masselot

unread,
Sep 2, 2014, 4:15:57 AM9/2/14
to raptur...@googlegroups.com
Hello 

I really like the idea of rapture.

Nevertheless, I hit a wall with the hello world example
import rapture.core._
import rapture.uri._
import rapture.json._
import rapture.io._
import rapture.fs._
import rapture.net._
import rapture.core.strategy.throwExceptions
import platform.posix
import Encodings.`UTF-8`


val url: HttpUrl = (Http / "rapture.io" / "sample.json")
url.slurp[Char]

Returns:

Error:(14, 11) Cannot find implicit StreamReader for rapture.net.HttpUrl resources. rapture.net.HttpUrl resources can only be read if a StreamReader implicit exists within scope.
url.slurp[Char]
Error:(14, 11) not enough arguments for method slurp: (implicit accumulatorBuilder: rapture.io.AccumulatorBuilder[Char], implicit eh: rapture.core.ExceptionHandler, implicit sr: rapture.io.StreamReader[rapture.net.HttpUrl,Char], implicit mf: scala.reflect.ClassTag[Char])eh.![accumulatorBuilder.Out,Exception].
Unspecified value parameters sr, mf.
url.slurp[Char]
         ^
Thanks for the help
Alex

Jon Pretty

unread,
Sep 4, 2014, 9:21:14 PM9/4/14
to raptur...@googlegroups.com
Thanks, Alex!

And sorry for the delay in responding.

It looks like you're using the 0.9.x version, and it can't find an implicit character encoding within scope. But you're importing Encodings.`UTF-8`!

In 0.9.x, the encodings in the `Encodings` object are not implicit. So you need to define the encoding using:

  implicit val enc = Encodings.`UTF-8`

Once I get the 0.10.0 modules released, you'll be able to import an encoding using:

  import encodings.`UTF-8`

(Note the lower-case 'e'.)

Cheers,
Jon
Reply all
Reply to author
Forward
0 new messages