{-# LANGUAGE MultiWayIf, PatternSynonyms #-}
module Language.Haskell.Syntax.Specificity (
ForAllTyFlag(Invisible,Required,Specified,Inferred),
Specificity(..),
isVisibleForAllTyFlag, isInvisibleForAllTyFlag, isInferredForAllTyFlag,
isSpecifiedForAllTyFlag,
coreTyLamForAllTyFlag,
) where
import Prelude
import Data.Data
data ForAllTyFlag = Invisible !Specificity
| Required
deriving (ForAllTyFlag -> ForAllTyFlag -> Bool
(ForAllTyFlag -> ForAllTyFlag -> Bool)
-> (ForAllTyFlag -> ForAllTyFlag -> Bool) -> Eq ForAllTyFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ForAllTyFlag -> ForAllTyFlag -> Bool
== :: ForAllTyFlag -> ForAllTyFlag -> Bool
$c/= :: ForAllTyFlag -> ForAllTyFlag -> Bool
/= :: ForAllTyFlag -> ForAllTyFlag -> Bool
Eq, Eq ForAllTyFlag
Eq ForAllTyFlag =>
(ForAllTyFlag -> ForAllTyFlag -> Ordering)
-> (ForAllTyFlag -> ForAllTyFlag -> Bool)
-> (ForAllTyFlag -> ForAllTyFlag -> Bool)
-> (ForAllTyFlag -> ForAllTyFlag -> Bool)
-> (ForAllTyFlag -> ForAllTyFlag -> Bool)
-> (ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag)
-> (ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag)
-> Ord ForAllTyFlag
ForAllTyFlag -> ForAllTyFlag -> Bool
ForAllTyFlag -> ForAllTyFlag -> Ordering
ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag
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 :: ForAllTyFlag -> ForAllTyFlag -> Ordering
compare :: ForAllTyFlag -> ForAllTyFlag -> Ordering
$c< :: ForAllTyFlag -> ForAllTyFlag -> Bool
< :: ForAllTyFlag -> ForAllTyFlag -> Bool
$c<= :: ForAllTyFlag -> ForAllTyFlag -> Bool
<= :: ForAllTyFlag -> ForAllTyFlag -> Bool
$c> :: ForAllTyFlag -> ForAllTyFlag -> Bool
> :: ForAllTyFlag -> ForAllTyFlag -> Bool
$c>= :: ForAllTyFlag -> ForAllTyFlag -> Bool
>= :: ForAllTyFlag -> ForAllTyFlag -> Bool
$cmax :: ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag
max :: ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag
$cmin :: ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag
min :: ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag
Ord, Typeable ForAllTyFlag
Typeable ForAllTyFlag =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ForAllTyFlag -> c ForAllTyFlag)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ForAllTyFlag)
-> (ForAllTyFlag -> Constr)
-> (ForAllTyFlag -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ForAllTyFlag))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ForAllTyFlag))
-> ((forall b. Data b => b -> b) -> ForAllTyFlag -> ForAllTyFlag)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r)
-> (forall u. (forall d. Data d => d -> u) -> ForAllTyFlag -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ForAllTyFlag -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag)
-> Data ForAllTyFlag
ForAllTyFlag -> Constr
ForAllTyFlag -> DataType
(forall b. Data b => b -> b) -> ForAllTyFlag -> ForAllTyFlag
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ForAllTyFlag -> u
forall u. (forall d. Data d => d -> u) -> ForAllTyFlag -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ForAllTyFlag
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ForAllTyFlag -> c ForAllTyFlag
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ForAllTyFlag)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ForAllTyFlag)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ForAllTyFlag -> c ForAllTyFlag
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ForAllTyFlag -> c ForAllTyFlag
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ForAllTyFlag
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ForAllTyFlag
$ctoConstr :: ForAllTyFlag -> Constr
toConstr :: ForAllTyFlag -> Constr
$cdataTypeOf :: ForAllTyFlag -> DataType
dataTypeOf :: ForAllTyFlag -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ForAllTyFlag)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ForAllTyFlag)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ForAllTyFlag)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ForAllTyFlag)
$cgmapT :: (forall b. Data b => b -> b) -> ForAllTyFlag -> ForAllTyFlag
gmapT :: (forall b. Data b => b -> b) -> ForAllTyFlag -> ForAllTyFlag
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ForAllTyFlag -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> ForAllTyFlag -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ForAllTyFlag -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ForAllTyFlag -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag
Data)
data Specificity = InferredSpec
| SpecifiedSpec
deriving (Specificity -> Specificity -> Bool
(Specificity -> Specificity -> Bool)
-> (Specificity -> Specificity -> Bool) -> Eq Specificity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Specificity -> Specificity -> Bool
== :: Specificity -> Specificity -> Bool
$c/= :: Specificity -> Specificity -> Bool
/= :: Specificity -> Specificity -> Bool
Eq, Eq Specificity
Eq Specificity =>
(Specificity -> Specificity -> Ordering)
-> (Specificity -> Specificity -> Bool)
-> (Specificity -> Specificity -> Bool)
-> (Specificity -> Specificity -> Bool)
-> (Specificity -> Specificity -> Bool)
-> (Specificity -> Specificity -> Specificity)
-> (Specificity -> Specificity -> Specificity)
-> Ord Specificity
Specificity -> Specificity -> Bool
Specificity -> Specificity -> Ordering
Specificity -> Specificity -> Specificity
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 :: Specificity -> Specificity -> Ordering
compare :: Specificity -> Specificity -> Ordering
$c< :: Specificity -> Specificity -> Bool
< :: Specificity -> Specificity -> Bool
$c<= :: Specificity -> Specificity -> Bool
<= :: Specificity -> Specificity -> Bool
$c> :: Specificity -> Specificity -> Bool
> :: Specificity -> Specificity -> Bool
$c>= :: Specificity -> Specificity -> Bool
>= :: Specificity -> Specificity -> Bool
$cmax :: Specificity -> Specificity -> Specificity
max :: Specificity -> Specificity -> Specificity
$cmin :: Specificity -> Specificity -> Specificity
min :: Specificity -> Specificity -> Specificity
Ord, Typeable Specificity
Typeable Specificity =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Specificity -> c Specificity)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Specificity)
-> (Specificity -> Constr)
-> (Specificity -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Specificity))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Specificity))
-> ((forall b. Data b => b -> b) -> Specificity -> Specificity)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Specificity -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Specificity -> r)
-> (forall u. (forall d. Data d => d -> u) -> Specificity -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> Specificity -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity)
-> Data Specificity
Specificity -> Constr
Specificity -> DataType
(forall b. Data b => b -> b) -> Specificity -> Specificity
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Specificity -> u
forall u. (forall d. Data d => d -> u) -> Specificity -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Specificity -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Specificity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Specificity
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Specificity -> c Specificity
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Specificity)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Specificity)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Specificity -> c Specificity
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Specificity -> c Specificity
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Specificity
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Specificity
$ctoConstr :: Specificity -> Constr
toConstr :: Specificity -> Constr
$cdataTypeOf :: Specificity -> DataType
dataTypeOf :: Specificity -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Specificity)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Specificity)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Specificity)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Specificity)
$cgmapT :: (forall b. Data b => b -> b) -> Specificity -> Specificity
gmapT :: (forall b. Data b => b -> b) -> Specificity -> Specificity
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Specificity -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Specificity -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Specificity -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Specificity -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Specificity -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Specificity -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Specificity -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Specificity -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Specificity -> m Specificity
Data)
pattern Inferred, Specified :: ForAllTyFlag
pattern $mInferred :: forall {r}. ForAllTyFlag -> ((# #) -> r) -> ((# #) -> r) -> r
$bInferred :: ForAllTyFlag
Inferred = Invisible InferredSpec
pattern $mSpecified :: forall {r}. ForAllTyFlag -> ((# #) -> r) -> ((# #) -> r) -> r
$bSpecified :: ForAllTyFlag
Specified = Invisible SpecifiedSpec
{-# COMPLETE Required, Specified, Inferred #-}
isVisibleForAllTyFlag :: ForAllTyFlag -> Bool
isVisibleForAllTyFlag :: ForAllTyFlag -> Bool
isVisibleForAllTyFlag ForAllTyFlag
af = Bool -> Bool
not (ForAllTyFlag -> Bool
isInvisibleForAllTyFlag ForAllTyFlag
af)
isInvisibleForAllTyFlag :: ForAllTyFlag -> Bool
isInvisibleForAllTyFlag :: ForAllTyFlag -> Bool
isInvisibleForAllTyFlag (Invisible {}) = Bool
True
isInvisibleForAllTyFlag ForAllTyFlag
Required = Bool
False
isInferredForAllTyFlag :: ForAllTyFlag -> Bool
isInferredForAllTyFlag :: ForAllTyFlag -> Bool
isInferredForAllTyFlag (Invisible Specificity
InferredSpec) = Bool
True
isInferredForAllTyFlag ForAllTyFlag
_ = Bool
False
isSpecifiedForAllTyFlag :: ForAllTyFlag -> Bool
isSpecifiedForAllTyFlag :: ForAllTyFlag -> Bool
isSpecifiedForAllTyFlag (Invisible Specificity
SpecifiedSpec) = Bool
True
isSpecifiedForAllTyFlag ForAllTyFlag
_ = Bool
False
coreTyLamForAllTyFlag :: ForAllTyFlag
coreTyLamForAllTyFlag :: ForAllTyFlag
coreTyLamForAllTyFlag = ForAllTyFlag
Specified