|
1 | 1 | module Data.URI.Types where |
2 | 2 |
|
3 | 3 | import Prelude |
4 | | - |
5 | 4 | import Data.Either (Either) |
6 | 5 | import Data.Generic (class Generic) |
| 6 | +import Data.List (List) |
7 | 7 | import Data.Maybe (Maybe) |
8 | 8 | import Data.Path.Pathy (Path, File, Dir, Abs, Rel, Sandboxed, Unsandboxed) |
9 | | -import Data.StrMap (StrMap) |
10 | 9 | import Data.Tuple (Tuple) |
11 | 10 |
|
12 | 11 | -- | A generic URI |
@@ -57,60 +56,60 @@ data Host |
57 | 56 | type Port = Int |
58 | 57 |
|
59 | 58 | -- | The query component of a URI. |
60 | | -newtype Query = Query (StrMap (Maybe String)) |
| 59 | +newtype Query = Query (List (Tuple String (Maybe String))) |
61 | 60 |
|
62 | 61 | -- | The hash fragment of a URI. |
63 | 62 | type Fragment = String |
64 | 63 |
|
65 | 64 | derive instance eqURI ∷ Eq URI |
66 | 65 |
|
67 | 66 | instance showURI ∷ Show URI where |
68 | | - show (URI s h q f) = "URI (" <> show s <> ") (" <> show h <> ") (" <> show q <> ") (" <> show f <> ")" |
| 67 | + show (URI s h q f) = "(URI " <> show s <> " " <> show h <> " " <> show q <> " " <> show f <> ")" |
69 | 68 |
|
70 | 69 | derive instance eqAbsoluteURI ∷ Eq AbsoluteURI |
71 | 70 |
|
72 | 71 | instance showAbsoluteURI ∷ Show AbsoluteURI where |
73 | | - show (AbsoluteURI s h q) = "AbsoluteURI (" <> show s <> ") (" <> show h <> ") (" <> show q <> ")" |
| 72 | + show (AbsoluteURI s h q) = "(AbsoluteURI " <> show s <> " " <> show h <> " " <> show q <> ")" |
74 | 73 |
|
75 | 74 | derive instance eqRelativeRef ∷ Eq RelativeRef |
76 | 75 |
|
77 | 76 | instance showRelativeRef ∷ Show RelativeRef where |
78 | | - show (RelativeRef r q f) = "RelativeRef (" <> show r <> ") (" <> show q <> ") (" <> show f <> ")" |
| 77 | + show (RelativeRef r q f) = "(RelativeRef " <> show r <> " " <> show q <> " " <> show f <> ")" |
79 | 78 |
|
80 | 79 | derive instance eqURIScheme ∷ Eq URIScheme |
81 | 80 | derive instance ordURIScheme ∷ Ord URIScheme |
82 | 81 | derive instance genericURIScheme ∷ Generic URIScheme |
83 | 82 |
|
84 | 83 | instance showURIScheme ∷ Show URIScheme where |
85 | | - show (URIScheme s) = "URIScheme " <> show s |
| 84 | + show (URIScheme s) = "(URIScheme " <> show s <> ")" |
86 | 85 |
|
87 | 86 | derive instance eqHierarchicalPart ∷ Eq HierarchicalPart |
88 | 87 |
|
89 | 88 | instance showHierarchicalPart ∷ Show HierarchicalPart where |
90 | | - show (HierarchicalPart authority path) = "HierarchicalPart (" <> show authority <> ") (" <> show path <> ")" |
| 89 | + show (HierarchicalPart authority path) = "(HierarchicalPart " <> show authority <> " " <> show path <> ")" |
91 | 90 |
|
92 | 91 | derive instance eqRelativePart ∷ Eq RelativePart |
93 | 92 |
|
94 | 93 | instance showRelativePart ∷ Show RelativePart where |
95 | | - show (RelativePart authority path) = "RelativePart (" <> show authority <> ") (" <> show path <> ")" |
| 94 | + show (RelativePart authority path) = "(RelativePart " <> show authority <> " " <> show path <> ")" |
96 | 95 |
|
97 | 96 | derive instance eqAuthority ∷ Eq Authority |
98 | 97 | derive instance ordAuthority ∷ Ord Authority |
99 | 98 | derive instance genericAuthority ∷ Generic Authority |
100 | 99 |
|
101 | 100 | instance showAuthority ∷ Show Authority where |
102 | | - show (Authority userinfo hosts) = "Authority (" <> show userinfo <> ") " <> show hosts |
| 101 | + show (Authority userinfo hosts) = "(Authority " <> show userinfo <> " " <> show hosts <> ")" |
103 | 102 |
|
104 | 103 | derive instance eqHost ∷ Eq Host |
105 | 104 | derive instance ordHost ∷ Ord Host |
106 | 105 | derive instance genericQuery ∷ Generic Host |
107 | 106 |
|
108 | 107 | instance showHost ∷ Show Host where |
109 | | - show (IPv6Address ip) = "IPv6Address " <> show ip |
110 | | - show (IPv4Address ip) = "IPv4Address " <> show ip |
111 | | - show (NameAddress name) = "NameAddress " <> show name |
| 108 | + show (IPv6Address ip) = "(IPv6Address " <> show ip <> ")" |
| 109 | + show (IPv4Address ip) = "(IPv4Address " <> show ip <> ")" |
| 110 | + show (NameAddress name) = "(NameAddress " <> show name <> ")" |
112 | 111 |
|
113 | 112 | derive instance eqQuery ∷ Eq Query |
114 | 113 |
|
115 | 114 | instance showQuery ∷ Show Query where |
116 | | - show (Query m) = "Query (" <> show m <> ")" |
| 115 | + show (Query m) = "(Query (" <> show m <> "))" |
0 commit comments