summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-13 14:37:07 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-13 14:37:07 +0200
commit22ad130fa851909870ddc0e6caa1aa6f8d6a66a1 (patch)
treecef280aeeabf0f4ef1bfa19d86eff6dc0a33d11a
parent9677ad5f6283368ff000050e23d420c9bb691e1a (diff)
downloadxmobar-22ad130fa851909870ddc0e6caa1aa6f8d6a66a1.tar.gz
xmobar-22ad130fa851909870ddc0e6caa1aa6f8d6a66a1.tar.bz2
haddock tuning
darcs-hash:20070713123707-d6583-b236b40087a92c45511afb3e4350813917515c02.gz
-rw-r--r--Commands.hs18
-rw-r--r--Config.hs7
-rw-r--r--Main.hs3
-rw-r--r--Runnable.hs4
4 files changed, 24 insertions, 8 deletions
diff --git a/Commands.hs b/Commands.hs
index 6fcb343..1a80b80 100644
--- a/Commands.hs
+++ b/Commands.hs
@@ -8,7 +8,13 @@
-- Stability : unstable
-- Portability : unportable
--
--- A Command datatype for XMobar status bar for the Xmonad Window Manager
+-- The 'Exec' class and the 'Command' data type.
+--
+-- The 'Exec' class rappresents the executable types, whose constructors may
+-- appear in the 'Config.commands' field of the 'Config.Config' data type.
+--
+-- The 'Command' data type stores the monitors to be run internally by
+-- XMobar.
--
-----------------------------------------------------------------------------
@@ -26,6 +32,11 @@ import Monitors.Swap
import Monitors.Cpu
import Monitors.Batt
+class Exec e where
+ run :: e -> IO String
+ rate :: e -> Int
+ alias :: e -> String
+
data Command = Com Program Args Alias Rate
| Weather Station Args Rate
| Network Interface Args Rate
@@ -42,11 +53,6 @@ type Station = String
type Interface = String
type Rate = Int
-class Exec e where
- run :: e -> IO String
- rate :: e -> Int
- alias :: e -> String
-
instance Exec Command where
alias (Weather s _ _) = s
alias (Network i _ _) = i
diff --git a/Config.hs b/Config.hs
index b120809..9d355ad 100644
--- a/Config.hs
+++ b/Config.hs
@@ -19,7 +19,6 @@ module Config ( -- * Configuration
, runnableTypes
) where
-
import Commands
import {-# SOURCE #-} Runnable
@@ -61,5 +60,11 @@ defaultConfig =
, template = "Uptime: <fc=#00FF00>%uptime%</fc> ** <fc=#FF0000>%date%</fc> %memory%"
}
+-- | This is the list of types that can be hidden inside
+-- 'Runnable.Runnable', the existential type that stores all commands
+-- to be executed by XMobar. It is used by 'Runnable.readRunnable' in
+-- the 'Runnable.Runnable' Read instance. To install a plugin just add
+-- the plugin's type to the list of types appearing in this function's type
+-- signature.
runnableTypes :: (Command,())
runnableTypes = undefined
diff --git a/Main.hs b/Main.hs
index 6f4a0ee..5af383f 100644
--- a/Main.hs
+++ b/Main.hs
@@ -15,7 +15,8 @@
module Main ( -- * Main Stuff
-- $main
main
- , readConfig
+ , readConfig
+ , readDefaultConfig
) where
import XMobar
diff --git a/Runnable.hs b/Runnable.hs
index c122eea..96216d0 100644
--- a/Runnable.hs
+++ b/Runnable.hs
@@ -48,6 +48,10 @@ instance (Read t, Exec t, ReadAsAnyOf ts Runnable) => ReadAsAnyOf (t,ts) Runnabl
readAsAnyOf ~(t,ts) = r t `mplus` readAsAnyOf ts
where r ty = do { m <- readPrec; return (Run (m `asTypeOf` ty)) }
+-- | The 'Prelude.Read' parser for the 'Runnable' existential type. It
+-- needs an 'Prelude.undefined' with a type signature containing the
+-- list of all possible types hidden within 'Runnable'. See 'Config.runnableTypes'.
+-- Each hidden type must have a 'Prelude.Read' instance.
readRunnable :: ReadPrec Runnable
readRunnable = prec 10 $ do
Ident "Run" <- lexP