- 
      
- 
        Save Centaur/0b54e2847cf83fe5bc28 to your computer and use it in GitHub Desktop. 
    Using scala-reflect to desugar
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | scala> import scala.reflect.runtime.universe._ | |
| import scala.reflect.runtime.universe._ | |
| scala> showCode(reify { | |
| | for{ | |
| | x <- 1 to 5 | |
| | _ = print("hi") | |
| | } print(x) | |
| | }.tree) | |
| res1: String = | |
| Predef.intWrapper(1).to(5).map(((x) => { | |
| val x$1 = Predef.print("hi"); | |
| Tuple2.apply(x, x$1) | |
| }))(IndexedSeq.canBuildFrom).foreach(((x$2) => (x$2: @unchecked) match { | |
| case Tuple2((x @ _), _) => Predef.print(x) | |
| })) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment