Types are erased; they don't exist are runtime. So, if the user is going to provide input at runtime to determine the processed data, you don't select that data via types (or type class instances).
You probably just want to have Cassava give you a [[Text]]
value (FromRecord [Text]
is provided by the library, you don't have to write it), then present the header line to the user, then process the data based on what they select. Just do the simple thing.
If the CSV file is too big to fit into memory, you might use Incremental module to read just the first record as a [Text]
, present that to the user, and then use their input to guide the rest of the processing. But, I wouldn't mess with that until after you have the small case worked out fairly well first.