3 ms·
* Cross Product is never needed by us. * Validation? Actually we are on HTTP so mostly a sealed trait structure is enough for us we barly use `Seq(ValidationEr
by merb 10y ago
* Cross Product is never needed by us.
* Validation? Actually we are on HTTP so mostly a sealed trait structure is enough for us we barly use `Seq(ValidationError)` from Playframework (only class constructs that manually)
* NonEmptyList - I never came across a palce where I needed NonEmptyList?!
* never needed.
Just keep in mind other languages don't have such abstractions as well (maybe haskell has, but I don't know haskell).
Some people need these high level abstractions and it's fine if you use it but most things are just syntactic sugar.
The only stupid thing is something like that:
- Future[Option[A1]]
- Future[Option[A2]]
...
- Future[Option[AN]]
and now I need a `case Some((a1, a2)) =>` without some magic you write a lot of boilerplate.
So a Monad is really something that would be great and probably we will evaluate if we get to use cats.
Edit: Code Snippet:
val h = (for {
ph <- OptionT(dbService.byId(id))
article <- OptionT(articleDao.by0A(ph.article))
} yield (ph, article)).map{ case (ph, article) =>
(ph.id, article.id)
}
h.value
yes this is something why we consider cats.
- codygman 10y ago> * NonEmptyList - I never came across a palce where I needed NonEmptyList?! Do you ever check the length of a list before applying a computation or dispatch based on a result list?
- merb 10y agoBasically we sometimes do. But all of that code is basically coming from either the database where we need to construct a list (which could be empty). Or it's coming from the user. I guess we have something like 30 occurences of .isEmpty/.nonEmpty in one of our codebases