When should I use type level computation in scala? -


i have been studying type-level programming in scala lately, , apparently can some fancy stuff @ compile time, , that's interesting , impressive. wondering when should use these tricks (after sufficiently familiar them)?

admittedly broad question, guess not 1 thinking this, experts can shed light newbies.

the golden rule when leads safer , more elegant solution easy understand , faster implement regular solution. otherwise code in way prefer or way advised to. it's asking "when should use functional style vs imperative style?" imho it's you. solutions more natural functional , others more natural imperative. same true type level programming intrisically easier type level programming become nightmare still struggling basics.

also find lot of developed stuff style, shapeless , many other libs leverage power of scala's type system solve common problems , support powerful abstractions maybe wouldn't otherwise.

my suggestion, still struggling type level programming, start tools shapeless , first learn abstractions inherited category theory , stuff. when have many of these concepts in bag, start thinking of new solutions implement type system.

my 2 cents.


Comments