David McBride wrote:
> Why not have:

> data Question = Question
>     { questionName    :: Name
>     , questionText    :: QuestionText
>     , questionType    :: QuestionType
>     , answerFunc      :: (String -> AnswerType)
>     , correctAnswer  :: Maybe AnswerType
>     , options        :: Maybe [Option AnswerType]
>     } deriving (Show)

> data AnswerType = AnsD Double | AnsS String | AnsI Integer
>                   deriving (Show, Read)

> Then, I'd personally make another change, why would you have a flat
> structure with a questionType and then optional correctAnswer and
> options fields?  There's no type safety in that.  I'd try:

> data Answer = StraightAnswer (String -> AnswerType) | MultipleChoice
> AnswerType [Option AnswerType]

> data Question = Question
>     { questionName    :: Name
>     , questionText    :: QuestionText
>     , answerFunc      :: (String -> AnswerType)
>     , answer              :: Answer
>     } deriving (Show)

> If you are storing answers as string, just store them as "AnsD 5.589",
> "AnsS \"Constantiople\"".  Then with the read instance you can go:

> let answer = read x :: AnswerType

Thank you very much for the reply which is eye-opening. But I do have to spend time
implementing your revised schema in the prior question handling functions to
get my head around it  (-:

Best,

Alia