{-# LANGUAGE QuasiQuotes #-}
module Summoner.Template.Script
( scriptFile
) where
import NeatInterpolation (text)
import Summoner.GhcVer (GhcVer, baseVer, latestLts)
import Summoner.Settings (Tool (..))
scriptFile :: GhcVer -> Tool -> Text
scriptFile :: GhcVer -> Tool -> Text
scriptFile ghcVer :: GhcVer
ghcVer = \case
Cabal ->
[text|
#!/usr/bin/env cabal
{- cabal:
build-depends:
, base ^>= $baseVersion
-}
main :: IO ()
main = putStrLn "Hello, World!"
|]
Stack ->
[text|
#!/usr/bin/env stack
{- stack
--resolver ${ltsVersion}
script
--package base
-}
main :: IO ()
main = putStrLn "Hello, World!"
|]
where
baseVersion, ltsVersion :: Text
baseVersion :: Text
baseVersion = GhcVer -> Text
baseVer GhcVer
ghcVer
ltsVersion :: Text
ltsVersion = GhcVer -> Text
latestLts GhcVer
ghcVer