Caffeine sharpens mind but not body, ADF research shows
theaustralian.com.au1 pointsby hhandoko0 comments
result = success(comment_params)
~>> fn p -> link_reply_to_id(p) end
~>> fn p -> create_changeset(p) end
~>> fn cs -> assert_changeset(cs) end
~>> fn cs -> insert_changeset(cs) end (for {
user <- currentUser(...)
group <- groups.fetchForUser(...)
friend <- friendships.fetchFriend(...)
member <- groups.addMember(...)
} yield {
render(...)
}).recover {
case e: Exception -> ...
} scala> val list = 1 :: 2 :: Nil
list: List[Int] = List(1, 2)
scala> val x = list match {
| case head :: _ => head
| case _ => 0
| }
x: Int = 1
scala> val seq = 1 +: Seq(2, 3) :+ 4
seq: Seq[Int] = List(1, 2, 3, 4)
scala> val y = seq match {
| case a +: _ :+ b => a + b
| case _ => 0
| }
y: Int = 5
It can be a bit confusing at first, especially for mutable vs immutable collection operators. But you end up remembering some, if not most of it, after using them a number of times. val aFuture = future(a)
val bFuture = future(b)
(for {
a <- aFuture
b <- bFuture
c <- futureC(a, b)
} yield c)
This is just a contrived example for working with `Future[T]`, but it can be applied to other monadic types.
https://www.motorist.sg/coe-results https://bydcars.sg/wp-content/uploads/2025/01/BYD-Pricelist-...