[commit: ghc] wip/nfs-locking: Add ShowAction typeclass. (64b16d7)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:46:55 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/64b16d796dc5aa8a889d41eeb08cbead19cba14d/ghc

>---------------------------------------------------------------

commit 64b16d796dc5aa8a889d41eeb08cbead19cba14d
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Thu Jan 1 23:56:12 2015 +0000

    Add ShowAction typeclass.


>---------------------------------------------------------------

64b16d796dc5aa8a889d41eeb08cbead19cba14d
 src/Base.hs | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/Base.hs b/src/Base.hs
index 0a88146..77c2858 100644
--- a/src/Base.hs
+++ b/src/Base.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
+
 module Base (
     module Development.Shake,
     module Development.Shake.FilePath,
@@ -27,8 +29,14 @@ instance Monoid a => Monoid (Action a) where
     mempty = return mempty
     mappend p q = mappend <$> p <*> q
 
-arg :: [String] -> Args
-arg = return
+class ShowAction a where
+    showAction :: a -> Action String
+
+instance ShowAction String where
+    showAction = return 
+
+arg :: ShowAction a => [a] -> Args
+arg = mapM showAction
 
 intercalateArgs :: String -> Args -> Args
 intercalateArgs s args = do



More information about the ghc-commits mailing list