From fb4622f2ec3abae8ddcdfc5452c2685235c8e6d0 Mon Sep 17 00:00:00 2001 From: Daniil Frumin Date: Tue, 25 Jun 2013 20:29:59 +0400 Subject: [PATCH 1/2] Functor instances for ArgDescr and OptDescr are now defined in base 4.7 --- core/Test/Framework/Runners/Console.hs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/core/Test/Framework/Runners/Console.hs b/core/Test/Framework/Runners/Console.hs index 6fb40ed..9d71f17 100644 --- a/core/Test/Framework/Runners/Console.hs +++ b/core/Test/Framework/Runners/Console.hs @@ -24,14 +24,6 @@ import System.IO import Data.Monoid -instance Functor OptDescr where - fmap f (Option a b arg_descr c) = Option a b (fmap f arg_descr) c - -instance Functor ArgDescr where - fmap f (NoArg a) = NoArg (f a) - fmap f (ReqArg g s) = ReqArg (f . g) s - fmap f (OptArg g s) = OptArg (f . g) s - -- | @Nothing@ signifies that usage information should be displayed. -- @Just@ simply gives us the contribution to overall options by the command line option. type SuppliedRunnerOptions = Maybe RunnerOptions From d51a4512f22cdf08c6d5e4d79ad117ca1098fff3 Mon Sep 17 00:00:00 2001 From: Daniil Frumin Date: Sun, 7 Jul 2013 20:44:59 +0400 Subject: [PATCH 2/2] Making it also work with base < 4.7 --- core/Test/Framework/Runners/Console.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/Test/Framework/Runners/Console.hs b/core/Test/Framework/Runners/Console.hs index 9d71f17..b489b18 100644 --- a/core/Test/Framework/Runners/Console.hs +++ b/core/Test/Framework/Runners/Console.hs @@ -23,6 +23,15 @@ import System.IO import Data.Monoid +#if !MIN_VERSION_base(4,7,0) +instance Functor OptDescr where + fmap f (Option a b arg_descr c) = Option a b (fmap f arg_descr) c + +instance Functor ArgDescr where + fmap f (NoArg a) = NoArg (f a) + fmap f (ReqArg g s) = ReqArg (f . g) s + fmap f (OptArg g s) = OptArg (f . g) s +#endif -- | @Nothing@ signifies that usage information should be displayed. -- @Just@ simply gives us the contribution to overall options by the command line option.