monky-2.2.1.0: A system state collecting library and application

Maintainerongy
Stabilitytesting
PortabilityLinux
Safe HaskellNone
LanguageHaskell2010

Monky.Examples.Modify

Description

Example that limits MPD song title to 20 characters

import Data.Text as T

modifyMPD :: [MonkyOut] -> [MonkyOut]
modifyMPD orig@(MonkyPlain xs:ys) =
  if T.length xs > 20
     then MonkyPlain (T.take 17 xs append "..."):ys
     else orig


evtPack    $ getModifyHandle modifyMPD $ getMPDHandle "127.0.0.1" "6600"

Synopsis

Documentation

data ModifyHandle a Source #

Handle for duing pure modification of module output

getModifyHandle :: ([MonkyOut] -> [MonkyOut]) -> IO a -> IO (ModifyHandle a) Source #

Get a handle to purely modify another modules output

data IOModifyHandle a Source #

Handle for modifying output in IO monad

getIOModifyHandle :: ([MonkyOut] -> IO [MonkyOut]) -> IO a -> IO (IOModifyHandle a) Source #

Get a handle that can modify another handles output in the IO monad

changeImage :: Char -> MonkyOut -> MonkyOut Source #

Change the replacemant char in an monky image (if your font doesn't support it), returns initial value if not an image