Created
September 11, 2019 20:28
-
-
Save blast-hardcheese/a63471fc3394d276b9eaf052ead72c75 to your computer and use it in GitHub Desktop.
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
import scala.meta._ | |
val classdef = q"case class Foo(..${(1 until 30).map({ i => Term.Param(Nil, Term.Name(s"a$i"), Some(Type.Name("Int")), None) }).toList})" | |
val exampleParameters: List[List[(Term.Param, Int)]] = (1 until 30).map({ i => param"${Term.Name(s"a$i")}: Int" }).zipWithIndex.toList.grouped(22).toList | |
exampleParameters.foldLeft((1, List.empty[List[Term]])) { case ((drop, acc), next) => | |
val first: List[Lit.Int] = next.map({ case (_, foo) => TermLit.Int(foo) }) | |
val rest: List[Term.Ascribe] = exampleParameters.drop(drop).flatten.map(_._1).map { case param"$_: ${Some(tpe)}" => q"_: $tpe" } | |
(drop + 1, acc :+ (first ++ rest)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This isn't complete, but the intent is to get it to a state where it can produce
this is for guardrail-dev/guardrail#382 (comment)