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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -