Starting the wolfram

This commit is contained in:
Zoe Roux
2021-03-09 11:28:53 +01:00
parent e64a5bcf38
commit b48cc95be9
2 changed files with 37 additions and 22 deletions
+21 -6
View File
@@ -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 {
+16 -16
View File
@@ -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 ::