Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding instance for single arguments.

  • Loading branch information...
commit 3e55952b069af24008d99c3c0a1de7afe0bfe594 1 parent 00516b2
@DanBurton DanBurton authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 ReadArgs.hs
View
7 ReadArgs.hs
@@ -126,6 +126,13 @@ instance (Argument a, ArgumentTuple y) => ArgumentTuple (a :& y) where
return $ a :& y
usageFor ~(a :& y) = " " ++ argName a ++ usageFor y
+-- Use :& to derive an instance for single arguments
+instance (Argument a) => ArgumentTuple a where
+ parseArgsFrom ss = do
+ a :& () <- parseArgsFrom ss
+ return a
+ usageFor a = usageFor (a :& ())
+
-- Use :& to derive instances for all the normal tuple types
instance (Argument b, Argument a) => ArgumentTuple (b,a) where
parseArgsFrom ss = do
Please sign in to comment.
Something went wrong with that request. Please try again.