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

Using enableIf to simplify code for compat purpose #124

Open
da-tubi opened this issue Apr 2, 2022 · 1 comment
Open

Using enableIf to simplify code for compat purpose #124

da-tubi opened this issue Apr 2, 2022 · 1 comment
Assignees
Labels

Comments

@da-tubi
Copy link

da-tubi commented Apr 2, 2022

Task

Summary

Using enableIf to simplify code for compat purpose

Project Details

Version: latest

Description

Use enableIf to switch Scala code at compile-time.

import com.thoughtworks.enableIf

@enableIf(scala.util.Properties.versionNumberString.startsWith("2.10."))
implicit class FlatMapForTailRec[A](underlying: TailRec[A]) {
  final def flatMap[B](f: A => TailRec[B]): TailRec[B] = {
    tailcall(f(underlying.result))
  }
}

https://github.com/ThoughtWorksInc/enableIf.scala#step-2-create-an-implicit-class-for-scala-210

@kevin-lee
Copy link
Owner

Thanks. It looks good. I'll have a look at it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants