forked from haskell-github/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathURL.hs
More file actions
30 lines (24 loc) · 697 Bytes
/
URL.hs
File metadata and controls
30 lines (24 loc) · 697 Bytes
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
-----------------------------------------------------------------------------
-- |
-- License : BSD-3-Clause
-- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>
--
module GitHub.Data.URL (
URL(..),
getUrl,
) where
import GitHub.Internal.Prelude
import Prelude ()
-- | Data representing URLs in responses.
--
-- /N.B./ syntactical validity is not verified.
newtype URL = URL Text
deriving (Eq, Ord, Show, Generic, Typeable, Data)
getUrl :: URL -> Text
getUrl (URL url) = url
instance NFData URL where rnf = genericRnf
instance Binary URL
instance ToJSON URL where
toJSON (URL url) = toJSON url
instance FromJSON URL where
parseJSON = withText "URL" (pure . URL)