I have a record that is supplied by the user:
type alias Model =
{ age : String,
weight : String,
height : String,
appetite : String
}
I want to convert it to numbers:
type alias FloatModel =
{ age : Float,
weight : Float,
height : Float,
appetite : Float
}
My struggle is that String.toFloat might return Nothing if the user entered bad data. So I guess I want a Maybe FloatModel to handle bad data. How can I call String.toFloat on each member, and if they're all successful return Just FloatModel and if not return Nothing?