
I read inputs from files into various data types. Not all of the information is known at input time, so some of the data for a type needs to be derived. The question is: what is the best way of "guarding" between derived and underived data? By that I mean, there is a function which will derive missing data, and other functions can only work on derived data. Working on underived data would be a mistake.

Mark Carter
I read inputs from files into various data types. Not all of the information is known at input time, so some of the data for a type needs to be derived. The question is: what is the best way of "guarding" between derived and underived data?
By that I mean, there is a function which will derive missing data, and other functions can only work on derived data. Working on underived data would be a mistake.
That seems like the straight-up definition of two data types: data Raw = Raw (Maybe Int) Text (Maybe Text) data Cooked = Cooked Text oven :: Raw -> Cooked -- Can't pass Raw data to consumer consumer :: Cooked -> Result Mike.
participants (2)
-
Mark Carter
-
Michael Alan Dorman