@danidiaz , name
, firstName
, , lastName
s.
, MonadZip
Monad m => ListT m
,
mzip :: Monad m => ListT m a -> ListT m b -> ListT m (a, b).
, name
name :: ListT IO String
name = do
(firstName, lastName) <- mzip (Select input) (Select input)
return (firstName ++ " " ++ lastName)
.
As a nice option, you can use the MonadComprehensions
and extensions ParallelListComp
. Using them, two versions name
become
name :: ListT IO String
name = [ firstName ++ " " ++ lastName | firstName <- Select input
, lastName <- Select input ]
name' :: ListT IO String
name' = [ firstName ++ " " ++ lastName | firstName <- Select input
| lastName <- Select input ]
source
share