I have several CSV files that I’m embedding in my program that’s necessary to run properly. This is all just fine, but in the case that I have a typo or error in one of them, I’d like the program to fail immediately when run. To do this currently, I find myself writing a whole lot of code that looks like this:
dataCsv = $(embedStringFile "res/data.csv")
data = case decodeByName dataCsv of
Left err -> error err
Right (_, rows) -> rows
I’m just curious if there’s a more “standard” way of handling this people do?
Edit: if there’s a way to do all this at compile-time that would be awesome!