Not really shorter but I think it's cleaner this way.Just found -> putStrLn ("found " ++ found)I'd rather use pattern matching in this case:check x assoc = case lookup x of
_ ->On Thu, Aug 1, 2013 at 5:00 PM, vold <voldermort@hotmail.com> wrote:
I've defined a function similar to
check x assoc = let found = lookup x assoc in
when (isJust found) $ putStrLn $ "found " ++ fromJust found
which I've used several times from within the IO monad. Is there a more
compact way of doing this?
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners