summaryrefslogtreecommitdiff
path: root/Hero/Database.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Hero/Database.hs')
-rw-r--r--Hero/Database.hs38
1 files changed, 21 insertions, 17 deletions
diff --git a/Hero/Database.hs b/Hero/Database.hs
index 5726f3c..0166c6f 100644
--- a/Hero/Database.hs
+++ b/Hero/Database.hs
@@ -2,20 +2,21 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
+
module Hero.Database
- ( ComicDB
- , getComics
- , load
- , dummy
+ ( ComicDB,
+ getComics,
+ load,
+ dummy,
)
where
-import Hero.App
-import Data.Map ( Map )
-import qualified Data.Map as Map
-import Dhall
-import Protolude
-import Servant ( Handler )
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Dhall
+import Hero.App
+import Protolude
+import Servant (Handler)
type ComicDB = (Map ComicId Comic)
@@ -25,14 +26,17 @@ load :: IO ComicDB
load = listToComicDB <$> input auto "./comic-database.dhall"
dummy :: IO ComicDB
-dummy = return $ listToComicDB
- [ Comic { comicId = "ComicId"
- , comicPages = 10
- , comicName = "Dummy comic"
- , comicIssue = "dummy issue"
- , comicDescription = "Lorem ipsum"
+dummy =
+ return $
+ listToComicDB
+ [ Comic
+ { comicId = "ComicId",
+ comicPages = 10,
+ comicName = "Dummy comic",
+ comicIssue = "dummy issue",
+ comicDescription = "Lorem ipsum"
}
- ]
+ ]
listToComicDB :: [Comic] -> ComicDB
listToComicDB ls = Map.fromList $ (,) <$> comicId <*> identity <$> ls