I just found it in the API and would like to see one or two examples along with an explanation what it is good for.
相关问题
- Unusual use of the new keyword
- Get Runtime Type picked by implicit evidence
- What's the point of nonfinal singleton objects
- PlayFramework: how to transform each element of a
- Error in Scala Compiler: java.lang.AssertionError:
相关文章
- Gatling拓展插件开发,check(bodyString.saveAs("key"))怎么实现
- Angular Material Stepper causes mat-formfield to v
- RDF libraries for Scala [closed]
- Why is my Dispatching on Actors scaled down in Akk
- How do you run cucumber with Scala 2.11 and sbt 0.
- GRPC: make high-throughput client in Java/Scala
- Setting up multiple test folders in a SBT project
- Testing request with CSRF Token in Play framework
It looks like you'd use it when you need Haskell's
newtype
like functionality.For example, the following Haskell code:
may roughly correspond to following Scala code:
The Proxy trait provides a useful basis for creating delegates, but note that it only provides implementations of the methods in
Any
(equals
,hashCode
, andtoString
). You will have to implement any additional forwarding methods yourself. Proxy is often used with the pimp-my-library pattern:The standard library also contains a set of traits that are useful for creating collection proxies (
SeqProxy
,SetProxy
,MapProxy
, etc).Finally, there is a compiler plugin in the scala-incubator (the AutoProxy plugin) that will automatically implement forwarding methods. See also this question.