Initial commit
authorNeil Smith <NeilNjae@users.noreply.github.com>
Sun, 1 Dec 2024 09:53:26 +0000 (09:53 +0000)
committerNeil Smith <NeilNjae@users.noreply.github.com>
Sun, 1 Dec 2024 09:53:26 +0000 (09:53 +0000)
.gitignore [new file with mode: 0644]
CHANGELOG.md [new file with mode: 0644]
adventofcode24.cabal [new file with mode: 0644]
app/Main.hs [new file with mode: 0644]
src/AoC.hs [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..1a0ee39
--- /dev/null
@@ -0,0 +1,42 @@
+# Extensionless files
+*
+!/**/
+!*.*
+
+# Haskell bits
+dist
+dist-*
+cabal-dev
+*.o
+*.hi
+*.chi
+*.chs.h
+*.dyn_o
+*.dyn_hi
+.hpc
+.hsenv
+.cabal-sandbox/
+cabal.sandbox.config
+*.prof
+*.aux
+*.hp
+*.eventlog
+cabal.project.local
+.HTF/
+
+
+# IPython / IHaskell notebook checkpoints
+.ipynb*
+
+# Sublime text
+*.sublime-workspace
+
+# Logs
+*.log
+
+# Profile exports
+*.ps
+
+# KDE
+.directory
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644 (file)
index 0000000..cca0c9b
--- /dev/null
@@ -0,0 +1,5 @@
+# Revision history for adventofcode24
+
+## 0.1.0.0 -- YYYY-mm-dd
+
+* First version. Released on an unsuspecting world.
diff --git a/adventofcode24.cabal b/adventofcode24.cabal
new file mode 100644 (file)
index 0000000..6f98911
--- /dev/null
@@ -0,0 +1,75 @@
+cabal-version:      3.4
+name:               adventofcode24
+version:            0.1.0.0
+-- synopsis:
+-- description:
+license:            GPL-3.0-or-later
+license-file:       LICENSE
+author:             Neil Smith
+maintainer:         NeilNjae@users.noreply.github.com
+-- copyright:
+category:           Game
+build-type:         Simple
+extra-doc-files:    CHANGELOG.md
+-- extra-source-files:
+
+common warnings
+    ghc-options: -Wall
+
+common common-extensions
+  default-extensions:     AllowAmbiguousTypes
+                        , ApplicativeDo
+                        , BlockArguments
+                        -- , DuplicateRecordFields
+                        , FunctionalDependencies
+                        -- , ImplicitParams
+                        , MultiWayIf
+                        , NegativeLiterals
+                        , NumDecimals
+                        -- , NoFieldSelectors
+                        , OverloadedLists
+                        -- , OverloadedRecordDot
+                        , OverloadedStrings
+                        -- , PartialTypeSignatures
+                        , PatternSynonyms
+                        , RecordWildCards
+                        , TemplateHaskell
+                        -- , TransformListComp
+                        , TypeFamilies
+                        , ViewPatterns
+
+common build-directives
+  build-depends:       base >=4.19
+  default-language:    GHC2021
+  hs-source-dirs:      ., app, src
+  -- other-modules:       AoC
+  ghc-options:         -O2 
+                       -Wall 
+                       -threaded 
+                       -rtsopts "-with-rtsopts=-N"
+
+library
+    import:           warnings, common-extensions
+    exposed-modules:  AoC
+    -- other-modules:
+    -- other-extensions:
+    build-depends:    base ^>=4.19.1.0
+    hs-source-dirs:   src
+    default-language: GHC2021
+
+executable adventofcode24
+    import:           warnings
+    main-is:          Main.hs
+    -- other-modules:
+    -- other-extensions:
+    build-depends:
+        base ^>=4.19.1.0,
+        adventofcode24
+
+    hs-source-dirs:   app
+    default-language: GHC2021
+
+executable advent01
+  import: common-extensions, build-directives
+  main-is: advent01/Main.hs
+--   build-depends: split
diff --git a/app/Main.hs b/app/Main.hs
new file mode 100644 (file)
index 0000000..60d904e
--- /dev/null
@@ -0,0 +1,8 @@
+module Main where
+
+import qualified MyLib (someFunc)
+
+main :: IO ()
+main = do
+  putStrLn "Hello, Haskell!"
+  MyLib.someFunc
diff --git a/src/AoC.hs b/src/AoC.hs
new file mode 100644 (file)
index 0000000..449c739
--- /dev/null
@@ -0,0 +1,16 @@
+Module AoC ( getDataFileName ) where
+
+import System.Environment
+
+getDataFileName :: IO String
+getDataFileName =
+  do args <- getArgs
+     progName <- getProgName
+     let baseDataName =  if null args
+                         then progName
+                         else head args 
+    let baseDataName' =  if length baseDataName < 5
+                         then progName ++ baseDataName
+                         else baseDataName
+     let dataFileName = "../data/" ++ baseDataName' ++ ".txt"
+     return dataFileName