Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9314635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:10:57+00:00 2026-06-19T02:10:57+00:00

So I’ve been trying to learn Scala through the twitter Scala school . But

  • 0

So I’ve been trying to learn Scala through the twitter Scala school. But I’m currently stuck at one of their type bound examples.

In particular, it’s the one where the type is bound to be viewable as a certain type, using the <%< type-relation operator.

When I execute the following code in my Scala console:

scala> class Container[A](value: A) { def addIt(implicit evidence: A <%< Int) = 123 + value }

… I get the following errors:

<console>:7: error: not found: type <%<
       class Container[A](value: A) { def addIt(implicit evidence: A <%< Int) = 123 + value }
                                                                     ^
<console>:7: error: overloaded method value + with alternatives:
  (x: Double)Double <and>
  (x: Float)Float <and>
  (x: Long)Long <and>
  (x: Int)Int <and>
  (x: Char)Int <and>
  (x: Short)Int <and>
  (x: Byte)Int <and>
  (x: String)String
 cannot be applied to (A)
       class Container[A](value: A) { def addIt(implicit evidence: A <%< Int) = 123 + value }

My question is, why is the Scala interpreter complaining?

I’ve been trying to look through the Scala documentation but I haven’t been able to find information that operator anywhere. I can see that the Scala school was created on the basis of Scala 2.8.0, and I’m running Scala 2.10.0 – so maybe this have been removed? If this is the case, why is this as it seems like a useful operator?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T02:10:58+00:00Added an answer on June 19, 2026 at 2:10 am

    The constraint A <%< B in Scala 2.8 is defined as

      sealed abstract class <%<[-From, +To] extends (From => To)
      object <%< {
        implicit def conformsOrViewsAs[A <% B, B]: A <%< B = new (A <%< B) {def apply(x: A) = x}
      }
    

    So you can always bring it back that way. However, I’m guessing that the reason it’s deprecated is that a view bound is just asking for an implicit function from A to B, and there’s a perfectly good way to express that particular constraint in a generalised way already:

    class Container[A](value: A) { def addIt(implicit evidence: A => Int) = 123 + value }
    

    As an aside, it’s worth noting that is isn’t an operator, but a class in infix position as you can see from the definition. The same is true for =>, which is just another way of referencing the Function1 type constructor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to loop through a bunch of documents I have to put
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:
This could be a duplicate question, but I have no idea what search terms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.