Skip to content

Repository files navigation

libmpd-effectful

Adaptation of the libmpd library for the effectful ecosystem.

Example

The below example retrieves and prints the currently playing song. Note that both the EMPD :> es and Error MPDError :> es constraints are necessary in order for Eff es String to be an instance of MonadMPD.

module Main (main) where

import Effectful
import Effectful.Error.Dynamic
import Effectful.Network.MPD

main :: IO ()
main = runEff $ do
  mpdResult <- withEMPD_ (Just "/tmp/mpd_socket") Nothing app
  liftIO . print $ case mpdResult of
    Left err -> "failed: " ++ show err
    Right songInfo -> "succeeded: " ++ songInfo

app :: (EMPD :> es, Error MPDError :> es) => Eff es String
app = maybe "no song playing" show <$> currentSong

About

Adaptation of libmpd-haskell library for the effectful ecosystem.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages