    {-# LANGUAGE TemplateHaskell #-}

    module Debian.VendorURI
        ( VendorURI(..)
        , vendorURI
        , parseVendorURI
        ) where

    import Control.Lens (makeLenses, review)
    import Debian.URI (parseURI, URI())
    import Language.Haskell.TH.Syntax (Loc)

    newtype VendorURI = VendorURI {VendorURI -> URI
    _vendorURI :: URI} deriving (VendorURI -> VendorURI -> Bool
    (VendorURI -> VendorURI -> Bool)
    -> (VendorURI -> VendorURI -> Bool) -> Eq VendorURI
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: VendorURI -> VendorURI -> Bool
    == :: VendorURI -> VendorURI -> Bool
    $c/= :: VendorURI -> VendorURI -> Bool
    /= :: VendorURI -> VendorURI -> Bool
    Eq, Eq VendorURI
    Eq VendorURI =>
    (VendorURI -> VendorURI -> Ordering)
    -> (VendorURI -> VendorURI -> Bool)
    -> (VendorURI -> VendorURI -> Bool)
    -> (VendorURI -> VendorURI -> Bool)
    -> (VendorURI -> VendorURI -> Bool)
    -> (VendorURI -> VendorURI -> VendorURI)
    -> (VendorURI -> VendorURI -> VendorURI)
    -> Ord VendorURI
    VendorURI -> VendorURI -> Bool
    VendorURI -> VendorURI -> Ordering
    VendorURI -> VendorURI -> VendorURI
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: VendorURI -> VendorURI -> Ordering
    compare :: VendorURI -> VendorURI -> Ordering
    $c< :: VendorURI -> VendorURI -> Bool
    < :: VendorURI -> VendorURI -> Bool
    $c<= :: VendorURI -> VendorURI -> Bool
    <= :: VendorURI -> VendorURI -> Bool
    $c> :: VendorURI -> VendorURI -> Bool
    > :: VendorURI -> VendorURI -> Bool
    $c>= :: VendorURI -> VendorURI -> Bool
    >= :: VendorURI -> VendorURI -> Bool
    $cmax :: VendorURI -> VendorURI -> VendorURI
    max :: VendorURI -> VendorURI -> VendorURI
    $cmin :: VendorURI -> VendorURI -> VendorURI
    min :: VendorURI -> VendorURI -> VendorURI
    Ord)

    instance Show VendorURI where
        show :: VendorURI -> String
    show (VendorURI URI
    uri) = String
    "VendorURI (fromJust (parseURIReference " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ShowS
    forall a. Show a => a -> String
    show (URI -> String
    forall a. Show a => a -> String
    show URI
    uri) String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    "))"

    $(makeLenses ''VendorURI)

    parseVendorURI :: [Loc] -> String -> Maybe VendorURI
    parseVendorURI :: [Loc] -> String -> Maybe VendorURI
    parseVendorURI [Loc]
    locs String
    s = (URI -> VendorURI) -> Maybe URI -> Maybe VendorURI
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (AReview VendorURI URI -> URI -> VendorURI
    forall b (m :: * -> *) t. MonadReader b m => AReview t b -> m t
    review AReview VendorURI URI
    Iso' VendorURI URI
    vendorURI) (String -> Maybe URI
    parseURI String
    s)

    -- toURI' :: VendorURI -> URI'
    -- toURI' = URI' . show . view vendorURI