bump 0.1.14.6
[diohsc.git] / Target.hs
blob6983c7918c5ad6f4b60f75298634ace44ea702cc
1 -- This file is part of Diohsc
2 -- Copyright (C) 2020-23 Martin Bays <mbays@sdf.org>
3 --
4 -- This program is free software: you can redistribute it and/or modify
5 -- it under the terms of version 3 of the GNU General Public License as
6 -- published by the Free Software Foundation, or any later version.
7 --
8 -- You should have received a copy of the GNU General Public License
9 -- along with this program. If not, see http://www.gnu.org/licenses/.
11 module Target where
13 import History
14 import Queue
15 import URI
17 data Target
18 = TargetHistory HistoryItem
19 | TargetFrom HistoryOrigin URI
20 | TargetIdUri String URI
21 | TargetUri URI
23 targetUri :: Target -> URI
24 targetUri (TargetHistory item) = historyUri item
25 targetUri (TargetFrom _ uri) = uri
26 targetUri (TargetIdUri _ uri) = uri
27 targetUri (TargetUri uri) = uri
29 targetQueueItem :: Target -> QueueItem
30 targetQueueItem (TargetFrom o uri) = QueueURI (Just o) uri
31 targetQueueItem (TargetHistory item) = QueueHistory item
32 targetQueueItem i = QueueURI Nothing $ targetUri i