1 {-# LANGUAGE DeriveGeneric #-}
2 {-# LANGUAGE ScopedTypeVariables #-}
3 module Main
(main
) where
5 import Control
.Exception
(SomeException
(..), catch, displayException
)
6 import GHC
.Generics
(Generic
)
7 import System
.Environment
(getArgs)
8 import System
.Exit
(exitFailure)
10 import qualified Data
.Map
as Map
11 import qualified Zinza
as Z
13 withIO
:: (String -> FilePath -> FilePath -> IO a
) -> IO a
18 -> k version src tgt `
catch`
\(SomeException e
) -> do
19 putStrLn $ "Exception: " ++ displayException e
22 putStrLn "Usage cabal run ... version"
26 main
= withIO
$ \version src tgt
-> do
27 render
<- Z
.parseAndCompileTemplateIO src
28 case Map
.lookup version params
of
31 writeFile tgt contents
34 putStrLn $ "Unknown version " ++ version
37 -------------------------------------------------------------------------------
39 -------------------------------------------------------------------------------
41 params
:: Map
.Map
String Z
43 [ pair
"8.10.4" $ Z
"ghc-8.10.4" "8.10.4-bionic" False True False True ""
44 , pair
"8.8.4" $ Z
"ghc-8.8.4" "8.8.4-bionic" False True False True "--doctest --solver-benchmarks --complete-hackage"
45 , pair
"8.6.5" $ Z
"ghc-8.6.5" "8.6.5-bionic" False True False True ""
46 , pair
"8.4.4" $ Z
"ghc-8.4.4" "8.4.4-bionic" False True False True ""
47 , pair
"8.2.2" $ Z
"ghc-8.2.2" "8.2.2-bionic" True True False True ""
52 -------------------------------------------------------------------------------
54 -------------------------------------------------------------------------------
59 , zParsecCompat
:: Bool
60 , zHasTransformers
:: Bool
61 , zNeedsDynamic
:: Bool
67 instance Z
.Zinza Z
where
68 toType
= Z
.genericToTypeSFP
69 toValue
= Z
.genericToValueSFP
70 fromValue
= Z
.genericFromValueSFP