1
- {-# LANGUAGE DeriveGeneric #-}
2
- {-# LANGUAGE OverloadedStrings #-}
3
- {-# LANGUAGE RecordWildCards #-}
1
+ {-# LANGUAGE DeriveDataTypeable #-}
2
+ {-# LANGUAGE DeriveGeneric #-}
3
+ {-# LANGUAGE OverloadedStrings #-}
4
+ {-# LANGUAGE RecordWildCards #-}
4
5
5
6
module Dhall.Syntax.Import
6
7
( Directory (.. )
@@ -14,9 +15,11 @@ module Dhall.Syntax.Import
14
15
, Scheme (.. )
15
16
) where
16
17
18
+ import Data.Data (Data )
17
19
import Data.Text (Text )
18
20
import Dhall.Src (Src (.. ))
19
21
import Dhall.Syntax.Expr (Expr (.. ))
22
+ import Dhall.Syntax.Instances.Data ()
20
23
import Dhall.Syntax.Instances.Functor ()
21
24
import GHC.Generics (Generic )
22
25
@@ -29,15 +32,15 @@ import qualified Dhall.Crypto
29
32
@Directory { components = [ "baz", "bar", "foo" ] }@
30
33
-}
31
34
newtype Directory = Directory { components :: [Text ] }
32
- deriving Generic
35
+ deriving ( Data , Generic )
33
36
34
37
{-| A `File` is a `directory` followed by one additional path component
35
38
representing the `file` name
36
39
-}
37
40
data File = File
38
41
{ directory :: Directory
39
42
, file :: Text
40
- } deriving Generic
43
+ } deriving ( Data , Generic )
41
44
42
45
-- | The beginning of a file path which anchors subsequent path components
43
46
data FilePrefix
@@ -49,11 +52,11 @@ data FilePrefix
49
52
-- ^ Path relative to @..@
50
53
| Home
51
54
-- ^ Path relative to @~@
52
- deriving Generic
55
+ deriving ( Data , Generic )
53
56
54
57
-- | The URI scheme
55
58
data Scheme = HTTP | HTTPS
56
- deriving Generic
59
+ deriving ( Data , Generic )
57
60
58
61
-- | This type stores all of the components of a remote import
59
62
data URL = URL
@@ -62,7 +65,7 @@ data URL = URL
62
65
, path :: File
63
66
, query :: Maybe Text
64
67
, headers :: Maybe (Expr Src Import )
65
- } deriving Generic
68
+ } deriving ( Data , Generic )
66
69
67
70
-- | The type of import (i.e. local vs. remote vs. environment)
68
71
data ImportType
@@ -73,23 +76,23 @@ data ImportType
73
76
| Env Text
74
77
-- ^ Environment variable
75
78
| Missing
76
- deriving Generic
79
+ deriving ( Data , Generic )
77
80
78
81
-- | How to interpret the import's contents (i.e. as Dhall code or raw text)
79
82
data ImportMode = Code | RawText | Location
80
- deriving Generic
83
+ deriving ( Data , Generic )
81
84
82
85
-- | A `ImportType` extended with an optional hash for semantic integrity checks
83
86
data ImportHashed = ImportHashed
84
87
{ hash :: Maybe Dhall.Crypto. SHA256Digest
85
88
, importType :: ImportType
86
- } deriving Generic
89
+ } deriving ( Data , Generic )
87
90
88
91
-- | Reference to an external resource
89
92
data Import = Import
90
93
{ importHashed :: ImportHashed
91
94
, importMode :: ImportMode
92
- } deriving Generic
95
+ } deriving ( Data , Generic )
93
96
94
97
95
98
0 commit comments