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 v2-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 ""
48 , pair
"8.0.2" $ Z
"ghc-8.0.2" "8.0.2-bionic" True True False True ""
53 -------------------------------------------------------------------------------
55 -------------------------------------------------------------------------------
60 , zParsecCompat
:: Bool
61 , zHasTransformers
:: Bool
62 , zNeedsDynamic
:: Bool
68 instance Z
.Zinza Z
where
69 toType
= Z
.genericToTypeSFP
70 toValue
= Z
.genericToValueSFP
71 fromValue
= Z
.genericFromValueSFP