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