Honestly, I think it sounds like you need to think a little, because the example is clearly not functional and not particularly fluent. It seems you can mix fluency with non-idempotency in the sense that your debugPrint method seems to do I / O and throwIfError throws exceptions. Is that what you mean?
If you mean whether the constructor works with state, the answer is "not in the pure sense." However, note that the builder does not have to be workable.
case class Person(name: String, age: Int)
At first; this can be created using named parameters:
Person(name="Oxbow", age=36)
Or, stateless creator:
object Person { def withName(name: String) = new { def andAge(age: Int) = new Person(name, age) } }
Hi Preko:
scala> Person withName "Oxbow" andAge 36
Regarding the use of untyped strings to define the query you are making; it is a bad form in a statically typed language. Moreover, there is no need:
sealed trait Query case object orders extends Query def get(query: Query): Result
Hi Preko:
api get orders
Although, I think this is a bad idea - you should not have a single method that can give you completely different types of results
In conclusion: I personally think that there is no reason that fluency and functionality cannot be mixed, because the functional simply indicates the absence of a volatile state and a strong preference for idempotent functions to fulfill your logic.
Here is one for you:
args.map(_.toInt) args map toInt
I would say that the second one is more fluent. This is possible if you define:
val toInt = (_ : String).toInt
I.e; if you define a function. I believe that function and fluency work well in Scala.