[Haskell-cafe] list comprehension with multiple generator|targets
Donn Cave
donn at avvanta.com
Mon Nov 10 02:58:37 UTC 2014
I'm guessing this isn't supported, but might be worth asking -
can I extend a list comprehension like ['A' | A <- s] to multiple values?
Like,
data V = A | B | C
pv :: [V] -> [Char]
pv [] = []
pv (A:x) = 'A':(pv x)
pv (B:x) = 'B':(pv x)
pv (_:x) = pv x
-- can that be a list comprehension, like
pv s = [
'A' | A <- s
-- ??
]
thanks,
Donn
More information about the Haskell-Cafe
mailing list