diff --git a/app/MyGetOpt.hs b/app/MyGetOpt.hs index 1afb3db..b0ec885 100644 --- a/app/MyGetOpt.hs +++ b/app/MyGetOpt.hs @@ -60,4 +60,25 @@ int = x <- num return (-x) <|> - num \ No newline at end of file + num + +maybeInt :: Parser (Maybe Int) +maybeInt = P $ \str -> case parse int str of + Nothing -> Just (Nothing, str) + Just (y, lo) -> Just (Just y, lo) + +data Configuration = Configuration { + rule :: Int, + start :: Maybe Int, + lines :: Maybe Int, + window :: Maybe Int, + move :: Maybe Int +} deriving Show + +defaultConfiguration = Configuration { + rule = 0, + start = Just 0, + Main.lines = Nothing, + window = Just 80, + move = Just 0 +} \ No newline at end of file