So, I wrote:

pledgeOptions =
    zip list $ map (show . fromRational . (0.1 *) . toRational) list

And Bryan helped me fix it but then there were type issues and the
result that worked ended up being:

        listAsCents :: [Double]
        listAsCents = map ((0.1 *) . fromIntegral) list
        pledgeOptions :: [(Int64, String)]
        pledgeOptions = zip list $ map (printf "%0.1f") listAsCents

This replaces show with printf (and the extra argument it needs) and has
only one from-number type function instead of two, but it uses two maps,
and has to specify etra types.

Is this really an improvement?

Neither of these get the full result I'd like which is where the case of
a whole number becomes 1 or 2 instead of 1.0 or 2.0.

Any thoughts on which to use or what to do instead?

-- 
Aaron Wolf Snowdrift.coop <https://snowdrift.coop>
_______________________________________________
Dev mailing list
[email protected]
http://lists.snowdrift.coop/mailman/listinfo/dev

Reply via email to