How to validate string format with scala in compile time -
my function has 1 parameter , type string lenght 4, can validate parameter in compile time?
in haskell , f# have type level , can validation in compile time, nonemptylist.
how make in scala. think shapless can don't understand
thank advance suggestion
yes, shapeless can this. perhaps this:
def f(s: sized[indexedseq[char], nat._4]): ...
you wouldn't able pass strings directly this, though. you'd have f(sized('a', 'b', 'c', 'd'))
Comments
Post a Comment