Precompute more
This commit is contained in:
parent
556ded64a8
commit
7e23b55513
|
@ -32,6 +32,7 @@ library
|
||||||
Evaluation.FunctionIO
|
Evaluation.FunctionIO
|
||||||
DependencyRunner
|
DependencyRunner
|
||||||
SiteGenerator
|
SiteGenerator
|
||||||
|
Precomputer
|
||||||
build-depends:
|
build-depends:
|
||||||
base >=4.14 && <4.20
|
base >=4.14 && <4.20
|
||||||
, mtl
|
, mtl
|
||||||
|
|
|
@ -1,25 +1,28 @@
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import Types.Dependency (Dependency, formatDependencyTrees)
|
|
||||||
import DependencyGenerator (evalDepGenM)
|
import DependencyGenerator (evalDepGenM)
|
||||||
import SiteGenerator (generateSite)
|
import SiteGenerator (generateSite)
|
||||||
import DependencyRunner (runDeps, runDepRunMIO)
|
import qualified Precomputer
|
||||||
|
|
||||||
import System.Environment (getArgs)
|
import System.Environment (getArgs)
|
||||||
|
import Data.Text (Text)
|
||||||
import qualified Data.Text.IO as T
|
import qualified Data.Text.IO as T
|
||||||
import Language.Haskell.TH.Syntax (lift)
|
import Language.Haskell.TH.Syntax
|
||||||
|
|
||||||
dependencies :: [Dependency]
|
formatDependencyTrees :: Text
|
||||||
dependencies = $(lift (evalDepGenM generateSite))
|
formatDependencyTrees = $$(Precomputer.formatDependencyTrees $(lift (evalDepGenM generateSite)))
|
||||||
|
|
||||||
|
runDeps :: IO ()
|
||||||
|
runDeps = $$(Precomputer.runDeps $(lift (evalDepGenM generateSite)))
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
args <- getArgs
|
args <- getArgs
|
||||||
case args of
|
case args of
|
||||||
["run"] ->
|
["run"] ->
|
||||||
runDepRunMIO $ runDeps dependencies
|
runDeps
|
||||||
["tree"] ->
|
["tree"] ->
|
||||||
T.putStr $ formatDependencyTrees dependencies
|
T.putStr formatDependencyTrees
|
||||||
_ ->
|
_ ->
|
||||||
error "unexpected arguments"
|
error "unexpected arguments"
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
module Precomputer
|
||||||
|
( runDeps
|
||||||
|
, formatDependencyTrees
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Types.Dependency (Dependency)
|
||||||
|
import qualified DependencyRunner as DR
|
||||||
|
import qualified Types.Dependency as D
|
||||||
|
|
||||||
|
import Data.Text (Text)
|
||||||
|
import Language.Haskell.TH.Syntax
|
||||||
|
|
||||||
|
runDeps :: [Dependency] -> Code Q (IO ())
|
||||||
|
runDeps deps = [|| DR.runDepRunMIO (DR.runDeps deps) ||]
|
||||||
|
|
||||||
|
formatDependencyTrees :: [Dependency] -> Code Q Text
|
||||||
|
formatDependencyTrees deps = [|| D.formatDependencyTrees deps ||]
|
Loading…
Reference in New Issue