Say I have the following types:
type EndsTup = (Int,Int)
-- (0-based index from start or end, Frequency)
type FreqTup = (Char, [EndsTup], [EndsTup])
-- (Character, Freqs from start, Freqs from end)
type FreqData = [FreqTup]
-- 1 entry in the list for each letter
Which I'm using to store data regarding the frequency of a character's position in a word. If I want to then save this to file, is it safe (as in guaranteed not to corrupt if it's written without error) to convert the structure to a string using show, and then read it using something like:
readData <- readFile filePath
let reconstructed = read readData :: FreqData
I'm just asking because that seems "too easy". Is this how it's typically done?