简体   繁体   中英

Scalaz and the REPL

I've successfully added scalaz to scala repl (2.9.1) and tried some basic examples with no problem, like : List(10, 20, 30) <*> (List(1, 2, 3) map ((_: Int) * (_: Int)).curried)

or

List(10, 20, 30) |@| List(1, 2, 3) apply (_ * _)

However, the alias for map, namely °, as seen in this example http://scalaz.github.com/scalaz/scalaz-2.9.1-6.0.4/doc.sxr/scalaz/example/ExampleApplicative.scala.html#23569

is not recognized, I got a

error: value ° is not a member of List[Int]

Maybe I'm using the wrong character ? A copy-paste from the example above gobble the special characters...

Any guidance would be greatly appreciated ! :)

Yes, you are indeed using the wrong character. It is not ° .

scala> val f: Int => String = _.toString
f: Int => String = <function1>

scala> List(1,2) ∘ f
res2: List[String] = List(1, 2)

edit: Is your encoding in terminal and java set to UTF8?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM