Trouble running simple slurp

30 views
Skip to first unread message

Andy Hull

unread,
Aug 15, 2014, 8:21:57 PM8/15/14
to raptur...@googlegroups.com
I have a trivial example I'm trying to get running:

import rapture.io._
import rapture.core._
import rapture.uri._
import rapture.net._
import rapture.fs._
import strategy.throwExceptions

object ReleaseScribe extends App { uri"http://rapture.io".slurp[Char] }

Compiling this hits the following error:

Cannot find implicit StreamReader for rapture.net.HttpUrl resources. rapture.net.HttpUrl resources can only be read if a StreamReader implicit exists within scope.

What am I doing wrong here?

Cheers,

--Andy

Jon Pretty

unread,
Aug 16, 2014, 1:06:56 PM8/16/14
to raptur...@googlegroups.com
So, what you've written there is all good, except it doesn't know how to interpret bytes as characters, so you'll need to specify a character encoding.

In Rapture 0.10 (as-yet unreleased) this is done with:

   import encodings.`UTF-8` // or whatever encoding you prefer!

though in Rapture 0.9 (which I think is what you're using) you'll need this somewhere in scope:

   implicit val enc = Encodings.`UTF-8`


I realised that the error message you saw isn't that helpful at pointing you towards the missing encoding being the problem, so in later versions, the message does tell you that you need an encoding if you're working with `Char`s!

Cheers,
Jon

Jon

Andy Hull

unread,
Aug 18, 2014, 1:34:05 PM8/18/14
to raptur...@googlegroups.com
Ah that's awesome. That's what I was missing!

Thanks,

--Andy


--
You received this message because you are subscribed to a topic in the Google Groups "Rapture users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rapture-users/YjuFMg-KfC4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rapture-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages