aboutsummaryrefslogtreecommitdiff
path: root/entities/article.rkt
blob: 4da6cece0d32516fb623daaf9e2553f24a517286 (about) (plain)
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
#lang typed/racket

(provide Article
         make-article
         article?
         article-id
         article-timestamp
         article-hash
         article-source
         article-title
         article-body

         Article-With-Tags
         make-article-with-tags
         article-with-tags?
         (rename-out [article-with-tags-tags article-tags])
         article->article-with-tags)

(struct article ([id : String]
                 [timestamp : date]
                 [hash : String]
                 [source : String]
                 [title : String]
                 [body : String])
  #:type-name Article
  #:constructor-name make-article
  #:transparent)

(struct article-with-tags article ([tags : (Listof String)])
  #:type-name Article-With-Tags
  #:constructor-name make-article-with-tags
  #:transparent)

(: article->article-with-tags (-> Article (Listof String) Article-With-Tags))
(define (article->article-with-tags a tags)
  (make-article-with-tags (article-id a)
                          (article-timestamp a)
                          (article-hash a)
                          (article-source a)
                          (article-title a)
                          (article-body a)
                          tags))