Add a package.json, load generator info from it instead of from settings.yml
This commit is contained in:
parent
353f1aa994
commit
4692e78503
8 changed files with 75 additions and 15 deletions
21
src/Package.hs
Normal file
21
src/Package.hs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Package ( Package(..)
|
||||
, Repository(..)
|
||||
, package
|
||||
) where
|
||||
|
||||
import Data.Aeson ( eitherDecodeStrict )
|
||||
import Data.Either ( either )
|
||||
import Language.Haskell.TH.Syntax ( addDependentFile, lift, runIO )
|
||||
import Package.Types
|
||||
|
||||
import qualified Data.ByteString as B
|
||||
|
||||
package :: Package
|
||||
package = $(do
|
||||
let f = "package.json"
|
||||
addDependentFile f
|
||||
json <- runIO $ B.readFile f
|
||||
let result = eitherDecodeStrict json :: Either String Package
|
||||
either fail lift result)
|
||||
Loading…
Add table
Add a link
Reference in a new issue