From f54a1eadde25096483f4a7fde9e348ddfb647027 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Fri, 13 Jul 2007 11:36:47 +0200 Subject: Runnable: cleanup and some comments darcs-hash:20070713093647-d6583-b26a258b1a30a787bb333ebf3782ee74c10d585c.gz --- Runnable.hs | 10 ++++------ 1 file 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 -- cgit v1.2.3