Could someone explain the syntax for the case h :: t. In particular to the 
right of the => h flatmap. I'm confused where we have a space between h and 
flatmap. 

>From what I understand h is of type Option[A] and not sure what flatmap 
should be. 

Likewise for inside the flatmap right of the =>. sequence(t) map(...). The 
space between sequence(t) and map(...).

def sequence[A](a: List[Option[A]]): Option[List[A]] =
  a match {
    case Nil => Some(Nil)
    case h :: t => h flatMap (hh => sequence(t) map (hh :: _))
  }


https://github.com/fpinscala/fpinscala/blob/master/answerkey/errorhandling/04.answer.scala

Thanks,
Tony

-- 
You received this message because you are subscribed to the Google Groups 
"scala-functional" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to scala-functional+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to