mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Merge pull request #507 from slotThe/minimal-pragmas
Add `MINIMAL` pragmas to `HasName` and `XPrompt`
This commit is contained in:
commit
0ebd3a0534
@ -221,17 +221,23 @@ instance XPrompt XPType where
|
|||||||
completionFunction (XPT t) = completionFunction t
|
completionFunction (XPT t) = completionFunction t
|
||||||
modeAction (XPT t) = modeAction t
|
modeAction (XPT t) = modeAction t
|
||||||
|
|
||||||
-- | The class prompt types must be an instance of. In order to
|
-- | A class for an abstract prompt. In order for your data type to be a
|
||||||
-- create a prompt you need to create a data type, without parameters,
|
-- valid prompt you _must_ make it an instance of this class.
|
||||||
-- and make it an instance of this class, by implementing a simple
|
|
||||||
-- method, 'showXPrompt', which will be used to print the string to be
|
|
||||||
-- displayed in the command line window.
|
|
||||||
--
|
--
|
||||||
-- This is an example of a XPrompt instance definition:
|
-- The minimal complete definition is just 'showXPrompt', i.e. the name
|
||||||
|
-- of the prompt. This string will be displayed in the command line
|
||||||
|
-- window (before the cursor).
|
||||||
--
|
--
|
||||||
|
-- As an example of a complete 'XPrompt' instance definition, we can
|
||||||
|
-- look at the 'XMonad.Prompt.Shell.Shell' prompt from
|
||||||
|
-- "XMonad.Prompt.Shell":
|
||||||
|
--
|
||||||
|
-- > data Shell = Shell
|
||||||
|
-- >
|
||||||
-- > instance XPrompt Shell where
|
-- > instance XPrompt Shell where
|
||||||
-- > showXPrompt Shell = "Run: "
|
-- > showXPrompt Shell = "Run: "
|
||||||
class XPrompt t where
|
class XPrompt t where
|
||||||
|
{-# MINIMAL showXPrompt #-}
|
||||||
|
|
||||||
-- | This method is used to print the string to be
|
-- | This method is used to print the string to be
|
||||||
-- displayed in the command line window.
|
-- displayed in the command line window.
|
||||||
|
@ -119,6 +119,7 @@ spawn' :: String -> NamedAction
|
|||||||
spawn' x = addName x $ spawn x
|
spawn' x = addName x $ spawn x
|
||||||
|
|
||||||
class HasName a where
|
class HasName a where
|
||||||
|
{-# MINIMAL getAction #-}
|
||||||
showName :: a -> [String]
|
showName :: a -> [String]
|
||||||
showName = const [""]
|
showName = const [""]
|
||||||
getAction :: a -> X ()
|
getAction :: a -> X ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user