4 ms·
This is one of the solutions, using do notation: solve (theInt, theString) = do a <- theInt b <- theString return (a,b)
by jose_zap 7y ago
This is one of the solutions, using do notation:
solve (theInt, theString) =
do
a <- theInt
b <- theString
return (a,b)
- kian 7y agowrnr - This is literally the 'flatmap' solution you referred to above, but in sugared form - what they were probably trying to see was whether or not you understood how to collapse a pair of Maybes into a single Nothing if either component is missing without needing to do an if test - i.e., whether or not you understand the essence of the bind operatorion in the context of the Maybe Monad.