Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8480023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:11:37+00:00 2026-06-10T19:11:37+00:00

I am learning Scalaz and I have a project that already makes use of

  • 0

I am learning Scalaz and I have a project that already makes use of Scalaz7. Following this question I would like to use the function

sequence[T](l: List[Option[T]]): Option[List[T]]

(not that it is hard to write it myself). But the aforementioned question mentions Scalaz6.

Where to find the sequence function in Scalaz7?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:11:38+00:00Added an answer on June 10, 2026 at 7:11 pm

    It’s defined in the scalaz.Traverse type class, where it looks like this:

    def sequence[G[_]:Applicative,A](fga: F[G[A]]): G[F[A]] =
      traversal[G].run[G[A], A](fga)(ga => ga)
    

    scalaz.syntax.TraverseOps provides a version that gets pimped onto List, since List has a Traverse instance.

    You can either import just what you need:

    import scalaz._, std.list._, std.option._, syntax.traverse._
    

    Or everything and the kitchen sink:

    import scalaz._, Scalaz._
    

    And then you can use it like this:

    scala> val xs: List[Option[Int]] = Some(1) :: Some(2) :: Nil
    xs: List[Option[Int]] = List(Some(1), Some(2))
    
    scala> xs.sequence
    res0: Option[List[Int]] = Some(List(1, 2))
    

    Or if you want exactly the formulation in your question:

    scala> def sequence[T](l: List[Option[T]]): Option[List[T]] = l.sequence
    sequence: [T](l: List[Option[T]])Option[List[T]]
    
    scala> sequence(xs)
    res1: Option[List[Int]] = Some(List(1, 2))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning myself Play 2.0 (Java API used) and would like to have a
I recently started learning perl and have a question that I'm not finding a
I'm learning Scala, so this is probably pretty noob-irific. I want to have a
Well, I'm learning Scala so this question may be too basic for most people.
I am new to Scala, just started learning, so this is basic beginner question.
I have came from another question to this one: How can one start with
So I'm learning Scala and came across some examples like this: val doubleEven =
I'm just learning scala, and I wrote the hello,world program like this: object HelloWorld
I am learning Scala and I have a Java project to migrate to Scala.
I am learning Scala so bear with me if this is a stupid question.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.