[get rid of mpd reconnect logic Evan Martin **20060217023502] { hunk ./MPD.hs 11 +type Connection = Handle + hunk ./MPD.hs 15 --- we keep around the host/port for reconnecting. -data Connection = Connection Handle (String, Int) - -connectionHandle (Connection h _) = h - -connect :: String -> Int -> IO Connection -connect host port = do +connect :: (String, Int) -> IO Connection +connect (host, port) = do hunk ./MPD.hs 21 - return $ Connection handle (host, port) + return handle hunk ./MPD.hs 23 -reconnect :: Connection -> IO Connection -reconnect (Connection _ (host, port)) = connect host port - -runCommand (Connection handle _) cmd = do +runCommand handle cmd = do hunk ./MPD.hs 34 -runCommand_ conn cmd = runCommand conn cmd >> return () +runCommand_ handle cmd = runCommand handle cmd >> return () hunk ./MPD.hs 37 -getVolume conn = do - lines <- runCommand conn "status" +getVolume handle = do + lines <- runCommand handle "status" hunk ./MPD.hs 46 -setVolume conn v = runCommand_ conn ("setvol " ++ show v) +setVolume handle v = runCommand_ handle ("setvol " ++ show v) hunk ./MPDMate.hs 11 +mpdAddress = ("localhost", 6600) + hunk ./MPDMate.hs 32 - mpd <- MPD.connect "localhost" 6600 + mpd <- MPD.connect mpdAddress hunk ./MPDMate.hs 41 - MPD.reconnect mpd + MPD.connect mpdAddress }