diff --git a/byg/byg.cabal b/byg/byg.cabal index 4d3ea09..0894901 100644 --- a/byg/byg.cabal +++ b/byg/byg.cabal @@ -37,7 +37,6 @@ library Functions DependencyRunner SiteGenerator - Precomputer build-depends: base >=4.14 && <4.20 , mtl @@ -49,7 +48,6 @@ library , pandoc , JuicyPixels , JuicyPixels-stbir - , template-haskell >=2.16 && <2.22 executable byg import: common @@ -57,3 +55,4 @@ executable byg build-depends: base >=4.14 && <4.20 , byg + , text diff --git a/byg/src/Main.hs b/byg/src/Main.hs index e0e6d18..470272a 100644 --- a/byg/src/Main.hs +++ b/byg/src/Main.hs @@ -1,17 +1,24 @@ -{-# LANGUAGE TemplateHaskell #-} module Main where -import qualified Precomputer +import Types (Dependency) +import qualified DependencyRunner as DR +import qualified Types.Dependency as D +import SiteGenerator (generateSite) +import DependencyGenerator (evalDepGenM) import System.Environment (getArgs) +import qualified Data.Text.IO as T + +dependencies :: [Dependency] +dependencies = evalDepGenM generateSite main :: IO () main = do args <- getArgs case args of ["run"] -> - $$(Precomputer.runDeps) + DR.runDepRunMIO $ DR.runDeps dependencies ["tree"] -> - $$(Precomputer.formatDependencyTrees) + T.putStr $ D.formatDependencyTrees dependencies _ -> error "unexpected arguments" diff --git a/byg/src/Precomputer.hs b/byg/src/Precomputer.hs deleted file mode 100644 index b35eae5..0000000 --- a/byg/src/Precomputer.hs +++ /dev/null @@ -1,19 +0,0 @@ -{-# LANGUAGE TemplateHaskell #-} -module Precomputer - ( runDeps - , formatDependencyTrees - ) where - -import qualified DependencyRunner as DR -import qualified Types.Dependency as D -import SiteGenerator (generateSite) -import DependencyGenerator (evalDepGenM) - -import qualified Data.Text.IO as T -import Language.Haskell.TH.Syntax - -runDeps :: Code Q (IO ()) -runDeps = [|| DR.runDepRunMIO (DR.runDeps (evalDepGenM generateSite)) ||] - -formatDependencyTrees :: Code Q (IO ()) -formatDependencyTrees = [|| T.putStr (D.formatDependencyTrees (evalDepGenM generateSite)) ||]