Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Free/FreeApplicative constructors private #613

Merged
merged 2 commits into from
Nov 9, 2015

Commits on Nov 8, 2015

  1. Make Free/FreeApplicative constructors private

    There are a couple of reasons this might be a good idea.
    
    Currently it's possible to observe a difference when calling
    `.map(identity)` on a `Free` instance:
    
    ```scala
    scala> import cats.free._; import cats.implicits._
    import cats.free._
    import cats.implicits._
    
    scala> def f(x: Free[Option, Int]) = x match {
         |   case Free.Pure(i) => i
         |   case _ => 0
         | }
    f: (x: cats.free.Free[Option,Int])Int
    
    scala> val x: Free[Option, Int] = Free.pure(3)
    x: cats.free.Free[Option,Int] = Pure(3)
    
    scala> f(x)
    res0: Int = 3
    
    scala> f(x.map(identity))
    res1: Int = 0
    ```
    
    Making these private also frees us up to change the internal
    representation in the future without breaking user code.
    ceedubs committed Nov 8, 2015
    Configuration menu
    Copy the full SHA
    2af29f2 View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2015

  1. Fix compile error in Trampoline.scala

    Also make TrampolineFunctions package-private, since it's just a
    workaround for a scalac bug and isn't really intended to be used
    directly.
    ceedubs committed Nov 9, 2015
    Configuration menu
    Copy the full SHA
    bc06262 View commit details
    Browse the repository at this point in the history