How to validate string format with scala in compile time

Viewed 1182

My function has 1 parameter and type is string but lenght is 4, Can I validate this parameter in compile time?

In haskell and F# have type level and it can validation in compile time, like nonEmptyList.

How to make it in scala. I think shapless can do this but I don't understand

Thank you for advance suggestion

3 Answers
Related