summaryrefslogtreecommitdiff
path: root/Coalpit.hs
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-03 10:39:34 +0300
committerdefanor <defanor@uberspace.net>2017-12-03 10:39:34 +0300
commit15f63061dd9308e223077d718db0fce85366538f (patch)
tree5b202660f3eb4cb6e21c1163a2dcf03cfc3ad096 /Coalpit.hs
parent9fd02f49809bfdfef205fae5885636eef0a69b21 (diff)
Add List and Either instances
No special handling for those yet, just for testing.
Diffstat (limited to 'Coalpit.hs')
-rw-r--r--Coalpit.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Coalpit.hs b/Coalpit.hs
index bc5436a..a252691 100644
--- a/Coalpit.hs
+++ b/Coalpit.hs
@@ -16,6 +16,7 @@ import Data.Maybe
import Data.Char
import Data.Proxy
import Data.Semigroup
+import Data.Either
advance :: Pos -> SourcePos -> t -> SourcePos
@@ -204,10 +205,10 @@ instance ArgParser Int where
instance ToArgs Int where
toArgs _ i = [show i]
-instance ArgParser String where
+instance {-#OVERLAPPING#-} ArgParser String where
argParser _ = pS $ many anyChar
-instance ToArgs String where
+instance {-#OVERLAPPING#-} ToArgs String where
toArgs _ i = [i]
instance ArgParser Double where
@@ -218,3 +219,9 @@ instance ToArgs Double where
instance ArgParser a => ArgParser (Maybe a)
instance ToArgs a => ToArgs (Maybe a)
+
+instance ArgParser a => ArgParser [a]
+instance ToArgs a => ToArgs [a]
+
+instance (ArgParser a, ArgParser b) => ArgParser (Either a b)
+instance (ToArgs a, ToArgs b) => ToArgs (Either a b)