Skip to content

Commit

Permalink
MonadMPD: provide getHandle() accessor to reach underlying handle
Browse files Browse the repository at this point in the history
this is needed in order to allow proper non-blocking idle support
  • Loading branch information
arybczak committed Sep 7, 2010
1 parent bf9d289 commit dc57273
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Network/MPD/Core.hs
Expand Up @@ -70,6 +70,7 @@ instance MonadMPD MPD where
open = mpdOpen
close = mpdClose
send = mpdSend
getHandle = MPD $ get
getPassword = MPD $ ask >>= \(_,_,pw) -> return pw

-- | A response is either an 'MPDError' or some result.
Expand Down
4 changes: 4 additions & 0 deletions Network/MPD/Core/Class.hs
Expand Up @@ -10,6 +10,8 @@

module Network.MPD.Core.Class where

import System.IO (Handle)

import Network.MPD.Core.Error (MPDError)

import Control.Monad.Error (MonadError)
Expand All @@ -25,6 +27,8 @@ class (Monad m, MonadError MPDError m) => MonadMPD m where
close :: m ()
-- | Send a string to the server and return its response.
send :: String -> m String
-- | Get underlying Handle (or Nothing, if no connection is estabilished)
getHandle :: m (Maybe Handle)
-- | Produce a password to send to the server should it ask for
-- one.
getPassword :: m Password

0 comments on commit dc57273

Please sign in to comment.