diff --git a/app/Main.hs b/app/Main.hs index 52ca31a..6e170ef 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -3,13 +3,28 @@ module Main where import Lib import MyGetOpt +data Cell = Empty | Full +newType CellList = CellList { left :: [], middle :: [], right :: [] } + +run :: Int -> [CellList] +run _ = [] + +printCells :: Configuration -> [CellList] -> IO() +printCells _ [] = return +printCells config (x:xs) = pl x >> printCells config xs + where + pl cl = + main :: IO () -main = print option - ( long "rule" - <> short "r" - <> metavar "RULE" - <> help "The rulset used." - ) +main = do + config = Configuration 30 0 10 80 0 + printCells config $ run (rule config) +-- print option +-- ( long "rule" +-- <> short "r" +-- <> metavar "RULE" +-- <> help "The rulset used." +-- ) data Configuration = Configuration { diff --git a/src/MyGetOpt.hs b/src/MyGetOpt.hs index 48493c6..abfd39d 100644 --- a/src/MyGetOpt.hs +++ b/src/MyGetOpt.hs @@ -111,19 +111,19 @@ instance Semigroup (Mod a) where -- (<>) a -> a -> a (<>) (Mod a) (Mod b) = Mod (a . b) --- If need to compile, comment everything bellow. -option :: Parser Int -> Mod Int -> Parser a -option p (Mod m) = optionParser (m $ def p) - where - def = Option "VAR" "" ' ' Nothing "No help message set." - -optionParser :: Option a -> Parser a -optionParser _ [] - - --- TODO Create a type OptionParser witch contains the short & long names & n args parsers. --- TODO Pattern match for the OptionParser or a default parser in the runParser. Option parser will check named args while the default one will do positional ones. --- EXAMPLE: https://www.paolocapriotti.com/blog/2012/04/27/applicative-option-parser/ - -runParser :: Parser a -> [String] -> Maybe (a, [String]) -runParser :: +---- If need to compile, comment everything bellow. +--option :: Parser Int -> Mod Int -> Parser a +--option p (Mod m) = optionParser (m $ def p) +-- where +-- def = Option "VAR" "" ' ' Nothing "No help message set." +-- +--optionParser :: Option a -> Parser a +--optionParser _ [] +-- +-- +---- TODO Create a type OptionParser witch contains the short & long names & n args parsers. +---- TODO Pattern match for the OptionParser or a default parser in the runParser. Option parser will check named args while the default one will do positional ones. +---- EXAMPLE: https://www.paolocapriotti.com/blog/2012/04/27/applicative-option-parser/ +-- +--runParser :: Parser a -> [String] -> Maybe (a, [String]) +--runParser ::