{-# LANGUAGE CPP #-}

{-| Some common syntactic entities are defined in this module.
-}
module Agda.Syntax.Common where

import Prelude hiding (null)

import Control.DeepSeq
import Control.Arrow ((&&&))
import Control.Applicative ((<|>), liftA2)

#if __GLASGOW_HASKELL__ < 804
import Data.Semigroup hiding (Arg)
#endif
import Data.Bifunctor
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as ByteString
import qualified Data.Foldable as Fold
import Data.Function
import Data.Hashable (Hashable(..))
import qualified Data.Strict.Maybe as Strict
import Data.Data (Data)
import Data.Word
import Data.IntSet (IntSet)
import qualified Data.IntSet as IntSet

import GHC.Generics (Generic)

import Agda.Syntax.Position

import Agda.Utils.Functor
import Agda.Utils.Lens
import Agda.Utils.List1  ( List1, pattern (:|), (<|) )
import qualified Agda.Utils.List1 as List1
import Agda.Utils.Maybe
import Agda.Utils.Null
import Agda.Utils.PartialOrd
import Agda.Utils.POMonoid
import Agda.Utils.Pretty

import Agda.Utils.Impossible

type Nat    = Int
type Arity  = Nat

---------------------------------------------------------------------------
-- * Delayed
---------------------------------------------------------------------------

-- | Used to specify whether something should be delayed.
data Delayed = Delayed | NotDelayed
  deriving (Typeable Delayed
DataType
Constr
Typeable Delayed
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Delayed -> c Delayed)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Delayed)
-> (Delayed -> Constr)
-> (Delayed -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Delayed))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Delayed))
-> ((forall b. Data b => b -> b) -> Delayed -> Delayed)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Delayed -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Delayed -> r)
-> (forall u. (forall d. Data d => d -> u) -> Delayed -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Delayed -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Delayed -> m Delayed)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Delayed -> m Delayed)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Delayed -> m Delayed)
-> Data Delayed
Delayed -> DataType
Delayed -> Constr
(forall b. Data b => b -> b) -> Delayed -> Delayed
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Delayed -> c Delayed
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Delayed
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) -> Delayed -> u
forall u. (forall d. Data d => d -> u) -> Delayed -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Delayed -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Delayed -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Delayed -> m Delayed
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Delayed -> m Delayed
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Delayed
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Delayed -> c Delayed
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Delayed)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Delayed)
$cNotDelayed :: Constr
$cDelayed :: Constr
$tDelayed :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Delayed -> m Delayed
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Delayed -> m Delayed
gmapMp :: (forall d. Data d => d -> m d) -> Delayed -> m Delayed
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Delayed -> m Delayed
gmapM :: (forall d. Data d => d -> m d) -> Delayed -> m Delayed
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Delayed -> m Delayed
gmapQi :: Int -> (forall d. Data d => d -> u) -> Delayed -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Delayed -> u
gmapQ :: (forall d. Data d => d -> u) -> Delayed -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Delayed -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Delayed -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Delayed -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Delayed -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Delayed -> r
gmapT :: (forall b. Data b => b -> b) -> Delayed -> Delayed
$cgmapT :: (forall b. Data b => b -> b) -> Delayed -> Delayed
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Delayed)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Delayed)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Delayed)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Delayed)
dataTypeOf :: Delayed -> DataType
$cdataTypeOf :: Delayed -> DataType
toConstr :: Delayed -> Constr
$ctoConstr :: Delayed -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Delayed
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Delayed
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Delayed -> c Delayed
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Delayed -> c Delayed
$cp1Data :: Typeable Delayed
Data, Int -> Delayed -> ShowS
[Delayed] -> ShowS
Delayed -> String
(Int -> Delayed -> ShowS)
-> (Delayed -> String) -> ([Delayed] -> ShowS) -> Show Delayed
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Delayed] -> ShowS
$cshowList :: [Delayed] -> ShowS
show :: Delayed -> String
$cshow :: Delayed -> String
showsPrec :: Int -> Delayed -> ShowS
$cshowsPrec :: Int -> Delayed -> ShowS
Show, Delayed -> Delayed -> Bool
(Delayed -> Delayed -> Bool)
-> (Delayed -> Delayed -> Bool) -> Eq Delayed
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Delayed -> Delayed -> Bool
$c/= :: Delayed -> Delayed -> Bool
== :: Delayed -> Delayed -> Bool
$c== :: Delayed -> Delayed -> Bool
Eq, Eq Delayed
Eq Delayed
-> (Delayed -> Delayed -> Ordering)
-> (Delayed -> Delayed -> Bool)
-> (Delayed -> Delayed -> Bool)
-> (Delayed -> Delayed -> Bool)
-> (Delayed -> Delayed -> Bool)
-> (Delayed -> Delayed -> Delayed)
-> (Delayed -> Delayed -> Delayed)
-> Ord Delayed
Delayed -> Delayed -> Bool
Delayed -> Delayed -> Ordering
Delayed -> Delayed -> Delayed
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 :: Delayed -> Delayed -> Delayed
$cmin :: Delayed -> Delayed -> Delayed
max :: Delayed -> Delayed -> Delayed
$cmax :: Delayed -> Delayed -> Delayed
>= :: Delayed -> Delayed -> Bool
$c>= :: Delayed -> Delayed -> Bool
> :: Delayed -> Delayed -> Bool
$c> :: Delayed -> Delayed -> Bool
<= :: Delayed -> Delayed -> Bool
$c<= :: Delayed -> Delayed -> Bool
< :: Delayed -> Delayed -> Bool
$c< :: Delayed -> Delayed -> Bool
compare :: Delayed -> Delayed -> Ordering
$ccompare :: Delayed -> Delayed -> Ordering
$cp1Ord :: Eq Delayed
Ord, (forall x. Delayed -> Rep Delayed x)
-> (forall x. Rep Delayed x -> Delayed) -> Generic Delayed
forall x. Rep Delayed x -> Delayed
forall x. Delayed -> Rep Delayed x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Delayed x -> Delayed
$cfrom :: forall x. Delayed -> Rep Delayed x
Generic)

instance KillRange Delayed where
  killRange :: Delayed -> Delayed
killRange = Delayed -> Delayed
forall a. a -> a
id

instance NFData Delayed

---------------------------------------------------------------------------
-- * File
---------------------------------------------------------------------------

data FileType = AgdaFileType | MdFileType | RstFileType | TexFileType | OrgFileType
  deriving (Typeable FileType
DataType
Constr
Typeable FileType
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> FileType -> c FileType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FileType)
-> (FileType -> Constr)
-> (FileType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c FileType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FileType))
-> ((forall b. Data b => b -> b) -> FileType -> FileType)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> FileType -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> FileType -> r)
-> (forall u. (forall d. Data d => d -> u) -> FileType -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FileType -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> FileType -> m FileType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FileType -> m FileType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FileType -> m FileType)
-> Data FileType
FileType -> DataType
FileType -> Constr
(forall b. Data b => b -> b) -> FileType -> FileType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FileType -> c FileType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FileType
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) -> FileType -> u
forall u. (forall d. Data d => d -> u) -> FileType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FileType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FileType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FileType -> m FileType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FileType -> m FileType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FileType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FileType -> c FileType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FileType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FileType)
$cOrgFileType :: Constr
$cTexFileType :: Constr
$cRstFileType :: Constr
$cMdFileType :: Constr
$cAgdaFileType :: Constr
$tFileType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FileType -> m FileType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FileType -> m FileType
gmapMp :: (forall d. Data d => d -> m d) -> FileType -> m FileType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FileType -> m FileType
gmapM :: (forall d. Data d => d -> m d) -> FileType -> m FileType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FileType -> m FileType
gmapQi :: Int -> (forall d. Data d => d -> u) -> FileType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FileType -> u
gmapQ :: (forall d. Data d => d -> u) -> FileType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FileType -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FileType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FileType -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FileType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FileType -> r
gmapT :: (forall b. Data b => b -> b) -> FileType -> FileType
$cgmapT :: (forall b. Data b => b -> b) -> FileType -> FileType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FileType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FileType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FileType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FileType)
dataTypeOf :: FileType -> DataType
$cdataTypeOf :: FileType -> DataType
toConstr :: FileType -> Constr
$ctoConstr :: FileType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FileType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FileType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FileType -> c FileType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FileType -> c FileType
$cp1Data :: Typeable FileType
Data, FileType -> FileType -> Bool
(FileType -> FileType -> Bool)
-> (FileType -> FileType -> Bool) -> Eq FileType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileType -> FileType -> Bool
$c/= :: FileType -> FileType -> Bool
== :: FileType -> FileType -> Bool
$c== :: FileType -> FileType -> Bool
Eq, Eq FileType
Eq FileType
-> (FileType -> FileType -> Ordering)
-> (FileType -> FileType -> Bool)
-> (FileType -> FileType -> Bool)
-> (FileType -> FileType -> Bool)
-> (FileType -> FileType -> Bool)
-> (FileType -> FileType -> FileType)
-> (FileType -> FileType -> FileType)
-> Ord FileType
FileType -> FileType -> Bool
FileType -> FileType -> Ordering
FileType -> FileType -> FileType
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 :: FileType -> FileType -> FileType
$cmin :: FileType -> FileType -> FileType
max :: FileType -> FileType -> FileType
$cmax :: FileType -> FileType -> FileType
>= :: FileType -> FileType -> Bool
$c>= :: FileType -> FileType -> Bool
> :: FileType -> FileType -> Bool
$c> :: FileType -> FileType -> Bool
<= :: FileType -> FileType -> Bool
$c<= :: FileType -> FileType -> Bool
< :: FileType -> FileType -> Bool
$c< :: FileType -> FileType -> Bool
compare :: FileType -> FileType -> Ordering
$ccompare :: FileType -> FileType -> Ordering
$cp1Ord :: Eq FileType
Ord, Int -> FileType -> ShowS
[FileType] -> ShowS
FileType -> String
(Int -> FileType -> ShowS)
-> (FileType -> String) -> ([FileType] -> ShowS) -> Show FileType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileType] -> ShowS
$cshowList :: [FileType] -> ShowS
show :: FileType -> String
$cshow :: FileType -> String
showsPrec :: Int -> FileType -> ShowS
$cshowsPrec :: Int -> FileType -> ShowS
Show, (forall x. FileType -> Rep FileType x)
-> (forall x. Rep FileType x -> FileType) -> Generic FileType
forall x. Rep FileType x -> FileType
forall x. FileType -> Rep FileType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileType x -> FileType
$cfrom :: forall x. FileType -> Rep FileType x
Generic)

instance Pretty FileType where
  pretty :: FileType -> Doc
pretty = \case
    FileType
AgdaFileType -> Doc
"Agda"
    FileType
MdFileType   -> Doc
"Markdown"
    FileType
RstFileType  -> Doc
"ReStructedText"
    FileType
TexFileType  -> Doc
"LaTeX"
    FileType
OrgFileType  -> Doc
"org-mode"

instance NFData FileType

---------------------------------------------------------------------------
-- * Agda variants
---------------------------------------------------------------------------

-- | Variants of Cubical Agda.

data Cubical = CErased | CFull
    deriving (Cubical -> Cubical -> Bool
(Cubical -> Cubical -> Bool)
-> (Cubical -> Cubical -> Bool) -> Eq Cubical
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Cubical -> Cubical -> Bool
$c/= :: Cubical -> Cubical -> Bool
== :: Cubical -> Cubical -> Bool
$c== :: Cubical -> Cubical -> Bool
Eq, Int -> Cubical -> ShowS
[Cubical] -> ShowS
Cubical -> String
(Int -> Cubical -> ShowS)
-> (Cubical -> String) -> ([Cubical] -> ShowS) -> Show Cubical
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Cubical] -> ShowS
$cshowList :: [Cubical] -> ShowS
show :: Cubical -> String
$cshow :: Cubical -> String
showsPrec :: Int -> Cubical -> ShowS
$cshowsPrec :: Int -> Cubical -> ShowS
Show, (forall x. Cubical -> Rep Cubical x)
-> (forall x. Rep Cubical x -> Cubical) -> Generic Cubical
forall x. Rep Cubical x -> Cubical
forall x. Cubical -> Rep Cubical x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Cubical x -> Cubical
$cfrom :: forall x. Cubical -> Rep Cubical x
Generic)

instance NFData Cubical

-- | Agda variants.
--
-- Only some variants are tracked.

data Language
  = WithoutK
  | WithK
  | Cubical Cubical
    deriving (Language -> Language -> Bool
(Language -> Language -> Bool)
-> (Language -> Language -> Bool) -> Eq Language
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Language -> Language -> Bool
$c/= :: Language -> Language -> Bool
== :: Language -> Language -> Bool
$c== :: Language -> Language -> Bool
Eq, Int -> Language -> ShowS
[Language] -> ShowS
Language -> String
(Int -> Language -> ShowS)
-> (Language -> String) -> ([Language] -> ShowS) -> Show Language
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Language] -> ShowS
$cshowList :: [Language] -> ShowS
show :: Language -> String
$cshow :: Language -> String
showsPrec :: Int -> Language -> ShowS
$cshowsPrec :: Int -> Language -> ShowS
Show, (forall x. Language -> Rep Language x)
-> (forall x. Rep Language x -> Language) -> Generic Language
forall x. Rep Language x -> Language
forall x. Language -> Rep Language x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Language x -> Language
$cfrom :: forall x. Language -> Rep Language x
Generic)

instance KillRange Language where
  killRange :: KillRangeT Language
killRange = KillRangeT Language
forall a. a -> a
id

instance NFData Language

---------------------------------------------------------------------------
-- * Record Directives
---------------------------------------------------------------------------

data RecordDirectives' a = RecordDirectives
  { RecordDirectives' a -> Maybe (Ranged Induction)
recInductive   :: Maybe (Ranged Induction)
  , RecordDirectives' a -> Maybe HasEta0
recHasEta      :: Maybe HasEta0
  , RecordDirectives' a -> Maybe Range
recPattern     :: Maybe Range
  , RecordDirectives' a -> Maybe a
recConstructor :: Maybe a
  } deriving (a -> RecordDirectives' b -> RecordDirectives' a
(a -> b) -> RecordDirectives' a -> RecordDirectives' b
(forall a b.
 (a -> b) -> RecordDirectives' a -> RecordDirectives' b)
-> (forall a b. a -> RecordDirectives' b -> RecordDirectives' a)
-> Functor RecordDirectives'
forall a b. a -> RecordDirectives' b -> RecordDirectives' a
forall a b. (a -> b) -> RecordDirectives' a -> RecordDirectives' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> RecordDirectives' b -> RecordDirectives' a
$c<$ :: forall a b. a -> RecordDirectives' b -> RecordDirectives' a
fmap :: (a -> b) -> RecordDirectives' a -> RecordDirectives' b
$cfmap :: forall a b. (a -> b) -> RecordDirectives' a -> RecordDirectives' b
Functor, Typeable (RecordDirectives' a)
DataType
Constr
Typeable (RecordDirectives' a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> RecordDirectives' a
    -> c (RecordDirectives' a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (RecordDirectives' a))
-> (RecordDirectives' a -> Constr)
-> (RecordDirectives' a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (RecordDirectives' a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (RecordDirectives' a)))
-> ((forall b. Data b => b -> b)
    -> RecordDirectives' a -> RecordDirectives' a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> RecordDirectives' a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> RecordDirectives' a -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> RecordDirectives' a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> RecordDirectives' a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> RecordDirectives' a -> m (RecordDirectives' a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> RecordDirectives' a -> m (RecordDirectives' a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> RecordDirectives' a -> m (RecordDirectives' a))
-> Data (RecordDirectives' a)
RecordDirectives' a -> DataType
RecordDirectives' a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (RecordDirectives' a))
(forall b. Data b => b -> b)
-> RecordDirectives' a -> RecordDirectives' a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RecordDirectives' a
-> c (RecordDirectives' a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RecordDirectives' a)
forall a. Data a => Typeable (RecordDirectives' a)
forall a. Data a => RecordDirectives' a -> DataType
forall a. Data a => RecordDirectives' a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b)
-> RecordDirectives' a -> RecordDirectives' a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> RecordDirectives' a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> RecordDirectives' a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirectives' a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirectives' a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> RecordDirectives' a -> m (RecordDirectives' a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> RecordDirectives' a -> m (RecordDirectives' a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RecordDirectives' a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RecordDirectives' a
-> c (RecordDirectives' a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (RecordDirectives' a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RecordDirectives' a))
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) -> RecordDirectives' a -> u
forall u.
(forall d. Data d => d -> u) -> RecordDirectives' a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirectives' a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirectives' a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> RecordDirectives' a -> m (RecordDirectives' a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordDirectives' a -> m (RecordDirectives' a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RecordDirectives' a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RecordDirectives' a
-> c (RecordDirectives' a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (RecordDirectives' a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RecordDirectives' a))
$cRecordDirectives :: Constr
$tRecordDirectives' :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> RecordDirectives' a -> m (RecordDirectives' a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> RecordDirectives' a -> m (RecordDirectives' a)
gmapMp :: (forall d. Data d => d -> m d)
-> RecordDirectives' a -> m (RecordDirectives' a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> RecordDirectives' a -> m (RecordDirectives' a)
gmapM :: (forall d. Data d => d -> m d)
-> RecordDirectives' a -> m (RecordDirectives' a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> RecordDirectives' a -> m (RecordDirectives' a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> RecordDirectives' a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> RecordDirectives' a -> u
gmapQ :: (forall d. Data d => d -> u) -> RecordDirectives' a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> RecordDirectives' a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirectives' a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirectives' a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirectives' a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirectives' a -> r
gmapT :: (forall b. Data b => b -> b)
-> RecordDirectives' a -> RecordDirectives' a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b)
-> RecordDirectives' a -> RecordDirectives' a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RecordDirectives' a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RecordDirectives' a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (RecordDirectives' a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (RecordDirectives' a))
dataTypeOf :: RecordDirectives' a -> DataType
$cdataTypeOf :: forall a. Data a => RecordDirectives' a -> DataType
toConstr :: RecordDirectives' a -> Constr
$ctoConstr :: forall a. Data a => RecordDirectives' a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RecordDirectives' a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RecordDirectives' a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RecordDirectives' a
-> c (RecordDirectives' a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RecordDirectives' a
-> c (RecordDirectives' a)
$cp1Data :: forall a. Data a => Typeable (RecordDirectives' a)
Data, Int -> RecordDirectives' a -> ShowS
[RecordDirectives' a] -> ShowS
RecordDirectives' a -> String
(Int -> RecordDirectives' a -> ShowS)
-> (RecordDirectives' a -> String)
-> ([RecordDirectives' a] -> ShowS)
-> Show (RecordDirectives' a)
forall a. Show a => Int -> RecordDirectives' a -> ShowS
forall a. Show a => [RecordDirectives' a] -> ShowS
forall a. Show a => RecordDirectives' a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecordDirectives' a] -> ShowS
$cshowList :: forall a. Show a => [RecordDirectives' a] -> ShowS
show :: RecordDirectives' a -> String
$cshow :: forall a. Show a => RecordDirectives' a -> String
showsPrec :: Int -> RecordDirectives' a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> RecordDirectives' a -> ShowS
Show, RecordDirectives' a -> RecordDirectives' a -> Bool
(RecordDirectives' a -> RecordDirectives' a -> Bool)
-> (RecordDirectives' a -> RecordDirectives' a -> Bool)
-> Eq (RecordDirectives' a)
forall a.
Eq a =>
RecordDirectives' a -> RecordDirectives' a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecordDirectives' a -> RecordDirectives' a -> Bool
$c/= :: forall a.
Eq a =>
RecordDirectives' a -> RecordDirectives' a -> Bool
== :: RecordDirectives' a -> RecordDirectives' a -> Bool
$c== :: forall a.
Eq a =>
RecordDirectives' a -> RecordDirectives' a -> Bool
Eq)

emptyRecordDirectives :: RecordDirectives' a
emptyRecordDirectives :: RecordDirectives' a
emptyRecordDirectives = Maybe (Ranged Induction)
-> Maybe HasEta0 -> Maybe Range -> Maybe a -> RecordDirectives' a
forall a.
Maybe (Ranged Induction)
-> Maybe HasEta0 -> Maybe Range -> Maybe a -> RecordDirectives' a
RecordDirectives Maybe (Ranged Induction)
forall a. Null a => a
empty Maybe HasEta0
forall a. Null a => a
empty Maybe Range
forall a. Null a => a
empty Maybe a
forall a. Null a => a
empty

instance HasRange a => HasRange (RecordDirectives' a) where
  getRange :: RecordDirectives' a -> Range
getRange (RecordDirectives Maybe (Ranged Induction)
a Maybe HasEta0
b Maybe Range
c Maybe a
d) = (Maybe (Ranged Induction), Maybe HasEta0, Maybe Range, Maybe a)
-> Range
forall a. HasRange a => a -> Range
getRange (Maybe (Ranged Induction)
a,Maybe HasEta0
b,Maybe Range
c,Maybe a
d)

instance KillRange a => KillRange (RecordDirectives' a) where
  killRange :: KillRangeT (RecordDirectives' a)
killRange (RecordDirectives Maybe (Ranged Induction)
a Maybe HasEta0
b Maybe Range
c Maybe a
d) = (Maybe (Ranged Induction)
 -> Maybe HasEta0 -> Maybe Range -> Maybe a -> RecordDirectives' a)
-> Maybe (Ranged Induction)
-> Maybe HasEta0
-> Maybe Range
-> Maybe a
-> RecordDirectives' a
forall a b c d e.
(KillRange a, KillRange b, KillRange c, KillRange d) =>
(a -> b -> c -> d -> e) -> a -> b -> c -> d -> e
killRange4 Maybe (Ranged Induction)
-> Maybe HasEta0 -> Maybe Range -> Maybe a -> RecordDirectives' a
forall a.
Maybe (Ranged Induction)
-> Maybe HasEta0 -> Maybe Range -> Maybe a -> RecordDirectives' a
RecordDirectives Maybe (Ranged Induction)
a Maybe HasEta0
b Maybe Range
c Maybe a
d

instance NFData a => NFData (RecordDirectives' a) where
  rnf :: RecordDirectives' a -> ()
rnf (RecordDirectives Maybe (Ranged Induction)
a Maybe HasEta0
b Maybe Range
c Maybe a
d) = Maybe Range
c Maybe Range -> () -> ()
`seq` (Maybe (Ranged Induction), Maybe HasEta0, Maybe a) -> ()
forall a. NFData a => a -> ()
rnf (Maybe (Ranged Induction)
a, Maybe HasEta0
b, Maybe a
d)

---------------------------------------------------------------------------
-- * Eta-equality
---------------------------------------------------------------------------

-- | Does a record come with eta-equality?
data HasEta' a
  = YesEta
  | NoEta a
  deriving (Typeable (HasEta' a)
DataType
Constr
Typeable (HasEta' a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> HasEta' a -> c (HasEta' a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (HasEta' a))
-> (HasEta' a -> Constr)
-> (HasEta' a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (HasEta' a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (HasEta' a)))
-> ((forall b. Data b => b -> b) -> HasEta' a -> HasEta' a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> HasEta' a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> HasEta' a -> r)
-> (forall u. (forall d. Data d => d -> u) -> HasEta' a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> HasEta' a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a))
-> Data (HasEta' a)
HasEta' a -> DataType
HasEta' a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (HasEta' a))
(forall b. Data b => b -> b) -> HasEta' a -> HasEta' a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HasEta' a -> c (HasEta' a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HasEta' a)
forall a. Data a => Typeable (HasEta' a)
forall a. Data a => HasEta' a -> DataType
forall a. Data a => HasEta' a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> HasEta' a -> HasEta' a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> HasEta' a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> HasEta' a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HasEta' a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HasEta' a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HasEta' a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HasEta' a -> c (HasEta' a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (HasEta' a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HasEta' a))
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) -> HasEta' a -> u
forall u. (forall d. Data d => d -> u) -> HasEta' a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HasEta' a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HasEta' a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HasEta' a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HasEta' a -> c (HasEta' a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (HasEta' a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HasEta' a))
$cNoEta :: Constr
$cYesEta :: Constr
$tHasEta' :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a)
gmapMp :: (forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a)
gmapM :: (forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> HasEta' a -> m (HasEta' a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> HasEta' a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> HasEta' a -> u
gmapQ :: (forall d. Data d => d -> u) -> HasEta' a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> HasEta' a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HasEta' a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HasEta' a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HasEta' a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HasEta' a -> r
gmapT :: (forall b. Data b => b -> b) -> HasEta' a -> HasEta' a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> HasEta' a -> HasEta' a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HasEta' a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HasEta' a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (HasEta' a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (HasEta' a))
dataTypeOf :: HasEta' a -> DataType
$cdataTypeOf :: forall a. Data a => HasEta' a -> DataType
toConstr :: HasEta' a -> Constr
$ctoConstr :: forall a. Data a => HasEta' a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HasEta' a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HasEta' a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HasEta' a -> c (HasEta' a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HasEta' a -> c (HasEta' a)
$cp1Data :: forall a. Data a => Typeable (HasEta' a)
Data, Int -> HasEta' a -> ShowS
[HasEta' a] -> ShowS
HasEta' a -> String
(Int -> HasEta' a -> ShowS)
-> (HasEta' a -> String)
-> ([HasEta' a] -> ShowS)
-> Show (HasEta' a)
forall a. Show a => Int -> HasEta' a -> ShowS
forall a. Show a => [HasEta' a] -> ShowS
forall a. Show a => HasEta' a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HasEta' a] -> ShowS
$cshowList :: forall a. Show a => [HasEta' a] -> ShowS
show :: HasEta' a -> String
$cshow :: forall a. Show a => HasEta' a -> String
showsPrec :: Int -> HasEta' a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> HasEta' a -> ShowS
Show, HasEta' a -> HasEta' a -> Bool
(HasEta' a -> HasEta' a -> Bool)
-> (HasEta' a -> HasEta' a -> Bool) -> Eq (HasEta' a)
forall a. Eq a => HasEta' a -> HasEta' a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HasEta' a -> HasEta' a -> Bool
$c/= :: forall a. Eq a => HasEta' a -> HasEta' a -> Bool
== :: HasEta' a -> HasEta' a -> Bool
$c== :: forall a. Eq a => HasEta' a -> HasEta' a -> Bool
Eq, Eq (HasEta' a)
Eq (HasEta' a)
-> (HasEta' a -> HasEta' a -> Ordering)
-> (HasEta' a -> HasEta' a -> Bool)
-> (HasEta' a -> HasEta' a -> Bool)
-> (HasEta' a -> HasEta' a -> Bool)
-> (HasEta' a -> HasEta' a -> Bool)
-> (HasEta' a -> HasEta' a -> HasEta' a)
-> (HasEta' a -> HasEta' a -> HasEta' a)
-> Ord (HasEta' a)
HasEta' a -> HasEta' a -> Bool
HasEta' a -> HasEta' a -> Ordering
HasEta' a -> HasEta' a -> HasEta' a
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
forall a. Ord a => Eq (HasEta' a)
forall a. Ord a => HasEta' a -> HasEta' a -> Bool
forall a. Ord a => HasEta' a -> HasEta' a -> Ordering
forall a. Ord a => HasEta' a -> HasEta' a -> HasEta' a
min :: HasEta' a -> HasEta' a -> HasEta' a
$cmin :: forall a. Ord a => HasEta' a -> HasEta' a -> HasEta' a
max :: HasEta' a -> HasEta' a -> HasEta' a
$cmax :: forall a. Ord a => HasEta' a -> HasEta' a -> HasEta' a
>= :: HasEta' a -> HasEta' a -> Bool
$c>= :: forall a. Ord a => HasEta' a -> HasEta' a -> Bool
> :: HasEta' a -> HasEta' a -> Bool
$c> :: forall a. Ord a => HasEta' a -> HasEta' a -> Bool
<= :: HasEta' a -> HasEta' a -> Bool
$c<= :: forall a. Ord a => HasEta' a -> HasEta' a -> Bool
< :: HasEta' a -> HasEta' a -> Bool
$c< :: forall a. Ord a => HasEta' a -> HasEta' a -> Bool
compare :: HasEta' a -> HasEta' a -> Ordering
$ccompare :: forall a. Ord a => HasEta' a -> HasEta' a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (HasEta' a)
Ord, a -> HasEta' b -> HasEta' a
(a -> b) -> HasEta' a -> HasEta' b
(forall a b. (a -> b) -> HasEta' a -> HasEta' b)
-> (forall a b. a -> HasEta' b -> HasEta' a) -> Functor HasEta'
forall a b. a -> HasEta' b -> HasEta' a
forall a b. (a -> b) -> HasEta' a -> HasEta' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> HasEta' b -> HasEta' a
$c<$ :: forall a b. a -> HasEta' b -> HasEta' a
fmap :: (a -> b) -> HasEta' a -> HasEta' b
$cfmap :: forall a b. (a -> b) -> HasEta' a -> HasEta' b
Functor, HasEta' a -> Bool
(a -> m) -> HasEta' a -> m
(a -> b -> b) -> b -> HasEta' a -> b
(forall m. Monoid m => HasEta' m -> m)
-> (forall m a. Monoid m => (a -> m) -> HasEta' a -> m)
-> (forall m a. Monoid m => (a -> m) -> HasEta' a -> m)
-> (forall a b. (a -> b -> b) -> b -> HasEta' a -> b)
-> (forall a b. (a -> b -> b) -> b -> HasEta' a -> b)
-> (forall b a. (b -> a -> b) -> b -> HasEta' a -> b)
-> (forall b a. (b -> a -> b) -> b -> HasEta' a -> b)
-> (forall a. (a -> a -> a) -> HasEta' a -> a)
-> (forall a. (a -> a -> a) -> HasEta' a -> a)
-> (forall a. HasEta' a -> [a])
-> (forall a. HasEta' a -> Bool)
-> (forall a. HasEta' a -> Int)
-> (forall a. Eq a => a -> HasEta' a -> Bool)
-> (forall a. Ord a => HasEta' a -> a)
-> (forall a. Ord a => HasEta' a -> a)
-> (forall a. Num a => HasEta' a -> a)
-> (forall a. Num a => HasEta' a -> a)
-> Foldable HasEta'
forall a. Eq a => a -> HasEta' a -> Bool
forall a. Num a => HasEta' a -> a
forall a. Ord a => HasEta' a -> a
forall m. Monoid m => HasEta' m -> m
forall a. HasEta' a -> Bool
forall a. HasEta' a -> Int
forall a. HasEta' a -> [a]
forall a. (a -> a -> a) -> HasEta' a -> a
forall m a. Monoid m => (a -> m) -> HasEta' a -> m
forall b a. (b -> a -> b) -> b -> HasEta' a -> b
forall a b. (a -> b -> b) -> b -> HasEta' a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: HasEta' a -> a
$cproduct :: forall a. Num a => HasEta' a -> a
sum :: HasEta' a -> a
$csum :: forall a. Num a => HasEta' a -> a
minimum :: HasEta' a -> a
$cminimum :: forall a. Ord a => HasEta' a -> a
maximum :: HasEta' a -> a
$cmaximum :: forall a. Ord a => HasEta' a -> a
elem :: a -> HasEta' a -> Bool
$celem :: forall a. Eq a => a -> HasEta' a -> Bool
length :: HasEta' a -> Int
$clength :: forall a. HasEta' a -> Int
null :: HasEta' a -> Bool
$cnull :: forall a. HasEta' a -> Bool
toList :: HasEta' a -> [a]
$ctoList :: forall a. HasEta' a -> [a]
foldl1 :: (a -> a -> a) -> HasEta' a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> HasEta' a -> a
foldr1 :: (a -> a -> a) -> HasEta' a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> HasEta' a -> a
foldl' :: (b -> a -> b) -> b -> HasEta' a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> HasEta' a -> b
foldl :: (b -> a -> b) -> b -> HasEta' a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> HasEta' a -> b
foldr' :: (a -> b -> b) -> b -> HasEta' a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> HasEta' a -> b
foldr :: (a -> b -> b) -> b -> HasEta' a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> HasEta' a -> b
foldMap' :: (a -> m) -> HasEta' a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> HasEta' a -> m
foldMap :: (a -> m) -> HasEta' a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> HasEta' a -> m
fold :: HasEta' m -> m
$cfold :: forall m. Monoid m => HasEta' m -> m
Foldable, Functor HasEta'
Foldable HasEta'
Functor HasEta'
-> Foldable HasEta'
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> HasEta' a -> f (HasEta' b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    HasEta' (f a) -> f (HasEta' a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> HasEta' a -> m (HasEta' b))
-> (forall (m :: * -> *) a.
    Monad m =>
    HasEta' (m a) -> m (HasEta' a))
-> Traversable HasEta'
(a -> f b) -> HasEta' a -> f (HasEta' b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => HasEta' (m a) -> m (HasEta' a)
forall (f :: * -> *) a.
Applicative f =>
HasEta' (f a) -> f (HasEta' a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HasEta' a -> m (HasEta' b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HasEta' a -> f (HasEta' b)
sequence :: HasEta' (m a) -> m (HasEta' a)
$csequence :: forall (m :: * -> *) a. Monad m => HasEta' (m a) -> m (HasEta' a)
mapM :: (a -> m b) -> HasEta' a -> m (HasEta' b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HasEta' a -> m (HasEta' b)
sequenceA :: HasEta' (f a) -> f (HasEta' a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
HasEta' (f a) -> f (HasEta' a)
traverse :: (a -> f b) -> HasEta' a -> f (HasEta' b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HasEta' a -> f (HasEta' b)
$cp2Traversable :: Foldable HasEta'
$cp1Traversable :: Functor HasEta'
Traversable)

instance HasRange a => HasRange (HasEta' a) where
  getRange :: HasEta' a -> Range
getRange = (a -> Range) -> HasEta' a -> Range
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap a -> Range
forall a. HasRange a => a -> Range
getRange

instance KillRange a => KillRange (HasEta' a) where
  killRange :: KillRangeT (HasEta' a)
killRange = (a -> a) -> KillRangeT (HasEta' a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. KillRange a => KillRangeT a
killRange

instance NFData a => NFData (HasEta' a) where
  rnf :: HasEta' a -> ()
rnf HasEta' a
YesEta    = ()
  rnf (NoEta a
p) = a -> ()
forall a. NFData a => a -> ()
rnf a
p

-- | Pattern and copattern matching is allowed in the presence of eta.
--
--   In the absence of eta, we have to choose whether we want to allow
--   matching on the constructor or copattern matching with the projections.
--   Having both leads to breakage of subject reduction (issue #4560).

type HasEta  = HasEta' PatternOrCopattern
type HasEta0 = HasEta' ()

-- | For a record without eta, which type of matching do we allow?
data PatternOrCopattern
  = PatternMatching
      -- ^ Can match on the record constructor.
  | CopatternMatching
      -- ^ Can copattern match using the projections. (Default.)
  deriving (Typeable PatternOrCopattern
DataType
Constr
Typeable PatternOrCopattern
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> PatternOrCopattern
    -> c PatternOrCopattern)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PatternOrCopattern)
-> (PatternOrCopattern -> Constr)
-> (PatternOrCopattern -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PatternOrCopattern))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PatternOrCopattern))
-> ((forall b. Data b => b -> b)
    -> PatternOrCopattern -> PatternOrCopattern)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PatternOrCopattern -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PatternOrCopattern -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> PatternOrCopattern -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> PatternOrCopattern -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> PatternOrCopattern -> m PatternOrCopattern)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PatternOrCopattern -> m PatternOrCopattern)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PatternOrCopattern -> m PatternOrCopattern)
-> Data PatternOrCopattern
PatternOrCopattern -> DataType
PatternOrCopattern -> Constr
(forall b. Data b => b -> b)
-> PatternOrCopattern -> PatternOrCopattern
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> PatternOrCopattern
-> c PatternOrCopattern
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PatternOrCopattern
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) -> PatternOrCopattern -> u
forall u. (forall d. Data d => d -> u) -> PatternOrCopattern -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PatternOrCopattern -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PatternOrCopattern -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> PatternOrCopattern -> m PatternOrCopattern
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PatternOrCopattern -> m PatternOrCopattern
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PatternOrCopattern
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> PatternOrCopattern
-> c PatternOrCopattern
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PatternOrCopattern)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PatternOrCopattern)
$cCopatternMatching :: Constr
$cPatternMatching :: Constr
$tPatternOrCopattern :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> PatternOrCopattern -> m PatternOrCopattern
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PatternOrCopattern -> m PatternOrCopattern
gmapMp :: (forall d. Data d => d -> m d)
-> PatternOrCopattern -> m PatternOrCopattern
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PatternOrCopattern -> m PatternOrCopattern
gmapM :: (forall d. Data d => d -> m d)
-> PatternOrCopattern -> m PatternOrCopattern
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> PatternOrCopattern -> m PatternOrCopattern
gmapQi :: Int -> (forall d. Data d => d -> u) -> PatternOrCopattern -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> PatternOrCopattern -> u
gmapQ :: (forall d. Data d => d -> u) -> PatternOrCopattern -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> PatternOrCopattern -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PatternOrCopattern -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PatternOrCopattern -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PatternOrCopattern -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PatternOrCopattern -> r
gmapT :: (forall b. Data b => b -> b)
-> PatternOrCopattern -> PatternOrCopattern
$cgmapT :: (forall b. Data b => b -> b)
-> PatternOrCopattern -> PatternOrCopattern
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PatternOrCopattern)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PatternOrCopattern)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c PatternOrCopattern)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PatternOrCopattern)
dataTypeOf :: PatternOrCopattern -> DataType
$cdataTypeOf :: PatternOrCopattern -> DataType
toConstr :: PatternOrCopattern -> Constr
$ctoConstr :: PatternOrCopattern -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PatternOrCopattern
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PatternOrCopattern
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> PatternOrCopattern
-> c PatternOrCopattern
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> PatternOrCopattern
-> c PatternOrCopattern
$cp1Data :: Typeable PatternOrCopattern
Data, Int -> PatternOrCopattern -> ShowS
[PatternOrCopattern] -> ShowS
PatternOrCopattern -> String
(Int -> PatternOrCopattern -> ShowS)
-> (PatternOrCopattern -> String)
-> ([PatternOrCopattern] -> ShowS)
-> Show PatternOrCopattern
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PatternOrCopattern] -> ShowS
$cshowList :: [PatternOrCopattern] -> ShowS
show :: PatternOrCopattern -> String
$cshow :: PatternOrCopattern -> String
showsPrec :: Int -> PatternOrCopattern -> ShowS
$cshowsPrec :: Int -> PatternOrCopattern -> ShowS
Show, PatternOrCopattern -> PatternOrCopattern -> Bool
(PatternOrCopattern -> PatternOrCopattern -> Bool)
-> (PatternOrCopattern -> PatternOrCopattern -> Bool)
-> Eq PatternOrCopattern
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PatternOrCopattern -> PatternOrCopattern -> Bool
$c/= :: PatternOrCopattern -> PatternOrCopattern -> Bool
== :: PatternOrCopattern -> PatternOrCopattern -> Bool
$c== :: PatternOrCopattern -> PatternOrCopattern -> Bool
Eq, Eq PatternOrCopattern
Eq PatternOrCopattern
-> (PatternOrCopattern -> PatternOrCopattern -> Ordering)
-> (PatternOrCopattern -> PatternOrCopattern -> Bool)
-> (PatternOrCopattern -> PatternOrCopattern -> Bool)
-> (PatternOrCopattern -> PatternOrCopattern -> Bool)
-> (PatternOrCopattern -> PatternOrCopattern -> Bool)
-> (PatternOrCopattern -> PatternOrCopattern -> PatternOrCopattern)
-> (PatternOrCopattern -> PatternOrCopattern -> PatternOrCopattern)
-> Ord PatternOrCopattern
PatternOrCopattern -> PatternOrCopattern -> Bool
PatternOrCopattern -> PatternOrCopattern -> Ordering
PatternOrCopattern -> PatternOrCopattern -> PatternOrCopattern
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 :: PatternOrCopattern -> PatternOrCopattern -> PatternOrCopattern
$cmin :: PatternOrCopattern -> PatternOrCopattern -> PatternOrCopattern
max :: PatternOrCopattern -> PatternOrCopattern -> PatternOrCopattern
$cmax :: PatternOrCopattern -> PatternOrCopattern -> PatternOrCopattern
>= :: PatternOrCopattern -> PatternOrCopattern -> Bool
$c>= :: PatternOrCopattern -> PatternOrCopattern -> Bool
> :: PatternOrCopattern -> PatternOrCopattern -> Bool
$c> :: PatternOrCopattern -> PatternOrCopattern -> Bool
<= :: PatternOrCopattern -> PatternOrCopattern -> Bool
$c<= :: PatternOrCopattern -> PatternOrCopattern -> Bool
< :: PatternOrCopattern -> PatternOrCopattern -> Bool
$c< :: PatternOrCopattern -> PatternOrCopattern -> Bool
compare :: PatternOrCopattern -> PatternOrCopattern -> Ordering
$ccompare :: PatternOrCopattern -> PatternOrCopattern -> Ordering
$cp1Ord :: Eq PatternOrCopattern
Ord, Int -> PatternOrCopattern
PatternOrCopattern -> Int
PatternOrCopattern -> [PatternOrCopattern]
PatternOrCopattern -> PatternOrCopattern
PatternOrCopattern -> PatternOrCopattern -> [PatternOrCopattern]
PatternOrCopattern
-> PatternOrCopattern -> PatternOrCopattern -> [PatternOrCopattern]
(PatternOrCopattern -> PatternOrCopattern)
-> (PatternOrCopattern -> PatternOrCopattern)
-> (Int -> PatternOrCopattern)
-> (PatternOrCopattern -> Int)
-> (PatternOrCopattern -> [PatternOrCopattern])
-> (PatternOrCopattern
    -> PatternOrCopattern -> [PatternOrCopattern])
-> (PatternOrCopattern
    -> PatternOrCopattern -> [PatternOrCopattern])
-> (PatternOrCopattern
    -> PatternOrCopattern
    -> PatternOrCopattern
    -> [PatternOrCopattern])
-> Enum PatternOrCopattern
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: PatternOrCopattern
-> PatternOrCopattern -> PatternOrCopattern -> [PatternOrCopattern]
$cenumFromThenTo :: PatternOrCopattern
-> PatternOrCopattern -> PatternOrCopattern -> [PatternOrCopattern]
enumFromTo :: PatternOrCopattern -> PatternOrCopattern -> [PatternOrCopattern]
$cenumFromTo :: PatternOrCopattern -> PatternOrCopattern -> [PatternOrCopattern]
enumFromThen :: PatternOrCopattern -> PatternOrCopattern -> [PatternOrCopattern]
$cenumFromThen :: PatternOrCopattern -> PatternOrCopattern -> [PatternOrCopattern]
enumFrom :: PatternOrCopattern -> [PatternOrCopattern]
$cenumFrom :: PatternOrCopattern -> [PatternOrCopattern]
fromEnum :: PatternOrCopattern -> Int
$cfromEnum :: PatternOrCopattern -> Int
toEnum :: Int -> PatternOrCopattern
$ctoEnum :: Int -> PatternOrCopattern
pred :: PatternOrCopattern -> PatternOrCopattern
$cpred :: PatternOrCopattern -> PatternOrCopattern
succ :: PatternOrCopattern -> PatternOrCopattern
$csucc :: PatternOrCopattern -> PatternOrCopattern
Enum, PatternOrCopattern
PatternOrCopattern
-> PatternOrCopattern -> Bounded PatternOrCopattern
forall a. a -> a -> Bounded a
maxBound :: PatternOrCopattern
$cmaxBound :: PatternOrCopattern
minBound :: PatternOrCopattern
$cminBound :: PatternOrCopattern
Bounded)

instance NFData PatternOrCopattern where
  rnf :: PatternOrCopattern -> ()
rnf PatternOrCopattern
PatternMatching   = ()
  rnf PatternOrCopattern
CopatternMatching = ()

instance HasRange PatternOrCopattern where
  getRange :: PatternOrCopattern -> Range
getRange PatternOrCopattern
_ = Range
forall a. Range' a
noRange

instance KillRange PatternOrCopattern where
  killRange :: PatternOrCopattern -> PatternOrCopattern
killRange = PatternOrCopattern -> PatternOrCopattern
forall a. a -> a
id

-- | Can we pattern match on the record constructor?
class PatternMatchingAllowed a where
  patternMatchingAllowed :: a -> Bool

instance PatternMatchingAllowed PatternOrCopattern where
  patternMatchingAllowed :: PatternOrCopattern -> Bool
patternMatchingAllowed = (PatternOrCopattern -> PatternOrCopattern -> Bool
forall a. Eq a => a -> a -> Bool
== PatternOrCopattern
PatternMatching)

instance PatternMatchingAllowed HasEta where
  patternMatchingAllowed :: HasEta -> Bool
patternMatchingAllowed = \case
    HasEta
YesEta -> Bool
True
    NoEta PatternOrCopattern
p -> PatternOrCopattern -> Bool
forall a. PatternMatchingAllowed a => a -> Bool
patternMatchingAllowed PatternOrCopattern
p


-- | Can we construct a record by copattern matching?
class CopatternMatchingAllowed a where
  copatternMatchingAllowed :: a -> Bool

instance CopatternMatchingAllowed PatternOrCopattern where
  copatternMatchingAllowed :: PatternOrCopattern -> Bool
copatternMatchingAllowed = (PatternOrCopattern -> PatternOrCopattern -> Bool
forall a. Eq a => a -> a -> Bool
== PatternOrCopattern
CopatternMatching)

instance CopatternMatchingAllowed HasEta where
  copatternMatchingAllowed :: HasEta -> Bool
copatternMatchingAllowed = \case
    HasEta
YesEta -> Bool
True
    NoEta PatternOrCopattern
p -> PatternOrCopattern -> Bool
forall a. CopatternMatchingAllowed a => a -> Bool
copatternMatchingAllowed PatternOrCopattern
p

---------------------------------------------------------------------------
-- * Induction
---------------------------------------------------------------------------

-- | @Inductive < Coinductive@
data Induction = Inductive | CoInductive  -- Keep in this order!
  deriving (Typeable Induction
DataType
Constr
Typeable Induction
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Induction -> c Induction)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Induction)
-> (Induction -> Constr)
-> (Induction -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Induction))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Induction))
-> ((forall b. Data b => b -> b) -> Induction -> Induction)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Induction -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Induction -> r)
-> (forall u. (forall d. Data d => d -> u) -> Induction -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Induction -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Induction -> m Induction)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Induction -> m Induction)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Induction -> m Induction)
-> Data Induction
Induction -> DataType
Induction -> Constr
(forall b. Data b => b -> b) -> Induction -> Induction
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Induction -> c Induction
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Induction
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) -> Induction -> u
forall u. (forall d. Data d => d -> u) -> Induction -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Induction -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Induction -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Induction -> m Induction
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Induction -> m Induction
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Induction
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Induction -> c Induction
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Induction)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Induction)
$cCoInductive :: Constr
$cInductive :: Constr
$tInduction :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Induction -> m Induction
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Induction -> m Induction
gmapMp :: (forall d. Data d => d -> m d) -> Induction -> m Induction
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Induction -> m Induction
gmapM :: (forall d. Data d => d -> m d) -> Induction -> m Induction
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Induction -> m Induction
gmapQi :: Int -> (forall d. Data d => d -> u) -> Induction -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Induction -> u
gmapQ :: (forall d. Data d => d -> u) -> Induction -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Induction -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Induction -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Induction -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Induction -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Induction -> r
gmapT :: (forall b. Data b => b -> b) -> Induction -> Induction
$cgmapT :: (forall b. Data b => b -> b) -> Induction -> Induction
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Induction)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Induction)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Induction)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Induction)
dataTypeOf :: Induction -> DataType
$cdataTypeOf :: Induction -> DataType
toConstr :: Induction -> Constr
$ctoConstr :: Induction -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Induction
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Induction
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Induction -> c Induction
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Induction -> c Induction
$cp1Data :: Typeable Induction
Data, Induction -> Induction -> Bool
(Induction -> Induction -> Bool)
-> (Induction -> Induction -> Bool) -> Eq Induction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Induction -> Induction -> Bool
$c/= :: Induction -> Induction -> Bool
== :: Induction -> Induction -> Bool
$c== :: Induction -> Induction -> Bool
Eq, Eq Induction
Eq Induction
-> (Induction -> Induction -> Ordering)
-> (Induction -> Induction -> Bool)
-> (Induction -> Induction -> Bool)
-> (Induction -> Induction -> Bool)
-> (Induction -> Induction -> Bool)
-> (Induction -> Induction -> Induction)
-> (Induction -> Induction -> Induction)
-> Ord Induction
Induction -> Induction -> Bool
Induction -> Induction -> Ordering
Induction -> Induction -> Induction
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 :: Induction -> Induction -> Induction
$cmin :: Induction -> Induction -> Induction
max :: Induction -> Induction -> Induction
$cmax :: Induction -> Induction -> Induction
>= :: Induction -> Induction -> Bool
$c>= :: Induction -> Induction -> Bool
> :: Induction -> Induction -> Bool
$c> :: Induction -> Induction -> Bool
<= :: Induction -> Induction -> Bool
$c<= :: Induction -> Induction -> Bool
< :: Induction -> Induction -> Bool
$c< :: Induction -> Induction -> Bool
compare :: Induction -> Induction -> Ordering
$ccompare :: Induction -> Induction -> Ordering
$cp1Ord :: Eq Induction
Ord, Int -> Induction -> ShowS
[Induction] -> ShowS
Induction -> String
(Int -> Induction -> ShowS)
-> (Induction -> String)
-> ([Induction] -> ShowS)
-> Show Induction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Induction] -> ShowS
$cshowList :: [Induction] -> ShowS
show :: Induction -> String
$cshow :: Induction -> String
showsPrec :: Int -> Induction -> ShowS
$cshowsPrec :: Int -> Induction -> ShowS
Show)

instance Pretty Induction where
  pretty :: Induction -> Doc
pretty Induction
Inductive   = Doc
"inductive"
  pretty Induction
CoInductive = Doc
"coinductive"

instance HasRange Induction where
  getRange :: Induction -> Range
getRange Induction
_ = Range
forall a. Range' a
noRange

instance KillRange Induction where
  killRange :: Induction -> Induction
killRange = Induction -> Induction
forall a. a -> a
id

instance NFData Induction where
  rnf :: Induction -> ()
rnf Induction
Inductive   = ()
  rnf Induction
CoInductive = ()

instance PatternMatchingAllowed Induction where
  patternMatchingAllowed :: Induction -> Bool
patternMatchingAllowed = (Induction -> Induction -> Bool
forall a. Eq a => a -> a -> Bool
== Induction
Inductive)

---------------------------------------------------------------------------
-- * Hiding
---------------------------------------------------------------------------

data Overlappable = YesOverlap | NoOverlap
  deriving (Typeable Overlappable
DataType
Constr
Typeable Overlappable
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Overlappable -> c Overlappable)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Overlappable)
-> (Overlappable -> Constr)
-> (Overlappable -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Overlappable))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c Overlappable))
-> ((forall b. Data b => b -> b) -> Overlappable -> Overlappable)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Overlappable -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Overlappable -> r)
-> (forall u. (forall d. Data d => d -> u) -> Overlappable -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Overlappable -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Overlappable -> m Overlappable)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Overlappable -> m Overlappable)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Overlappable -> m Overlappable)
-> Data Overlappable
Overlappable -> DataType
Overlappable -> Constr
(forall b. Data b => b -> b) -> Overlappable -> Overlappable
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Overlappable -> c Overlappable
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Overlappable
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) -> Overlappable -> u
forall u. (forall d. Data d => d -> u) -> Overlappable -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Overlappable -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Overlappable -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Overlappable -> m Overlappable
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Overlappable -> m Overlappable
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Overlappable
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Overlappable -> c Overlappable
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Overlappable)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Overlappable)
$cNoOverlap :: Constr
$cYesOverlap :: Constr
$tOverlappable :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Overlappable -> m Overlappable
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Overlappable -> m Overlappable
gmapMp :: (forall d. Data d => d -> m d) -> Overlappable -> m Overlappable
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Overlappable -> m Overlappable
gmapM :: (forall d. Data d => d -> m d) -> Overlappable -> m Overlappable
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Overlappable -> m Overlappable
gmapQi :: Int -> (forall d. Data d => d -> u) -> Overlappable -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Overlappable -> u
gmapQ :: (forall d. Data d => d -> u) -> Overlappable -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Overlappable -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Overlappable -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Overlappable -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Overlappable -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Overlappable -> r
gmapT :: (forall b. Data b => b -> b) -> Overlappable -> Overlappable
$cgmapT :: (forall b. Data b => b -> b) -> Overlappable -> Overlappable
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Overlappable)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Overlappable)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Overlappable)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Overlappable)
dataTypeOf :: Overlappable -> DataType
$cdataTypeOf :: Overlappable -> DataType
toConstr :: Overlappable -> Constr
$ctoConstr :: Overlappable -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Overlappable
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Overlappable
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Overlappable -> c Overlappable
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Overlappable -> c Overlappable
$cp1Data :: Typeable Overlappable
Data, Int -> Overlappable -> ShowS
[Overlappable] -> ShowS
Overlappable -> String
(Int -> Overlappable -> ShowS)
-> (Overlappable -> String)
-> ([Overlappable] -> ShowS)
-> Show Overlappable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Overlappable] -> ShowS
$cshowList :: [Overlappable] -> ShowS
show :: Overlappable -> String
$cshow :: Overlappable -> String
showsPrec :: Int -> Overlappable -> ShowS
$cshowsPrec :: Int -> Overlappable -> ShowS
Show, Overlappable -> Overlappable -> Bool
(Overlappable -> Overlappable -> Bool)
-> (Overlappable -> Overlappable -> Bool) -> Eq Overlappable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Overlappable -> Overlappable -> Bool
$c/= :: Overlappable -> Overlappable -> Bool
== :: Overlappable -> Overlappable -> Bool
$c== :: Overlappable -> Overlappable -> Bool
Eq, Eq Overlappable
Eq Overlappable
-> (Overlappable -> Overlappable -> Ordering)
-> (Overlappable -> Overlappable -> Bool)
-> (Overlappable -> Overlappable -> Bool)
-> (Overlappable -> Overlappable -> Bool)
-> (Overlappable -> Overlappable -> Bool)
-> (Overlappable -> Overlappable -> Overlappable)
-> (Overlappable -> Overlappable -> Overlappable)
-> Ord Overlappable
Overlappable -> Overlappable -> Bool
Overlappable -> Overlappable -> Ordering
Overlappable -> Overlappable -> Overlappable
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 :: Overlappable -> Overlappable -> Overlappable
$cmin :: Overlappable -> Overlappable -> Overlappable
max :: Overlappable -> Overlappable -> Overlappable
$cmax :: Overlappable -> Overlappable -> Overlappable
>= :: Overlappable -> Overlappable -> Bool
$c>= :: Overlappable -> Overlappable -> Bool
> :: Overlappable -> Overlappable -> Bool
$c> :: Overlappable -> Overlappable -> Bool
<= :: Overlappable -> Overlappable -> Bool
$c<= :: Overlappable -> Overlappable -> Bool
< :: Overlappable -> Overlappable -> Bool
$c< :: Overlappable -> Overlappable -> Bool
compare :: Overlappable -> Overlappable -> Ordering
$ccompare :: Overlappable -> Overlappable -> Ordering
$cp1Ord :: Eq Overlappable
Ord)

data Hiding  = Hidden | Instance Overlappable | NotHidden
  deriving (Typeable Hiding
DataType
Constr
Typeable Hiding
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Hiding -> c Hiding)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Hiding)
-> (Hiding -> Constr)
-> (Hiding -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Hiding))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Hiding))
-> ((forall b. Data b => b -> b) -> Hiding -> Hiding)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Hiding -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Hiding -> r)
-> (forall u. (forall d. Data d => d -> u) -> Hiding -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Hiding -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Hiding -> m Hiding)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Hiding -> m Hiding)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Hiding -> m Hiding)
-> Data Hiding
Hiding -> DataType
Hiding -> Constr
(forall b. Data b => b -> b) -> Hiding -> Hiding
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Hiding -> c Hiding
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Hiding
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) -> Hiding -> u
forall u. (forall d. Data d => d -> u) -> Hiding -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Hiding -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Hiding -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Hiding -> m Hiding
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Hiding -> m Hiding
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Hiding
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Hiding -> c Hiding
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Hiding)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Hiding)
$cNotHidden :: Constr
$cInstance :: Constr
$cHidden :: Constr
$tHiding :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Hiding -> m Hiding
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Hiding -> m Hiding
gmapMp :: (forall d. Data d => d -> m d) -> Hiding -> m Hiding
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Hiding -> m Hiding
gmapM :: (forall d. Data d => d -> m d) -> Hiding -> m Hiding
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Hiding -> m Hiding
gmapQi :: Int -> (forall d. Data d => d -> u) -> Hiding -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Hiding -> u
gmapQ :: (forall d. Data d => d -> u) -> Hiding -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Hiding -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Hiding -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Hiding -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Hiding -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Hiding -> r
gmapT :: (forall b. Data b => b -> b) -> Hiding -> Hiding
$cgmapT :: (forall b. Data b => b -> b) -> Hiding -> Hiding
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Hiding)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Hiding)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Hiding)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Hiding)
dataTypeOf :: Hiding -> DataType
$cdataTypeOf :: Hiding -> DataType
toConstr :: Hiding -> Constr
$ctoConstr :: Hiding -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Hiding
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Hiding
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Hiding -> c Hiding
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Hiding -> c Hiding
$cp1Data :: Typeable Hiding
Data, Int -> Hiding -> ShowS
[Hiding] -> ShowS
Hiding -> String
(Int -> Hiding -> ShowS)
-> (Hiding -> String) -> ([Hiding] -> ShowS) -> Show Hiding
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Hiding] -> ShowS
$cshowList :: [Hiding] -> ShowS
show :: Hiding -> String
$cshow :: Hiding -> String
showsPrec :: Int -> Hiding -> ShowS
$cshowsPrec :: Int -> Hiding -> ShowS
Show, Hiding -> Hiding -> Bool
(Hiding -> Hiding -> Bool)
-> (Hiding -> Hiding -> Bool) -> Eq Hiding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Hiding -> Hiding -> Bool
$c/= :: Hiding -> Hiding -> Bool
== :: Hiding -> Hiding -> Bool
$c== :: Hiding -> Hiding -> Bool
Eq, Eq Hiding
Eq Hiding
-> (Hiding -> Hiding -> Ordering)
-> (Hiding -> Hiding -> Bool)
-> (Hiding -> Hiding -> Bool)
-> (Hiding -> Hiding -> Bool)
-> (Hiding -> Hiding -> Bool)
-> (Hiding -> Hiding -> Hiding)
-> (Hiding -> Hiding -> Hiding)
-> Ord Hiding
Hiding -> Hiding -> Bool
Hiding -> Hiding -> Ordering
Hiding -> Hiding -> Hiding
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 :: Hiding -> Hiding -> Hiding
$cmin :: Hiding -> Hiding -> Hiding
max :: Hiding -> Hiding -> Hiding
$cmax :: Hiding -> Hiding -> Hiding
>= :: Hiding -> Hiding -> Bool
$c>= :: Hiding -> Hiding -> Bool
> :: Hiding -> Hiding -> Bool
$c> :: Hiding -> Hiding -> Bool
<= :: Hiding -> Hiding -> Bool
$c<= :: Hiding -> Hiding -> Bool
< :: Hiding -> Hiding -> Bool
$c< :: Hiding -> Hiding -> Bool
compare :: Hiding -> Hiding -> Ordering
$ccompare :: Hiding -> Hiding -> Ordering
$cp1Ord :: Eq Hiding
Ord)

instance Pretty Hiding where
  pretty :: Hiding -> Doc
pretty = \case
    Hiding
Hidden     -> Doc
"hidden"
    Hiding
NotHidden  -> Doc
"visible"
    Instance{} -> Doc
"instance"

-- | Just for the 'Hiding' instance. Should never combine different
--   overlapping.
instance Semigroup Overlappable where
  Overlappable
NoOverlap  <> :: Overlappable -> Overlappable -> Overlappable
<> Overlappable
NoOverlap  = Overlappable
NoOverlap
  Overlappable
YesOverlap <> Overlappable
YesOverlap = Overlappable
YesOverlap
  Overlappable
_          <> Overlappable
_          = Overlappable
forall a. HasCallStack => a
__IMPOSSIBLE__

-- | 'Hiding' is an idempotent partial monoid, with unit 'NotHidden'.
--   'Instance' and 'NotHidden' are incompatible.
instance Semigroup Hiding where
  Hiding
NotHidden  <> :: Hiding -> Hiding -> Hiding
<> Hiding
h           = Hiding
h
  Hiding
h          <> Hiding
NotHidden   = Hiding
h
  Hiding
Hidden     <> Hiding
Hidden      = Hiding
Hidden
  Instance Overlappable
o <> Instance Overlappable
o' = Overlappable -> Hiding
Instance (Overlappable
o Overlappable -> Overlappable -> Overlappable
forall a. Semigroup a => a -> a -> a
<> Overlappable
o')
  Hiding
_          <> Hiding
_           = Hiding
forall a. HasCallStack => a
__IMPOSSIBLE__

instance Monoid Overlappable where
  mempty :: Overlappable
mempty  = Overlappable
NoOverlap
  mappend :: Overlappable -> Overlappable -> Overlappable
mappend = Overlappable -> Overlappable -> Overlappable
forall a. Semigroup a => a -> a -> a
(<>)

instance Monoid Hiding where
  mempty :: Hiding
mempty = Hiding
NotHidden
  mappend :: Hiding -> Hiding -> Hiding
mappend = Hiding -> Hiding -> Hiding
forall a. Semigroup a => a -> a -> a
(<>)

instance HasRange Hiding where
  getRange :: Hiding -> Range
getRange Hiding
_ = Range
forall a. Range' a
noRange

instance KillRange Hiding where
  killRange :: Hiding -> Hiding
killRange = Hiding -> Hiding
forall a. a -> a
id

instance NFData Overlappable where
  rnf :: Overlappable -> ()
rnf Overlappable
NoOverlap  = ()
  rnf Overlappable
YesOverlap = ()

instance NFData Hiding where
  rnf :: Hiding -> ()
rnf Hiding
Hidden       = ()
  rnf (Instance Overlappable
o) = Overlappable -> ()
forall a. NFData a => a -> ()
rnf Overlappable
o
  rnf Hiding
NotHidden    = ()

-- | Decorating something with 'Hiding' information.
data WithHiding a = WithHiding
  { WithHiding a -> Hiding
whHiding :: !Hiding
  , WithHiding a -> a
whThing  :: a
  }
  deriving (Typeable (WithHiding a)
DataType
Constr
Typeable (WithHiding a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> WithHiding a -> c (WithHiding a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (WithHiding a))
-> (WithHiding a -> Constr)
-> (WithHiding a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (WithHiding a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (WithHiding a)))
-> ((forall b. Data b => b -> b) -> WithHiding a -> WithHiding a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> WithHiding a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> WithHiding a -> r)
-> (forall u. (forall d. Data d => d -> u) -> WithHiding a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> WithHiding a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a))
-> Data (WithHiding a)
WithHiding a -> DataType
WithHiding a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (WithHiding a))
(forall b. Data b => b -> b) -> WithHiding a -> WithHiding a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WithHiding a -> c (WithHiding a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WithHiding a)
forall a. Data a => Typeable (WithHiding a)
forall a. Data a => WithHiding a -> DataType
forall a. Data a => WithHiding a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> WithHiding a -> WithHiding a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> WithHiding a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> WithHiding a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WithHiding a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WithHiding a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WithHiding a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WithHiding a -> c (WithHiding a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (WithHiding a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WithHiding a))
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) -> WithHiding a -> u
forall u. (forall d. Data d => d -> u) -> WithHiding a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WithHiding a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WithHiding a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WithHiding a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WithHiding a -> c (WithHiding a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (WithHiding a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WithHiding a))
$cWithHiding :: Constr
$tWithHiding :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a)
gmapMp :: (forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a)
gmapM :: (forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> WithHiding a -> m (WithHiding a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> WithHiding a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> WithHiding a -> u
gmapQ :: (forall d. Data d => d -> u) -> WithHiding a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> WithHiding a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WithHiding a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WithHiding a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WithHiding a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WithHiding a -> r
gmapT :: (forall b. Data b => b -> b) -> WithHiding a -> WithHiding a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> WithHiding a -> WithHiding a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WithHiding a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WithHiding a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (WithHiding a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (WithHiding a))
dataTypeOf :: WithHiding a -> DataType
$cdataTypeOf :: forall a. Data a => WithHiding a -> DataType
toConstr :: WithHiding a -> Constr
$ctoConstr :: forall a. Data a => WithHiding a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WithHiding a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WithHiding a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WithHiding a -> c (WithHiding a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WithHiding a -> c (WithHiding a)
$cp1Data :: forall a. Data a => Typeable (WithHiding a)
Data, WithHiding a -> WithHiding a -> Bool
(WithHiding a -> WithHiding a -> Bool)
-> (WithHiding a -> WithHiding a -> Bool) -> Eq (WithHiding a)
forall a. Eq a => WithHiding a -> WithHiding a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WithHiding a -> WithHiding a -> Bool
$c/= :: forall a. Eq a => WithHiding a -> WithHiding a -> Bool
== :: WithHiding a -> WithHiding a -> Bool
$c== :: forall a. Eq a => WithHiding a -> WithHiding a -> Bool
Eq, Eq (WithHiding a)
Eq (WithHiding a)
-> (WithHiding a -> WithHiding a -> Ordering)
-> (WithHiding a -> WithHiding a -> Bool)
-> (WithHiding a -> WithHiding a -> Bool)
-> (WithHiding a -> WithHiding a -> Bool)
-> (WithHiding a -> WithHiding a -> Bool)
-> (WithHiding a -> WithHiding a -> WithHiding a)
-> (WithHiding a -> WithHiding a -> WithHiding a)
-> Ord (WithHiding a)
WithHiding a -> WithHiding a -> Bool
WithHiding a -> WithHiding a -> Ordering
WithHiding a -> WithHiding a -> WithHiding a
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
forall a. Ord a => Eq (WithHiding a)
forall a. Ord a => WithHiding a -> WithHiding a -> Bool
forall a. Ord a => WithHiding a -> WithHiding a -> Ordering
forall a. Ord a => WithHiding a -> WithHiding a -> WithHiding a
min :: WithHiding a -> WithHiding a -> WithHiding a
$cmin :: forall a. Ord a => WithHiding a -> WithHiding a -> WithHiding a
max :: WithHiding a -> WithHiding a -> WithHiding a
$cmax :: forall a. Ord a => WithHiding a -> WithHiding a -> WithHiding a
>= :: WithHiding a -> WithHiding a -> Bool
$c>= :: forall a. Ord a => WithHiding a -> WithHiding a -> Bool
> :: WithHiding a -> WithHiding a -> Bool
$c> :: forall a. Ord a => WithHiding a -> WithHiding a -> Bool
<= :: WithHiding a -> WithHiding a -> Bool
$c<= :: forall a. Ord a => WithHiding a -> WithHiding a -> Bool
< :: WithHiding a -> WithHiding a -> Bool
$c< :: forall a. Ord a => WithHiding a -> WithHiding a -> Bool
compare :: WithHiding a -> WithHiding a -> Ordering
$ccompare :: forall a. Ord a => WithHiding a -> WithHiding a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (WithHiding a)
Ord, Int -> WithHiding a -> ShowS
[WithHiding a] -> ShowS
WithHiding a -> String
(Int -> WithHiding a -> ShowS)
-> (WithHiding a -> String)
-> ([WithHiding a] -> ShowS)
-> Show (WithHiding a)
forall a. Show a => Int -> WithHiding a -> ShowS
forall a. Show a => [WithHiding a] -> ShowS
forall a. Show a => WithHiding a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WithHiding a] -> ShowS
$cshowList :: forall a. Show a => [WithHiding a] -> ShowS
show :: WithHiding a -> String
$cshow :: forall a. Show a => WithHiding a -> String
showsPrec :: Int -> WithHiding a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> WithHiding a -> ShowS
Show, a -> WithHiding b -> WithHiding a
(a -> b) -> WithHiding a -> WithHiding b
(forall a b. (a -> b) -> WithHiding a -> WithHiding b)
-> (forall a b. a -> WithHiding b -> WithHiding a)
-> Functor WithHiding
forall a b. a -> WithHiding b -> WithHiding a
forall a b. (a -> b) -> WithHiding a -> WithHiding b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> WithHiding b -> WithHiding a
$c<$ :: forall a b. a -> WithHiding b -> WithHiding a
fmap :: (a -> b) -> WithHiding a -> WithHiding b
$cfmap :: forall a b. (a -> b) -> WithHiding a -> WithHiding b
Functor, WithHiding a -> Bool
(a -> m) -> WithHiding a -> m
(a -> b -> b) -> b -> WithHiding a -> b
(forall m. Monoid m => WithHiding m -> m)
-> (forall m a. Monoid m => (a -> m) -> WithHiding a -> m)
-> (forall m a. Monoid m => (a -> m) -> WithHiding a -> m)
-> (forall a b. (a -> b -> b) -> b -> WithHiding a -> b)
-> (forall a b. (a -> b -> b) -> b -> WithHiding a -> b)
-> (forall b a. (b -> a -> b) -> b -> WithHiding a -> b)
-> (forall b a. (b -> a -> b) -> b -> WithHiding a -> b)
-> (forall a. (a -> a -> a) -> WithHiding a -> a)
-> (forall a. (a -> a -> a) -> WithHiding a -> a)
-> (forall a. WithHiding a -> [a])
-> (forall a. WithHiding a -> Bool)
-> (forall a. WithHiding a -> Int)
-> (forall a. Eq a => a -> WithHiding a -> Bool)
-> (forall a. Ord a => WithHiding a -> a)
-> (forall a. Ord a => WithHiding a -> a)
-> (forall a. Num a => WithHiding a -> a)
-> (forall a. Num a => WithHiding a -> a)
-> Foldable WithHiding
forall a. Eq a => a -> WithHiding a -> Bool
forall a. Num a => WithHiding a -> a
forall a. Ord a => WithHiding a -> a
forall m. Monoid m => WithHiding m -> m
forall a. WithHiding a -> Bool
forall a. WithHiding a -> Int
forall a. WithHiding a -> [a]
forall a. (a -> a -> a) -> WithHiding a -> a
forall m a. Monoid m => (a -> m) -> WithHiding a -> m
forall b a. (b -> a -> b) -> b -> WithHiding a -> b
forall a b. (a -> b -> b) -> b -> WithHiding a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: WithHiding a -> a
$cproduct :: forall a. Num a => WithHiding a -> a
sum :: WithHiding a -> a
$csum :: forall a. Num a => WithHiding a -> a
minimum :: WithHiding a -> a
$cminimum :: forall a. Ord a => WithHiding a -> a
maximum :: WithHiding a -> a
$cmaximum :: forall a. Ord a => WithHiding a -> a
elem :: a -> WithHiding a -> Bool
$celem :: forall a. Eq a => a -> WithHiding a -> Bool
length :: WithHiding a -> Int
$clength :: forall a. WithHiding a -> Int
null :: WithHiding a -> Bool
$cnull :: forall a. WithHiding a -> Bool
toList :: WithHiding a -> [a]
$ctoList :: forall a. WithHiding a -> [a]
foldl1 :: (a -> a -> a) -> WithHiding a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> WithHiding a -> a
foldr1 :: (a -> a -> a) -> WithHiding a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> WithHiding a -> a
foldl' :: (b -> a -> b) -> b -> WithHiding a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> WithHiding a -> b
foldl :: (b -> a -> b) -> b -> WithHiding a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> WithHiding a -> b
foldr' :: (a -> b -> b) -> b -> WithHiding a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> WithHiding a -> b
foldr :: (a -> b -> b) -> b -> WithHiding a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> WithHiding a -> b
foldMap' :: (a -> m) -> WithHiding a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> WithHiding a -> m
foldMap :: (a -> m) -> WithHiding a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> WithHiding a -> m
fold :: WithHiding m -> m
$cfold :: forall m. Monoid m => WithHiding m -> m
Foldable, Functor WithHiding
Foldable WithHiding
Functor WithHiding
-> Foldable WithHiding
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> WithHiding a -> f (WithHiding b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    WithHiding (f a) -> f (WithHiding a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> WithHiding a -> m (WithHiding b))
-> (forall (m :: * -> *) a.
    Monad m =>
    WithHiding (m a) -> m (WithHiding a))
-> Traversable WithHiding
(a -> f b) -> WithHiding a -> f (WithHiding b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
WithHiding (m a) -> m (WithHiding a)
forall (f :: * -> *) a.
Applicative f =>
WithHiding (f a) -> f (WithHiding a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WithHiding a -> m (WithHiding b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WithHiding a -> f (WithHiding b)
sequence :: WithHiding (m a) -> m (WithHiding a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
WithHiding (m a) -> m (WithHiding a)
mapM :: (a -> m b) -> WithHiding a -> m (WithHiding b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WithHiding a -> m (WithHiding b)
sequenceA :: WithHiding (f a) -> f (WithHiding a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
WithHiding (f a) -> f (WithHiding a)
traverse :: (a -> f b) -> WithHiding a -> f (WithHiding b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WithHiding a -> f (WithHiding b)
$cp2Traversable :: Foldable WithHiding
$cp1Traversable :: Functor WithHiding
Traversable)

instance Decoration WithHiding where
  traverseF :: (a -> m b) -> WithHiding a -> m (WithHiding b)
traverseF a -> m b
f (WithHiding Hiding
h a
a) = Hiding -> b -> WithHiding b
forall a. Hiding -> a -> WithHiding a
WithHiding Hiding
h (b -> WithHiding b) -> m b -> m (WithHiding b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> m b
f a
a

instance Applicative WithHiding where
  pure :: a -> WithHiding a
pure = Hiding -> a -> WithHiding a
forall a. Hiding -> a -> WithHiding a
WithHiding Hiding
forall a. Monoid a => a
mempty
  WithHiding Hiding
h a -> b
f <*> :: WithHiding (a -> b) -> WithHiding a -> WithHiding b
<*> WithHiding Hiding
h' a
a = Hiding -> b -> WithHiding b
forall a. Hiding -> a -> WithHiding a
WithHiding (Hiding -> Hiding -> Hiding
forall a. Monoid a => a -> a -> a
mappend Hiding
h Hiding
h') (a -> b
f a
a)

instance HasRange a => HasRange (WithHiding a) where
  getRange :: WithHiding a -> Range
getRange = a -> Range
forall a. HasRange a => a -> Range
getRange (a -> Range) -> (WithHiding a -> a) -> WithHiding a -> Range
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WithHiding a -> a
forall (t :: * -> *) a. Decoration t => t a -> a
dget

instance SetRange a => SetRange (WithHiding a) where
  setRange :: Range -> WithHiding a -> WithHiding a
setRange = (a -> a) -> WithHiding a -> WithHiding a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a) -> WithHiding a -> WithHiding a)
-> (Range -> a -> a) -> Range -> WithHiding a -> WithHiding a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Range -> a -> a
forall a. SetRange a => Range -> a -> a
setRange

instance KillRange a => KillRange (WithHiding a) where
  killRange :: KillRangeT (WithHiding a)
killRange = (a -> a) -> KillRangeT (WithHiding a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. KillRange a => KillRangeT a
killRange

instance NFData a => NFData (WithHiding a) where
  rnf :: WithHiding a -> ()
rnf (WithHiding Hiding
_ a
a) = a -> ()
forall a. NFData a => a -> ()
rnf a
a

-- | A lens to access the 'Hiding' attribute in data structures.
--   Minimal implementation: @getHiding@ and @mapHiding@ or @LensArgInfo@.
class LensHiding a where

  getHiding :: a -> Hiding

  setHiding :: Hiding -> a -> a
  setHiding Hiding
h = (Hiding -> Hiding) -> a -> a
forall a. LensHiding a => (Hiding -> Hiding) -> a -> a
mapHiding (Hiding -> Hiding -> Hiding
forall a b. a -> b -> a
const Hiding
h)

  mapHiding :: (Hiding -> Hiding) -> a -> a

  default getHiding :: LensArgInfo a => a -> Hiding
  getHiding = ArgInfo -> Hiding
argInfoHiding (ArgInfo -> Hiding) -> (a -> ArgInfo) -> a -> Hiding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo

  default mapHiding :: LensArgInfo a => (Hiding -> Hiding) -> a -> a
  mapHiding Hiding -> Hiding
f = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a) -> (ArgInfo -> ArgInfo) -> a -> a
forall a b. (a -> b) -> a -> b
$ \ ArgInfo
ai -> ArgInfo
ai { argInfoHiding :: Hiding
argInfoHiding = Hiding -> Hiding
f (Hiding -> Hiding) -> Hiding -> Hiding
forall a b. (a -> b) -> a -> b
$ ArgInfo -> Hiding
argInfoHiding ArgInfo
ai }

instance LensHiding Hiding where
  getHiding :: Hiding -> Hiding
getHiding = Hiding -> Hiding
forall a. a -> a
id
  setHiding :: Hiding -> Hiding -> Hiding
setHiding = Hiding -> Hiding -> Hiding
forall a b. a -> b -> a
const
  mapHiding :: (Hiding -> Hiding) -> Hiding -> Hiding
mapHiding = (Hiding -> Hiding) -> Hiding -> Hiding
forall a. a -> a
id

instance LensHiding (WithHiding a) where
  getHiding :: WithHiding a -> Hiding
getHiding   (WithHiding Hiding
h a
_) = Hiding
h
  setHiding :: Hiding -> WithHiding a -> WithHiding a
setHiding Hiding
h (WithHiding Hiding
_ a
a) = Hiding -> a -> WithHiding a
forall a. Hiding -> a -> WithHiding a
WithHiding Hiding
h a
a
  mapHiding :: (Hiding -> Hiding) -> WithHiding a -> WithHiding a
mapHiding Hiding -> Hiding
f (WithHiding Hiding
h a
a) = Hiding -> a -> WithHiding a
forall a. Hiding -> a -> WithHiding a
WithHiding (Hiding -> Hiding
f Hiding
h) a
a

instance LensHiding a => LensHiding (Named nm a) where
  getHiding :: Named nm a -> Hiding
getHiding = a -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding (a -> Hiding) -> (Named nm a -> a) -> Named nm a -> Hiding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Named nm a -> a
forall name a. Named name a -> a
namedThing
  setHiding :: Hiding -> Named nm a -> Named nm a
setHiding = (a -> a) -> Named nm a -> Named nm a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a) -> Named nm a -> Named nm a)
-> (Hiding -> a -> a) -> Hiding -> Named nm a -> Named nm a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Hiding -> a -> a
forall a. LensHiding a => Hiding -> a -> a
setHiding
  mapHiding :: (Hiding -> Hiding) -> Named nm a -> Named nm a
mapHiding = (a -> a) -> Named nm a -> Named nm a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a) -> Named nm a -> Named nm a)
-> ((Hiding -> Hiding) -> a -> a)
-> (Hiding -> Hiding)
-> Named nm a
-> Named nm a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Hiding -> Hiding) -> a -> a
forall a. LensHiding a => (Hiding -> Hiding) -> a -> a
mapHiding

-- | Monoidal composition of 'Hiding' information in some data.
mergeHiding :: LensHiding a => WithHiding a -> a
mergeHiding :: WithHiding a -> a
mergeHiding (WithHiding Hiding
h a
a) = (Hiding -> Hiding) -> a -> a
forall a. LensHiding a => (Hiding -> Hiding) -> a -> a
mapHiding (Hiding -> Hiding -> Hiding
forall a. Monoid a => a -> a -> a
mappend Hiding
h) a
a

-- | 'NotHidden' arguments are @visible@.
visible :: LensHiding a => a -> Bool
visible :: a -> Bool
visible a
a = a -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding a
a Hiding -> Hiding -> Bool
forall a. Eq a => a -> a -> Bool
== Hiding
NotHidden

-- | 'Instance' and 'Hidden' arguments are @notVisible@.
notVisible :: LensHiding a => a -> Bool
notVisible :: a -> Bool
notVisible a
a = a -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding a
a Hiding -> Hiding -> Bool
forall a. Eq a => a -> a -> Bool
/= Hiding
NotHidden

-- | 'Hidden' arguments are @hidden@.
hidden :: LensHiding a => a -> Bool
hidden :: a -> Bool
hidden a
a = a -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding a
a Hiding -> Hiding -> Bool
forall a. Eq a => a -> a -> Bool
== Hiding
Hidden

hide :: LensHiding a => a -> a
hide :: a -> a
hide = Hiding -> a -> a
forall a. LensHiding a => Hiding -> a -> a
setHiding Hiding
Hidden

hideOrKeepInstance :: LensHiding a => a -> a
hideOrKeepInstance :: a -> a
hideOrKeepInstance a
x =
  case a -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding a
x of
    Hiding
Hidden     -> a
x
    Instance{} -> a
x
    Hiding
NotHidden  -> Hiding -> a -> a
forall a. LensHiding a => Hiding -> a -> a
setHiding Hiding
Hidden a
x

makeInstance :: LensHiding a => a -> a
makeInstance :: a -> a
makeInstance = Overlappable -> a -> a
forall a. LensHiding a => Overlappable -> a -> a
makeInstance' Overlappable
NoOverlap

makeInstance' :: LensHiding a => Overlappable -> a -> a
makeInstance' :: Overlappable -> a -> a
makeInstance' Overlappable
o = Hiding -> a -> a
forall a. LensHiding a => Hiding -> a -> a
setHiding (Overlappable -> Hiding
Instance Overlappable
o)

isOverlappable :: LensHiding a => a -> Bool
isOverlappable :: a -> Bool
isOverlappable a
x =
  case a -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding a
x of
    Instance Overlappable
YesOverlap -> Bool
True
    Hiding
_ -> Bool
False

isInstance :: LensHiding a => a -> Bool
isInstance :: a -> Bool
isInstance a
x =
  case a -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding a
x of
    Instance{} -> Bool
True
    Hiding
_          -> Bool
False

-- | Ignores 'Overlappable'.
sameHiding :: (LensHiding a, LensHiding b) => a -> b -> Bool
sameHiding :: a -> b -> Bool
sameHiding a
x b
y =
  case (a -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding a
x, b -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding b
y) of
    (Instance{}, Instance{}) -> Bool
True
    (Hiding
hx, Hiding
hy)                 -> Hiding
hx Hiding -> Hiding -> Bool
forall a. Eq a => a -> a -> Bool
== Hiding
hy

---------------------------------------------------------------------------
-- * Modalities
---------------------------------------------------------------------------

-- | Type wrapper to indicate additive monoid/semigroup context.
newtype UnderAddition t = UnderAddition t deriving (Int -> UnderAddition t -> ShowS
[UnderAddition t] -> ShowS
UnderAddition t -> String
(Int -> UnderAddition t -> ShowS)
-> (UnderAddition t -> String)
-> ([UnderAddition t] -> ShowS)
-> Show (UnderAddition t)
forall t. Show t => Int -> UnderAddition t -> ShowS
forall t. Show t => [UnderAddition t] -> ShowS
forall t. Show t => UnderAddition t -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnderAddition t] -> ShowS
$cshowList :: forall t. Show t => [UnderAddition t] -> ShowS
show :: UnderAddition t -> String
$cshow :: forall t. Show t => UnderAddition t -> String
showsPrec :: Int -> UnderAddition t -> ShowS
$cshowsPrec :: forall t. Show t => Int -> UnderAddition t -> ShowS
Show, a -> UnderAddition b -> UnderAddition a
(a -> b) -> UnderAddition a -> UnderAddition b
(forall a b. (a -> b) -> UnderAddition a -> UnderAddition b)
-> (forall a b. a -> UnderAddition b -> UnderAddition a)
-> Functor UnderAddition
forall a b. a -> UnderAddition b -> UnderAddition a
forall a b. (a -> b) -> UnderAddition a -> UnderAddition b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> UnderAddition b -> UnderAddition a
$c<$ :: forall a b. a -> UnderAddition b -> UnderAddition a
fmap :: (a -> b) -> UnderAddition a -> UnderAddition b
$cfmap :: forall a b. (a -> b) -> UnderAddition a -> UnderAddition b
Functor, UnderAddition t -> UnderAddition t -> Bool
(UnderAddition t -> UnderAddition t -> Bool)
-> (UnderAddition t -> UnderAddition t -> Bool)
-> Eq (UnderAddition t)
forall t. Eq t => UnderAddition t -> UnderAddition t -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnderAddition t -> UnderAddition t -> Bool
$c/= :: forall t. Eq t => UnderAddition t -> UnderAddition t -> Bool
== :: UnderAddition t -> UnderAddition t -> Bool
$c== :: forall t. Eq t => UnderAddition t -> UnderAddition t -> Bool
Eq, Eq (UnderAddition t)
Eq (UnderAddition t)
-> (UnderAddition t -> UnderAddition t -> Ordering)
-> (UnderAddition t -> UnderAddition t -> Bool)
-> (UnderAddition t -> UnderAddition t -> Bool)
-> (UnderAddition t -> UnderAddition t -> Bool)
-> (UnderAddition t -> UnderAddition t -> Bool)
-> (UnderAddition t -> UnderAddition t -> UnderAddition t)
-> (UnderAddition t -> UnderAddition t -> UnderAddition t)
-> Ord (UnderAddition t)
UnderAddition t -> UnderAddition t -> Bool
UnderAddition t -> UnderAddition t -> Ordering
UnderAddition t -> UnderAddition t -> UnderAddition t
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
forall t. Ord t => Eq (UnderAddition t)
forall t. Ord t => UnderAddition t -> UnderAddition t -> Bool
forall t. Ord t => UnderAddition t -> UnderAddition t -> Ordering
forall t.
Ord t =>
UnderAddition t -> UnderAddition t -> UnderAddition t
min :: UnderAddition t -> UnderAddition t -> UnderAddition t
$cmin :: forall t.
Ord t =>
UnderAddition t -> UnderAddition t -> UnderAddition t
max :: UnderAddition t -> UnderAddition t -> UnderAddition t
$cmax :: forall t.
Ord t =>
UnderAddition t -> UnderAddition t -> UnderAddition t
>= :: UnderAddition t -> UnderAddition t -> Bool
$c>= :: forall t. Ord t => UnderAddition t -> UnderAddition t -> Bool
> :: UnderAddition t -> UnderAddition t -> Bool
$c> :: forall t. Ord t => UnderAddition t -> UnderAddition t -> Bool
<= :: UnderAddition t -> UnderAddition t -> Bool
$c<= :: forall t. Ord t => UnderAddition t -> UnderAddition t -> Bool
< :: UnderAddition t -> UnderAddition t -> Bool
$c< :: forall t. Ord t => UnderAddition t -> UnderAddition t -> Bool
compare :: UnderAddition t -> UnderAddition t -> Ordering
$ccompare :: forall t. Ord t => UnderAddition t -> UnderAddition t -> Ordering
$cp1Ord :: forall t. Ord t => Eq (UnderAddition t)
Ord, Comparable (UnderAddition t)
Comparable (UnderAddition t) -> PartialOrd (UnderAddition t)
forall t. PartialOrd t => Comparable (UnderAddition t)
forall a. Comparable a -> PartialOrd a
comparable :: Comparable (UnderAddition t)
$ccomparable :: forall t. PartialOrd t => Comparable (UnderAddition t)
PartialOrd)

instance Applicative UnderAddition where
  pure :: a -> UnderAddition a
pure = a -> UnderAddition a
forall a. a -> UnderAddition a
UnderAddition
  <*> :: UnderAddition (a -> b) -> UnderAddition a -> UnderAddition b
(<*>) (UnderAddition a -> b
f) (UnderAddition a
a) = b -> UnderAddition b
forall (f :: * -> *) a. Applicative f => a -> f a
pure (a -> b
f a
a)

-- | Type wrapper to indicate composition or multiplicative monoid/semigroup context.
newtype UnderComposition t = UnderComposition t deriving (Int -> UnderComposition t -> ShowS
[UnderComposition t] -> ShowS
UnderComposition t -> String
(Int -> UnderComposition t -> ShowS)
-> (UnderComposition t -> String)
-> ([UnderComposition t] -> ShowS)
-> Show (UnderComposition t)
forall t. Show t => Int -> UnderComposition t -> ShowS
forall t. Show t => [UnderComposition t] -> ShowS
forall t. Show t => UnderComposition t -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnderComposition t] -> ShowS
$cshowList :: forall t. Show t => [UnderComposition t] -> ShowS
show :: UnderComposition t -> String
$cshow :: forall t. Show t => UnderComposition t -> String
showsPrec :: Int -> UnderComposition t -> ShowS
$cshowsPrec :: forall t. Show t => Int -> UnderComposition t -> ShowS
Show, a -> UnderComposition b -> UnderComposition a
(a -> b) -> UnderComposition a -> UnderComposition b
(forall a b. (a -> b) -> UnderComposition a -> UnderComposition b)
-> (forall a b. a -> UnderComposition b -> UnderComposition a)
-> Functor UnderComposition
forall a b. a -> UnderComposition b -> UnderComposition a
forall a b. (a -> b) -> UnderComposition a -> UnderComposition b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> UnderComposition b -> UnderComposition a
$c<$ :: forall a b. a -> UnderComposition b -> UnderComposition a
fmap :: (a -> b) -> UnderComposition a -> UnderComposition b
$cfmap :: forall a b. (a -> b) -> UnderComposition a -> UnderComposition b
Functor, UnderComposition t -> UnderComposition t -> Bool
(UnderComposition t -> UnderComposition t -> Bool)
-> (UnderComposition t -> UnderComposition t -> Bool)
-> Eq (UnderComposition t)
forall t. Eq t => UnderComposition t -> UnderComposition t -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnderComposition t -> UnderComposition t -> Bool
$c/= :: forall t. Eq t => UnderComposition t -> UnderComposition t -> Bool
== :: UnderComposition t -> UnderComposition t -> Bool
$c== :: forall t. Eq t => UnderComposition t -> UnderComposition t -> Bool
Eq, Eq (UnderComposition t)
Eq (UnderComposition t)
-> (UnderComposition t -> UnderComposition t -> Ordering)
-> (UnderComposition t -> UnderComposition t -> Bool)
-> (UnderComposition t -> UnderComposition t -> Bool)
-> (UnderComposition t -> UnderComposition t -> Bool)
-> (UnderComposition t -> UnderComposition t -> Bool)
-> (UnderComposition t -> UnderComposition t -> UnderComposition t)
-> (UnderComposition t -> UnderComposition t -> UnderComposition t)
-> Ord (UnderComposition t)
UnderComposition t -> UnderComposition t -> Bool
UnderComposition t -> UnderComposition t -> Ordering
UnderComposition t -> UnderComposition t -> UnderComposition t
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
forall t. Ord t => Eq (UnderComposition t)
forall t. Ord t => UnderComposition t -> UnderComposition t -> Bool
forall t.
Ord t =>
UnderComposition t -> UnderComposition t -> Ordering
forall t.
Ord t =>
UnderComposition t -> UnderComposition t -> UnderComposition t
min :: UnderComposition t -> UnderComposition t -> UnderComposition t
$cmin :: forall t.
Ord t =>
UnderComposition t -> UnderComposition t -> UnderComposition t
max :: UnderComposition t -> UnderComposition t -> UnderComposition t
$cmax :: forall t.
Ord t =>
UnderComposition t -> UnderComposition t -> UnderComposition t
>= :: UnderComposition t -> UnderComposition t -> Bool
$c>= :: forall t. Ord t => UnderComposition t -> UnderComposition t -> Bool
> :: UnderComposition t -> UnderComposition t -> Bool
$c> :: forall t. Ord t => UnderComposition t -> UnderComposition t -> Bool
<= :: UnderComposition t -> UnderComposition t -> Bool
$c<= :: forall t. Ord t => UnderComposition t -> UnderComposition t -> Bool
< :: UnderComposition t -> UnderComposition t -> Bool
$c< :: forall t. Ord t => UnderComposition t -> UnderComposition t -> Bool
compare :: UnderComposition t -> UnderComposition t -> Ordering
$ccompare :: forall t.
Ord t =>
UnderComposition t -> UnderComposition t -> Ordering
$cp1Ord :: forall t. Ord t => Eq (UnderComposition t)
Ord, Comparable (UnderComposition t)
Comparable (UnderComposition t) -> PartialOrd (UnderComposition t)
forall t. PartialOrd t => Comparable (UnderComposition t)
forall a. Comparable a -> PartialOrd a
comparable :: Comparable (UnderComposition t)
$ccomparable :: forall t. PartialOrd t => Comparable (UnderComposition t)
PartialOrd)

instance Applicative UnderComposition where
  pure :: a -> UnderComposition a
pure = a -> UnderComposition a
forall a. a -> UnderComposition a
UnderComposition
  <*> :: UnderComposition (a -> b)
-> UnderComposition a -> UnderComposition b
(<*>) (UnderComposition a -> b
f) (UnderComposition a
a) = b -> UnderComposition b
forall (f :: * -> *) a. Applicative f => a -> f a
pure (a -> b
f a
a)

-- | We have a tuple of modalities, which might not be fully orthogonal.
--   For instance, irrelevant stuff is also run-time irrelevant.
data Modality = Modality
  { Modality -> Relevance
modRelevance :: Relevance
      -- ^ Legacy irrelevance.
      --   See Pfenning, LiCS 2001; Abel/Vezzosi/Winterhalter, ICFP 2017.
  , Modality -> Quantity
modQuantity  :: Quantity
      -- ^ Cardinality / runtime erasure.
      --   See Conor McBride, I got plenty o' nutting, Wadlerfest 2016.
      --   See Bob Atkey, Syntax and Semantics of Quantitative Type Theory, LiCS 2018.
  , Modality -> Cohesion
modCohesion :: Cohesion
      -- ^ Cohesion/what was in Agda-flat.
      --   see "Brouwer's fixed-point theorem in real-cohesive homotopy type theory" (arXiv:1509.07584)
      --   Currently only the comonad is implemented.
  } deriving (Typeable Modality
DataType
Constr
Typeable Modality
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Modality -> c Modality)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Modality)
-> (Modality -> Constr)
-> (Modality -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Modality))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Modality))
-> ((forall b. Data b => b -> b) -> Modality -> Modality)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Modality -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Modality -> r)
-> (forall u. (forall d. Data d => d -> u) -> Modality -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Modality -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Modality -> m Modality)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Modality -> m Modality)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Modality -> m Modality)
-> Data Modality
Modality -> DataType
Modality -> Constr
(forall b. Data b => b -> b) -> Modality -> Modality
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Modality -> c Modality
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Modality
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) -> Modality -> u
forall u. (forall d. Data d => d -> u) -> Modality -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Modality -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Modality -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Modality -> m Modality
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Modality -> m Modality
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Modality
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Modality -> c Modality
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Modality)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Modality)
$cModality :: Constr
$tModality :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Modality -> m Modality
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Modality -> m Modality
gmapMp :: (forall d. Data d => d -> m d) -> Modality -> m Modality
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Modality -> m Modality
gmapM :: (forall d. Data d => d -> m d) -> Modality -> m Modality
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Modality -> m Modality
gmapQi :: Int -> (forall d. Data d => d -> u) -> Modality -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Modality -> u
gmapQ :: (forall d. Data d => d -> u) -> Modality -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Modality -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Modality -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Modality -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Modality -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Modality -> r
gmapT :: (forall b. Data b => b -> b) -> Modality -> Modality
$cgmapT :: (forall b. Data b => b -> b) -> Modality -> Modality
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Modality)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Modality)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Modality)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Modality)
dataTypeOf :: Modality -> DataType
$cdataTypeOf :: Modality -> DataType
toConstr :: Modality -> Constr
$ctoConstr :: Modality -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Modality
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Modality
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Modality -> c Modality
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Modality -> c Modality
$cp1Data :: Typeable Modality
Data, Modality -> Modality -> Bool
(Modality -> Modality -> Bool)
-> (Modality -> Modality -> Bool) -> Eq Modality
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Modality -> Modality -> Bool
$c/= :: Modality -> Modality -> Bool
== :: Modality -> Modality -> Bool
$c== :: Modality -> Modality -> Bool
Eq, Eq Modality
Eq Modality
-> (Modality -> Modality -> Ordering)
-> (Modality -> Modality -> Bool)
-> (Modality -> Modality -> Bool)
-> (Modality -> Modality -> Bool)
-> (Modality -> Modality -> Bool)
-> (Modality -> Modality -> Modality)
-> (Modality -> Modality -> Modality)
-> Ord Modality
Modality -> Modality -> Bool
Modality -> Modality -> Ordering
Modality -> Modality -> Modality
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 :: Modality -> Modality -> Modality
$cmin :: Modality -> Modality -> Modality
max :: Modality -> Modality -> Modality
$cmax :: Modality -> Modality -> Modality
>= :: Modality -> Modality -> Bool
$c>= :: Modality -> Modality -> Bool
> :: Modality -> Modality -> Bool
$c> :: Modality -> Modality -> Bool
<= :: Modality -> Modality -> Bool
$c<= :: Modality -> Modality -> Bool
< :: Modality -> Modality -> Bool
$c< :: Modality -> Modality -> Bool
compare :: Modality -> Modality -> Ordering
$ccompare :: Modality -> Modality -> Ordering
$cp1Ord :: Eq Modality
Ord, Int -> Modality -> ShowS
[Modality] -> ShowS
Modality -> String
(Int -> Modality -> ShowS)
-> (Modality -> String) -> ([Modality] -> ShowS) -> Show Modality
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Modality] -> ShowS
$cshowList :: [Modality] -> ShowS
show :: Modality -> String
$cshow :: Modality -> String
showsPrec :: Int -> Modality -> ShowS
$cshowsPrec :: Int -> Modality -> ShowS
Show, (forall x. Modality -> Rep Modality x)
-> (forall x. Rep Modality x -> Modality) -> Generic Modality
forall x. Rep Modality x -> Modality
forall x. Modality -> Rep Modality x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Modality x -> Modality
$cfrom :: forall x. Modality -> Rep Modality x
Generic)

-- | Dominance ordering.
instance PartialOrd Modality where
  comparable :: Comparable Modality
comparable (Modality Relevance
r Quantity
q Cohesion
c) (Modality Relevance
r' Quantity
q' Cohesion
c') = Comparable (Relevance, (Quantity, Cohesion))
forall a. PartialOrd a => Comparable a
comparable (Relevance
r, (Quantity
q, Cohesion
c)) (Relevance
r', (Quantity
q', Cohesion
c'))

-- | Pointwise composition.
instance Semigroup (UnderComposition Modality) where
  <> :: UnderComposition Modality
-> UnderComposition Modality -> UnderComposition Modality
(<>) = (Modality -> Modality -> Modality)
-> UnderComposition Modality
-> UnderComposition Modality
-> UnderComposition Modality
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Modality -> Modality -> Modality
composeModality

-- | Pointwise composition unit.
instance Monoid (UnderComposition Modality) where
  mempty :: UnderComposition Modality
mempty  = Modality -> UnderComposition Modality
forall (f :: * -> *) a. Applicative f => a -> f a
pure Modality
unitModality
  mappend :: UnderComposition Modality
-> UnderComposition Modality -> UnderComposition Modality
mappend = UnderComposition Modality
-> UnderComposition Modality -> UnderComposition Modality
forall a. Semigroup a => a -> a -> a
(<>)

instance POSemigroup (UnderComposition Modality) where
instance POMonoid (UnderComposition Modality) where

instance LeftClosedPOMonoid (UnderComposition Modality) where
  inverseCompose :: UnderComposition Modality
-> UnderComposition Modality -> UnderComposition Modality
inverseCompose = (Modality -> Modality -> Modality)
-> UnderComposition Modality
-> UnderComposition Modality
-> UnderComposition Modality
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Modality -> Modality -> Modality
inverseComposeModality

-- | Pointwise addition.
instance Semigroup (UnderAddition Modality) where
  <> :: UnderAddition Modality
-> UnderAddition Modality -> UnderAddition Modality
(<>) = (Modality -> Modality -> Modality)
-> UnderAddition Modality
-> UnderAddition Modality
-> UnderAddition Modality
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Modality -> Modality -> Modality
addModality

-- | Pointwise additive unit.
instance Monoid (UnderAddition Modality) where
  mempty :: UnderAddition Modality
mempty  = Modality -> UnderAddition Modality
forall (f :: * -> *) a. Applicative f => a -> f a
pure Modality
zeroModality
  mappend :: UnderAddition Modality
-> UnderAddition Modality -> UnderAddition Modality
mappend = UnderAddition Modality
-> UnderAddition Modality -> UnderAddition Modality
forall a. Semigroup a => a -> a -> a
(<>)

instance POSemigroup (UnderAddition Modality) where
instance POMonoid (UnderAddition Modality) where

-- | @m `moreUsableModality` m'@ means that an @m@ can be used
--   where ever an @m'@ is required.

moreUsableModality :: Modality -> Modality -> Bool
moreUsableModality :: Modality -> Modality -> Bool
moreUsableModality Modality
m Modality
m' = Modality -> PartialOrdering -> Modality -> Bool
forall a. PartialOrd a => a -> PartialOrdering -> a -> Bool
related Modality
m PartialOrdering
POLE Modality
m'

usableModality :: LensModality a => a -> Bool
usableModality :: a -> Bool
usableModality a
a = Modality -> Bool
forall a. LensRelevance a => a -> Bool
usableRelevance Modality
m Bool -> Bool -> Bool
&& Modality -> Bool
forall a. LensQuantity a => a -> Bool
usableQuantity Modality
m
  where m :: Modality
m = a -> Modality
forall a. LensModality a => a -> Modality
getModality a
a

-- | Multiplicative monoid (standard monoid).
composeModality :: Modality -> Modality -> Modality
composeModality :: Modality -> Modality -> Modality
composeModality (Modality Relevance
r Quantity
q Cohesion
c) (Modality Relevance
r' Quantity
q' Cohesion
c') =
    Relevance -> Quantity -> Cohesion -> Modality
Modality (Relevance
r Relevance -> Relevance -> Relevance
`composeRelevance` Relevance
r')
             (Quantity
q Quantity -> Quantity -> Quantity
`composeQuantity` Quantity
q')
             (Cohesion
c Cohesion -> Cohesion -> Cohesion
`composeCohesion` Cohesion
c')

-- | Compose with modality flag from the left.
--   This function is e.g. used to update the modality information
--   on pattern variables @a@ after a match against something of modality @q@.
applyModality :: LensModality a => Modality -> a -> a
applyModality :: Modality -> a -> a
applyModality Modality
m = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality (Modality
m Modality -> Modality -> Modality
`composeModality`)

-- | @inverseComposeModality r x@ returns the least modality @y@
--   such that forall @x@, @y@ we have
--   @x \`moreUsableModality\` (r \`composeModality\` y)@
--   iff
--   @(r \`inverseComposeModality\` x) \`moreUsableModality\` y@ (Galois connection).
inverseComposeModality :: Modality -> Modality -> Modality
inverseComposeModality :: Modality -> Modality -> Modality
inverseComposeModality (Modality Relevance
r Quantity
q Cohesion
c) (Modality Relevance
r' Quantity
q' Cohesion
c') =
  Relevance -> Quantity -> Cohesion -> Modality
Modality (Relevance
r Relevance -> Relevance -> Relevance
`inverseComposeRelevance` Relevance
r')
           (Quantity
q Quantity -> Quantity -> Quantity
`inverseComposeQuantity`  Quantity
q')
           (Cohesion
c Cohesion -> Cohesion -> Cohesion
`inverseComposeCohesion`  Cohesion
c')

-- | Left division by a 'Modality'.
--   Used e.g. to modify context when going into a @m@ argument.
--
-- Note that this function does not change quantities.
inverseApplyModalityButNotQuantity :: LensModality a => Modality -> a -> a
inverseApplyModalityButNotQuantity :: Modality -> a -> a
inverseApplyModalityButNotQuantity Modality
m =
  (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality (Modality
m' Modality -> Modality -> Modality
`inverseComposeModality`)
  where
  m' :: Modality
m' = Quantity -> Modality -> Modality
forall a. LensQuantity a => Quantity -> a -> a
setQuantity (Q1Origin -> Quantity
Quantity1 Q1Origin
Q1Inferred) Modality
m

-- | 'Modality' forms a pointwise additive monoid.
addModality :: Modality -> Modality -> Modality
addModality :: Modality -> Modality -> Modality
addModality (Modality Relevance
r Quantity
q Cohesion
c) (Modality Relevance
r' Quantity
q' Cohesion
c') = Relevance -> Quantity -> Cohesion -> Modality
Modality (Relevance -> Relevance -> Relevance
addRelevance Relevance
r Relevance
r') (Quantity -> Quantity -> Quantity
addQuantity Quantity
q Quantity
q') (Cohesion -> Cohesion -> Cohesion
addCohesion Cohesion
c Cohesion
c')

-- | Identity under addition
zeroModality :: Modality
zeroModality :: Modality
zeroModality = Relevance -> Quantity -> Cohesion -> Modality
Modality Relevance
zeroRelevance Quantity
zeroQuantity Cohesion
zeroCohesion

-- | Identity under composition
unitModality :: Modality
unitModality :: Modality
unitModality = Relevance -> Quantity -> Cohesion -> Modality
Modality Relevance
unitRelevance Quantity
unitQuantity Cohesion
unitCohesion

-- | Absorptive element under addition.
topModality :: Modality
topModality :: Modality
topModality = Relevance -> Quantity -> Cohesion -> Modality
Modality Relevance
topRelevance Quantity
topQuantity Cohesion
topCohesion

-- | The default Modality
--   Beware that this is neither the additive unit nor the unit under
--   composition, because the default quantity is ω.
defaultModality :: Modality
defaultModality :: Modality
defaultModality = Relevance -> Quantity -> Cohesion -> Modality
Modality Relevance
defaultRelevance Quantity
defaultQuantity Cohesion
defaultCohesion

-- | Equality ignoring origin.

sameModality :: (LensModality a, LensModality b) => a -> b -> Bool
sameModality :: a -> b -> Bool
sameModality a
x b
y = case (a -> Modality
forall a. LensModality a => a -> Modality
getModality a
x , b -> Modality
forall a. LensModality a => a -> Modality
getModality b
y) of
  (Modality Relevance
r Quantity
q Cohesion
c , Modality Relevance
r' Quantity
q' Cohesion
c') -> Relevance -> Relevance -> Bool
sameRelevance Relevance
r Relevance
r' Bool -> Bool -> Bool
&& Quantity -> Quantity -> Bool
sameQuantity Quantity
q Quantity
q' Bool -> Bool -> Bool
&& Cohesion -> Cohesion -> Bool
sameCohesion Cohesion
c Cohesion
c'

-- boilerplate instances

instance HasRange Modality where
  getRange :: Modality -> Range
getRange (Modality Relevance
r Quantity
q Cohesion
c) = (Relevance, Quantity, Cohesion) -> Range
forall a. HasRange a => a -> Range
getRange (Relevance
r, Quantity
q, Cohesion
c)

instance KillRange Modality where
  killRange :: Modality -> Modality
killRange (Modality Relevance
r Quantity
q Cohesion
c) = (Relevance -> Quantity -> Cohesion -> Modality)
-> Relevance -> Quantity -> Cohesion -> Modality
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 Relevance -> Quantity -> Cohesion -> Modality
Modality Relevance
r Quantity
q Cohesion
c

instance NFData Modality where

-- Lens stuff

lModRelevance :: Lens' Relevance Modality
lModRelevance :: (Relevance -> f Relevance) -> Modality -> f Modality
lModRelevance Relevance -> f Relevance
f Modality
m = Relevance -> f Relevance
f (Modality -> Relevance
modRelevance Modality
m) f Relevance -> (Relevance -> Modality) -> f Modality
forall (m :: * -> *) a b. Functor m => m a -> (a -> b) -> m b
<&> \ Relevance
r -> Modality
m { modRelevance :: Relevance
modRelevance = Relevance
r }

lModQuantity :: Lens' Quantity Modality
lModQuantity :: (Quantity -> f Quantity) -> Modality -> f Modality
lModQuantity Quantity -> f Quantity
f Modality
m = Quantity -> f Quantity
f (Modality -> Quantity
modQuantity Modality
m) f Quantity -> (Quantity -> Modality) -> f Modality
forall (m :: * -> *) a b. Functor m => m a -> (a -> b) -> m b
<&> \ Quantity
q -> Modality
m { modQuantity :: Quantity
modQuantity = Quantity
q }

lModCohesion :: Lens' Cohesion Modality
lModCohesion :: (Cohesion -> f Cohesion) -> Modality -> f Modality
lModCohesion Cohesion -> f Cohesion
f Modality
m = Cohesion -> f Cohesion
f (Modality -> Cohesion
modCohesion Modality
m) f Cohesion -> (Cohesion -> Modality) -> f Modality
forall (m :: * -> *) a b. Functor m => m a -> (a -> b) -> m b
<&> \ Cohesion
q -> Modality
m { modCohesion :: Cohesion
modCohesion = Cohesion
q }

class LensModality a where

  getModality :: a -> Modality

  setModality :: Modality -> a -> a
  setModality = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality ((Modality -> Modality) -> a -> a)
-> (Modality -> Modality -> Modality) -> Modality -> a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Modality -> Modality -> Modality
forall a b. a -> b -> a
const

  mapModality :: (Modality -> Modality) -> a -> a

  default getModality :: LensArgInfo a => a -> Modality
  getModality = ArgInfo -> Modality
argInfoModality (ArgInfo -> Modality) -> (a -> ArgInfo) -> a -> Modality
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo

  default mapModality :: LensArgInfo a => (Modality -> Modality) -> a -> a
  mapModality Modality -> Modality
f = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a) -> (ArgInfo -> ArgInfo) -> a -> a
forall a b. (a -> b) -> a -> b
$ \ ArgInfo
ai -> ArgInfo
ai { argInfoModality :: Modality
argInfoModality = Modality -> Modality
f (Modality -> Modality) -> Modality -> Modality
forall a b. (a -> b) -> a -> b
$ ArgInfo -> Modality
argInfoModality ArgInfo
ai }

instance LensModality Modality where
  getModality :: Modality -> Modality
getModality = Modality -> Modality
forall a. a -> a
id
  setModality :: Modality -> Modality -> Modality
setModality = Modality -> Modality -> Modality
forall a b. a -> b -> a
const
  mapModality :: (Modality -> Modality) -> Modality -> Modality
mapModality = (Modality -> Modality) -> Modality -> Modality
forall a. a -> a
id

instance LensRelevance Modality where
  getRelevance :: Modality -> Relevance
getRelevance = Modality -> Relevance
modRelevance
  setRelevance :: Relevance -> Modality -> Modality
setRelevance Relevance
h Modality
m = Modality
m { modRelevance :: Relevance
modRelevance = Relevance
h }
  mapRelevance :: (Relevance -> Relevance) -> Modality -> Modality
mapRelevance Relevance -> Relevance
f Modality
m = Modality
m { modRelevance :: Relevance
modRelevance = Relevance -> Relevance
f (Modality -> Relevance
modRelevance Modality
m) }

instance LensQuantity Modality where
  getQuantity :: Modality -> Quantity
getQuantity = Modality -> Quantity
modQuantity
  setQuantity :: Quantity -> Modality -> Modality
setQuantity Quantity
h Modality
m = Modality
m { modQuantity :: Quantity
modQuantity = Quantity
h }
  mapQuantity :: (Quantity -> Quantity) -> Modality -> Modality
mapQuantity Quantity -> Quantity
f Modality
m = Modality
m { modQuantity :: Quantity
modQuantity = Quantity -> Quantity
f (Modality -> Quantity
modQuantity Modality
m) }

instance LensCohesion Modality where
  getCohesion :: Modality -> Cohesion
getCohesion = Modality -> Cohesion
modCohesion
  setCohesion :: Cohesion -> Modality -> Modality
setCohesion Cohesion
h Modality
m = Modality
m { modCohesion :: Cohesion
modCohesion = Cohesion
h }
  mapCohesion :: (Cohesion -> Cohesion) -> Modality -> Modality
mapCohesion Cohesion -> Cohesion
f Modality
m = Modality
m { modCohesion :: Cohesion
modCohesion = Cohesion -> Cohesion
f (Modality -> Cohesion
modCohesion Modality
m) }

-- default accessors for Relevance

getRelevanceMod :: LensModality a => LensGet Relevance a
getRelevanceMod :: LensGet Relevance a
getRelevanceMod = Modality -> Relevance
forall a. LensRelevance a => a -> Relevance
getRelevance (Modality -> Relevance) -> (a -> Modality) -> LensGet Relevance a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Modality
forall a. LensModality a => a -> Modality
getModality

setRelevanceMod :: LensModality a => LensSet Relevance a
setRelevanceMod :: LensSet Relevance a
setRelevanceMod = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality ((Modality -> Modality) -> a -> a)
-> (Relevance -> Modality -> Modality) -> LensSet Relevance a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Relevance -> Modality -> Modality
forall a. LensRelevance a => Relevance -> a -> a
setRelevance

mapRelevanceMod :: LensModality a => LensMap Relevance a
mapRelevanceMod :: LensMap Relevance a
mapRelevanceMod = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality ((Modality -> Modality) -> a -> a)
-> ((Relevance -> Relevance) -> Modality -> Modality)
-> LensMap Relevance a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Relevance -> Relevance) -> Modality -> Modality
forall a. LensRelevance a => (Relevance -> Relevance) -> a -> a
mapRelevance

-- default accessors for Quantity

getQuantityMod :: LensModality a => LensGet Quantity a
getQuantityMod :: LensGet Quantity a
getQuantityMod = Modality -> Quantity
forall a. LensQuantity a => a -> Quantity
getQuantity (Modality -> Quantity) -> (a -> Modality) -> LensGet Quantity a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Modality
forall a. LensModality a => a -> Modality
getModality

setQuantityMod :: LensModality a => LensSet Quantity a
setQuantityMod :: LensSet Quantity a
setQuantityMod = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality ((Modality -> Modality) -> a -> a)
-> (Quantity -> Modality -> Modality) -> LensSet Quantity a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Quantity -> Modality -> Modality
forall a. LensQuantity a => Quantity -> a -> a
setQuantity

mapQuantityMod :: LensModality a => LensMap Quantity a
mapQuantityMod :: LensMap Quantity a
mapQuantityMod = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality ((Modality -> Modality) -> a -> a)
-> ((Quantity -> Quantity) -> Modality -> Modality)
-> LensMap Quantity a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Quantity -> Quantity) -> Modality -> Modality
forall a. LensQuantity a => (Quantity -> Quantity) -> a -> a
mapQuantity

-- default accessors for Cohesion

getCohesionMod :: LensModality a => LensGet Cohesion a
getCohesionMod :: LensGet Cohesion a
getCohesionMod = Modality -> Cohesion
forall a. LensCohesion a => a -> Cohesion
getCohesion (Modality -> Cohesion) -> (a -> Modality) -> LensGet Cohesion a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Modality
forall a. LensModality a => a -> Modality
getModality

setCohesionMod :: LensModality a => LensSet Cohesion a
setCohesionMod :: LensSet Cohesion a
setCohesionMod = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality ((Modality -> Modality) -> a -> a)
-> (Cohesion -> Modality -> Modality) -> LensSet Cohesion a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Cohesion -> Modality -> Modality
forall a. LensCohesion a => Cohesion -> a -> a
setCohesion

mapCohesionMod :: LensModality a => LensMap Cohesion a
mapCohesionMod :: LensMap Cohesion a
mapCohesionMod = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality ((Modality -> Modality) -> a -> a)
-> ((Cohesion -> Cohesion) -> Modality -> Modality)
-> LensMap Cohesion a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Cohesion -> Cohesion) -> Modality -> Modality
forall a. LensCohesion a => (Cohesion -> Cohesion) -> a -> a
mapCohesion

---------------------------------------------------------------------------
-- * Quantities
---------------------------------------------------------------------------

-- ** Quantity origin.

-- | Origin of 'Quantity0'.
data Q0Origin
  = Q0Inferred       -- ^ User wrote nothing.
  | Q0       Range   -- ^ User wrote "@0".
  | Q0Erased Range   -- ^ User wrote "@erased".
  deriving (Typeable Q0Origin
DataType
Constr
Typeable Q0Origin
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Q0Origin -> c Q0Origin)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Q0Origin)
-> (Q0Origin -> Constr)
-> (Q0Origin -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Q0Origin))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Q0Origin))
-> ((forall b. Data b => b -> b) -> Q0Origin -> Q0Origin)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Q0Origin -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Q0Origin -> r)
-> (forall u. (forall d. Data d => d -> u) -> Q0Origin -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Q0Origin -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin)
-> Data Q0Origin
Q0Origin -> DataType
Q0Origin -> Constr
(forall b. Data b => b -> b) -> Q0Origin -> Q0Origin
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Q0Origin -> c Q0Origin
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Q0Origin
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) -> Q0Origin -> u
forall u. (forall d. Data d => d -> u) -> Q0Origin -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Q0Origin -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Q0Origin -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Q0Origin
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Q0Origin -> c Q0Origin
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Q0Origin)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Q0Origin)
$cQ0Erased :: Constr
$cQ0 :: Constr
$cQ0Inferred :: Constr
$tQ0Origin :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin
gmapMp :: (forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin
gmapM :: (forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Q0Origin -> m Q0Origin
gmapQi :: Int -> (forall d. Data d => d -> u) -> Q0Origin -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Q0Origin -> u
gmapQ :: (forall d. Data d => d -> u) -> Q0Origin -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Q0Origin -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Q0Origin -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Q0Origin -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Q0Origin -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Q0Origin -> r
gmapT :: (forall b. Data b => b -> b) -> Q0Origin -> Q0Origin
$cgmapT :: (forall b. Data b => b -> b) -> Q0Origin -> Q0Origin
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Q0Origin)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Q0Origin)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Q0Origin)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Q0Origin)
dataTypeOf :: Q0Origin -> DataType
$cdataTypeOf :: Q0Origin -> DataType
toConstr :: Q0Origin -> Constr
$ctoConstr :: Q0Origin -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Q0Origin
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Q0Origin
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Q0Origin -> c Q0Origin
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Q0Origin -> c Q0Origin
$cp1Data :: Typeable Q0Origin
Data, Int -> Q0Origin -> ShowS
[Q0Origin] -> ShowS
Q0Origin -> String
(Int -> Q0Origin -> ShowS)
-> (Q0Origin -> String) -> ([Q0Origin] -> ShowS) -> Show Q0Origin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Q0Origin] -> ShowS
$cshowList :: [Q0Origin] -> ShowS
show :: Q0Origin -> String
$cshow :: Q0Origin -> String
showsPrec :: Int -> Q0Origin -> ShowS
$cshowsPrec :: Int -> Q0Origin -> ShowS
Show, (forall x. Q0Origin -> Rep Q0Origin x)
-> (forall x. Rep Q0Origin x -> Q0Origin) -> Generic Q0Origin
forall x. Rep Q0Origin x -> Q0Origin
forall x. Q0Origin -> Rep Q0Origin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Q0Origin x -> Q0Origin
$cfrom :: forall x. Q0Origin -> Rep Q0Origin x
Generic, Q0Origin -> Q0Origin -> Bool
(Q0Origin -> Q0Origin -> Bool)
-> (Q0Origin -> Q0Origin -> Bool) -> Eq Q0Origin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Q0Origin -> Q0Origin -> Bool
$c/= :: Q0Origin -> Q0Origin -> Bool
== :: Q0Origin -> Q0Origin -> Bool
$c== :: Q0Origin -> Q0Origin -> Bool
Eq, Eq Q0Origin
Eq Q0Origin
-> (Q0Origin -> Q0Origin -> Ordering)
-> (Q0Origin -> Q0Origin -> Bool)
-> (Q0Origin -> Q0Origin -> Bool)
-> (Q0Origin -> Q0Origin -> Bool)
-> (Q0Origin -> Q0Origin -> Bool)
-> (Q0Origin -> Q0Origin -> Q0Origin)
-> (Q0Origin -> Q0Origin -> Q0Origin)
-> Ord Q0Origin
Q0Origin -> Q0Origin -> Bool
Q0Origin -> Q0Origin -> Ordering
Q0Origin -> Q0Origin -> Q0Origin
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 :: Q0Origin -> Q0Origin -> Q0Origin
$cmin :: Q0Origin -> Q0Origin -> Q0Origin
max :: Q0Origin -> Q0Origin -> Q0Origin
$cmax :: Q0Origin -> Q0Origin -> Q0Origin
>= :: Q0Origin -> Q0Origin -> Bool
$c>= :: Q0Origin -> Q0Origin -> Bool
> :: Q0Origin -> Q0Origin -> Bool
$c> :: Q0Origin -> Q0Origin -> Bool
<= :: Q0Origin -> Q0Origin -> Bool
$c<= :: Q0Origin -> Q0Origin -> Bool
< :: Q0Origin -> Q0Origin -> Bool
$c< :: Q0Origin -> Q0Origin -> Bool
compare :: Q0Origin -> Q0Origin -> Ordering
$ccompare :: Q0Origin -> Q0Origin -> Ordering
$cp1Ord :: Eq Q0Origin
Ord)

-- | Origin of 'Quantity1'.
data Q1Origin
  = Q1Inferred       -- ^ User wrote nothing.
  | Q1       Range   -- ^ User wrote "@1".
  | Q1Linear Range   -- ^ User wrote "@linear".
  deriving (Typeable Q1Origin
DataType
Constr
Typeable Q1Origin
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Q1Origin -> c Q1Origin)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Q1Origin)
-> (Q1Origin -> Constr)
-> (Q1Origin -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Q1Origin))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Q1Origin))
-> ((forall b. Data b => b -> b) -> Q1Origin -> Q1Origin)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Q1Origin -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Q1Origin -> r)
-> (forall u. (forall d. Data d => d -> u) -> Q1Origin -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Q1Origin -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin)
-> Data Q1Origin
Q1Origin -> DataType
Q1Origin -> Constr
(forall b. Data b => b -> b) -> Q1Origin -> Q1Origin
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Q1Origin -> c Q1Origin
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Q1Origin
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) -> Q1Origin -> u
forall u. (forall d. Data d => d -> u) -> Q1Origin -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Q1Origin -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Q1Origin -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Q1Origin
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Q1Origin -> c Q1Origin
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Q1Origin)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Q1Origin)
$cQ1Linear :: Constr
$cQ1 :: Constr
$cQ1Inferred :: Constr
$tQ1Origin :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin
gmapMp :: (forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin
gmapM :: (forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Q1Origin -> m Q1Origin
gmapQi :: Int -> (forall d. Data d => d -> u) -> Q1Origin -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Q1Origin -> u
gmapQ :: (forall d. Data d => d -> u) -> Q1Origin -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Q1Origin -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Q1Origin -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Q1Origin -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Q1Origin -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Q1Origin -> r
gmapT :: (forall b. Data b => b -> b) -> Q1Origin -> Q1Origin
$cgmapT :: (forall b. Data b => b -> b) -> Q1Origin -> Q1Origin
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Q1Origin)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Q1Origin)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Q1Origin)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Q1Origin)
dataTypeOf :: Q1Origin -> DataType
$cdataTypeOf :: Q1Origin -> DataType
toConstr :: Q1Origin -> Constr
$ctoConstr :: Q1Origin -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Q1Origin
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Q1Origin
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Q1Origin -> c Q1Origin
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Q1Origin -> c Q1Origin
$cp1Data :: Typeable Q1Origin
Data, Int -> Q1Origin -> ShowS
[Q1Origin] -> ShowS
Q1Origin -> String
(Int -> Q1Origin -> ShowS)
-> (Q1Origin -> String) -> ([Q1Origin] -> ShowS) -> Show Q1Origin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Q1Origin] -> ShowS
$cshowList :: [Q1Origin] -> ShowS
show :: Q1Origin -> String
$cshow :: Q1Origin -> String
showsPrec :: Int -> Q1Origin -> ShowS
$cshowsPrec :: Int -> Q1Origin -> ShowS
Show, (forall x. Q1Origin -> Rep Q1Origin x)
-> (forall x. Rep Q1Origin x -> Q1Origin) -> Generic Q1Origin
forall x. Rep Q1Origin x -> Q1Origin
forall x. Q1Origin -> Rep Q1Origin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Q1Origin x -> Q1Origin
$cfrom :: forall x. Q1Origin -> Rep Q1Origin x
Generic, Q1Origin -> Q1Origin -> Bool
(Q1Origin -> Q1Origin -> Bool)
-> (Q1Origin -> Q1Origin -> Bool) -> Eq Q1Origin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Q1Origin -> Q1Origin -> Bool
$c/= :: Q1Origin -> Q1Origin -> Bool
== :: Q1Origin -> Q1Origin -> Bool
$c== :: Q1Origin -> Q1Origin -> Bool
Eq, Eq Q1Origin
Eq Q1Origin
-> (Q1Origin -> Q1Origin -> Ordering)
-> (Q1Origin -> Q1Origin -> Bool)
-> (Q1Origin -> Q1Origin -> Bool)
-> (Q1Origin -> Q1Origin -> Bool)
-> (Q1Origin -> Q1Origin -> Bool)
-> (Q1Origin -> Q1Origin -> Q1Origin)
-> (Q1Origin -> Q1Origin -> Q1Origin)
-> Ord Q1Origin
Q1Origin -> Q1Origin -> Bool
Q1Origin -> Q1Origin -> Ordering
Q1Origin -> Q1Origin -> Q1Origin
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 :: Q1Origin -> Q1Origin -> Q1Origin
$cmin :: Q1Origin -> Q1Origin -> Q1Origin
max :: Q1Origin -> Q1Origin -> Q1Origin
$cmax :: Q1Origin -> Q1Origin -> Q1Origin
>= :: Q1Origin -> Q1Origin -> Bool
$c>= :: Q1Origin -> Q1Origin -> Bool
> :: Q1Origin -> Q1Origin -> Bool
$c> :: Q1Origin -> Q1Origin -> Bool
<= :: Q1Origin -> Q1Origin -> Bool
$c<= :: Q1Origin -> Q1Origin -> Bool
< :: Q1Origin -> Q1Origin -> Bool
$c< :: Q1Origin -> Q1Origin -> Bool
compare :: Q1Origin -> Q1Origin -> Ordering
$ccompare :: Q1Origin -> Q1Origin -> Ordering
$cp1Ord :: Eq Q1Origin
Ord)

-- | Origin of 'Quantityω'.
data QωOrigin
  = QωInferred       -- ^ User wrote nothing.
  |        Range   -- ^ User wrote "@ω".
  | QωPlenty Range   -- ^ User wrote "@plenty".
  deriving (Typeable QωOrigin
DataType
Constr
Typeable QωOrigin
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> QωOrigin -> c QωOrigin)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c QωOrigin)
-> (QωOrigin -> Constr)
-> (QωOrigin -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c QωOrigin))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QωOrigin))
-> ((forall b. Data b => b -> b) -> QωOrigin -> QωOrigin)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> QωOrigin -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> QωOrigin -> r)
-> (forall u. (forall d. Data d => d -> u) -> QωOrigin -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> QωOrigin -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin)
-> Data QωOrigin
QωOrigin -> DataType
QωOrigin -> Constr
(forall b. Data b => b -> b) -> QωOrigin -> QωOrigin
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QωOrigin -> c QωOrigin
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QωOrigin
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) -> QωOrigin -> u
forall u. (forall d. Data d => d -> u) -> QωOrigin -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> QωOrigin -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> QωOrigin -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QωOrigin
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QωOrigin -> c QωOrigin
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c QωOrigin)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QωOrigin)
$cQωPlenty :: Constr
$cQω :: Constr
$cQωInferred :: Constr
$tQωOrigin :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin
gmapMp :: (forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin
gmapM :: (forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> QωOrigin -> m QωOrigin
gmapQi :: Int -> (forall d. Data d => d -> u) -> QωOrigin -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> QωOrigin -> u
gmapQ :: (forall d. Data d => d -> u) -> QωOrigin -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> QωOrigin -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> QωOrigin -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> QωOrigin -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> QωOrigin -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> QωOrigin -> r
gmapT :: (forall b. Data b => b -> b) -> QωOrigin -> QωOrigin
$cgmapT :: (forall b. Data b => b -> b) -> QωOrigin -> QωOrigin
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QωOrigin)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QωOrigin)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c QωOrigin)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c QωOrigin)
dataTypeOf :: QωOrigin -> DataType
$cdataTypeOf :: QωOrigin -> DataType
toConstr :: QωOrigin -> Constr
$ctoConstr :: QωOrigin -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QωOrigin
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QωOrigin
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QωOrigin -> c QωOrigin
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QωOrigin -> c QωOrigin
$cp1Data :: Typeable QωOrigin
Data, Int -> QωOrigin -> ShowS
[QωOrigin] -> ShowS
QωOrigin -> String
(Int -> QωOrigin -> ShowS)
-> (QωOrigin -> String) -> ([QωOrigin] -> ShowS) -> Show QωOrigin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QωOrigin] -> ShowS
$cshowList :: [QωOrigin] -> ShowS
show :: QωOrigin -> String
$cshow :: QωOrigin -> String
showsPrec :: Int -> QωOrigin -> ShowS
$cshowsPrec :: Int -> QωOrigin -> ShowS
Show, (forall x. QωOrigin -> Rep QωOrigin x)
-> (forall x. Rep QωOrigin x -> QωOrigin) -> Generic QωOrigin
forall x. Rep QωOrigin x -> QωOrigin
forall x. QωOrigin -> Rep QωOrigin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QωOrigin x -> QωOrigin
$cfrom :: forall x. QωOrigin -> Rep QωOrigin x
Generic, QωOrigin -> QωOrigin -> Bool
(QωOrigin -> QωOrigin -> Bool)
-> (QωOrigin -> QωOrigin -> Bool) -> Eq QωOrigin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QωOrigin -> QωOrigin -> Bool
$c/= :: QωOrigin -> QωOrigin -> Bool
== :: QωOrigin -> QωOrigin -> Bool
$c== :: QωOrigin -> QωOrigin -> Bool
Eq, Eq QωOrigin
Eq QωOrigin
-> (QωOrigin -> QωOrigin -> Ordering)
-> (QωOrigin -> QωOrigin -> Bool)
-> (QωOrigin -> QωOrigin -> Bool)
-> (QωOrigin -> QωOrigin -> Bool)
-> (QωOrigin -> QωOrigin -> Bool)
-> (QωOrigin -> QωOrigin -> QωOrigin)
-> (QωOrigin -> QωOrigin -> QωOrigin)
-> Ord QωOrigin
QωOrigin -> QωOrigin -> Bool
QωOrigin -> QωOrigin -> Ordering
QωOrigin -> QωOrigin -> QωOrigin
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 :: QωOrigin -> QωOrigin -> QωOrigin
$cmin :: QωOrigin -> QωOrigin -> QωOrigin
max :: QωOrigin -> QωOrigin -> QωOrigin
$cmax :: QωOrigin -> QωOrigin -> QωOrigin
>= :: QωOrigin -> QωOrigin -> Bool
$c>= :: QωOrigin -> QωOrigin -> Bool
> :: QωOrigin -> QωOrigin -> Bool
$c> :: QωOrigin -> QωOrigin -> Bool
<= :: QωOrigin -> QωOrigin -> Bool
$c<= :: QωOrigin -> QωOrigin -> Bool
< :: QωOrigin -> QωOrigin -> Bool
$c< :: QωOrigin -> QωOrigin -> Bool
compare :: QωOrigin -> QωOrigin -> Ordering
$ccompare :: QωOrigin -> QωOrigin -> Ordering
$cp1Ord :: Eq QωOrigin
Ord)

-- *** Instances for 'Q0Origin'.

-- | Right-biased composition, because the left quantity
--   acts as context, and the right one as occurrence.
instance Semigroup Q0Origin where
  <> :: Q0Origin -> Q0Origin -> Q0Origin
(<>) = ((Q0Origin, Q0Origin) -> Q0Origin)
-> Q0Origin -> Q0Origin -> Q0Origin
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((Q0Origin, Q0Origin) -> Q0Origin)
 -> Q0Origin -> Q0Origin -> Q0Origin)
-> ((Q0Origin, Q0Origin) -> Q0Origin)
-> Q0Origin
-> Q0Origin
-> Q0Origin
forall a b. (a -> b) -> a -> b
$ \case
    (Q0Origin
Q0Inferred, Q0Origin
o) -> Q0Origin
o
    (Q0Origin
o, Q0Origin
Q0Inferred) -> Q0Origin
o
    (Q0Origin
o, Q0       Range
r) -> Range -> Q0Origin
Q0 (Range -> Q0Origin) -> Range -> Q0Origin
forall a b. (a -> b) -> a -> b
$ Q0Origin -> Range -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange Q0Origin
o Range
r
    (Q0Origin
o, Q0Erased Range
r) -> Range -> Q0Origin
Q0 (Range -> Q0Origin) -> Range -> Q0Origin
forall a b. (a -> b) -> a -> b
$ Q0Origin -> Range -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange Q0Origin
o Range
r

instance Monoid Q0Origin where
  mempty :: Q0Origin
mempty = Q0Origin
Q0Inferred
  mappend :: Q0Origin -> Q0Origin -> Q0Origin
mappend = Q0Origin -> Q0Origin -> Q0Origin
forall a. Semigroup a => a -> a -> a
(<>)

instance Null Q0Origin where
  empty :: Q0Origin
empty = Q0Origin
forall a. Monoid a => a
mempty

instance HasRange Q0Origin where
  getRange :: Q0Origin -> Range
getRange = \case
    Q0Origin
Q0Inferred -> Range
forall a. Range' a
noRange
    Q0       Range
r -> Range
r
    Q0Erased Range
r -> Range
r

instance SetRange Q0Origin where
  setRange :: Range -> Q0Origin -> Q0Origin
setRange Range
r = \case
    Q0Origin
Q0Inferred -> Q0Origin
Q0Inferred
    Q0       Range
_ -> Range -> Q0Origin
Q0       Range
r
    Q0Erased Range
_ -> Range -> Q0Origin
Q0Erased Range
r

instance KillRange Q0Origin where
  killRange :: Q0Origin -> Q0Origin
killRange = \case
    Q0Origin
Q0Inferred -> Q0Origin
Q0Inferred
    Q0       Range
_ -> Range -> Q0Origin
Q0       Range
forall a. Range' a
noRange
    Q0Erased Range
_ -> Range -> Q0Origin
Q0Erased Range
forall a. Range' a
noRange

instance NFData Q0Origin where
  rnf :: Q0Origin -> ()
rnf = \case
    Q0Origin
Q0Inferred -> ()
    Q0       Range
_ -> ()
    Q0Erased Range
_ -> ()

-- *** Instances for 'Q1Origin'.

-- | Right-biased composition, because the left quantity
--   acts as context, and the right one as occurrence.
instance Semigroup Q1Origin where
  <> :: Q1Origin -> Q1Origin -> Q1Origin
(<>) = ((Q1Origin, Q1Origin) -> Q1Origin)
-> Q1Origin -> Q1Origin -> Q1Origin
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((Q1Origin, Q1Origin) -> Q1Origin)
 -> Q1Origin -> Q1Origin -> Q1Origin)
-> ((Q1Origin, Q1Origin) -> Q1Origin)
-> Q1Origin
-> Q1Origin
-> Q1Origin
forall a b. (a -> b) -> a -> b
$ \case
    (Q1Origin
Q1Inferred, Q1Origin
o) -> Q1Origin
o
    (Q1Origin
o, Q1Origin
Q1Inferred) -> Q1Origin
o
    (Q1Origin
o, Q1       Range
r) -> Range -> Q1Origin
Q1 (Range -> Q1Origin) -> Range -> Q1Origin
forall a b. (a -> b) -> a -> b
$ Q1Origin -> Range -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange Q1Origin
o Range
r
    (Q1Origin
o, Q1Linear Range
r) -> Range -> Q1Origin
Q1 (Range -> Q1Origin) -> Range -> Q1Origin
forall a b. (a -> b) -> a -> b
$ Q1Origin -> Range -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange Q1Origin
o Range
r

instance Monoid Q1Origin where
  mempty :: Q1Origin
mempty = Q1Origin
Q1Inferred
  mappend :: Q1Origin -> Q1Origin -> Q1Origin
mappend = Q1Origin -> Q1Origin -> Q1Origin
forall a. Semigroup a => a -> a -> a
(<>)

instance Null Q1Origin where
  empty :: Q1Origin
empty = Q1Origin
forall a. Monoid a => a
mempty

instance HasRange Q1Origin where
  getRange :: Q1Origin -> Range
getRange = \case
    Q1Origin
Q1Inferred -> Range
forall a. Range' a
noRange
    Q1       Range
r -> Range
r
    Q1Linear Range
r -> Range
r

instance SetRange Q1Origin where
  setRange :: Range -> Q1Origin -> Q1Origin
setRange Range
r = \case
    Q1Origin
Q1Inferred -> Q1Origin
Q1Inferred
    Q1       Range
_ -> Range -> Q1Origin
Q1       Range
r
    Q1Linear Range
_ -> Range -> Q1Origin
Q1Linear Range
r

instance KillRange Q1Origin where
  killRange :: Q1Origin -> Q1Origin
killRange = \case
    Q1Origin
Q1Inferred -> Q1Origin
Q1Inferred
    Q1       Range
_ -> Range -> Q1Origin
Q1       Range
forall a. Range' a
noRange
    Q1Linear Range
_ -> Range -> Q1Origin
Q1Linear Range
forall a. Range' a
noRange

instance NFData Q1Origin where
  rnf :: Q1Origin -> ()
rnf = \case
    Q1Origin
Q1Inferred -> ()
    Q1       Range
_ -> ()
    Q1Linear Range
_ -> ()

-- *** Instances for 'QωOrigin'.

-- | Right-biased composition, because the left quantity
--   acts as context, and the right one as occurrence.
instance Semigroup QωOrigin where
  <> :: QωOrigin -> QωOrigin -> QωOrigin
(<>) = ((QωOrigin, QωOrigin) -> QωOrigin)
-> QωOrigin -> QωOrigin -> QωOrigin
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((QωOrigin, QωOrigin) -> QωOrigin)
 -> QωOrigin -> QωOrigin -> QωOrigin)
-> ((QωOrigin, QωOrigin) -> QωOrigin)
-> QωOrigin
-> QωOrigin
-> QωOrigin
forall a b. (a -> b) -> a -> b
$ \case
    (QωOrigin
QωInferred, QωOrigin
o) -> QωOrigin
o
    (QωOrigin
o, QωOrigin
QωInferred) -> QωOrigin
o
    (QωOrigin
o,        Range
r) -> Range -> QωOrigin
 (Range -> QωOrigin) -> Range -> QωOrigin
forall a b. (a -> b) -> a -> b
$ QωOrigin -> Range -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange QωOrigin
o Range
r
    (QωOrigin
o, QωPlenty Range
r) -> Range -> QωOrigin
 (Range -> QωOrigin) -> Range -> QωOrigin
forall a b. (a -> b) -> a -> b
$ QωOrigin -> Range -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange QωOrigin
o Range
r

instance Monoid QωOrigin where
  mempty :: QωOrigin
mempty = QωOrigin
QωInferred
  mappend :: QωOrigin -> QωOrigin -> QωOrigin
mappend = QωOrigin -> QωOrigin -> QωOrigin
forall a. Semigroup a => a -> a -> a
(<>)

instance Null QωOrigin where
  empty :: QωOrigin
empty = QωOrigin
forall a. Monoid a => a
mempty

instance HasRange QωOrigin where
  getRange :: QωOrigin -> Range
getRange = \case
    QωOrigin
QωInferred -> Range
forall a. Range' a
noRange
           Range
r -> Range
r
    QωPlenty Range
r -> Range
r

instance SetRange QωOrigin where
  setRange :: Range -> QωOrigin -> QωOrigin
setRange Range
r = \case
    QωOrigin
QωInferred -> QωOrigin
QωInferred
           Range
_ -> Range -> QωOrigin
       Range
r
    QωPlenty Range
_ -> Range -> QωOrigin
QωPlenty Range
r

instance KillRange QωOrigin where
  killRange :: QωOrigin -> QωOrigin
killRange = \case
    QωOrigin
QωInferred -> QωOrigin
QωInferred
           Range
_ -> Range -> QωOrigin
       Range
forall a. Range' a
noRange
    QωPlenty Range
_ -> Range -> QωOrigin
QωPlenty Range
forall a. Range' a
noRange

instance NFData QωOrigin where
  rnf :: QωOrigin -> ()
rnf = \case
    QωOrigin
QωInferred -> ()
           Range
_ -> ()
    QωPlenty Range
_ -> ()

-- ** Quantity.

-- | Quantity for linearity.
--
--   A quantity is a set of natural numbers, indicating possible semantic
--   uses of a variable.  A singleton set @{n}@ requires that the
--   corresponding variable is used exactly @n@ times.
--
data Quantity
  = Quantity0 Q0Origin -- ^ Zero uses @{0}@, erased at runtime.
  | Quantity1 Q1Origin -- ^ Linear use @{1}@ (could be updated destructively).
    -- Mostly TODO (needs postponable constraints between quantities to compute uses).
  | Quantityω QωOrigin -- ^ Unrestricted use @ℕ@.
  deriving (Typeable Quantity
DataType
Constr
Typeable Quantity
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Quantity -> c Quantity)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Quantity)
-> (Quantity -> Constr)
-> (Quantity -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Quantity))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Quantity))
-> ((forall b. Data b => b -> b) -> Quantity -> Quantity)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Quantity -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Quantity -> r)
-> (forall u. (forall d. Data d => d -> u) -> Quantity -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Quantity -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Quantity -> m Quantity)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Quantity -> m Quantity)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Quantity -> m Quantity)
-> Data Quantity
Quantity -> DataType
Quantity -> Constr
(forall b. Data b => b -> b) -> Quantity -> Quantity
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Quantity -> c Quantity
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Quantity
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) -> Quantity -> u
forall u. (forall d. Data d => d -> u) -> Quantity -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Quantity -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Quantity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Quantity -> m Quantity
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Quantity -> m Quantity
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Quantity
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Quantity -> c Quantity
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Quantity)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Quantity)
$cQuantityω :: Constr
$cQuantity1 :: Constr
$cQuantity0 :: Constr
$tQuantity :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Quantity -> m Quantity
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Quantity -> m Quantity
gmapMp :: (forall d. Data d => d -> m d) -> Quantity -> m Quantity
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Quantity -> m Quantity
gmapM :: (forall d. Data d => d -> m d) -> Quantity -> m Quantity
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Quantity -> m Quantity
gmapQi :: Int -> (forall d. Data d => d -> u) -> Quantity -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Quantity -> u
gmapQ :: (forall d. Data d => d -> u) -> Quantity -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Quantity -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Quantity -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Quantity -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Quantity -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Quantity -> r
gmapT :: (forall b. Data b => b -> b) -> Quantity -> Quantity
$cgmapT :: (forall b. Data b => b -> b) -> Quantity -> Quantity
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Quantity)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Quantity)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Quantity)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Quantity)
dataTypeOf :: Quantity -> DataType
$cdataTypeOf :: Quantity -> DataType
toConstr :: Quantity -> Constr
$ctoConstr :: Quantity -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Quantity
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Quantity
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Quantity -> c Quantity
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Quantity -> c Quantity
$cp1Data :: Typeable Quantity
Data, Int -> Quantity -> ShowS
[Quantity] -> ShowS
Quantity -> String
(Int -> Quantity -> ShowS)
-> (Quantity -> String) -> ([Quantity] -> ShowS) -> Show Quantity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Quantity] -> ShowS
$cshowList :: [Quantity] -> ShowS
show :: Quantity -> String
$cshow :: Quantity -> String
showsPrec :: Int -> Quantity -> ShowS
$cshowsPrec :: Int -> Quantity -> ShowS
Show, (forall x. Quantity -> Rep Quantity x)
-> (forall x. Rep Quantity x -> Quantity) -> Generic Quantity
forall x. Rep Quantity x -> Quantity
forall x. Quantity -> Rep Quantity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Quantity x -> Quantity
$cfrom :: forall x. Quantity -> Rep Quantity x
Generic, Quantity -> Quantity -> Bool
(Quantity -> Quantity -> Bool)
-> (Quantity -> Quantity -> Bool) -> Eq Quantity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Quantity -> Quantity -> Bool
$c/= :: Quantity -> Quantity -> Bool
== :: Quantity -> Quantity -> Bool
$c== :: Quantity -> Quantity -> Bool
Eq, Eq Quantity
Eq Quantity
-> (Quantity -> Quantity -> Ordering)
-> (Quantity -> Quantity -> Bool)
-> (Quantity -> Quantity -> Bool)
-> (Quantity -> Quantity -> Bool)
-> (Quantity -> Quantity -> Bool)
-> (Quantity -> Quantity -> Quantity)
-> (Quantity -> Quantity -> Quantity)
-> Ord Quantity
Quantity -> Quantity -> Bool
Quantity -> Quantity -> Ordering
Quantity -> Quantity -> Quantity
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 :: Quantity -> Quantity -> Quantity
$cmin :: Quantity -> Quantity -> Quantity
max :: Quantity -> Quantity -> Quantity
$cmax :: Quantity -> Quantity -> Quantity
>= :: Quantity -> Quantity -> Bool
$c>= :: Quantity -> Quantity -> Bool
> :: Quantity -> Quantity -> Bool
$c> :: Quantity -> Quantity -> Bool
<= :: Quantity -> Quantity -> Bool
$c<= :: Quantity -> Quantity -> Bool
< :: Quantity -> Quantity -> Bool
$c< :: Quantity -> Quantity -> Bool
compare :: Quantity -> Quantity -> Ordering
$ccompare :: Quantity -> Quantity -> Ordering
$cp1Ord :: Eq Quantity
Ord)
    -- @Ord@ instance in case @Quantity@ is used in keys for maps etc.

-- | Equality ignoring origin.

sameQuantity :: Quantity -> Quantity -> Bool
sameQuantity :: Quantity -> Quantity -> Bool
sameQuantity = ((Quantity, Quantity) -> Bool) -> Quantity -> Quantity -> Bool
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((Quantity, Quantity) -> Bool) -> Quantity -> Quantity -> Bool)
-> ((Quantity, Quantity) -> Bool) -> Quantity -> Quantity -> Bool
forall a b. (a -> b) -> a -> b
$ \case
  (Quantity0{}, Quantity0{}) -> Bool
True
  (Quantity1{}, Quantity1{}) -> Bool
True
  (Quantityω{}, Quantityω{}) -> Bool
True
  (Quantity, Quantity)
_ -> Bool
False

-- | Composition of quantities (multiplication).
--
-- 'Quantity0' is dominant.
-- 'Quantity1' is neutral.
--
-- Right-biased for origin.
--
instance Semigroup (UnderComposition Quantity) where
  <> :: UnderComposition Quantity
-> UnderComposition Quantity -> UnderComposition Quantity
(<>) = (Quantity -> Quantity -> Quantity)
-> UnderComposition Quantity
-> UnderComposition Quantity
-> UnderComposition Quantity
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Quantity -> Quantity -> Quantity
composeQuantity

-- | In the absense of finite quantities besides 0, ω is the unit.
--   Otherwise, 1 is the unit.
instance Monoid (UnderComposition Quantity) where
  mempty :: UnderComposition Quantity
mempty  = Quantity -> UnderComposition Quantity
forall (f :: * -> *) a. Applicative f => a -> f a
pure Quantity
unitQuantity
  mappend :: UnderComposition Quantity
-> UnderComposition Quantity -> UnderComposition Quantity
mappend = UnderComposition Quantity
-> UnderComposition Quantity -> UnderComposition Quantity
forall a. Semigroup a => a -> a -> a
(<>)

instance POSemigroup (UnderComposition Quantity) where
instance POMonoid (UnderComposition Quantity) where

instance LeftClosedPOMonoid (UnderComposition Quantity) where
  inverseCompose :: UnderComposition Quantity
-> UnderComposition Quantity -> UnderComposition Quantity
inverseCompose = (Quantity -> Quantity -> Quantity)
-> UnderComposition Quantity
-> UnderComposition Quantity
-> UnderComposition Quantity
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Quantity -> Quantity -> Quantity
inverseComposeQuantity

instance Semigroup (UnderAddition Quantity) where
  <> :: UnderAddition Quantity
-> UnderAddition Quantity -> UnderAddition Quantity
(<>) = (Quantity -> Quantity -> Quantity)
-> UnderAddition Quantity
-> UnderAddition Quantity
-> UnderAddition Quantity
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Quantity -> Quantity -> Quantity
addQuantity

instance Monoid (UnderAddition Quantity) where
  mempty :: UnderAddition Quantity
mempty  = Quantity -> UnderAddition Quantity
forall (f :: * -> *) a. Applicative f => a -> f a
pure Quantity
zeroQuantity
  mappend :: UnderAddition Quantity
-> UnderAddition Quantity -> UnderAddition Quantity
mappend = UnderAddition Quantity
-> UnderAddition Quantity -> UnderAddition Quantity
forall a. Semigroup a => a -> a -> a
(<>)

instance POSemigroup (UnderAddition Quantity) where
instance POMonoid (UnderAddition Quantity) where

-- | Note that the order is @ω ≤ 0,1@, more options is smaller.
instance PartialOrd Quantity where
  comparable :: Comparable Quantity
comparable = ((Quantity, Quantity) -> PartialOrdering) -> Comparable Quantity
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((Quantity, Quantity) -> PartialOrdering) -> Comparable Quantity)
-> ((Quantity, Quantity) -> PartialOrdering) -> Comparable Quantity
forall a b. (a -> b) -> a -> b
$ \case
    (Quantity
q, Quantity
q') | Quantity -> Quantity -> Bool
sameQuantity Quantity
q Quantity
q' -> PartialOrdering
POEQ
    -- ω is least
    (Quantityω{}, Quantity
_)  -> PartialOrdering
POLT
    (Quantity
_, Quantityω{})  -> PartialOrdering
POGT
    -- others are uncomparable
    (Quantity, Quantity)
_ -> PartialOrdering
POAny

-- | 'Quantity' forms an additive monoid with zero Quantity0.
addQuantity :: Quantity -> Quantity -> Quantity
addQuantity :: Quantity -> Quantity -> Quantity
addQuantity = ((Quantity, Quantity) -> Quantity)
-> Quantity -> Quantity -> Quantity
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((Quantity, Quantity) -> Quantity)
 -> Quantity -> Quantity -> Quantity)
-> ((Quantity, Quantity) -> Quantity)
-> Quantity
-> Quantity
-> Quantity
forall a b. (a -> b) -> a -> b
$ \case
  -- ω is absorptive
  (q :: Quantity
q@Quantityω{}, Quantity
_) -> Quantity
q
  (Quantity
_, q :: Quantity
q@Quantityω{}) -> Quantity
q
  -- 0 is neutral
  (Quantity0{}, Quantity
q) -> Quantity
q
  (Quantity
q, Quantity0{}) -> Quantity
q
  -- 1 + 1 = ω
  (Quantity1 Q1Origin
_, Quantity1 Q1Origin
_) -> Quantity
topQuantity

-- | Identity element under addition
zeroQuantity :: Quantity
zeroQuantity :: Quantity
zeroQuantity = Q0Origin -> Quantity
Quantity0 Q0Origin
forall a. Monoid a => a
mempty

-- | Absorptive element!
--   This differs from Relevance and Cohesion whose default
--   is the multiplicative unit.
defaultQuantity :: Quantity
defaultQuantity :: Quantity
defaultQuantity = Quantity
topQuantity

-- | Identity element under composition
unitQuantity :: Quantity
unitQuantity :: Quantity
unitQuantity = QωOrigin -> Quantity
Quantityω QωOrigin
forall a. Monoid a => a
mempty

-- | Absorptive element is ω.
topQuantity :: Quantity
topQuantity :: Quantity
topQuantity = QωOrigin -> Quantity
Quantityω QωOrigin
forall a. Monoid a => a
mempty

-- | @m `moreUsableQuantity` m'@ means that an @m@ can be used
--   where ever an @m'@ is required.

moreQuantity :: Quantity -> Quantity -> Bool
moreQuantity :: Quantity -> Quantity -> Bool
moreQuantity Quantity
m Quantity
m' = Quantity -> PartialOrdering -> Quantity -> Bool
forall a. PartialOrd a => a -> PartialOrdering -> a -> Bool
related Quantity
m PartialOrdering
POLE Quantity
m'

-- | Composition of quantities (multiplication).
--
-- 'Quantity0' is dominant.
-- 'Quantity1' is neutral.
--
-- Right-biased for origin.
--
composeQuantity :: Quantity -> Quantity -> Quantity
composeQuantity :: Quantity -> Quantity -> Quantity
composeQuantity = ((Quantity, Quantity) -> Quantity)
-> Quantity -> Quantity -> Quantity
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((Quantity, Quantity) -> Quantity)
 -> Quantity -> Quantity -> Quantity)
-> ((Quantity, Quantity) -> Quantity)
-> Quantity
-> Quantity
-> Quantity
forall a b. (a -> b) -> a -> b
$ \case
  (Quantity1 Q1Origin
o, Quantity1 Q1Origin
o') -> Q1Origin -> Quantity
Quantity1 (Q1Origin
o Q1Origin -> Q1Origin -> Q1Origin
forall a. Semigroup a => a -> a -> a
<> Q1Origin
o')
  (Quantity1{}, Quantity
q           ) -> Quantity
q
  (Quantity
q          , Quantity1{} ) -> Quantity
q
  (Quantity0 Q0Origin
o, Quantity0 Q0Origin
o') -> Q0Origin -> Quantity
Quantity0 (Q0Origin
o Q0Origin -> Q0Origin -> Q0Origin
forall a. Semigroup a => a -> a -> a
<> Q0Origin
o')
  (Quantity
_          , Quantity0 Q0Origin
o ) -> Q0Origin -> Quantity
Quantity0 Q0Origin
o
  (Quantity0 Q0Origin
o, Quantity
_           ) -> Q0Origin -> Quantity
Quantity0 Q0Origin
o
  (Quantityω QωOrigin
o, Quantityω QωOrigin
o') -> QωOrigin -> Quantity
Quantityω (QωOrigin
o QωOrigin -> QωOrigin -> QωOrigin
forall a. Semigroup a => a -> a -> a
<> QωOrigin
o')

-- | Compose with quantity flag from the left.
--   This function is e.g. used to update the quantity information
--   on pattern variables @a@ after a match against something of quantity @q@.

applyQuantity :: LensQuantity a => Quantity -> a -> a
applyQuantity :: Quantity -> a -> a
applyQuantity Quantity
q = (Quantity -> Quantity) -> a -> a
forall a. LensQuantity a => (Quantity -> Quantity) -> a -> a
mapQuantity (Quantity
q Quantity -> Quantity -> Quantity
`composeQuantity`)

-- | @inverseComposeQuantity r x@ returns the least quantity @y@
--   such that forall @x@, @y@ we have
--   @x \`moreQuantity\` (r \`composeQuantity\` y)@
--   iff
--   @(r \`inverseComposeQuantity\` x) \`moreQuantity\` y@ (Galois connection).

inverseComposeQuantity :: Quantity -> Quantity -> Quantity
inverseComposeQuantity :: Quantity -> Quantity -> Quantity
inverseComposeQuantity = ((Quantity, Quantity) -> Quantity)
-> Quantity -> Quantity -> Quantity
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((Quantity, Quantity) -> Quantity)
 -> Quantity -> Quantity -> Quantity)
-> ((Quantity, Quantity) -> Quantity)
-> Quantity
-> Quantity
-> Quantity
forall a b. (a -> b) -> a -> b
$ \case
    (Quantity1{} , Quantity
x)              -> Quantity
x             -- going to linear arg: nothing changes
    (Quantity0{} , Quantity
x)              -> Quantity
topQuantity   -- going to erased arg: every thing usable
    (Quantityω{} , x :: Quantity
x@Quantityω{})  -> Quantity
x
    (Quantityω{} , Quantity
_)              -> Quantity
zeroQuantity  -- linear resources are unusable as arguments to unrestricted functions

-- | Left division by a 'Quantity'.
--   Used e.g. to modify context when going into a @q@ argument.

inverseApplyQuantity :: LensQuantity a => Quantity -> a -> a
inverseApplyQuantity :: Quantity -> a -> a
inverseApplyQuantity Quantity
q = (Quantity -> Quantity) -> a -> a
forall a. LensQuantity a => (Quantity -> Quantity) -> a -> a
mapQuantity (Quantity
q Quantity -> Quantity -> Quantity
`inverseComposeQuantity`)

-- | Check for 'Quantity0'.

hasQuantity0 :: LensQuantity a => a -> Bool
hasQuantity0 :: a -> Bool
hasQuantity0 a
a
  | Quantity0{} <- a -> Quantity
forall a. LensQuantity a => a -> Quantity
getQuantity a
a = Bool
True
  | Bool
otherwise = Bool
False

-- | Check for 'Quantity1'.

hasQuantity1 :: LensQuantity a => a -> Bool
hasQuantity1 :: a -> Bool
hasQuantity1 a
a
  | Quantity1{} <- a -> Quantity
forall a. LensQuantity a => a -> Quantity
getQuantity a
a = Bool
True
  | Bool
otherwise = Bool
False

-- | Check for 'Quantityω'.

hasQuantityω :: LensQuantity a => a -> Bool
hasQuantityω :: a -> Bool
hasQuantityω a
a
  | Quantityω{} <- a -> Quantity
forall a. LensQuantity a => a -> Quantity
getQuantity a
a = Bool
True
  | Bool
otherwise = Bool
False

-- | Did the user supply a quantity annotation?

noUserQuantity :: LensQuantity a => a -> Bool
noUserQuantity :: a -> Bool
noUserQuantity a
a = case a -> Quantity
forall a. LensQuantity a => a -> Quantity
getQuantity a
a of
  Quantity0 Q0Origin
o -> Q0Origin -> Bool
forall a. Null a => a -> Bool
null Q0Origin
o
  Quantity1 Q1Origin
o -> Q1Origin -> Bool
forall a. Null a => a -> Bool
null Q1Origin
o
  Quantityω QωOrigin
o -> QωOrigin -> Bool
forall a. Null a => a -> Bool
null QωOrigin
o

-- | A thing of quantity 0 is unusable, all others are usable.

usableQuantity :: LensQuantity a => a -> Bool
usableQuantity :: a -> Bool
usableQuantity = Bool -> Bool
not (Bool -> Bool) -> (a -> Bool) -> a -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Bool
forall a. LensQuantity a => a -> Bool
hasQuantity0

-- boilerplate instances

class LensQuantity a where

  getQuantity :: a -> Quantity

  setQuantity :: Quantity -> a -> a
  setQuantity = (Quantity -> Quantity) -> a -> a
forall a. LensQuantity a => (Quantity -> Quantity) -> a -> a
mapQuantity ((Quantity -> Quantity) -> a -> a)
-> (Quantity -> Quantity -> Quantity) -> Quantity -> a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Quantity -> Quantity -> Quantity
forall a b. a -> b -> a
const

  mapQuantity :: (Quantity -> Quantity) -> a -> a

  default getQuantity :: LensModality a => a -> Quantity
  getQuantity = Modality -> Quantity
modQuantity (Modality -> Quantity) -> (a -> Modality) -> a -> Quantity
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Modality
forall a. LensModality a => a -> Modality
getModality

  default mapQuantity :: LensModality a => (Quantity -> Quantity) -> a -> a
  mapQuantity Quantity -> Quantity
f = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality ((Modality -> Modality) -> a -> a)
-> (Modality -> Modality) -> a -> a
forall a b. (a -> b) -> a -> b
$ \ Modality
ai -> Modality
ai { modQuantity :: Quantity
modQuantity = Quantity -> Quantity
f (Quantity -> Quantity) -> Quantity -> Quantity
forall a b. (a -> b) -> a -> b
$ Modality -> Quantity
modQuantity Modality
ai }

instance LensQuantity Quantity where
  getQuantity :: Quantity -> Quantity
getQuantity = Quantity -> Quantity
forall a. a -> a
id
  setQuantity :: Quantity -> Quantity -> Quantity
setQuantity = Quantity -> Quantity -> Quantity
forall a b. a -> b -> a
const
  mapQuantity :: (Quantity -> Quantity) -> Quantity -> Quantity
mapQuantity = (Quantity -> Quantity) -> Quantity -> Quantity
forall a. a -> a
id

instance HasRange Quantity where
  getRange :: Quantity -> Range
getRange = \case
    Quantity0 Q0Origin
o -> Q0Origin -> Range
forall a. HasRange a => a -> Range
getRange Q0Origin
o
    Quantity1 Q1Origin
o -> Q1Origin -> Range
forall a. HasRange a => a -> Range
getRange Q1Origin
o
    Quantityω QωOrigin
o -> QωOrigin -> Range
forall a. HasRange a => a -> Range
getRange QωOrigin
o

instance SetRange Quantity where
  setRange :: Range -> Quantity -> Quantity
setRange Range
r = \case
    Quantity0 Q0Origin
o -> Q0Origin -> Quantity
Quantity0 (Q0Origin -> Quantity) -> Q0Origin -> Quantity
forall a b. (a -> b) -> a -> b
$ Range -> Q0Origin -> Q0Origin
forall a. SetRange a => Range -> a -> a
setRange Range
r Q0Origin
o
    Quantity1 Q1Origin
o -> Q1Origin -> Quantity
Quantity1 (Q1Origin -> Quantity) -> Q1Origin -> Quantity
forall a b. (a -> b) -> a -> b
$ Range -> Q1Origin -> Q1Origin
forall a. SetRange a => Range -> a -> a
setRange Range
r Q1Origin
o
    Quantityω QωOrigin
o -> QωOrigin -> Quantity
Quantityω (QωOrigin -> Quantity) -> QωOrigin -> Quantity
forall a b. (a -> b) -> a -> b
$ Range -> QωOrigin -> QωOrigin
forall a. SetRange a => Range -> a -> a
setRange Range
r QωOrigin
o

instance KillRange Quantity where
  killRange :: Quantity -> Quantity
killRange = \case
    Quantity0 Q0Origin
o -> Q0Origin -> Quantity
Quantity0 (Q0Origin -> Quantity) -> Q0Origin -> Quantity
forall a b. (a -> b) -> a -> b
$ Q0Origin -> Q0Origin
forall a. KillRange a => KillRangeT a
killRange Q0Origin
o
    Quantity1 Q1Origin
o -> Q1Origin -> Quantity
Quantity1 (Q1Origin -> Quantity) -> Q1Origin -> Quantity
forall a b. (a -> b) -> a -> b
$ Q1Origin -> Q1Origin
forall a. KillRange a => KillRangeT a
killRange Q1Origin
o
    Quantityω QωOrigin
o -> QωOrigin -> Quantity
Quantityω (QωOrigin -> Quantity) -> QωOrigin -> Quantity
forall a b. (a -> b) -> a -> b
$ QωOrigin -> QωOrigin
forall a. KillRange a => KillRangeT a
killRange QωOrigin
o

instance NFData Quantity where
  rnf :: Quantity -> ()
rnf (Quantity0 Q0Origin
o) = Q0Origin -> ()
forall a. NFData a => a -> ()
rnf Q0Origin
o
  rnf (Quantity1 Q1Origin
o) = Q1Origin -> ()
forall a. NFData a => a -> ()
rnf Q1Origin
o
  rnf (Quantityω QωOrigin
o) = QωOrigin -> ()
forall a. NFData a => a -> ()
rnf QωOrigin
o

-- ** Erased.

-- | A special case of 'Quantity': erased or not.

data Erased
  = Erased Q0Origin
  | NotErased QωOrigin
  deriving (Typeable Erased
DataType
Constr
Typeable Erased
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Erased -> c Erased)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Erased)
-> (Erased -> Constr)
-> (Erased -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Erased))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Erased))
-> ((forall b. Data b => b -> b) -> Erased -> Erased)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Erased -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Erased -> r)
-> (forall u. (forall d. Data d => d -> u) -> Erased -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Erased -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Erased -> m Erased)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Erased -> m Erased)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Erased -> m Erased)
-> Data Erased
Erased -> DataType
Erased -> Constr
(forall b. Data b => b -> b) -> Erased -> Erased
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Erased -> c Erased
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Erased
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) -> Erased -> u
forall u. (forall d. Data d => d -> u) -> Erased -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Erased -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Erased -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Erased -> m Erased
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Erased -> m Erased
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Erased
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Erased -> c Erased
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Erased)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Erased)
$cNotErased :: Constr
$cErased :: Constr
$tErased :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Erased -> m Erased
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Erased -> m Erased
gmapMp :: (forall d. Data d => d -> m d) -> Erased -> m Erased
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Erased -> m Erased
gmapM :: (forall d. Data d => d -> m d) -> Erased -> m Erased
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Erased -> m Erased
gmapQi :: Int -> (forall d. Data d => d -> u) -> Erased -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Erased -> u
gmapQ :: (forall d. Data d => d -> u) -> Erased -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Erased -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Erased -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Erased -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Erased -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Erased -> r
gmapT :: (forall b. Data b => b -> b) -> Erased -> Erased
$cgmapT :: (forall b. Data b => b -> b) -> Erased -> Erased
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Erased)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Erased)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Erased)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Erased)
dataTypeOf :: Erased -> DataType
$cdataTypeOf :: Erased -> DataType
toConstr :: Erased -> Constr
$ctoConstr :: Erased -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Erased
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Erased
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Erased -> c Erased
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Erased -> c Erased
$cp1Data :: Typeable Erased
Data, Int -> Erased -> ShowS
[Erased] -> ShowS
Erased -> String
(Int -> Erased -> ShowS)
-> (Erased -> String) -> ([Erased] -> ShowS) -> Show Erased
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Erased] -> ShowS
$cshowList :: [Erased] -> ShowS
show :: Erased -> String
$cshow :: Erased -> String
showsPrec :: Int -> Erased -> ShowS
$cshowsPrec :: Int -> Erased -> ShowS
Show, Erased -> Erased -> Bool
(Erased -> Erased -> Bool)
-> (Erased -> Erased -> Bool) -> Eq Erased
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Erased -> Erased -> Bool
$c/= :: Erased -> Erased -> Bool
== :: Erased -> Erased -> Bool
$c== :: Erased -> Erased -> Bool
Eq, (forall x. Erased -> Rep Erased x)
-> (forall x. Rep Erased x -> Erased) -> Generic Erased
forall x. Rep Erased x -> Erased
forall x. Erased -> Rep Erased x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Erased x -> Erased
$cfrom :: forall x. Erased -> Rep Erased x
Generic)

-- | The default value of type 'Erased': not erased.

defaultErased :: Erased
defaultErased :: Erased
defaultErased = QωOrigin -> Erased
NotErased QωOrigin
QωInferred

-- | 'Erased' can be embedded into 'Quantity'.

asQuantity :: Erased -> Quantity
asQuantity :: Erased -> Quantity
asQuantity (Erased    Q0Origin
o) = Q0Origin -> Quantity
Quantity0 Q0Origin
o
asQuantity (NotErased QωOrigin
o) = QωOrigin -> Quantity
Quantityω QωOrigin
o

-- | 'Quantity' can be projected onto 'Erased'.

erasedFromQuantity :: Quantity -> Maybe Erased
erasedFromQuantity :: Quantity -> Maybe Erased
erasedFromQuantity = \case
  Quantity1{} -> Maybe Erased
forall a. Maybe a
Nothing
  Quantity0 Q0Origin
o -> Erased -> Maybe Erased
forall a. a -> Maybe a
Just (Erased -> Maybe Erased) -> Erased -> Maybe Erased
forall a b. (a -> b) -> a -> b
$ Q0Origin -> Erased
Erased    Q0Origin
o
  Quantityω QωOrigin
o -> Erased -> Maybe Erased
forall a. a -> Maybe a
Just (Erased -> Maybe Erased) -> Erased -> Maybe Erased
forall a b. (a -> b) -> a -> b
$ QωOrigin -> Erased
NotErased QωOrigin
o

-- | Equality ignoring origin.

sameErased :: Erased -> Erased -> Bool
sameErased :: Erased -> Erased -> Bool
sameErased = Quantity -> Quantity -> Bool
sameQuantity (Quantity -> Quantity -> Bool)
-> (Erased -> Quantity) -> Erased -> Erased -> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` Erased -> Quantity
asQuantity

-- | Is the value \"erased\"?

isErased :: Erased -> Bool
isErased :: Erased -> Bool
isErased = Quantity -> Bool
forall a. LensQuantity a => a -> Bool
hasQuantity0 (Quantity -> Bool) -> (Erased -> Quantity) -> Erased -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Erased -> Quantity
asQuantity

instance NFData Erased

instance HasRange Erased where
  getRange :: Erased -> Range
getRange = Quantity -> Range
forall a. HasRange a => a -> Range
getRange (Quantity -> Range) -> (Erased -> Quantity) -> Erased -> Range
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Erased -> Quantity
asQuantity

instance KillRange Erased where
  killRange :: Erased -> Erased
killRange = \case
    Erased Q0Origin
o    -> Q0Origin -> Erased
Erased (Q0Origin -> Erased) -> Q0Origin -> Erased
forall a b. (a -> b) -> a -> b
$ Q0Origin -> Q0Origin
forall a. KillRange a => KillRangeT a
killRange Q0Origin
o
    NotErased QωOrigin
o -> QωOrigin -> Erased
NotErased (QωOrigin -> Erased) -> QωOrigin -> Erased
forall a b. (a -> b) -> a -> b
$ QωOrigin -> QωOrigin
forall a. KillRange a => KillRangeT a
killRange QωOrigin
o

-- | Composition of values of type 'Erased'.
--
-- 'Erased' is dominant.
-- 'NotErased' is neutral.
--
-- Right-biased for the origin.

composeErased :: Erased -> Erased -> Erased
composeErased :: Erased -> Erased -> Erased
composeErased = ((Erased, Erased) -> Erased) -> Erased -> Erased -> Erased
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((Erased, Erased) -> Erased) -> Erased -> Erased -> Erased)
-> ((Erased, Erased) -> Erased) -> Erased -> Erased -> Erased
forall a b. (a -> b) -> a -> b
$ \case
  (Erased Q0Origin
o,    Erased Q0Origin
o')    -> Q0Origin -> Erased
Erased (Q0Origin
o Q0Origin -> Q0Origin -> Q0Origin
forall a. Semigroup a => a -> a -> a
<> Q0Origin
o')
  (NotErased QωOrigin
_, Erased Q0Origin
o)     -> Q0Origin -> Erased
Erased Q0Origin
o
  (Erased Q0Origin
o,    NotErased QωOrigin
_)  -> Q0Origin -> Erased
Erased Q0Origin
o
  (NotErased QωOrigin
o, NotErased QωOrigin
o') -> QωOrigin -> Erased
NotErased (QωOrigin
o QωOrigin -> QωOrigin -> QωOrigin
forall a. Semigroup a => a -> a -> a
<> QωOrigin
o')

instance Semigroup (UnderComposition Erased) where
  <> :: UnderComposition Erased
-> UnderComposition Erased -> UnderComposition Erased
(<>) = (Erased -> Erased -> Erased)
-> UnderComposition Erased
-> UnderComposition Erased
-> UnderComposition Erased
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Erased -> Erased -> Erased
composeErased

---------------------------------------------------------------------------
-- * Relevance
---------------------------------------------------------------------------

-- | A function argument can be relevant or irrelevant.
--   See "Agda.TypeChecking.Irrelevance".
data Relevance
  = Relevant    -- ^ The argument is (possibly) relevant at compile-time.
  | NonStrict   -- ^ The argument may never flow into evaluation position.
                --   Therefore, it is irrelevant at run-time.
                --   It is treated relevantly during equality checking.
  | Irrelevant  -- ^ The argument is irrelevant at compile- and runtime.
    deriving (Typeable Relevance
DataType
Constr
Typeable Relevance
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Relevance -> c Relevance)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Relevance)
-> (Relevance -> Constr)
-> (Relevance -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Relevance))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Relevance))
-> ((forall b. Data b => b -> b) -> Relevance -> Relevance)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Relevance -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Relevance -> r)
-> (forall u. (forall d. Data d => d -> u) -> Relevance -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Relevance -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Relevance -> m Relevance)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Relevance -> m Relevance)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Relevance -> m Relevance)
-> Data Relevance
Relevance -> DataType
Relevance -> Constr
(forall b. Data b => b -> b) -> Relevance -> Relevance
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Relevance -> c Relevance
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Relevance
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) -> Relevance -> u
forall u. (forall d. Data d => d -> u) -> Relevance -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Relevance -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Relevance -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Relevance -> m Relevance
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Relevance -> m Relevance
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Relevance
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Relevance -> c Relevance
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Relevance)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Relevance)
$cIrrelevant :: Constr
$cNonStrict :: Constr
$cRelevant :: Constr
$tRelevance :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Relevance -> m Relevance
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Relevance -> m Relevance
gmapMp :: (forall d. Data d => d -> m d) -> Relevance -> m Relevance
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Relevance -> m Relevance
gmapM :: (forall d. Data d => d -> m d) -> Relevance -> m Relevance
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Relevance -> m Relevance
gmapQi :: Int -> (forall d. Data d => d -> u) -> Relevance -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Relevance -> u
gmapQ :: (forall d. Data d => d -> u) -> Relevance -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Relevance -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Relevance -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Relevance -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Relevance -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Relevance -> r
gmapT :: (forall b. Data b => b -> b) -> Relevance -> Relevance
$cgmapT :: (forall b. Data b => b -> b) -> Relevance -> Relevance
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Relevance)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Relevance)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Relevance)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Relevance)
dataTypeOf :: Relevance -> DataType
$cdataTypeOf :: Relevance -> DataType
toConstr :: Relevance -> Constr
$ctoConstr :: Relevance -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Relevance
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Relevance
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Relevance -> c Relevance
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Relevance -> c Relevance
$cp1Data :: Typeable Relevance
Data, Int -> Relevance -> ShowS
[Relevance] -> ShowS
Relevance -> String
(Int -> Relevance -> ShowS)
-> (Relevance -> String)
-> ([Relevance] -> ShowS)
-> Show Relevance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Relevance] -> ShowS
$cshowList :: [Relevance] -> ShowS
show :: Relevance -> String
$cshow :: Relevance -> String
showsPrec :: Int -> Relevance -> ShowS
$cshowsPrec :: Int -> Relevance -> ShowS
Show, Relevance -> Relevance -> Bool
(Relevance -> Relevance -> Bool)
-> (Relevance -> Relevance -> Bool) -> Eq Relevance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Relevance -> Relevance -> Bool
$c/= :: Relevance -> Relevance -> Bool
== :: Relevance -> Relevance -> Bool
$c== :: Relevance -> Relevance -> Bool
Eq, Int -> Relevance
Relevance -> Int
Relevance -> [Relevance]
Relevance -> Relevance
Relevance -> Relevance -> [Relevance]
Relevance -> Relevance -> Relevance -> [Relevance]
(Relevance -> Relevance)
-> (Relevance -> Relevance)
-> (Int -> Relevance)
-> (Relevance -> Int)
-> (Relevance -> [Relevance])
-> (Relevance -> Relevance -> [Relevance])
-> (Relevance -> Relevance -> [Relevance])
-> (Relevance -> Relevance -> Relevance -> [Relevance])
-> Enum Relevance
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Relevance -> Relevance -> Relevance -> [Relevance]
$cenumFromThenTo :: Relevance -> Relevance -> Relevance -> [Relevance]
enumFromTo :: Relevance -> Relevance -> [Relevance]
$cenumFromTo :: Relevance -> Relevance -> [Relevance]
enumFromThen :: Relevance -> Relevance -> [Relevance]
$cenumFromThen :: Relevance -> Relevance -> [Relevance]
enumFrom :: Relevance -> [Relevance]
$cenumFrom :: Relevance -> [Relevance]
fromEnum :: Relevance -> Int
$cfromEnum :: Relevance -> Int
toEnum :: Int -> Relevance
$ctoEnum :: Int -> Relevance
pred :: Relevance -> Relevance
$cpred :: Relevance -> Relevance
succ :: Relevance -> Relevance
$csucc :: Relevance -> Relevance
Enum, Relevance
Relevance -> Relevance -> Bounded Relevance
forall a. a -> a -> Bounded a
maxBound :: Relevance
$cmaxBound :: Relevance
minBound :: Relevance
$cminBound :: Relevance
Bounded, (forall x. Relevance -> Rep Relevance x)
-> (forall x. Rep Relevance x -> Relevance) -> Generic Relevance
forall x. Rep Relevance x -> Relevance
forall x. Relevance -> Rep Relevance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Relevance x -> Relevance
$cfrom :: forall x. Relevance -> Rep Relevance x
Generic)

allRelevances :: [Relevance]
allRelevances :: [Relevance]
allRelevances = [Relevance
forall a. Bounded a => a
minBound..Relevance
forall a. Bounded a => a
maxBound]

instance HasRange Relevance where
  getRange :: Relevance -> Range
getRange Relevance
_ = Range
forall a. Range' a
noRange

instance SetRange Relevance where
  setRange :: Range -> Relevance -> Relevance
setRange Range
_ = Relevance -> Relevance
forall a. a -> a
id

instance KillRange Relevance where
  killRange :: Relevance -> Relevance
killRange Relevance
rel = Relevance
rel -- no range to kill

instance NFData Relevance where
  rnf :: Relevance -> ()
rnf Relevance
Relevant   = ()
  rnf Relevance
NonStrict  = ()
  rnf Relevance
Irrelevant = ()

-- | A lens to access the 'Relevance' attribute in data structures.
--   Minimal implementation: @getRelevance@ and @mapRelevance@ or @LensModality@.
class LensRelevance a where

  getRelevance :: a -> Relevance

  setRelevance :: Relevance -> a -> a
  setRelevance Relevance
h = (Relevance -> Relevance) -> a -> a
forall a. LensRelevance a => (Relevance -> Relevance) -> a -> a
mapRelevance (Relevance -> Relevance -> Relevance
forall a b. a -> b -> a
const Relevance
h)

  mapRelevance :: (Relevance -> Relevance) -> a -> a

  default getRelevance :: LensModality a => a -> Relevance
  getRelevance = Modality -> Relevance
modRelevance (Modality -> Relevance) -> (a -> Modality) -> a -> Relevance
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Modality
forall a. LensModality a => a -> Modality
getModality

  default mapRelevance :: LensModality a => (Relevance -> Relevance) -> a -> a
  mapRelevance Relevance -> Relevance
f = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality ((Modality -> Modality) -> a -> a)
-> (Modality -> Modality) -> a -> a
forall a b. (a -> b) -> a -> b
$ \ Modality
ai -> Modality
ai { modRelevance :: Relevance
modRelevance = Relevance -> Relevance
f (Relevance -> Relevance) -> Relevance -> Relevance
forall a b. (a -> b) -> a -> b
$ Modality -> Relevance
modRelevance Modality
ai }

instance LensRelevance Relevance where
  getRelevance :: Relevance -> Relevance
getRelevance = Relevance -> Relevance
forall a. a -> a
id
  setRelevance :: Relevance -> Relevance -> Relevance
setRelevance = Relevance -> Relevance -> Relevance
forall a b. a -> b -> a
const
  mapRelevance :: (Relevance -> Relevance) -> Relevance -> Relevance
mapRelevance = (Relevance -> Relevance) -> Relevance -> Relevance
forall a. a -> a
id

isRelevant :: LensRelevance a => a -> Bool
isRelevant :: a -> Bool
isRelevant a
a = a -> Relevance
forall a. LensRelevance a => a -> Relevance
getRelevance a
a Relevance -> Relevance -> Bool
forall a. Eq a => a -> a -> Bool
== Relevance
Relevant

isIrrelevant :: LensRelevance a => a -> Bool
isIrrelevant :: a -> Bool
isIrrelevant a
a = a -> Relevance
forall a. LensRelevance a => a -> Relevance
getRelevance a
a Relevance -> Relevance -> Bool
forall a. Eq a => a -> a -> Bool
== Relevance
Irrelevant

isNonStrict :: LensRelevance a => a -> Bool
isNonStrict :: a -> Bool
isNonStrict a
a = a -> Relevance
forall a. LensRelevance a => a -> Relevance
getRelevance a
a Relevance -> Relevance -> Bool
forall a. Eq a => a -> a -> Bool
== Relevance
NonStrict

-- | Information ordering.
-- @Relevant  \`moreRelevant\`
--  NonStrict \`moreRelevant\`
--  Irrelevant@
moreRelevant :: Relevance -> Relevance -> Bool
moreRelevant :: Relevance -> Relevance -> Bool
moreRelevant = Relevance -> Relevance -> Bool
forall a. Ord a => a -> a -> Bool
(<=)

-- | Equality ignoring origin.
sameRelevance :: Relevance -> Relevance -> Bool
sameRelevance :: Relevance -> Relevance -> Bool
sameRelevance = Relevance -> Relevance -> Bool
forall a. Eq a => a -> a -> Bool
(==)

-- | More relevant is smaller.
instance Ord Relevance where
  compare :: Relevance -> Relevance -> Ordering
compare = ((Relevance, Relevance) -> Ordering)
-> Relevance -> Relevance -> Ordering
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((Relevance, Relevance) -> Ordering)
 -> Relevance -> Relevance -> Ordering)
-> ((Relevance, Relevance) -> Ordering)
-> Relevance
-> Relevance
-> Ordering
forall a b. (a -> b) -> a -> b
$ \case
    (Relevance
r, Relevance
r') | Relevance
r Relevance -> Relevance -> Bool
forall a. Eq a => a -> a -> Bool
== Relevance
r' -> Ordering
EQ
    -- top
    (Relevance
_, Relevance
Irrelevant) -> Ordering
LT
    (Relevance
Irrelevant, Relevance
_) -> Ordering
GT
    -- bottom
    (Relevance
Relevant, Relevance
_) -> Ordering
LT
    (Relevance
_, Relevance
Relevant) -> Ordering
GT
    -- redundant case
    (Relevance
NonStrict,Relevance
NonStrict) -> Ordering
EQ

-- | More relevant is smaller.
instance PartialOrd Relevance where
  comparable :: Comparable Relevance
comparable = Comparable Relevance
forall a. Ord a => Comparable a
comparableOrd

-- | @usableRelevance rel == False@ iff we cannot use a variable of @rel@.
usableRelevance :: LensRelevance a => a -> Bool
usableRelevance :: a -> Bool
usableRelevance = a -> Bool
forall a. LensRelevance a => a -> Bool
isRelevant

-- | 'Relevance' composition.
--   'Irrelevant' is dominant, 'Relevant' is neutral.
--   Composition coincides with 'max'.
composeRelevance :: Relevance -> Relevance -> Relevance
composeRelevance :: Relevance -> Relevance -> Relevance
composeRelevance Relevance
r Relevance
r' =
  case (Relevance
r, Relevance
r') of
    (Relevance
Irrelevant, Relevance
_) -> Relevance
Irrelevant
    (Relevance
_, Relevance
Irrelevant) -> Relevance
Irrelevant
    (Relevance
NonStrict, Relevance
_)  -> Relevance
NonStrict
    (Relevance
_, Relevance
NonStrict)  -> Relevance
NonStrict
    (Relevance
Relevant, Relevance
Relevant) -> Relevance
Relevant

-- | Compose with relevance flag from the left.
--   This function is e.g. used to update the relevance information
--   on pattern variables @a@ after a match against something @rel@.
applyRelevance :: LensRelevance a => Relevance -> a -> a
applyRelevance :: Relevance -> a -> a
applyRelevance Relevance
rel = (Relevance -> Relevance) -> a -> a
forall a. LensRelevance a => (Relevance -> Relevance) -> a -> a
mapRelevance (Relevance
rel Relevance -> Relevance -> Relevance
`composeRelevance`)

-- | @inverseComposeRelevance r x@ returns the most irrelevant @y@
--   such that forall @x@, @y@ we have
--   @x \`moreRelevant\` (r \`composeRelevance\` y)@
--   iff
--   @(r \`inverseComposeRelevance\` x) \`moreRelevant\` y@ (Galois connection).
inverseComposeRelevance :: Relevance -> Relevance -> Relevance
inverseComposeRelevance :: Relevance -> Relevance -> Relevance
inverseComposeRelevance Relevance
r Relevance
x =
  case (Relevance
r, Relevance
x) of
    (Relevance
Relevant  , Relevance
x)          -> Relevance
x          -- going to relevant arg.: nothing changes
                                           -- because Relevant is comp.-neutral
    (Relevance
Irrelevant, Relevance
x)          -> Relevance
Relevant   -- going irrelevant: every thing usable
    (Relevance
NonStrict , Relevance
Irrelevant) -> Relevance
Irrelevant -- otherwise: irrelevant things remain unusable
    (Relevance
NonStrict , Relevance
_)          -> Relevance
Relevant   -- but @NonStrict@s become usable

-- | Left division by a 'Relevance'.
--   Used e.g. to modify context when going into a @rel@ argument.
inverseApplyRelevance :: LensRelevance a => Relevance -> a -> a
inverseApplyRelevance :: Relevance -> a -> a
inverseApplyRelevance Relevance
rel = (Relevance -> Relevance) -> a -> a
forall a. LensRelevance a => (Relevance -> Relevance) -> a -> a
mapRelevance (Relevance
rel Relevance -> Relevance -> Relevance
`inverseComposeRelevance`)

-- | 'Relevance' forms a semigroup under composition.
instance Semigroup (UnderComposition Relevance) where
  <> :: UnderComposition Relevance
-> UnderComposition Relevance -> UnderComposition Relevance
(<>) = (Relevance -> Relevance -> Relevance)
-> UnderComposition Relevance
-> UnderComposition Relevance
-> UnderComposition Relevance
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Relevance -> Relevance -> Relevance
composeRelevance

-- | 'Relevant' is the unit under composition.
instance Monoid (UnderComposition Relevance) where
  mempty :: UnderComposition Relevance
mempty  = Relevance -> UnderComposition Relevance
forall (f :: * -> *) a. Applicative f => a -> f a
pure Relevance
unitRelevance
  mappend :: UnderComposition Relevance
-> UnderComposition Relevance -> UnderComposition Relevance
mappend = UnderComposition Relevance
-> UnderComposition Relevance -> UnderComposition Relevance
forall a. Semigroup a => a -> a -> a
(<>)

instance POSemigroup (UnderComposition Relevance) where
instance POMonoid (UnderComposition Relevance) where

instance LeftClosedPOMonoid (UnderComposition Relevance) where
  inverseCompose :: UnderComposition Relevance
-> UnderComposition Relevance -> UnderComposition Relevance
inverseCompose = (Relevance -> Relevance -> Relevance)
-> UnderComposition Relevance
-> UnderComposition Relevance
-> UnderComposition Relevance
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Relevance -> Relevance -> Relevance
inverseComposeRelevance

instance Semigroup (UnderAddition Relevance) where
  <> :: UnderAddition Relevance
-> UnderAddition Relevance -> UnderAddition Relevance
(<>) = (Relevance -> Relevance -> Relevance)
-> UnderAddition Relevance
-> UnderAddition Relevance
-> UnderAddition Relevance
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Relevance -> Relevance -> Relevance
addRelevance

instance Monoid (UnderAddition Relevance) where
  mempty :: UnderAddition Relevance
mempty  = Relevance -> UnderAddition Relevance
forall (f :: * -> *) a. Applicative f => a -> f a
pure Relevance
zeroRelevance
  mappend :: UnderAddition Relevance
-> UnderAddition Relevance -> UnderAddition Relevance
mappend = UnderAddition Relevance
-> UnderAddition Relevance -> UnderAddition Relevance
forall a. Semigroup a => a -> a -> a
(<>)

instance POSemigroup (UnderAddition Relevance) where
instance POMonoid (UnderAddition Relevance) where

-- | Combine inferred 'Relevance'.
--   The unit is 'Irrelevant'.
addRelevance :: Relevance -> Relevance -> Relevance
addRelevance :: Relevance -> Relevance -> Relevance
addRelevance = Relevance -> Relevance -> Relevance
forall a. Ord a => a -> a -> a
min

-- | 'Relevance' forms a monoid under addition, and even a semiring.
zeroRelevance :: Relevance
zeroRelevance :: Relevance
zeroRelevance = Relevance
Irrelevant

-- | Identity element under composition
unitRelevance :: Relevance
unitRelevance :: Relevance
unitRelevance = Relevance
Relevant

-- | Absorptive element under addition.
topRelevance :: Relevance
topRelevance :: Relevance
topRelevance = Relevance
Relevant

-- | Default Relevance is the identity element under composition
defaultRelevance :: Relevance
defaultRelevance :: Relevance
defaultRelevance = Relevance
unitRelevance

-- | Irrelevant function arguments may appear non-strictly in the codomain type.
irrToNonStrict :: Relevance -> Relevance
irrToNonStrict :: Relevance -> Relevance
irrToNonStrict Relevance
Irrelevant = Relevance
NonStrict
irrToNonStrict Relevance
rel        = Relevance
rel

-- | Applied when working on types (unless --experimental-irrelevance).
nonStrictToRel :: Relevance -> Relevance
nonStrictToRel :: Relevance -> Relevance
nonStrictToRel Relevance
NonStrict = Relevance
Relevant
nonStrictToRel Relevance
rel       = Relevance
rel

nonStrictToIrr :: Relevance -> Relevance
nonStrictToIrr :: Relevance -> Relevance
nonStrictToIrr Relevance
NonStrict = Relevance
Irrelevant
nonStrictToIrr Relevance
rel       = Relevance
rel


---------------------------------------------------------------------------
-- * Annotations
---------------------------------------------------------------------------

-- | We have a tuple of annotations, which might not be fully orthogonal.
data Annotation = Annotation
  { Annotation -> Lock
annLock :: Lock
    -- ^ Fitch-style dependent right adjoints.
    --   See Modal Dependent Type Theory and Dependent Right Adjoints, arXiv:1804.05236.
  } deriving (Typeable Annotation
DataType
Constr
Typeable Annotation
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Annotation -> c Annotation)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Annotation)
-> (Annotation -> Constr)
-> (Annotation -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Annotation))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c Annotation))
-> ((forall b. Data b => b -> b) -> Annotation -> Annotation)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Annotation -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Annotation -> r)
-> (forall u. (forall d. Data d => d -> u) -> Annotation -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Annotation -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Annotation -> m Annotation)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Annotation -> m Annotation)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Annotation -> m Annotation)
-> Data Annotation
Annotation -> DataType
Annotation -> Constr
(forall b. Data b => b -> b) -> Annotation -> Annotation
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Annotation -> c Annotation
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Annotation
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) -> Annotation -> u
forall u. (forall d. Data d => d -> u) -> Annotation -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Annotation -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Annotation -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Annotation -> m Annotation
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Annotation -> m Annotation
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Annotation
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Annotation -> c Annotation
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Annotation)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Annotation)
$cAnnotation :: Constr
$tAnnotation :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Annotation -> m Annotation
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Annotation -> m Annotation
gmapMp :: (forall d. Data d => d -> m d) -> Annotation -> m Annotation
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Annotation -> m Annotation
gmapM :: (forall d. Data d => d -> m d) -> Annotation -> m Annotation
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Annotation -> m Annotation
gmapQi :: Int -> (forall d. Data d => d -> u) -> Annotation -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Annotation -> u
gmapQ :: (forall d. Data d => d -> u) -> Annotation -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Annotation -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Annotation -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Annotation -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Annotation -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Annotation -> r
gmapT :: (forall b. Data b => b -> b) -> Annotation -> Annotation
$cgmapT :: (forall b. Data b => b -> b) -> Annotation -> Annotation
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Annotation)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Annotation)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Annotation)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Annotation)
dataTypeOf :: Annotation -> DataType
$cdataTypeOf :: Annotation -> DataType
toConstr :: Annotation -> Constr
$ctoConstr :: Annotation -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Annotation
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Annotation
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Annotation -> c Annotation
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Annotation -> c Annotation
$cp1Data :: Typeable Annotation
Data, Annotation -> Annotation -> Bool
(Annotation -> Annotation -> Bool)
-> (Annotation -> Annotation -> Bool) -> Eq Annotation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Annotation -> Annotation -> Bool
$c/= :: Annotation -> Annotation -> Bool
== :: Annotation -> Annotation -> Bool
$c== :: Annotation -> Annotation -> Bool
Eq, Eq Annotation
Eq Annotation
-> (Annotation -> Annotation -> Ordering)
-> (Annotation -> Annotation -> Bool)
-> (Annotation -> Annotation -> Bool)
-> (Annotation -> Annotation -> Bool)
-> (Annotation -> Annotation -> Bool)
-> (Annotation -> Annotation -> Annotation)
-> (Annotation -> Annotation -> Annotation)
-> Ord Annotation
Annotation -> Annotation -> Bool
Annotation -> Annotation -> Ordering
Annotation -> Annotation -> Annotation
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 :: Annotation -> Annotation -> Annotation
$cmin :: Annotation -> Annotation -> Annotation
max :: Annotation -> Annotation -> Annotation
$cmax :: Annotation -> Annotation -> Annotation
>= :: Annotation -> Annotation -> Bool
$c>= :: Annotation -> Annotation -> Bool
> :: Annotation -> Annotation -> Bool
$c> :: Annotation -> Annotation -> Bool
<= :: Annotation -> Annotation -> Bool
$c<= :: Annotation -> Annotation -> Bool
< :: Annotation -> Annotation -> Bool
$c< :: Annotation -> Annotation -> Bool
compare :: Annotation -> Annotation -> Ordering
$ccompare :: Annotation -> Annotation -> Ordering
$cp1Ord :: Eq Annotation
Ord, Int -> Annotation -> ShowS
[Annotation] -> ShowS
Annotation -> String
(Int -> Annotation -> ShowS)
-> (Annotation -> String)
-> ([Annotation] -> ShowS)
-> Show Annotation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Annotation] -> ShowS
$cshowList :: [Annotation] -> ShowS
show :: Annotation -> String
$cshow :: Annotation -> String
showsPrec :: Int -> Annotation -> ShowS
$cshowsPrec :: Int -> Annotation -> ShowS
Show, (forall x. Annotation -> Rep Annotation x)
-> (forall x. Rep Annotation x -> Annotation) -> Generic Annotation
forall x. Rep Annotation x -> Annotation
forall x. Annotation -> Rep Annotation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Annotation x -> Annotation
$cfrom :: forall x. Annotation -> Rep Annotation x
Generic)

instance HasRange Annotation where
  getRange :: Annotation -> Range
getRange Annotation
_ = Range
forall a. Range' a
noRange

instance KillRange Annotation where
  killRange :: Annotation -> Annotation
killRange = Annotation -> Annotation
forall a. a -> a
id

defaultAnnotation :: Annotation
defaultAnnotation :: Annotation
defaultAnnotation = Lock -> Annotation
Annotation Lock
defaultLock

instance NFData Annotation where
  rnf :: Annotation -> ()
rnf (Annotation Lock
l) = Lock -> ()
forall a. NFData a => a -> ()
rnf Lock
l

class LensAnnotation a where

  getAnnotation :: a -> Annotation

  setAnnotation :: Annotation -> a -> a

  mapAnnotation :: (Annotation -> Annotation) -> a -> a
  mapAnnotation Annotation -> Annotation
f a
a = Annotation -> a -> a
forall a. LensAnnotation a => Annotation -> a -> a
setAnnotation (Annotation -> Annotation
f (Annotation -> Annotation) -> Annotation -> Annotation
forall a b. (a -> b) -> a -> b
$ a -> Annotation
forall a. LensAnnotation a => a -> Annotation
getAnnotation a
a) a
a

  default getAnnotation :: LensArgInfo a => a -> Annotation
  getAnnotation = ArgInfo -> Annotation
argInfoAnnotation (ArgInfo -> Annotation) -> (a -> ArgInfo) -> a -> Annotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo

  default setAnnotation :: LensArgInfo a => Annotation -> a -> a
  setAnnotation Annotation
a = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a) -> (ArgInfo -> ArgInfo) -> a -> a
forall a b. (a -> b) -> a -> b
$ \ ArgInfo
ai -> ArgInfo
ai { argInfoAnnotation :: Annotation
argInfoAnnotation = Annotation
a }

instance LensAnnotation Annotation where
  getAnnotation :: Annotation -> Annotation
getAnnotation = Annotation -> Annotation
forall a. a -> a
id
  setAnnotation :: Annotation -> Annotation -> Annotation
setAnnotation = Annotation -> Annotation -> Annotation
forall a b. a -> b -> a
const
  mapAnnotation :: (Annotation -> Annotation) -> Annotation -> Annotation
mapAnnotation = (Annotation -> Annotation) -> Annotation -> Annotation
forall a. a -> a
id

instance LensAnnotation (Arg t) where
  getAnnotation :: Arg t -> Annotation
getAnnotation = ArgInfo -> Annotation
forall a. LensAnnotation a => a -> Annotation
getAnnotation (ArgInfo -> Annotation)
-> (Arg t -> ArgInfo) -> Arg t -> Annotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Arg t -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo
  setAnnotation :: Annotation -> Arg t -> Arg t
setAnnotation = (ArgInfo -> ArgInfo) -> Arg t -> Arg t
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> Arg t -> Arg t)
-> (Annotation -> ArgInfo -> ArgInfo)
-> Annotation
-> Arg t
-> Arg t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Annotation -> ArgInfo -> ArgInfo
forall a. LensAnnotation a => Annotation -> a -> a
setAnnotation


---------------------------------------------------------------------------
-- * Locks
---------------------------------------------------------------------------

data Lock = IsNotLock
          | IsLock -- ^ In the future there might be different kinds of them.
                   --   For now we assume lock weakening.
  deriving (Typeable Lock
DataType
Constr
Typeable Lock
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Lock -> c Lock)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Lock)
-> (Lock -> Constr)
-> (Lock -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Lock))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Lock))
-> ((forall b. Data b => b -> b) -> Lock -> Lock)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Lock -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Lock -> r)
-> (forall u. (forall d. Data d => d -> u) -> Lock -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Lock -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Lock -> m Lock)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Lock -> m Lock)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Lock -> m Lock)
-> Data Lock
Lock -> DataType
Lock -> Constr
(forall b. Data b => b -> b) -> Lock -> Lock
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Lock -> c Lock
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Lock
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) -> Lock -> u
forall u. (forall d. Data d => d -> u) -> Lock -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Lock -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Lock -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Lock -> m Lock
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Lock -> m Lock
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Lock
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Lock -> c Lock
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Lock)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Lock)
$cIsLock :: Constr
$cIsNotLock :: Constr
$tLock :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Lock -> m Lock
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Lock -> m Lock
gmapMp :: (forall d. Data d => d -> m d) -> Lock -> m Lock
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Lock -> m Lock
gmapM :: (forall d. Data d => d -> m d) -> Lock -> m Lock
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Lock -> m Lock
gmapQi :: Int -> (forall d. Data d => d -> u) -> Lock -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Lock -> u
gmapQ :: (forall d. Data d => d -> u) -> Lock -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Lock -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Lock -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Lock -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Lock -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Lock -> r
gmapT :: (forall b. Data b => b -> b) -> Lock -> Lock
$cgmapT :: (forall b. Data b => b -> b) -> Lock -> Lock
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Lock)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Lock)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Lock)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Lock)
dataTypeOf :: Lock -> DataType
$cdataTypeOf :: Lock -> DataType
toConstr :: Lock -> Constr
$ctoConstr :: Lock -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Lock
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Lock
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Lock -> c Lock
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Lock -> c Lock
$cp1Data :: Typeable Lock
Data, Int -> Lock -> ShowS
[Lock] -> ShowS
Lock -> String
(Int -> Lock -> ShowS)
-> (Lock -> String) -> ([Lock] -> ShowS) -> Show Lock
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Lock] -> ShowS
$cshowList :: [Lock] -> ShowS
show :: Lock -> String
$cshow :: Lock -> String
showsPrec :: Int -> Lock -> ShowS
$cshowsPrec :: Int -> Lock -> ShowS
Show, (forall x. Lock -> Rep Lock x)
-> (forall x. Rep Lock x -> Lock) -> Generic Lock
forall x. Rep Lock x -> Lock
forall x. Lock -> Rep Lock x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Lock x -> Lock
$cfrom :: forall x. Lock -> Rep Lock x
Generic, Lock -> Lock -> Bool
(Lock -> Lock -> Bool) -> (Lock -> Lock -> Bool) -> Eq Lock
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Lock -> Lock -> Bool
$c/= :: Lock -> Lock -> Bool
== :: Lock -> Lock -> Bool
$c== :: Lock -> Lock -> Bool
Eq, Int -> Lock
Lock -> Int
Lock -> [Lock]
Lock -> Lock
Lock -> Lock -> [Lock]
Lock -> Lock -> Lock -> [Lock]
(Lock -> Lock)
-> (Lock -> Lock)
-> (Int -> Lock)
-> (Lock -> Int)
-> (Lock -> [Lock])
-> (Lock -> Lock -> [Lock])
-> (Lock -> Lock -> [Lock])
-> (Lock -> Lock -> Lock -> [Lock])
-> Enum Lock
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Lock -> Lock -> Lock -> [Lock]
$cenumFromThenTo :: Lock -> Lock -> Lock -> [Lock]
enumFromTo :: Lock -> Lock -> [Lock]
$cenumFromTo :: Lock -> Lock -> [Lock]
enumFromThen :: Lock -> Lock -> [Lock]
$cenumFromThen :: Lock -> Lock -> [Lock]
enumFrom :: Lock -> [Lock]
$cenumFrom :: Lock -> [Lock]
fromEnum :: Lock -> Int
$cfromEnum :: Lock -> Int
toEnum :: Int -> Lock
$ctoEnum :: Int -> Lock
pred :: Lock -> Lock
$cpred :: Lock -> Lock
succ :: Lock -> Lock
$csucc :: Lock -> Lock
Enum, Lock
Lock -> Lock -> Bounded Lock
forall a. a -> a -> Bounded a
maxBound :: Lock
$cmaxBound :: Lock
minBound :: Lock
$cminBound :: Lock
Bounded, Eq Lock
Eq Lock
-> (Lock -> Lock -> Ordering)
-> (Lock -> Lock -> Bool)
-> (Lock -> Lock -> Bool)
-> (Lock -> Lock -> Bool)
-> (Lock -> Lock -> Bool)
-> (Lock -> Lock -> Lock)
-> (Lock -> Lock -> Lock)
-> Ord Lock
Lock -> Lock -> Bool
Lock -> Lock -> Ordering
Lock -> Lock -> Lock
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 :: Lock -> Lock -> Lock
$cmin :: Lock -> Lock -> Lock
max :: Lock -> Lock -> Lock
$cmax :: Lock -> Lock -> Lock
>= :: Lock -> Lock -> Bool
$c>= :: Lock -> Lock -> Bool
> :: Lock -> Lock -> Bool
$c> :: Lock -> Lock -> Bool
<= :: Lock -> Lock -> Bool
$c<= :: Lock -> Lock -> Bool
< :: Lock -> Lock -> Bool
$c< :: Lock -> Lock -> Bool
compare :: Lock -> Lock -> Ordering
$ccompare :: Lock -> Lock -> Ordering
$cp1Ord :: Eq Lock
Ord)

defaultLock :: Lock
defaultLock :: Lock
defaultLock = Lock
IsNotLock

instance NFData Lock where
  rnf :: Lock -> ()
rnf Lock
IsNotLock = ()
  rnf Lock
IsLock    = ()

class LensLock a where

  getLock :: a -> Lock

  setLock :: Lock -> a -> a
  setLock = (Lock -> Lock) -> a -> a
forall a. LensLock a => (Lock -> Lock) -> a -> a
mapLock ((Lock -> Lock) -> a -> a)
-> (Lock -> Lock -> Lock) -> Lock -> a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Lock -> Lock -> Lock
forall a b. a -> b -> a
const

  mapLock :: (Lock -> Lock) -> a -> a
  mapLock Lock -> Lock
f a
a = Lock -> a -> a
forall a. LensLock a => Lock -> a -> a
setLock (Lock -> Lock
f (Lock -> Lock) -> Lock -> Lock
forall a b. (a -> b) -> a -> b
$ a -> Lock
forall a. LensLock a => a -> Lock
getLock a
a) a
a

instance LensLock Lock where
  getLock :: Lock -> Lock
getLock = Lock -> Lock
forall a. a -> a
id
  setLock :: Lock -> Lock -> Lock
setLock = Lock -> Lock -> Lock
forall a b. a -> b -> a
const
  mapLock :: (Lock -> Lock) -> Lock -> Lock
mapLock = (Lock -> Lock) -> Lock -> Lock
forall a. a -> a
id

instance LensLock ArgInfo where
  getLock :: ArgInfo -> Lock
getLock = Annotation -> Lock
annLock (Annotation -> Lock) -> (ArgInfo -> Annotation) -> ArgInfo -> Lock
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ArgInfo -> Annotation
argInfoAnnotation
  setLock :: Lock -> ArgInfo -> ArgInfo
setLock Lock
l ArgInfo
info = ArgInfo
info { argInfoAnnotation :: Annotation
argInfoAnnotation = Lock -> Annotation
Annotation Lock
l }

instance LensLock (Arg t) where
  getLock :: Arg t -> Lock
getLock = ArgInfo -> Lock
forall a. LensLock a => a -> Lock
getLock (ArgInfo -> Lock) -> (Arg t -> ArgInfo) -> Arg t -> Lock
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Arg t -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo
  setLock :: Lock -> Arg t -> Arg t
setLock = (ArgInfo -> ArgInfo) -> Arg t -> Arg t
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> Arg t -> Arg t)
-> (Lock -> ArgInfo -> ArgInfo) -> Lock -> Arg t -> Arg t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Lock -> ArgInfo -> ArgInfo
forall a. LensLock a => Lock -> a -> a
setLock

---------------------------------------------------------------------------
-- * Cohesion
---------------------------------------------------------------------------

-- | Cohesion modalities
--   see "Brouwer's fixed-point theorem in real-cohesive homotopy type theory" (arXiv:1509.07584)
--   types are now given an additional topological layer which the modalities interact with.
data Cohesion
  = Flat        -- ^ same points, discrete topology, idempotent comonad, box-like.
  | Continuous  -- ^ identity modality.
  -- | Sharp    -- ^ same points, codiscrete topology, idempotent monad, diamond-like.
  | Squash      -- ^ single point space, artificially added for Flat left-composition.
    deriving (Typeable Cohesion
DataType
Constr
Typeable Cohesion
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Cohesion -> c Cohesion)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Cohesion)
-> (Cohesion -> Constr)
-> (Cohesion -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Cohesion))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cohesion))
-> ((forall b. Data b => b -> b) -> Cohesion -> Cohesion)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Cohesion -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Cohesion -> r)
-> (forall u. (forall d. Data d => d -> u) -> Cohesion -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Cohesion -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Cohesion -> m Cohesion)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Cohesion -> m Cohesion)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Cohesion -> m Cohesion)
-> Data Cohesion
Cohesion -> DataType
Cohesion -> Constr
(forall b. Data b => b -> b) -> Cohesion -> Cohesion
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cohesion -> c Cohesion
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cohesion
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) -> Cohesion -> u
forall u. (forall d. Data d => d -> u) -> Cohesion -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Cohesion -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Cohesion -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Cohesion -> m Cohesion
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Cohesion -> m Cohesion
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cohesion
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cohesion -> c Cohesion
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Cohesion)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cohesion)
$cSquash :: Constr
$cContinuous :: Constr
$cFlat :: Constr
$tCohesion :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Cohesion -> m Cohesion
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Cohesion -> m Cohesion
gmapMp :: (forall d. Data d => d -> m d) -> Cohesion -> m Cohesion
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Cohesion -> m Cohesion
gmapM :: (forall d. Data d => d -> m d) -> Cohesion -> m Cohesion
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Cohesion -> m Cohesion
gmapQi :: Int -> (forall d. Data d => d -> u) -> Cohesion -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Cohesion -> u
gmapQ :: (forall d. Data d => d -> u) -> Cohesion -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Cohesion -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Cohesion -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Cohesion -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Cohesion -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Cohesion -> r
gmapT :: (forall b. Data b => b -> b) -> Cohesion -> Cohesion
$cgmapT :: (forall b. Data b => b -> b) -> Cohesion -> Cohesion
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cohesion)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cohesion)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Cohesion)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Cohesion)
dataTypeOf :: Cohesion -> DataType
$cdataTypeOf :: Cohesion -> DataType
toConstr :: Cohesion -> Constr
$ctoConstr :: Cohesion -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cohesion
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cohesion
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cohesion -> c Cohesion
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cohesion -> c Cohesion
$cp1Data :: Typeable Cohesion
Data, Int -> Cohesion -> ShowS
[Cohesion] -> ShowS
Cohesion -> String
(Int -> Cohesion -> ShowS)
-> (Cohesion -> String) -> ([Cohesion] -> ShowS) -> Show Cohesion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Cohesion] -> ShowS
$cshowList :: [Cohesion] -> ShowS
show :: Cohesion -> String
$cshow :: Cohesion -> String
showsPrec :: Int -> Cohesion -> ShowS
$cshowsPrec :: Int -> Cohesion -> ShowS
Show, Cohesion -> Cohesion -> Bool
(Cohesion -> Cohesion -> Bool)
-> (Cohesion -> Cohesion -> Bool) -> Eq Cohesion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Cohesion -> Cohesion -> Bool
$c/= :: Cohesion -> Cohesion -> Bool
== :: Cohesion -> Cohesion -> Bool
$c== :: Cohesion -> Cohesion -> Bool
Eq, Int -> Cohesion
Cohesion -> Int
Cohesion -> [Cohesion]
Cohesion -> Cohesion
Cohesion -> Cohesion -> [Cohesion]
Cohesion -> Cohesion -> Cohesion -> [Cohesion]
(Cohesion -> Cohesion)
-> (Cohesion -> Cohesion)
-> (Int -> Cohesion)
-> (Cohesion -> Int)
-> (Cohesion -> [Cohesion])
-> (Cohesion -> Cohesion -> [Cohesion])
-> (Cohesion -> Cohesion -> [Cohesion])
-> (Cohesion -> Cohesion -> Cohesion -> [Cohesion])
-> Enum Cohesion
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Cohesion -> Cohesion -> Cohesion -> [Cohesion]
$cenumFromThenTo :: Cohesion -> Cohesion -> Cohesion -> [Cohesion]
enumFromTo :: Cohesion -> Cohesion -> [Cohesion]
$cenumFromTo :: Cohesion -> Cohesion -> [Cohesion]
enumFromThen :: Cohesion -> Cohesion -> [Cohesion]
$cenumFromThen :: Cohesion -> Cohesion -> [Cohesion]
enumFrom :: Cohesion -> [Cohesion]
$cenumFrom :: Cohesion -> [Cohesion]
fromEnum :: Cohesion -> Int
$cfromEnum :: Cohesion -> Int
toEnum :: Int -> Cohesion
$ctoEnum :: Int -> Cohesion
pred :: Cohesion -> Cohesion
$cpred :: Cohesion -> Cohesion
succ :: Cohesion -> Cohesion
$csucc :: Cohesion -> Cohesion
Enum, Cohesion
Cohesion -> Cohesion -> Bounded Cohesion
forall a. a -> a -> Bounded a
maxBound :: Cohesion
$cmaxBound :: Cohesion
minBound :: Cohesion
$cminBound :: Cohesion
Bounded, (forall x. Cohesion -> Rep Cohesion x)
-> (forall x. Rep Cohesion x -> Cohesion) -> Generic Cohesion
forall x. Rep Cohesion x -> Cohesion
forall x. Cohesion -> Rep Cohesion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Cohesion x -> Cohesion
$cfrom :: forall x. Cohesion -> Rep Cohesion x
Generic)

allCohesions :: [Cohesion]
allCohesions :: [Cohesion]
allCohesions = [Cohesion
forall a. Bounded a => a
minBound..Cohesion
forall a. Bounded a => a
maxBound]

instance HasRange Cohesion where
  getRange :: Cohesion -> Range
getRange Cohesion
_ = Range
forall a. Range' a
noRange

instance SetRange Cohesion where
  setRange :: Range -> Cohesion -> Cohesion
setRange Range
_ = Cohesion -> Cohesion
forall a. a -> a
id

instance KillRange Cohesion where
  killRange :: Cohesion -> Cohesion
killRange Cohesion
rel = Cohesion
rel -- no range to kill

instance NFData Cohesion where
  rnf :: Cohesion -> ()
rnf Cohesion
Flat       = ()
  rnf Cohesion
Continuous = ()
  rnf Cohesion
Squash     = ()

-- | A lens to access the 'Cohesion' attribute in data structures.
--   Minimal implementation: @getCohesion@ and @mapCohesion@ or @LensModality@.
class LensCohesion a where

  getCohesion :: a -> Cohesion

  setCohesion :: Cohesion -> a -> a
  setCohesion Cohesion
h = (Cohesion -> Cohesion) -> a -> a
forall a. LensCohesion a => (Cohesion -> Cohesion) -> a -> a
mapCohesion (Cohesion -> Cohesion -> Cohesion
forall a b. a -> b -> a
const Cohesion
h)

  mapCohesion :: (Cohesion -> Cohesion) -> a -> a

  default getCohesion :: LensModality a => a -> Cohesion
  getCohesion = Modality -> Cohesion
modCohesion (Modality -> Cohesion) -> (a -> Modality) -> a -> Cohesion
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Modality
forall a. LensModality a => a -> Modality
getModality

  default mapCohesion :: LensModality a => (Cohesion -> Cohesion) -> a -> a
  mapCohesion Cohesion -> Cohesion
f = (Modality -> Modality) -> a -> a
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality ((Modality -> Modality) -> a -> a)
-> (Modality -> Modality) -> a -> a
forall a b. (a -> b) -> a -> b
$ \ Modality
ai -> Modality
ai { modCohesion :: Cohesion
modCohesion = Cohesion -> Cohesion
f (Cohesion -> Cohesion) -> Cohesion -> Cohesion
forall a b. (a -> b) -> a -> b
$ Modality -> Cohesion
modCohesion Modality
ai }

instance LensCohesion Cohesion where
  getCohesion :: Cohesion -> Cohesion
getCohesion = Cohesion -> Cohesion
forall a. a -> a
id
  setCohesion :: Cohesion -> Cohesion -> Cohesion
setCohesion = Cohesion -> Cohesion -> Cohesion
forall a b. a -> b -> a
const
  mapCohesion :: (Cohesion -> Cohesion) -> Cohesion -> Cohesion
mapCohesion = (Cohesion -> Cohesion) -> Cohesion -> Cohesion
forall a. a -> a
id

-- | Information ordering.
-- @Flat  \`moreCohesion\`
--  Continuous \`moreCohesion\`
--  Sharp \`moreCohesion\`
--  Squash@
moreCohesion :: Cohesion -> Cohesion -> Bool
moreCohesion :: Cohesion -> Cohesion -> Bool
moreCohesion = Cohesion -> Cohesion -> Bool
forall a. Ord a => a -> a -> Bool
(<=)

-- | Equality ignoring origin.
sameCohesion :: Cohesion -> Cohesion -> Bool
sameCohesion :: Cohesion -> Cohesion -> Bool
sameCohesion = Cohesion -> Cohesion -> Bool
forall a. Eq a => a -> a -> Bool
(==)

-- | Order is given by implication: flatter is smaller.
instance Ord Cohesion where
  compare :: Cohesion -> Cohesion -> Ordering
compare = ((Cohesion, Cohesion) -> Ordering)
-> Cohesion -> Cohesion -> Ordering
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (((Cohesion, Cohesion) -> Ordering)
 -> Cohesion -> Cohesion -> Ordering)
-> ((Cohesion, Cohesion) -> Ordering)
-> Cohesion
-> Cohesion
-> Ordering
forall a b. (a -> b) -> a -> b
$ \case
    (Cohesion
r, Cohesion
r') | Cohesion
r Cohesion -> Cohesion -> Bool
forall a. Eq a => a -> a -> Bool
== Cohesion
r' -> Ordering
EQ
    -- top
    (Cohesion
_, Cohesion
Squash) -> Ordering
LT
    (Cohesion
Squash, Cohesion
_) -> Ordering
GT
    -- bottom
    (Cohesion
Flat, Cohesion
_) -> Ordering
LT
    (Cohesion
_, Cohesion
Flat) -> Ordering
GT
    -- redundant case
    (Cohesion
Continuous,Cohesion
Continuous) -> Ordering
EQ

-- | Flatter is smaller.
instance PartialOrd Cohesion where
  comparable :: Comparable Cohesion
comparable = Comparable Cohesion
forall a. Ord a => Comparable a
comparableOrd

-- | @usableCohesion rel == False@ iff we cannot use a variable of @rel@.
usableCohesion :: LensCohesion a => a -> Bool
usableCohesion :: a -> Bool
usableCohesion a
a = a -> Cohesion
forall a. LensCohesion a => a -> Cohesion
getCohesion a
a Cohesion -> Cohesion -> Bool
`moreCohesion` Cohesion
Continuous

-- | 'Cohesion' composition.
--   'Squash' is dominant, 'Continuous' is neutral.
composeCohesion :: Cohesion -> Cohesion -> Cohesion
composeCohesion :: Cohesion -> Cohesion -> Cohesion
composeCohesion Cohesion
r Cohesion
r' =
  case (Cohesion
r, Cohesion
r') of
    (Cohesion
Squash, Cohesion
_) -> Cohesion
Squash
    (Cohesion
_, Cohesion
Squash) -> Cohesion
Squash
    (Cohesion
Flat, Cohesion
_)  -> Cohesion
Flat
    (Cohesion
_, Cohesion
Flat)  -> Cohesion
Flat
    (Cohesion
Continuous, Cohesion
Continuous) -> Cohesion
Continuous

-- | Compose with cohesion flag from the left.
--   This function is e.g. used to update the cohesion information
--   on pattern variables @a@ after a match against something of cohesion @rel@.
applyCohesion :: LensCohesion a => Cohesion -> a -> a
applyCohesion :: Cohesion -> a -> a
applyCohesion Cohesion
rel = (Cohesion -> Cohesion) -> a -> a
forall a. LensCohesion a => (Cohesion -> Cohesion) -> a -> a
mapCohesion (Cohesion
rel Cohesion -> Cohesion -> Cohesion
`composeCohesion`)

-- | @inverseComposeCohesion r x@ returns the least @y@
--   such that forall @x@, @y@ we have
--   @x \`moreCohesion\` (r \`composeCohesion\` y)@
--   iff
--   @(r \`inverseComposeCohesion\` x) \`moreCohesion\` y@ (Galois connection).
--   The above law fails for @r = Squash@.
inverseComposeCohesion :: Cohesion -> Cohesion -> Cohesion
inverseComposeCohesion :: Cohesion -> Cohesion -> Cohesion
inverseComposeCohesion Cohesion
r Cohesion
x =
  case (Cohesion
r, Cohesion
x) of
    (Cohesion
Continuous  , Cohesion
x) -> Cohesion
x          -- going to continous arg.: nothing changes
                                    -- because Continuous is comp.-neutral
    (Cohesion
Squash, Cohesion
x)       -> Cohesion
Squash     -- artificial case, should not be needed.
    (Cohesion
Flat , Cohesion
Flat)     -> Cohesion
Flat       -- otherwise: Flat things remain Flat
    (Cohesion
Flat , Cohesion
_)        -> Cohesion
Squash     -- but everything else becomes unusable.

-- | Left division by a 'Cohesion'.
--   Used e.g. to modify context when going into a @rel@ argument.
inverseApplyCohesion :: LensCohesion a => Cohesion -> a -> a
inverseApplyCohesion :: Cohesion -> a -> a
inverseApplyCohesion Cohesion
rel = (Cohesion -> Cohesion) -> a -> a
forall a. LensCohesion a => (Cohesion -> Cohesion) -> a -> a
mapCohesion (Cohesion
rel Cohesion -> Cohesion -> Cohesion
`inverseComposeCohesion`)

-- | 'Cohesion' forms a semigroup under composition.
instance Semigroup (UnderComposition Cohesion) where
  <> :: UnderComposition Cohesion
-> UnderComposition Cohesion -> UnderComposition Cohesion
(<>) = (Cohesion -> Cohesion -> Cohesion)
-> UnderComposition Cohesion
-> UnderComposition Cohesion
-> UnderComposition Cohesion
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Cohesion -> Cohesion -> Cohesion
composeCohesion

-- | 'Continous' is the multiplicative unit.
instance Monoid (UnderComposition Cohesion) where
  mempty :: UnderComposition Cohesion
mempty  = Cohesion -> UnderComposition Cohesion
forall (f :: * -> *) a. Applicative f => a -> f a
pure Cohesion
unitCohesion
  mappend :: UnderComposition Cohesion
-> UnderComposition Cohesion -> UnderComposition Cohesion
mappend = UnderComposition Cohesion
-> UnderComposition Cohesion -> UnderComposition Cohesion
forall a. Semigroup a => a -> a -> a
(<>)

instance POSemigroup (UnderComposition Cohesion) where
instance POMonoid (UnderComposition Cohesion) where

instance LeftClosedPOMonoid (UnderComposition Cohesion) where
  inverseCompose :: UnderComposition Cohesion
-> UnderComposition Cohesion -> UnderComposition Cohesion
inverseCompose = (Cohesion -> Cohesion -> Cohesion)
-> UnderComposition Cohesion
-> UnderComposition Cohesion
-> UnderComposition Cohesion
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Cohesion -> Cohesion -> Cohesion
inverseComposeCohesion

-- | 'Cohesion' forms a semigroup under addition.
instance Semigroup (UnderAddition Cohesion) where
  <> :: UnderAddition Cohesion
-> UnderAddition Cohesion -> UnderAddition Cohesion
(<>) = (Cohesion -> Cohesion -> Cohesion)
-> UnderAddition Cohesion
-> UnderAddition Cohesion
-> UnderAddition Cohesion
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Cohesion -> Cohesion -> Cohesion
addCohesion

-- | 'Squash' is the additive unit.
instance Monoid (UnderAddition Cohesion) where
  mempty :: UnderAddition Cohesion
mempty  = Cohesion -> UnderAddition Cohesion
forall (f :: * -> *) a. Applicative f => a -> f a
pure Cohesion
zeroCohesion
  mappend :: UnderAddition Cohesion
-> UnderAddition Cohesion -> UnderAddition Cohesion
mappend = UnderAddition Cohesion
-> UnderAddition Cohesion -> UnderAddition Cohesion
forall a. Semigroup a => a -> a -> a
(<>)

instance POSemigroup (UnderAddition Cohesion) where
instance POMonoid (UnderAddition Cohesion) where

-- | Combine inferred 'Cohesion'.
--   The unit is 'Squash'.
addCohesion :: Cohesion -> Cohesion -> Cohesion
addCohesion :: Cohesion -> Cohesion -> Cohesion
addCohesion = Cohesion -> Cohesion -> Cohesion
forall a. Ord a => a -> a -> a
min

-- | 'Cohesion' forms a monoid under addition, and even a semiring.
zeroCohesion :: Cohesion
zeroCohesion :: Cohesion
zeroCohesion = Cohesion
Squash

-- | Identity under composition
unitCohesion :: Cohesion
unitCohesion :: Cohesion
unitCohesion = Cohesion
Continuous

-- | Absorptive element under addition.
topCohesion :: Cohesion
topCohesion :: Cohesion
topCohesion = Cohesion
Flat

-- | Default Cohesion is the identity element under composition
defaultCohesion :: Cohesion
defaultCohesion :: Cohesion
defaultCohesion = Cohesion
unitCohesion

---------------------------------------------------------------------------
-- * Origin of arguments (user-written, inserted or reflected)
---------------------------------------------------------------------------

-- | Origin of arguments.
data Origin
  = UserWritten  -- ^ From the source file / user input.  (Preserve!)
  | Inserted     -- ^ E.g. inserted hidden arguments.
  | Reflected    -- ^ Produced by the reflection machinery.
  | CaseSplit    -- ^ Produced by an interactive case split.
  | Substitution -- ^ Named application produced to represent a substitution. E.g. "?0 (x = n)" instead of "?0 n"
  deriving (Typeable Origin
DataType
Constr
Typeable Origin
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Origin -> c Origin)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Origin)
-> (Origin -> Constr)
-> (Origin -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Origin))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Origin))
-> ((forall b. Data b => b -> b) -> Origin -> Origin)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Origin -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Origin -> r)
-> (forall u. (forall d. Data d => d -> u) -> Origin -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Origin -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Origin -> m Origin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Origin -> m Origin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Origin -> m Origin)
-> Data Origin
Origin -> DataType
Origin -> Constr
(forall b. Data b => b -> b) -> Origin -> Origin
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Origin -> c Origin
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Origin
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) -> Origin -> u
forall u. (forall d. Data d => d -> u) -> Origin -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Origin -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Origin -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Origin -> m Origin
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Origin -> m Origin
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Origin
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Origin -> c Origin
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Origin)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Origin)
$cSubstitution :: Constr
$cCaseSplit :: Constr
$cReflected :: Constr
$cInserted :: Constr
$cUserWritten :: Constr
$tOrigin :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Origin -> m Origin
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Origin -> m Origin
gmapMp :: (forall d. Data d => d -> m d) -> Origin -> m Origin
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Origin -> m Origin
gmapM :: (forall d. Data d => d -> m d) -> Origin -> m Origin
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Origin -> m Origin
gmapQi :: Int -> (forall d. Data d => d -> u) -> Origin -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Origin -> u
gmapQ :: (forall d. Data d => d -> u) -> Origin -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Origin -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Origin -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Origin -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Origin -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Origin -> r
gmapT :: (forall b. Data b => b -> b) -> Origin -> Origin
$cgmapT :: (forall b. Data b => b -> b) -> Origin -> Origin
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Origin)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Origin)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Origin)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Origin)
dataTypeOf :: Origin -> DataType
$cdataTypeOf :: Origin -> DataType
toConstr :: Origin -> Constr
$ctoConstr :: Origin -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Origin
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Origin
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Origin -> c Origin
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Origin -> c Origin
$cp1Data :: Typeable Origin
Data, Int -> Origin -> ShowS
[Origin] -> ShowS
Origin -> String
(Int -> Origin -> ShowS)
-> (Origin -> String) -> ([Origin] -> ShowS) -> Show Origin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Origin] -> ShowS
$cshowList :: [Origin] -> ShowS
show :: Origin -> String
$cshow :: Origin -> String
showsPrec :: Int -> Origin -> ShowS
$cshowsPrec :: Int -> Origin -> ShowS
Show, Origin -> Origin -> Bool
(Origin -> Origin -> Bool)
-> (Origin -> Origin -> Bool) -> Eq Origin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Origin -> Origin -> Bool
$c/= :: Origin -> Origin -> Bool
== :: Origin -> Origin -> Bool
$c== :: Origin -> Origin -> Bool
Eq, Eq Origin
Eq Origin
-> (Origin -> Origin -> Ordering)
-> (Origin -> Origin -> Bool)
-> (Origin -> Origin -> Bool)
-> (Origin -> Origin -> Bool)
-> (Origin -> Origin -> Bool)
-> (Origin -> Origin -> Origin)
-> (Origin -> Origin -> Origin)
-> Ord Origin
Origin -> Origin -> Bool
Origin -> Origin -> Ordering
Origin -> Origin -> Origin
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 :: Origin -> Origin -> Origin
$cmin :: Origin -> Origin -> Origin
max :: Origin -> Origin -> Origin
$cmax :: Origin -> Origin -> Origin
>= :: Origin -> Origin -> Bool
$c>= :: Origin -> Origin -> Bool
> :: Origin -> Origin -> Bool
$c> :: Origin -> Origin -> Bool
<= :: Origin -> Origin -> Bool
$c<= :: Origin -> Origin -> Bool
< :: Origin -> Origin -> Bool
$c< :: Origin -> Origin -> Bool
compare :: Origin -> Origin -> Ordering
$ccompare :: Origin -> Origin -> Ordering
$cp1Ord :: Eq Origin
Ord)

instance HasRange Origin where
  getRange :: Origin -> Range
getRange Origin
_ = Range
forall a. Range' a
noRange

instance KillRange Origin where
  killRange :: Origin -> Origin
killRange = Origin -> Origin
forall a. a -> a
id

instance NFData Origin where
  rnf :: Origin -> ()
rnf Origin
UserWritten = ()
  rnf Origin
Inserted = ()
  rnf Origin
Reflected = ()
  rnf Origin
CaseSplit = ()
  rnf Origin
Substitution = ()

-- | Decorating something with 'Origin' information.
data WithOrigin a = WithOrigin
  { WithOrigin a -> Origin
woOrigin :: !Origin
  , WithOrigin a -> a
woThing  :: a
  }
  deriving (Typeable (WithOrigin a)
DataType
Constr
Typeable (WithOrigin a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> WithOrigin a -> c (WithOrigin a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (WithOrigin a))
-> (WithOrigin a -> Constr)
-> (WithOrigin a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (WithOrigin a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (WithOrigin a)))
-> ((forall b. Data b => b -> b) -> WithOrigin a -> WithOrigin a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> WithOrigin a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> WithOrigin a -> r)
-> (forall u. (forall d. Data d => d -> u) -> WithOrigin a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> WithOrigin a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a))
-> Data (WithOrigin a)
WithOrigin a -> DataType
WithOrigin a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (WithOrigin a))
(forall b. Data b => b -> b) -> WithOrigin a -> WithOrigin a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WithOrigin a -> c (WithOrigin a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WithOrigin a)
forall a. Data a => Typeable (WithOrigin a)
forall a. Data a => WithOrigin a -> DataType
forall a. Data a => WithOrigin a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> WithOrigin a -> WithOrigin a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> WithOrigin a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> WithOrigin a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WithOrigin a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WithOrigin a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WithOrigin a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WithOrigin a -> c (WithOrigin a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (WithOrigin a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WithOrigin a))
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) -> WithOrigin a -> u
forall u. (forall d. Data d => d -> u) -> WithOrigin a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WithOrigin a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WithOrigin a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WithOrigin a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WithOrigin a -> c (WithOrigin a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (WithOrigin a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WithOrigin a))
$cWithOrigin :: Constr
$tWithOrigin :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a)
gmapMp :: (forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a)
gmapM :: (forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> WithOrigin a -> m (WithOrigin a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> WithOrigin a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> WithOrigin a -> u
gmapQ :: (forall d. Data d => d -> u) -> WithOrigin a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> WithOrigin a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WithOrigin a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WithOrigin a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WithOrigin a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WithOrigin a -> r
gmapT :: (forall b. Data b => b -> b) -> WithOrigin a -> WithOrigin a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> WithOrigin a -> WithOrigin a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WithOrigin a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WithOrigin a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (WithOrigin a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (WithOrigin a))
dataTypeOf :: WithOrigin a -> DataType
$cdataTypeOf :: forall a. Data a => WithOrigin a -> DataType
toConstr :: WithOrigin a -> Constr
$ctoConstr :: forall a. Data a => WithOrigin a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WithOrigin a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WithOrigin a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WithOrigin a -> c (WithOrigin a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WithOrigin a -> c (WithOrigin a)
$cp1Data :: forall a. Data a => Typeable (WithOrigin a)
Data, WithOrigin a -> WithOrigin a -> Bool
(WithOrigin a -> WithOrigin a -> Bool)
-> (WithOrigin a -> WithOrigin a -> Bool) -> Eq (WithOrigin a)
forall a. Eq a => WithOrigin a -> WithOrigin a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WithOrigin a -> WithOrigin a -> Bool
$c/= :: forall a. Eq a => WithOrigin a -> WithOrigin a -> Bool
== :: WithOrigin a -> WithOrigin a -> Bool
$c== :: forall a. Eq a => WithOrigin a -> WithOrigin a -> Bool
Eq, Eq (WithOrigin a)
Eq (WithOrigin a)
-> (WithOrigin a -> WithOrigin a -> Ordering)
-> (WithOrigin a -> WithOrigin a -> Bool)
-> (WithOrigin a -> WithOrigin a -> Bool)
-> (WithOrigin a -> WithOrigin a -> Bool)
-> (WithOrigin a -> WithOrigin a -> Bool)
-> (WithOrigin a -> WithOrigin a -> WithOrigin a)
-> (WithOrigin a -> WithOrigin a -> WithOrigin a)
-> Ord (WithOrigin a)
WithOrigin a -> WithOrigin a -> Bool
WithOrigin a -> WithOrigin a -> Ordering
WithOrigin a -> WithOrigin a -> WithOrigin a
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
forall a. Ord a => Eq (WithOrigin a)
forall a. Ord a => WithOrigin a -> WithOrigin a -> Bool
forall a. Ord a => WithOrigin a -> WithOrigin a -> Ordering
forall a. Ord a => WithOrigin a -> WithOrigin a -> WithOrigin a
min :: WithOrigin a -> WithOrigin a -> WithOrigin a
$cmin :: forall a. Ord a => WithOrigin a -> WithOrigin a -> WithOrigin a
max :: WithOrigin a -> WithOrigin a -> WithOrigin a
$cmax :: forall a. Ord a => WithOrigin a -> WithOrigin a -> WithOrigin a
>= :: WithOrigin a -> WithOrigin a -> Bool
$c>= :: forall a. Ord a => WithOrigin a -> WithOrigin a -> Bool
> :: WithOrigin a -> WithOrigin a -> Bool
$c> :: forall a. Ord a => WithOrigin a -> WithOrigin a -> Bool
<= :: WithOrigin a -> WithOrigin a -> Bool
$c<= :: forall a. Ord a => WithOrigin a -> WithOrigin a -> Bool
< :: WithOrigin a -> WithOrigin a -> Bool
$c< :: forall a. Ord a => WithOrigin a -> WithOrigin a -> Bool
compare :: WithOrigin a -> WithOrigin a -> Ordering
$ccompare :: forall a. Ord a => WithOrigin a -> WithOrigin a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (WithOrigin a)
Ord, Int -> WithOrigin a -> ShowS
[WithOrigin a] -> ShowS
WithOrigin a -> String
(Int -> WithOrigin a -> ShowS)
-> (WithOrigin a -> String)
-> ([WithOrigin a] -> ShowS)
-> Show (WithOrigin a)
forall a. Show a => Int -> WithOrigin a -> ShowS
forall a. Show a => [WithOrigin a] -> ShowS
forall a. Show a => WithOrigin a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WithOrigin a] -> ShowS
$cshowList :: forall a. Show a => [WithOrigin a] -> ShowS
show :: WithOrigin a -> String
$cshow :: forall a. Show a => WithOrigin a -> String
showsPrec :: Int -> WithOrigin a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> WithOrigin a -> ShowS
Show, a -> WithOrigin b -> WithOrigin a
(a -> b) -> WithOrigin a -> WithOrigin b
(forall a b. (a -> b) -> WithOrigin a -> WithOrigin b)
-> (forall a b. a -> WithOrigin b -> WithOrigin a)
-> Functor WithOrigin
forall a b. a -> WithOrigin b -> WithOrigin a
forall a b. (a -> b) -> WithOrigin a -> WithOrigin b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> WithOrigin b -> WithOrigin a
$c<$ :: forall a b. a -> WithOrigin b -> WithOrigin a
fmap :: (a -> b) -> WithOrigin a -> WithOrigin b
$cfmap :: forall a b. (a -> b) -> WithOrigin a -> WithOrigin b
Functor, WithOrigin a -> Bool
(a -> m) -> WithOrigin a -> m
(a -> b -> b) -> b -> WithOrigin a -> b
(forall m. Monoid m => WithOrigin m -> m)
-> (forall m a. Monoid m => (a -> m) -> WithOrigin a -> m)
-> (forall m a. Monoid m => (a -> m) -> WithOrigin a -> m)
-> (forall a b. (a -> b -> b) -> b -> WithOrigin a -> b)
-> (forall a b. (a -> b -> b) -> b -> WithOrigin a -> b)
-> (forall b a. (b -> a -> b) -> b -> WithOrigin a -> b)
-> (forall b a. (b -> a -> b) -> b -> WithOrigin a -> b)
-> (forall a. (a -> a -> a) -> WithOrigin a -> a)
-> (forall a. (a -> a -> a) -> WithOrigin a -> a)
-> (forall a. WithOrigin a -> [a])
-> (forall a. WithOrigin a -> Bool)
-> (forall a. WithOrigin a -> Int)
-> (forall a. Eq a => a -> WithOrigin a -> Bool)
-> (forall a. Ord a => WithOrigin a -> a)
-> (forall a. Ord a => WithOrigin a -> a)
-> (forall a. Num a => WithOrigin a -> a)
-> (forall a. Num a => WithOrigin a -> a)
-> Foldable WithOrigin
forall a. Eq a => a -> WithOrigin a -> Bool
forall a. Num a => WithOrigin a -> a
forall a. Ord a => WithOrigin a -> a
forall m. Monoid m => WithOrigin m -> m
forall a. WithOrigin a -> Bool
forall a. WithOrigin a -> Int
forall a. WithOrigin a -> [a]
forall a. (a -> a -> a) -> WithOrigin a -> a
forall m a. Monoid m => (a -> m) -> WithOrigin a -> m
forall b a. (b -> a -> b) -> b -> WithOrigin a -> b
forall a b. (a -> b -> b) -> b -> WithOrigin a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: WithOrigin a -> a
$cproduct :: forall a. Num a => WithOrigin a -> a
sum :: WithOrigin a -> a
$csum :: forall a. Num a => WithOrigin a -> a
minimum :: WithOrigin a -> a
$cminimum :: forall a. Ord a => WithOrigin a -> a
maximum :: WithOrigin a -> a
$cmaximum :: forall a. Ord a => WithOrigin a -> a
elem :: a -> WithOrigin a -> Bool
$celem :: forall a. Eq a => a -> WithOrigin a -> Bool
length :: WithOrigin a -> Int
$clength :: forall a. WithOrigin a -> Int
null :: WithOrigin a -> Bool
$cnull :: forall a. WithOrigin a -> Bool
toList :: WithOrigin a -> [a]
$ctoList :: forall a. WithOrigin a -> [a]
foldl1 :: (a -> a -> a) -> WithOrigin a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> WithOrigin a -> a
foldr1 :: (a -> a -> a) -> WithOrigin a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> WithOrigin a -> a
foldl' :: (b -> a -> b) -> b -> WithOrigin a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> WithOrigin a -> b
foldl :: (b -> a -> b) -> b -> WithOrigin a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> WithOrigin a -> b
foldr' :: (a -> b -> b) -> b -> WithOrigin a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> WithOrigin a -> b
foldr :: (a -> b -> b) -> b -> WithOrigin a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> WithOrigin a -> b
foldMap' :: (a -> m) -> WithOrigin a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> WithOrigin a -> m
foldMap :: (a -> m) -> WithOrigin a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> WithOrigin a -> m
fold :: WithOrigin m -> m
$cfold :: forall m. Monoid m => WithOrigin m -> m
Foldable, Functor WithOrigin
Foldable WithOrigin
Functor WithOrigin
-> Foldable WithOrigin
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> WithOrigin a -> f (WithOrigin b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    WithOrigin (f a) -> f (WithOrigin a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> WithOrigin a -> m (WithOrigin b))
-> (forall (m :: * -> *) a.
    Monad m =>
    WithOrigin (m a) -> m (WithOrigin a))
-> Traversable WithOrigin
(a -> f b) -> WithOrigin a -> f (WithOrigin b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
WithOrigin (m a) -> m (WithOrigin a)
forall (f :: * -> *) a.
Applicative f =>
WithOrigin (f a) -> f (WithOrigin a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WithOrigin a -> m (WithOrigin b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WithOrigin a -> f (WithOrigin b)
sequence :: WithOrigin (m a) -> m (WithOrigin a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
WithOrigin (m a) -> m (WithOrigin a)
mapM :: (a -> m b) -> WithOrigin a -> m (WithOrigin b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WithOrigin a -> m (WithOrigin b)
sequenceA :: WithOrigin (f a) -> f (WithOrigin a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
WithOrigin (f a) -> f (WithOrigin a)
traverse :: (a -> f b) -> WithOrigin a -> f (WithOrigin b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WithOrigin a -> f (WithOrigin b)
$cp2Traversable :: Foldable WithOrigin
$cp1Traversable :: Functor WithOrigin
Traversable)

instance Decoration WithOrigin where
  traverseF :: (a -> m b) -> WithOrigin a -> m (WithOrigin b)
traverseF a -> m b
f (WithOrigin Origin
h a
a) = Origin -> b -> WithOrigin b
forall a. Origin -> a -> WithOrigin a
WithOrigin Origin
h (b -> WithOrigin b) -> m b -> m (WithOrigin b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> m b
f a
a

instance Pretty a => Pretty (WithOrigin a) where
  prettyPrec :: Int -> WithOrigin a -> Doc
prettyPrec Int
p = Int -> a -> Doc
forall a. Pretty a => Int -> a -> Doc
prettyPrec Int
p (a -> Doc) -> (WithOrigin a -> a) -> WithOrigin a -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WithOrigin a -> a
forall a. WithOrigin a -> a
woThing

instance HasRange a => HasRange (WithOrigin a) where
  getRange :: WithOrigin a -> Range
getRange = a -> Range
forall a. HasRange a => a -> Range
getRange (a -> Range) -> (WithOrigin a -> a) -> WithOrigin a -> Range
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WithOrigin a -> a
forall (t :: * -> *) a. Decoration t => t a -> a
dget

instance SetRange a => SetRange (WithOrigin a) where
  setRange :: Range -> WithOrigin a -> WithOrigin a
setRange = (a -> a) -> WithOrigin a -> WithOrigin a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a) -> WithOrigin a -> WithOrigin a)
-> (Range -> a -> a) -> Range -> WithOrigin a -> WithOrigin a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Range -> a -> a
forall a. SetRange a => Range -> a -> a
setRange

instance KillRange a => KillRange (WithOrigin a) where
  killRange :: KillRangeT (WithOrigin a)
killRange = (a -> a) -> KillRangeT (WithOrigin a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. KillRange a => KillRangeT a
killRange

instance NFData a => NFData (WithOrigin a) where
  rnf :: WithOrigin a -> ()
rnf (WithOrigin Origin
_ a
a) = a -> ()
forall a. NFData a => a -> ()
rnf a
a

-- | A lens to access the 'Origin' attribute in data structures.
--   Minimal implementation: @getOrigin@ and @mapOrigin@ or @LensArgInfo@.

class LensOrigin a where

  getOrigin :: a -> Origin

  setOrigin :: Origin -> a -> a
  setOrigin Origin
o = (Origin -> Origin) -> a -> a
forall a. LensOrigin a => (Origin -> Origin) -> a -> a
mapOrigin (Origin -> Origin -> Origin
forall a b. a -> b -> a
const Origin
o)

  mapOrigin :: (Origin -> Origin) -> a -> a

  default getOrigin :: LensArgInfo a => a -> Origin
  getOrigin = ArgInfo -> Origin
argInfoOrigin (ArgInfo -> Origin) -> (a -> ArgInfo) -> a -> Origin
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo

  default mapOrigin :: LensArgInfo a => (Origin -> Origin) -> a -> a
  mapOrigin Origin -> Origin
f = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a) -> (ArgInfo -> ArgInfo) -> a -> a
forall a b. (a -> b) -> a -> b
$ \ ArgInfo
ai -> ArgInfo
ai { argInfoOrigin :: Origin
argInfoOrigin = Origin -> Origin
f (Origin -> Origin) -> Origin -> Origin
forall a b. (a -> b) -> a -> b
$ ArgInfo -> Origin
argInfoOrigin ArgInfo
ai }

instance LensOrigin Origin where
  getOrigin :: Origin -> Origin
getOrigin = Origin -> Origin
forall a. a -> a
id
  setOrigin :: Origin -> Origin -> Origin
setOrigin = Origin -> Origin -> Origin
forall a b. a -> b -> a
const
  mapOrigin :: (Origin -> Origin) -> Origin -> Origin
mapOrigin = (Origin -> Origin) -> Origin -> Origin
forall a. a -> a
id

instance LensOrigin (WithOrigin a) where
  getOrigin :: WithOrigin a -> Origin
getOrigin   (WithOrigin Origin
h a
_) = Origin
h
  setOrigin :: Origin -> WithOrigin a -> WithOrigin a
setOrigin Origin
h (WithOrigin Origin
_ a
a) = Origin -> a -> WithOrigin a
forall a. Origin -> a -> WithOrigin a
WithOrigin Origin
h a
a
  mapOrigin :: (Origin -> Origin) -> WithOrigin a -> WithOrigin a
mapOrigin Origin -> Origin
f (WithOrigin Origin
h a
a) = Origin -> a -> WithOrigin a
forall a. Origin -> a -> WithOrigin a
WithOrigin (Origin -> Origin
f Origin
h) a
a

-----------------------------------------------------------------------------
-- * Free variable annotations
-----------------------------------------------------------------------------

data FreeVariables = UnknownFVs | KnownFVs IntSet
  deriving (Typeable FreeVariables
DataType
Constr
Typeable FreeVariables
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> FreeVariables -> c FreeVariables)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FreeVariables)
-> (FreeVariables -> Constr)
-> (FreeVariables -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c FreeVariables))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c FreeVariables))
-> ((forall b. Data b => b -> b) -> FreeVariables -> FreeVariables)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> FreeVariables -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> FreeVariables -> r)
-> (forall u. (forall d. Data d => d -> u) -> FreeVariables -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> FreeVariables -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables)
-> Data FreeVariables
FreeVariables -> DataType
FreeVariables -> Constr
(forall b. Data b => b -> b) -> FreeVariables -> FreeVariables
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FreeVariables -> c FreeVariables
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FreeVariables
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) -> FreeVariables -> u
forall u. (forall d. Data d => d -> u) -> FreeVariables -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FreeVariables -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FreeVariables -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FreeVariables
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FreeVariables -> c FreeVariables
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FreeVariables)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FreeVariables)
$cKnownFVs :: Constr
$cUnknownFVs :: Constr
$tFreeVariables :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables
gmapMp :: (forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables
gmapM :: (forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FreeVariables -> m FreeVariables
gmapQi :: Int -> (forall d. Data d => d -> u) -> FreeVariables -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FreeVariables -> u
gmapQ :: (forall d. Data d => d -> u) -> FreeVariables -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FreeVariables -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FreeVariables -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FreeVariables -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FreeVariables -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FreeVariables -> r
gmapT :: (forall b. Data b => b -> b) -> FreeVariables -> FreeVariables
$cgmapT :: (forall b. Data b => b -> b) -> FreeVariables -> FreeVariables
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FreeVariables)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FreeVariables)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FreeVariables)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FreeVariables)
dataTypeOf :: FreeVariables -> DataType
$cdataTypeOf :: FreeVariables -> DataType
toConstr :: FreeVariables -> Constr
$ctoConstr :: FreeVariables -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FreeVariables
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FreeVariables
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FreeVariables -> c FreeVariables
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FreeVariables -> c FreeVariables
$cp1Data :: Typeable FreeVariables
Data, FreeVariables -> FreeVariables -> Bool
(FreeVariables -> FreeVariables -> Bool)
-> (FreeVariables -> FreeVariables -> Bool) -> Eq FreeVariables
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FreeVariables -> FreeVariables -> Bool
$c/= :: FreeVariables -> FreeVariables -> Bool
== :: FreeVariables -> FreeVariables -> Bool
$c== :: FreeVariables -> FreeVariables -> Bool
Eq, Eq FreeVariables
Eq FreeVariables
-> (FreeVariables -> FreeVariables -> Ordering)
-> (FreeVariables -> FreeVariables -> Bool)
-> (FreeVariables -> FreeVariables -> Bool)
-> (FreeVariables -> FreeVariables -> Bool)
-> (FreeVariables -> FreeVariables -> Bool)
-> (FreeVariables -> FreeVariables -> FreeVariables)
-> (FreeVariables -> FreeVariables -> FreeVariables)
-> Ord FreeVariables
FreeVariables -> FreeVariables -> Bool
FreeVariables -> FreeVariables -> Ordering
FreeVariables -> FreeVariables -> FreeVariables
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 :: FreeVariables -> FreeVariables -> FreeVariables
$cmin :: FreeVariables -> FreeVariables -> FreeVariables
max :: FreeVariables -> FreeVariables -> FreeVariables
$cmax :: FreeVariables -> FreeVariables -> FreeVariables
>= :: FreeVariables -> FreeVariables -> Bool
$c>= :: FreeVariables -> FreeVariables -> Bool
> :: FreeVariables -> FreeVariables -> Bool
$c> :: FreeVariables -> FreeVariables -> Bool
<= :: FreeVariables -> FreeVariables -> Bool
$c<= :: FreeVariables -> FreeVariables -> Bool
< :: FreeVariables -> FreeVariables -> Bool
$c< :: FreeVariables -> FreeVariables -> Bool
compare :: FreeVariables -> FreeVariables -> Ordering
$ccompare :: FreeVariables -> FreeVariables -> Ordering
$cp1Ord :: Eq FreeVariables
Ord, Int -> FreeVariables -> ShowS
[FreeVariables] -> ShowS
FreeVariables -> String
(Int -> FreeVariables -> ShowS)
-> (FreeVariables -> String)
-> ([FreeVariables] -> ShowS)
-> Show FreeVariables
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FreeVariables] -> ShowS
$cshowList :: [FreeVariables] -> ShowS
show :: FreeVariables -> String
$cshow :: FreeVariables -> String
showsPrec :: Int -> FreeVariables -> ShowS
$cshowsPrec :: Int -> FreeVariables -> ShowS
Show)

instance Semigroup FreeVariables where
  FreeVariables
UnknownFVs   <> :: FreeVariables -> FreeVariables -> FreeVariables
<> FreeVariables
_            = FreeVariables
UnknownFVs
  FreeVariables
_            <> FreeVariables
UnknownFVs   = FreeVariables
UnknownFVs
  KnownFVs IntSet
vs1 <> KnownFVs IntSet
vs2 = IntSet -> FreeVariables
KnownFVs (IntSet -> IntSet -> IntSet
IntSet.union IntSet
vs1 IntSet
vs2)

instance Monoid FreeVariables where
  mempty :: FreeVariables
mempty  = IntSet -> FreeVariables
KnownFVs IntSet
IntSet.empty
  mappend :: FreeVariables -> FreeVariables -> FreeVariables
mappend = FreeVariables -> FreeVariables -> FreeVariables
forall a. Semigroup a => a -> a -> a
(<>)

instance KillRange FreeVariables where
  killRange :: FreeVariables -> FreeVariables
killRange = FreeVariables -> FreeVariables
forall a. a -> a
id

instance NFData FreeVariables where
  rnf :: FreeVariables -> ()
rnf FreeVariables
UnknownFVs    = ()
  rnf (KnownFVs IntSet
fv) = IntSet -> ()
forall a. NFData a => a -> ()
rnf IntSet
fv

unknownFreeVariables :: FreeVariables
unknownFreeVariables :: FreeVariables
unknownFreeVariables = FreeVariables
UnknownFVs

noFreeVariables :: FreeVariables
noFreeVariables :: FreeVariables
noFreeVariables = FreeVariables
forall a. Monoid a => a
mempty

oneFreeVariable :: Int -> FreeVariables
oneFreeVariable :: Int -> FreeVariables
oneFreeVariable = IntSet -> FreeVariables
KnownFVs (IntSet -> FreeVariables)
-> (Int -> IntSet) -> Int -> FreeVariables
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> IntSet
IntSet.singleton

freeVariablesFromList :: [Int] -> FreeVariables
freeVariablesFromList :: [Int] -> FreeVariables
freeVariablesFromList = [FreeVariables] -> FreeVariables
forall a. Monoid a => [a] -> a
mconcat ([FreeVariables] -> FreeVariables)
-> ([Int] -> [FreeVariables]) -> [Int] -> FreeVariables
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> FreeVariables) -> [Int] -> [FreeVariables]
forall a b. (a -> b) -> [a] -> [b]
map Int -> FreeVariables
oneFreeVariable

-- | A lens to access the 'FreeVariables' attribute in data structures.
--   Minimal implementation: @getFreeVariables@ and @mapFreeVariables@ or @LensArgInfo@.
class LensFreeVariables a where

  getFreeVariables :: a -> FreeVariables

  setFreeVariables :: FreeVariables -> a -> a
  setFreeVariables FreeVariables
o = (FreeVariables -> FreeVariables) -> a -> a
forall a.
LensFreeVariables a =>
(FreeVariables -> FreeVariables) -> a -> a
mapFreeVariables (FreeVariables -> FreeVariables -> FreeVariables
forall a b. a -> b -> a
const FreeVariables
o)

  mapFreeVariables :: (FreeVariables -> FreeVariables) -> a -> a

  default getFreeVariables :: LensArgInfo a => a -> FreeVariables
  getFreeVariables = ArgInfo -> FreeVariables
argInfoFreeVariables (ArgInfo -> FreeVariables) -> (a -> ArgInfo) -> a -> FreeVariables
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo

  default mapFreeVariables :: LensArgInfo a => (FreeVariables -> FreeVariables) -> a -> a
  mapFreeVariables FreeVariables -> FreeVariables
f = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a) -> (ArgInfo -> ArgInfo) -> a -> a
forall a b. (a -> b) -> a -> b
$ \ ArgInfo
ai -> ArgInfo
ai { argInfoFreeVariables :: FreeVariables
argInfoFreeVariables = FreeVariables -> FreeVariables
f (FreeVariables -> FreeVariables) -> FreeVariables -> FreeVariables
forall a b. (a -> b) -> a -> b
$ ArgInfo -> FreeVariables
argInfoFreeVariables ArgInfo
ai }

instance LensFreeVariables FreeVariables where
  getFreeVariables :: FreeVariables -> FreeVariables
getFreeVariables = FreeVariables -> FreeVariables
forall a. a -> a
id
  setFreeVariables :: FreeVariables -> FreeVariables -> FreeVariables
setFreeVariables = FreeVariables -> FreeVariables -> FreeVariables
forall a b. a -> b -> a
const
  mapFreeVariables :: (FreeVariables -> FreeVariables) -> FreeVariables -> FreeVariables
mapFreeVariables = (FreeVariables -> FreeVariables) -> FreeVariables -> FreeVariables
forall a. a -> a
id

hasNoFreeVariables :: LensFreeVariables a => a -> Bool
hasNoFreeVariables :: a -> Bool
hasNoFreeVariables a
x =
  case a -> FreeVariables
forall a. LensFreeVariables a => a -> FreeVariables
getFreeVariables a
x of
    FreeVariables
UnknownFVs  -> Bool
False
    KnownFVs IntSet
fv -> IntSet -> Bool
IntSet.null IntSet
fv

---------------------------------------------------------------------------
-- * Argument decoration
---------------------------------------------------------------------------

-- | A function argument can be hidden and/or irrelevant.

data ArgInfo = ArgInfo
  { ArgInfo -> Hiding
argInfoHiding        :: Hiding
  , ArgInfo -> Modality
argInfoModality      :: Modality
  , ArgInfo -> Origin
argInfoOrigin        :: Origin
  , ArgInfo -> FreeVariables
argInfoFreeVariables :: FreeVariables
  , ArgInfo -> Annotation
argInfoAnnotation    :: Annotation
    -- ^ Sometimes we want a different kind of binder/pi-type, without it
    --   supporting any of the @Modality@ interface.
  } deriving (Typeable ArgInfo
DataType
Constr
Typeable ArgInfo
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ArgInfo -> c ArgInfo)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ArgInfo)
-> (ArgInfo -> Constr)
-> (ArgInfo -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ArgInfo))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArgInfo))
-> ((forall b. Data b => b -> b) -> ArgInfo -> ArgInfo)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ArgInfo -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ArgInfo -> r)
-> (forall u. (forall d. Data d => d -> u) -> ArgInfo -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> ArgInfo -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo)
-> Data ArgInfo
ArgInfo -> DataType
ArgInfo -> Constr
(forall b. Data b => b -> b) -> ArgInfo -> ArgInfo
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArgInfo -> c ArgInfo
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArgInfo
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) -> ArgInfo -> u
forall u. (forall d. Data d => d -> u) -> ArgInfo -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ArgInfo -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ArgInfo -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArgInfo
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArgInfo -> c ArgInfo
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ArgInfo)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArgInfo)
$cArgInfo :: Constr
$tArgInfo :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo
gmapMp :: (forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo
gmapM :: (forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ArgInfo -> m ArgInfo
gmapQi :: Int -> (forall d. Data d => d -> u) -> ArgInfo -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ArgInfo -> u
gmapQ :: (forall d. Data d => d -> u) -> ArgInfo -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ArgInfo -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ArgInfo -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ArgInfo -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ArgInfo -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ArgInfo -> r
gmapT :: (forall b. Data b => b -> b) -> ArgInfo -> ArgInfo
$cgmapT :: (forall b. Data b => b -> b) -> ArgInfo -> ArgInfo
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArgInfo)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArgInfo)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ArgInfo)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ArgInfo)
dataTypeOf :: ArgInfo -> DataType
$cdataTypeOf :: ArgInfo -> DataType
toConstr :: ArgInfo -> Constr
$ctoConstr :: ArgInfo -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArgInfo
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArgInfo
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArgInfo -> c ArgInfo
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArgInfo -> c ArgInfo
$cp1Data :: Typeable ArgInfo
Data, ArgInfo -> ArgInfo -> Bool
(ArgInfo -> ArgInfo -> Bool)
-> (ArgInfo -> ArgInfo -> Bool) -> Eq ArgInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArgInfo -> ArgInfo -> Bool
$c/= :: ArgInfo -> ArgInfo -> Bool
== :: ArgInfo -> ArgInfo -> Bool
$c== :: ArgInfo -> ArgInfo -> Bool
Eq, Eq ArgInfo
Eq ArgInfo
-> (ArgInfo -> ArgInfo -> Ordering)
-> (ArgInfo -> ArgInfo -> Bool)
-> (ArgInfo -> ArgInfo -> Bool)
-> (ArgInfo -> ArgInfo -> Bool)
-> (ArgInfo -> ArgInfo -> Bool)
-> (ArgInfo -> ArgInfo -> ArgInfo)
-> (ArgInfo -> ArgInfo -> ArgInfo)
-> Ord ArgInfo
ArgInfo -> ArgInfo -> Bool
ArgInfo -> ArgInfo -> Ordering
ArgInfo -> ArgInfo -> ArgInfo
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 :: ArgInfo -> ArgInfo -> ArgInfo
$cmin :: ArgInfo -> ArgInfo -> ArgInfo
max :: ArgInfo -> ArgInfo -> ArgInfo
$cmax :: ArgInfo -> ArgInfo -> ArgInfo
>= :: ArgInfo -> ArgInfo -> Bool
$c>= :: ArgInfo -> ArgInfo -> Bool
> :: ArgInfo -> ArgInfo -> Bool
$c> :: ArgInfo -> ArgInfo -> Bool
<= :: ArgInfo -> ArgInfo -> Bool
$c<= :: ArgInfo -> ArgInfo -> Bool
< :: ArgInfo -> ArgInfo -> Bool
$c< :: ArgInfo -> ArgInfo -> Bool
compare :: ArgInfo -> ArgInfo -> Ordering
$ccompare :: ArgInfo -> ArgInfo -> Ordering
$cp1Ord :: Eq ArgInfo
Ord, Int -> ArgInfo -> ShowS
[ArgInfo] -> ShowS
ArgInfo -> String
(Int -> ArgInfo -> ShowS)
-> (ArgInfo -> String) -> ([ArgInfo] -> ShowS) -> Show ArgInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArgInfo] -> ShowS
$cshowList :: [ArgInfo] -> ShowS
show :: ArgInfo -> String
$cshow :: ArgInfo -> String
showsPrec :: Int -> ArgInfo -> ShowS
$cshowsPrec :: Int -> ArgInfo -> ShowS
Show)

instance HasRange ArgInfo where
  getRange :: ArgInfo -> Range
getRange (ArgInfo Hiding
h Modality
m Origin
o FreeVariables
_fv Annotation
a) = (Hiding, Modality, Origin, Annotation) -> Range
forall a. HasRange a => a -> Range
getRange (Hiding
h, Modality
m, Origin
o, Annotation
a)

instance KillRange ArgInfo where
  killRange :: ArgInfo -> ArgInfo
killRange (ArgInfo Hiding
h Modality
m Origin
o FreeVariables
fv Annotation
a) = (Hiding
 -> Modality -> Origin -> FreeVariables -> Annotation -> ArgInfo)
-> Hiding
-> Modality
-> Origin
-> FreeVariables
-> Annotation
-> ArgInfo
forall a b c d e f.
(KillRange a, KillRange b, KillRange c, KillRange d,
 KillRange e) =>
(a -> b -> c -> d -> e -> f) -> a -> b -> c -> d -> e -> f
killRange5 Hiding
-> Modality -> Origin -> FreeVariables -> Annotation -> ArgInfo
ArgInfo Hiding
h Modality
m Origin
o FreeVariables
fv Annotation
a

class LensArgInfo a where
  getArgInfo :: a -> ArgInfo
  setArgInfo :: ArgInfo -> a -> a
  setArgInfo ArgInfo
ai = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo (ArgInfo -> ArgInfo -> ArgInfo
forall a b. a -> b -> a
const ArgInfo
ai)
  mapArgInfo :: (ArgInfo -> ArgInfo) -> a -> a
  mapArgInfo ArgInfo -> ArgInfo
f a
a = ArgInfo -> a -> a
forall a. LensArgInfo a => ArgInfo -> a -> a
setArgInfo (ArgInfo -> ArgInfo
f (ArgInfo -> ArgInfo) -> ArgInfo -> ArgInfo
forall a b. (a -> b) -> a -> b
$ a -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo a
a) a
a

instance LensArgInfo ArgInfo where
  getArgInfo :: ArgInfo -> ArgInfo
getArgInfo = ArgInfo -> ArgInfo
forall a. a -> a
id
  setArgInfo :: ArgInfo -> ArgInfo -> ArgInfo
setArgInfo = ArgInfo -> ArgInfo -> ArgInfo
forall a b. a -> b -> a
const
  mapArgInfo :: (ArgInfo -> ArgInfo) -> ArgInfo -> ArgInfo
mapArgInfo = (ArgInfo -> ArgInfo) -> ArgInfo -> ArgInfo
forall a. a -> a
id

instance NFData ArgInfo where
  rnf :: ArgInfo -> ()
rnf (ArgInfo Hiding
a Modality
b Origin
c FreeVariables
d Annotation
e) = Hiding -> ()
forall a. NFData a => a -> ()
rnf Hiding
a () -> () -> ()
`seq` Modality -> ()
forall a. NFData a => a -> ()
rnf Modality
b () -> () -> ()
`seq` Origin -> ()
forall a. NFData a => a -> ()
rnf Origin
c () -> () -> ()
`seq` FreeVariables -> ()
forall a. NFData a => a -> ()
rnf FreeVariables
d () -> () -> ()
`seq` Annotation -> ()
forall a. NFData a => a -> ()
rnf Annotation
e

instance LensHiding ArgInfo where
  getHiding :: ArgInfo -> Hiding
getHiding = ArgInfo -> Hiding
argInfoHiding
  setHiding :: Hiding -> ArgInfo -> ArgInfo
setHiding Hiding
h ArgInfo
ai = ArgInfo
ai { argInfoHiding :: Hiding
argInfoHiding = Hiding
h }
  mapHiding :: (Hiding -> Hiding) -> ArgInfo -> ArgInfo
mapHiding Hiding -> Hiding
f ArgInfo
ai = ArgInfo
ai { argInfoHiding :: Hiding
argInfoHiding = Hiding -> Hiding
f (ArgInfo -> Hiding
argInfoHiding ArgInfo
ai) }

instance LensModality ArgInfo where
  getModality :: ArgInfo -> Modality
getModality = ArgInfo -> Modality
argInfoModality
  setModality :: Modality -> ArgInfo -> ArgInfo
setModality Modality
m ArgInfo
ai = ArgInfo
ai { argInfoModality :: Modality
argInfoModality = Modality
m }
  mapModality :: (Modality -> Modality) -> ArgInfo -> ArgInfo
mapModality Modality -> Modality
f ArgInfo
ai = ArgInfo
ai { argInfoModality :: Modality
argInfoModality = Modality -> Modality
f (ArgInfo -> Modality
argInfoModality ArgInfo
ai) }

instance LensOrigin ArgInfo where
  getOrigin :: ArgInfo -> Origin
getOrigin = ArgInfo -> Origin
argInfoOrigin
  setOrigin :: Origin -> ArgInfo -> ArgInfo
setOrigin Origin
o ArgInfo
ai = ArgInfo
ai { argInfoOrigin :: Origin
argInfoOrigin = Origin
o }
  mapOrigin :: (Origin -> Origin) -> ArgInfo -> ArgInfo
mapOrigin Origin -> Origin
f ArgInfo
ai = ArgInfo
ai { argInfoOrigin :: Origin
argInfoOrigin = Origin -> Origin
f (ArgInfo -> Origin
argInfoOrigin ArgInfo
ai) }

instance LensFreeVariables ArgInfo where
  getFreeVariables :: ArgInfo -> FreeVariables
getFreeVariables = ArgInfo -> FreeVariables
argInfoFreeVariables
  setFreeVariables :: FreeVariables -> ArgInfo -> ArgInfo
setFreeVariables FreeVariables
o ArgInfo
ai = ArgInfo
ai { argInfoFreeVariables :: FreeVariables
argInfoFreeVariables = FreeVariables
o }
  mapFreeVariables :: (FreeVariables -> FreeVariables) -> ArgInfo -> ArgInfo
mapFreeVariables FreeVariables -> FreeVariables
f ArgInfo
ai = ArgInfo
ai { argInfoFreeVariables :: FreeVariables
argInfoFreeVariables = FreeVariables -> FreeVariables
f (ArgInfo -> FreeVariables
argInfoFreeVariables ArgInfo
ai) }

instance LensAnnotation ArgInfo where
  getAnnotation :: ArgInfo -> Annotation
getAnnotation = ArgInfo -> Annotation
argInfoAnnotation
  setAnnotation :: Annotation -> ArgInfo -> ArgInfo
setAnnotation Annotation
m ArgInfo
ai = ArgInfo
ai { argInfoAnnotation :: Annotation
argInfoAnnotation = Annotation
m }
  mapAnnotation :: (Annotation -> Annotation) -> ArgInfo -> ArgInfo
mapAnnotation Annotation -> Annotation
f ArgInfo
ai = ArgInfo
ai { argInfoAnnotation :: Annotation
argInfoAnnotation = Annotation -> Annotation
f (ArgInfo -> Annotation
argInfoAnnotation ArgInfo
ai) }

-- inherited instances

instance LensRelevance ArgInfo where
  getRelevance :: ArgInfo -> Relevance
getRelevance = ArgInfo -> Relevance
forall a. LensModality a => LensGet Relevance a
getRelevanceMod
  setRelevance :: Relevance -> ArgInfo -> ArgInfo
setRelevance = Relevance -> ArgInfo -> ArgInfo
forall a. LensModality a => LensSet Relevance a
setRelevanceMod
  mapRelevance :: (Relevance -> Relevance) -> ArgInfo -> ArgInfo
mapRelevance = (Relevance -> Relevance) -> ArgInfo -> ArgInfo
forall a. LensModality a => LensMap Relevance a
mapRelevanceMod

instance LensQuantity ArgInfo where
  getQuantity :: ArgInfo -> Quantity
getQuantity = ArgInfo -> Quantity
forall a. LensModality a => LensGet Quantity a
getQuantityMod
  setQuantity :: Quantity -> ArgInfo -> ArgInfo
setQuantity = Quantity -> ArgInfo -> ArgInfo
forall a. LensModality a => LensSet Quantity a
setQuantityMod
  mapQuantity :: (Quantity -> Quantity) -> ArgInfo -> ArgInfo
mapQuantity = (Quantity -> Quantity) -> ArgInfo -> ArgInfo
forall a. LensModality a => LensMap Quantity a
mapQuantityMod

instance LensCohesion ArgInfo where
  getCohesion :: ArgInfo -> Cohesion
getCohesion = ArgInfo -> Cohesion
forall a. LensModality a => LensGet Cohesion a
getCohesionMod
  setCohesion :: Cohesion -> ArgInfo -> ArgInfo
setCohesion = Cohesion -> ArgInfo -> ArgInfo
forall a. LensModality a => LensSet Cohesion a
setCohesionMod
  mapCohesion :: (Cohesion -> Cohesion) -> ArgInfo -> ArgInfo
mapCohesion = (Cohesion -> Cohesion) -> ArgInfo -> ArgInfo
forall a. LensModality a => LensMap Cohesion a
mapCohesionMod

defaultArgInfo :: ArgInfo
defaultArgInfo :: ArgInfo
defaultArgInfo =  ArgInfo :: Hiding
-> Modality -> Origin -> FreeVariables -> Annotation -> ArgInfo
ArgInfo
  { argInfoHiding :: Hiding
argInfoHiding        = Hiding
NotHidden
  , argInfoModality :: Modality
argInfoModality      = Modality
defaultModality
  , argInfoOrigin :: Origin
argInfoOrigin        = Origin
UserWritten
  , argInfoFreeVariables :: FreeVariables
argInfoFreeVariables = FreeVariables
UnknownFVs
  , argInfoAnnotation :: Annotation
argInfoAnnotation    = Annotation
defaultAnnotation
  }

-- Accessing through ArgInfo

-- default accessors for Hiding

getHidingArgInfo :: LensArgInfo a => LensGet Hiding a
getHidingArgInfo :: LensGet Hiding a
getHidingArgInfo = ArgInfo -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding (ArgInfo -> Hiding) -> (a -> ArgInfo) -> LensGet Hiding a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo

setHidingArgInfo :: LensArgInfo a => LensSet Hiding a
setHidingArgInfo :: LensSet Hiding a
setHidingArgInfo = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a)
-> (Hiding -> ArgInfo -> ArgInfo) -> LensSet Hiding a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Hiding -> ArgInfo -> ArgInfo
forall a. LensHiding a => Hiding -> a -> a
setHiding

mapHidingArgInfo :: LensArgInfo a => LensMap Hiding a
mapHidingArgInfo :: LensMap Hiding a
mapHidingArgInfo = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a)
-> ((Hiding -> Hiding) -> ArgInfo -> ArgInfo) -> LensMap Hiding a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Hiding -> Hiding) -> ArgInfo -> ArgInfo
forall a. LensHiding a => (Hiding -> Hiding) -> a -> a
mapHiding

-- default accessors for Modality

getModalityArgInfo :: LensArgInfo a => LensGet Modality a
getModalityArgInfo :: LensGet Modality a
getModalityArgInfo = ArgInfo -> Modality
forall a. LensModality a => a -> Modality
getModality (ArgInfo -> Modality) -> (a -> ArgInfo) -> LensGet Modality a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo

setModalityArgInfo :: LensArgInfo a => LensSet Modality a
setModalityArgInfo :: LensSet Modality a
setModalityArgInfo = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a)
-> (Modality -> ArgInfo -> ArgInfo) -> LensSet Modality a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Modality -> ArgInfo -> ArgInfo
forall a. LensModality a => Modality -> a -> a
setModality

mapModalityArgInfo :: LensArgInfo a => LensMap Modality a
mapModalityArgInfo :: LensMap Modality a
mapModalityArgInfo = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a)
-> ((Modality -> Modality) -> ArgInfo -> ArgInfo)
-> LensMap Modality a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Modality -> Modality) -> ArgInfo -> ArgInfo
forall a. LensModality a => (Modality -> Modality) -> a -> a
mapModality

-- default accessors for Origin

getOriginArgInfo :: LensArgInfo a => LensGet Origin a
getOriginArgInfo :: LensGet Origin a
getOriginArgInfo = ArgInfo -> Origin
forall a. LensOrigin a => a -> Origin
getOrigin (ArgInfo -> Origin) -> (a -> ArgInfo) -> LensGet Origin a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo

setOriginArgInfo :: LensArgInfo a => LensSet Origin a
setOriginArgInfo :: LensSet Origin a
setOriginArgInfo = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a)
-> (Origin -> ArgInfo -> ArgInfo) -> LensSet Origin a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Origin -> ArgInfo -> ArgInfo
forall a. LensOrigin a => Origin -> a -> a
setOrigin

mapOriginArgInfo :: LensArgInfo a => LensMap Origin a
mapOriginArgInfo :: LensMap Origin a
mapOriginArgInfo = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a)
-> ((Origin -> Origin) -> ArgInfo -> ArgInfo) -> LensMap Origin a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Origin -> Origin) -> ArgInfo -> ArgInfo
forall a. LensOrigin a => (Origin -> Origin) -> a -> a
mapOrigin

-- default accessors for FreeVariables

getFreeVariablesArgInfo :: LensArgInfo a => LensGet FreeVariables a
getFreeVariablesArgInfo :: LensGet FreeVariables a
getFreeVariablesArgInfo = ArgInfo -> FreeVariables
forall a. LensFreeVariables a => a -> FreeVariables
getFreeVariables (ArgInfo -> FreeVariables)
-> (a -> ArgInfo) -> LensGet FreeVariables a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ArgInfo
forall a. LensArgInfo a => a -> ArgInfo
getArgInfo

setFreeVariablesArgInfo :: LensArgInfo a => LensSet FreeVariables a
setFreeVariablesArgInfo :: LensSet FreeVariables a
setFreeVariablesArgInfo = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a)
-> (FreeVariables -> ArgInfo -> ArgInfo) -> LensSet FreeVariables a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FreeVariables -> ArgInfo -> ArgInfo
forall a. LensFreeVariables a => FreeVariables -> a -> a
setFreeVariables

mapFreeVariablesArgInfo :: LensArgInfo a => LensMap FreeVariables a
mapFreeVariablesArgInfo :: LensMap FreeVariables a
mapFreeVariablesArgInfo = (ArgInfo -> ArgInfo) -> a -> a
forall a. LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a
mapArgInfo ((ArgInfo -> ArgInfo) -> a -> a)
-> ((FreeVariables -> FreeVariables) -> ArgInfo -> ArgInfo)
-> LensMap FreeVariables a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FreeVariables -> FreeVariables) -> ArgInfo -> ArgInfo
forall a.
LensFreeVariables a =>
(FreeVariables -> FreeVariables) -> a -> a
mapFreeVariables

-- inserted hidden arguments

isInsertedHidden :: (LensHiding a, LensOrigin a) => a -> Bool
isInsertedHidden :: a -> Bool
isInsertedHidden a
a = a -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding a
a Hiding -> Hiding -> Bool
forall a. Eq a => a -> a -> Bool
== Hiding
Hidden Bool -> Bool -> Bool
&& a -> Origin
forall a. LensOrigin a => a -> Origin
getOrigin a
a Origin -> Origin -> Bool
forall a. Eq a => a -> a -> Bool
== Origin
Inserted

---------------------------------------------------------------------------
-- * Arguments
---------------------------------------------------------------------------

data Arg e  = Arg
  { Arg e -> ArgInfo
argInfo :: ArgInfo
  , Arg e -> e
unArg :: e
  } deriving (Typeable (Arg e)
DataType
Constr
Typeable (Arg e)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Arg e -> c (Arg e))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Arg e))
-> (Arg e -> Constr)
-> (Arg e -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Arg e)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Arg e)))
-> ((forall b. Data b => b -> b) -> Arg e -> Arg e)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Arg e -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Arg e -> r)
-> (forall u. (forall d. Data d => d -> u) -> Arg e -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Arg e -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Arg e -> m (Arg e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Arg e -> m (Arg e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Arg e -> m (Arg e))
-> Data (Arg e)
Arg e -> DataType
Arg e -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Arg e))
(forall b. Data b => b -> b) -> Arg e -> Arg e
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Arg e -> c (Arg e)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Arg e)
forall e. Data e => Typeable (Arg e)
forall e. Data e => Arg e -> DataType
forall e. Data e => Arg e -> Constr
forall e. Data e => (forall b. Data b => b -> b) -> Arg e -> Arg e
forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> Arg e -> u
forall e u. Data e => (forall d. Data d => d -> u) -> Arg e -> [u]
forall e r r'.
Data e =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Arg e -> r
forall e r r'.
Data e =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Arg e -> r
forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d) -> Arg e -> m (Arg e)
forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Arg e -> m (Arg e)
forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Arg e)
forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Arg e -> c (Arg e)
forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Arg e))
forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Arg e))
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) -> Arg e -> u
forall u. (forall d. Data d => d -> u) -> Arg e -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Arg e -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Arg e -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Arg e -> m (Arg e)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Arg e -> m (Arg e)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Arg e)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Arg e -> c (Arg e)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Arg e))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Arg e))
$cArg :: Constr
$tArg :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Arg e -> m (Arg e)
$cgmapMo :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Arg e -> m (Arg e)
gmapMp :: (forall d. Data d => d -> m d) -> Arg e -> m (Arg e)
$cgmapMp :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Arg e -> m (Arg e)
gmapM :: (forall d. Data d => d -> m d) -> Arg e -> m (Arg e)
$cgmapM :: forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d) -> Arg e -> m (Arg e)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Arg e -> u
$cgmapQi :: forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> Arg e -> u
gmapQ :: (forall d. Data d => d -> u) -> Arg e -> [u]
$cgmapQ :: forall e u. Data e => (forall d. Data d => d -> u) -> Arg e -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Arg e -> r
$cgmapQr :: forall e r r'.
Data e =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Arg e -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Arg e -> r
$cgmapQl :: forall e r r'.
Data e =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Arg e -> r
gmapT :: (forall b. Data b => b -> b) -> Arg e -> Arg e
$cgmapT :: forall e. Data e => (forall b. Data b => b -> b) -> Arg e -> Arg e
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Arg e))
$cdataCast2 :: forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Arg e))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Arg e))
$cdataCast1 :: forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Arg e))
dataTypeOf :: Arg e -> DataType
$cdataTypeOf :: forall e. Data e => Arg e -> DataType
toConstr :: Arg e -> Constr
$ctoConstr :: forall e. Data e => Arg e -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Arg e)
$cgunfold :: forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Arg e)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Arg e -> c (Arg e)
$cgfoldl :: forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Arg e -> c (Arg e)
$cp1Data :: forall e. Data e => Typeable (Arg e)
Data, Arg e -> Arg e -> Bool
(Arg e -> Arg e -> Bool) -> (Arg e -> Arg e -> Bool) -> Eq (Arg e)
forall e. Eq e => Arg e -> Arg e -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Arg e -> Arg e -> Bool
$c/= :: forall e. Eq e => Arg e -> Arg e -> Bool
== :: Arg e -> Arg e -> Bool
$c== :: forall e. Eq e => Arg e -> Arg e -> Bool
Eq, Eq (Arg e)
Eq (Arg e)
-> (Arg e -> Arg e -> Ordering)
-> (Arg e -> Arg e -> Bool)
-> (Arg e -> Arg e -> Bool)
-> (Arg e -> Arg e -> Bool)
-> (Arg e -> Arg e -> Bool)
-> (Arg e -> Arg e -> Arg e)
-> (Arg e -> Arg e -> Arg e)
-> Ord (Arg e)
Arg e -> Arg e -> Bool
Arg e -> Arg e -> Ordering
Arg e -> Arg e -> Arg e
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
forall e. Ord e => Eq (Arg e)
forall e. Ord e => Arg e -> Arg e -> Bool
forall e. Ord e => Arg e -> Arg e -> Ordering
forall e. Ord e => Arg e -> Arg e -> Arg e
min :: Arg e -> Arg e -> Arg e
$cmin :: forall e. Ord e => Arg e -> Arg e -> Arg e
max :: Arg e -> Arg e -> Arg e
$cmax :: forall e. Ord e => Arg e -> Arg e -> Arg e
>= :: Arg e -> Arg e -> Bool
$c>= :: forall e. Ord e => Arg e -> Arg e -> Bool
> :: Arg e -> Arg e -> Bool
$c> :: forall e. Ord e => Arg e -> Arg e -> Bool
<= :: Arg e -> Arg e -> Bool
$c<= :: forall e. Ord e => Arg e -> Arg e -> Bool
< :: Arg e -> Arg e -> Bool
$c< :: forall e. Ord e => Arg e -> Arg e -> Bool
compare :: Arg e -> Arg e -> Ordering
$ccompare :: forall e. Ord e => Arg e -> Arg e -> Ordering
$cp1Ord :: forall e. Ord e => Eq (Arg e)
Ord, Int -> Arg e -> ShowS
[Arg e] -> ShowS
Arg e -> String
(Int -> Arg e -> ShowS)
-> (Arg e -> String) -> ([Arg e] -> ShowS) -> Show (Arg e)
forall e. Show e => Int -> Arg e -> ShowS
forall e. Show e => [Arg e] -> ShowS
forall e. Show e => Arg e -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Arg e] -> ShowS
$cshowList :: forall e. Show e => [Arg e] -> ShowS
show :: Arg e -> String
$cshow :: forall e. Show e => Arg e -> String
showsPrec :: Int -> Arg e -> ShowS
$cshowsPrec :: forall e. Show e => Int -> Arg e -> ShowS
Show, a -> Arg b -> Arg a
(a -> b) -> Arg a -> Arg b
(forall a b. (a -> b) -> Arg a -> Arg b)
-> (forall a b. a -> Arg b -> Arg a) -> Functor Arg
forall a b. a -> Arg b -> Arg a
forall a b. (a -> b) -> Arg a -> Arg b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Arg b -> Arg a
$c<$ :: forall a b. a -> Arg b -> Arg a
fmap :: (a -> b) -> Arg a -> Arg b
$cfmap :: forall a b. (a -> b) -> Arg a -> Arg b
Functor, Arg a -> Bool
(a -> m) -> Arg a -> m
(a -> b -> b) -> b -> Arg a -> b
(forall m. Monoid m => Arg m -> m)
-> (forall m a. Monoid m => (a -> m) -> Arg a -> m)
-> (forall m a. Monoid m => (a -> m) -> Arg a -> m)
-> (forall a b. (a -> b -> b) -> b -> Arg a -> b)
-> (forall a b. (a -> b -> b) -> b -> Arg a -> b)
-> (forall b a. (b -> a -> b) -> b -> Arg a -> b)
-> (forall b a. (b -> a -> b) -> b -> Arg a -> b)
-> (forall a. (a -> a -> a) -> Arg a -> a)
-> (forall a. (a -> a -> a) -> Arg a -> a)
-> (forall a. Arg a -> [a])
-> (forall a. Arg a -> Bool)
-> (forall a. Arg a -> Int)
-> (forall a. Eq a => a -> Arg a -> Bool)
-> (forall a. Ord a => Arg a -> a)
-> (forall a. Ord a => Arg a -> a)
-> (forall a. Num a => Arg a -> a)
-> (forall a. Num a => Arg a -> a)
-> Foldable Arg
forall a. Eq a => a -> Arg a -> Bool
forall a. Num a => Arg a -> a
forall a. Ord a => Arg a -> a
forall m. Monoid m => Arg m -> m
forall a. Arg a -> Bool
forall a. Arg a -> Int
forall a. Arg a -> [a]
forall a. (a -> a -> a) -> Arg a -> a
forall m a. Monoid m => (a -> m) -> Arg a -> m
forall b a. (b -> a -> b) -> b -> Arg a -> b
forall a b. (a -> b -> b) -> b -> Arg a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Arg a -> a
$cproduct :: forall a. Num a => Arg a -> a
sum :: Arg a -> a
$csum :: forall a. Num a => Arg a -> a
minimum :: Arg a -> a
$cminimum :: forall a. Ord a => Arg a -> a
maximum :: Arg a -> a
$cmaximum :: forall a. Ord a => Arg a -> a
elem :: a -> Arg a -> Bool
$celem :: forall a. Eq a => a -> Arg a -> Bool
length :: Arg a -> Int
$clength :: forall a. Arg a -> Int
null :: Arg a -> Bool
$cnull :: forall a. Arg a -> Bool
toList :: Arg a -> [a]
$ctoList :: forall a. Arg a -> [a]
foldl1 :: (a -> a -> a) -> Arg a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Arg a -> a
foldr1 :: (a -> a -> a) -> Arg a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Arg a -> a
foldl' :: (b -> a -> b) -> b -> Arg a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Arg a -> b
foldl :: (b -> a -> b) -> b -> Arg a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Arg a -> b
foldr' :: (a -> b -> b) -> b -> Arg a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Arg a -> b
foldr :: (a -> b -> b) -> b -> Arg a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Arg a -> b
foldMap' :: (a -> m) -> Arg a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Arg a -> m
foldMap :: (a -> m) -> Arg a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Arg a -> m
fold :: Arg m -> m
$cfold :: forall m. Monoid m => Arg m -> m
Foldable, Functor Arg
Foldable Arg
Functor Arg
-> Foldable Arg
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Arg a -> f (Arg b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Arg (f a) -> f (Arg a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Arg a -> m (Arg b))
-> (forall (m :: * -> *) a. Monad m => Arg (m a) -> m (Arg a))
-> Traversable Arg
(a -> f b) -> Arg a -> f (Arg b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Arg (m a) -> m (Arg a)
forall (f :: * -> *) a. Applicative f => Arg (f a) -> f (Arg a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Arg a -> m (Arg b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Arg a -> f (Arg b)
sequence :: Arg (m a) -> m (Arg a)
$csequence :: forall (m :: * -> *) a. Monad m => Arg (m a) -> m (Arg a)
mapM :: (a -> m b) -> Arg a -> m (Arg b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Arg a -> m (Arg b)
sequenceA :: Arg (f a) -> f (Arg a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Arg (f a) -> f (Arg a)
traverse :: (a -> f b) -> Arg a -> f (Arg b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Arg a -> f (Arg b)
$cp2Traversable :: Foldable Arg
$cp1Traversable :: Functor Arg
Traversable)

instance Decoration Arg where
  traverseF :: (a -> m b) -> Arg a -> m (Arg b)
traverseF a -> m b
f (Arg ArgInfo
ai a
a) = ArgInfo -> b -> Arg b
forall e. ArgInfo -> e -> Arg e
Arg ArgInfo
ai (b -> Arg b) -> m b -> m (Arg b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> m b
f a
a

instance HasRange a => HasRange (Arg a) where
    getRange :: Arg a -> Range
getRange = a -> Range
forall a. HasRange a => a -> Range
getRange (a -> Range) -> (Arg a -> a) -> Arg a -> Range
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Arg a -> a
forall e. Arg e -> e
unArg

instance SetRange a => SetRange (Arg a) where
  setRange :: Range -> Arg a -> Arg a
setRange Range
r = (a -> a) -> Arg a -> Arg a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a) -> Arg a -> Arg a) -> (a -> a) -> Arg a -> Arg a
forall a b. (a -> b) -> a -> b
$ Range -> a -> a
forall a. SetRange a => Range -> a -> a
setRange Range
r

instance KillRange a => KillRange (Arg a) where
  killRange :: KillRangeT (Arg a)
killRange (Arg ArgInfo
info a
a) = (ArgInfo -> a -> Arg a) -> ArgInfo -> a -> Arg a
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 ArgInfo -> a -> Arg a
forall e. ArgInfo -> e -> Arg e
Arg ArgInfo
info a
a

-- Andreas, 2019-07-05, issue #3889
-- A dedicated equality for with-abstraction now exists,
-- thus, we can use intensional equality for Arg.
--
-- -- | Ignores 'Quantity', 'Relevance', 'Origin', and 'FreeVariables'.
-- --   Ignores content of argument if 'Irrelevant'.
-- --
-- instance Eq a => Eq (Arg a) where
--   Arg (ArgInfo h1 m1 _ _) x1 == Arg (ArgInfo h2 m2 _ _) x2 =
--     h1 == h2 && (isIrrelevant m1 || isIrrelevant m2 || x1 == x2)
--     -- Andreas, 2017-10-04, issue #2775, ignore irrelevant arguments during with-abstraction.
--     -- This is a hack, we should not use '(==)' in with-abstraction
--     -- and more generally not use it on Syntax.
--     -- Andrea: except for caching.

-- instance Show a => Show (Arg a) where
--     show (Arg (ArgInfo h (Modality r q) o fv) a) = showFVs fv $ showQ q $ showR r $ showO o $ showH h $ show a
--       where
--         showH Hidden       s = "{" ++ s ++ "}"
--         showH NotHidden    s = "(" ++ s ++ ")"
--         showH (Instance o) s = showOv o ++ "{{" ++ s ++ "}}"
--           where showOv YesOverlap = "overlap "
--                 showOv NoOverlap  = ""
--         showR r s = case r of
--           Irrelevant   -> "." ++ s
--           NonStrict    -> "?" ++ s
--           Relevant     -> "r" ++ s -- Andreas: I want to see it explicitly
--         showQ q s = case q of
--           Quantity0   -> "0" ++ s
--           Quantity1   -> "1" ++ s
--           Quantityω   -> "ω" ++ s
--         showO o s = case o of
--           UserWritten -> "u" ++ s
--           Inserted    -> "i" ++ s
--           Reflected   -> "g" ++ s -- generated by reflection
--           CaseSplit   -> "c" ++ s -- generated by case split
--           Substitution -> "s" ++ s
--         showFVs UnknownFVs    s = s
--         showFVs (KnownFVs fv) s = "fv" ++ show (IntSet.toList fv) ++ s

-- -- defined in Concrete.Pretty
-- instance Pretty a => Pretty (Arg a) where
--     pretty (Arg (ArgInfo h (Modality r q) o fv) a) = prettyFVs fv $ prettyQ q $ prettyR r $ prettyO o $ prettyH h $ pretty a
--       where
--         prettyH Hidden       s = "{" <> s <> "}"
--         prettyH NotHidden    s = "(" <> s <> ")"
--         prettyH (Instance o) s = prettyOv o <> "{{" <> s <> "}}"
--           where prettyOv YesOverlap = "overlap "
--                 prettyOv NoOverlap  = ""
--         prettyR r s = case r of
--           Irrelevant   -> "." <> s
--           NonStrict    -> "?" <> s
--           Relevant     -> "r" <> s -- Andreas: I want to see it explicitly
--         prettyQ q s = case q of
--           Quantity0   -> "0" <> s
--           Quantity1   -> "1" <> s
--           Quantityω   -> "ω" <> s
--         prettyO o s = case o of
--           UserWritten -> "u" <> s
--           Inserted    -> "i" <> s
--           Reflected   -> "g" <> s -- generated by reflection
--           CaseSplit   -> "c" <> s -- generated by case split
--           Substitution -> "s" <> s
--         prettyFVs UnknownFVs    s = s
--         prettyFVs (KnownFVs fv) s = "fv" <> pretty (IntSet.toList fv) <> s

instance NFData e => NFData (Arg e) where
  rnf :: Arg e -> ()
rnf (Arg ArgInfo
a e
b) = ArgInfo -> ()
forall a. NFData a => a -> ()
rnf ArgInfo
a () -> () -> ()
`seq` e -> ()
forall a. NFData a => a -> ()
rnf e
b

instance LensArgInfo (Arg a) where
  getArgInfo :: Arg a -> ArgInfo
getArgInfo        = Arg a -> ArgInfo
forall a. Arg a -> ArgInfo
argInfo
  setArgInfo :: ArgInfo -> Arg a -> Arg a
setArgInfo ArgInfo
ai Arg a
arg = Arg a
arg { argInfo :: ArgInfo
argInfo = ArgInfo
ai }
  mapArgInfo :: (ArgInfo -> ArgInfo) -> Arg a -> Arg a
mapArgInfo ArgInfo -> ArgInfo
f Arg a
arg  = Arg a
arg { argInfo :: ArgInfo
argInfo = ArgInfo -> ArgInfo
f (ArgInfo -> ArgInfo) -> ArgInfo -> ArgInfo
forall a b. (a -> b) -> a -> b
$ Arg a -> ArgInfo
forall a. Arg a -> ArgInfo
argInfo Arg a
arg }

-- The other lenses are defined through LensArgInfo

instance LensHiding (Arg e) where
  getHiding :: Arg e -> Hiding
getHiding = Arg e -> Hiding
forall a. LensArgInfo a => LensGet Hiding a
getHidingArgInfo
  setHiding :: Hiding -> Arg e -> Arg e
setHiding = Hiding -> Arg e -> Arg e
forall a. LensArgInfo a => LensSet Hiding a
setHidingArgInfo
  mapHiding :: (Hiding -> Hiding) -> Arg e -> Arg e
mapHiding = (Hiding -> Hiding) -> Arg e -> Arg e
forall a. LensArgInfo a => LensMap Hiding a
mapHidingArgInfo

instance LensModality (Arg e) where
  getModality :: Arg e -> Modality
getModality = Arg e -> Modality
forall a. LensArgInfo a => LensGet Modality a
getModalityArgInfo
  setModality :: Modality -> Arg e -> Arg e
setModality = Modality -> Arg e -> Arg e
forall a. LensArgInfo a => LensSet Modality a
setModalityArgInfo
  mapModality :: (Modality -> Modality) -> Arg e -> Arg e
mapModality = (Modality -> Modality) -> Arg e -> Arg e
forall a. LensArgInfo a => LensMap Modality a
mapModalityArgInfo

instance LensOrigin (Arg e) where
  getOrigin :: Arg e -> Origin
getOrigin = Arg e -> Origin
forall a. LensArgInfo a => LensGet Origin a
getOriginArgInfo
  setOrigin :: Origin -> Arg e -> Arg e
setOrigin = Origin -> Arg e -> Arg e
forall a. LensArgInfo a => LensSet Origin a
setOriginArgInfo
  mapOrigin :: (Origin -> Origin) -> Arg e -> Arg e
mapOrigin = (Origin -> Origin) -> Arg e -> Arg e
forall a. LensArgInfo a => LensMap Origin a
mapOriginArgInfo

instance LensFreeVariables (Arg e) where
  getFreeVariables :: Arg e -> FreeVariables
getFreeVariables = Arg e -> FreeVariables
forall a. LensArgInfo a => LensGet FreeVariables a
getFreeVariablesArgInfo
  setFreeVariables :: FreeVariables -> Arg e -> Arg e
setFreeVariables = FreeVariables -> Arg e -> Arg e
forall a. LensArgInfo a => LensSet FreeVariables a
setFreeVariablesArgInfo
  mapFreeVariables :: (FreeVariables -> FreeVariables) -> Arg e -> Arg e
mapFreeVariables = (FreeVariables -> FreeVariables) -> Arg e -> Arg e
forall a. LensArgInfo a => LensMap FreeVariables a
mapFreeVariablesArgInfo

-- Since we have LensModality, we get relevance and quantity by default

instance LensRelevance (Arg e) where
  getRelevance :: Arg e -> Relevance
getRelevance = Arg e -> Relevance
forall a. LensModality a => LensGet Relevance a
getRelevanceMod
  setRelevance :: Relevance -> Arg e -> Arg e
setRelevance = Relevance -> Arg e -> Arg e
forall a. LensModality a => LensSet Relevance a
setRelevanceMod
  mapRelevance :: (Relevance -> Relevance) -> Arg e -> Arg e
mapRelevance = (Relevance -> Relevance) -> Arg e -> Arg e
forall a. LensModality a => LensMap Relevance a
mapRelevanceMod

instance LensQuantity (Arg e) where
  getQuantity :: Arg e -> Quantity
getQuantity = Arg e -> Quantity
forall a. LensModality a => LensGet Quantity a
getQuantityMod
  setQuantity :: Quantity -> Arg e -> Arg e
setQuantity = Quantity -> Arg e -> Arg e
forall a. LensModality a => LensSet Quantity a
setQuantityMod
  mapQuantity :: (Quantity -> Quantity) -> Arg e -> Arg e
mapQuantity = (Quantity -> Quantity) -> Arg e -> Arg e
forall a. LensModality a => LensMap Quantity a
mapQuantityMod

instance LensCohesion (Arg e) where
  getCohesion :: Arg e -> Cohesion
getCohesion = Arg e -> Cohesion
forall a. LensModality a => LensGet Cohesion a
getCohesionMod
  setCohesion :: Cohesion -> Arg e -> Arg e
setCohesion = Cohesion -> Arg e -> Arg e
forall a. LensModality a => LensSet Cohesion a
setCohesionMod
  mapCohesion :: (Cohesion -> Cohesion) -> Arg e -> Arg e
mapCohesion = (Cohesion -> Cohesion) -> Arg e -> Arg e
forall a. LensModality a => LensMap Cohesion a
mapCohesionMod

defaultArg :: a -> Arg a
defaultArg :: a -> Arg a
defaultArg = ArgInfo -> a -> Arg a
forall e. ArgInfo -> e -> Arg e
Arg ArgInfo
defaultArgInfo

-- | @xs \`withArgsFrom\` args@ translates @xs@ into a list of 'Arg's,
-- using the elements in @args@ to fill in the non-'unArg' fields.
--
-- Precondition: The two lists should have equal length.

withArgsFrom :: [a] -> [Arg b] -> [Arg a]
[a]
xs withArgsFrom :: [a] -> [Arg b] -> [Arg a]
`withArgsFrom` [Arg b]
args =
  (a -> Arg b -> Arg a) -> [a] -> [Arg b] -> [Arg a]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith (\a
x Arg b
arg -> (b -> a) -> Arg b -> Arg a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (a -> b -> a
forall a b. a -> b -> a
const a
x) Arg b
arg) [a]
xs [Arg b]
args

withNamedArgsFrom :: [a] -> [NamedArg b] -> [NamedArg a]
[a]
xs withNamedArgsFrom :: [a] -> [NamedArg b] -> [NamedArg a]
`withNamedArgsFrom` [NamedArg b]
args =
  (a -> NamedArg b -> NamedArg a)
-> [a] -> [NamedArg b] -> [NamedArg a]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith (\a
x -> (Named NamedName b -> Named NamedName a)
-> NamedArg b -> NamedArg a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (a
x a -> Named NamedName b -> Named NamedName a
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$)) [a]
xs [NamedArg b]
args

---------------------------------------------------------------------------
-- * Names
---------------------------------------------------------------------------

class Eq a => Underscore a where
  underscore   :: a
  isUnderscore :: a -> Bool
  isUnderscore = (a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Underscore a => a
underscore)

instance Underscore String where
  underscore :: String
underscore = String
"_"

instance Underscore ByteString where
  underscore :: ByteString
underscore = String -> ByteString
ByteString.pack String
forall a. Underscore a => a
underscore

instance Underscore Doc where
  underscore :: Doc
underscore = String -> Doc
text String
forall a. Underscore a => a
underscore

---------------------------------------------------------------------------
-- * Named arguments
---------------------------------------------------------------------------

-- | Something potentially carrying a name.
data Named name a =
    Named { Named name a -> Maybe name
nameOf     :: Maybe name
          , Named name a -> a
namedThing :: a
          }
    deriving (Named name a -> Named name a -> Bool
(Named name a -> Named name a -> Bool)
-> (Named name a -> Named name a -> Bool) -> Eq (Named name a)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall name a.
(Eq name, Eq a) =>
Named name a -> Named name a -> Bool
/= :: Named name a -> Named name a -> Bool
$c/= :: forall name a.
(Eq name, Eq a) =>
Named name a -> Named name a -> Bool
== :: Named name a -> Named name a -> Bool
$c== :: forall name a.
(Eq name, Eq a) =>
Named name a -> Named name a -> Bool
Eq, Eq (Named name a)
Eq (Named name a)
-> (Named name a -> Named name a -> Ordering)
-> (Named name a -> Named name a -> Bool)
-> (Named name a -> Named name a -> Bool)
-> (Named name a -> Named name a -> Bool)
-> (Named name a -> Named name a -> Bool)
-> (Named name a -> Named name a -> Named name a)
-> (Named name a -> Named name a -> Named name a)
-> Ord (Named name a)
Named name a -> Named name a -> Bool
Named name a -> Named name a -> Ordering
Named name a -> Named name a -> Named name a
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
forall name a. (Ord name, Ord a) => Eq (Named name a)
forall name a.
(Ord name, Ord a) =>
Named name a -> Named name a -> Bool
forall name a.
(Ord name, Ord a) =>
Named name a -> Named name a -> Ordering
forall name a.
(Ord name, Ord a) =>
Named name a -> Named name a -> Named name a
min :: Named name a -> Named name a -> Named name a
$cmin :: forall name a.
(Ord name, Ord a) =>
Named name a -> Named name a -> Named name a
max :: Named name a -> Named name a -> Named name a
$cmax :: forall name a.
(Ord name, Ord a) =>
Named name a -> Named name a -> Named name a
>= :: Named name a -> Named name a -> Bool
$c>= :: forall name a.
(Ord name, Ord a) =>
Named name a -> Named name a -> Bool
> :: Named name a -> Named name a -> Bool
$c> :: forall name a.
(Ord name, Ord a) =>
Named name a -> Named name a -> Bool
<= :: Named name a -> Named name a -> Bool
$c<= :: forall name a.
(Ord name, Ord a) =>
Named name a -> Named name a -> Bool
< :: Named name a -> Named name a -> Bool
$c< :: forall name a.
(Ord name, Ord a) =>
Named name a -> Named name a -> Bool
compare :: Named name a -> Named name a -> Ordering
$ccompare :: forall name a.
(Ord name, Ord a) =>
Named name a -> Named name a -> Ordering
$cp1Ord :: forall name a. (Ord name, Ord a) => Eq (Named name a)
Ord, Int -> Named name a -> ShowS
[Named name a] -> ShowS
Named name a -> String
(Int -> Named name a -> ShowS)
-> (Named name a -> String)
-> ([Named name a] -> ShowS)
-> Show (Named name a)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall name a. (Show name, Show a) => Int -> Named name a -> ShowS
forall name a. (Show name, Show a) => [Named name a] -> ShowS
forall name a. (Show name, Show a) => Named name a -> String
showList :: [Named name a] -> ShowS
$cshowList :: forall name a. (Show name, Show a) => [Named name a] -> ShowS
show :: Named name a -> String
$cshow :: forall name a. (Show name, Show a) => Named name a -> String
showsPrec :: Int -> Named name a -> ShowS
$cshowsPrec :: forall name a. (Show name, Show a) => Int -> Named name a -> ShowS
Show, Typeable (Named name a)
DataType
Constr
Typeable (Named name a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Named name a -> c (Named name a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Named name a))
-> (Named name a -> Constr)
-> (Named name a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Named name a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Named name a)))
-> ((forall b. Data b => b -> b) -> Named name a -> Named name a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Named name a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Named name a -> r)
-> (forall u. (forall d. Data d => d -> u) -> Named name a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Named name a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Named name a -> m (Named name a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Named name a -> m (Named name a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Named name a -> m (Named name a))
-> Data (Named name a)
Named name a -> DataType
Named name a -> Constr
(forall b. Data b => b -> b) -> Named name a -> Named name a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Named name a -> c (Named name a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Named name a)
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Named name a))
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) -> Named name a -> u
forall u. (forall d. Data d => d -> u) -> Named name a -> [u]
forall name a. (Data name, Data a) => Typeable (Named name a)
forall name a. (Data name, Data a) => Named name a -> DataType
forall name a. (Data name, Data a) => Named name a -> Constr
forall name a.
(Data name, Data a) =>
(forall b. Data b => b -> b) -> Named name a -> Named name a
forall name a u.
(Data name, Data a) =>
Int -> (forall d. Data d => d -> u) -> Named name a -> u
forall name a u.
(Data name, Data a) =>
(forall d. Data d => d -> u) -> Named name a -> [u]
forall name a r r'.
(Data name, Data a) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Named name a -> r
forall name a r r'.
(Data name, Data a) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Named name a -> r
forall name a (m :: * -> *).
(Data name, Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Named name a -> m (Named name a)
forall name a (m :: * -> *).
(Data name, Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Named name a -> m (Named name a)
forall name a (c :: * -> *).
(Data name, Data a) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Named name a)
forall name a (c :: * -> *).
(Data name, Data a) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Named name a -> c (Named name a)
forall name a (t :: * -> *) (c :: * -> *).
(Data name, Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Named name a))
forall name a (t :: * -> * -> *) (c :: * -> *).
(Data name, Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Named name a))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Named name a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Named name a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Named name a -> m (Named name a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Named name a -> m (Named name a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Named name a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Named name a -> c (Named name a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Named name a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Named name a))
$cNamed :: Constr
$tNamed :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Named name a -> m (Named name a)
$cgmapMo :: forall name a (m :: * -> *).
(Data name, Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Named name a -> m (Named name a)
gmapMp :: (forall d. Data d => d -> m d) -> Named name a -> m (Named name a)
$cgmapMp :: forall name a (m :: * -> *).
(Data name, Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Named name a -> m (Named name a)
gmapM :: (forall d. Data d => d -> m d) -> Named name a -> m (Named name a)
$cgmapM :: forall name a (m :: * -> *).
(Data name, Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Named name a -> m (Named name a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Named name a -> u
$cgmapQi :: forall name a u.
(Data name, Data a) =>
Int -> (forall d. Data d => d -> u) -> Named name a -> u
gmapQ :: (forall d. Data d => d -> u) -> Named name a -> [u]
$cgmapQ :: forall name a u.
(Data name, Data a) =>
(forall d. Data d => d -> u) -> Named name a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Named name a -> r
$cgmapQr :: forall name a r r'.
(Data name, Data a) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Named name a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Named name a -> r
$cgmapQl :: forall name a r r'.
(Data name, Data a) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Named name a -> r
gmapT :: (forall b. Data b => b -> b) -> Named name a -> Named name a
$cgmapT :: forall name a.
(Data name, Data a) =>
(forall b. Data b => b -> b) -> Named name a -> Named name a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Named name a))
$cdataCast2 :: forall name a (t :: * -> * -> *) (c :: * -> *).
(Data name, Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Named name a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Named name a))
$cdataCast1 :: forall name a (t :: * -> *) (c :: * -> *).
(Data name, Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Named name a))
dataTypeOf :: Named name a -> DataType
$cdataTypeOf :: forall name a. (Data name, Data a) => Named name a -> DataType
toConstr :: Named name a -> Constr
$ctoConstr :: forall name a. (Data name, Data a) => Named name a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Named name a)
$cgunfold :: forall name a (c :: * -> *).
(Data name, Data a) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Named name a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Named name a -> c (Named name a)
$cgfoldl :: forall name a (c :: * -> *).
(Data name, Data a) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Named name a -> c (Named name a)
$cp1Data :: forall name a. (Data name, Data a) => Typeable (Named name a)
Data, a -> Named name b -> Named name a
(a -> b) -> Named name a -> Named name b
(forall a b. (a -> b) -> Named name a -> Named name b)
-> (forall a b. a -> Named name b -> Named name a)
-> Functor (Named name)
forall a b. a -> Named name b -> Named name a
forall a b. (a -> b) -> Named name a -> Named name b
forall name a b. a -> Named name b -> Named name a
forall name a b. (a -> b) -> Named name a -> Named name b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Named name b -> Named name a
$c<$ :: forall name a b. a -> Named name b -> Named name a
fmap :: (a -> b) -> Named name a -> Named name b
$cfmap :: forall name a b. (a -> b) -> Named name a -> Named name b
Functor, Named name a -> Bool
(a -> m) -> Named name a -> m
(a -> b -> b) -> b -> Named name a -> b
(forall m. Monoid m => Named name m -> m)
-> (forall m a. Monoid m => (a -> m) -> Named name a -> m)
-> (forall m a. Monoid m => (a -> m) -> Named name a -> m)
-> (forall a b. (a -> b -> b) -> b -> Named name a -> b)
-> (forall a b. (a -> b -> b) -> b -> Named name a -> b)
-> (forall b a. (b -> a -> b) -> b -> Named name a -> b)
-> (forall b a. (b -> a -> b) -> b -> Named name a -> b)
-> (forall a. (a -> a -> a) -> Named name a -> a)
-> (forall a. (a -> a -> a) -> Named name a -> a)
-> (forall a. Named name a -> [a])
-> (forall a. Named name a -> Bool)
-> (forall a. Named name a -> Int)
-> (forall a. Eq a => a -> Named name a -> Bool)
-> (forall a. Ord a => Named name a -> a)
-> (forall a. Ord a => Named name a -> a)
-> (forall a. Num a => Named name a -> a)
-> (forall a. Num a => Named name a -> a)
-> Foldable (Named name)
forall a. Eq a => a -> Named name a -> Bool
forall a. Num a => Named name a -> a
forall a. Ord a => Named name a -> a
forall m. Monoid m => Named name m -> m
forall a. Named name a -> Bool
forall a. Named name a -> Int
forall a. Named name a -> [a]
forall a. (a -> a -> a) -> Named name a -> a
forall name a. Eq a => a -> Named name a -> Bool
forall name a. Num a => Named name a -> a
forall name a. Ord a => Named name a -> a
forall m a. Monoid m => (a -> m) -> Named name a -> m
forall name m. Monoid m => Named name m -> m
forall name a. Named name a -> Bool
forall name a. Named name a -> Int
forall name a. Named name a -> [a]
forall b a. (b -> a -> b) -> b -> Named name a -> b
forall a b. (a -> b -> b) -> b -> Named name a -> b
forall name a. (a -> a -> a) -> Named name a -> a
forall name m a. Monoid m => (a -> m) -> Named name a -> m
forall name b a. (b -> a -> b) -> b -> Named name a -> b
forall name a b. (a -> b -> b) -> b -> Named name a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Named name a -> a
$cproduct :: forall name a. Num a => Named name a -> a
sum :: Named name a -> a
$csum :: forall name a. Num a => Named name a -> a
minimum :: Named name a -> a
$cminimum :: forall name a. Ord a => Named name a -> a
maximum :: Named name a -> a
$cmaximum :: forall name a. Ord a => Named name a -> a
elem :: a -> Named name a -> Bool
$celem :: forall name a. Eq a => a -> Named name a -> Bool
length :: Named name a -> Int
$clength :: forall name a. Named name a -> Int
null :: Named name a -> Bool
$cnull :: forall name a. Named name a -> Bool
toList :: Named name a -> [a]
$ctoList :: forall name a. Named name a -> [a]
foldl1 :: (a -> a -> a) -> Named name a -> a
$cfoldl1 :: forall name a. (a -> a -> a) -> Named name a -> a
foldr1 :: (a -> a -> a) -> Named name a -> a
$cfoldr1 :: forall name a. (a -> a -> a) -> Named name a -> a
foldl' :: (b -> a -> b) -> b -> Named name a -> b
$cfoldl' :: forall name b a. (b -> a -> b) -> b -> Named name a -> b
foldl :: (b -> a -> b) -> b -> Named name a -> b
$cfoldl :: forall name b a. (b -> a -> b) -> b -> Named name a -> b
foldr' :: (a -> b -> b) -> b -> Named name a -> b
$cfoldr' :: forall name a b. (a -> b -> b) -> b -> Named name a -> b
foldr :: (a -> b -> b) -> b -> Named name a -> b
$cfoldr :: forall name a b. (a -> b -> b) -> b -> Named name a -> b
foldMap' :: (a -> m) -> Named name a -> m
$cfoldMap' :: forall name m a. Monoid m => (a -> m) -> Named name a -> m
foldMap :: (a -> m) -> Named name a -> m
$cfoldMap :: forall name m a. Monoid m => (a -> m) -> Named name a -> m
fold :: Named name m -> m
$cfold :: forall name m. Monoid m => Named name m -> m
Foldable, Functor (Named name)
Foldable (Named name)
Functor (Named name)
-> Foldable (Named name)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Named name a -> f (Named name b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Named name (f a) -> f (Named name a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Named name a -> m (Named name b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Named name (m a) -> m (Named name a))
-> Traversable (Named name)
(a -> f b) -> Named name a -> f (Named name b)
forall name. Functor (Named name)
forall name. Foldable (Named name)
forall name (m :: * -> *) a.
Monad m =>
Named name (m a) -> m (Named name a)
forall name (f :: * -> *) a.
Applicative f =>
Named name (f a) -> f (Named name a)
forall name (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Named name a -> m (Named name b)
forall name (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Named name a -> f (Named name b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
Named name (m a) -> m (Named name a)
forall (f :: * -> *) a.
Applicative f =>
Named name (f a) -> f (Named name a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Named name a -> m (Named name b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Named name a -> f (Named name b)
sequence :: Named name (m a) -> m (Named name a)
$csequence :: forall name (m :: * -> *) a.
Monad m =>
Named name (m a) -> m (Named name a)
mapM :: (a -> m b) -> Named name a -> m (Named name b)
$cmapM :: forall name (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Named name a -> m (Named name b)
sequenceA :: Named name (f a) -> f (Named name a)
$csequenceA :: forall name (f :: * -> *) a.
Applicative f =>
Named name (f a) -> f (Named name a)
traverse :: (a -> f b) -> Named name a -> f (Named name b)
$ctraverse :: forall name (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Named name a -> f (Named name b)
$cp2Traversable :: forall name. Foldable (Named name)
$cp1Traversable :: forall name. Functor (Named name)
Traversable)

-- | Standard naming.
type Named_ = Named NamedName

-- | Standard argument names.
type NamedName = WithOrigin (Ranged ArgName)

-- | Equality of argument names of things modulo 'Range' and 'Origin'.
sameName :: NamedName -> NamedName -> Bool
sameName :: NamedName -> NamedName -> Bool
sameName = String -> String -> Bool
forall a. Eq a => a -> a -> Bool
(==) (String -> String -> Bool)
-> (NamedName -> String) -> NamedName -> NamedName -> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` (Ranged String -> String
forall a. Ranged a -> a
rangedThing (Ranged String -> String)
-> (NamedName -> Ranged String) -> NamedName -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NamedName -> Ranged String
forall a. WithOrigin a -> a
woThing)

unnamed :: a -> Named name a
unnamed :: a -> Named name a
unnamed = Maybe name -> a -> Named name a
forall name a. Maybe name -> a -> Named name a
Named Maybe name
forall a. Maybe a
Nothing

isUnnamed :: Named name a -> Maybe a
isUnnamed :: Named name a -> Maybe a
isUnnamed = \case
  Named Maybe name
Nothing a
a -> a -> Maybe a
forall a. a -> Maybe a
Just a
a
  Named Just{}  a
a -> Maybe a
forall a. Maybe a
Nothing

named :: name -> a -> Named name a
named :: name -> a -> Named name a
named = Maybe name -> a -> Named name a
forall name a. Maybe name -> a -> Named name a
Named (Maybe name -> a -> Named name a)
-> (name -> Maybe name) -> name -> a -> Named name a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. name -> Maybe name
forall a. a -> Maybe a
Just

userNamed :: Ranged ArgName -> a -> Named_ a
userNamed :: Ranged String -> a -> Named_ a
userNamed = Maybe NamedName -> a -> Named_ a
forall name a. Maybe name -> a -> Named name a
Named (Maybe NamedName -> a -> Named_ a)
-> (Ranged String -> Maybe NamedName)
-> Ranged String
-> a
-> Named_ a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NamedName -> Maybe NamedName
forall a. a -> Maybe a
Just (NamedName -> Maybe NamedName)
-> (Ranged String -> NamedName) -> Ranged String -> Maybe NamedName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Origin -> Ranged String -> NamedName
forall a. Origin -> a -> WithOrigin a
WithOrigin Origin
UserWritten

-- | Accessor/editor for the 'nameOf' component.
class LensNamed a where
  -- | The type of the name
  type NameOf a
  lensNamed :: Lens' (Maybe (NameOf a)) a

  -- Lenses lift through decorations:
  default lensNamed :: (Decoration f, LensNamed b, NameOf b ~ NameOf a, f b ~ a) => Lens' (Maybe (NameOf a)) a
  lensNamed = (b -> f b) -> f b -> f (f b)
forall (t :: * -> *) (m :: * -> *) a b.
(Decoration t, Functor m) =>
(a -> m b) -> t a -> m (t b)
traverseF ((b -> f b) -> f b -> f (f b))
-> ((Maybe (NameOf b) -> f (Maybe (NameOf b))) -> b -> f b)
-> (Maybe (NameOf b) -> f (Maybe (NameOf b)))
-> f b
-> f (f b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe (NameOf b) -> f (Maybe (NameOf b))) -> b -> f b
forall a. LensNamed a => Lens' (Maybe (NameOf a)) a
lensNamed

instance LensNamed a => LensNamed (Arg a) where
  type NameOf (Arg a) = NameOf a

instance LensNamed (Maybe a) where
  type NameOf (Maybe a) = a
  lensNamed :: (Maybe (NameOf (Maybe a)) -> f (Maybe (NameOf (Maybe a))))
-> Maybe a -> f (Maybe a)
lensNamed = (Maybe (NameOf (Maybe a)) -> f (Maybe (NameOf (Maybe a))))
-> Maybe a -> f (Maybe a)
forall a. a -> a
id

instance LensNamed (Named name a) where
  type NameOf (Named name a) = name

  lensNamed :: (Maybe (NameOf (Named name a))
 -> f (Maybe (NameOf (Named name a))))
-> Named name a -> f (Named name a)
lensNamed Maybe (NameOf (Named name a)) -> f (Maybe (NameOf (Named name a)))
f (Named Maybe name
mn a
a) = Maybe (NameOf (Named name a)) -> f (Maybe (NameOf (Named name a)))
f Maybe name
Maybe (NameOf (Named name a))
mn f (Maybe name) -> (Maybe name -> Named name a) -> f (Named name a)
forall (m :: * -> *) a b. Functor m => m a -> (a -> b) -> m b
<&> \ Maybe name
mn' -> Maybe name -> a -> Named name a
forall name a. Maybe name -> a -> Named name a
Named Maybe name
mn' a
a

getNameOf :: LensNamed a => a -> Maybe (NameOf a)
getNameOf :: a -> Maybe (NameOf a)
getNameOf a
a = a
a a -> Lens' (Maybe (NameOf a)) a -> Maybe (NameOf a)
forall o i. o -> Lens' i o -> i
^. forall a. LensNamed a => Lens' (Maybe (NameOf a)) a
Lens' (Maybe (NameOf a)) a
lensNamed

setNameOf :: LensNamed a => Maybe (NameOf a) -> a -> a
setNameOf :: Maybe (NameOf a) -> a -> a
setNameOf = Lens' (Maybe (NameOf a)) a -> Maybe (NameOf a) -> a -> a
forall i o. Lens' i o -> LensSet i o
set forall a. LensNamed a => Lens' (Maybe (NameOf a)) a
Lens' (Maybe (NameOf a)) a
lensNamed

mapNameOf :: LensNamed a => (Maybe (NameOf a) -> Maybe (NameOf a)) -> a -> a
mapNameOf :: (Maybe (NameOf a) -> Maybe (NameOf a)) -> a -> a
mapNameOf = Lens' (Maybe (NameOf a)) a
-> (Maybe (NameOf a) -> Maybe (NameOf a)) -> a -> a
forall i o. Lens' i o -> LensMap i o
over forall a. LensNamed a => Lens' (Maybe (NameOf a)) a
Lens' (Maybe (NameOf a)) a
lensNamed
bareNameOf :: (LensNamed a, NameOf a ~ NamedName) => a -> Maybe ArgName
bareNameOf :: a -> Maybe String
bareNameOf a
a = Ranged String -> String
forall a. Ranged a -> a
rangedThing (Ranged String -> String)
-> (NamedName -> Ranged String) -> NamedName -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NamedName -> Ranged String
forall a. WithOrigin a -> a
woThing (NamedName -> String) -> Maybe NamedName -> Maybe String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> Maybe (NameOf a)
forall a. LensNamed a => a -> Maybe (NameOf a)
getNameOf a
a

bareNameWithDefault :: (LensNamed a, NameOf a ~ NamedName) => ArgName -> a -> ArgName
bareNameWithDefault :: String -> a -> String
bareNameWithDefault String
x a
a = String -> (NamedName -> String) -> Maybe NamedName -> String
forall b a. b -> (a -> b) -> Maybe a -> b
maybe String
x (Ranged String -> String
forall a. Ranged a -> a
rangedThing (Ranged String -> String)
-> (NamedName -> Ranged String) -> NamedName -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NamedName -> Ranged String
forall a. WithOrigin a -> a
woThing) (Maybe NamedName -> String) -> Maybe NamedName -> String
forall a b. (a -> b) -> a -> b
$ a -> Maybe (NameOf a)
forall a. LensNamed a => a -> Maybe (NameOf a)
getNameOf a
a

-- | Equality of argument names of things modulo 'Range' and 'Origin'.
namedSame :: (LensNamed a, LensNamed b, NameOf a ~ NamedName, NameOf b ~ NamedName) => a -> b -> Bool
namedSame :: a -> b -> Bool
namedSame a
a b
b = case (a -> Maybe (NameOf a)
forall a. LensNamed a => a -> Maybe (NameOf a)
getNameOf a
a, b -> Maybe (NameOf b)
forall a. LensNamed a => a -> Maybe (NameOf a)
getNameOf b
b) of
  (Maybe NamedName
Nothing, Maybe NamedName
Nothing) -> Bool
True
  (Just NamedName
x , Just NamedName
y ) -> NamedName -> NamedName -> Bool
sameName NamedName
x NamedName
y
  (Maybe NamedName, Maybe NamedName)
_ -> Bool
False

-- | Does an argument @arg@ fit the shape @dom@ of the next expected argument?
--
--   The hiding has to match, and if the argument has a name, it should match
--   the name of the domain.
--
--   'Nothing' should be '__IMPOSSIBLE__', so use as
--   @@
--     fromMaybe __IMPOSSIBLE__ $ fittingNamedArg arg dom
--   @@
--
fittingNamedArg
  :: ( LensNamed arg, NameOf arg ~ NamedName, LensHiding arg
     , LensNamed dom, NameOf dom ~ NamedName, LensHiding dom )
  => arg -> dom -> Maybe Bool
fittingNamedArg :: arg -> dom -> Maybe Bool
fittingNamedArg arg
arg dom
dom
    | Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ arg -> dom -> Bool
forall a b. (LensHiding a, LensHiding b) => a -> b -> Bool
sameHiding arg
arg dom
dom = Maybe Bool
no
    | arg -> Bool
forall a. LensHiding a => a -> Bool
visible arg
arg              = Maybe Bool
yes
    | Bool
otherwise =
        Maybe String -> Maybe Bool -> (String -> Maybe Bool) -> Maybe Bool
forall a b. Maybe a -> b -> (a -> b) -> b
caseMaybe (arg -> Maybe String
forall a. (LensNamed a, NameOf a ~ NamedName) => a -> Maybe String
bareNameOf arg
arg) Maybe Bool
yes        ((String -> Maybe Bool) -> Maybe Bool)
-> (String -> Maybe Bool) -> Maybe Bool
forall a b. (a -> b) -> a -> b
$ \ String
x ->
        Maybe String -> Maybe Bool -> (String -> Maybe Bool) -> Maybe Bool
forall a b. Maybe a -> b -> (a -> b) -> b
caseMaybe (dom -> Maybe String
forall a. (LensNamed a, NameOf a ~ NamedName) => a -> Maybe String
bareNameOf dom
dom) Maybe Bool
forall a. Maybe a
impossible ((String -> Maybe Bool) -> Maybe Bool)
-> (String -> Maybe Bool) -> Maybe Bool
forall a b. (a -> b) -> a -> b
$ \ String
y ->
        Bool -> Maybe Bool
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool -> Maybe Bool) -> Bool -> Maybe Bool
forall a b. (a -> b) -> a -> b
$ String
x String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
y
  where
    yes :: Maybe Bool
yes = Bool -> Maybe Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True
    no :: Maybe Bool
no  = Bool -> Maybe Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
    impossible :: Maybe a
impossible = Maybe a
forall a. Maybe a
Nothing

-- Standard instances for 'Named':

instance Decoration (Named name) where
  traverseF :: (a -> m b) -> Named name a -> m (Named name b)
traverseF a -> m b
f (Named Maybe name
n a
a) = Maybe name -> b -> Named name b
forall name a. Maybe name -> a -> Named name a
Named Maybe name
n (b -> Named name b) -> m b -> m (Named name b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> m b
f a
a

instance HasRange a => HasRange (Named name a) where
    getRange :: Named name a -> Range
getRange = a -> Range
forall a. HasRange a => a -> Range
getRange (a -> Range) -> (Named name a -> a) -> Named name a -> Range
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Named name a -> a
forall name a. Named name a -> a
namedThing

instance SetRange a => SetRange (Named name a) where
  setRange :: Range -> Named name a -> Named name a
setRange Range
r = (a -> a) -> Named name a -> Named name a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a) -> Named name a -> Named name a)
-> (a -> a) -> Named name a -> Named name a
forall a b. (a -> b) -> a -> b
$ Range -> a -> a
forall a. SetRange a => Range -> a -> a
setRange Range
r

instance (KillRange name, KillRange a) => KillRange (Named name a) where
  killRange :: KillRangeT (Named name a)
killRange (Named Maybe name
n a
a) = Maybe name -> a -> Named name a
forall name a. Maybe name -> a -> Named name a
Named (KillRangeT (Maybe name)
forall a. KillRange a => KillRangeT a
killRange Maybe name
n) (KillRangeT a
forall a. KillRange a => KillRangeT a
killRange a
a)

-- instance Show a => Show (Named_ a) where
--     show (Named Nothing a)  = show a
--     show (Named (Just n) a) = rawNameToString (rangedThing n) ++ " = " ++ show a

-- -- Defined in Concrete.Pretty
-- instance Pretty a => Pretty (Named_ a) where
--     pretty (Named Nothing a)  = pretty a
--     pretty (Named (Just n) a) = text (rawNameToString (rangedThing n)) <+> "=" <+> pretty a

instance (NFData name, NFData a) => NFData (Named name a) where
  rnf :: Named name a -> ()
rnf (Named Maybe name
a a
b) = Maybe name -> ()
forall a. NFData a => a -> ()
rnf Maybe name
a () -> () -> ()
`seq` a -> ()
forall a. NFData a => a -> ()
rnf a
b

-- | Only 'Hidden' arguments can have names.
type NamedArg a = Arg (Named_ a)

-- | Get the content of a 'NamedArg'.
namedArg :: NamedArg a -> a
namedArg :: NamedArg a -> a
namedArg = Named NamedName a -> a
forall name a. Named name a -> a
namedThing (Named NamedName a -> a)
-> (NamedArg a -> Named NamedName a) -> NamedArg a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NamedArg a -> Named NamedName a
forall e. Arg e -> e
unArg

defaultNamedArg :: a -> NamedArg a
defaultNamedArg :: a -> NamedArg a
defaultNamedArg = ArgInfo -> a -> NamedArg a
forall a. ArgInfo -> a -> NamedArg a
unnamedArg ArgInfo
defaultArgInfo

unnamedArg :: ArgInfo -> a -> NamedArg a
unnamedArg :: ArgInfo -> a -> NamedArg a
unnamedArg ArgInfo
info = ArgInfo -> Named NamedName a -> NamedArg a
forall e. ArgInfo -> e -> Arg e
Arg ArgInfo
info (Named NamedName a -> NamedArg a)
-> (a -> Named NamedName a) -> a -> NamedArg a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Named NamedName a
forall a name. a -> Named name a
unnamed

-- | The functor instance for 'NamedArg' would be ambiguous,
--   so we give it another name here.
updateNamedArg :: (a -> b) -> NamedArg a -> NamedArg b
updateNamedArg :: (a -> b) -> NamedArg a -> NamedArg b
updateNamedArg = (Named NamedName a -> Named NamedName b)
-> NamedArg a -> NamedArg b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Named NamedName a -> Named NamedName b)
 -> NamedArg a -> NamedArg b)
-> ((a -> b) -> Named NamedName a -> Named NamedName b)
-> (a -> b)
-> NamedArg a
-> NamedArg b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> Named NamedName a -> Named NamedName b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap

updateNamedArgA :: Applicative f => (a -> f b) -> NamedArg a -> f (NamedArg b)
updateNamedArgA :: (a -> f b) -> NamedArg a -> f (NamedArg b)
updateNamedArgA = (Named NamedName a -> f (Named NamedName b))
-> NamedArg a -> f (NamedArg b)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((Named NamedName a -> f (Named NamedName b))
 -> NamedArg a -> f (NamedArg b))
-> ((a -> f b) -> Named NamedName a -> f (Named NamedName b))
-> (a -> f b)
-> NamedArg a
-> f (NamedArg b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> f b) -> Named NamedName a -> f (Named NamedName b)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse

-- | @setNamedArg a b = updateNamedArg (const b) a@
setNamedArg :: NamedArg a -> b -> NamedArg b
setNamedArg :: NamedArg a -> b -> NamedArg b
setNamedArg NamedArg a
a b
b = (b
b b -> Named NamedName a -> Named NamedName b
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$) (Named NamedName a -> Named NamedName b)
-> NamedArg a -> NamedArg b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NamedArg a
a

-- ** ArgName

-- | Names in binders and arguments.
type ArgName = String

argNameToString :: ArgName -> String
argNameToString :: ShowS
argNameToString = ShowS
forall a. a -> a
id

stringToArgName :: String -> ArgName
stringToArgName :: ShowS
stringToArgName = ShowS
forall a. a -> a
id

appendArgNames :: ArgName -> ArgName -> ArgName
appendArgNames :: String -> ShowS
appendArgNames = String -> ShowS
forall a. [a] -> [a] -> [a]
(++)

---------------------------------------------------------------------------
-- * Range decoration.
---------------------------------------------------------------------------

-- | Thing with range info.
data Ranged a = Ranged
  { Ranged a -> Range
rangeOf     :: Range
  , Ranged a -> a
rangedThing :: a
  }
  deriving (Typeable (Ranged a)
DataType
Constr
Typeable (Ranged a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Ranged a -> c (Ranged a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Ranged a))
-> (Ranged a -> Constr)
-> (Ranged a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Ranged a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Ranged a)))
-> ((forall b. Data b => b -> b) -> Ranged a -> Ranged a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Ranged a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Ranged a -> r)
-> (forall u. (forall d. Data d => d -> u) -> Ranged a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Ranged a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a))
-> Data (Ranged a)
Ranged a -> DataType
Ranged a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Ranged a))
(forall b. Data b => b -> b) -> Ranged a -> Ranged a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Ranged a -> c (Ranged a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Ranged a)
forall a. Data a => Typeable (Ranged a)
forall a. Data a => Ranged a -> DataType
forall a. Data a => Ranged a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> Ranged a -> Ranged a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Ranged a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> Ranged a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Ranged a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Ranged a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Ranged a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Ranged a -> c (Ranged a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Ranged a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Ranged a))
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) -> Ranged a -> u
forall u. (forall d. Data d => d -> u) -> Ranged a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Ranged a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Ranged a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Ranged a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Ranged a -> c (Ranged a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Ranged a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Ranged a))
$cRanged :: Constr
$tRanged :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a)
gmapMp :: (forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a)
gmapM :: (forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Ranged a -> m (Ranged a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Ranged a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Ranged a -> u
gmapQ :: (forall d. Data d => d -> u) -> Ranged a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> Ranged a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Ranged a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Ranged a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Ranged a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Ranged a -> r
gmapT :: (forall b. Data b => b -> b) -> Ranged a -> Ranged a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Ranged a -> Ranged a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Ranged a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Ranged a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Ranged a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Ranged a))
dataTypeOf :: Ranged a -> DataType
$cdataTypeOf :: forall a. Data a => Ranged a -> DataType
toConstr :: Ranged a -> Constr
$ctoConstr :: forall a. Data a => Ranged a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Ranged a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Ranged a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Ranged a -> c (Ranged a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Ranged a -> c (Ranged a)
$cp1Data :: forall a. Data a => Typeable (Ranged a)
Data, Int -> Ranged a -> ShowS
[Ranged a] -> ShowS
Ranged a -> String
(Int -> Ranged a -> ShowS)
-> (Ranged a -> String) -> ([Ranged a] -> ShowS) -> Show (Ranged a)
forall a. Show a => Int -> Ranged a -> ShowS
forall a. Show a => [Ranged a] -> ShowS
forall a. Show a => Ranged a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ranged a] -> ShowS
$cshowList :: forall a. Show a => [Ranged a] -> ShowS
show :: Ranged a -> String
$cshow :: forall a. Show a => Ranged a -> String
showsPrec :: Int -> Ranged a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Ranged a -> ShowS
Show, a -> Ranged b -> Ranged a
(a -> b) -> Ranged a -> Ranged b
(forall a b. (a -> b) -> Ranged a -> Ranged b)
-> (forall a b. a -> Ranged b -> Ranged a) -> Functor Ranged
forall a b. a -> Ranged b -> Ranged a
forall a b. (a -> b) -> Ranged a -> Ranged b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Ranged b -> Ranged a
$c<$ :: forall a b. a -> Ranged b -> Ranged a
fmap :: (a -> b) -> Ranged a -> Ranged b
$cfmap :: forall a b. (a -> b) -> Ranged a -> Ranged b
Functor, Ranged a -> Bool
(a -> m) -> Ranged a -> m
(a -> b -> b) -> b -> Ranged a -> b
(forall m. Monoid m => Ranged m -> m)
-> (forall m a. Monoid m => (a -> m) -> Ranged a -> m)
-> (forall m a. Monoid m => (a -> m) -> Ranged a -> m)
-> (forall a b. (a -> b -> b) -> b -> Ranged a -> b)
-> (forall a b. (a -> b -> b) -> b -> Ranged a -> b)
-> (forall b a. (b -> a -> b) -> b -> Ranged a -> b)
-> (forall b a. (b -> a -> b) -> b -> Ranged a -> b)
-> (forall a. (a -> a -> a) -> Ranged a -> a)
-> (forall a. (a -> a -> a) -> Ranged a -> a)
-> (forall a. Ranged a -> [a])
-> (forall a. Ranged a -> Bool)
-> (forall a. Ranged a -> Int)
-> (forall a. Eq a => a -> Ranged a -> Bool)
-> (forall a. Ord a => Ranged a -> a)
-> (forall a. Ord a => Ranged a -> a)
-> (forall a. Num a => Ranged a -> a)
-> (forall a. Num a => Ranged a -> a)
-> Foldable Ranged
forall a. Eq a => a -> Ranged a -> Bool
forall a. Num a => Ranged a -> a
forall a. Ord a => Ranged a -> a
forall m. Monoid m => Ranged m -> m
forall a. Ranged a -> Bool
forall a. Ranged a -> Int
forall a. Ranged a -> [a]
forall a. (a -> a -> a) -> Ranged a -> a
forall m a. Monoid m => (a -> m) -> Ranged a -> m
forall b a. (b -> a -> b) -> b -> Ranged a -> b
forall a b. (a -> b -> b) -> b -> Ranged a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Ranged a -> a
$cproduct :: forall a. Num a => Ranged a -> a
sum :: Ranged a -> a
$csum :: forall a. Num a => Ranged a -> a
minimum :: Ranged a -> a
$cminimum :: forall a. Ord a => Ranged a -> a
maximum :: Ranged a -> a
$cmaximum :: forall a. Ord a => Ranged a -> a
elem :: a -> Ranged a -> Bool
$celem :: forall a. Eq a => a -> Ranged a -> Bool
length :: Ranged a -> Int
$clength :: forall a. Ranged a -> Int
null :: Ranged a -> Bool
$cnull :: forall a. Ranged a -> Bool
toList :: Ranged a -> [a]
$ctoList :: forall a. Ranged a -> [a]
foldl1 :: (a -> a -> a) -> Ranged a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Ranged a -> a
foldr1 :: (a -> a -> a) -> Ranged a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Ranged a -> a
foldl' :: (b -> a -> b) -> b -> Ranged a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Ranged a -> b
foldl :: (b -> a -> b) -> b -> Ranged a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Ranged a -> b
foldr' :: (a -> b -> b) -> b -> Ranged a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Ranged a -> b
foldr :: (a -> b -> b) -> b -> Ranged a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Ranged a -> b
foldMap' :: (a -> m) -> Ranged a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Ranged a -> m
foldMap :: (a -> m) -> Ranged a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Ranged a -> m
fold :: Ranged m -> m
$cfold :: forall m. Monoid m => Ranged m -> m
Foldable, Functor Ranged
Foldable Ranged
Functor Ranged
-> Foldable Ranged
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Ranged a -> f (Ranged b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Ranged (f a) -> f (Ranged a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Ranged a -> m (Ranged b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Ranged (m a) -> m (Ranged a))
-> Traversable Ranged
(a -> f b) -> Ranged a -> f (Ranged b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Ranged (m a) -> m (Ranged a)
forall (f :: * -> *) a.
Applicative f =>
Ranged (f a) -> f (Ranged a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Ranged a -> m (Ranged b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Ranged a -> f (Ranged b)
sequence :: Ranged (m a) -> m (Ranged a)
$csequence :: forall (m :: * -> *) a. Monad m => Ranged (m a) -> m (Ranged a)
mapM :: (a -> m b) -> Ranged a -> m (Ranged b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Ranged a -> m (Ranged b)
sequenceA :: Ranged (f a) -> f (Ranged a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Ranged (f a) -> f (Ranged a)
traverse :: (a -> f b) -> Ranged a -> f (Ranged b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Ranged a -> f (Ranged b)
$cp2Traversable :: Foldable Ranged
$cp1Traversable :: Functor Ranged
Traversable)

-- | Thing with no range info.
unranged :: a -> Ranged a
unranged :: a -> Ranged a
unranged = Range -> a -> Ranged a
forall a. Range -> a -> Ranged a
Ranged Range
forall a. Range' a
noRange

-- | Ignores range.
instance Pretty a => Pretty (Ranged a) where
  pretty :: Ranged a -> Doc
pretty = a -> Doc
forall a. Pretty a => a -> Doc
pretty (a -> Doc) -> (Ranged a -> a) -> Ranged a -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ranged a -> a
forall a. Ranged a -> a
rangedThing

-- | Ignores range.
instance Eq a => Eq (Ranged a) where
  == :: Ranged a -> Ranged a -> Bool
(==) = a -> a -> Bool
forall a. Eq a => a -> a -> Bool
(==) (a -> a -> Bool) -> (Ranged a -> a) -> Ranged a -> Ranged a -> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` Ranged a -> a
forall a. Ranged a -> a
rangedThing

-- | Ignores range.
instance Ord a => Ord (Ranged a) where
  compare :: Ranged a -> Ranged a -> Ordering
compare = a -> a -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (a -> a -> Ordering)
-> (Ranged a -> a) -> Ranged a -> Ranged a -> Ordering
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` Ranged a -> a
forall a. Ranged a -> a
rangedThing

instance HasRange (Ranged a) where
  getRange :: Ranged a -> Range
getRange = Ranged a -> Range
forall a. Ranged a -> Range
rangeOf

instance KillRange (Ranged a) where
  killRange :: KillRangeT (Ranged a)
killRange (Ranged Range
_ a
x) = Range -> a -> Ranged a
forall a. Range -> a -> Ranged a
Ranged Range
forall a. Range' a
noRange a
x

instance Decoration Ranged where
  traverseF :: (a -> m b) -> Ranged a -> m (Ranged b)
traverseF a -> m b
f (Ranged Range
r a
x) = Range -> b -> Ranged b
forall a. Range -> a -> Ranged a
Ranged Range
r (b -> Ranged b) -> m b -> m (Ranged b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> m b
f a
x

-- | Ranges are not forced.

instance NFData a => NFData (Ranged a) where
  rnf :: Ranged a -> ()
rnf (Ranged Range
_ a
a) = a -> ()
forall a. NFData a => a -> ()
rnf a
a

---------------------------------------------------------------------------
-- * Raw names (before parsing into name parts).
---------------------------------------------------------------------------

-- | A @RawName@ is some sort of string.
type RawName = String

rawNameToString :: RawName -> String
rawNameToString :: ShowS
rawNameToString = ShowS
forall a. a -> a
id

stringToRawName :: String -> RawName
stringToRawName :: ShowS
stringToRawName = ShowS
forall a. a -> a
id

-- | String with range info.
type RString = Ranged RawName

---------------------------------------------------------------------------
-- * Further constructor and projection info
---------------------------------------------------------------------------

-- | Where does the 'ConP' or 'Con' come from?
data ConOrigin
  = ConOSystem  -- ^ Inserted by system or expanded from an implicit pattern.
  | ConOCon     -- ^ User wrote a constructor (pattern).
  | ConORec     -- ^ User wrote a record (pattern).
  | ConOSplit   -- ^ Generated by interactive case splitting.
  deriving (Typeable ConOrigin
DataType
Constr
Typeable ConOrigin
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ConOrigin -> c ConOrigin)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ConOrigin)
-> (ConOrigin -> Constr)
-> (ConOrigin -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ConOrigin))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ConOrigin))
-> ((forall b. Data b => b -> b) -> ConOrigin -> ConOrigin)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ConOrigin -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ConOrigin -> r)
-> (forall u. (forall d. Data d => d -> u) -> ConOrigin -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ConOrigin -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin)
-> Data ConOrigin
ConOrigin -> DataType
ConOrigin -> Constr
(forall b. Data b => b -> b) -> ConOrigin -> ConOrigin
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConOrigin -> c ConOrigin
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConOrigin
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) -> ConOrigin -> u
forall u. (forall d. Data d => d -> u) -> ConOrigin -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConOrigin -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConOrigin -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConOrigin
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConOrigin -> c ConOrigin
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ConOrigin)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ConOrigin)
$cConOSplit :: Constr
$cConORec :: Constr
$cConOCon :: Constr
$cConOSystem :: Constr
$tConOrigin :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin
gmapMp :: (forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin
gmapM :: (forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConOrigin -> m ConOrigin
gmapQi :: Int -> (forall d. Data d => d -> u) -> ConOrigin -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ConOrigin -> u
gmapQ :: (forall d. Data d => d -> u) -> ConOrigin -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ConOrigin -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConOrigin -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConOrigin -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConOrigin -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConOrigin -> r
gmapT :: (forall b. Data b => b -> b) -> ConOrigin -> ConOrigin
$cgmapT :: (forall b. Data b => b -> b) -> ConOrigin -> ConOrigin
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ConOrigin)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ConOrigin)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ConOrigin)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ConOrigin)
dataTypeOf :: ConOrigin -> DataType
$cdataTypeOf :: ConOrigin -> DataType
toConstr :: ConOrigin -> Constr
$ctoConstr :: ConOrigin -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConOrigin
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConOrigin
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConOrigin -> c ConOrigin
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConOrigin -> c ConOrigin
$cp1Data :: Typeable ConOrigin
Data, Int -> ConOrigin -> ShowS
[ConOrigin] -> ShowS
ConOrigin -> String
(Int -> ConOrigin -> ShowS)
-> (ConOrigin -> String)
-> ([ConOrigin] -> ShowS)
-> Show ConOrigin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConOrigin] -> ShowS
$cshowList :: [ConOrigin] -> ShowS
show :: ConOrigin -> String
$cshow :: ConOrigin -> String
showsPrec :: Int -> ConOrigin -> ShowS
$cshowsPrec :: Int -> ConOrigin -> ShowS
Show, ConOrigin -> ConOrigin -> Bool
(ConOrigin -> ConOrigin -> Bool)
-> (ConOrigin -> ConOrigin -> Bool) -> Eq ConOrigin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConOrigin -> ConOrigin -> Bool
$c/= :: ConOrigin -> ConOrigin -> Bool
== :: ConOrigin -> ConOrigin -> Bool
$c== :: ConOrigin -> ConOrigin -> Bool
Eq, Eq ConOrigin
Eq ConOrigin
-> (ConOrigin -> ConOrigin -> Ordering)
-> (ConOrigin -> ConOrigin -> Bool)
-> (ConOrigin -> ConOrigin -> Bool)
-> (ConOrigin -> ConOrigin -> Bool)
-> (ConOrigin -> ConOrigin -> Bool)
-> (ConOrigin -> ConOrigin -> ConOrigin)
-> (ConOrigin -> ConOrigin -> ConOrigin)
-> Ord ConOrigin
ConOrigin -> ConOrigin -> Bool
ConOrigin -> ConOrigin -> Ordering
ConOrigin -> ConOrigin -> ConOrigin
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 :: ConOrigin -> ConOrigin -> ConOrigin
$cmin :: ConOrigin -> ConOrigin -> ConOrigin
max :: ConOrigin -> ConOrigin -> ConOrigin
$cmax :: ConOrigin -> ConOrigin -> ConOrigin
>= :: ConOrigin -> ConOrigin -> Bool
$c>= :: ConOrigin -> ConOrigin -> Bool
> :: ConOrigin -> ConOrigin -> Bool
$c> :: ConOrigin -> ConOrigin -> Bool
<= :: ConOrigin -> ConOrigin -> Bool
$c<= :: ConOrigin -> ConOrigin -> Bool
< :: ConOrigin -> ConOrigin -> Bool
$c< :: ConOrigin -> ConOrigin -> Bool
compare :: ConOrigin -> ConOrigin -> Ordering
$ccompare :: ConOrigin -> ConOrigin -> Ordering
$cp1Ord :: Eq ConOrigin
Ord, Int -> ConOrigin
ConOrigin -> Int
ConOrigin -> [ConOrigin]
ConOrigin -> ConOrigin
ConOrigin -> ConOrigin -> [ConOrigin]
ConOrigin -> ConOrigin -> ConOrigin -> [ConOrigin]
(ConOrigin -> ConOrigin)
-> (ConOrigin -> ConOrigin)
-> (Int -> ConOrigin)
-> (ConOrigin -> Int)
-> (ConOrigin -> [ConOrigin])
-> (ConOrigin -> ConOrigin -> [ConOrigin])
-> (ConOrigin -> ConOrigin -> [ConOrigin])
-> (ConOrigin -> ConOrigin -> ConOrigin -> [ConOrigin])
-> Enum ConOrigin
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ConOrigin -> ConOrigin -> ConOrigin -> [ConOrigin]
$cenumFromThenTo :: ConOrigin -> ConOrigin -> ConOrigin -> [ConOrigin]
enumFromTo :: ConOrigin -> ConOrigin -> [ConOrigin]
$cenumFromTo :: ConOrigin -> ConOrigin -> [ConOrigin]
enumFromThen :: ConOrigin -> ConOrigin -> [ConOrigin]
$cenumFromThen :: ConOrigin -> ConOrigin -> [ConOrigin]
enumFrom :: ConOrigin -> [ConOrigin]
$cenumFrom :: ConOrigin -> [ConOrigin]
fromEnum :: ConOrigin -> Int
$cfromEnum :: ConOrigin -> Int
toEnum :: Int -> ConOrigin
$ctoEnum :: Int -> ConOrigin
pred :: ConOrigin -> ConOrigin
$cpred :: ConOrigin -> ConOrigin
succ :: ConOrigin -> ConOrigin
$csucc :: ConOrigin -> ConOrigin
Enum, ConOrigin
ConOrigin -> ConOrigin -> Bounded ConOrigin
forall a. a -> a -> Bounded a
maxBound :: ConOrigin
$cmaxBound :: ConOrigin
minBound :: ConOrigin
$cminBound :: ConOrigin
Bounded, (forall x. ConOrigin -> Rep ConOrigin x)
-> (forall x. Rep ConOrigin x -> ConOrigin) -> Generic ConOrigin
forall x. Rep ConOrigin x -> ConOrigin
forall x. ConOrigin -> Rep ConOrigin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConOrigin x -> ConOrigin
$cfrom :: forall x. ConOrigin -> Rep ConOrigin x
Generic)

instance NFData ConOrigin

instance KillRange ConOrigin where
  killRange :: ConOrigin -> ConOrigin
killRange = ConOrigin -> ConOrigin
forall a. a -> a
id

-- | Prefer user-written over system-inserted.
bestConInfo :: ConOrigin -> ConOrigin -> ConOrigin
bestConInfo :: ConOrigin -> ConOrigin -> ConOrigin
bestConInfo ConOrigin
ConOSystem ConOrigin
o = ConOrigin
o
bestConInfo ConOrigin
o ConOrigin
_ = ConOrigin
o

-- | Where does a projection come from?
data ProjOrigin
  = ProjPrefix    -- ^ User wrote a prefix projection.
  | ProjPostfix   -- ^ User wrote a postfix projection.
  | ProjSystem    -- ^ Projection was generated by the system.
  deriving (Typeable ProjOrigin
DataType
Constr
Typeable ProjOrigin
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ProjOrigin -> c ProjOrigin)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ProjOrigin)
-> (ProjOrigin -> Constr)
-> (ProjOrigin -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ProjOrigin))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ProjOrigin))
-> ((forall b. Data b => b -> b) -> ProjOrigin -> ProjOrigin)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ProjOrigin -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ProjOrigin -> r)
-> (forall u. (forall d. Data d => d -> u) -> ProjOrigin -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ProjOrigin -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin)
-> Data ProjOrigin
ProjOrigin -> DataType
ProjOrigin -> Constr
(forall b. Data b => b -> b) -> ProjOrigin -> ProjOrigin
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProjOrigin -> c ProjOrigin
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProjOrigin
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) -> ProjOrigin -> u
forall u. (forall d. Data d => d -> u) -> ProjOrigin -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProjOrigin -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProjOrigin -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProjOrigin
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProjOrigin -> c ProjOrigin
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ProjOrigin)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProjOrigin)
$cProjSystem :: Constr
$cProjPostfix :: Constr
$cProjPrefix :: Constr
$tProjOrigin :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin
gmapMp :: (forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin
gmapM :: (forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProjOrigin -> m ProjOrigin
gmapQi :: Int -> (forall d. Data d => d -> u) -> ProjOrigin -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ProjOrigin -> u
gmapQ :: (forall d. Data d => d -> u) -> ProjOrigin -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ProjOrigin -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProjOrigin -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProjOrigin -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProjOrigin -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProjOrigin -> r
gmapT :: (forall b. Data b => b -> b) -> ProjOrigin -> ProjOrigin
$cgmapT :: (forall b. Data b => b -> b) -> ProjOrigin -> ProjOrigin
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProjOrigin)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProjOrigin)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ProjOrigin)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ProjOrigin)
dataTypeOf :: ProjOrigin -> DataType
$cdataTypeOf :: ProjOrigin -> DataType
toConstr :: ProjOrigin -> Constr
$ctoConstr :: ProjOrigin -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProjOrigin
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProjOrigin
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProjOrigin -> c ProjOrigin
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProjOrigin -> c ProjOrigin
$cp1Data :: Typeable ProjOrigin
Data, Int -> ProjOrigin -> ShowS
[ProjOrigin] -> ShowS
ProjOrigin -> String
(Int -> ProjOrigin -> ShowS)
-> (ProjOrigin -> String)
-> ([ProjOrigin] -> ShowS)
-> Show ProjOrigin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjOrigin] -> ShowS
$cshowList :: [ProjOrigin] -> ShowS
show :: ProjOrigin -> String
$cshow :: ProjOrigin -> String
showsPrec :: Int -> ProjOrigin -> ShowS
$cshowsPrec :: Int -> ProjOrigin -> ShowS
Show, ProjOrigin -> ProjOrigin -> Bool
(ProjOrigin -> ProjOrigin -> Bool)
-> (ProjOrigin -> ProjOrigin -> Bool) -> Eq ProjOrigin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjOrigin -> ProjOrigin -> Bool
$c/= :: ProjOrigin -> ProjOrigin -> Bool
== :: ProjOrigin -> ProjOrigin -> Bool
$c== :: ProjOrigin -> ProjOrigin -> Bool
Eq, Eq ProjOrigin
Eq ProjOrigin
-> (ProjOrigin -> ProjOrigin -> Ordering)
-> (ProjOrigin -> ProjOrigin -> Bool)
-> (ProjOrigin -> ProjOrigin -> Bool)
-> (ProjOrigin -> ProjOrigin -> Bool)
-> (ProjOrigin -> ProjOrigin -> Bool)
-> (ProjOrigin -> ProjOrigin -> ProjOrigin)
-> (ProjOrigin -> ProjOrigin -> ProjOrigin)
-> Ord ProjOrigin
ProjOrigin -> ProjOrigin -> Bool
ProjOrigin -> ProjOrigin -> Ordering
ProjOrigin -> ProjOrigin -> ProjOrigin
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 :: ProjOrigin -> ProjOrigin -> ProjOrigin
$cmin :: ProjOrigin -> ProjOrigin -> ProjOrigin
max :: ProjOrigin -> ProjOrigin -> ProjOrigin
$cmax :: ProjOrigin -> ProjOrigin -> ProjOrigin
>= :: ProjOrigin -> ProjOrigin -> Bool
$c>= :: ProjOrigin -> ProjOrigin -> Bool
> :: ProjOrigin -> ProjOrigin -> Bool
$c> :: ProjOrigin -> ProjOrigin -> Bool
<= :: ProjOrigin -> ProjOrigin -> Bool
$c<= :: ProjOrigin -> ProjOrigin -> Bool
< :: ProjOrigin -> ProjOrigin -> Bool
$c< :: ProjOrigin -> ProjOrigin -> Bool
compare :: ProjOrigin -> ProjOrigin -> Ordering
$ccompare :: ProjOrigin -> ProjOrigin -> Ordering
$cp1Ord :: Eq ProjOrigin
Ord, Int -> ProjOrigin
ProjOrigin -> Int
ProjOrigin -> [ProjOrigin]
ProjOrigin -> ProjOrigin
ProjOrigin -> ProjOrigin -> [ProjOrigin]
ProjOrigin -> ProjOrigin -> ProjOrigin -> [ProjOrigin]
(ProjOrigin -> ProjOrigin)
-> (ProjOrigin -> ProjOrigin)
-> (Int -> ProjOrigin)
-> (ProjOrigin -> Int)
-> (ProjOrigin -> [ProjOrigin])
-> (ProjOrigin -> ProjOrigin -> [ProjOrigin])
-> (ProjOrigin -> ProjOrigin -> [ProjOrigin])
-> (ProjOrigin -> ProjOrigin -> ProjOrigin -> [ProjOrigin])
-> Enum ProjOrigin
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ProjOrigin -> ProjOrigin -> ProjOrigin -> [ProjOrigin]
$cenumFromThenTo :: ProjOrigin -> ProjOrigin -> ProjOrigin -> [ProjOrigin]
enumFromTo :: ProjOrigin -> ProjOrigin -> [ProjOrigin]
$cenumFromTo :: ProjOrigin -> ProjOrigin -> [ProjOrigin]
enumFromThen :: ProjOrigin -> ProjOrigin -> [ProjOrigin]
$cenumFromThen :: ProjOrigin -> ProjOrigin -> [ProjOrigin]
enumFrom :: ProjOrigin -> [ProjOrigin]
$cenumFrom :: ProjOrigin -> [ProjOrigin]
fromEnum :: ProjOrigin -> Int
$cfromEnum :: ProjOrigin -> Int
toEnum :: Int -> ProjOrigin
$ctoEnum :: Int -> ProjOrigin
pred :: ProjOrigin -> ProjOrigin
$cpred :: ProjOrigin -> ProjOrigin
succ :: ProjOrigin -> ProjOrigin
$csucc :: ProjOrigin -> ProjOrigin
Enum, ProjOrigin
ProjOrigin -> ProjOrigin -> Bounded ProjOrigin
forall a. a -> a -> Bounded a
maxBound :: ProjOrigin
$cmaxBound :: ProjOrigin
minBound :: ProjOrigin
$cminBound :: ProjOrigin
Bounded, (forall x. ProjOrigin -> Rep ProjOrigin x)
-> (forall x. Rep ProjOrigin x -> ProjOrigin) -> Generic ProjOrigin
forall x. Rep ProjOrigin x -> ProjOrigin
forall x. ProjOrigin -> Rep ProjOrigin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjOrigin x -> ProjOrigin
$cfrom :: forall x. ProjOrigin -> Rep ProjOrigin x
Generic)

instance NFData ProjOrigin

instance KillRange ProjOrigin where
  killRange :: ProjOrigin -> ProjOrigin
killRange = ProjOrigin -> ProjOrigin
forall a. a -> a
id

---------------------------------------------------------------------------
-- * Infixity, access, abstract, etc.
---------------------------------------------------------------------------

-- | Functions can be defined in both infix and prefix style. See
--   'Agda.Syntax.Concrete.LHS'.
data IsInfix = InfixDef | PrefixDef
    deriving (Typeable IsInfix
DataType
Constr
Typeable IsInfix
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> IsInfix -> c IsInfix)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c IsInfix)
-> (IsInfix -> Constr)
-> (IsInfix -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c IsInfix))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsInfix))
-> ((forall b. Data b => b -> b) -> IsInfix -> IsInfix)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> IsInfix -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> IsInfix -> r)
-> (forall u. (forall d. Data d => d -> u) -> IsInfix -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> IsInfix -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> IsInfix -> m IsInfix)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IsInfix -> m IsInfix)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IsInfix -> m IsInfix)
-> Data IsInfix
IsInfix -> DataType
IsInfix -> Constr
(forall b. Data b => b -> b) -> IsInfix -> IsInfix
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsInfix -> c IsInfix
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsInfix
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) -> IsInfix -> u
forall u. (forall d. Data d => d -> u) -> IsInfix -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsInfix -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsInfix -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IsInfix -> m IsInfix
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsInfix -> m IsInfix
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsInfix
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsInfix -> c IsInfix
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsInfix)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsInfix)
$cPrefixDef :: Constr
$cInfixDef :: Constr
$tIsInfix :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> IsInfix -> m IsInfix
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsInfix -> m IsInfix
gmapMp :: (forall d. Data d => d -> m d) -> IsInfix -> m IsInfix
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsInfix -> m IsInfix
gmapM :: (forall d. Data d => d -> m d) -> IsInfix -> m IsInfix
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IsInfix -> m IsInfix
gmapQi :: Int -> (forall d. Data d => d -> u) -> IsInfix -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IsInfix -> u
gmapQ :: (forall d. Data d => d -> u) -> IsInfix -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IsInfix -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsInfix -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsInfix -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsInfix -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsInfix -> r
gmapT :: (forall b. Data b => b -> b) -> IsInfix -> IsInfix
$cgmapT :: (forall b. Data b => b -> b) -> IsInfix -> IsInfix
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsInfix)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsInfix)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c IsInfix)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsInfix)
dataTypeOf :: IsInfix -> DataType
$cdataTypeOf :: IsInfix -> DataType
toConstr :: IsInfix -> Constr
$ctoConstr :: IsInfix -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsInfix
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsInfix
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsInfix -> c IsInfix
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsInfix -> c IsInfix
$cp1Data :: Typeable IsInfix
Data, Int -> IsInfix -> ShowS
[IsInfix] -> ShowS
IsInfix -> String
(Int -> IsInfix -> ShowS)
-> (IsInfix -> String) -> ([IsInfix] -> ShowS) -> Show IsInfix
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IsInfix] -> ShowS
$cshowList :: [IsInfix] -> ShowS
show :: IsInfix -> String
$cshow :: IsInfix -> String
showsPrec :: Int -> IsInfix -> ShowS
$cshowsPrec :: Int -> IsInfix -> ShowS
Show, IsInfix -> IsInfix -> Bool
(IsInfix -> IsInfix -> Bool)
-> (IsInfix -> IsInfix -> Bool) -> Eq IsInfix
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IsInfix -> IsInfix -> Bool
$c/= :: IsInfix -> IsInfix -> Bool
== :: IsInfix -> IsInfix -> Bool
$c== :: IsInfix -> IsInfix -> Bool
Eq, Eq IsInfix
Eq IsInfix
-> (IsInfix -> IsInfix -> Ordering)
-> (IsInfix -> IsInfix -> Bool)
-> (IsInfix -> IsInfix -> Bool)
-> (IsInfix -> IsInfix -> Bool)
-> (IsInfix -> IsInfix -> Bool)
-> (IsInfix -> IsInfix -> IsInfix)
-> (IsInfix -> IsInfix -> IsInfix)
-> Ord IsInfix
IsInfix -> IsInfix -> Bool
IsInfix -> IsInfix -> Ordering
IsInfix -> IsInfix -> IsInfix
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 :: IsInfix -> IsInfix -> IsInfix
$cmin :: IsInfix -> IsInfix -> IsInfix
max :: IsInfix -> IsInfix -> IsInfix
$cmax :: IsInfix -> IsInfix -> IsInfix
>= :: IsInfix -> IsInfix -> Bool
$c>= :: IsInfix -> IsInfix -> Bool
> :: IsInfix -> IsInfix -> Bool
$c> :: IsInfix -> IsInfix -> Bool
<= :: IsInfix -> IsInfix -> Bool
$c<= :: IsInfix -> IsInfix -> Bool
< :: IsInfix -> IsInfix -> Bool
$c< :: IsInfix -> IsInfix -> Bool
compare :: IsInfix -> IsInfix -> Ordering
$ccompare :: IsInfix -> IsInfix -> Ordering
$cp1Ord :: Eq IsInfix
Ord)

-- ** private blocks, public imports

-- | Access modifier.
data Access
  = PrivateAccess Origin
      -- ^ Store the 'Origin' of the private block that lead to this qualifier.
      --   This is needed for more faithful printing of declarations.
  | PublicAccess
    deriving (Typeable Access
DataType
Constr
Typeable Access
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Access -> c Access)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Access)
-> (Access -> Constr)
-> (Access -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Access))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Access))
-> ((forall b. Data b => b -> b) -> Access -> Access)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Access -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Access -> r)
-> (forall u. (forall d. Data d => d -> u) -> Access -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Access -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Access -> m Access)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Access -> m Access)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Access -> m Access)
-> Data Access
Access -> DataType
Access -> Constr
(forall b. Data b => b -> b) -> Access -> Access
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Access -> c Access
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Access
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) -> Access -> u
forall u. (forall d. Data d => d -> u) -> Access -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Access -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Access -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Access -> m Access
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Access -> m Access
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Access
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Access -> c Access
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Access)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Access)
$cPublicAccess :: Constr
$cPrivateAccess :: Constr
$tAccess :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Access -> m Access
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Access -> m Access
gmapMp :: (forall d. Data d => d -> m d) -> Access -> m Access
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Access -> m Access
gmapM :: (forall d. Data d => d -> m d) -> Access -> m Access
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Access -> m Access
gmapQi :: Int -> (forall d. Data d => d -> u) -> Access -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Access -> u
gmapQ :: (forall d. Data d => d -> u) -> Access -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Access -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Access -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Access -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Access -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Access -> r
gmapT :: (forall b. Data b => b -> b) -> Access -> Access
$cgmapT :: (forall b. Data b => b -> b) -> Access -> Access
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Access)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Access)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Access)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Access)
dataTypeOf :: Access -> DataType
$cdataTypeOf :: Access -> DataType
toConstr :: Access -> Constr
$ctoConstr :: Access -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Access
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Access
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Access -> c Access
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Access -> c Access
$cp1Data :: Typeable Access
Data, Int -> Access -> ShowS
[Access] -> ShowS
Access -> String
(Int -> Access -> ShowS)
-> (Access -> String) -> ([Access] -> ShowS) -> Show Access
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Access] -> ShowS
$cshowList :: [Access] -> ShowS
show :: Access -> String
$cshow :: Access -> String
showsPrec :: Int -> Access -> ShowS
$cshowsPrec :: Int -> Access -> ShowS
Show, Access -> Access -> Bool
(Access -> Access -> Bool)
-> (Access -> Access -> Bool) -> Eq Access
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Access -> Access -> Bool
$c/= :: Access -> Access -> Bool
== :: Access -> Access -> Bool
$c== :: Access -> Access -> Bool
Eq, Eq Access
Eq Access
-> (Access -> Access -> Ordering)
-> (Access -> Access -> Bool)
-> (Access -> Access -> Bool)
-> (Access -> Access -> Bool)
-> (Access -> Access -> Bool)
-> (Access -> Access -> Access)
-> (Access -> Access -> Access)
-> Ord Access
Access -> Access -> Bool
Access -> Access -> Ordering
Access -> Access -> Access
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 :: Access -> Access -> Access
$cmin :: Access -> Access -> Access
max :: Access -> Access -> Access
$cmax :: Access -> Access -> Access
>= :: Access -> Access -> Bool
$c>= :: Access -> Access -> Bool
> :: Access -> Access -> Bool
$c> :: Access -> Access -> Bool
<= :: Access -> Access -> Bool
$c<= :: Access -> Access -> Bool
< :: Access -> Access -> Bool
$c< :: Access -> Access -> Bool
compare :: Access -> Access -> Ordering
$ccompare :: Access -> Access -> Ordering
$cp1Ord :: Eq Access
Ord)

instance Pretty Access where
  pretty :: Access -> Doc
pretty = String -> Doc
text (String -> Doc) -> (Access -> String) -> Access -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. \case
    PrivateAccess Origin
_ -> String
"private"
    Access
PublicAccess    -> String
"public"

instance NFData Access where
  rnf :: Access -> ()
rnf Access
_ = ()

instance HasRange Access where
  getRange :: Access -> Range
getRange Access
_ = Range
forall a. Range' a
noRange

instance KillRange Access where
  killRange :: Access -> Access
killRange = Access -> Access
forall a. a -> a
id

-- ** abstract blocks

-- | Abstract or concrete.
data IsAbstract = AbstractDef | ConcreteDef
    deriving (Typeable IsAbstract
DataType
Constr
Typeable IsAbstract
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> IsAbstract -> c IsAbstract)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c IsAbstract)
-> (IsAbstract -> Constr)
-> (IsAbstract -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c IsAbstract))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c IsAbstract))
-> ((forall b. Data b => b -> b) -> IsAbstract -> IsAbstract)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> IsAbstract -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> IsAbstract -> r)
-> (forall u. (forall d. Data d => d -> u) -> IsAbstract -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> IsAbstract -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract)
-> Data IsAbstract
IsAbstract -> DataType
IsAbstract -> Constr
(forall b. Data b => b -> b) -> IsAbstract -> IsAbstract
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsAbstract -> c IsAbstract
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsAbstract
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) -> IsAbstract -> u
forall u. (forall d. Data d => d -> u) -> IsAbstract -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsAbstract -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsAbstract -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsAbstract
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsAbstract -> c IsAbstract
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsAbstract)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsAbstract)
$cConcreteDef :: Constr
$cAbstractDef :: Constr
$tIsAbstract :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract
gmapMp :: (forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract
gmapM :: (forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IsAbstract -> m IsAbstract
gmapQi :: Int -> (forall d. Data d => d -> u) -> IsAbstract -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IsAbstract -> u
gmapQ :: (forall d. Data d => d -> u) -> IsAbstract -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IsAbstract -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsAbstract -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsAbstract -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsAbstract -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsAbstract -> r
gmapT :: (forall b. Data b => b -> b) -> IsAbstract -> IsAbstract
$cgmapT :: (forall b. Data b => b -> b) -> IsAbstract -> IsAbstract
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsAbstract)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsAbstract)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c IsAbstract)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsAbstract)
dataTypeOf :: IsAbstract -> DataType
$cdataTypeOf :: IsAbstract -> DataType
toConstr :: IsAbstract -> Constr
$ctoConstr :: IsAbstract -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsAbstract
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsAbstract
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsAbstract -> c IsAbstract
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsAbstract -> c IsAbstract
$cp1Data :: Typeable IsAbstract
Data, Int -> IsAbstract -> ShowS
[IsAbstract] -> ShowS
IsAbstract -> String
(Int -> IsAbstract -> ShowS)
-> (IsAbstract -> String)
-> ([IsAbstract] -> ShowS)
-> Show IsAbstract
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IsAbstract] -> ShowS
$cshowList :: [IsAbstract] -> ShowS
show :: IsAbstract -> String
$cshow :: IsAbstract -> String
showsPrec :: Int -> IsAbstract -> ShowS
$cshowsPrec :: Int -> IsAbstract -> ShowS
Show, IsAbstract -> IsAbstract -> Bool
(IsAbstract -> IsAbstract -> Bool)
-> (IsAbstract -> IsAbstract -> Bool) -> Eq IsAbstract
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IsAbstract -> IsAbstract -> Bool
$c/= :: IsAbstract -> IsAbstract -> Bool
== :: IsAbstract -> IsAbstract -> Bool
$c== :: IsAbstract -> IsAbstract -> Bool
Eq, Eq IsAbstract
Eq IsAbstract
-> (IsAbstract -> IsAbstract -> Ordering)
-> (IsAbstract -> IsAbstract -> Bool)
-> (IsAbstract -> IsAbstract -> Bool)
-> (IsAbstract -> IsAbstract -> Bool)
-> (IsAbstract -> IsAbstract -> Bool)
-> (IsAbstract -> IsAbstract -> IsAbstract)
-> (IsAbstract -> IsAbstract -> IsAbstract)
-> Ord IsAbstract
IsAbstract -> IsAbstract -> Bool
IsAbstract -> IsAbstract -> Ordering
IsAbstract -> IsAbstract -> IsAbstract
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 :: IsAbstract -> IsAbstract -> IsAbstract
$cmin :: IsAbstract -> IsAbstract -> IsAbstract
max :: IsAbstract -> IsAbstract -> IsAbstract
$cmax :: IsAbstract -> IsAbstract -> IsAbstract
>= :: IsAbstract -> IsAbstract -> Bool
$c>= :: IsAbstract -> IsAbstract -> Bool
> :: IsAbstract -> IsAbstract -> Bool
$c> :: IsAbstract -> IsAbstract -> Bool
<= :: IsAbstract -> IsAbstract -> Bool
$c<= :: IsAbstract -> IsAbstract -> Bool
< :: IsAbstract -> IsAbstract -> Bool
$c< :: IsAbstract -> IsAbstract -> Bool
compare :: IsAbstract -> IsAbstract -> Ordering
$ccompare :: IsAbstract -> IsAbstract -> Ordering
$cp1Ord :: Eq IsAbstract
Ord, (forall x. IsAbstract -> Rep IsAbstract x)
-> (forall x. Rep IsAbstract x -> IsAbstract) -> Generic IsAbstract
forall x. Rep IsAbstract x -> IsAbstract
forall x. IsAbstract -> Rep IsAbstract x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IsAbstract x -> IsAbstract
$cfrom :: forall x. IsAbstract -> Rep IsAbstract x
Generic)

-- | Semigroup computes if any of several is an 'AbstractDef'.
instance Semigroup IsAbstract where
  IsAbstract
AbstractDef <> :: IsAbstract -> IsAbstract -> IsAbstract
<> IsAbstract
_ = IsAbstract
AbstractDef
  IsAbstract
ConcreteDef <> IsAbstract
a = IsAbstract
a

-- | Default is 'ConcreteDef'.
instance Monoid IsAbstract where
  mempty :: IsAbstract
mempty  = IsAbstract
ConcreteDef
  mappend :: IsAbstract -> IsAbstract -> IsAbstract
mappend = IsAbstract -> IsAbstract -> IsAbstract
forall a. Semigroup a => a -> a -> a
(<>)

instance KillRange IsAbstract where
  killRange :: IsAbstract -> IsAbstract
killRange = IsAbstract -> IsAbstract
forall a. a -> a
id

instance NFData IsAbstract

class LensIsAbstract a where
  lensIsAbstract :: Lens' IsAbstract a

instance LensIsAbstract IsAbstract where
  lensIsAbstract :: (IsAbstract -> f IsAbstract) -> IsAbstract -> f IsAbstract
lensIsAbstract = (IsAbstract -> f IsAbstract) -> IsAbstract -> f IsAbstract
forall a. a -> a
id

-- | Is any element of a collection an 'AbstractDef'.
class AnyIsAbstract a where
  anyIsAbstract :: a -> IsAbstract

  default anyIsAbstract :: (Foldable t, AnyIsAbstract b, t b ~ a) => a -> IsAbstract
  anyIsAbstract = (b -> IsAbstract) -> t b -> IsAbstract
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Fold.foldMap b -> IsAbstract
forall a. AnyIsAbstract a => a -> IsAbstract
anyIsAbstract

instance AnyIsAbstract IsAbstract where
  anyIsAbstract :: IsAbstract -> IsAbstract
anyIsAbstract = IsAbstract -> IsAbstract
forall a. a -> a
id

instance AnyIsAbstract a => AnyIsAbstract [a] where
instance AnyIsAbstract a => AnyIsAbstract (Maybe a) where

-- ** instance blocks

-- | Is this definition eligible for instance search?
data IsInstance
  = InstanceDef Range  -- ^ Range of the @instance@ keyword.
  | NotInstanceDef
    deriving (Typeable IsInstance
DataType
Constr
Typeable IsInstance
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> IsInstance -> c IsInstance)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c IsInstance)
-> (IsInstance -> Constr)
-> (IsInstance -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c IsInstance))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c IsInstance))
-> ((forall b. Data b => b -> b) -> IsInstance -> IsInstance)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> IsInstance -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> IsInstance -> r)
-> (forall u. (forall d. Data d => d -> u) -> IsInstance -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> IsInstance -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> IsInstance -> m IsInstance)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IsInstance -> m IsInstance)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IsInstance -> m IsInstance)
-> Data IsInstance
IsInstance -> DataType
IsInstance -> Constr
(forall b. Data b => b -> b) -> IsInstance -> IsInstance
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsInstance -> c IsInstance
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsInstance
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) -> IsInstance -> u
forall u. (forall d. Data d => d -> u) -> IsInstance -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsInstance -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsInstance -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IsInstance -> m IsInstance
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsInstance -> m IsInstance
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsInstance
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsInstance -> c IsInstance
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsInstance)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsInstance)
$cNotInstanceDef :: Constr
$cInstanceDef :: Constr
$tIsInstance :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> IsInstance -> m IsInstance
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsInstance -> m IsInstance
gmapMp :: (forall d. Data d => d -> m d) -> IsInstance -> m IsInstance
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsInstance -> m IsInstance
gmapM :: (forall d. Data d => d -> m d) -> IsInstance -> m IsInstance
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IsInstance -> m IsInstance
gmapQi :: Int -> (forall d. Data d => d -> u) -> IsInstance -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IsInstance -> u
gmapQ :: (forall d. Data d => d -> u) -> IsInstance -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IsInstance -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsInstance -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsInstance -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsInstance -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsInstance -> r
gmapT :: (forall b. Data b => b -> b) -> IsInstance -> IsInstance
$cgmapT :: (forall b. Data b => b -> b) -> IsInstance -> IsInstance
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsInstance)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsInstance)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c IsInstance)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsInstance)
dataTypeOf :: IsInstance -> DataType
$cdataTypeOf :: IsInstance -> DataType
toConstr :: IsInstance -> Constr
$ctoConstr :: IsInstance -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsInstance
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsInstance
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsInstance -> c IsInstance
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsInstance -> c IsInstance
$cp1Data :: Typeable IsInstance
Data, Int -> IsInstance -> ShowS
[IsInstance] -> ShowS
IsInstance -> String
(Int -> IsInstance -> ShowS)
-> (IsInstance -> String)
-> ([IsInstance] -> ShowS)
-> Show IsInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IsInstance] -> ShowS
$cshowList :: [IsInstance] -> ShowS
show :: IsInstance -> String
$cshow :: IsInstance -> String
showsPrec :: Int -> IsInstance -> ShowS
$cshowsPrec :: Int -> IsInstance -> ShowS
Show, IsInstance -> IsInstance -> Bool
(IsInstance -> IsInstance -> Bool)
-> (IsInstance -> IsInstance -> Bool) -> Eq IsInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IsInstance -> IsInstance -> Bool
$c/= :: IsInstance -> IsInstance -> Bool
== :: IsInstance -> IsInstance -> Bool
$c== :: IsInstance -> IsInstance -> Bool
Eq, Eq IsInstance
Eq IsInstance
-> (IsInstance -> IsInstance -> Ordering)
-> (IsInstance -> IsInstance -> Bool)
-> (IsInstance -> IsInstance -> Bool)
-> (IsInstance -> IsInstance -> Bool)
-> (IsInstance -> IsInstance -> Bool)
-> (IsInstance -> IsInstance -> IsInstance)
-> (IsInstance -> IsInstance -> IsInstance)
-> Ord IsInstance
IsInstance -> IsInstance -> Bool
IsInstance -> IsInstance -> Ordering
IsInstance -> IsInstance -> IsInstance
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 :: IsInstance -> IsInstance -> IsInstance
$cmin :: IsInstance -> IsInstance -> IsInstance
max :: IsInstance -> IsInstance -> IsInstance
$cmax :: IsInstance -> IsInstance -> IsInstance
>= :: IsInstance -> IsInstance -> Bool
$c>= :: IsInstance -> IsInstance -> Bool
> :: IsInstance -> IsInstance -> Bool
$c> :: IsInstance -> IsInstance -> Bool
<= :: IsInstance -> IsInstance -> Bool
$c<= :: IsInstance -> IsInstance -> Bool
< :: IsInstance -> IsInstance -> Bool
$c< :: IsInstance -> IsInstance -> Bool
compare :: IsInstance -> IsInstance -> Ordering
$ccompare :: IsInstance -> IsInstance -> Ordering
$cp1Ord :: Eq IsInstance
Ord)

instance KillRange IsInstance where
  killRange :: IsInstance -> IsInstance
killRange = \case
    InstanceDef Range
_    -> Range -> IsInstance
InstanceDef Range
forall a. Range' a
noRange
    i :: IsInstance
i@IsInstance
NotInstanceDef -> IsInstance
i

instance HasRange IsInstance where
  getRange :: IsInstance -> Range
getRange = \case
    InstanceDef Range
r  -> Range
r
    IsInstance
NotInstanceDef -> Range
forall a. Range' a
noRange

instance NFData IsInstance where
  rnf :: IsInstance -> ()
rnf (InstanceDef Range
_) = ()
  rnf IsInstance
NotInstanceDef  = ()

-- ** macro blocks

-- | Is this a macro definition?
data IsMacro = MacroDef | NotMacroDef
  deriving (Typeable IsMacro
DataType
Constr
Typeable IsMacro
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> IsMacro -> c IsMacro)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c IsMacro)
-> (IsMacro -> Constr)
-> (IsMacro -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c IsMacro))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsMacro))
-> ((forall b. Data b => b -> b) -> IsMacro -> IsMacro)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> IsMacro -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> IsMacro -> r)
-> (forall u. (forall d. Data d => d -> u) -> IsMacro -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> IsMacro -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> IsMacro -> m IsMacro)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IsMacro -> m IsMacro)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IsMacro -> m IsMacro)
-> Data IsMacro
IsMacro -> DataType
IsMacro -> Constr
(forall b. Data b => b -> b) -> IsMacro -> IsMacro
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsMacro -> c IsMacro
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsMacro
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) -> IsMacro -> u
forall u. (forall d. Data d => d -> u) -> IsMacro -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsMacro -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsMacro -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IsMacro -> m IsMacro
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsMacro -> m IsMacro
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsMacro
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsMacro -> c IsMacro
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsMacro)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsMacro)
$cNotMacroDef :: Constr
$cMacroDef :: Constr
$tIsMacro :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> IsMacro -> m IsMacro
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsMacro -> m IsMacro
gmapMp :: (forall d. Data d => d -> m d) -> IsMacro -> m IsMacro
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IsMacro -> m IsMacro
gmapM :: (forall d. Data d => d -> m d) -> IsMacro -> m IsMacro
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IsMacro -> m IsMacro
gmapQi :: Int -> (forall d. Data d => d -> u) -> IsMacro -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IsMacro -> u
gmapQ :: (forall d. Data d => d -> u) -> IsMacro -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IsMacro -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsMacro -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsMacro -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsMacro -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsMacro -> r
gmapT :: (forall b. Data b => b -> b) -> IsMacro -> IsMacro
$cgmapT :: (forall b. Data b => b -> b) -> IsMacro -> IsMacro
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsMacro)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsMacro)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c IsMacro)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsMacro)
dataTypeOf :: IsMacro -> DataType
$cdataTypeOf :: IsMacro -> DataType
toConstr :: IsMacro -> Constr
$ctoConstr :: IsMacro -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsMacro
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsMacro
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsMacro -> c IsMacro
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsMacro -> c IsMacro
$cp1Data :: Typeable IsMacro
Data, Int -> IsMacro -> ShowS
[IsMacro] -> ShowS
IsMacro -> String
(Int -> IsMacro -> ShowS)
-> (IsMacro -> String) -> ([IsMacro] -> ShowS) -> Show IsMacro
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IsMacro] -> ShowS
$cshowList :: [IsMacro] -> ShowS
show :: IsMacro -> String
$cshow :: IsMacro -> String
showsPrec :: Int -> IsMacro -> ShowS
$cshowsPrec :: Int -> IsMacro -> ShowS
Show, IsMacro -> IsMacro -> Bool
(IsMacro -> IsMacro -> Bool)
-> (IsMacro -> IsMacro -> Bool) -> Eq IsMacro
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IsMacro -> IsMacro -> Bool
$c/= :: IsMacro -> IsMacro -> Bool
== :: IsMacro -> IsMacro -> Bool
$c== :: IsMacro -> IsMacro -> Bool
Eq, Eq IsMacro
Eq IsMacro
-> (IsMacro -> IsMacro -> Ordering)
-> (IsMacro -> IsMacro -> Bool)
-> (IsMacro -> IsMacro -> Bool)
-> (IsMacro -> IsMacro -> Bool)
-> (IsMacro -> IsMacro -> Bool)
-> (IsMacro -> IsMacro -> IsMacro)
-> (IsMacro -> IsMacro -> IsMacro)
-> Ord IsMacro
IsMacro -> IsMacro -> Bool
IsMacro -> IsMacro -> Ordering
IsMacro -> IsMacro -> IsMacro
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 :: IsMacro -> IsMacro -> IsMacro
$cmin :: IsMacro -> IsMacro -> IsMacro
max :: IsMacro -> IsMacro -> IsMacro
$cmax :: IsMacro -> IsMacro -> IsMacro
>= :: IsMacro -> IsMacro -> Bool
$c>= :: IsMacro -> IsMacro -> Bool
> :: IsMacro -> IsMacro -> Bool
$c> :: IsMacro -> IsMacro -> Bool
<= :: IsMacro -> IsMacro -> Bool
$c<= :: IsMacro -> IsMacro -> Bool
< :: IsMacro -> IsMacro -> Bool
$c< :: IsMacro -> IsMacro -> Bool
compare :: IsMacro -> IsMacro -> Ordering
$ccompare :: IsMacro -> IsMacro -> Ordering
$cp1Ord :: Eq IsMacro
Ord, (forall x. IsMacro -> Rep IsMacro x)
-> (forall x. Rep IsMacro x -> IsMacro) -> Generic IsMacro
forall x. Rep IsMacro x -> IsMacro
forall x. IsMacro -> Rep IsMacro x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IsMacro x -> IsMacro
$cfrom :: forall x. IsMacro -> Rep IsMacro x
Generic)

instance KillRange IsMacro where killRange :: IsMacro -> IsMacro
killRange = IsMacro -> IsMacro
forall a. a -> a
id
instance HasRange  IsMacro where getRange :: IsMacro -> Range
getRange IsMacro
_ = Range
forall a. Range' a
noRange

instance NFData IsMacro

---------------------------------------------------------------------------
-- * NameId
---------------------------------------------------------------------------

newtype ModuleNameHash = ModuleNameHash Word64
  deriving (ModuleNameHash -> ModuleNameHash -> Bool
(ModuleNameHash -> ModuleNameHash -> Bool)
-> (ModuleNameHash -> ModuleNameHash -> Bool) -> Eq ModuleNameHash
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModuleNameHash -> ModuleNameHash -> Bool
$c/= :: ModuleNameHash -> ModuleNameHash -> Bool
== :: ModuleNameHash -> ModuleNameHash -> Bool
$c== :: ModuleNameHash -> ModuleNameHash -> Bool
Eq, Eq ModuleNameHash
Eq ModuleNameHash
-> (ModuleNameHash -> ModuleNameHash -> Ordering)
-> (ModuleNameHash -> ModuleNameHash -> Bool)
-> (ModuleNameHash -> ModuleNameHash -> Bool)
-> (ModuleNameHash -> ModuleNameHash -> Bool)
-> (ModuleNameHash -> ModuleNameHash -> Bool)
-> (ModuleNameHash -> ModuleNameHash -> ModuleNameHash)
-> (ModuleNameHash -> ModuleNameHash -> ModuleNameHash)
-> Ord ModuleNameHash
ModuleNameHash -> ModuleNameHash -> Bool
ModuleNameHash -> ModuleNameHash -> Ordering
ModuleNameHash -> ModuleNameHash -> ModuleNameHash
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 :: ModuleNameHash -> ModuleNameHash -> ModuleNameHash
$cmin :: ModuleNameHash -> ModuleNameHash -> ModuleNameHash
max :: ModuleNameHash -> ModuleNameHash -> ModuleNameHash
$cmax :: ModuleNameHash -> ModuleNameHash -> ModuleNameHash
>= :: ModuleNameHash -> ModuleNameHash -> Bool
$c>= :: ModuleNameHash -> ModuleNameHash -> Bool
> :: ModuleNameHash -> ModuleNameHash -> Bool
$c> :: ModuleNameHash -> ModuleNameHash -> Bool
<= :: ModuleNameHash -> ModuleNameHash -> Bool
$c<= :: ModuleNameHash -> ModuleNameHash -> Bool
< :: ModuleNameHash -> ModuleNameHash -> Bool
$c< :: ModuleNameHash -> ModuleNameHash -> Bool
compare :: ModuleNameHash -> ModuleNameHash -> Ordering
$ccompare :: ModuleNameHash -> ModuleNameHash -> Ordering
$cp1Ord :: Eq ModuleNameHash
Ord, Int -> ModuleNameHash -> ShowS
[ModuleNameHash] -> ShowS
ModuleNameHash -> String
(Int -> ModuleNameHash -> ShowS)
-> (ModuleNameHash -> String)
-> ([ModuleNameHash] -> ShowS)
-> Show ModuleNameHash
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleNameHash] -> ShowS
$cshowList :: [ModuleNameHash] -> ShowS
show :: ModuleNameHash -> String
$cshow :: ModuleNameHash -> String
showsPrec :: Int -> ModuleNameHash -> ShowS
$cshowsPrec :: Int -> ModuleNameHash -> ShowS
Show, Typeable ModuleNameHash
DataType
Constr
Typeable ModuleNameHash
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ModuleNameHash -> c ModuleNameHash)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ModuleNameHash)
-> (ModuleNameHash -> Constr)
-> (ModuleNameHash -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ModuleNameHash))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ModuleNameHash))
-> ((forall b. Data b => b -> b)
    -> ModuleNameHash -> ModuleNameHash)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ModuleNameHash -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ModuleNameHash -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> ModuleNameHash -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ModuleNameHash -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> ModuleNameHash -> m ModuleNameHash)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ModuleNameHash -> m ModuleNameHash)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ModuleNameHash -> m ModuleNameHash)
-> Data ModuleNameHash
ModuleNameHash -> DataType
ModuleNameHash -> Constr
(forall b. Data b => b -> b) -> ModuleNameHash -> ModuleNameHash
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleNameHash -> c ModuleNameHash
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleNameHash
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) -> ModuleNameHash -> u
forall u. (forall d. Data d => d -> u) -> ModuleNameHash -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleNameHash -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleNameHash -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ModuleNameHash -> m ModuleNameHash
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleNameHash -> m ModuleNameHash
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleNameHash
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleNameHash -> c ModuleNameHash
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ModuleNameHash)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleNameHash)
$cModuleNameHash :: Constr
$tModuleNameHash :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> ModuleNameHash -> m ModuleNameHash
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleNameHash -> m ModuleNameHash
gmapMp :: (forall d. Data d => d -> m d)
-> ModuleNameHash -> m ModuleNameHash
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleNameHash -> m ModuleNameHash
gmapM :: (forall d. Data d => d -> m d)
-> ModuleNameHash -> m ModuleNameHash
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ModuleNameHash -> m ModuleNameHash
gmapQi :: Int -> (forall d. Data d => d -> u) -> ModuleNameHash -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ModuleNameHash -> u
gmapQ :: (forall d. Data d => d -> u) -> ModuleNameHash -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ModuleNameHash -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleNameHash -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleNameHash -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleNameHash -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleNameHash -> r
gmapT :: (forall b. Data b => b -> b) -> ModuleNameHash -> ModuleNameHash
$cgmapT :: (forall b. Data b => b -> b) -> ModuleNameHash -> ModuleNameHash
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleNameHash)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleNameHash)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ModuleNameHash)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ModuleNameHash)
dataTypeOf :: ModuleNameHash -> DataType
$cdataTypeOf :: ModuleNameHash -> DataType
toConstr :: ModuleNameHash -> Constr
$ctoConstr :: ModuleNameHash -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleNameHash
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleNameHash
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleNameHash -> c ModuleNameHash
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleNameHash -> c ModuleNameHash
$cp1Data :: Typeable ModuleNameHash
Data)

noModuleNameHash :: ModuleNameHash
noModuleNameHash :: ModuleNameHash
noModuleNameHash = Word64 -> ModuleNameHash
ModuleNameHash Word64
0

-- | The unique identifier of a name. Second argument is the top-level module
--   identifier.
data NameId = NameId {-# UNPACK #-} !Word64 {-# UNPACK #-} !ModuleNameHash
    deriving (NameId -> NameId -> Bool
(NameId -> NameId -> Bool)
-> (NameId -> NameId -> Bool) -> Eq NameId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NameId -> NameId -> Bool
$c/= :: NameId -> NameId -> Bool
== :: NameId -> NameId -> Bool
$c== :: NameId -> NameId -> Bool
Eq, Eq NameId
Eq NameId
-> (NameId -> NameId -> Ordering)
-> (NameId -> NameId -> Bool)
-> (NameId -> NameId -> Bool)
-> (NameId -> NameId -> Bool)
-> (NameId -> NameId -> Bool)
-> (NameId -> NameId -> NameId)
-> (NameId -> NameId -> NameId)
-> Ord NameId
NameId -> NameId -> Bool
NameId -> NameId -> Ordering
NameId -> NameId -> NameId
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 :: NameId -> NameId -> NameId
$cmin :: NameId -> NameId -> NameId
max :: NameId -> NameId -> NameId
$cmax :: NameId -> NameId -> NameId
>= :: NameId -> NameId -> Bool
$c>= :: NameId -> NameId -> Bool
> :: NameId -> NameId -> Bool
$c> :: NameId -> NameId -> Bool
<= :: NameId -> NameId -> Bool
$c<= :: NameId -> NameId -> Bool
< :: NameId -> NameId -> Bool
$c< :: NameId -> NameId -> Bool
compare :: NameId -> NameId -> Ordering
$ccompare :: NameId -> NameId -> Ordering
$cp1Ord :: Eq NameId
Ord, Typeable NameId
DataType
Constr
Typeable NameId
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> NameId -> c NameId)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NameId)
-> (NameId -> Constr)
-> (NameId -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NameId))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameId))
-> ((forall b. Data b => b -> b) -> NameId -> NameId)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NameId -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NameId -> r)
-> (forall u. (forall d. Data d => d -> u) -> NameId -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> NameId -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> NameId -> m NameId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NameId -> m NameId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NameId -> m NameId)
-> Data NameId
NameId -> DataType
NameId -> Constr
(forall b. Data b => b -> b) -> NameId -> NameId
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameId -> c NameId
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameId
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) -> NameId -> u
forall u. (forall d. Data d => d -> u) -> NameId -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NameId -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NameId -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NameId -> m NameId
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameId -> m NameId
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameId
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameId -> c NameId
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NameId)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameId)
$cNameId :: Constr
$tNameId :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NameId -> m NameId
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameId -> m NameId
gmapMp :: (forall d. Data d => d -> m d) -> NameId -> m NameId
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameId -> m NameId
gmapM :: (forall d. Data d => d -> m d) -> NameId -> m NameId
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NameId -> m NameId
gmapQi :: Int -> (forall d. Data d => d -> u) -> NameId -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NameId -> u
gmapQ :: (forall d. Data d => d -> u) -> NameId -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NameId -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NameId -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NameId -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NameId -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NameId -> r
gmapT :: (forall b. Data b => b -> b) -> NameId -> NameId
$cgmapT :: (forall b. Data b => b -> b) -> NameId -> NameId
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameId)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameId)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c NameId)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NameId)
dataTypeOf :: NameId -> DataType
$cdataTypeOf :: NameId -> DataType
toConstr :: NameId -> Constr
$ctoConstr :: NameId -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameId
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameId
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameId -> c NameId
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameId -> c NameId
$cp1Data :: Typeable NameId
Data, (forall x. NameId -> Rep NameId x)
-> (forall x. Rep NameId x -> NameId) -> Generic NameId
forall x. Rep NameId x -> NameId
forall x. NameId -> Rep NameId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NameId x -> NameId
$cfrom :: forall x. NameId -> Rep NameId x
Generic, Int -> NameId -> ShowS
[NameId] -> ShowS
NameId -> String
(Int -> NameId -> ShowS)
-> (NameId -> String) -> ([NameId] -> ShowS) -> Show NameId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NameId] -> ShowS
$cshowList :: [NameId] -> ShowS
show :: NameId -> String
$cshow :: NameId -> String
showsPrec :: Int -> NameId -> ShowS
$cshowsPrec :: Int -> NameId -> ShowS
Show)

instance KillRange NameId where
  killRange :: NameId -> NameId
killRange = NameId -> NameId
forall a. a -> a
id

instance Pretty NameId where
  pretty :: NameId -> Doc
pretty (NameId Word64
n ModuleNameHash
m) = String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ Word64 -> String
forall a. Show a => a -> String
show Word64
n String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"@" String -> ShowS
forall a. [a] -> [a] -> [a]
++ ModuleNameHash -> String
forall a. Show a => a -> String
show ModuleNameHash
m

instance Enum NameId where
  succ :: NameId -> NameId
succ (NameId Word64
n ModuleNameHash
m)     = Word64 -> ModuleNameHash -> NameId
NameId (Word64
n Word64 -> Word64 -> Word64
forall a. Num a => a -> a -> a
+ Word64
1) ModuleNameHash
m
  pred :: NameId -> NameId
pred (NameId Word64
n ModuleNameHash
m)     = Word64 -> ModuleNameHash -> NameId
NameId (Word64
n Word64 -> Word64 -> Word64
forall a. Num a => a -> a -> a
- Word64
1) ModuleNameHash
m
  toEnum :: Int -> NameId
toEnum Int
n              = NameId
forall a. HasCallStack => a
__IMPOSSIBLE__  -- should not be used
  fromEnum :: NameId -> Int
fromEnum (NameId Word64
n ModuleNameHash
_) = Word64 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word64
n

instance NFData NameId where
  rnf :: NameId -> ()
rnf (NameId Word64
_ ModuleNameHash
_) = ()

instance NFData ModuleNameHash where
  rnf :: ModuleNameHash -> ()
rnf ModuleNameHash
_ = ()

instance Hashable NameId where
  {-# INLINE hashWithSalt #-}
  hashWithSalt :: Int -> NameId -> Int
hashWithSalt Int
salt (NameId Word64
n (ModuleNameHash Word64
m)) = Int -> (Word64, Word64) -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
salt (Word64
n, Word64
m)

---------------------------------------------------------------------------
-- * Meta variables
---------------------------------------------------------------------------

-- | A meta variable identifier is just a natural number.
--
newtype MetaId = MetaId { MetaId -> Int
metaId :: Nat }
    deriving (MetaId -> MetaId -> Bool
(MetaId -> MetaId -> Bool)
-> (MetaId -> MetaId -> Bool) -> Eq MetaId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetaId -> MetaId -> Bool
$c/= :: MetaId -> MetaId -> Bool
== :: MetaId -> MetaId -> Bool
$c== :: MetaId -> MetaId -> Bool
Eq, Eq MetaId
Eq MetaId
-> (MetaId -> MetaId -> Ordering)
-> (MetaId -> MetaId -> Bool)
-> (MetaId -> MetaId -> Bool)
-> (MetaId -> MetaId -> Bool)
-> (MetaId -> MetaId -> Bool)
-> (MetaId -> MetaId -> MetaId)
-> (MetaId -> MetaId -> MetaId)
-> Ord MetaId
MetaId -> MetaId -> Bool
MetaId -> MetaId -> Ordering
MetaId -> MetaId -> MetaId
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 :: MetaId -> MetaId -> MetaId
$cmin :: MetaId -> MetaId -> MetaId
max :: MetaId -> MetaId -> MetaId
$cmax :: MetaId -> MetaId -> MetaId
>= :: MetaId -> MetaId -> Bool
$c>= :: MetaId -> MetaId -> Bool
> :: MetaId -> MetaId -> Bool
$c> :: MetaId -> MetaId -> Bool
<= :: MetaId -> MetaId -> Bool
$c<= :: MetaId -> MetaId -> Bool
< :: MetaId -> MetaId -> Bool
$c< :: MetaId -> MetaId -> Bool
compare :: MetaId -> MetaId -> Ordering
$ccompare :: MetaId -> MetaId -> Ordering
$cp1Ord :: Eq MetaId
Ord, Integer -> MetaId
MetaId -> MetaId
MetaId -> MetaId -> MetaId
(MetaId -> MetaId -> MetaId)
-> (MetaId -> MetaId -> MetaId)
-> (MetaId -> MetaId -> MetaId)
-> (MetaId -> MetaId)
-> (MetaId -> MetaId)
-> (MetaId -> MetaId)
-> (Integer -> MetaId)
-> Num MetaId
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> MetaId
$cfromInteger :: Integer -> MetaId
signum :: MetaId -> MetaId
$csignum :: MetaId -> MetaId
abs :: MetaId -> MetaId
$cabs :: MetaId -> MetaId
negate :: MetaId -> MetaId
$cnegate :: MetaId -> MetaId
* :: MetaId -> MetaId -> MetaId
$c* :: MetaId -> MetaId -> MetaId
- :: MetaId -> MetaId -> MetaId
$c- :: MetaId -> MetaId -> MetaId
+ :: MetaId -> MetaId -> MetaId
$c+ :: MetaId -> MetaId -> MetaId
Num, Num MetaId
Ord MetaId
Num MetaId -> Ord MetaId -> (MetaId -> Rational) -> Real MetaId
MetaId -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: MetaId -> Rational
$ctoRational :: MetaId -> Rational
$cp2Real :: Ord MetaId
$cp1Real :: Num MetaId
Real, Int -> MetaId
MetaId -> Int
MetaId -> [MetaId]
MetaId -> MetaId
MetaId -> MetaId -> [MetaId]
MetaId -> MetaId -> MetaId -> [MetaId]
(MetaId -> MetaId)
-> (MetaId -> MetaId)
-> (Int -> MetaId)
-> (MetaId -> Int)
-> (MetaId -> [MetaId])
-> (MetaId -> MetaId -> [MetaId])
-> (MetaId -> MetaId -> [MetaId])
-> (MetaId -> MetaId -> MetaId -> [MetaId])
-> Enum MetaId
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: MetaId -> MetaId -> MetaId -> [MetaId]
$cenumFromThenTo :: MetaId -> MetaId -> MetaId -> [MetaId]
enumFromTo :: MetaId -> MetaId -> [MetaId]
$cenumFromTo :: MetaId -> MetaId -> [MetaId]
enumFromThen :: MetaId -> MetaId -> [MetaId]
$cenumFromThen :: MetaId -> MetaId -> [MetaId]
enumFrom :: MetaId -> [MetaId]
$cenumFrom :: MetaId -> [MetaId]
fromEnum :: MetaId -> Int
$cfromEnum :: MetaId -> Int
toEnum :: Int -> MetaId
$ctoEnum :: Int -> MetaId
pred :: MetaId -> MetaId
$cpred :: MetaId -> MetaId
succ :: MetaId -> MetaId
$csucc :: MetaId -> MetaId
Enum, Enum MetaId
Real MetaId
Real MetaId
-> Enum MetaId
-> (MetaId -> MetaId -> MetaId)
-> (MetaId -> MetaId -> MetaId)
-> (MetaId -> MetaId -> MetaId)
-> (MetaId -> MetaId -> MetaId)
-> (MetaId -> MetaId -> (MetaId, MetaId))
-> (MetaId -> MetaId -> (MetaId, MetaId))
-> (MetaId -> Integer)
-> Integral MetaId
MetaId -> Integer
MetaId -> MetaId -> (MetaId, MetaId)
MetaId -> MetaId -> MetaId
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: MetaId -> Integer
$ctoInteger :: MetaId -> Integer
divMod :: MetaId -> MetaId -> (MetaId, MetaId)
$cdivMod :: MetaId -> MetaId -> (MetaId, MetaId)
quotRem :: MetaId -> MetaId -> (MetaId, MetaId)
$cquotRem :: MetaId -> MetaId -> (MetaId, MetaId)
mod :: MetaId -> MetaId -> MetaId
$cmod :: MetaId -> MetaId -> MetaId
div :: MetaId -> MetaId -> MetaId
$cdiv :: MetaId -> MetaId -> MetaId
rem :: MetaId -> MetaId -> MetaId
$crem :: MetaId -> MetaId -> MetaId
quot :: MetaId -> MetaId -> MetaId
$cquot :: MetaId -> MetaId -> MetaId
$cp2Integral :: Enum MetaId
$cp1Integral :: Real MetaId
Integral, Typeable MetaId
DataType
Constr
Typeable MetaId
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> MetaId -> c MetaId)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MetaId)
-> (MetaId -> Constr)
-> (MetaId -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MetaId))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MetaId))
-> ((forall b. Data b => b -> b) -> MetaId -> MetaId)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MetaId -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MetaId -> r)
-> (forall u. (forall d. Data d => d -> u) -> MetaId -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> MetaId -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> MetaId -> m MetaId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MetaId -> m MetaId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MetaId -> m MetaId)
-> Data MetaId
MetaId -> DataType
MetaId -> Constr
(forall b. Data b => b -> b) -> MetaId -> MetaId
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MetaId -> c MetaId
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MetaId
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) -> MetaId -> u
forall u. (forall d. Data d => d -> u) -> MetaId -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MetaId -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MetaId -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MetaId -> m MetaId
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MetaId -> m MetaId
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MetaId
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MetaId -> c MetaId
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MetaId)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MetaId)
$cMetaId :: Constr
$tMetaId :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> MetaId -> m MetaId
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MetaId -> m MetaId
gmapMp :: (forall d. Data d => d -> m d) -> MetaId -> m MetaId
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MetaId -> m MetaId
gmapM :: (forall d. Data d => d -> m d) -> MetaId -> m MetaId
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MetaId -> m MetaId
gmapQi :: Int -> (forall d. Data d => d -> u) -> MetaId -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MetaId -> u
gmapQ :: (forall d. Data d => d -> u) -> MetaId -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> MetaId -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MetaId -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MetaId -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MetaId -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MetaId -> r
gmapT :: (forall b. Data b => b -> b) -> MetaId -> MetaId
$cgmapT :: (forall b. Data b => b -> b) -> MetaId -> MetaId
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MetaId)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MetaId)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c MetaId)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MetaId)
dataTypeOf :: MetaId -> DataType
$cdataTypeOf :: MetaId -> DataType
toConstr :: MetaId -> Constr
$ctoConstr :: MetaId -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MetaId
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MetaId
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MetaId -> c MetaId
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MetaId -> c MetaId
$cp1Data :: Typeable MetaId
Data, (forall x. MetaId -> Rep MetaId x)
-> (forall x. Rep MetaId x -> MetaId) -> Generic MetaId
forall x. Rep MetaId x -> MetaId
forall x. MetaId -> Rep MetaId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetaId x -> MetaId
$cfrom :: forall x. MetaId -> Rep MetaId x
Generic)

instance Pretty MetaId where
  pretty :: MetaId -> Doc
pretty (MetaId Int
n) = String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ String
"_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

-- | Show non-record version of this newtype.
instance Show MetaId where
  showsPrec :: Int -> MetaId -> ShowS
showsPrec Int
p (MetaId Int
n) = Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
0) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
    String -> ShowS
showString String
"MetaId " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ShowS
forall a. Show a => a -> ShowS
shows Int
n

instance NFData MetaId where
  rnf :: MetaId -> ()
rnf (MetaId Int
x) = Int -> ()
forall a. NFData a => a -> ()
rnf Int
x

instance Hashable MetaId

newtype Constr a = Constr a

-----------------------------------------------------------------------------
-- * Problems
-----------------------------------------------------------------------------

-- | A "problem" consists of a set of constraints and the same constraint can be part of multiple
--   problems.
newtype ProblemId = ProblemId Nat
  deriving (Typeable ProblemId
DataType
Constr
Typeable ProblemId
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ProblemId -> c ProblemId)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ProblemId)
-> (ProblemId -> Constr)
-> (ProblemId -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ProblemId))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProblemId))
-> ((forall b. Data b => b -> b) -> ProblemId -> ProblemId)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ProblemId -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ProblemId -> r)
-> (forall u. (forall d. Data d => d -> u) -> ProblemId -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ProblemId -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ProblemId -> m ProblemId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ProblemId -> m ProblemId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ProblemId -> m ProblemId)
-> Data ProblemId
ProblemId -> DataType
ProblemId -> Constr
(forall b. Data b => b -> b) -> ProblemId -> ProblemId
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProblemId -> c ProblemId
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProblemId
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) -> ProblemId -> u
forall u. (forall d. Data d => d -> u) -> ProblemId -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemId -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemId -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProblemId -> m ProblemId
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProblemId -> m ProblemId
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProblemId
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProblemId -> c ProblemId
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ProblemId)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProblemId)
$cProblemId :: Constr
$tProblemId :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ProblemId -> m ProblemId
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProblemId -> m ProblemId
gmapMp :: (forall d. Data d => d -> m d) -> ProblemId -> m ProblemId
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProblemId -> m ProblemId
gmapM :: (forall d. Data d => d -> m d) -> ProblemId -> m ProblemId
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProblemId -> m ProblemId
gmapQi :: Int -> (forall d. Data d => d -> u) -> ProblemId -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ProblemId -> u
gmapQ :: (forall d. Data d => d -> u) -> ProblemId -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ProblemId -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemId -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemId -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemId -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemId -> r
gmapT :: (forall b. Data b => b -> b) -> ProblemId -> ProblemId
$cgmapT :: (forall b. Data b => b -> b) -> ProblemId -> ProblemId
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProblemId)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProblemId)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ProblemId)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ProblemId)
dataTypeOf :: ProblemId -> DataType
$cdataTypeOf :: ProblemId -> DataType
toConstr :: ProblemId -> Constr
$ctoConstr :: ProblemId -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProblemId
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProblemId
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProblemId -> c ProblemId
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProblemId -> c ProblemId
$cp1Data :: Typeable ProblemId
Data, ProblemId -> ProblemId -> Bool
(ProblemId -> ProblemId -> Bool)
-> (ProblemId -> ProblemId -> Bool) -> Eq ProblemId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProblemId -> ProblemId -> Bool
$c/= :: ProblemId -> ProblemId -> Bool
== :: ProblemId -> ProblemId -> Bool
$c== :: ProblemId -> ProblemId -> Bool
Eq, Eq ProblemId
Eq ProblemId
-> (ProblemId -> ProblemId -> Ordering)
-> (ProblemId -> ProblemId -> Bool)
-> (ProblemId -> ProblemId -> Bool)
-> (ProblemId -> ProblemId -> Bool)
-> (ProblemId -> ProblemId -> Bool)
-> (ProblemId -> ProblemId -> ProblemId)
-> (ProblemId -> ProblemId -> ProblemId)
-> Ord ProblemId
ProblemId -> ProblemId -> Bool
ProblemId -> ProblemId -> Ordering
ProblemId -> ProblemId -> ProblemId
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 :: ProblemId -> ProblemId -> ProblemId
$cmin :: ProblemId -> ProblemId -> ProblemId
max :: ProblemId -> ProblemId -> ProblemId
$cmax :: ProblemId -> ProblemId -> ProblemId
>= :: ProblemId -> ProblemId -> Bool
$c>= :: ProblemId -> ProblemId -> Bool
> :: ProblemId -> ProblemId -> Bool
$c> :: ProblemId -> ProblemId -> Bool
<= :: ProblemId -> ProblemId -> Bool
$c<= :: ProblemId -> ProblemId -> Bool
< :: ProblemId -> ProblemId -> Bool
$c< :: ProblemId -> ProblemId -> Bool
compare :: ProblemId -> ProblemId -> Ordering
$ccompare :: ProblemId -> ProblemId -> Ordering
$cp1Ord :: Eq ProblemId
Ord, Int -> ProblemId
ProblemId -> Int
ProblemId -> [ProblemId]
ProblemId -> ProblemId
ProblemId -> ProblemId -> [ProblemId]
ProblemId -> ProblemId -> ProblemId -> [ProblemId]
(ProblemId -> ProblemId)
-> (ProblemId -> ProblemId)
-> (Int -> ProblemId)
-> (ProblemId -> Int)
-> (ProblemId -> [ProblemId])
-> (ProblemId -> ProblemId -> [ProblemId])
-> (ProblemId -> ProblemId -> [ProblemId])
-> (ProblemId -> ProblemId -> ProblemId -> [ProblemId])
-> Enum ProblemId
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ProblemId -> ProblemId -> ProblemId -> [ProblemId]
$cenumFromThenTo :: ProblemId -> ProblemId -> ProblemId -> [ProblemId]
enumFromTo :: ProblemId -> ProblemId -> [ProblemId]
$cenumFromTo :: ProblemId -> ProblemId -> [ProblemId]
enumFromThen :: ProblemId -> ProblemId -> [ProblemId]
$cenumFromThen :: ProblemId -> ProblemId -> [ProblemId]
enumFrom :: ProblemId -> [ProblemId]
$cenumFrom :: ProblemId -> [ProblemId]
fromEnum :: ProblemId -> Int
$cfromEnum :: ProblemId -> Int
toEnum :: Int -> ProblemId
$ctoEnum :: Int -> ProblemId
pred :: ProblemId -> ProblemId
$cpred :: ProblemId -> ProblemId
succ :: ProblemId -> ProblemId
$csucc :: ProblemId -> ProblemId
Enum, Num ProblemId
Ord ProblemId
Num ProblemId
-> Ord ProblemId -> (ProblemId -> Rational) -> Real ProblemId
ProblemId -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: ProblemId -> Rational
$ctoRational :: ProblemId -> Rational
$cp2Real :: Ord ProblemId
$cp1Real :: Num ProblemId
Real, Enum ProblemId
Real ProblemId
Real ProblemId
-> Enum ProblemId
-> (ProblemId -> ProblemId -> ProblemId)
-> (ProblemId -> ProblemId -> ProblemId)
-> (ProblemId -> ProblemId -> ProblemId)
-> (ProblemId -> ProblemId -> ProblemId)
-> (ProblemId -> ProblemId -> (ProblemId, ProblemId))
-> (ProblemId -> ProblemId -> (ProblemId, ProblemId))
-> (ProblemId -> Integer)
-> Integral ProblemId
ProblemId -> Integer
ProblemId -> ProblemId -> (ProblemId, ProblemId)
ProblemId -> ProblemId -> ProblemId
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: ProblemId -> Integer
$ctoInteger :: ProblemId -> Integer
divMod :: ProblemId -> ProblemId -> (ProblemId, ProblemId)
$cdivMod :: ProblemId -> ProblemId -> (ProblemId, ProblemId)
quotRem :: ProblemId -> ProblemId -> (ProblemId, ProblemId)
$cquotRem :: ProblemId -> ProblemId -> (ProblemId, ProblemId)
mod :: ProblemId -> ProblemId -> ProblemId
$cmod :: ProblemId -> ProblemId -> ProblemId
div :: ProblemId -> ProblemId -> ProblemId
$cdiv :: ProblemId -> ProblemId -> ProblemId
rem :: ProblemId -> ProblemId -> ProblemId
$crem :: ProblemId -> ProblemId -> ProblemId
quot :: ProblemId -> ProblemId -> ProblemId
$cquot :: ProblemId -> ProblemId -> ProblemId
$cp2Integral :: Enum ProblemId
$cp1Integral :: Real ProblemId
Integral, Integer -> ProblemId
ProblemId -> ProblemId
ProblemId -> ProblemId -> ProblemId
(ProblemId -> ProblemId -> ProblemId)
-> (ProblemId -> ProblemId -> ProblemId)
-> (ProblemId -> ProblemId -> ProblemId)
-> (ProblemId -> ProblemId)
-> (ProblemId -> ProblemId)
-> (ProblemId -> ProblemId)
-> (Integer -> ProblemId)
-> Num ProblemId
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> ProblemId
$cfromInteger :: Integer -> ProblemId
signum :: ProblemId -> ProblemId
$csignum :: ProblemId -> ProblemId
abs :: ProblemId -> ProblemId
$cabs :: ProblemId -> ProblemId
negate :: ProblemId -> ProblemId
$cnegate :: ProblemId -> ProblemId
* :: ProblemId -> ProblemId -> ProblemId
$c* :: ProblemId -> ProblemId -> ProblemId
- :: ProblemId -> ProblemId -> ProblemId
$c- :: ProblemId -> ProblemId -> ProblemId
+ :: ProblemId -> ProblemId -> ProblemId
$c+ :: ProblemId -> ProblemId -> ProblemId
Num, ProblemId -> ()
(ProblemId -> ()) -> NFData ProblemId
forall a. (a -> ()) -> NFData a
rnf :: ProblemId -> ()
$crnf :: ProblemId -> ()
NFData)

-- This particular Show instance is ok because of the Num instance.
instance Show   ProblemId where show :: ProblemId -> String
show   (ProblemId Int
n) = Int -> String
forall a. Show a => a -> String
show Int
n
instance Pretty ProblemId where pretty :: ProblemId -> Doc
pretty (ProblemId Int
n) = Int -> Doc
forall a. Pretty a => a -> Doc
pretty Int
n

------------------------------------------------------------------------
-- * Placeholders (used to parse sections)
------------------------------------------------------------------------

-- | The position of a name part or underscore in a name.

data PositionInName
  = Beginning
    -- ^ The following underscore is at the beginning of the name:
    -- @_foo@.
  | Middle
    -- ^ The following underscore is in the middle of the name:
    -- @foo_bar@.
  | End
    -- ^ The following underscore is at the end of the name: @foo_@.
  deriving (Int -> PositionInName -> ShowS
[PositionInName] -> ShowS
PositionInName -> String
(Int -> PositionInName -> ShowS)
-> (PositionInName -> String)
-> ([PositionInName] -> ShowS)
-> Show PositionInName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PositionInName] -> ShowS
$cshowList :: [PositionInName] -> ShowS
show :: PositionInName -> String
$cshow :: PositionInName -> String
showsPrec :: Int -> PositionInName -> ShowS
$cshowsPrec :: Int -> PositionInName -> ShowS
Show, PositionInName -> PositionInName -> Bool
(PositionInName -> PositionInName -> Bool)
-> (PositionInName -> PositionInName -> Bool) -> Eq PositionInName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PositionInName -> PositionInName -> Bool
$c/= :: PositionInName -> PositionInName -> Bool
== :: PositionInName -> PositionInName -> Bool
$c== :: PositionInName -> PositionInName -> Bool
Eq, Eq PositionInName
Eq PositionInName
-> (PositionInName -> PositionInName -> Ordering)
-> (PositionInName -> PositionInName -> Bool)
-> (PositionInName -> PositionInName -> Bool)
-> (PositionInName -> PositionInName -> Bool)
-> (PositionInName -> PositionInName -> Bool)
-> (PositionInName -> PositionInName -> PositionInName)
-> (PositionInName -> PositionInName -> PositionInName)
-> Ord PositionInName
PositionInName -> PositionInName -> Bool
PositionInName -> PositionInName -> Ordering
PositionInName -> PositionInName -> PositionInName
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 :: PositionInName -> PositionInName -> PositionInName
$cmin :: PositionInName -> PositionInName -> PositionInName
max :: PositionInName -> PositionInName -> PositionInName
$cmax :: PositionInName -> PositionInName -> PositionInName
>= :: PositionInName -> PositionInName -> Bool
$c>= :: PositionInName -> PositionInName -> Bool
> :: PositionInName -> PositionInName -> Bool
$c> :: PositionInName -> PositionInName -> Bool
<= :: PositionInName -> PositionInName -> Bool
$c<= :: PositionInName -> PositionInName -> Bool
< :: PositionInName -> PositionInName -> Bool
$c< :: PositionInName -> PositionInName -> Bool
compare :: PositionInName -> PositionInName -> Ordering
$ccompare :: PositionInName -> PositionInName -> Ordering
$cp1Ord :: Eq PositionInName
Ord, Typeable PositionInName
DataType
Constr
Typeable PositionInName
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PositionInName -> c PositionInName)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PositionInName)
-> (PositionInName -> Constr)
-> (PositionInName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PositionInName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PositionInName))
-> ((forall b. Data b => b -> b)
    -> PositionInName -> PositionInName)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PositionInName -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PositionInName -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> PositionInName -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> PositionInName -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> PositionInName -> m PositionInName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PositionInName -> m PositionInName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PositionInName -> m PositionInName)
-> Data PositionInName
PositionInName -> DataType
PositionInName -> Constr
(forall b. Data b => b -> b) -> PositionInName -> PositionInName
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositionInName -> c PositionInName
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositionInName
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) -> PositionInName -> u
forall u. (forall d. Data d => d -> u) -> PositionInName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PositionInName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PositionInName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> PositionInName -> m PositionInName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PositionInName -> m PositionInName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositionInName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositionInName -> c PositionInName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PositionInName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PositionInName)
$cEnd :: Constr
$cMiddle :: Constr
$cBeginning :: Constr
$tPositionInName :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> PositionInName -> m PositionInName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PositionInName -> m PositionInName
gmapMp :: (forall d. Data d => d -> m d)
-> PositionInName -> m PositionInName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PositionInName -> m PositionInName
gmapM :: (forall d. Data d => d -> m d)
-> PositionInName -> m PositionInName
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> PositionInName -> m PositionInName
gmapQi :: Int -> (forall d. Data d => d -> u) -> PositionInName -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> PositionInName -> u
gmapQ :: (forall d. Data d => d -> u) -> PositionInName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> PositionInName -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PositionInName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PositionInName -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PositionInName -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PositionInName -> r
gmapT :: (forall b. Data b => b -> b) -> PositionInName -> PositionInName
$cgmapT :: (forall b. Data b => b -> b) -> PositionInName -> PositionInName
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PositionInName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PositionInName)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c PositionInName)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PositionInName)
dataTypeOf :: PositionInName -> DataType
$cdataTypeOf :: PositionInName -> DataType
toConstr :: PositionInName -> Constr
$ctoConstr :: PositionInName -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositionInName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositionInName
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositionInName -> c PositionInName
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositionInName -> c PositionInName
$cp1Data :: Typeable PositionInName
Data)

-- | Placeholders are used to represent the underscores in a section.

data MaybePlaceholder e
  = Placeholder !PositionInName
  | NoPlaceholder !(Strict.Maybe PositionInName) e
    -- ^ The second argument is used only (but not always) for name
    -- parts other than underscores.
  deriving (Typeable (MaybePlaceholder e)
DataType
Constr
Typeable (MaybePlaceholder e)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> MaybePlaceholder e
    -> c (MaybePlaceholder e))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (MaybePlaceholder e))
-> (MaybePlaceholder e -> Constr)
-> (MaybePlaceholder e -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (MaybePlaceholder e)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (MaybePlaceholder e)))
-> ((forall b. Data b => b -> b)
    -> MaybePlaceholder e -> MaybePlaceholder e)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MaybePlaceholder e -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MaybePlaceholder e -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> MaybePlaceholder e -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> MaybePlaceholder e -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> MaybePlaceholder e -> m (MaybePlaceholder e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MaybePlaceholder e -> m (MaybePlaceholder e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MaybePlaceholder e -> m (MaybePlaceholder e))
-> Data (MaybePlaceholder e)
MaybePlaceholder e -> DataType
MaybePlaceholder e -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (MaybePlaceholder e))
(forall b. Data b => b -> b)
-> MaybePlaceholder e -> MaybePlaceholder e
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> MaybePlaceholder e
-> c (MaybePlaceholder e)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MaybePlaceholder e)
forall e. Data e => Typeable (MaybePlaceholder e)
forall e. Data e => MaybePlaceholder e -> DataType
forall e. Data e => MaybePlaceholder e -> Constr
forall e.
Data e =>
(forall b. Data b => b -> b)
-> MaybePlaceholder e -> MaybePlaceholder e
forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> MaybePlaceholder e -> u
forall e u.
Data e =>
(forall d. Data d => d -> u) -> MaybePlaceholder e -> [u]
forall e r r'.
Data e =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MaybePlaceholder e -> r
forall e r r'.
Data e =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MaybePlaceholder e -> r
forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d)
-> MaybePlaceholder e -> m (MaybePlaceholder e)
forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> MaybePlaceholder e -> m (MaybePlaceholder e)
forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MaybePlaceholder e)
forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> MaybePlaceholder e
-> c (MaybePlaceholder e)
forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (MaybePlaceholder e))
forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MaybePlaceholder e))
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) -> MaybePlaceholder e -> u
forall u. (forall d. Data d => d -> u) -> MaybePlaceholder e -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MaybePlaceholder e -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MaybePlaceholder e -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> MaybePlaceholder e -> m (MaybePlaceholder e)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> MaybePlaceholder e -> m (MaybePlaceholder e)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MaybePlaceholder e)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> MaybePlaceholder e
-> c (MaybePlaceholder e)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (MaybePlaceholder e))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MaybePlaceholder e))
$cNoPlaceholder :: Constr
$cPlaceholder :: Constr
$tMaybePlaceholder :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> MaybePlaceholder e -> m (MaybePlaceholder e)
$cgmapMo :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> MaybePlaceholder e -> m (MaybePlaceholder e)
gmapMp :: (forall d. Data d => d -> m d)
-> MaybePlaceholder e -> m (MaybePlaceholder e)
$cgmapMp :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> MaybePlaceholder e -> m (MaybePlaceholder e)
gmapM :: (forall d. Data d => d -> m d)
-> MaybePlaceholder e -> m (MaybePlaceholder e)
$cgmapM :: forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d)
-> MaybePlaceholder e -> m (MaybePlaceholder e)
gmapQi :: Int -> (forall d. Data d => d -> u) -> MaybePlaceholder e -> u
$cgmapQi :: forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> MaybePlaceholder e -> u
gmapQ :: (forall d. Data d => d -> u) -> MaybePlaceholder e -> [u]
$cgmapQ :: forall e u.
Data e =>
(forall d. Data d => d -> u) -> MaybePlaceholder e -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MaybePlaceholder e -> r
$cgmapQr :: forall e r r'.
Data e =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MaybePlaceholder e -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MaybePlaceholder e -> r
$cgmapQl :: forall e r r'.
Data e =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MaybePlaceholder e -> r
gmapT :: (forall b. Data b => b -> b)
-> MaybePlaceholder e -> MaybePlaceholder e
$cgmapT :: forall e.
Data e =>
(forall b. Data b => b -> b)
-> MaybePlaceholder e -> MaybePlaceholder e
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MaybePlaceholder e))
$cdataCast2 :: forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MaybePlaceholder e))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (MaybePlaceholder e))
$cdataCast1 :: forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (MaybePlaceholder e))
dataTypeOf :: MaybePlaceholder e -> DataType
$cdataTypeOf :: forall e. Data e => MaybePlaceholder e -> DataType
toConstr :: MaybePlaceholder e -> Constr
$ctoConstr :: forall e. Data e => MaybePlaceholder e -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MaybePlaceholder e)
$cgunfold :: forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MaybePlaceholder e)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> MaybePlaceholder e
-> c (MaybePlaceholder e)
$cgfoldl :: forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> MaybePlaceholder e
-> c (MaybePlaceholder e)
$cp1Data :: forall e. Data e => Typeable (MaybePlaceholder e)
Data, MaybePlaceholder e -> MaybePlaceholder e -> Bool
(MaybePlaceholder e -> MaybePlaceholder e -> Bool)
-> (MaybePlaceholder e -> MaybePlaceholder e -> Bool)
-> Eq (MaybePlaceholder e)
forall e. Eq e => MaybePlaceholder e -> MaybePlaceholder e -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MaybePlaceholder e -> MaybePlaceholder e -> Bool
$c/= :: forall e. Eq e => MaybePlaceholder e -> MaybePlaceholder e -> Bool
== :: MaybePlaceholder e -> MaybePlaceholder e -> Bool
$c== :: forall e. Eq e => MaybePlaceholder e -> MaybePlaceholder e -> Bool
Eq, Eq (MaybePlaceholder e)
Eq (MaybePlaceholder e)
-> (MaybePlaceholder e -> MaybePlaceholder e -> Ordering)
-> (MaybePlaceholder e -> MaybePlaceholder e -> Bool)
-> (MaybePlaceholder e -> MaybePlaceholder e -> Bool)
-> (MaybePlaceholder e -> MaybePlaceholder e -> Bool)
-> (MaybePlaceholder e -> MaybePlaceholder e -> Bool)
-> (MaybePlaceholder e -> MaybePlaceholder e -> MaybePlaceholder e)
-> (MaybePlaceholder e -> MaybePlaceholder e -> MaybePlaceholder e)
-> Ord (MaybePlaceholder e)
MaybePlaceholder e -> MaybePlaceholder e -> Bool
MaybePlaceholder e -> MaybePlaceholder e -> Ordering
MaybePlaceholder e -> MaybePlaceholder e -> MaybePlaceholder e
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
forall e. Ord e => Eq (MaybePlaceholder e)
forall e. Ord e => MaybePlaceholder e -> MaybePlaceholder e -> Bool
forall e.
Ord e =>
MaybePlaceholder e -> MaybePlaceholder e -> Ordering
forall e.
Ord e =>
MaybePlaceholder e -> MaybePlaceholder e -> MaybePlaceholder e
min :: MaybePlaceholder e -> MaybePlaceholder e -> MaybePlaceholder e
$cmin :: forall e.
Ord e =>
MaybePlaceholder e -> MaybePlaceholder e -> MaybePlaceholder e
max :: MaybePlaceholder e -> MaybePlaceholder e -> MaybePlaceholder e
$cmax :: forall e.
Ord e =>
MaybePlaceholder e -> MaybePlaceholder e -> MaybePlaceholder e
>= :: MaybePlaceholder e -> MaybePlaceholder e -> Bool
$c>= :: forall e. Ord e => MaybePlaceholder e -> MaybePlaceholder e -> Bool
> :: MaybePlaceholder e -> MaybePlaceholder e -> Bool
$c> :: forall e. Ord e => MaybePlaceholder e -> MaybePlaceholder e -> Bool
<= :: MaybePlaceholder e -> MaybePlaceholder e -> Bool
$c<= :: forall e. Ord e => MaybePlaceholder e -> MaybePlaceholder e -> Bool
< :: MaybePlaceholder e -> MaybePlaceholder e -> Bool
$c< :: forall e. Ord e => MaybePlaceholder e -> MaybePlaceholder e -> Bool
compare :: MaybePlaceholder e -> MaybePlaceholder e -> Ordering
$ccompare :: forall e.
Ord e =>
MaybePlaceholder e -> MaybePlaceholder e -> Ordering
$cp1Ord :: forall e. Ord e => Eq (MaybePlaceholder e)
Ord, a -> MaybePlaceholder b -> MaybePlaceholder a
(a -> b) -> MaybePlaceholder a -> MaybePlaceholder b
(forall a b. (a -> b) -> MaybePlaceholder a -> MaybePlaceholder b)
-> (forall a b. a -> MaybePlaceholder b -> MaybePlaceholder a)
-> Functor MaybePlaceholder
forall a b. a -> MaybePlaceholder b -> MaybePlaceholder a
forall a b. (a -> b) -> MaybePlaceholder a -> MaybePlaceholder b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> MaybePlaceholder b -> MaybePlaceholder a
$c<$ :: forall a b. a -> MaybePlaceholder b -> MaybePlaceholder a
fmap :: (a -> b) -> MaybePlaceholder a -> MaybePlaceholder b
$cfmap :: forall a b. (a -> b) -> MaybePlaceholder a -> MaybePlaceholder b
Functor, MaybePlaceholder a -> Bool
(a -> m) -> MaybePlaceholder a -> m
(a -> b -> b) -> b -> MaybePlaceholder a -> b
(forall m. Monoid m => MaybePlaceholder m -> m)
-> (forall m a. Monoid m => (a -> m) -> MaybePlaceholder a -> m)
-> (forall m a. Monoid m => (a -> m) -> MaybePlaceholder a -> m)
-> (forall a b. (a -> b -> b) -> b -> MaybePlaceholder a -> b)
-> (forall a b. (a -> b -> b) -> b -> MaybePlaceholder a -> b)
-> (forall b a. (b -> a -> b) -> b -> MaybePlaceholder a -> b)
-> (forall b a. (b -> a -> b) -> b -> MaybePlaceholder a -> b)
-> (forall a. (a -> a -> a) -> MaybePlaceholder a -> a)
-> (forall a. (a -> a -> a) -> MaybePlaceholder a -> a)
-> (forall a. MaybePlaceholder a -> [a])
-> (forall a. MaybePlaceholder a -> Bool)
-> (forall a. MaybePlaceholder a -> Int)
-> (forall a. Eq a => a -> MaybePlaceholder a -> Bool)
-> (forall a. Ord a => MaybePlaceholder a -> a)
-> (forall a. Ord a => MaybePlaceholder a -> a)
-> (forall a. Num a => MaybePlaceholder a -> a)
-> (forall a. Num a => MaybePlaceholder a -> a)
-> Foldable MaybePlaceholder
forall a. Eq a => a -> MaybePlaceholder a -> Bool
forall a. Num a => MaybePlaceholder a -> a
forall a. Ord a => MaybePlaceholder a -> a
forall m. Monoid m => MaybePlaceholder m -> m
forall a. MaybePlaceholder a -> Bool
forall a. MaybePlaceholder a -> Int
forall a. MaybePlaceholder a -> [a]
forall a. (a -> a -> a) -> MaybePlaceholder a -> a
forall m a. Monoid m => (a -> m) -> MaybePlaceholder a -> m
forall b a. (b -> a -> b) -> b -> MaybePlaceholder a -> b
forall a b. (a -> b -> b) -> b -> MaybePlaceholder a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: MaybePlaceholder a -> a
$cproduct :: forall a. Num a => MaybePlaceholder a -> a
sum :: MaybePlaceholder a -> a
$csum :: forall a. Num a => MaybePlaceholder a -> a
minimum :: MaybePlaceholder a -> a
$cminimum :: forall a. Ord a => MaybePlaceholder a -> a
maximum :: MaybePlaceholder a -> a
$cmaximum :: forall a. Ord a => MaybePlaceholder a -> a
elem :: a -> MaybePlaceholder a -> Bool
$celem :: forall a. Eq a => a -> MaybePlaceholder a -> Bool
length :: MaybePlaceholder a -> Int
$clength :: forall a. MaybePlaceholder a -> Int
null :: MaybePlaceholder a -> Bool
$cnull :: forall a. MaybePlaceholder a -> Bool
toList :: MaybePlaceholder a -> [a]
$ctoList :: forall a. MaybePlaceholder a -> [a]
foldl1 :: (a -> a -> a) -> MaybePlaceholder a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> MaybePlaceholder a -> a
foldr1 :: (a -> a -> a) -> MaybePlaceholder a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> MaybePlaceholder a -> a
foldl' :: (b -> a -> b) -> b -> MaybePlaceholder a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> MaybePlaceholder a -> b
foldl :: (b -> a -> b) -> b -> MaybePlaceholder a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> MaybePlaceholder a -> b
foldr' :: (a -> b -> b) -> b -> MaybePlaceholder a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> MaybePlaceholder a -> b
foldr :: (a -> b -> b) -> b -> MaybePlaceholder a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> MaybePlaceholder a -> b
foldMap' :: (a -> m) -> MaybePlaceholder a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> MaybePlaceholder a -> m
foldMap :: (a -> m) -> MaybePlaceholder a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> MaybePlaceholder a -> m
fold :: MaybePlaceholder m -> m
$cfold :: forall m. Monoid m => MaybePlaceholder m -> m
Foldable, Functor MaybePlaceholder
Foldable MaybePlaceholder
Functor MaybePlaceholder
-> Foldable MaybePlaceholder
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> MaybePlaceholder a -> f (MaybePlaceholder b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    MaybePlaceholder (f a) -> f (MaybePlaceholder a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> MaybePlaceholder a -> m (MaybePlaceholder b))
-> (forall (m :: * -> *) a.
    Monad m =>
    MaybePlaceholder (m a) -> m (MaybePlaceholder a))
-> Traversable MaybePlaceholder
(a -> f b) -> MaybePlaceholder a -> f (MaybePlaceholder b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
MaybePlaceholder (m a) -> m (MaybePlaceholder a)
forall (f :: * -> *) a.
Applicative f =>
MaybePlaceholder (f a) -> f (MaybePlaceholder a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> MaybePlaceholder a -> m (MaybePlaceholder b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> MaybePlaceholder a -> f (MaybePlaceholder b)
sequence :: MaybePlaceholder (m a) -> m (MaybePlaceholder a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
MaybePlaceholder (m a) -> m (MaybePlaceholder a)
mapM :: (a -> m b) -> MaybePlaceholder a -> m (MaybePlaceholder b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> MaybePlaceholder a -> m (MaybePlaceholder b)
sequenceA :: MaybePlaceholder (f a) -> f (MaybePlaceholder a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
MaybePlaceholder (f a) -> f (MaybePlaceholder a)
traverse :: (a -> f b) -> MaybePlaceholder a -> f (MaybePlaceholder b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> MaybePlaceholder a -> f (MaybePlaceholder b)
$cp2Traversable :: Foldable MaybePlaceholder
$cp1Traversable :: Functor MaybePlaceholder
Traversable, Int -> MaybePlaceholder e -> ShowS
[MaybePlaceholder e] -> ShowS
MaybePlaceholder e -> String
(Int -> MaybePlaceholder e -> ShowS)
-> (MaybePlaceholder e -> String)
-> ([MaybePlaceholder e] -> ShowS)
-> Show (MaybePlaceholder e)
forall e. Show e => Int -> MaybePlaceholder e -> ShowS
forall e. Show e => [MaybePlaceholder e] -> ShowS
forall e. Show e => MaybePlaceholder e -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MaybePlaceholder e] -> ShowS
$cshowList :: forall e. Show e => [MaybePlaceholder e] -> ShowS
show :: MaybePlaceholder e -> String
$cshow :: forall e. Show e => MaybePlaceholder e -> String
showsPrec :: Int -> MaybePlaceholder e -> ShowS
$cshowsPrec :: forall e. Show e => Int -> MaybePlaceholder e -> ShowS
Show)

-- | An abbreviation: @noPlaceholder = 'NoPlaceholder'
-- 'Strict.Nothing'@.

noPlaceholder :: e -> MaybePlaceholder e
noPlaceholder :: e -> MaybePlaceholder e
noPlaceholder = Maybe PositionInName -> e -> MaybePlaceholder e
forall e. Maybe PositionInName -> e -> MaybePlaceholder e
NoPlaceholder Maybe PositionInName
forall a. Maybe a
Strict.Nothing

instance HasRange a => HasRange (MaybePlaceholder a) where
  getRange :: MaybePlaceholder a -> Range
getRange Placeholder{}       = Range
forall a. Range' a
noRange
  getRange (NoPlaceholder Maybe PositionInName
_ a
e) = a -> Range
forall a. HasRange a => a -> Range
getRange a
e

instance KillRange a => KillRange (MaybePlaceholder a) where
  killRange :: KillRangeT (MaybePlaceholder a)
killRange p :: MaybePlaceholder a
p@Placeholder{}     = MaybePlaceholder a
p
  killRange (NoPlaceholder Maybe PositionInName
p a
e) = (a -> MaybePlaceholder a) -> a -> MaybePlaceholder a
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Maybe PositionInName -> a -> MaybePlaceholder a
forall e. Maybe PositionInName -> e -> MaybePlaceholder e
NoPlaceholder Maybe PositionInName
p) a
e

instance NFData a => NFData (MaybePlaceholder a) where
  rnf :: MaybePlaceholder a -> ()
rnf (Placeholder PositionInName
_)     = ()
  rnf (NoPlaceholder Maybe PositionInName
_ a
a) = a -> ()
forall a. NFData a => a -> ()
rnf a
a

---------------------------------------------------------------------------
-- * Interaction meta variables
---------------------------------------------------------------------------

newtype InteractionId = InteractionId { InteractionId -> Int
interactionId :: Nat }
    deriving ( InteractionId -> InteractionId -> Bool
(InteractionId -> InteractionId -> Bool)
-> (InteractionId -> InteractionId -> Bool) -> Eq InteractionId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InteractionId -> InteractionId -> Bool
$c/= :: InteractionId -> InteractionId -> Bool
== :: InteractionId -> InteractionId -> Bool
$c== :: InteractionId -> InteractionId -> Bool
Eq
             , Eq InteractionId
Eq InteractionId
-> (InteractionId -> InteractionId -> Ordering)
-> (InteractionId -> InteractionId -> Bool)
-> (InteractionId -> InteractionId -> Bool)
-> (InteractionId -> InteractionId -> Bool)
-> (InteractionId -> InteractionId -> Bool)
-> (InteractionId -> InteractionId -> InteractionId)
-> (InteractionId -> InteractionId -> InteractionId)
-> Ord InteractionId
InteractionId -> InteractionId -> Bool
InteractionId -> InteractionId -> Ordering
InteractionId -> InteractionId -> InteractionId
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 :: InteractionId -> InteractionId -> InteractionId
$cmin :: InteractionId -> InteractionId -> InteractionId
max :: InteractionId -> InteractionId -> InteractionId
$cmax :: InteractionId -> InteractionId -> InteractionId
>= :: InteractionId -> InteractionId -> Bool
$c>= :: InteractionId -> InteractionId -> Bool
> :: InteractionId -> InteractionId -> Bool
$c> :: InteractionId -> InteractionId -> Bool
<= :: InteractionId -> InteractionId -> Bool
$c<= :: InteractionId -> InteractionId -> Bool
< :: InteractionId -> InteractionId -> Bool
$c< :: InteractionId -> InteractionId -> Bool
compare :: InteractionId -> InteractionId -> Ordering
$ccompare :: InteractionId -> InteractionId -> Ordering
$cp1Ord :: Eq InteractionId
Ord
             , Int -> InteractionId -> ShowS
[InteractionId] -> ShowS
InteractionId -> String
(Int -> InteractionId -> ShowS)
-> (InteractionId -> String)
-> ([InteractionId] -> ShowS)
-> Show InteractionId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InteractionId] -> ShowS
$cshowList :: [InteractionId] -> ShowS
show :: InteractionId -> String
$cshow :: InteractionId -> String
showsPrec :: Int -> InteractionId -> ShowS
$cshowsPrec :: Int -> InteractionId -> ShowS
Show
             , Integer -> InteractionId
InteractionId -> InteractionId
InteractionId -> InteractionId -> InteractionId
(InteractionId -> InteractionId -> InteractionId)
-> (InteractionId -> InteractionId -> InteractionId)
-> (InteractionId -> InteractionId -> InteractionId)
-> (InteractionId -> InteractionId)
-> (InteractionId -> InteractionId)
-> (InteractionId -> InteractionId)
-> (Integer -> InteractionId)
-> Num InteractionId
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> InteractionId
$cfromInteger :: Integer -> InteractionId
signum :: InteractionId -> InteractionId
$csignum :: InteractionId -> InteractionId
abs :: InteractionId -> InteractionId
$cabs :: InteractionId -> InteractionId
negate :: InteractionId -> InteractionId
$cnegate :: InteractionId -> InteractionId
* :: InteractionId -> InteractionId -> InteractionId
$c* :: InteractionId -> InteractionId -> InteractionId
- :: InteractionId -> InteractionId -> InteractionId
$c- :: InteractionId -> InteractionId -> InteractionId
+ :: InteractionId -> InteractionId -> InteractionId
$c+ :: InteractionId -> InteractionId -> InteractionId
Num
             , Enum InteractionId
Real InteractionId
Real InteractionId
-> Enum InteractionId
-> (InteractionId -> InteractionId -> InteractionId)
-> (InteractionId -> InteractionId -> InteractionId)
-> (InteractionId -> InteractionId -> InteractionId)
-> (InteractionId -> InteractionId -> InteractionId)
-> (InteractionId
    -> InteractionId -> (InteractionId, InteractionId))
-> (InteractionId
    -> InteractionId -> (InteractionId, InteractionId))
-> (InteractionId -> Integer)
-> Integral InteractionId
InteractionId -> Integer
InteractionId -> InteractionId -> (InteractionId, InteractionId)
InteractionId -> InteractionId -> InteractionId
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: InteractionId -> Integer
$ctoInteger :: InteractionId -> Integer
divMod :: InteractionId -> InteractionId -> (InteractionId, InteractionId)
$cdivMod :: InteractionId -> InteractionId -> (InteractionId, InteractionId)
quotRem :: InteractionId -> InteractionId -> (InteractionId, InteractionId)
$cquotRem :: InteractionId -> InteractionId -> (InteractionId, InteractionId)
mod :: InteractionId -> InteractionId -> InteractionId
$cmod :: InteractionId -> InteractionId -> InteractionId
div :: InteractionId -> InteractionId -> InteractionId
$cdiv :: InteractionId -> InteractionId -> InteractionId
rem :: InteractionId -> InteractionId -> InteractionId
$crem :: InteractionId -> InteractionId -> InteractionId
quot :: InteractionId -> InteractionId -> InteractionId
$cquot :: InteractionId -> InteractionId -> InteractionId
$cp2Integral :: Enum InteractionId
$cp1Integral :: Real InteractionId
Integral
             , Num InteractionId
Ord InteractionId
Num InteractionId
-> Ord InteractionId
-> (InteractionId -> Rational)
-> Real InteractionId
InteractionId -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: InteractionId -> Rational
$ctoRational :: InteractionId -> Rational
$cp2Real :: Ord InteractionId
$cp1Real :: Num InteractionId
Real
             , Int -> InteractionId
InteractionId -> Int
InteractionId -> [InteractionId]
InteractionId -> InteractionId
InteractionId -> InteractionId -> [InteractionId]
InteractionId -> InteractionId -> InteractionId -> [InteractionId]
(InteractionId -> InteractionId)
-> (InteractionId -> InteractionId)
-> (Int -> InteractionId)
-> (InteractionId -> Int)
-> (InteractionId -> [InteractionId])
-> (InteractionId -> InteractionId -> [InteractionId])
-> (InteractionId -> InteractionId -> [InteractionId])
-> (InteractionId
    -> InteractionId -> InteractionId -> [InteractionId])
-> Enum InteractionId
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: InteractionId -> InteractionId -> InteractionId -> [InteractionId]
$cenumFromThenTo :: InteractionId -> InteractionId -> InteractionId -> [InteractionId]
enumFromTo :: InteractionId -> InteractionId -> [InteractionId]
$cenumFromTo :: InteractionId -> InteractionId -> [InteractionId]
enumFromThen :: InteractionId -> InteractionId -> [InteractionId]
$cenumFromThen :: InteractionId -> InteractionId -> [InteractionId]
enumFrom :: InteractionId -> [InteractionId]
$cenumFrom :: InteractionId -> [InteractionId]
fromEnum :: InteractionId -> Int
$cfromEnum :: InteractionId -> Int
toEnum :: Int -> InteractionId
$ctoEnum :: Int -> InteractionId
pred :: InteractionId -> InteractionId
$cpred :: InteractionId -> InteractionId
succ :: InteractionId -> InteractionId
$csucc :: InteractionId -> InteractionId
Enum
             , Typeable InteractionId
DataType
Constr
Typeable InteractionId
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> InteractionId -> c InteractionId)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c InteractionId)
-> (InteractionId -> Constr)
-> (InteractionId -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c InteractionId))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c InteractionId))
-> ((forall b. Data b => b -> b) -> InteractionId -> InteractionId)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> InteractionId -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> InteractionId -> r)
-> (forall u. (forall d. Data d => d -> u) -> InteractionId -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> InteractionId -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> InteractionId -> m InteractionId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> InteractionId -> m InteractionId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> InteractionId -> m InteractionId)
-> Data InteractionId
InteractionId -> DataType
InteractionId -> Constr
(forall b. Data b => b -> b) -> InteractionId -> InteractionId
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> InteractionId -> c InteractionId
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c InteractionId
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) -> InteractionId -> u
forall u. (forall d. Data d => d -> u) -> InteractionId -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> InteractionId -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> InteractionId -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> InteractionId -> m InteractionId
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> InteractionId -> m InteractionId
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c InteractionId
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> InteractionId -> c InteractionId
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c InteractionId)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c InteractionId)
$cInteractionId :: Constr
$tInteractionId :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> InteractionId -> m InteractionId
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> InteractionId -> m InteractionId
gmapMp :: (forall d. Data d => d -> m d) -> InteractionId -> m InteractionId
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> InteractionId -> m InteractionId
gmapM :: (forall d. Data d => d -> m d) -> InteractionId -> m InteractionId
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> InteractionId -> m InteractionId
gmapQi :: Int -> (forall d. Data d => d -> u) -> InteractionId -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> InteractionId -> u
gmapQ :: (forall d. Data d => d -> u) -> InteractionId -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> InteractionId -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> InteractionId -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> InteractionId -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> InteractionId -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> InteractionId -> r
gmapT :: (forall b. Data b => b -> b) -> InteractionId -> InteractionId
$cgmapT :: (forall b. Data b => b -> b) -> InteractionId -> InteractionId
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c InteractionId)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c InteractionId)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c InteractionId)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c InteractionId)
dataTypeOf :: InteractionId -> DataType
$cdataTypeOf :: InteractionId -> DataType
toConstr :: InteractionId -> Constr
$ctoConstr :: InteractionId -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c InteractionId
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c InteractionId
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> InteractionId -> c InteractionId
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> InteractionId -> c InteractionId
$cp1Data :: Typeable InteractionId
Data
             , InteractionId -> ()
(InteractionId -> ()) -> NFData InteractionId
forall a. (a -> ()) -> NFData a
rnf :: InteractionId -> ()
$crnf :: InteractionId -> ()
NFData
             )

instance Pretty InteractionId where
    pretty :: InteractionId -> Doc
pretty (InteractionId Int
i) = String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ String
"?" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i

instance KillRange InteractionId where killRange :: InteractionId -> InteractionId
killRange = InteractionId -> InteractionId
forall a. a -> a
id

---------------------------------------------------------------------------
-- * Fixity
---------------------------------------------------------------------------

-- | Precedence levels for operators.

type PrecedenceLevel = Double

data FixityLevel
  = Unrelated
    -- ^ No fixity declared.
  | Related !PrecedenceLevel
    -- ^ Fixity level declared as the number.
  deriving (FixityLevel -> FixityLevel -> Bool
(FixityLevel -> FixityLevel -> Bool)
-> (FixityLevel -> FixityLevel -> Bool) -> Eq FixityLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FixityLevel -> FixityLevel -> Bool
$c/= :: FixityLevel -> FixityLevel -> Bool
== :: FixityLevel -> FixityLevel -> Bool
$c== :: FixityLevel -> FixityLevel -> Bool
Eq, Eq FixityLevel
Eq FixityLevel
-> (FixityLevel -> FixityLevel -> Ordering)
-> (FixityLevel -> FixityLevel -> Bool)
-> (FixityLevel -> FixityLevel -> Bool)
-> (FixityLevel -> FixityLevel -> Bool)
-> (FixityLevel -> FixityLevel -> Bool)
-> (FixityLevel -> FixityLevel -> FixityLevel)
-> (FixityLevel -> FixityLevel -> FixityLevel)
-> Ord FixityLevel
FixityLevel -> FixityLevel -> Bool
FixityLevel -> FixityLevel -> Ordering
FixityLevel -> FixityLevel -> FixityLevel
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 :: FixityLevel -> FixityLevel -> FixityLevel
$cmin :: FixityLevel -> FixityLevel -> FixityLevel
max :: FixityLevel -> FixityLevel -> FixityLevel
$cmax :: FixityLevel -> FixityLevel -> FixityLevel
>= :: FixityLevel -> FixityLevel -> Bool
$c>= :: FixityLevel -> FixityLevel -> Bool
> :: FixityLevel -> FixityLevel -> Bool
$c> :: FixityLevel -> FixityLevel -> Bool
<= :: FixityLevel -> FixityLevel -> Bool
$c<= :: FixityLevel -> FixityLevel -> Bool
< :: FixityLevel -> FixityLevel -> Bool
$c< :: FixityLevel -> FixityLevel -> Bool
compare :: FixityLevel -> FixityLevel -> Ordering
$ccompare :: FixityLevel -> FixityLevel -> Ordering
$cp1Ord :: Eq FixityLevel
Ord, Int -> FixityLevel -> ShowS
[FixityLevel] -> ShowS
FixityLevel -> String
(Int -> FixityLevel -> ShowS)
-> (FixityLevel -> String)
-> ([FixityLevel] -> ShowS)
-> Show FixityLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FixityLevel] -> ShowS
$cshowList :: [FixityLevel] -> ShowS
show :: FixityLevel -> String
$cshow :: FixityLevel -> String
showsPrec :: Int -> FixityLevel -> ShowS
$cshowsPrec :: Int -> FixityLevel -> ShowS
Show, Typeable FixityLevel
DataType
Constr
Typeable FixityLevel
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> FixityLevel -> c FixityLevel)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FixityLevel)
-> (FixityLevel -> Constr)
-> (FixityLevel -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c FixityLevel))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c FixityLevel))
-> ((forall b. Data b => b -> b) -> FixityLevel -> FixityLevel)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> FixityLevel -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> FixityLevel -> r)
-> (forall u. (forall d. Data d => d -> u) -> FixityLevel -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> FixityLevel -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel)
-> Data FixityLevel
FixityLevel -> DataType
FixityLevel -> Constr
(forall b. Data b => b -> b) -> FixityLevel -> FixityLevel
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FixityLevel -> c FixityLevel
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FixityLevel
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) -> FixityLevel -> u
forall u. (forall d. Data d => d -> u) -> FixityLevel -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FixityLevel -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FixityLevel -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FixityLevel
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FixityLevel -> c FixityLevel
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FixityLevel)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FixityLevel)
$cRelated :: Constr
$cUnrelated :: Constr
$tFixityLevel :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel
gmapMp :: (forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel
gmapM :: (forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FixityLevel -> m FixityLevel
gmapQi :: Int -> (forall d. Data d => d -> u) -> FixityLevel -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FixityLevel -> u
gmapQ :: (forall d. Data d => d -> u) -> FixityLevel -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FixityLevel -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FixityLevel -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FixityLevel -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FixityLevel -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FixityLevel -> r
gmapT :: (forall b. Data b => b -> b) -> FixityLevel -> FixityLevel
$cgmapT :: (forall b. Data b => b -> b) -> FixityLevel -> FixityLevel
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FixityLevel)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FixityLevel)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FixityLevel)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FixityLevel)
dataTypeOf :: FixityLevel -> DataType
$cdataTypeOf :: FixityLevel -> DataType
toConstr :: FixityLevel -> Constr
$ctoConstr :: FixityLevel -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FixityLevel
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FixityLevel
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FixityLevel -> c FixityLevel
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FixityLevel -> c FixityLevel
$cp1Data :: Typeable FixityLevel
Data)

instance Null FixityLevel where
  null :: FixityLevel -> Bool
null FixityLevel
Unrelated = Bool
True
  null Related{} = Bool
False
  empty :: FixityLevel
empty = FixityLevel
Unrelated

instance NFData FixityLevel where
  rnf :: FixityLevel -> ()
rnf FixityLevel
Unrelated   = ()
  rnf (Related PrecedenceLevel
_) = ()

-- | Associativity.

data Associativity = NonAssoc | LeftAssoc | RightAssoc
   deriving (Associativity -> Associativity -> Bool
(Associativity -> Associativity -> Bool)
-> (Associativity -> Associativity -> Bool) -> Eq Associativity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Associativity -> Associativity -> Bool
$c/= :: Associativity -> Associativity -> Bool
== :: Associativity -> Associativity -> Bool
$c== :: Associativity -> Associativity -> Bool
Eq, Eq Associativity
Eq Associativity
-> (Associativity -> Associativity -> Ordering)
-> (Associativity -> Associativity -> Bool)
-> (Associativity -> Associativity -> Bool)
-> (Associativity -> Associativity -> Bool)
-> (Associativity -> Associativity -> Bool)
-> (Associativity -> Associativity -> Associativity)
-> (Associativity -> Associativity -> Associativity)
-> Ord Associativity
Associativity -> Associativity -> Bool
Associativity -> Associativity -> Ordering
Associativity -> Associativity -> Associativity
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 :: Associativity -> Associativity -> Associativity
$cmin :: Associativity -> Associativity -> Associativity
max :: Associativity -> Associativity -> Associativity
$cmax :: Associativity -> Associativity -> Associativity
>= :: Associativity -> Associativity -> Bool
$c>= :: Associativity -> Associativity -> Bool
> :: Associativity -> Associativity -> Bool
$c> :: Associativity -> Associativity -> Bool
<= :: Associativity -> Associativity -> Bool
$c<= :: Associativity -> Associativity -> Bool
< :: Associativity -> Associativity -> Bool
$c< :: Associativity -> Associativity -> Bool
compare :: Associativity -> Associativity -> Ordering
$ccompare :: Associativity -> Associativity -> Ordering
$cp1Ord :: Eq Associativity
Ord, Int -> Associativity -> ShowS
[Associativity] -> ShowS
Associativity -> String
(Int -> Associativity -> ShowS)
-> (Associativity -> String)
-> ([Associativity] -> ShowS)
-> Show Associativity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Associativity] -> ShowS
$cshowList :: [Associativity] -> ShowS
show :: Associativity -> String
$cshow :: Associativity -> String
showsPrec :: Int -> Associativity -> ShowS
$cshowsPrec :: Int -> Associativity -> ShowS
Show, Typeable Associativity
DataType
Constr
Typeable Associativity
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Associativity -> c Associativity)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Associativity)
-> (Associativity -> Constr)
-> (Associativity -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Associativity))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c Associativity))
-> ((forall b. Data b => b -> b) -> Associativity -> Associativity)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Associativity -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Associativity -> r)
-> (forall u. (forall d. Data d => d -> u) -> Associativity -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Associativity -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Associativity -> m Associativity)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Associativity -> m Associativity)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Associativity -> m Associativity)
-> Data Associativity
Associativity -> DataType
Associativity -> Constr
(forall b. Data b => b -> b) -> Associativity -> Associativity
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Associativity -> c Associativity
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Associativity
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) -> Associativity -> u
forall u. (forall d. Data d => d -> u) -> Associativity -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Associativity -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Associativity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Associativity -> m Associativity
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Associativity -> m Associativity
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Associativity
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Associativity -> c Associativity
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Associativity)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Associativity)
$cRightAssoc :: Constr
$cLeftAssoc :: Constr
$cNonAssoc :: Constr
$tAssociativity :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Associativity -> m Associativity
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Associativity -> m Associativity
gmapMp :: (forall d. Data d => d -> m d) -> Associativity -> m Associativity
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Associativity -> m Associativity
gmapM :: (forall d. Data d => d -> m d) -> Associativity -> m Associativity
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Associativity -> m Associativity
gmapQi :: Int -> (forall d. Data d => d -> u) -> Associativity -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Associativity -> u
gmapQ :: (forall d. Data d => d -> u) -> Associativity -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Associativity -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Associativity -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Associativity -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Associativity -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Associativity -> r
gmapT :: (forall b. Data b => b -> b) -> Associativity -> Associativity
$cgmapT :: (forall b. Data b => b -> b) -> Associativity -> Associativity
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Associativity)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Associativity)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Associativity)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Associativity)
dataTypeOf :: Associativity -> DataType
$cdataTypeOf :: Associativity -> DataType
toConstr :: Associativity -> Constr
$ctoConstr :: Associativity -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Associativity
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Associativity
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Associativity -> c Associativity
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Associativity -> c Associativity
$cp1Data :: Typeable Associativity
Data)

-- | Fixity of operators.

data Fixity = Fixity
  { Fixity -> Range
fixityRange :: Range
    -- ^ Range of the whole fixity declaration.
  , Fixity -> FixityLevel
fixityLevel :: !FixityLevel
  , Fixity -> Associativity
fixityAssoc :: !Associativity
  }
  deriving (Typeable Fixity
DataType
Constr
Typeable Fixity
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Fixity -> c Fixity)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Fixity)
-> (Fixity -> Constr)
-> (Fixity -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Fixity))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity))
-> ((forall b. Data b => b -> b) -> Fixity -> Fixity)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Fixity -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Fixity -> r)
-> (forall u. (forall d. Data d => d -> u) -> Fixity -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Fixity -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Fixity -> m Fixity)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Fixity -> m Fixity)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Fixity -> m Fixity)
-> Data Fixity
Fixity -> DataType
Fixity -> Constr
(forall b. Data b => b -> b) -> Fixity -> Fixity
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity -> c Fixity
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity
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) -> Fixity -> u
forall u. (forall d. Data d => d -> u) -> Fixity -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity -> c Fixity
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Fixity)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity)
$cFixity :: Constr
$tFixity :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Fixity -> m Fixity
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
gmapMp :: (forall d. Data d => d -> m d) -> Fixity -> m Fixity
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
gmapM :: (forall d. Data d => d -> m d) -> Fixity -> m Fixity
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
gmapQi :: Int -> (forall d. Data d => d -> u) -> Fixity -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Fixity -> u
gmapQ :: (forall d. Data d => d -> u) -> Fixity -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Fixity -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
gmapT :: (forall b. Data b => b -> b) -> Fixity -> Fixity
$cgmapT :: (forall b. Data b => b -> b) -> Fixity -> Fixity
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Fixity)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Fixity)
dataTypeOf :: Fixity -> DataType
$cdataTypeOf :: Fixity -> DataType
toConstr :: Fixity -> Constr
$ctoConstr :: Fixity -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity -> c Fixity
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity -> c Fixity
$cp1Data :: Typeable Fixity
Data, Int -> Fixity -> ShowS
[Fixity] -> ShowS
Fixity -> String
(Int -> Fixity -> ShowS)
-> (Fixity -> String) -> ([Fixity] -> ShowS) -> Show Fixity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Fixity] -> ShowS
$cshowList :: [Fixity] -> ShowS
show :: Fixity -> String
$cshow :: Fixity -> String
showsPrec :: Int -> Fixity -> ShowS
$cshowsPrec :: Int -> Fixity -> ShowS
Show)

noFixity :: Fixity
noFixity :: Fixity
noFixity = Range -> FixityLevel -> Associativity -> Fixity
Fixity Range
forall a. Range' a
noRange FixityLevel
Unrelated Associativity
NonAssoc

defaultFixity :: Fixity
defaultFixity :: Fixity
defaultFixity = Range -> FixityLevel -> Associativity -> Fixity
Fixity Range
forall a. Range' a
noRange (PrecedenceLevel -> FixityLevel
Related PrecedenceLevel
20) Associativity
NonAssoc

-- For @instance Pretty Fixity@, see Agda.Syntax.Concrete.Pretty

instance Eq Fixity where
  Fixity
f1 == :: Fixity -> Fixity -> Bool
== Fixity
f2 = Fixity -> Fixity -> Ordering
forall a. Ord a => a -> a -> Ordering
compare Fixity
f1 Fixity
f2 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
EQ

instance Ord Fixity where
  compare :: Fixity -> Fixity -> Ordering
compare = (FixityLevel, Associativity)
-> (FixityLevel, Associativity) -> Ordering
forall a. Ord a => a -> a -> Ordering
compare ((FixityLevel, Associativity)
 -> (FixityLevel, Associativity) -> Ordering)
-> (Fixity -> (FixityLevel, Associativity))
-> Fixity
-> Fixity
-> Ordering
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` (Fixity -> FixityLevel
fixityLevel (Fixity -> FixityLevel)
-> (Fixity -> Associativity)
-> Fixity
-> (FixityLevel, Associativity)
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& Fixity -> Associativity
fixityAssoc)

instance Null Fixity where
  null :: Fixity -> Bool
null  = FixityLevel -> Bool
forall a. Null a => a -> Bool
null (FixityLevel -> Bool) -> (Fixity -> FixityLevel) -> Fixity -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Fixity -> FixityLevel
fixityLevel
  empty :: Fixity
empty = Fixity
noFixity

instance HasRange Fixity where
  getRange :: Fixity -> Range
getRange = Fixity -> Range
fixityRange

instance KillRange Fixity where
  killRange :: Fixity -> Fixity
killRange Fixity
f = Fixity
f { fixityRange :: Range
fixityRange = Range
forall a. Range' a
noRange }

instance NFData Fixity where
  rnf :: Fixity -> ()
rnf (Fixity Range
_ FixityLevel
_ Associativity
_) = ()     -- Ranges are not forced, the other fields are strict.

-- * Notation coupled with 'Fixity'

-- | The notation is handled as the fixity in the renamer.
--   Hence, they are grouped together in this type.
data Fixity' = Fixity'
    { Fixity' -> Fixity
theFixity   :: !Fixity
    , Fixity' -> Notation
theNotation :: Notation
    , Fixity' -> Range
theNameRange :: Range
      -- ^ Range of the name in the fixity declaration
      --   (used for correct highlighting, see issue #2140).
    }
  deriving (Typeable Fixity'
DataType
Constr
Typeable Fixity'
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Fixity' -> c Fixity')
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Fixity')
-> (Fixity' -> Constr)
-> (Fixity' -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Fixity'))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity'))
-> ((forall b. Data b => b -> b) -> Fixity' -> Fixity')
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Fixity' -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Fixity' -> r)
-> (forall u. (forall d. Data d => d -> u) -> Fixity' -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Fixity' -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Fixity' -> m Fixity')
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Fixity' -> m Fixity')
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Fixity' -> m Fixity')
-> Data Fixity'
Fixity' -> DataType
Fixity' -> Constr
(forall b. Data b => b -> b) -> Fixity' -> Fixity'
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity' -> c Fixity'
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity'
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) -> Fixity' -> u
forall u. (forall d. Data d => d -> u) -> Fixity' -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Fixity' -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Fixity' -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Fixity' -> m Fixity'
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity' -> m Fixity'
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity'
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity' -> c Fixity'
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Fixity')
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity')
$cFixity' :: Constr
$tFixity' :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Fixity' -> m Fixity'
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity' -> m Fixity'
gmapMp :: (forall d. Data d => d -> m d) -> Fixity' -> m Fixity'
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity' -> m Fixity'
gmapM :: (forall d. Data d => d -> m d) -> Fixity' -> m Fixity'
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Fixity' -> m Fixity'
gmapQi :: Int -> (forall d. Data d => d -> u) -> Fixity' -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Fixity' -> u
gmapQ :: (forall d. Data d => d -> u) -> Fixity' -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Fixity' -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Fixity' -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Fixity' -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Fixity' -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Fixity' -> r
gmapT :: (forall b. Data b => b -> b) -> Fixity' -> Fixity'
$cgmapT :: (forall b. Data b => b -> b) -> Fixity' -> Fixity'
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity')
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity')
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Fixity')
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Fixity')
dataTypeOf :: Fixity' -> DataType
$cdataTypeOf :: Fixity' -> DataType
toConstr :: Fixity' -> Constr
$ctoConstr :: Fixity' -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity'
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity'
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity' -> c Fixity'
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity' -> c Fixity'
$cp1Data :: Typeable Fixity'
Data, Int -> Fixity' -> ShowS
[Fixity'] -> ShowS
Fixity' -> String
(Int -> Fixity' -> ShowS)
-> (Fixity' -> String) -> ([Fixity'] -> ShowS) -> Show Fixity'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Fixity'] -> ShowS
$cshowList :: [Fixity'] -> ShowS
show :: Fixity' -> String
$cshow :: Fixity' -> String
showsPrec :: Int -> Fixity' -> ShowS
$cshowsPrec :: Int -> Fixity' -> ShowS
Show)

noFixity' :: Fixity'
noFixity' :: Fixity'
noFixity' = Fixity -> Notation -> Range -> Fixity'
Fixity' Fixity
noFixity Notation
noNotation Range
forall a. Range' a
noRange

instance Eq Fixity' where
  Fixity' Fixity
f Notation
n Range
_ == :: Fixity' -> Fixity' -> Bool
== Fixity' Fixity
f' Notation
n' Range
_ = Fixity
f Fixity -> Fixity -> Bool
forall a. Eq a => a -> a -> Bool
== Fixity
f' Bool -> Bool -> Bool
&& Notation
n Notation -> Notation -> Bool
forall a. Eq a => a -> a -> Bool
== Notation
n'

instance Null Fixity' where
  null :: Fixity' -> Bool
null (Fixity' Fixity
f Notation
n Range
_) = Fixity -> Bool
forall a. Null a => a -> Bool
null Fixity
f Bool -> Bool -> Bool
&& Notation -> Bool
forall a. Null a => a -> Bool
null Notation
n
  empty :: Fixity'
empty = Fixity'
noFixity'

instance NFData Fixity' where
  rnf :: Fixity' -> ()
rnf (Fixity' Fixity
_ Notation
a Range
_) = Notation -> ()
forall a. NFData a => a -> ()
rnf Notation
a

instance KillRange Fixity' where
  killRange :: Fixity' -> Fixity'
killRange (Fixity' Fixity
f Notation
n Range
r) = (Fixity -> Notation -> Range -> Fixity')
-> Fixity -> Notation -> Range -> Fixity'
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 Fixity -> Notation -> Range -> Fixity'
Fixity' Fixity
f Notation
n Range
r

-- lenses

_fixityAssoc :: Lens' Associativity Fixity
_fixityAssoc :: (Associativity -> f Associativity) -> Fixity -> f Fixity
_fixityAssoc Associativity -> f Associativity
f Fixity
r = Associativity -> f Associativity
f (Fixity -> Associativity
fixityAssoc Fixity
r) f Associativity -> (Associativity -> Fixity) -> f Fixity
forall (m :: * -> *) a b. Functor m => m a -> (a -> b) -> m b
<&> \Associativity
x -> Fixity
r { fixityAssoc :: Associativity
fixityAssoc = Associativity
x }

_fixityLevel :: Lens' FixityLevel Fixity
_fixityLevel :: (FixityLevel -> f FixityLevel) -> Fixity -> f Fixity
_fixityLevel FixityLevel -> f FixityLevel
f Fixity
r = FixityLevel -> f FixityLevel
f (Fixity -> FixityLevel
fixityLevel Fixity
r) f FixityLevel -> (FixityLevel -> Fixity) -> f Fixity
forall (m :: * -> *) a b. Functor m => m a -> (a -> b) -> m b
<&> \FixityLevel
x -> Fixity
r { fixityLevel :: FixityLevel
fixityLevel = FixityLevel
x }

-- Lens focusing on Fixity

class LensFixity a where
  lensFixity :: Lens' Fixity a

instance LensFixity Fixity where
  lensFixity :: (Fixity -> f Fixity) -> Fixity -> f Fixity
lensFixity = (Fixity -> f Fixity) -> Fixity -> f Fixity
forall a. a -> a
id

instance LensFixity Fixity' where
  lensFixity :: (Fixity -> f Fixity) -> Fixity' -> f Fixity'
lensFixity Fixity -> f Fixity
f Fixity'
fix' = Fixity -> f Fixity
f (Fixity' -> Fixity
theFixity Fixity'
fix') f Fixity -> (Fixity -> Fixity') -> f Fixity'
forall (m :: * -> *) a b. Functor m => m a -> (a -> b) -> m b
<&> \ Fixity
fx -> Fixity'
fix' { theFixity :: Fixity
theFixity = Fixity
fx }

-- Lens focusing on Fixity'

class LensFixity' a where
  lensFixity' :: Lens' Fixity' a

instance LensFixity' Fixity' where
  lensFixity' :: (Fixity' -> f Fixity') -> Fixity' -> f Fixity'
lensFixity' = (Fixity' -> f Fixity') -> Fixity' -> f Fixity'
forall a. a -> a
id
---------------------------------------------------------------------------
-- * Import directive
---------------------------------------------------------------------------

-- | The things you are allowed to say when you shuffle names between name
--   spaces (i.e. in @import@, @namespace@, or @open@ declarations).
data ImportDirective' n m = ImportDirective
  { ImportDirective' n m -> Range
importDirRange :: Range
  , ImportDirective' n m -> Using' n m
using          :: Using' n m
  , ImportDirective' n m -> HidingDirective' n m
hiding         :: HidingDirective' n m
  , ImportDirective' n m -> RenamingDirective' n m
impRenaming    :: RenamingDirective' n m
  , ImportDirective' n m -> Maybe Range
publicOpen     :: Maybe Range -- ^ Only for @open@. Exports the opened names from the current module.
  }
  deriving (Typeable (ImportDirective' n m)
DataType
Constr
Typeable (ImportDirective' n m)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> ImportDirective' n m
    -> c (ImportDirective' n m))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (ImportDirective' n m))
-> (ImportDirective' n m -> Constr)
-> (ImportDirective' n m -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (ImportDirective' n m)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (ImportDirective' n m)))
-> ((forall b. Data b => b -> b)
    -> ImportDirective' n m -> ImportDirective' n m)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ImportDirective' n m -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ImportDirective' n m -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> ImportDirective' n m -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ImportDirective' n m -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> ImportDirective' n m -> m (ImportDirective' n m))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ImportDirective' n m -> m (ImportDirective' n m))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ImportDirective' n m -> m (ImportDirective' n m))
-> Data (ImportDirective' n m)
ImportDirective' n m -> DataType
ImportDirective' n m -> Constr
(forall b. Data b => b -> b)
-> ImportDirective' n m -> ImportDirective' n m
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ImportDirective' n m
-> c (ImportDirective' n m)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ImportDirective' n m)
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ImportDirective' n m))
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) -> ImportDirective' n m -> u
forall u.
(forall d. Data d => d -> u) -> ImportDirective' n m -> [u]
forall n m. (Data n, Data m) => Typeable (ImportDirective' n m)
forall n m. (Data n, Data m) => ImportDirective' n m -> DataType
forall n m. (Data n, Data m) => ImportDirective' n m -> Constr
forall n m.
(Data n, Data m) =>
(forall b. Data b => b -> b)
-> ImportDirective' n m -> ImportDirective' n m
forall n m u.
(Data n, Data m) =>
Int -> (forall d. Data d => d -> u) -> ImportDirective' n m -> u
forall n m u.
(Data n, Data m) =>
(forall d. Data d => d -> u) -> ImportDirective' n m -> [u]
forall n m r r'.
(Data n, Data m) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImportDirective' n m -> r
forall n m r r'.
(Data n, Data m) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImportDirective' n m -> r
forall n m (m :: * -> *).
(Data n, Data m, Monad m) =>
(forall d. Data d => d -> m d)
-> ImportDirective' n m -> m (ImportDirective' n m)
forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ImportDirective' n m -> m (ImportDirective' n m)
forall n m (c :: * -> *).
(Data n, Data m) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ImportDirective' n m)
forall n m (c :: * -> *).
(Data n, Data m) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ImportDirective' n m
-> c (ImportDirective' n m)
forall n m (t :: * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ImportDirective' n m))
forall n m (t :: * -> * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ImportDirective' n m))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImportDirective' n m -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImportDirective' n m -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ImportDirective' n m -> m (ImportDirective' n m)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ImportDirective' n m -> m (ImportDirective' n m)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ImportDirective' n m)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ImportDirective' n m
-> c (ImportDirective' n m)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ImportDirective' n m))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ImportDirective' n m))
$cImportDirective :: Constr
$tImportDirective' :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> ImportDirective' n m -> m (ImportDirective' n m)
$cgmapMo :: forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ImportDirective' n m -> m (ImportDirective' n m)
gmapMp :: (forall d. Data d => d -> m d)
-> ImportDirective' n m -> m (ImportDirective' n m)
$cgmapMp :: forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ImportDirective' n m -> m (ImportDirective' n m)
gmapM :: (forall d. Data d => d -> m d)
-> ImportDirective' n m -> m (ImportDirective' n m)
$cgmapM :: forall n m (m :: * -> *).
(Data n, Data m, Monad m) =>
(forall d. Data d => d -> m d)
-> ImportDirective' n m -> m (ImportDirective' n m)
gmapQi :: Int -> (forall d. Data d => d -> u) -> ImportDirective' n m -> u
$cgmapQi :: forall n m u.
(Data n, Data m) =>
Int -> (forall d. Data d => d -> u) -> ImportDirective' n m -> u
gmapQ :: (forall d. Data d => d -> u) -> ImportDirective' n m -> [u]
$cgmapQ :: forall n m u.
(Data n, Data m) =>
(forall d. Data d => d -> u) -> ImportDirective' n m -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImportDirective' n m -> r
$cgmapQr :: forall n m r r'.
(Data n, Data m) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImportDirective' n m -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImportDirective' n m -> r
$cgmapQl :: forall n m r r'.
(Data n, Data m) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImportDirective' n m -> r
gmapT :: (forall b. Data b => b -> b)
-> ImportDirective' n m -> ImportDirective' n m
$cgmapT :: forall n m.
(Data n, Data m) =>
(forall b. Data b => b -> b)
-> ImportDirective' n m -> ImportDirective' n m
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ImportDirective' n m))
$cdataCast2 :: forall n m (t :: * -> * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ImportDirective' n m))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (ImportDirective' n m))
$cdataCast1 :: forall n m (t :: * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ImportDirective' n m))
dataTypeOf :: ImportDirective' n m -> DataType
$cdataTypeOf :: forall n m. (Data n, Data m) => ImportDirective' n m -> DataType
toConstr :: ImportDirective' n m -> Constr
$ctoConstr :: forall n m. (Data n, Data m) => ImportDirective' n m -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ImportDirective' n m)
$cgunfold :: forall n m (c :: * -> *).
(Data n, Data m) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ImportDirective' n m)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ImportDirective' n m
-> c (ImportDirective' n m)
$cgfoldl :: forall n m (c :: * -> *).
(Data n, Data m) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ImportDirective' n m
-> c (ImportDirective' n m)
$cp1Data :: forall n m. (Data n, Data m) => Typeable (ImportDirective' n m)
Data, ImportDirective' n m -> ImportDirective' n m -> Bool
(ImportDirective' n m -> ImportDirective' n m -> Bool)
-> (ImportDirective' n m -> ImportDirective' n m -> Bool)
-> Eq (ImportDirective' n m)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall n m.
(Eq m, Eq n) =>
ImportDirective' n m -> ImportDirective' n m -> Bool
/= :: ImportDirective' n m -> ImportDirective' n m -> Bool
$c/= :: forall n m.
(Eq m, Eq n) =>
ImportDirective' n m -> ImportDirective' n m -> Bool
== :: ImportDirective' n m -> ImportDirective' n m -> Bool
$c== :: forall n m.
(Eq m, Eq n) =>
ImportDirective' n m -> ImportDirective' n m -> Bool
Eq)

type HidingDirective'   n m = [ImportedName' n m]
type RenamingDirective' n m = [Renaming' n m]

-- | @null@ for import directives holds when everything is imported unchanged
--   (no names are hidden or renamed).
instance Null (ImportDirective' n m) where
  null :: ImportDirective' n m -> Bool
null = \case
    ImportDirective Range
_ Using' n m
UseEverything [] [] Maybe Range
_ -> Bool
True
    ImportDirective' n m
_ -> Bool
False
  empty :: ImportDirective' n m
empty = ImportDirective' n m
forall n m. ImportDirective' n m
defaultImportDir

instance (HasRange n, HasRange m) => Semigroup (ImportDirective' n m) where
  ImportDirective' n m
i1 <> :: ImportDirective' n m
-> ImportDirective' n m -> ImportDirective' n m
<> ImportDirective' n m
i2 = ImportDirective :: forall n m.
Range
-> Using' n m
-> HidingDirective' n m
-> RenamingDirective' n m
-> Maybe Range
-> ImportDirective' n m
ImportDirective
    { importDirRange :: Range
importDirRange = ImportDirective' n m -> ImportDirective' n m -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange ImportDirective' n m
i1 ImportDirective' n m
i2
    , using :: Using' n m
using          = ImportDirective' n m -> Using' n m
forall n m. ImportDirective' n m -> Using' n m
using ImportDirective' n m
i1 Using' n m -> Using' n m -> Using' n m
forall a. Semigroup a => a -> a -> a
<> ImportDirective' n m -> Using' n m
forall n m. ImportDirective' n m -> Using' n m
using ImportDirective' n m
i2
    , hiding :: HidingDirective' n m
hiding         = ImportDirective' n m -> HidingDirective' n m
forall n m. ImportDirective' n m -> HidingDirective' n m
hiding ImportDirective' n m
i1 HidingDirective' n m
-> HidingDirective' n m -> HidingDirective' n m
forall a. [a] -> [a] -> [a]
++ ImportDirective' n m -> HidingDirective' n m
forall n m. ImportDirective' n m -> HidingDirective' n m
hiding ImportDirective' n m
i2
    , impRenaming :: RenamingDirective' n m
impRenaming    = ImportDirective' n m -> RenamingDirective' n m
forall n m. ImportDirective' n m -> RenamingDirective' n m
impRenaming ImportDirective' n m
i1 RenamingDirective' n m
-> RenamingDirective' n m -> RenamingDirective' n m
forall a. [a] -> [a] -> [a]
++ ImportDirective' n m -> RenamingDirective' n m
forall n m. ImportDirective' n m -> RenamingDirective' n m
impRenaming ImportDirective' n m
i2
    , publicOpen :: Maybe Range
publicOpen     = ImportDirective' n m -> Maybe Range
forall n m. ImportDirective' n m -> Maybe Range
publicOpen ImportDirective' n m
i1 Maybe Range -> Maybe Range -> Maybe Range
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ImportDirective' n m -> Maybe Range
forall n m. ImportDirective' n m -> Maybe Range
publicOpen ImportDirective' n m
i2
    }

instance (HasRange n, HasRange m) => Monoid (ImportDirective' n m) where
  mempty :: ImportDirective' n m
mempty  = ImportDirective' n m
forall a. Null a => a
empty
  mappend :: ImportDirective' n m
-> ImportDirective' n m -> ImportDirective' n m
mappend = ImportDirective' n m
-> ImportDirective' n m -> ImportDirective' n m
forall a. Semigroup a => a -> a -> a
(<>)

-- | Default is directive is @private@ (use everything, but do not export).
defaultImportDir :: ImportDirective' n m
defaultImportDir :: ImportDirective' n m
defaultImportDir = Range
-> Using' n m
-> HidingDirective' n m
-> RenamingDirective' n m
-> Maybe Range
-> ImportDirective' n m
forall n m.
Range
-> Using' n m
-> HidingDirective' n m
-> RenamingDirective' n m
-> Maybe Range
-> ImportDirective' n m
ImportDirective Range
forall a. Range' a
noRange Using' n m
forall n m. Using' n m
UseEverything [] [] Maybe Range
forall a. Maybe a
Nothing

-- | @isDefaultImportDir@ implies @null@, but not the other way round.
isDefaultImportDir :: ImportDirective' n m -> Bool
isDefaultImportDir :: ImportDirective' n m -> Bool
isDefaultImportDir ImportDirective' n m
dir = ImportDirective' n m -> Bool
forall a. Null a => a -> Bool
null ImportDirective' n m
dir Bool -> Bool -> Bool
&& Maybe Range -> Bool
forall a. Null a => a -> Bool
null (ImportDirective' n m -> Maybe Range
forall n m. ImportDirective' n m -> Maybe Range
publicOpen ImportDirective' n m
dir)

-- | The @using@ clause of import directive.
data Using' n m
  = UseEverything              -- ^ No @using@ clause given.
  | Using [ImportedName' n m]  -- ^ @using@ the specified names.
  deriving (Typeable (Using' n m)
DataType
Constr
Typeable (Using' n m)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Using' n m -> c (Using' n m))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Using' n m))
-> (Using' n m -> Constr)
-> (Using' n m -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Using' n m)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Using' n m)))
-> ((forall b. Data b => b -> b) -> Using' n m -> Using' n m)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Using' n m -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Using' n m -> r)
-> (forall u. (forall d. Data d => d -> u) -> Using' n m -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Using' n m -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m))
-> Data (Using' n m)
Using' n m -> DataType
Using' n m -> Constr
(forall b. Data b => b -> b) -> Using' n m -> Using' n m
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Using' n m -> c (Using' n m)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Using' n m)
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Using' n m))
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) -> Using' n m -> u
forall u. (forall d. Data d => d -> u) -> Using' n m -> [u]
forall n m. (Data n, Data m) => Typeable (Using' n m)
forall n m. (Data n, Data m) => Using' n m -> DataType
forall n m. (Data n, Data m) => Using' n m -> Constr
forall n m.
(Data n, Data m) =>
(forall b. Data b => b -> b) -> Using' n m -> Using' n m
forall n m u.
(Data n, Data m) =>
Int -> (forall d. Data d => d -> u) -> Using' n m -> u
forall n m u.
(Data n, Data m) =>
(forall d. Data d => d -> u) -> Using' n m -> [u]
forall n m r r'.
(Data n, Data m) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Using' n m -> r
forall n m r r'.
(Data n, Data m) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Using' n m -> r
forall n m (m :: * -> *).
(Data n, Data m, Monad m) =>
(forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m)
forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m)
forall n m (c :: * -> *).
(Data n, Data m) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Using' n m)
forall n m (c :: * -> *).
(Data n, Data m) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Using' n m -> c (Using' n m)
forall n m (t :: * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Using' n m))
forall n m (t :: * -> * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Using' n m))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Using' n m -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Using' n m -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Using' n m)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Using' n m -> c (Using' n m)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Using' n m))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Using' n m))
$cUsing :: Constr
$cUseEverything :: Constr
$tUsing' :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m)
$cgmapMo :: forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m)
gmapMp :: (forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m)
$cgmapMp :: forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m)
gmapM :: (forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m)
$cgmapM :: forall n m (m :: * -> *).
(Data n, Data m, Monad m) =>
(forall d. Data d => d -> m d) -> Using' n m -> m (Using' n m)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Using' n m -> u
$cgmapQi :: forall n m u.
(Data n, Data m) =>
Int -> (forall d. Data d => d -> u) -> Using' n m -> u
gmapQ :: (forall d. Data d => d -> u) -> Using' n m -> [u]
$cgmapQ :: forall n m u.
(Data n, Data m) =>
(forall d. Data d => d -> u) -> Using' n m -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Using' n m -> r
$cgmapQr :: forall n m r r'.
(Data n, Data m) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Using' n m -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Using' n m -> r
$cgmapQl :: forall n m r r'.
(Data n, Data m) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Using' n m -> r
gmapT :: (forall b. Data b => b -> b) -> Using' n m -> Using' n m
$cgmapT :: forall n m.
(Data n, Data m) =>
(forall b. Data b => b -> b) -> Using' n m -> Using' n m
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Using' n m))
$cdataCast2 :: forall n m (t :: * -> * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Using' n m))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Using' n m))
$cdataCast1 :: forall n m (t :: * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Using' n m))
dataTypeOf :: Using' n m -> DataType
$cdataTypeOf :: forall n m. (Data n, Data m) => Using' n m -> DataType
toConstr :: Using' n m -> Constr
$ctoConstr :: forall n m. (Data n, Data m) => Using' n m -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Using' n m)
$cgunfold :: forall n m (c :: * -> *).
(Data n, Data m) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Using' n m)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Using' n m -> c (Using' n m)
$cgfoldl :: forall n m (c :: * -> *).
(Data n, Data m) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Using' n m -> c (Using' n m)
$cp1Data :: forall n m. (Data n, Data m) => Typeable (Using' n m)
Data, Using' n m -> Using' n m -> Bool
(Using' n m -> Using' n m -> Bool)
-> (Using' n m -> Using' n m -> Bool) -> Eq (Using' n m)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall n m. (Eq m, Eq n) => Using' n m -> Using' n m -> Bool
/= :: Using' n m -> Using' n m -> Bool
$c/= :: forall n m. (Eq m, Eq n) => Using' n m -> Using' n m -> Bool
== :: Using' n m -> Using' n m -> Bool
$c== :: forall n m. (Eq m, Eq n) => Using' n m -> Using' n m -> Bool
Eq)

instance Semigroup (Using' n m) where
  Using' n m
UseEverything <> :: Using' n m -> Using' n m -> Using' n m
<> Using' n m
u             = Using' n m
u
  Using' n m
u             <> Using' n m
UseEverything = Using' n m
u
  Using [ImportedName' n m]
xs      <> Using [ImportedName' n m]
ys      = [ImportedName' n m] -> Using' n m
forall n m. [ImportedName' n m] -> Using' n m
Using ([ImportedName' n m]
xs [ImportedName' n m] -> [ImportedName' n m] -> [ImportedName' n m]
forall a. [a] -> [a] -> [a]
++ [ImportedName' n m]
ys)

instance Monoid (Using' n m) where
  mempty :: Using' n m
mempty  = Using' n m
forall n m. Using' n m
UseEverything
  mappend :: Using' n m -> Using' n m -> Using' n m
mappend = Using' n m -> Using' n m -> Using' n m
forall a. Semigroup a => a -> a -> a
(<>)

instance Null (Using' n m) where
  null :: Using' n m -> Bool
null Using' n m
UseEverything = Bool
True
  null Using{}       = Bool
False
  empty :: Using' n m
empty = Using' n m
forall a. Monoid a => a
mempty

mapUsing :: ([ImportedName' n1 m1] -> [ImportedName' n2 m2]) -> Using' n1 m1 -> Using' n2 m2
mapUsing :: ([ImportedName' n1 m1] -> [ImportedName' n2 m2])
-> Using' n1 m1 -> Using' n2 m2
mapUsing [ImportedName' n1 m1] -> [ImportedName' n2 m2]
f = \case
  Using' n1 m1
UseEverything -> Using' n2 m2
forall n m. Using' n m
UseEverything
  Using [ImportedName' n1 m1]
xs      -> [ImportedName' n2 m2] -> Using' n2 m2
forall n m. [ImportedName' n m] -> Using' n m
Using ([ImportedName' n2 m2] -> Using' n2 m2)
-> [ImportedName' n2 m2] -> Using' n2 m2
forall a b. (a -> b) -> a -> b
$ [ImportedName' n1 m1] -> [ImportedName' n2 m2]
f [ImportedName' n1 m1]
xs

-- | An imported name can be a module or a defined name.
data ImportedName' n m
  = ImportedModule  m  -- ^ Imported module name of type @m@.
  | ImportedName    n  -- ^ Imported name of type @n@.
  deriving (Typeable (ImportedName' n m)
DataType
Constr
Typeable (ImportedName' n m)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> ImportedName' n m
    -> c (ImportedName' n m))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (ImportedName' n m))
-> (ImportedName' n m -> Constr)
-> (ImportedName' n m -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (ImportedName' n m)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (ImportedName' n m)))
-> ((forall b. Data b => b -> b)
    -> ImportedName' n m -> ImportedName' n m)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ImportedName' n m -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ImportedName' n m -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> ImportedName' n m -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ImportedName' n m -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> ImportedName' n m -> m (ImportedName' n m))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ImportedName' n m -> m (ImportedName' n m))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ImportedName' n m -> m (ImportedName' n m))
-> Data (ImportedName' n m)
ImportedName' n m -> DataType
ImportedName' n m -> Constr
(forall b. Data b => b -> b)
-> ImportedName' n m -> ImportedName' n m
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ImportedName' n m
-> c (ImportedName' n m)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ImportedName' n m)
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ImportedName' n m))
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) -> ImportedName' n m -> u
forall u. (forall d. Data d => d -> u) -> ImportedName' n m -> [u]
forall n m. (Data n, Data m) => Typeable (ImportedName' n m)
forall n m. (Data n, Data m) => ImportedName' n m -> DataType
forall n m. (Data n, Data m) => ImportedName' n m -> Constr
forall n m.
(Data n, Data m) =>
(forall b. Data b => b -> b)
-> ImportedName' n m -> ImportedName' n m
forall n m u.
(Data n, Data m) =>
Int -> (forall d. Data d => d -> u) -> ImportedName' n m -> u
forall n m u.
(Data n, Data m) =>
(forall d. Data d => d -> u) -> ImportedName' n m -> [u]
forall n m r r'.
(Data n, Data m) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImportedName' n m -> r
forall n m r r'.
(Data n, Data m) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImportedName' n m -> r
forall n m (m :: * -> *).
(Data n, Data m, Monad m) =>
(forall d. Data d => d -> m d)
-> ImportedName' n m -> m (ImportedName' n m)
forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ImportedName' n m -> m (ImportedName' n m)
forall n m (c :: * -> *).
(Data n, Data m) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ImportedName' n m)
forall n m (c :: * -> *).
(Data n, Data m) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ImportedName' n m
-> c (ImportedName' n m)
forall n m (t :: * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ImportedName' n m))
forall n m (t :: * -> * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ImportedName' n m))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImportedName' n m -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImportedName' n m -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ImportedName' n m -> m (ImportedName' n m)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ImportedName' n m -> m (ImportedName' n m)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ImportedName' n m)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ImportedName' n m
-> c (ImportedName' n m)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ImportedName' n m))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ImportedName' n m))
$cImportedName :: Constr
$cImportedModule :: Constr
$tImportedName' :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> ImportedName' n m -> m (ImportedName' n m)
$cgmapMo :: forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ImportedName' n m -> m (ImportedName' n m)
gmapMp :: (forall d. Data d => d -> m d)
-> ImportedName' n m -> m (ImportedName' n m)
$cgmapMp :: forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ImportedName' n m -> m (ImportedName' n m)
gmapM :: (forall d. Data d => d -> m d)
-> ImportedName' n m -> m (ImportedName' n m)
$cgmapM :: forall n m (m :: * -> *).
(Data n, Data m, Monad m) =>
(forall d. Data d => d -> m d)
-> ImportedName' n m -> m (ImportedName' n m)
gmapQi :: Int -> (forall d. Data d => d -> u) -> ImportedName' n m -> u
$cgmapQi :: forall n m u.
(Data n, Data m) =>
Int -> (forall d. Data d => d -> u) -> ImportedName' n m -> u
gmapQ :: (forall d. Data d => d -> u) -> ImportedName' n m -> [u]
$cgmapQ :: forall n m u.
(Data n, Data m) =>
(forall d. Data d => d -> u) -> ImportedName' n m -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImportedName' n m -> r
$cgmapQr :: forall n m r r'.
(Data n, Data m) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImportedName' n m -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImportedName' n m -> r
$cgmapQl :: forall n m r r'.
(Data n, Data m) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImportedName' n m -> r
gmapT :: (forall b. Data b => b -> b)
-> ImportedName' n m -> ImportedName' n m
$cgmapT :: forall n m.
(Data n, Data m) =>
(forall b. Data b => b -> b)
-> ImportedName' n m -> ImportedName' n m
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ImportedName' n m))
$cdataCast2 :: forall n m (t :: * -> * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ImportedName' n m))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (ImportedName' n m))
$cdataCast1 :: forall n m (t :: * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ImportedName' n m))
dataTypeOf :: ImportedName' n m -> DataType
$cdataTypeOf :: forall n m. (Data n, Data m) => ImportedName' n m -> DataType
toConstr :: ImportedName' n m -> Constr
$ctoConstr :: forall n m. (Data n, Data m) => ImportedName' n m -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ImportedName' n m)
$cgunfold :: forall n m (c :: * -> *).
(Data n, Data m) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ImportedName' n m)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ImportedName' n m
-> c (ImportedName' n m)
$cgfoldl :: forall n m (c :: * -> *).
(Data n, Data m) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ImportedName' n m
-> c (ImportedName' n m)
$cp1Data :: forall n m. (Data n, Data m) => Typeable (ImportedName' n m)
Data, ImportedName' n m -> ImportedName' n m -> Bool
(ImportedName' n m -> ImportedName' n m -> Bool)
-> (ImportedName' n m -> ImportedName' n m -> Bool)
-> Eq (ImportedName' n m)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall n m.
(Eq m, Eq n) =>
ImportedName' n m -> ImportedName' n m -> Bool
/= :: ImportedName' n m -> ImportedName' n m -> Bool
$c/= :: forall n m.
(Eq m, Eq n) =>
ImportedName' n m -> ImportedName' n m -> Bool
== :: ImportedName' n m -> ImportedName' n m -> Bool
$c== :: forall n m.
(Eq m, Eq n) =>
ImportedName' n m -> ImportedName' n m -> Bool
Eq, Eq (ImportedName' n m)
Eq (ImportedName' n m)
-> (ImportedName' n m -> ImportedName' n m -> Ordering)
-> (ImportedName' n m -> ImportedName' n m -> Bool)
-> (ImportedName' n m -> ImportedName' n m -> Bool)
-> (ImportedName' n m -> ImportedName' n m -> Bool)
-> (ImportedName' n m -> ImportedName' n m -> Bool)
-> (ImportedName' n m -> ImportedName' n m -> ImportedName' n m)
-> (ImportedName' n m -> ImportedName' n m -> ImportedName' n m)
-> Ord (ImportedName' n m)
ImportedName' n m -> ImportedName' n m -> Bool
ImportedName' n m -> ImportedName' n m -> Ordering
ImportedName' n m -> ImportedName' n m -> ImportedName' n m
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
forall n m. (Ord m, Ord n) => Eq (ImportedName' n m)
forall n m.
(Ord m, Ord n) =>
ImportedName' n m -> ImportedName' n m -> Bool
forall n m.
(Ord m, Ord n) =>
ImportedName' n m -> ImportedName' n m -> Ordering
forall n m.
(Ord m, Ord n) =>
ImportedName' n m -> ImportedName' n m -> ImportedName' n m
min :: ImportedName' n m -> ImportedName' n m -> ImportedName' n m
$cmin :: forall n m.
(Ord m, Ord n) =>
ImportedName' n m -> ImportedName' n m -> ImportedName' n m
max :: ImportedName' n m -> ImportedName' n m -> ImportedName' n m
$cmax :: forall n m.
(Ord m, Ord n) =>
ImportedName' n m -> ImportedName' n m -> ImportedName' n m
>= :: ImportedName' n m -> ImportedName' n m -> Bool
$c>= :: forall n m.
(Ord m, Ord n) =>
ImportedName' n m -> ImportedName' n m -> Bool
> :: ImportedName' n m -> ImportedName' n m -> Bool
$c> :: forall n m.
(Ord m, Ord n) =>
ImportedName' n m -> ImportedName' n m -> Bool
<= :: ImportedName' n m -> ImportedName' n m -> Bool
$c<= :: forall n m.
(Ord m, Ord n) =>
ImportedName' n m -> ImportedName' n m -> Bool
< :: ImportedName' n m -> ImportedName' n m -> Bool
$c< :: forall n m.
(Ord m, Ord n) =>
ImportedName' n m -> ImportedName' n m -> Bool
compare :: ImportedName' n m -> ImportedName' n m -> Ordering
$ccompare :: forall n m.
(Ord m, Ord n) =>
ImportedName' n m -> ImportedName' n m -> Ordering
$cp1Ord :: forall n m. (Ord m, Ord n) => Eq (ImportedName' n m)
Ord, Int -> ImportedName' n m -> ShowS
[ImportedName' n m] -> ShowS
ImportedName' n m -> String
(Int -> ImportedName' n m -> ShowS)
-> (ImportedName' n m -> String)
-> ([ImportedName' n m] -> ShowS)
-> Show (ImportedName' n m)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall n m. (Show m, Show n) => Int -> ImportedName' n m -> ShowS
forall n m. (Show m, Show n) => [ImportedName' n m] -> ShowS
forall n m. (Show m, Show n) => ImportedName' n m -> String
showList :: [ImportedName' n m] -> ShowS
$cshowList :: forall n m. (Show m, Show n) => [ImportedName' n m] -> ShowS
show :: ImportedName' n m -> String
$cshow :: forall n m. (Show m, Show n) => ImportedName' n m -> String
showsPrec :: Int -> ImportedName' n m -> ShowS
$cshowsPrec :: forall n m. (Show m, Show n) => Int -> ImportedName' n m -> ShowS
Show)

fromImportedName :: ImportedName' a a -> a
fromImportedName :: ImportedName' a a -> a
fromImportedName = \case
  ImportedModule a
x -> a
x
  ImportedName   a
x -> a
x

setImportedName :: ImportedName' a a -> a -> ImportedName' a a
setImportedName :: ImportedName' a a -> a -> ImportedName' a a
setImportedName (ImportedName   a
x) a
y = a -> ImportedName' a a
forall n m. n -> ImportedName' n m
ImportedName   a
y
setImportedName (ImportedModule a
x) a
y = a -> ImportedName' a a
forall n m. m -> ImportedName' n m
ImportedModule a
y

-- | Like 'partitionEithers'.
partitionImportedNames :: [ImportedName' n m] -> ([n], [m])
partitionImportedNames :: [ImportedName' n m] -> ([n], [m])
partitionImportedNames = ((ImportedName' n m -> ([n], [m]) -> ([n], [m]))
 -> ([n], [m]) -> [ImportedName' n m] -> ([n], [m]))
-> ([n], [m])
-> (ImportedName' n m -> ([n], [m]) -> ([n], [m]))
-> [ImportedName' n m]
-> ([n], [m])
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ImportedName' n m -> ([n], [m]) -> ([n], [m]))
-> ([n], [m]) -> [ImportedName' n m] -> ([n], [m])
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ([], []) ((ImportedName' n m -> ([n], [m]) -> ([n], [m]))
 -> [ImportedName' n m] -> ([n], [m]))
-> (ImportedName' n m -> ([n], [m]) -> ([n], [m]))
-> [ImportedName' n m]
-> ([n], [m])
forall a b. (a -> b) -> a -> b
$ \case
  ImportedName   n
n -> ([n] -> [n]) -> ([n], [m]) -> ([n], [m])
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first  (n
nn -> [n] -> [n]
forall a. a -> [a] -> [a]
:)
  ImportedModule m
m -> ([m] -> [m]) -> ([n], [m]) -> ([n], [m])
forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second (m
mm -> [m] -> [m]
forall a. a -> [a] -> [a]
:)

-- -- Defined in Concrete.Pretty
-- instance (Pretty n, Pretty m) => Pretty (ImportedName' n m) where
--   pretty (ImportedModule x) = "module" <+> pretty x
--   pretty (ImportedName   x) = pretty x

-- instance (Show n, Show m) => Show (ImportedName' n m) where
--   show (ImportedModule x) = "module " ++ show x
--   show (ImportedName   x) = show x

data Renaming' n m = Renaming
  { Renaming' n m -> ImportedName' n m
renFrom    :: ImportedName' n m
    -- ^ Rename from this name.
  , Renaming' n m -> ImportedName' n m
renTo      :: ImportedName' n m
    -- ^ To this one.  Must be same kind as 'renFrom'.
  , Renaming' n m -> Maybe Fixity
renFixity  :: Maybe Fixity
    -- ^ New fixity of 'renTo' (optional).
  , Renaming' n m -> Range
renToRange :: Range
    -- ^ The range of the \"to\" keyword.  Retained for highlighting purposes.
  }
  deriving (Typeable (Renaming' n m)
DataType
Constr
Typeable (Renaming' n m)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Renaming' n m -> c (Renaming' n m))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Renaming' n m))
-> (Renaming' n m -> Constr)
-> (Renaming' n m -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Renaming' n m)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Renaming' n m)))
-> ((forall b. Data b => b -> b) -> Renaming' n m -> Renaming' n m)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Renaming' n m -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Renaming' n m -> r)
-> (forall u. (forall d. Data d => d -> u) -> Renaming' n m -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Renaming' n m -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> Renaming' n m -> m (Renaming' n m))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> Renaming' n m -> m (Renaming' n m))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> Renaming' n m -> m (Renaming' n m))
-> Data (Renaming' n m)
Renaming' n m -> DataType
Renaming' n m -> Constr
(forall b. Data b => b -> b) -> Renaming' n m -> Renaming' n m
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Renaming' n m -> c (Renaming' n m)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Renaming' n m)
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Renaming' n m))
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) -> Renaming' n m -> u
forall u. (forall d. Data d => d -> u) -> Renaming' n m -> [u]
forall n m. (Data n, Data m) => Typeable (Renaming' n m)
forall n m. (Data n, Data m) => Renaming' n m -> DataType
forall n m. (Data n, Data m) => Renaming' n m -> Constr
forall n m.
(Data n, Data m) =>
(forall b. Data b => b -> b) -> Renaming' n m -> Renaming' n m
forall n m u.
(Data n, Data m) =>
Int -> (forall d. Data d => d -> u) -> Renaming' n m -> u
forall n m u.
(Data n, Data m) =>
(forall d. Data d => d -> u) -> Renaming' n m -> [u]
forall n m r r'.
(Data n, Data m) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Renaming' n m -> r
forall n m r r'.
(Data n, Data m) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Renaming' n m -> r
forall n m (m :: * -> *).
(Data n, Data m, Monad m) =>
(forall d. Data d => d -> m d)
-> Renaming' n m -> m (Renaming' n m)
forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> Renaming' n m -> m (Renaming' n m)
forall n m (c :: * -> *).
(Data n, Data m) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Renaming' n m)
forall n m (c :: * -> *).
(Data n, Data m) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Renaming' n m -> c (Renaming' n m)
forall n m (t :: * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Renaming' n m))
forall n m (t :: * -> * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Renaming' n m))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Renaming' n m -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Renaming' n m -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> Renaming' n m -> m (Renaming' n m)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> Renaming' n m -> m (Renaming' n m)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Renaming' n m)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Renaming' n m -> c (Renaming' n m)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Renaming' n m))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Renaming' n m))
$cRenaming :: Constr
$tRenaming' :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> Renaming' n m -> m (Renaming' n m)
$cgmapMo :: forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> Renaming' n m -> m (Renaming' n m)
gmapMp :: (forall d. Data d => d -> m d)
-> Renaming' n m -> m (Renaming' n m)
$cgmapMp :: forall n m (m :: * -> *).
(Data n, Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> Renaming' n m -> m (Renaming' n m)
gmapM :: (forall d. Data d => d -> m d)
-> Renaming' n m -> m (Renaming' n m)
$cgmapM :: forall n m (m :: * -> *).
(Data n, Data m, Monad m) =>
(forall d. Data d => d -> m d)
-> Renaming' n m -> m (Renaming' n m)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Renaming' n m -> u
$cgmapQi :: forall n m u.
(Data n, Data m) =>
Int -> (forall d. Data d => d -> u) -> Renaming' n m -> u
gmapQ :: (forall d. Data d => d -> u) -> Renaming' n m -> [u]
$cgmapQ :: forall n m u.
(Data n, Data m) =>
(forall d. Data d => d -> u) -> Renaming' n m -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Renaming' n m -> r
$cgmapQr :: forall n m r r'.
(Data n, Data m) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Renaming' n m -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Renaming' n m -> r
$cgmapQl :: forall n m r r'.
(Data n, Data m) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Renaming' n m -> r
gmapT :: (forall b. Data b => b -> b) -> Renaming' n m -> Renaming' n m
$cgmapT :: forall n m.
(Data n, Data m) =>
(forall b. Data b => b -> b) -> Renaming' n m -> Renaming' n m
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Renaming' n m))
$cdataCast2 :: forall n m (t :: * -> * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Renaming' n m))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Renaming' n m))
$cdataCast1 :: forall n m (t :: * -> *) (c :: * -> *).
(Data n, Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Renaming' n m))
dataTypeOf :: Renaming' n m -> DataType
$cdataTypeOf :: forall n m. (Data n, Data m) => Renaming' n m -> DataType
toConstr :: Renaming' n m -> Constr
$ctoConstr :: forall n m. (Data n, Data m) => Renaming' n m -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Renaming' n m)
$cgunfold :: forall n m (c :: * -> *).
(Data n, Data m) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Renaming' n m)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Renaming' n m -> c (Renaming' n m)
$cgfoldl :: forall n m (c :: * -> *).
(Data n, Data m) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Renaming' n m -> c (Renaming' n m)
$cp1Data :: forall n m. (Data n, Data m) => Typeable (Renaming' n m)
Data, Renaming' n m -> Renaming' n m -> Bool
(Renaming' n m -> Renaming' n m -> Bool)
-> (Renaming' n m -> Renaming' n m -> Bool) -> Eq (Renaming' n m)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall n m. (Eq m, Eq n) => Renaming' n m -> Renaming' n m -> Bool
/= :: Renaming' n m -> Renaming' n m -> Bool
$c/= :: forall n m. (Eq m, Eq n) => Renaming' n m -> Renaming' n m -> Bool
== :: Renaming' n m -> Renaming' n m -> Bool
$c== :: forall n m. (Eq m, Eq n) => Renaming' n m -> Renaming' n m -> Bool
Eq)

-- ** HasRange instances

instance (HasRange a, HasRange b) => HasRange (ImportDirective' a b) where
  getRange :: ImportDirective' a b -> Range
getRange = ImportDirective' a b -> Range
forall n m. ImportDirective' n m -> Range
importDirRange

instance (HasRange a, HasRange b) => HasRange (Using' a b) where
  getRange :: Using' a b -> Range
getRange (Using  [ImportedName' a b]
xs) = [ImportedName' a b] -> Range
forall a. HasRange a => a -> Range
getRange [ImportedName' a b]
xs
  getRange Using' a b
UseEverything = Range
forall a. Range' a
noRange

instance (HasRange a, HasRange b) => HasRange (Renaming' a b) where
  getRange :: Renaming' a b -> Range
getRange Renaming' a b
r = (ImportedName' a b, ImportedName' a b) -> Range
forall a. HasRange a => a -> Range
getRange (Renaming' a b -> ImportedName' a b
forall n m. Renaming' n m -> ImportedName' n m
renFrom Renaming' a b
r, Renaming' a b -> ImportedName' a b
forall n m. Renaming' n m -> ImportedName' n m
renTo Renaming' a b
r)

instance (HasRange a, HasRange b) => HasRange (ImportedName' a b) where
  getRange :: ImportedName' a b -> Range
getRange (ImportedName   a
x) = a -> Range
forall a. HasRange a => a -> Range
getRange a
x
  getRange (ImportedModule b
x) = b -> Range
forall a. HasRange a => a -> Range
getRange b
x

-- ** KillRange instances

instance (KillRange a, KillRange b) => KillRange (ImportDirective' a b) where
  killRange :: KillRangeT (ImportDirective' a b)
killRange (ImportDirective Range
_ Using' a b
u HidingDirective' a b
h RenamingDirective' a b
r Maybe Range
p) =
    (Using' a b
 -> HidingDirective' a b
 -> RenamingDirective' a b
 -> ImportDirective' a b)
-> Using' a b
-> HidingDirective' a b
-> RenamingDirective' a b
-> ImportDirective' a b
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (\Using' a b
u HidingDirective' a b
h RenamingDirective' a b
r -> Range
-> Using' a b
-> HidingDirective' a b
-> RenamingDirective' a b
-> Maybe Range
-> ImportDirective' a b
forall n m.
Range
-> Using' n m
-> HidingDirective' n m
-> RenamingDirective' n m
-> Maybe Range
-> ImportDirective' n m
ImportDirective Range
forall a. Range' a
noRange Using' a b
u HidingDirective' a b
h RenamingDirective' a b
r Maybe Range
p) Using' a b
u HidingDirective' a b
h RenamingDirective' a b
r

instance (KillRange a, KillRange b) => KillRange (Using' a b) where
  killRange :: KillRangeT (Using' a b)
killRange (Using  [ImportedName' a b]
i) = ([ImportedName' a b] -> Using' a b)
-> [ImportedName' a b] -> Using' a b
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 [ImportedName' a b] -> Using' a b
forall n m. [ImportedName' n m] -> Using' n m
Using  [ImportedName' a b]
i
  killRange Using' a b
UseEverything = Using' a b
forall n m. Using' n m
UseEverything

instance (KillRange a, KillRange b) => KillRange (Renaming' a b) where
  killRange :: KillRangeT (Renaming' a b)
killRange (Renaming ImportedName' a b
i ImportedName' a b
n Maybe Fixity
mf Range
_to) = (ImportedName' a b
 -> ImportedName' a b -> Maybe Fixity -> Renaming' a b)
-> ImportedName' a b
-> ImportedName' a b
-> Maybe Fixity
-> Renaming' a b
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (\ ImportedName' a b
i ImportedName' a b
n Maybe Fixity
mf -> ImportedName' a b
-> ImportedName' a b -> Maybe Fixity -> Range -> Renaming' a b
forall n m.
ImportedName' n m
-> ImportedName' n m -> Maybe Fixity -> Range -> Renaming' n m
Renaming ImportedName' a b
i ImportedName' a b
n Maybe Fixity
mf Range
forall a. Range' a
noRange) ImportedName' a b
i ImportedName' a b
n Maybe Fixity
mf

instance (KillRange a, KillRange b) => KillRange (ImportedName' a b) where
  killRange :: KillRangeT (ImportedName' a b)
killRange (ImportedModule b
n) = (b -> ImportedName' a b) -> b -> ImportedName' a b
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 b -> ImportedName' a b
forall n m. m -> ImportedName' n m
ImportedModule b
n
  killRange (ImportedName   a
n) = (a -> ImportedName' a b) -> a -> ImportedName' a b
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 a -> ImportedName' a b
forall n m. n -> ImportedName' n m
ImportedName   a
n

-- ** NFData instances

-- | Ranges are not forced.

instance (NFData a, NFData b) => NFData (ImportDirective' a b) where
  rnf :: ImportDirective' a b -> ()
rnf (ImportDirective Range
_ Using' a b
a HidingDirective' a b
b RenamingDirective' a b
c Maybe Range
_) = Using' a b -> ()
forall a. NFData a => a -> ()
rnf Using' a b
a () -> () -> ()
`seq` HidingDirective' a b -> ()
forall a. NFData a => a -> ()
rnf HidingDirective' a b
b () -> () -> ()
`seq` RenamingDirective' a b -> ()
forall a. NFData a => a -> ()
rnf RenamingDirective' a b
c

instance (NFData a, NFData b) => NFData (Using' a b) where
  rnf :: Using' a b -> ()
rnf Using' a b
UseEverything = ()
  rnf (Using [ImportedName' a b]
a)     = [ImportedName' a b] -> ()
forall a. NFData a => a -> ()
rnf [ImportedName' a b]
a

-- | Ranges are not forced.

instance (NFData a, NFData b) => NFData (Renaming' a b) where
  rnf :: Renaming' a b -> ()
rnf (Renaming ImportedName' a b
a ImportedName' a b
b Maybe Fixity
c Range
_) = ImportedName' a b -> ()
forall a. NFData a => a -> ()
rnf ImportedName' a b
a () -> () -> ()
`seq` ImportedName' a b -> ()
forall a. NFData a => a -> ()
rnf ImportedName' a b
b () -> () -> ()
`seq` Maybe Fixity -> ()
forall a. NFData a => a -> ()
rnf Maybe Fixity
c

instance (NFData a, NFData b) => NFData (ImportedName' a b) where
  rnf :: ImportedName' a b -> ()
rnf (ImportedModule b
a) = b -> ()
forall a. NFData a => a -> ()
rnf b
a
  rnf (ImportedName a
a)   = a -> ()
forall a. NFData a => a -> ()
rnf a
a

-----------------------------------------------------------------------------
-- * Termination
-----------------------------------------------------------------------------

-- | Termination check? (Default = TerminationCheck).
data TerminationCheck m
  = TerminationCheck
    -- ^ Run the termination checker.
  | NoTerminationCheck
    -- ^ Skip termination checking (unsafe).
  | NonTerminating
    -- ^ Treat as non-terminating.
  | Terminating
    -- ^ Treat as terminating (unsafe).  Same effect as 'NoTerminationCheck'.
  | TerminationMeasure Range m
    -- ^ Skip termination checking but use measure instead.
    deriving (Typeable (TerminationCheck m)
DataType
Constr
Typeable (TerminationCheck m)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> TerminationCheck m
    -> c (TerminationCheck m))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (TerminationCheck m))
-> (TerminationCheck m -> Constr)
-> (TerminationCheck m -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (TerminationCheck m)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (TerminationCheck m)))
-> ((forall b. Data b => b -> b)
    -> TerminationCheck m -> TerminationCheck m)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TerminationCheck m -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TerminationCheck m -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> TerminationCheck m -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> TerminationCheck m -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> TerminationCheck m -> m (TerminationCheck m))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TerminationCheck m -> m (TerminationCheck m))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TerminationCheck m -> m (TerminationCheck m))
-> Data (TerminationCheck m)
TerminationCheck m -> DataType
TerminationCheck m -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (TerminationCheck m))
(forall b. Data b => b -> b)
-> TerminationCheck m -> TerminationCheck m
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TerminationCheck m
-> c (TerminationCheck m)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TerminationCheck m)
forall m. Data m => Typeable (TerminationCheck m)
forall m. Data m => TerminationCheck m -> DataType
forall m. Data m => TerminationCheck m -> Constr
forall m.
Data m =>
(forall b. Data b => b -> b)
-> TerminationCheck m -> TerminationCheck m
forall m u.
Data m =>
Int -> (forall d. Data d => d -> u) -> TerminationCheck m -> u
forall m u.
Data m =>
(forall d. Data d => d -> u) -> TerminationCheck m -> [u]
forall m r r'.
Data m =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TerminationCheck m -> r
forall m r r'.
Data m =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TerminationCheck m -> r
forall m (m :: * -> *).
(Data m, Monad m) =>
(forall d. Data d => d -> m d)
-> TerminationCheck m -> m (TerminationCheck m)
forall m (m :: * -> *).
(Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> TerminationCheck m -> m (TerminationCheck m)
forall m (c :: * -> *).
Data m =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TerminationCheck m)
forall m (c :: * -> *).
Data m =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TerminationCheck m
-> c (TerminationCheck m)
forall m (t :: * -> *) (c :: * -> *).
(Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (TerminationCheck m))
forall m (t :: * -> * -> *) (c :: * -> *).
(Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (TerminationCheck m))
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) -> TerminationCheck m -> u
forall u. (forall d. Data d => d -> u) -> TerminationCheck m -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TerminationCheck m -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TerminationCheck m -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> TerminationCheck m -> m (TerminationCheck m)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TerminationCheck m -> m (TerminationCheck m)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TerminationCheck m)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TerminationCheck m
-> c (TerminationCheck m)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (TerminationCheck m))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (TerminationCheck m))
$cTerminationMeasure :: Constr
$cTerminating :: Constr
$cNonTerminating :: Constr
$cNoTerminationCheck :: Constr
$cTerminationCheck :: Constr
$tTerminationCheck :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> TerminationCheck m -> m (TerminationCheck m)
$cgmapMo :: forall m (m :: * -> *).
(Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> TerminationCheck m -> m (TerminationCheck m)
gmapMp :: (forall d. Data d => d -> m d)
-> TerminationCheck m -> m (TerminationCheck m)
$cgmapMp :: forall m (m :: * -> *).
(Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> TerminationCheck m -> m (TerminationCheck m)
gmapM :: (forall d. Data d => d -> m d)
-> TerminationCheck m -> m (TerminationCheck m)
$cgmapM :: forall m (m :: * -> *).
(Data m, Monad m) =>
(forall d. Data d => d -> m d)
-> TerminationCheck m -> m (TerminationCheck m)
gmapQi :: Int -> (forall d. Data d => d -> u) -> TerminationCheck m -> u
$cgmapQi :: forall m u.
Data m =>
Int -> (forall d. Data d => d -> u) -> TerminationCheck m -> u
gmapQ :: (forall d. Data d => d -> u) -> TerminationCheck m -> [u]
$cgmapQ :: forall m u.
Data m =>
(forall d. Data d => d -> u) -> TerminationCheck m -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TerminationCheck m -> r
$cgmapQr :: forall m r r'.
Data m =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TerminationCheck m -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TerminationCheck m -> r
$cgmapQl :: forall m r r'.
Data m =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TerminationCheck m -> r
gmapT :: (forall b. Data b => b -> b)
-> TerminationCheck m -> TerminationCheck m
$cgmapT :: forall m.
Data m =>
(forall b. Data b => b -> b)
-> TerminationCheck m -> TerminationCheck m
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (TerminationCheck m))
$cdataCast2 :: forall m (t :: * -> * -> *) (c :: * -> *).
(Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (TerminationCheck m))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (TerminationCheck m))
$cdataCast1 :: forall m (t :: * -> *) (c :: * -> *).
(Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (TerminationCheck m))
dataTypeOf :: TerminationCheck m -> DataType
$cdataTypeOf :: forall m. Data m => TerminationCheck m -> DataType
toConstr :: TerminationCheck m -> Constr
$ctoConstr :: forall m. Data m => TerminationCheck m -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TerminationCheck m)
$cgunfold :: forall m (c :: * -> *).
Data m =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TerminationCheck m)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TerminationCheck m
-> c (TerminationCheck m)
$cgfoldl :: forall m (c :: * -> *).
Data m =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TerminationCheck m
-> c (TerminationCheck m)
$cp1Data :: forall m. Data m => Typeable (TerminationCheck m)
Data, Int -> TerminationCheck m -> ShowS
[TerminationCheck m] -> ShowS
TerminationCheck m -> String
(Int -> TerminationCheck m -> ShowS)
-> (TerminationCheck m -> String)
-> ([TerminationCheck m] -> ShowS)
-> Show (TerminationCheck m)
forall m. Show m => Int -> TerminationCheck m -> ShowS
forall m. Show m => [TerminationCheck m] -> ShowS
forall m. Show m => TerminationCheck m -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminationCheck m] -> ShowS
$cshowList :: forall m. Show m => [TerminationCheck m] -> ShowS
show :: TerminationCheck m -> String
$cshow :: forall m. Show m => TerminationCheck m -> String
showsPrec :: Int -> TerminationCheck m -> ShowS
$cshowsPrec :: forall m. Show m => Int -> TerminationCheck m -> ShowS
Show, TerminationCheck m -> TerminationCheck m -> Bool
(TerminationCheck m -> TerminationCheck m -> Bool)
-> (TerminationCheck m -> TerminationCheck m -> Bool)
-> Eq (TerminationCheck m)
forall m. Eq m => TerminationCheck m -> TerminationCheck m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminationCheck m -> TerminationCheck m -> Bool
$c/= :: forall m. Eq m => TerminationCheck m -> TerminationCheck m -> Bool
== :: TerminationCheck m -> TerminationCheck m -> Bool
$c== :: forall m. Eq m => TerminationCheck m -> TerminationCheck m -> Bool
Eq, a -> TerminationCheck b -> TerminationCheck a
(a -> b) -> TerminationCheck a -> TerminationCheck b
(forall a b. (a -> b) -> TerminationCheck a -> TerminationCheck b)
-> (forall a b. a -> TerminationCheck b -> TerminationCheck a)
-> Functor TerminationCheck
forall a b. a -> TerminationCheck b -> TerminationCheck a
forall a b. (a -> b) -> TerminationCheck a -> TerminationCheck b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> TerminationCheck b -> TerminationCheck a
$c<$ :: forall a b. a -> TerminationCheck b -> TerminationCheck a
fmap :: (a -> b) -> TerminationCheck a -> TerminationCheck b
$cfmap :: forall a b. (a -> b) -> TerminationCheck a -> TerminationCheck b
Functor)

instance KillRange m => KillRange (TerminationCheck m) where
  killRange :: KillRangeT (TerminationCheck m)
killRange (TerminationMeasure Range
_ m
m) = Range -> m -> TerminationCheck m
forall m. Range -> m -> TerminationCheck m
TerminationMeasure Range
forall a. Range' a
noRange (KillRangeT m
forall a. KillRange a => KillRangeT a
killRange m
m)
  killRange TerminationCheck m
t                        = TerminationCheck m
t

instance NFData a => NFData (TerminationCheck a) where
  rnf :: TerminationCheck a -> ()
rnf TerminationCheck a
TerminationCheck         = ()
  rnf TerminationCheck a
NoTerminationCheck       = ()
  rnf TerminationCheck a
NonTerminating           = ()
  rnf TerminationCheck a
Terminating              = ()
  rnf (TerminationMeasure Range
_ a
a) = a -> ()
forall a. NFData a => a -> ()
rnf a
a

-----------------------------------------------------------------------------
-- * Positivity
-----------------------------------------------------------------------------

-- | Positivity check? (Default = True).
data PositivityCheck = YesPositivityCheck | NoPositivityCheck
  deriving (PositivityCheck -> PositivityCheck -> Bool
(PositivityCheck -> PositivityCheck -> Bool)
-> (PositivityCheck -> PositivityCheck -> Bool)
-> Eq PositivityCheck
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PositivityCheck -> PositivityCheck -> Bool
$c/= :: PositivityCheck -> PositivityCheck -> Bool
== :: PositivityCheck -> PositivityCheck -> Bool
$c== :: PositivityCheck -> PositivityCheck -> Bool
Eq, Eq PositivityCheck
Eq PositivityCheck
-> (PositivityCheck -> PositivityCheck -> Ordering)
-> (PositivityCheck -> PositivityCheck -> Bool)
-> (PositivityCheck -> PositivityCheck -> Bool)
-> (PositivityCheck -> PositivityCheck -> Bool)
-> (PositivityCheck -> PositivityCheck -> Bool)
-> (PositivityCheck -> PositivityCheck -> PositivityCheck)
-> (PositivityCheck -> PositivityCheck -> PositivityCheck)
-> Ord PositivityCheck
PositivityCheck -> PositivityCheck -> Bool
PositivityCheck -> PositivityCheck -> Ordering
PositivityCheck -> PositivityCheck -> PositivityCheck
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 :: PositivityCheck -> PositivityCheck -> PositivityCheck
$cmin :: PositivityCheck -> PositivityCheck -> PositivityCheck
max :: PositivityCheck -> PositivityCheck -> PositivityCheck
$cmax :: PositivityCheck -> PositivityCheck -> PositivityCheck
>= :: PositivityCheck -> PositivityCheck -> Bool
$c>= :: PositivityCheck -> PositivityCheck -> Bool
> :: PositivityCheck -> PositivityCheck -> Bool
$c> :: PositivityCheck -> PositivityCheck -> Bool
<= :: PositivityCheck -> PositivityCheck -> Bool
$c<= :: PositivityCheck -> PositivityCheck -> Bool
< :: PositivityCheck -> PositivityCheck -> Bool
$c< :: PositivityCheck -> PositivityCheck -> Bool
compare :: PositivityCheck -> PositivityCheck -> Ordering
$ccompare :: PositivityCheck -> PositivityCheck -> Ordering
$cp1Ord :: Eq PositivityCheck
Ord, Int -> PositivityCheck -> ShowS
[PositivityCheck] -> ShowS
PositivityCheck -> String
(Int -> PositivityCheck -> ShowS)
-> (PositivityCheck -> String)
-> ([PositivityCheck] -> ShowS)
-> Show PositivityCheck
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PositivityCheck] -> ShowS
$cshowList :: [PositivityCheck] -> ShowS
show :: PositivityCheck -> String
$cshow :: PositivityCheck -> String
showsPrec :: Int -> PositivityCheck -> ShowS
$cshowsPrec :: Int -> PositivityCheck -> ShowS
Show, PositivityCheck
PositivityCheck -> PositivityCheck -> Bounded PositivityCheck
forall a. a -> a -> Bounded a
maxBound :: PositivityCheck
$cmaxBound :: PositivityCheck
minBound :: PositivityCheck
$cminBound :: PositivityCheck
Bounded, Int -> PositivityCheck
PositivityCheck -> Int
PositivityCheck -> [PositivityCheck]
PositivityCheck -> PositivityCheck
PositivityCheck -> PositivityCheck -> [PositivityCheck]
PositivityCheck
-> PositivityCheck -> PositivityCheck -> [PositivityCheck]
(PositivityCheck -> PositivityCheck)
-> (PositivityCheck -> PositivityCheck)
-> (Int -> PositivityCheck)
-> (PositivityCheck -> Int)
-> (PositivityCheck -> [PositivityCheck])
-> (PositivityCheck -> PositivityCheck -> [PositivityCheck])
-> (PositivityCheck -> PositivityCheck -> [PositivityCheck])
-> (PositivityCheck
    -> PositivityCheck -> PositivityCheck -> [PositivityCheck])
-> Enum PositivityCheck
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: PositivityCheck
-> PositivityCheck -> PositivityCheck -> [PositivityCheck]
$cenumFromThenTo :: PositivityCheck
-> PositivityCheck -> PositivityCheck -> [PositivityCheck]
enumFromTo :: PositivityCheck -> PositivityCheck -> [PositivityCheck]
$cenumFromTo :: PositivityCheck -> PositivityCheck -> [PositivityCheck]
enumFromThen :: PositivityCheck -> PositivityCheck -> [PositivityCheck]
$cenumFromThen :: PositivityCheck -> PositivityCheck -> [PositivityCheck]
enumFrom :: PositivityCheck -> [PositivityCheck]
$cenumFrom :: PositivityCheck -> [PositivityCheck]
fromEnum :: PositivityCheck -> Int
$cfromEnum :: PositivityCheck -> Int
toEnum :: Int -> PositivityCheck
$ctoEnum :: Int -> PositivityCheck
pred :: PositivityCheck -> PositivityCheck
$cpred :: PositivityCheck -> PositivityCheck
succ :: PositivityCheck -> PositivityCheck
$csucc :: PositivityCheck -> PositivityCheck
Enum, Typeable PositivityCheck
DataType
Constr
Typeable PositivityCheck
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PositivityCheck -> c PositivityCheck)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PositivityCheck)
-> (PositivityCheck -> Constr)
-> (PositivityCheck -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PositivityCheck))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PositivityCheck))
-> ((forall b. Data b => b -> b)
    -> PositivityCheck -> PositivityCheck)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PositivityCheck -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PositivityCheck -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> PositivityCheck -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> PositivityCheck -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> PositivityCheck -> m PositivityCheck)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PositivityCheck -> m PositivityCheck)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PositivityCheck -> m PositivityCheck)
-> Data PositivityCheck
PositivityCheck -> DataType
PositivityCheck -> Constr
(forall b. Data b => b -> b) -> PositivityCheck -> PositivityCheck
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositivityCheck -> c PositivityCheck
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositivityCheck
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) -> PositivityCheck -> u
forall u. (forall d. Data d => d -> u) -> PositivityCheck -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PositivityCheck -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PositivityCheck -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> PositivityCheck -> m PositivityCheck
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PositivityCheck -> m PositivityCheck
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositivityCheck
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositivityCheck -> c PositivityCheck
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PositivityCheck)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PositivityCheck)
$cNoPositivityCheck :: Constr
$cYesPositivityCheck :: Constr
$tPositivityCheck :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> PositivityCheck -> m PositivityCheck
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PositivityCheck -> m PositivityCheck
gmapMp :: (forall d. Data d => d -> m d)
-> PositivityCheck -> m PositivityCheck
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PositivityCheck -> m PositivityCheck
gmapM :: (forall d. Data d => d -> m d)
-> PositivityCheck -> m PositivityCheck
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> PositivityCheck -> m PositivityCheck
gmapQi :: Int -> (forall d. Data d => d -> u) -> PositivityCheck -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> PositivityCheck -> u
gmapQ :: (forall d. Data d => d -> u) -> PositivityCheck -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> PositivityCheck -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PositivityCheck -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PositivityCheck -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PositivityCheck -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PositivityCheck -> r
gmapT :: (forall b. Data b => b -> b) -> PositivityCheck -> PositivityCheck
$cgmapT :: (forall b. Data b => b -> b) -> PositivityCheck -> PositivityCheck
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PositivityCheck)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PositivityCheck)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c PositivityCheck)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PositivityCheck)
dataTypeOf :: PositivityCheck -> DataType
$cdataTypeOf :: PositivityCheck -> DataType
toConstr :: PositivityCheck -> Constr
$ctoConstr :: PositivityCheck -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositivityCheck
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositivityCheck
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositivityCheck -> c PositivityCheck
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositivityCheck -> c PositivityCheck
$cp1Data :: Typeable PositivityCheck
Data, (forall x. PositivityCheck -> Rep PositivityCheck x)
-> (forall x. Rep PositivityCheck x -> PositivityCheck)
-> Generic PositivityCheck
forall x. Rep PositivityCheck x -> PositivityCheck
forall x. PositivityCheck -> Rep PositivityCheck x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PositivityCheck x -> PositivityCheck
$cfrom :: forall x. PositivityCheck -> Rep PositivityCheck x
Generic)

instance KillRange PositivityCheck where
  killRange :: PositivityCheck -> PositivityCheck
killRange = PositivityCheck -> PositivityCheck
forall a. a -> a
id

-- Semigroup and Monoid via conjunction
instance Semigroup PositivityCheck where
  PositivityCheck
NoPositivityCheck <> :: PositivityCheck -> PositivityCheck -> PositivityCheck
<> PositivityCheck
_ = PositivityCheck
NoPositivityCheck
  PositivityCheck
_ <> PositivityCheck
NoPositivityCheck = PositivityCheck
NoPositivityCheck
  PositivityCheck
_ <> PositivityCheck
_ = PositivityCheck
YesPositivityCheck

instance Monoid PositivityCheck where
  mempty :: PositivityCheck
mempty  = PositivityCheck
YesPositivityCheck
  mappend :: PositivityCheck -> PositivityCheck -> PositivityCheck
mappend = PositivityCheck -> PositivityCheck -> PositivityCheck
forall a. Semigroup a => a -> a -> a
(<>)

instance NFData PositivityCheck

-----------------------------------------------------------------------------
-- * Universe checking
-----------------------------------------------------------------------------

-- | Universe check? (Default is yes).
data UniverseCheck = YesUniverseCheck | NoUniverseCheck
  deriving (UniverseCheck -> UniverseCheck -> Bool
(UniverseCheck -> UniverseCheck -> Bool)
-> (UniverseCheck -> UniverseCheck -> Bool) -> Eq UniverseCheck
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UniverseCheck -> UniverseCheck -> Bool
$c/= :: UniverseCheck -> UniverseCheck -> Bool
== :: UniverseCheck -> UniverseCheck -> Bool
$c== :: UniverseCheck -> UniverseCheck -> Bool
Eq, Eq UniverseCheck
Eq UniverseCheck
-> (UniverseCheck -> UniverseCheck -> Ordering)
-> (UniverseCheck -> UniverseCheck -> Bool)
-> (UniverseCheck -> UniverseCheck -> Bool)
-> (UniverseCheck -> UniverseCheck -> Bool)
-> (UniverseCheck -> UniverseCheck -> Bool)
-> (UniverseCheck -> UniverseCheck -> UniverseCheck)
-> (UniverseCheck -> UniverseCheck -> UniverseCheck)
-> Ord UniverseCheck
UniverseCheck -> UniverseCheck -> Bool
UniverseCheck -> UniverseCheck -> Ordering
UniverseCheck -> UniverseCheck -> UniverseCheck
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 :: UniverseCheck -> UniverseCheck -> UniverseCheck
$cmin :: UniverseCheck -> UniverseCheck -> UniverseCheck
max :: UniverseCheck -> UniverseCheck -> UniverseCheck
$cmax :: UniverseCheck -> UniverseCheck -> UniverseCheck
>= :: UniverseCheck -> UniverseCheck -> Bool
$c>= :: UniverseCheck -> UniverseCheck -> Bool
> :: UniverseCheck -> UniverseCheck -> Bool
$c> :: UniverseCheck -> UniverseCheck -> Bool
<= :: UniverseCheck -> UniverseCheck -> Bool
$c<= :: UniverseCheck -> UniverseCheck -> Bool
< :: UniverseCheck -> UniverseCheck -> Bool
$c< :: UniverseCheck -> UniverseCheck -> Bool
compare :: UniverseCheck -> UniverseCheck -> Ordering
$ccompare :: UniverseCheck -> UniverseCheck -> Ordering
$cp1Ord :: Eq UniverseCheck
Ord, Int -> UniverseCheck -> ShowS
[UniverseCheck] -> ShowS
UniverseCheck -> String
(Int -> UniverseCheck -> ShowS)
-> (UniverseCheck -> String)
-> ([UniverseCheck] -> ShowS)
-> Show UniverseCheck
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UniverseCheck] -> ShowS
$cshowList :: [UniverseCheck] -> ShowS
show :: UniverseCheck -> String
$cshow :: UniverseCheck -> String
showsPrec :: Int -> UniverseCheck -> ShowS
$cshowsPrec :: Int -> UniverseCheck -> ShowS
Show, UniverseCheck
UniverseCheck -> UniverseCheck -> Bounded UniverseCheck
forall a. a -> a -> Bounded a
maxBound :: UniverseCheck
$cmaxBound :: UniverseCheck
minBound :: UniverseCheck
$cminBound :: UniverseCheck
Bounded, Int -> UniverseCheck
UniverseCheck -> Int
UniverseCheck -> [UniverseCheck]
UniverseCheck -> UniverseCheck
UniverseCheck -> UniverseCheck -> [UniverseCheck]
UniverseCheck -> UniverseCheck -> UniverseCheck -> [UniverseCheck]
(UniverseCheck -> UniverseCheck)
-> (UniverseCheck -> UniverseCheck)
-> (Int -> UniverseCheck)
-> (UniverseCheck -> Int)
-> (UniverseCheck -> [UniverseCheck])
-> (UniverseCheck -> UniverseCheck -> [UniverseCheck])
-> (UniverseCheck -> UniverseCheck -> [UniverseCheck])
-> (UniverseCheck
    -> UniverseCheck -> UniverseCheck -> [UniverseCheck])
-> Enum UniverseCheck
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: UniverseCheck -> UniverseCheck -> UniverseCheck -> [UniverseCheck]
$cenumFromThenTo :: UniverseCheck -> UniverseCheck -> UniverseCheck -> [UniverseCheck]
enumFromTo :: UniverseCheck -> UniverseCheck -> [UniverseCheck]
$cenumFromTo :: UniverseCheck -> UniverseCheck -> [UniverseCheck]
enumFromThen :: UniverseCheck -> UniverseCheck -> [UniverseCheck]
$cenumFromThen :: UniverseCheck -> UniverseCheck -> [UniverseCheck]
enumFrom :: UniverseCheck -> [UniverseCheck]
$cenumFrom :: UniverseCheck -> [UniverseCheck]
fromEnum :: UniverseCheck -> Int
$cfromEnum :: UniverseCheck -> Int
toEnum :: Int -> UniverseCheck
$ctoEnum :: Int -> UniverseCheck
pred :: UniverseCheck -> UniverseCheck
$cpred :: UniverseCheck -> UniverseCheck
succ :: UniverseCheck -> UniverseCheck
$csucc :: UniverseCheck -> UniverseCheck
Enum, Typeable UniverseCheck
DataType
Constr
Typeable UniverseCheck
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UniverseCheck -> c UniverseCheck)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UniverseCheck)
-> (UniverseCheck -> Constr)
-> (UniverseCheck -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UniverseCheck))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UniverseCheck))
-> ((forall b. Data b => b -> b) -> UniverseCheck -> UniverseCheck)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> UniverseCheck -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> UniverseCheck -> r)
-> (forall u. (forall d. Data d => d -> u) -> UniverseCheck -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UniverseCheck -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck)
-> Data UniverseCheck
UniverseCheck -> DataType
UniverseCheck -> Constr
(forall b. Data b => b -> b) -> UniverseCheck -> UniverseCheck
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UniverseCheck -> c UniverseCheck
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UniverseCheck
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) -> UniverseCheck -> u
forall u. (forall d. Data d => d -> u) -> UniverseCheck -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UniverseCheck -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UniverseCheck -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UniverseCheck
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UniverseCheck -> c UniverseCheck
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UniverseCheck)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UniverseCheck)
$cNoUniverseCheck :: Constr
$cYesUniverseCheck :: Constr
$tUniverseCheck :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck
gmapMp :: (forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck
gmapM :: (forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UniverseCheck -> m UniverseCheck
gmapQi :: Int -> (forall d. Data d => d -> u) -> UniverseCheck -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UniverseCheck -> u
gmapQ :: (forall d. Data d => d -> u) -> UniverseCheck -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UniverseCheck -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UniverseCheck -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UniverseCheck -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UniverseCheck -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UniverseCheck -> r
gmapT :: (forall b. Data b => b -> b) -> UniverseCheck -> UniverseCheck
$cgmapT :: (forall b. Data b => b -> b) -> UniverseCheck -> UniverseCheck
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UniverseCheck)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UniverseCheck)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UniverseCheck)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UniverseCheck)
dataTypeOf :: UniverseCheck -> DataType
$cdataTypeOf :: UniverseCheck -> DataType
toConstr :: UniverseCheck -> Constr
$ctoConstr :: UniverseCheck -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UniverseCheck
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UniverseCheck
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UniverseCheck -> c UniverseCheck
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UniverseCheck -> c UniverseCheck
$cp1Data :: Typeable UniverseCheck
Data, (forall x. UniverseCheck -> Rep UniverseCheck x)
-> (forall x. Rep UniverseCheck x -> UniverseCheck)
-> Generic UniverseCheck
forall x. Rep UniverseCheck x -> UniverseCheck
forall x. UniverseCheck -> Rep UniverseCheck x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UniverseCheck x -> UniverseCheck
$cfrom :: forall x. UniverseCheck -> Rep UniverseCheck x
Generic)

instance KillRange UniverseCheck where
  killRange :: UniverseCheck -> UniverseCheck
killRange = UniverseCheck -> UniverseCheck
forall a. a -> a
id

instance NFData UniverseCheck

-----------------------------------------------------------------------------
-- * Universe checking
-----------------------------------------------------------------------------

-- | Coverage check? (Default is yes).
data CoverageCheck = YesCoverageCheck | NoCoverageCheck
  deriving (CoverageCheck -> CoverageCheck -> Bool
(CoverageCheck -> CoverageCheck -> Bool)
-> (CoverageCheck -> CoverageCheck -> Bool) -> Eq CoverageCheck
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CoverageCheck -> CoverageCheck -> Bool
$c/= :: CoverageCheck -> CoverageCheck -> Bool
== :: CoverageCheck -> CoverageCheck -> Bool
$c== :: CoverageCheck -> CoverageCheck -> Bool
Eq, Eq CoverageCheck
Eq CoverageCheck
-> (CoverageCheck -> CoverageCheck -> Ordering)
-> (CoverageCheck -> CoverageCheck -> Bool)
-> (CoverageCheck -> CoverageCheck -> Bool)
-> (CoverageCheck -> CoverageCheck -> Bool)
-> (CoverageCheck -> CoverageCheck -> Bool)
-> (CoverageCheck -> CoverageCheck -> CoverageCheck)
-> (CoverageCheck -> CoverageCheck -> CoverageCheck)
-> Ord CoverageCheck
CoverageCheck -> CoverageCheck -> Bool
CoverageCheck -> CoverageCheck -> Ordering
CoverageCheck -> CoverageCheck -> CoverageCheck
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 :: CoverageCheck -> CoverageCheck -> CoverageCheck
$cmin :: CoverageCheck -> CoverageCheck -> CoverageCheck
max :: CoverageCheck -> CoverageCheck -> CoverageCheck
$cmax :: CoverageCheck -> CoverageCheck -> CoverageCheck
>= :: CoverageCheck -> CoverageCheck -> Bool
$c>= :: CoverageCheck -> CoverageCheck -> Bool
> :: CoverageCheck -> CoverageCheck -> Bool
$c> :: CoverageCheck -> CoverageCheck -> Bool
<= :: CoverageCheck -> CoverageCheck -> Bool
$c<= :: CoverageCheck -> CoverageCheck -> Bool
< :: CoverageCheck -> CoverageCheck -> Bool
$c< :: CoverageCheck -> CoverageCheck -> Bool
compare :: CoverageCheck -> CoverageCheck -> Ordering
$ccompare :: CoverageCheck -> CoverageCheck -> Ordering
$cp1Ord :: Eq CoverageCheck
Ord, Int -> CoverageCheck -> ShowS
[CoverageCheck] -> ShowS
CoverageCheck -> String
(Int -> CoverageCheck -> ShowS)
-> (CoverageCheck -> String)
-> ([CoverageCheck] -> ShowS)
-> Show CoverageCheck
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CoverageCheck] -> ShowS
$cshowList :: [CoverageCheck] -> ShowS
show :: CoverageCheck -> String
$cshow :: CoverageCheck -> String
showsPrec :: Int -> CoverageCheck -> ShowS
$cshowsPrec :: Int -> CoverageCheck -> ShowS
Show, CoverageCheck
CoverageCheck -> CoverageCheck -> Bounded CoverageCheck
forall a. a -> a -> Bounded a
maxBound :: CoverageCheck
$cmaxBound :: CoverageCheck
minBound :: CoverageCheck
$cminBound :: CoverageCheck
Bounded, Int -> CoverageCheck
CoverageCheck -> Int
CoverageCheck -> [CoverageCheck]
CoverageCheck -> CoverageCheck
CoverageCheck -> CoverageCheck -> [CoverageCheck]
CoverageCheck -> CoverageCheck -> CoverageCheck -> [CoverageCheck]
(CoverageCheck -> CoverageCheck)
-> (CoverageCheck -> CoverageCheck)
-> (Int -> CoverageCheck)
-> (CoverageCheck -> Int)
-> (CoverageCheck -> [CoverageCheck])
-> (CoverageCheck -> CoverageCheck -> [CoverageCheck])
-> (CoverageCheck -> CoverageCheck -> [CoverageCheck])
-> (CoverageCheck
    -> CoverageCheck -> CoverageCheck -> [CoverageCheck])
-> Enum CoverageCheck
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: CoverageCheck -> CoverageCheck -> CoverageCheck -> [CoverageCheck]
$cenumFromThenTo :: CoverageCheck -> CoverageCheck -> CoverageCheck -> [CoverageCheck]
enumFromTo :: CoverageCheck -> CoverageCheck -> [CoverageCheck]
$cenumFromTo :: CoverageCheck -> CoverageCheck -> [CoverageCheck]
enumFromThen :: CoverageCheck -> CoverageCheck -> [CoverageCheck]
$cenumFromThen :: CoverageCheck -> CoverageCheck -> [CoverageCheck]
enumFrom :: CoverageCheck -> [CoverageCheck]
$cenumFrom :: CoverageCheck -> [CoverageCheck]
fromEnum :: CoverageCheck -> Int
$cfromEnum :: CoverageCheck -> Int
toEnum :: Int -> CoverageCheck
$ctoEnum :: Int -> CoverageCheck
pred :: CoverageCheck -> CoverageCheck
$cpred :: CoverageCheck -> CoverageCheck
succ :: CoverageCheck -> CoverageCheck
$csucc :: CoverageCheck -> CoverageCheck
Enum, Typeable CoverageCheck
DataType
Constr
Typeable CoverageCheck
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CoverageCheck -> c CoverageCheck)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CoverageCheck)
-> (CoverageCheck -> Constr)
-> (CoverageCheck -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CoverageCheck))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c CoverageCheck))
-> ((forall b. Data b => b -> b) -> CoverageCheck -> CoverageCheck)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CoverageCheck -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CoverageCheck -> r)
-> (forall u. (forall d. Data d => d -> u) -> CoverageCheck -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CoverageCheck -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck)
-> Data CoverageCheck
CoverageCheck -> DataType
CoverageCheck -> Constr
(forall b. Data b => b -> b) -> CoverageCheck -> CoverageCheck
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CoverageCheck -> c CoverageCheck
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CoverageCheck
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) -> CoverageCheck -> u
forall u. (forall d. Data d => d -> u) -> CoverageCheck -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CoverageCheck -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CoverageCheck -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CoverageCheck
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CoverageCheck -> c CoverageCheck
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CoverageCheck)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CoverageCheck)
$cNoCoverageCheck :: Constr
$cYesCoverageCheck :: Constr
$tCoverageCheck :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck
gmapMp :: (forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck
gmapM :: (forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CoverageCheck -> m CoverageCheck
gmapQi :: Int -> (forall d. Data d => d -> u) -> CoverageCheck -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CoverageCheck -> u
gmapQ :: (forall d. Data d => d -> u) -> CoverageCheck -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CoverageCheck -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CoverageCheck -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CoverageCheck -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CoverageCheck -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CoverageCheck -> r
gmapT :: (forall b. Data b => b -> b) -> CoverageCheck -> CoverageCheck
$cgmapT :: (forall b. Data b => b -> b) -> CoverageCheck -> CoverageCheck
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CoverageCheck)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CoverageCheck)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CoverageCheck)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CoverageCheck)
dataTypeOf :: CoverageCheck -> DataType
$cdataTypeOf :: CoverageCheck -> DataType
toConstr :: CoverageCheck -> Constr
$ctoConstr :: CoverageCheck -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CoverageCheck
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CoverageCheck
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CoverageCheck -> c CoverageCheck
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CoverageCheck -> c CoverageCheck
$cp1Data :: Typeable CoverageCheck
Data, (forall x. CoverageCheck -> Rep CoverageCheck x)
-> (forall x. Rep CoverageCheck x -> CoverageCheck)
-> Generic CoverageCheck
forall x. Rep CoverageCheck x -> CoverageCheck
forall x. CoverageCheck -> Rep CoverageCheck x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CoverageCheck x -> CoverageCheck
$cfrom :: forall x. CoverageCheck -> Rep CoverageCheck x
Generic)

instance KillRange CoverageCheck where
  killRange :: CoverageCheck -> CoverageCheck
killRange = CoverageCheck -> CoverageCheck
forall a. a -> a
id

-- Semigroup and Monoid via conjunction
instance Semigroup CoverageCheck where
  CoverageCheck
NoCoverageCheck <> :: CoverageCheck -> CoverageCheck -> CoverageCheck
<> CoverageCheck
_ = CoverageCheck
NoCoverageCheck
  CoverageCheck
_ <> CoverageCheck
NoCoverageCheck = CoverageCheck
NoCoverageCheck
  CoverageCheck
_ <> CoverageCheck
_ = CoverageCheck
YesCoverageCheck

instance Monoid CoverageCheck where
  mempty :: CoverageCheck
mempty  = CoverageCheck
YesCoverageCheck
  mappend :: CoverageCheck -> CoverageCheck -> CoverageCheck
mappend = CoverageCheck -> CoverageCheck -> CoverageCheck
forall a. Semigroup a => a -> a -> a
(<>)

instance NFData CoverageCheck

-----------------------------------------------------------------------------
-- * Rewrite Directives on the LHS
-----------------------------------------------------------------------------

-- | @RewriteEqn' qn p e@ represents the @rewrite@ and irrefutable @with@
--   clauses of the LHS.
--   @qn@ stands for the QName of the auxiliary function generated to implement the feature
--   @nm@ is the type of names for pattern variables
--   @p@  is the type of patterns
--   @e@  is the type of expressions

data RewriteEqn' qn nm p e
  = Rewrite (List1 (qn, e))             -- ^ @rewrite e@
  | Invert qn (List1 (Named nm (p, e))) -- ^ @with p <- e in eq@
  deriving (Typeable (RewriteEqn' qn nm p e)
DataType
Constr
Typeable (RewriteEqn' qn nm p e)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> RewriteEqn' qn nm p e
    -> c (RewriteEqn' qn nm p e))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (RewriteEqn' qn nm p e))
-> (RewriteEqn' qn nm p e -> Constr)
-> (RewriteEqn' qn nm p e -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (RewriteEqn' qn nm p e)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (RewriteEqn' qn nm p e)))
-> ((forall b. Data b => b -> b)
    -> RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> RewriteEqn' qn nm p e
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> RewriteEqn' qn nm p e
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> RewriteEqn' qn nm p e -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> RewriteEqn' qn nm p e -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e))
-> Data (RewriteEqn' qn nm p e)
RewriteEqn' qn nm p e -> DataType
RewriteEqn' qn nm p e -> Constr
(forall b. Data b => b -> b)
-> RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RewriteEqn' qn nm p e
-> c (RewriteEqn' qn nm p e)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RewriteEqn' qn nm p e)
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) -> RewriteEqn' qn nm p e -> u
forall u.
(forall d. Data d => d -> u) -> RewriteEqn' qn nm p e -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RewriteEqn' qn nm p e -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RewriteEqn' qn nm p e -> r
forall qn nm p e.
(Data qn, Data nm, Data p, Data e) =>
Typeable (RewriteEqn' qn nm p e)
forall qn nm p e.
(Data qn, Data nm, Data p, Data e) =>
RewriteEqn' qn nm p e -> DataType
forall qn nm p e.
(Data qn, Data nm, Data p, Data e) =>
RewriteEqn' qn nm p e -> Constr
forall qn nm p e.
(Data qn, Data nm, Data p, Data e) =>
(forall b. Data b => b -> b)
-> RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e
forall qn nm p e u.
(Data qn, Data nm, Data p, Data e) =>
Int -> (forall d. Data d => d -> u) -> RewriteEqn' qn nm p e -> u
forall qn nm p e u.
(Data qn, Data nm, Data p, Data e) =>
(forall d. Data d => d -> u) -> RewriteEqn' qn nm p e -> [u]
forall qn nm p e r r'.
(Data qn, Data nm, Data p, Data e) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RewriteEqn' qn nm p e -> r
forall qn nm p e r r'.
(Data qn, Data nm, Data p, Data e) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RewriteEqn' qn nm p e -> r
forall qn nm p e (m :: * -> *).
(Data qn, Data nm, Data p, Data e, Monad m) =>
(forall d. Data d => d -> m d)
-> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e)
forall qn nm p e (m :: * -> *).
(Data qn, Data nm, Data p, Data e, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e)
forall qn nm p e (c :: * -> *).
(Data qn, Data nm, Data p, Data e) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RewriteEqn' qn nm p e)
forall qn nm p e (c :: * -> *).
(Data qn, Data nm, Data p, Data e) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RewriteEqn' qn nm p e
-> c (RewriteEqn' qn nm p e)
forall qn nm p e (t :: * -> *) (c :: * -> *).
(Data qn, Data nm, Data p, Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (RewriteEqn' qn nm p e))
forall qn nm p e (t :: * -> * -> *) (c :: * -> *).
(Data qn, Data nm, Data p, Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RewriteEqn' qn nm p e))
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RewriteEqn' qn nm p e)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RewriteEqn' qn nm p e
-> c (RewriteEqn' qn nm p e)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (RewriteEqn' qn nm p e))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RewriteEqn' qn nm p e))
$cInvert :: Constr
$cRewrite :: Constr
$tRewriteEqn' :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e)
$cgmapMo :: forall qn nm p e (m :: * -> *).
(Data qn, Data nm, Data p, Data e, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e)
gmapMp :: (forall d. Data d => d -> m d)
-> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e)
$cgmapMp :: forall qn nm p e (m :: * -> *).
(Data qn, Data nm, Data p, Data e, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e)
gmapM :: (forall d. Data d => d -> m d)
-> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e)
$cgmapM :: forall qn nm p e (m :: * -> *).
(Data qn, Data nm, Data p, Data e, Monad m) =>
(forall d. Data d => d -> m d)
-> RewriteEqn' qn nm p e -> m (RewriteEqn' qn nm p e)
gmapQi :: Int -> (forall d. Data d => d -> u) -> RewriteEqn' qn nm p e -> u
$cgmapQi :: forall qn nm p e u.
(Data qn, Data nm, Data p, Data e) =>
Int -> (forall d. Data d => d -> u) -> RewriteEqn' qn nm p e -> u
gmapQ :: (forall d. Data d => d -> u) -> RewriteEqn' qn nm p e -> [u]
$cgmapQ :: forall qn nm p e u.
(Data qn, Data nm, Data p, Data e) =>
(forall d. Data d => d -> u) -> RewriteEqn' qn nm p e -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RewriteEqn' qn nm p e -> r
$cgmapQr :: forall qn nm p e r r'.
(Data qn, Data nm, Data p, Data e) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RewriteEqn' qn nm p e -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RewriteEqn' qn nm p e -> r
$cgmapQl :: forall qn nm p e r r'.
(Data qn, Data nm, Data p, Data e) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RewriteEqn' qn nm p e -> r
gmapT :: (forall b. Data b => b -> b)
-> RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e
$cgmapT :: forall qn nm p e.
(Data qn, Data nm, Data p, Data e) =>
(forall b. Data b => b -> b)
-> RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RewriteEqn' qn nm p e))
$cdataCast2 :: forall qn nm p e (t :: * -> * -> *) (c :: * -> *).
(Data qn, Data nm, Data p, Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RewriteEqn' qn nm p e))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (RewriteEqn' qn nm p e))
$cdataCast1 :: forall qn nm p e (t :: * -> *) (c :: * -> *).
(Data qn, Data nm, Data p, Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (RewriteEqn' qn nm p e))
dataTypeOf :: RewriteEqn' qn nm p e -> DataType
$cdataTypeOf :: forall qn nm p e.
(Data qn, Data nm, Data p, Data e) =>
RewriteEqn' qn nm p e -> DataType
toConstr :: RewriteEqn' qn nm p e -> Constr
$ctoConstr :: forall qn nm p e.
(Data qn, Data nm, Data p, Data e) =>
RewriteEqn' qn nm p e -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RewriteEqn' qn nm p e)
$cgunfold :: forall qn nm p e (c :: * -> *).
(Data qn, Data nm, Data p, Data e) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RewriteEqn' qn nm p e)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RewriteEqn' qn nm p e
-> c (RewriteEqn' qn nm p e)
$cgfoldl :: forall qn nm p e (c :: * -> *).
(Data qn, Data nm, Data p, Data e) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RewriteEqn' qn nm p e
-> c (RewriteEqn' qn nm p e)
$cp1Data :: forall qn nm p e.
(Data qn, Data nm, Data p, Data e) =>
Typeable (RewriteEqn' qn nm p e)
Data, RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e -> Bool
(RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e -> Bool)
-> (RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e -> Bool)
-> Eq (RewriteEqn' qn nm p e)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall qn nm p e.
(Eq qn, Eq e, Eq nm, Eq p) =>
RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e -> Bool
/= :: RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e -> Bool
$c/= :: forall qn nm p e.
(Eq qn, Eq e, Eq nm, Eq p) =>
RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e -> Bool
== :: RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e -> Bool
$c== :: forall qn nm p e.
(Eq qn, Eq e, Eq nm, Eq p) =>
RewriteEqn' qn nm p e -> RewriteEqn' qn nm p e -> Bool
Eq, Int -> RewriteEqn' qn nm p e -> ShowS
[RewriteEqn' qn nm p e] -> ShowS
RewriteEqn' qn nm p e -> String
(Int -> RewriteEqn' qn nm p e -> ShowS)
-> (RewriteEqn' qn nm p e -> String)
-> ([RewriteEqn' qn nm p e] -> ShowS)
-> Show (RewriteEqn' qn nm p e)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall qn nm p e.
(Show qn, Show e, Show nm, Show p) =>
Int -> RewriteEqn' qn nm p e -> ShowS
forall qn nm p e.
(Show qn, Show e, Show nm, Show p) =>
[RewriteEqn' qn nm p e] -> ShowS
forall qn nm p e.
(Show qn, Show e, Show nm, Show p) =>
RewriteEqn' qn nm p e -> String
showList :: [RewriteEqn' qn nm p e] -> ShowS
$cshowList :: forall qn nm p e.
(Show qn, Show e, Show nm, Show p) =>
[RewriteEqn' qn nm p e] -> ShowS
show :: RewriteEqn' qn nm p e -> String
$cshow :: forall qn nm p e.
(Show qn, Show e, Show nm, Show p) =>
RewriteEqn' qn nm p e -> String
showsPrec :: Int -> RewriteEqn' qn nm p e -> ShowS
$cshowsPrec :: forall qn nm p e.
(Show qn, Show e, Show nm, Show p) =>
Int -> RewriteEqn' qn nm p e -> ShowS
Show, a -> RewriteEqn' qn nm p b -> RewriteEqn' qn nm p a
(a -> b) -> RewriteEqn' qn nm p a -> RewriteEqn' qn nm p b
(forall a b.
 (a -> b) -> RewriteEqn' qn nm p a -> RewriteEqn' qn nm p b)
-> (forall a b.
    a -> RewriteEqn' qn nm p b -> RewriteEqn' qn nm p a)
-> Functor (RewriteEqn' qn nm p)
forall a b. a -> RewriteEqn' qn nm p b -> RewriteEqn' qn nm p a
forall a b.
(a -> b) -> RewriteEqn' qn nm p a -> RewriteEqn' qn nm p b
forall qn nm p a b.
a -> RewriteEqn' qn nm p b -> RewriteEqn' qn nm p a
forall qn nm p a b.
(a -> b) -> RewriteEqn' qn nm p a -> RewriteEqn' qn nm p b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> RewriteEqn' qn nm p b -> RewriteEqn' qn nm p a
$c<$ :: forall qn nm p a b.
a -> RewriteEqn' qn nm p b -> RewriteEqn' qn nm p a
fmap :: (a -> b) -> RewriteEqn' qn nm p a -> RewriteEqn' qn nm p b
$cfmap :: forall qn nm p a b.
(a -> b) -> RewriteEqn' qn nm p a -> RewriteEqn' qn nm p b
Functor, RewriteEqn' qn nm p a -> Bool
(a -> m) -> RewriteEqn' qn nm p a -> m
(a -> b -> b) -> b -> RewriteEqn' qn nm p a -> b
(forall m. Monoid m => RewriteEqn' qn nm p m -> m)
-> (forall m a. Monoid m => (a -> m) -> RewriteEqn' qn nm p a -> m)
-> (forall m a. Monoid m => (a -> m) -> RewriteEqn' qn nm p a -> m)
-> (forall a b. (a -> b -> b) -> b -> RewriteEqn' qn nm p a -> b)
-> (forall a b. (a -> b -> b) -> b -> RewriteEqn' qn nm p a -> b)
-> (forall b a. (b -> a -> b) -> b -> RewriteEqn' qn nm p a -> b)
-> (forall b a. (b -> a -> b) -> b -> RewriteEqn' qn nm p a -> b)
-> (forall a. (a -> a -> a) -> RewriteEqn' qn nm p a -> a)
-> (forall a. (a -> a -> a) -> RewriteEqn' qn nm p a -> a)
-> (forall a. RewriteEqn' qn nm p a -> [a])
-> (forall a. RewriteEqn' qn nm p a -> Bool)
-> (forall a. RewriteEqn' qn nm p a -> Int)
-> (forall a. Eq a => a -> RewriteEqn' qn nm p a -> Bool)
-> (forall a. Ord a => RewriteEqn' qn nm p a -> a)
-> (forall a. Ord a => RewriteEqn' qn nm p a -> a)
-> (forall a. Num a => RewriteEqn' qn nm p a -> a)
-> (forall a. Num a => RewriteEqn' qn nm p a -> a)
-> Foldable (RewriteEqn' qn nm p)
forall a. Eq a => a -> RewriteEqn' qn nm p a -> Bool
forall a. Num a => RewriteEqn' qn nm p a -> a
forall a. Ord a => RewriteEqn' qn nm p a -> a
forall m. Monoid m => RewriteEqn' qn nm p m -> m
forall a. RewriteEqn' qn nm p a -> Bool
forall a. RewriteEqn' qn nm p a -> Int
forall a. RewriteEqn' qn nm p a -> [a]
forall a. (a -> a -> a) -> RewriteEqn' qn nm p a -> a
forall m a. Monoid m => (a -> m) -> RewriteEqn' qn nm p a -> m
forall b a. (b -> a -> b) -> b -> RewriteEqn' qn nm p a -> b
forall a b. (a -> b -> b) -> b -> RewriteEqn' qn nm p a -> b
forall qn nm p a. Eq a => a -> RewriteEqn' qn nm p a -> Bool
forall qn nm p a. Num a => RewriteEqn' qn nm p a -> a
forall qn nm p a. Ord a => RewriteEqn' qn nm p a -> a
forall qn nm p m. Monoid m => RewriteEqn' qn nm p m -> m
forall qn nm p a. RewriteEqn' qn nm p a -> Bool
forall qn nm p a. RewriteEqn' qn nm p a -> Int
forall qn nm p a. RewriteEqn' qn nm p a -> [a]
forall qn nm p a. (a -> a -> a) -> RewriteEqn' qn nm p a -> a
forall qn nm p m a.
Monoid m =>
(a -> m) -> RewriteEqn' qn nm p a -> m
forall qn nm p b a.
(b -> a -> b) -> b -> RewriteEqn' qn nm p a -> b
forall qn nm p a b.
(a -> b -> b) -> b -> RewriteEqn' qn nm p a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: RewriteEqn' qn nm p a -> a
$cproduct :: forall qn nm p a. Num a => RewriteEqn' qn nm p a -> a
sum :: RewriteEqn' qn nm p a -> a
$csum :: forall qn nm p a. Num a => RewriteEqn' qn nm p a -> a
minimum :: RewriteEqn' qn nm p a -> a
$cminimum :: forall qn nm p a. Ord a => RewriteEqn' qn nm p a -> a
maximum :: RewriteEqn' qn nm p a -> a
$cmaximum :: forall qn nm p a. Ord a => RewriteEqn' qn nm p a -> a
elem :: a -> RewriteEqn' qn nm p a -> Bool
$celem :: forall qn nm p a. Eq a => a -> RewriteEqn' qn nm p a -> Bool
length :: RewriteEqn' qn nm p a -> Int
$clength :: forall qn nm p a. RewriteEqn' qn nm p a -> Int
null :: RewriteEqn' qn nm p a -> Bool
$cnull :: forall qn nm p a. RewriteEqn' qn nm p a -> Bool
toList :: RewriteEqn' qn nm p a -> [a]
$ctoList :: forall qn nm p a. RewriteEqn' qn nm p a -> [a]
foldl1 :: (a -> a -> a) -> RewriteEqn' qn nm p a -> a
$cfoldl1 :: forall qn nm p a. (a -> a -> a) -> RewriteEqn' qn nm p a -> a
foldr1 :: (a -> a -> a) -> RewriteEqn' qn nm p a -> a
$cfoldr1 :: forall qn nm p a. (a -> a -> a) -> RewriteEqn' qn nm p a -> a
foldl' :: (b -> a -> b) -> b -> RewriteEqn' qn nm p a -> b
$cfoldl' :: forall qn nm p b a.
(b -> a -> b) -> b -> RewriteEqn' qn nm p a -> b
foldl :: (b -> a -> b) -> b -> RewriteEqn' qn nm p a -> b
$cfoldl :: forall qn nm p b a.
(b -> a -> b) -> b -> RewriteEqn' qn nm p a -> b
foldr' :: (a -> b -> b) -> b -> RewriteEqn' qn nm p a -> b
$cfoldr' :: forall qn nm p a b.
(a -> b -> b) -> b -> RewriteEqn' qn nm p a -> b
foldr :: (a -> b -> b) -> b -> RewriteEqn' qn nm p a -> b
$cfoldr :: forall qn nm p a b.
(a -> b -> b) -> b -> RewriteEqn' qn nm p a -> b
foldMap' :: (a -> m) -> RewriteEqn' qn nm p a -> m
$cfoldMap' :: forall qn nm p m a.
Monoid m =>
(a -> m) -> RewriteEqn' qn nm p a -> m
foldMap :: (a -> m) -> RewriteEqn' qn nm p a -> m
$cfoldMap :: forall qn nm p m a.
Monoid m =>
(a -> m) -> RewriteEqn' qn nm p a -> m
fold :: RewriteEqn' qn nm p m -> m
$cfold :: forall qn nm p m. Monoid m => RewriteEqn' qn nm p m -> m
Foldable, Functor (RewriteEqn' qn nm p)
Foldable (RewriteEqn' qn nm p)
Functor (RewriteEqn' qn nm p)
-> Foldable (RewriteEqn' qn nm p)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> RewriteEqn' qn nm p a -> f (RewriteEqn' qn nm p b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    RewriteEqn' qn nm p (f a) -> f (RewriteEqn' qn nm p a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> RewriteEqn' qn nm p a -> m (RewriteEqn' qn nm p b))
-> (forall (m :: * -> *) a.
    Monad m =>
    RewriteEqn' qn nm p (m a) -> m (RewriteEqn' qn nm p a))
-> Traversable (RewriteEqn' qn nm p)
(a -> f b) -> RewriteEqn' qn nm p a -> f (RewriteEqn' qn nm p b)
forall qn nm p. Functor (RewriteEqn' qn nm p)
forall qn nm p. Foldable (RewriteEqn' qn nm p)
forall qn nm p (m :: * -> *) a.
Monad m =>
RewriteEqn' qn nm p (m a) -> m (RewriteEqn' qn nm p a)
forall qn nm p (f :: * -> *) a.
Applicative f =>
RewriteEqn' qn nm p (f a) -> f (RewriteEqn' qn nm p a)
forall qn nm p (m :: * -> *) a b.
Monad m =>
(a -> m b) -> RewriteEqn' qn nm p a -> m (RewriteEqn' qn nm p b)
forall qn nm p (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> RewriteEqn' qn nm p a -> f (RewriteEqn' qn nm p b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
RewriteEqn' qn nm p (m a) -> m (RewriteEqn' qn nm p a)
forall (f :: * -> *) a.
Applicative f =>
RewriteEqn' qn nm p (f a) -> f (RewriteEqn' qn nm p a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> RewriteEqn' qn nm p a -> m (RewriteEqn' qn nm p b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> RewriteEqn' qn nm p a -> f (RewriteEqn' qn nm p b)
sequence :: RewriteEqn' qn nm p (m a) -> m (RewriteEqn' qn nm p a)
$csequence :: forall qn nm p (m :: * -> *) a.
Monad m =>
RewriteEqn' qn nm p (m a) -> m (RewriteEqn' qn nm p a)
mapM :: (a -> m b) -> RewriteEqn' qn nm p a -> m (RewriteEqn' qn nm p b)
$cmapM :: forall qn nm p (m :: * -> *) a b.
Monad m =>
(a -> m b) -> RewriteEqn' qn nm p a -> m (RewriteEqn' qn nm p b)
sequenceA :: RewriteEqn' qn nm p (f a) -> f (RewriteEqn' qn nm p a)
$csequenceA :: forall qn nm p (f :: * -> *) a.
Applicative f =>
RewriteEqn' qn nm p (f a) -> f (RewriteEqn' qn nm p a)
traverse :: (a -> f b) -> RewriteEqn' qn nm p a -> f (RewriteEqn' qn nm p b)
$ctraverse :: forall qn nm p (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> RewriteEqn' qn nm p a -> f (RewriteEqn' qn nm p b)
$cp2Traversable :: forall qn nm p. Foldable (RewriteEqn' qn nm p)
$cp1Traversable :: forall qn nm p. Functor (RewriteEqn' qn nm p)
Traversable)

instance (NFData qn, NFData nm, NFData p, NFData e) => NFData (RewriteEqn' qn nm p e) where
  rnf :: RewriteEqn' qn nm p e -> ()
rnf = \case
    Rewrite List1 (qn, e)
es    -> List1 (qn, e) -> ()
forall a. NFData a => a -> ()
rnf List1 (qn, e)
es
    Invert qn
qn List1 (Named nm (p, e))
pes -> (qn, List1 (Named nm (p, e))) -> ()
forall a. NFData a => a -> ()
rnf (qn
qn, List1 (Named nm (p, e))
pes)

instance (Pretty nm, Pretty p, Pretty e) => Pretty (RewriteEqn' qn nm p e) where
  pretty :: RewriteEqn' qn nm p e -> Doc
pretty = \case
    Rewrite List1 (qn, e)
es   -> Doc -> [Doc] -> Doc
prefixedThings (String -> Doc
text String
"rewrite") ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ NonEmpty Doc -> [Doc]
forall a. NonEmpty a -> [a]
List1.toList (e -> Doc
forall a. Pretty a => a -> Doc
pretty (e -> Doc) -> ((qn, e) -> e) -> (qn, e) -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (qn, e) -> e
forall a b. (a, b) -> b
snd ((qn, e) -> Doc) -> List1 (qn, e) -> NonEmpty Doc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> List1 (qn, e)
es)
    Invert qn
_ List1 (Named nm (p, e))
pes -> Doc -> [Doc] -> Doc
prefixedThings (String -> Doc
text String
"invert") ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ NonEmpty Doc -> [Doc]
forall a. NonEmpty a -> [a]
List1.toList (Named nm (p, e) -> Doc
forall a a a.
(Pretty a, Pretty a, Pretty a) =>
Named a (a, a) -> Doc
namedWith (Named nm (p, e) -> Doc) -> List1 (Named nm (p, e)) -> NonEmpty Doc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> List1 (Named nm (p, e))
pes) where

      namedWith :: Named a (a, a) -> Doc
namedWith (Named Maybe a
nm (a
p, a
e)) =
        let patexp :: Doc
patexp = a -> Doc
forall a. Pretty a => a -> Doc
pretty a
p Doc -> Doc -> Doc
<+> Doc
"<-" Doc -> Doc -> Doc
<+> a -> Doc
forall a. Pretty a => a -> Doc
pretty a
e in
        case Maybe a
nm of
          Maybe a
Nothing -> Doc
patexp
          Just a
nm -> a -> Doc
forall a. Pretty a => a -> Doc
pretty a
nm Doc -> Doc -> Doc
<+> Doc
":" Doc -> Doc -> Doc
<+> Doc
patexp

instance (HasRange qn, HasRange nm, HasRange p, HasRange e) => HasRange (RewriteEqn' qn nm p e) where
  getRange :: RewriteEqn' qn nm p e -> Range
getRange = \case
    Rewrite List1 (qn, e)
es    -> List1 (qn, e) -> Range
forall a. HasRange a => a -> Range
getRange List1 (qn, e)
es
    Invert qn
qn List1 (Named nm (p, e))
pes -> (qn, List1 (Named nm (p, e))) -> Range
forall a. HasRange a => a -> Range
getRange (qn
qn, List1 (Named nm (p, e))
pes)

instance (KillRange qn, KillRange nm, KillRange e, KillRange p) => KillRange (RewriteEqn' qn nm p e) where
  killRange :: KillRangeT (RewriteEqn' qn nm p e)
killRange = \case
    Rewrite List1 (qn, e)
es    -> (List1 (qn, e) -> RewriteEqn' qn nm p e)
-> List1 (qn, e) -> RewriteEqn' qn nm p e
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 List1 (qn, e) -> RewriteEqn' qn nm p e
forall qn nm p e. List1 (qn, e) -> RewriteEqn' qn nm p e
Rewrite List1 (qn, e)
es
    Invert qn
qn List1 (Named nm (p, e))
pes -> (qn -> List1 (Named nm (p, e)) -> RewriteEqn' qn nm p e)
-> qn -> List1 (Named nm (p, e)) -> RewriteEqn' qn nm p e
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 qn -> List1 (Named nm (p, e)) -> RewriteEqn' qn nm p e
forall qn nm p e.
qn -> List1 (Named nm (p, e)) -> RewriteEqn' qn nm p e
Invert qn
qn List1 (Named nm (p, e))
pes

-----------------------------------------------------------------------------
-- * Information on expanded ellipsis (@...@)
-----------------------------------------------------------------------------

-- ^ When the ellipsis in a clause is expanded, we remember that we
--   did so. We also store the number of with-arguments that are
--   included in the expanded ellipsis.
data ExpandedEllipsis
  = ExpandedEllipsis
  { ExpandedEllipsis -> Range
ellipsisRange :: Range
  , ExpandedEllipsis -> Int
ellipsisWithArgs :: Int
  }
  | NoEllipsis
  deriving (Typeable ExpandedEllipsis
DataType
Constr
Typeable ExpandedEllipsis
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ExpandedEllipsis -> c ExpandedEllipsis)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ExpandedEllipsis)
-> (ExpandedEllipsis -> Constr)
-> (ExpandedEllipsis -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ExpandedEllipsis))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ExpandedEllipsis))
-> ((forall b. Data b => b -> b)
    -> ExpandedEllipsis -> ExpandedEllipsis)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ExpandedEllipsis -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ExpandedEllipsis -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> ExpandedEllipsis -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ExpandedEllipsis -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> ExpandedEllipsis -> m ExpandedEllipsis)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ExpandedEllipsis -> m ExpandedEllipsis)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ExpandedEllipsis -> m ExpandedEllipsis)
-> Data ExpandedEllipsis
ExpandedEllipsis -> DataType
ExpandedEllipsis -> Constr
(forall b. Data b => b -> b)
-> ExpandedEllipsis -> ExpandedEllipsis
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ExpandedEllipsis -> c ExpandedEllipsis
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ExpandedEllipsis
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) -> ExpandedEllipsis -> u
forall u. (forall d. Data d => d -> u) -> ExpandedEllipsis -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ExpandedEllipsis -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ExpandedEllipsis -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ExpandedEllipsis -> m ExpandedEllipsis
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ExpandedEllipsis -> m ExpandedEllipsis
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ExpandedEllipsis
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ExpandedEllipsis -> c ExpandedEllipsis
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ExpandedEllipsis)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ExpandedEllipsis)
$cNoEllipsis :: Constr
$cExpandedEllipsis :: Constr
$tExpandedEllipsis :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> ExpandedEllipsis -> m ExpandedEllipsis
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ExpandedEllipsis -> m ExpandedEllipsis
gmapMp :: (forall d. Data d => d -> m d)
-> ExpandedEllipsis -> m ExpandedEllipsis
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ExpandedEllipsis -> m ExpandedEllipsis
gmapM :: (forall d. Data d => d -> m d)
-> ExpandedEllipsis -> m ExpandedEllipsis
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ExpandedEllipsis -> m ExpandedEllipsis
gmapQi :: Int -> (forall d. Data d => d -> u) -> ExpandedEllipsis -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ExpandedEllipsis -> u
gmapQ :: (forall d. Data d => d -> u) -> ExpandedEllipsis -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ExpandedEllipsis -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ExpandedEllipsis -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ExpandedEllipsis -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ExpandedEllipsis -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ExpandedEllipsis -> r
gmapT :: (forall b. Data b => b -> b)
-> ExpandedEllipsis -> ExpandedEllipsis
$cgmapT :: (forall b. Data b => b -> b)
-> ExpandedEllipsis -> ExpandedEllipsis
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ExpandedEllipsis)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ExpandedEllipsis)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ExpandedEllipsis)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ExpandedEllipsis)
dataTypeOf :: ExpandedEllipsis -> DataType
$cdataTypeOf :: ExpandedEllipsis -> DataType
toConstr :: ExpandedEllipsis -> Constr
$ctoConstr :: ExpandedEllipsis -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ExpandedEllipsis
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ExpandedEllipsis
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ExpandedEllipsis -> c ExpandedEllipsis
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ExpandedEllipsis -> c ExpandedEllipsis
$cp1Data :: Typeable ExpandedEllipsis
Data, Int -> ExpandedEllipsis -> ShowS
[ExpandedEllipsis] -> ShowS
ExpandedEllipsis -> String
(Int -> ExpandedEllipsis -> ShowS)
-> (ExpandedEllipsis -> String)
-> ([ExpandedEllipsis] -> ShowS)
-> Show ExpandedEllipsis
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExpandedEllipsis] -> ShowS
$cshowList :: [ExpandedEllipsis] -> ShowS
show :: ExpandedEllipsis -> String
$cshow :: ExpandedEllipsis -> String
showsPrec :: Int -> ExpandedEllipsis -> ShowS
$cshowsPrec :: Int -> ExpandedEllipsis -> ShowS
Show, ExpandedEllipsis -> ExpandedEllipsis -> Bool
(ExpandedEllipsis -> ExpandedEllipsis -> Bool)
-> (ExpandedEllipsis -> ExpandedEllipsis -> Bool)
-> Eq ExpandedEllipsis
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExpandedEllipsis -> ExpandedEllipsis -> Bool
$c/= :: ExpandedEllipsis -> ExpandedEllipsis -> Bool
== :: ExpandedEllipsis -> ExpandedEllipsis -> Bool
$c== :: ExpandedEllipsis -> ExpandedEllipsis -> Bool
Eq)

instance Null ExpandedEllipsis where
  null :: ExpandedEllipsis -> Bool
null  = (ExpandedEllipsis -> ExpandedEllipsis -> Bool
forall a. Eq a => a -> a -> Bool
== ExpandedEllipsis
NoEllipsis)
  empty :: ExpandedEllipsis
empty = ExpandedEllipsis
NoEllipsis

instance Semigroup ExpandedEllipsis where
  ExpandedEllipsis
NoEllipsis <> :: ExpandedEllipsis -> ExpandedEllipsis -> ExpandedEllipsis
<> ExpandedEllipsis
e          = ExpandedEllipsis
e
  ExpandedEllipsis
e          <> ExpandedEllipsis
NoEllipsis = ExpandedEllipsis
e
  (ExpandedEllipsis Range
r1 Int
k1) <> (ExpandedEllipsis Range
r2 Int
k2) = Range -> Int -> ExpandedEllipsis
ExpandedEllipsis (Range
r1 Range -> Range -> Range
forall a. Semigroup a => a -> a -> a
<> Range
r2) (Int
k1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
k2)

instance Monoid ExpandedEllipsis where
  mempty :: ExpandedEllipsis
mempty  = ExpandedEllipsis
NoEllipsis
  mappend :: ExpandedEllipsis -> ExpandedEllipsis -> ExpandedEllipsis
mappend = ExpandedEllipsis -> ExpandedEllipsis -> ExpandedEllipsis
forall a. Semigroup a => a -> a -> a
(<>)

instance KillRange ExpandedEllipsis where
  killRange :: ExpandedEllipsis -> ExpandedEllipsis
killRange (ExpandedEllipsis Range
_ Int
k) = Range -> Int -> ExpandedEllipsis
ExpandedEllipsis Range
forall a. Range' a
noRange Int
k
  killRange ExpandedEllipsis
NoEllipsis             = ExpandedEllipsis
NoEllipsis

instance NFData ExpandedEllipsis where
  rnf :: ExpandedEllipsis -> ()
rnf (ExpandedEllipsis Range
_ Int
a) = Int -> ()
forall a. NFData a => a -> ()
rnf Int
a
  rnf ExpandedEllipsis
NoEllipsis             = ()

-- | Notation as provided by the @syntax@ declaration.
type Notation = [GenPart]

noNotation :: Notation
noNotation :: Notation
noNotation = []

-- | Part of a Notation
data GenPart
  = BindHole Range (Ranged Int)
    -- ^ Argument is the position of the hole (with binding) where the binding should occur.
    --   First range is the rhs range and second is the binder.
  | NormalHole Range (NamedArg (Ranged Int))
    -- ^ Argument is where the expression should go.
  | WildHole (Ranged Int)
    -- ^ An underscore in binding position.
  | IdPart RString
  deriving (Typeable GenPart
DataType
Constr
Typeable GenPart
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> GenPart -> c GenPart)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c GenPart)
-> (GenPart -> Constr)
-> (GenPart -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c GenPart))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GenPart))
-> ((forall b. Data b => b -> b) -> GenPart -> GenPart)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> GenPart -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> GenPart -> r)
-> (forall u. (forall d. Data d => d -> u) -> GenPart -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> GenPart -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> GenPart -> m GenPart)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> GenPart -> m GenPart)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> GenPart -> m GenPart)
-> Data GenPart
GenPart -> DataType
GenPart -> Constr
(forall b. Data b => b -> b) -> GenPart -> GenPart
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> GenPart -> c GenPart
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GenPart
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) -> GenPart -> u
forall u. (forall d. Data d => d -> u) -> GenPart -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> GenPart -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> GenPart -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> GenPart -> m GenPart
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> GenPart -> m GenPart
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GenPart
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> GenPart -> c GenPart
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c GenPart)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GenPart)
$cIdPart :: Constr
$cWildHole :: Constr
$cNormalHole :: Constr
$cBindHole :: Constr
$tGenPart :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> GenPart -> m GenPart
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> GenPart -> m GenPart
gmapMp :: (forall d. Data d => d -> m d) -> GenPart -> m GenPart
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> GenPart -> m GenPart
gmapM :: (forall d. Data d => d -> m d) -> GenPart -> m GenPart
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> GenPart -> m GenPart
gmapQi :: Int -> (forall d. Data d => d -> u) -> GenPart -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> GenPart -> u
gmapQ :: (forall d. Data d => d -> u) -> GenPart -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> GenPart -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> GenPart -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> GenPart -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> GenPart -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> GenPart -> r
gmapT :: (forall b. Data b => b -> b) -> GenPart -> GenPart
$cgmapT :: (forall b. Data b => b -> b) -> GenPart -> GenPart
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GenPart)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GenPart)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c GenPart)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c GenPart)
dataTypeOf :: GenPart -> DataType
$cdataTypeOf :: GenPart -> DataType
toConstr :: GenPart -> Constr
$ctoConstr :: GenPart -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GenPart
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GenPart
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> GenPart -> c GenPart
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> GenPart -> c GenPart
$cp1Data :: Typeable GenPart
Data, Int -> GenPart -> ShowS
Notation -> ShowS
GenPart -> String
(Int -> GenPart -> ShowS)
-> (GenPart -> String) -> (Notation -> ShowS) -> Show GenPart
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: Notation -> ShowS
$cshowList :: Notation -> ShowS
show :: GenPart -> String
$cshow :: GenPart -> String
showsPrec :: Int -> GenPart -> ShowS
$cshowsPrec :: Int -> GenPart -> ShowS
Show)

instance Eq GenPart where
  BindHole Range
_ Ranged Int
i   == :: GenPart -> GenPart -> Bool
== BindHole Range
_ Ranged Int
j   = Ranged Int
i Ranged Int -> Ranged Int -> Bool
forall a. Eq a => a -> a -> Bool
== Ranged Int
j
  NormalHole Range
_ NamedArg (Ranged Int)
x == NormalHole Range
_ NamedArg (Ranged Int)
y = NamedArg (Ranged Int)
x NamedArg (Ranged Int) -> NamedArg (Ranged Int) -> Bool
forall a. Eq a => a -> a -> Bool
== NamedArg (Ranged Int)
y
  WildHole Ranged Int
i     == WildHole Ranged Int
j     = Ranged Int
i Ranged Int -> Ranged Int -> Bool
forall a. Eq a => a -> a -> Bool
== Ranged Int
j
  IdPart Ranged String
x       == IdPart Ranged String
y       = Ranged String
x Ranged String -> Ranged String -> Bool
forall a. Eq a => a -> a -> Bool
== Ranged String
y
  GenPart
_              == GenPart
_              = Bool
False

instance Ord GenPart where
  BindHole Range
_ Ranged Int
i   compare :: GenPart -> GenPart -> Ordering
`compare` BindHole Range
_ Ranged Int
j   = Ranged Int
i Ranged Int -> Ranged Int -> Ordering
forall a. Ord a => a -> a -> Ordering
`compare` Ranged Int
j
  NormalHole Range
_ NamedArg (Ranged Int)
x `compare` NormalHole Range
_ NamedArg (Ranged Int)
y = NamedArg (Ranged Int)
x NamedArg (Ranged Int) -> NamedArg (Ranged Int) -> Ordering
forall a. Ord a => a -> a -> Ordering
`compare` NamedArg (Ranged Int)
y
  WildHole Ranged Int
i     `compare` WildHole Ranged Int
j     = Ranged Int
i Ranged Int -> Ranged Int -> Ordering
forall a. Ord a => a -> a -> Ordering
`compare` Ranged Int
j
  IdPart Ranged String
x       `compare` IdPart Ranged String
y       = Ranged String
x Ranged String -> Ranged String -> Ordering
forall a. Ord a => a -> a -> Ordering
`compare` Ranged String
y
  BindHole{}     `compare` GenPart
_              = Ordering
LT
  GenPart
_              `compare` BindHole{}     = Ordering
GT
  NormalHole{}   `compare` GenPart
_              = Ordering
LT
  GenPart
_              `compare` NormalHole{}   = Ordering
GT
  WildHole{}     `compare` GenPart
_              = Ordering
LT
  GenPart
_              `compare` WildHole{}     = Ordering
GT

instance HasRange GenPart where
  getRange :: GenPart -> Range
getRange = \case
    IdPart Ranged String
x       -> Ranged String -> Range
forall a. HasRange a => a -> Range
getRange Ranged String
x
    BindHole Range
r Ranged Int
_   -> Range
r
    WildHole Ranged Int
i     -> Ranged Int -> Range
forall a. HasRange a => a -> Range
getRange Ranged Int
i
    NormalHole Range
r NamedArg (Ranged Int)
_ -> Range
r

instance SetRange GenPart where
  setRange :: Range -> GenPart -> GenPart
setRange Range
r = \case
    IdPart Ranged String
x       -> Ranged String -> GenPart
IdPart Ranged String
x
    BindHole Range
_ Ranged Int
i   -> Range -> Ranged Int -> GenPart
BindHole Range
r Ranged Int
i
    WildHole Ranged Int
i     -> Ranged Int -> GenPart
WildHole Ranged Int
i
    NormalHole Range
_ NamedArg (Ranged Int)
i -> Range -> NamedArg (Ranged Int) -> GenPart
NormalHole Range
r NamedArg (Ranged Int)
i

instance KillRange GenPart where
  killRange :: GenPart -> GenPart
killRange = \case
    IdPart Ranged String
x       -> Ranged String -> GenPart
IdPart (Ranged String -> GenPart) -> Ranged String -> GenPart
forall a b. (a -> b) -> a -> b
$ KillRangeT (Ranged String)
forall a. KillRange a => KillRangeT a
killRange Ranged String
x
    BindHole Range
_ Ranged Int
i   -> Range -> Ranged Int -> GenPart
BindHole Range
forall a. Range' a
noRange (Ranged Int -> GenPart) -> Ranged Int -> GenPart
forall a b. (a -> b) -> a -> b
$ KillRangeT (Ranged Int)
forall a. KillRange a => KillRangeT a
killRange Ranged Int
i
    WildHole Ranged Int
i     -> Ranged Int -> GenPart
WildHole (Ranged Int -> GenPart) -> Ranged Int -> GenPart
forall a b. (a -> b) -> a -> b
$ KillRangeT (Ranged Int)
forall a. KillRange a => KillRangeT a
killRange Ranged Int
i
    NormalHole Range
_ NamedArg (Ranged Int)
x -> Range -> NamedArg (Ranged Int) -> GenPart
NormalHole Range
forall a. Range' a
noRange (NamedArg (Ranged Int) -> GenPart)
-> NamedArg (Ranged Int) -> GenPart
forall a b. (a -> b) -> a -> b
$ KillRangeT (NamedArg (Ranged Int))
forall a. KillRange a => KillRangeT a
killRange NamedArg (Ranged Int)
x

instance NFData GenPart where
  rnf :: GenPart -> ()
rnf (BindHole Range
_ Ranged Int
a)   = Ranged Int -> ()
forall a. NFData a => a -> ()
rnf Ranged Int
a
  rnf (NormalHole Range
_ NamedArg (Ranged Int)
a) = NamedArg (Ranged Int) -> ()
forall a. NFData a => a -> ()
rnf NamedArg (Ranged Int)
a
  rnf (WildHole Ranged Int
a)     = Ranged Int -> ()
forall a. NFData a => a -> ()
rnf Ranged Int
a
  rnf (IdPart Ranged String
a)       = Ranged String -> ()
forall a. NFData a => a -> ()
rnf Ranged String
a