Permalink
Browse files

Minor cleanup

  • Loading branch information...
1 parent f6f2dee commit 7a9ee223b83bfd3ed8c0a8e5814d8f5a2799713d @sol sol committed Aug 15, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 Network/MPD/Core.hs
View
@@ -106,9 +106,9 @@ mpdOpen :: MPD ()
mpdOpen = MPD $ do
(host, port) <- ask
runMPD close
- handle <- liftIO (safeConnectTo host port)
- modify (\st -> st { stHandle = handle })
- F.forM_ handle (const $ runMPD checkConn >>= flip unless (runMPD close))
+ mHandle <- liftIO (safeConnectTo host port)
+ modify (\st -> st { stHandle = mHandle })
+ F.forM_ mHandle $ \_ -> runMPD checkConn >>= (`unless` runMPD close)
where
safeConnectTo host@('/':_) _ =
(Just <$> connectTo "" (UnixSocket host))

0 comments on commit 7a9ee22

Please sign in to comment.