real world scalaz

Download Real World Scalaz

Post on 22-Nov-2014

1.790 views

Category:

Technology

2 download

Embed Size (px)

DESCRIPTION

Real World Scalaz

TRANSCRIPT

  • 1. REAL WRLD SCALAZ http://speakerdeck.com/u/jrwest/p/real-world-scalazchanged talk title (practical scalaz by Chris Marshall http://skillsmatter.com/podcast/scala/practical-scalaz-2518)
  • 2. If you are thinking of using Scalaz, stop now while you still have your sanity"* context: java devs learning scala* source: http://zeroturnaround.com/blog/scala-sink-or-swim-part-1/#scalaz
  • 3. How does this help you ship features or improve your product?* context: commenting on the use of lenses* source: https://twitter.com/#!/coda/status/167794305107361796)
  • 4. It will not immediately help you write better programs that are easy to understand* hear/read this often* source: http://zeroturnaround.com/blog/scala-sink-or-swim-part-1/#scalaz
  • 5. There are two types of [libraries]: the ones people hate and the ones nobody uses - unknown* applies to scala too* know correct attribution? contact me
  • 6. HOW & WHY?* those quotes pretty much boil down to these two questions:* how: apply tools given by scalaz to real world problems? to handle human scale?* why would we choose this solution over other ones?
  • 7. @_jrwest github.com/jrwest blog.loopedstrange.com* a little context before we talk about the how & why?
  • 8. I WORK @* small team, < 15 engineers* many have java bg, but not all, most w/ little to no scala experience* most have oop bg, varying knowledge of FP topics
  • 9. WE USE SCALA { a lot }* 15+ public facing services supported by many other internal modules/libs* most built on netty, also I/O bound* originally java, now > 70% scala
  • 10. libraryDependencies += org.scalaz %% scalaz-core % 6.0.3* almost all our services depend on scalaz* usage levels and parts of scalaz used vary among services* blocked on upgrading to 6.0.4 b/c of binary compatibility issues
  • 11. SOMEEXAMPLES
  • 12. JSON Mapping def Fi leMani def re festJS ad(jso ONR = ma n: JVa new JS nifest lue) = ONR[ Ap NoId.a p I D= > F field( pplyJS ileMan jsonMa O N( ifest] f i e l d( nifest { )(json change K e y) , ) LogEnt} ryCach edJson} K e y)* lift-json-scalaz (https://github.com/lift/framework/tree/master/core/json-scalaz)* validationnel applicative, error accumulation = better user-facing errors & debugging* composition
  • 13. S @-@ A / State[S,A] for { mbE _ xis