------------------------------------------------------------------------------- |-- Module : XMonad.Prompt.Eval-- Copyright : Daniel Schoepe <daniel.schoepe@gmail.com>-- License : BSD3---- Maintainer : Daniel Schoepe <daniel.schoepe@gmail.com>-- Stability : unstable-- Portability : unportable---- A prompt for evaluating Haskell expressions(in the context of the running-- xmonad instance).-------------------------------------------------------------------------------moduleXMonad.Prompt.Eval(-- * Usage-- $usageevalPrompt,evalPromptWithOutput,showWithDzen)whereimportXMonadimportXMonad.PromptimportXMonad.Actions.EvalimportXMonad.Util.Dzen-- $usage-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:---- > import XMonad.Prompt-- > import XMonad.Prompt.Eval---- in your keybindings add:---- > , ((modMask x .|. controlMask, xK_x), evalPrompt defaultEvalConfig)---- For detailed instruction on editing the key binding see-- "XMonad.Doc.Extending#Editing_key_bindings".dataEvalPrompt=EvalPromptinstanceXPromptEvalPromptwhereshowXPromptEvalPrompt="Eval: "-- | A prompt that evaluates the entered Haskell expression, whose type has-- to be an instance of Show.evalPrompt::EvalConfig->XPConfig->X()evalPromptevcc=evalPromptWithOutputevcc(const$return())-- | The same as 'evalPrompt', but lets the user supply a function to be-- executed on the returned string, which is produced by applying show-- to the executed expression. (This is a crude solution, but the returned-- type has to be monomorphic)evalPromptWithOutput::EvalConfig->XPConfig->(String->X())->X()evalPromptWithOutputevccf=flipwhenJustf=<<mkXPromptWithReturnEvalPromptc(const$return[])(evalExpressionWithReturnevc)-- | A nice default to have the result of an expression displayed by dzen,-- if it's interesting (i.e. not () or an empty string).-- The first parameter specifies the display time in microseconds, the second parameter-- allows to pass additional options to dzen.showWithDzen::Int->[String]->String->X()showWithDzentargs"Error"=dzenWithArgs"Error"(["-bg","#ff0000","-fg","#000000"]++args)tshowWithDzentargss|s`elem`["","()"]=return()|otherwise=dzenWithArgss(["-bg","#00c600","-fg","#000000"]++args)t