-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathConfig.hs
64 lines (47 loc) · 1.12 KB
/
Config.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{-# LANGUAGE DeriveGeneric #-}
module Config
where
import GHC.Generics
import Data.Yaml (FromJSON, decodeFile)
fromConfig :: (FromJSON a) => FilePath -> IO (Maybe a)
fromConfig =
decodeFile
data Style =
Style { header_colour :: Colour
, head_theme_colour :: HexColour
, footer_colour :: Colour
, footer_btn_colour :: Colour
, footer_link_colour :: Colour
, navbar_text_colour_desktop :: Colour
, navbar_text_colour_mobile :: Colour
}
deriving Generic
type Colour =
String
type HexColour =
String
data General =
General { base_url :: String
, head_title :: String
, site_title :: String
, paginate :: Int
}
deriving Generic
data Feed =
Feed { title :: String
, description :: String
, author_name :: String
, author_email:: String
, root :: String
}
deriving Generic
data Site =
Site { general :: General
, feed :: Feed
, style :: Style
}
deriving Generic
instance FromJSON Style
instance FromJSON General
instance FromJSON Feed
instance FromJSON Site