Compound Implicits

I’m wondering if anyone’s come up with a good design pattern for interfaces with generic resources, where you might need more than one. For instance

trait Downloader[Resource] {
  def download()(implicit r: Resource) ...

is fine if you just have something like an Amazon S3 client, but what if the destination of the download requires yet another resource. Then you need two resources.

case class MyResources(s3: AmazonS3, fs: FileSystem)

Inside download() I’m going to call methods that specifically require a FileSystem. To facilitate that I need an implicit method from MyResources to FileSystem. Which is fine for a one-off, but doing this over and over is obnoxious.

What I’m looking for is something equivalent to

trait Downloader[Resource0, Resource1, ...] {
  def download()(implicit r0: Resource0, r1: Resource1, ...) ...

Maybe something in shapeless that lets you pull a value from an HList by type? Like

implicit def hImplicitly[A, L <: HList](implicit l: L): A