File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ -- Book Types definition
2
+
3
+ module Codec.EBook.Types (
4
+ Book (.. ),
5
+ BookItem (.. ),
6
+ Metadata (.. ),
7
+ emptyBook ,
8
+ addItem2Book
9
+ )
10
+ where
11
+
12
+ data Book = Book {
13
+ bookID :: String ,
14
+ bookTitle :: String ,
15
+ bookAuthor :: String ,
16
+ bookLang :: String ,
17
+ bookItems :: [BookItem ]
18
+ } deriving (Show , Ord , Eq )
19
+
20
+ data BookItem = BookItem {
21
+ itemFileName :: String ,
22
+ itemContent :: String ,
23
+ itemMediaType :: String ,
24
+ itemMetadata :: Maybe Metadata
25
+ } deriving (Show , Ord , Eq )
26
+
27
+ data Metadata = ChapterMetadata {
28
+ chapterTitle :: String
29
+ } deriving (Show , Ord , Eq )
30
+
31
+ emptyBook :: Book
32
+ emptyBook = Book " NO ID" " NO TITLE" " NO AUTHOR" " en" []
33
+
34
+ addItem2Book :: Book -> BookItem -> Book
35
+ addItem2Book book item = book { bookItems = newItems }
36
+ where
37
+ newItems = (bookItems book) ++ [item]
You can’t perform that action at this time.
0 commit comments