typelevel / cats

Lightweight, modular, and extensible library for functional programming.
https://typelevel.org/cats/
Other
5.26k stars 1.21k forks source link

Proper universally quantified `const` #401

Open adelbertc opened 9 years ago

adelbertc commented 9 years ago

Would something like this be useful/belong in Cats and if so where would it belong?

def const[A](a: A): ConstAux[A] = new ConstAux(a)
final class ConstAux[A] private[cats](a: A) {
  def apply[B](b: => B): A = a
}
TonioGela commented 2 years ago

7 years later answer: wasn't it implemented as Const?