blob: f96e88ce8e3718058e06570b451c52550ca92055 (
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
|
module Destination (
Destination,
DeclaredDestination(..),
DestinationName(..),
openDestination,
) where
import Data.Text (Text)
import Data.Text qualified as T
import System.Directory
data Destination
= FilesystemDestination FilePath
data DeclaredDestination = DeclaredDestination
{ destinationName :: DestinationName
, destinationUrl :: Maybe Text
}
newtype DestinationName = DestinationName Text
deriving (Eq, Ord, Show)
openDestination :: Text -> IO Destination
openDestination url = do
let path = T.unpack url
createDirectoryIfMissing True path
return $ FilesystemDestination path
|