From 9a575fec544c2ded3fff5016375c7b532c41b5f3 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Thu, 27 Sep 2007 19:27:51 +0200 Subject: Updated Runnable to the new API - added Show instance darcs-hash:20070927172751-d6583-09727fed3afdcd51e573f8d34237612fcc60a0f7.gz --- Runnable.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Runnable.hs b/Runnable.hs index c51d173..bc78198 100644 --- a/Runnable.hs +++ b/Runnable.hs @@ -27,13 +27,16 @@ import Text.ParserCombinators.ReadPrec import Config (runnableTypes) import Commands -data Runnable = forall r . (Exec r, Read r) => Run r +data Runnable = forall r . (Exec r, Read r, Show r) => Run r instance Exec Runnable where - run (Run a) = run a - rate (Run a) = rate a + start (Run a) = start a + rate (Run a) = rate a alias (Run a) = alias a +instance Show Runnable where + show (Run x) = show x + instance Read Runnable where readPrec = readRunnable @@ -44,7 +47,7 @@ class ReadAsAnyOf ts ex where instance ReadAsAnyOf () ex where readAsAnyOf ~() = mzero -instance (Read t, Exec t, ReadAsAnyOf ts Runnable) => ReadAsAnyOf (t,ts) Runnable where +instance (Show t, Read t, Exec t, ReadAsAnyOf ts Runnable) => ReadAsAnyOf (t,ts) Runnable where readAsAnyOf ~(t,ts) = r t `mplus` readAsAnyOf ts where r ty = do { m <- readPrec; return (Run (m `asTypeOf` ty)) } -- cgit v1.2.3