{-# LANGUAGE NoImplicitPrelude #-}

module Stack.Types.AllowNewerDeps
  ( AllowNewerDeps (..)
  ) where

import qualified Distribution.PackageDescription as C
import           Generics.Deriving.Monoid ( mappenddefault, memptydefault )
import           Pantry.Internal.AesonExtended ( FromJSON (..) )
import           Stack.Prelude

newtype AllowNewerDeps
  = AllowNewerDeps [PackageName]
  deriving (AllowNewerDeps -> AllowNewerDeps -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AllowNewerDeps -> AllowNewerDeps -> Bool
$c/= :: AllowNewerDeps -> AllowNewerDeps -> Bool
== :: AllowNewerDeps -> AllowNewerDeps -> Bool
$c== :: AllowNewerDeps -> AllowNewerDeps -> Bool
Eq, forall x. Rep AllowNewerDeps x -> AllowNewerDeps
forall x. AllowNewerDeps -> Rep AllowNewerDeps x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AllowNewerDeps x -> AllowNewerDeps
$cfrom :: forall x. AllowNewerDeps -> Rep AllowNewerDeps x
Generic, Eq AllowNewerDeps
AllowNewerDeps -> AllowNewerDeps -> Bool
AllowNewerDeps -> AllowNewerDeps -> Ordering
AllowNewerDeps -> AllowNewerDeps -> AllowNewerDeps
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
min :: AllowNewerDeps -> AllowNewerDeps -> AllowNewerDeps
$cmin :: AllowNewerDeps -> AllowNewerDeps -> AllowNewerDeps
max :: AllowNewerDeps -> AllowNewerDeps -> AllowNewerDeps
$cmax :: AllowNewerDeps -> AllowNewerDeps -> AllowNewerDeps
>= :: AllowNewerDeps -> AllowNewerDeps -> Bool
$c>= :: AllowNewerDeps -> AllowNewerDeps -> Bool
> :: AllowNewerDeps -> AllowNewerDeps -> Bool
$c> :: AllowNewerDeps -> AllowNewerDeps -> Bool
<= :: AllowNewerDeps -> AllowNewerDeps -> Bool
$c<= :: AllowNewerDeps -> AllowNewerDeps -> Bool
< :: AllowNewerDeps -> AllowNewerDeps -> Bool
$c< :: AllowNewerDeps -> AllowNewerDeps -> Bool
compare :: AllowNewerDeps -> AllowNewerDeps -> Ordering
$ccompare :: AllowNewerDeps -> AllowNewerDeps -> Ordering
Ord, ReadPrec [AllowNewerDeps]
ReadPrec AllowNewerDeps
Int -> ReadS AllowNewerDeps
ReadS [AllowNewerDeps]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AllowNewerDeps]
$creadListPrec :: ReadPrec [AllowNewerDeps]
readPrec :: ReadPrec AllowNewerDeps
$creadPrec :: ReadPrec AllowNewerDeps
readList :: ReadS [AllowNewerDeps]
$creadList :: ReadS [AllowNewerDeps]
readsPrec :: Int -> ReadS AllowNewerDeps
$creadsPrec :: Int -> ReadS AllowNewerDeps
Read, Int -> AllowNewerDeps -> ShowS
[AllowNewerDeps] -> ShowS
AllowNewerDeps -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AllowNewerDeps] -> ShowS
$cshowList :: [AllowNewerDeps] -> ShowS
show :: AllowNewerDeps -> String
$cshow :: AllowNewerDeps -> String
showsPrec :: Int -> AllowNewerDeps -> ShowS
$cshowsPrec :: Int -> AllowNewerDeps -> ShowS
Show)

instance Semigroup AllowNewerDeps where
  <> :: AllowNewerDeps -> AllowNewerDeps -> AllowNewerDeps
(<>) = forall a. (Generic a, Monoid' (Rep a)) => a -> a -> a
mappenddefault

instance Monoid AllowNewerDeps where
  mappend :: AllowNewerDeps -> AllowNewerDeps -> AllowNewerDeps
mappend = forall a. Semigroup a => a -> a -> a
(<>)
  mempty :: AllowNewerDeps
mempty = forall a. (Generic a, Monoid' (Rep a)) => a
memptydefault

instance FromJSON AllowNewerDeps where
  parseJSON :: Value -> Parser AllowNewerDeps
parseJSON = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ([PackageName] -> AllowNewerDeps
AllowNewerDeps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> PackageName
C.mkPackageName) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. FromJSON a => Value -> Parser a
parseJSON