Scala does not recognize LazyList type?

I tried to import every single type in scala.collection.immutable, one by one, as they are here. Note that LazyList is not mentioned there in the official documentation. But here’s the output:

edit: I’m running popOS 20.10

Welcome to Scala 2.13.0-M1 (OpenJDK 64-Bit Server VM, Java 11.0.10).
Type in expressions for evaluation. Or try :help.

    scala> import scala.collection.immutable.Stream
    import scala.collection.immutable.Stream
    
    scala> import scala.collection.immutable.List
    import scala.collection.immutable.List
    
    scala> import scala.collection.immutable.Vector
    import scala.collection.immutable.Vector
    
    scala> import scala.collection.immutable.Stack
    import scala.collection.immutable.Stack
    
    scala> import scala.collection.immutable.Queue
    import scala.collection.immutable.Queue
    
    scala> import scala.collection.immutable.Range
    import scala.collection.immutable.Range
    
    scala> import scala.collection.immutable.HashMap
    import scala.collection.immutable.HashMap
    
    scala> import scala.collection.immutable.TreeSet
    import scala.collection.immutable.TreeSet
    
    scala> import scala.collection.immutable.BitSet
    import scala.collection.immutable.BitSet
    
    scala> import scala.collection.immutable.ListMap
    import scala.collection.immutable.ListMap
    
    scala> import scala.collection.immutable.LazyList
    <console>:21: error: object LazyList is not a member of package scala.collection.immutable
           import scala.collection.immutable.LazyList
                  ^
    
    scala> 

As you can see, LazyList is the only one that is not being imported. Did they remove this type? It exists in the Scala Standard Library wesite, but it’s not mentioned on the first link I posted. As you can see, it seems it’s the only one failing to be imported.

You are using a milestone release (Scala 2.13.0-M1). Probably LazyList didn’t existed a that point or was in another location.

Use a stable release like 2.13.0 (or even better the latest 2.13.4) and that should fix the problem.

Also, you should have mentioned that on your SO question.

2 Likes

Thank you, @BalmungSan ! That solved the problem! Have a great day.