summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-13 11:36:47 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-13 11:36:47 +0200
commitf54a1eadde25096483f4a7fde9e348ddfb647027 (patch)
tree6b1568408db4155a5da58229bf75546200a3e9e0
parent5e916888721ab2687ce1ade07d4427aeece38139 (diff)
downloadxmobar-f54a1eadde25096483f4a7fde9e348ddfb647027.tar.gz
xmobar-f54a1eadde25096483f4a7fde9e348ddfb647027.tar.bz2
Runnable: cleanup and some comments
darcs-hash:20070713093647-d6583-b26a258b1a30a787bb333ebf3782ee74c10d585c.gz
-rw-r--r--Runnable.hs10
1 files changed, 4 insertions, 6 deletions
diff --git a/Runnable.hs b/Runnable.hs
index 2f55e7f..c122eea 100644
--- a/Runnable.hs
+++ b/Runnable.hs
@@ -12,12 +12,13 @@
-- The existential type to store the list of commands to be executed.
-- I must thank Claus Reinke for the help in understanding the mysteries of
-- reading existential types. The Read instance of Runnable must be credited to
--- him. See here:
+-- him.
+--
+-- See here:
-- http:\/\/www.haskell.org\/pipermail\/haskell-cafe\/2007-July\/028227.html
--
-----------------------------------------------------------------------------
-
module Runnable where
import Control.Monad
@@ -28,7 +29,6 @@ import Commands
data Runnable = forall r . (Exec r, Read r) => Run r
-
instance Exec Runnable where
run (Run a) = run a
rate (Run a) = rate a
@@ -37,8 +37,8 @@ instance Exec Runnable where
instance Read Runnable where
readPrec = readRunnable
--- read an existential as any of hidden types ts
class ReadAsAnyOf ts ex where
+ -- | Reads an existential type as any of hidden types ts
readAsAnyOf :: ts -> ReadPrec ex
instance ReadAsAnyOf () ex where
@@ -48,8 +48,6 @@ 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)) }
-
-
readRunnable :: ReadPrec Runnable
readRunnable = prec 10 $ do
Ident "Run" <- lexP