@@ -0,0 +1,50 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE QuasiQuotes #-}
3+
4+module Config where
5+
6+import Data.Text (Text)
7+import qualified Data.Yaml as Y
8+import Data.Yaml (FromJSON(..), (.:))
9+import Text.RawString.QQ
10+
11+configYaml = [r|
12+resolver: lts-3.7
13+packages:
14+ - ./yesod-core
15+ - ./yesod-static
16+ - ./yesod-persistent
17+ - ./yesod-newsfeed
18+ - ./yesod-form
19+ - ./yesod-auth
20+ - ./yesod-auth-oauth
21+ - ./yesod-sitemap
22+ - ./yesod-test
23+ - ./yesod-bin
24+ - ./yesod
25+ - ./yesod-eventsource
26+ - ./yesod-websockets
27+
28+# Needed for LTS 2
29+extra-deps:
30+- wai-app-static-3.1.4.1
31+|]
32+
33+data Config =
34+ Config {
35+ resolver :: Text
36+ , packages :: [FilePath]
37+ , extraDeps :: [Text]
38+ } deriving (Eq, Show)
39+
40+instance FromJSON Config where
41+ parseJSON (Y.Object v) =
42+ Config <$>
43+ v .: "resolver" <*>
44+ v .: "packages" <*>
45+ v .: "extra-deps"
46+ parseJSON _ = fail "Expected Object for Config value"
47+
48+main :: IO ()
49+main =
50+ print $ (Y.decode configYaml :: Maybe Config)