Thank you, that's helpful! Indeed that's not as much boilerplate as I expected.
I did solve today's problem already, I just didn't take advantage of the type
system and got an error from it at some point that could have been avoided.
I did:
for line in lines("input.txt"):
let info = line.split(" ")
var (hand, bid) = (info[0], info[1].parseInt())
let score = getScore(line) # <- spot the error here
# I'm passing line instead of hand, and since my hand is just a string
just like line,
# it's happy to do its work and output a wrong value without erroring
Run
Still I wonder, on a general basis, if there is a way to enforce more esoteric
constraints (some that might not fit in existing types) in a type?