File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
pub/functora/src/cfg/Functora Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
module Functora.CfgOrphan () where
4
4
5
+ import qualified Data.Aeson as A
5
6
import Functora.Prelude
6
7
import qualified Text.URI as URI
7
8
import qualified Toml
8
9
10
+ instance A. ToJSON URI where
11
+ toJSON =
12
+ A. toJSON . URI. render
13
+
14
+ instance A. FromJSON URI where
15
+ parseJSON =
16
+ A. withText " URI"
17
+ $ either (fail . displayException) pure
18
+ . URI. mkURI
19
+
9
20
instance Toml. HasCodec URI where
10
21
hasCodec =
11
- Toml. textBy URI. render $
12
- first (from @ String @ Text . displayException) . URI. mkURI
22
+ Toml. textBy URI. render
23
+ $ first (from @ String @ Text . displayException)
24
+ . URI. mkURI
13
25
14
26
instance Toml. HasItemCodec URI where
15
27
hasItemCodec =
@@ -21,4 +33,5 @@ instance Toml.HasItemCodec URI where
21
33
(const . Toml. MatchError Toml. TText $ Toml. AnyValue src)
22
34
$ URI. mkURI txt
23
35
)
24
- $ Toml. Text . URI. render
36
+ $ Toml. Text
37
+ . URI. render
You can’t perform that action at this time.
0 commit comments