Here is a function that doesn’t sit right with me, I’m thinking I need to get rid of the fst.
flagHolidays :: [(C.Day,Availability)] -> Handler [(C.Day,Availability)]
flagHolidays dayPairs = do
let days = map fst dayPairs
yepNope = Prelude.map isHoliday days
availability = Prelude.map flagAvailability yepNope
return $ Prelude.zip days availability
The only way I can think to do it is a very ugly pattern match, along the lines of (x,y):(xs,ys). Does the removal of fst make sense? If so, what’s the best way to pattern-match this list of pairs?
Make the function pure and
And to answer the actual question, unless passed as an argument fst and snd are rarely used.
[Edit] Hmmm, I was a bit hasty writing that. It’s wrong. You’re passing in a list of pairs and never use the second component of the pair. Corrected, but in the same vein (and now using
fst):