{-| The abstract syntax. This is what you get after desugaring and scope
    analysis of the concrete syntax. The type checker works on abstract syntax,
    producing internal syntax ("Agda.Syntax.Internal").
-}
module Agda.Syntax.Abstract
    ( module Agda.Syntax.Abstract
    , module Agda.Syntax.Abstract.Name
    ) where

import Prelude hiding (null)

import Control.DeepSeq

import Data.Bifunctor
import qualified Data.Foldable as Fold
import Data.Function (on)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe
import Data.Sequence (Seq, (<|), (><))
import qualified Data.Sequence as Seq
import qualified Data.Set as Set
import Data.Set (Set)
import Data.Void
import Data.Data (Data)

import GHC.Generics (Generic)

import Agda.Syntax.Concrete (FieldAssignment'(..), exprFieldA)--, HoleContent'(..))
import qualified Agda.Syntax.Concrete as C
import Agda.Syntax.Abstract.Name
import qualified Agda.Syntax.Internal as I
import Agda.Syntax.Common
import Agda.Syntax.Info
import Agda.Syntax.Literal
import Agda.Syntax.Position
import Agda.Syntax.Scope.Base

import Agda.TypeChecking.Positivity.Occurrence

import Agda.Utils.Lens
import Agda.Utils.List1 (List1, pattern (:|))
import qualified Agda.Utils.List1 as List1
import Agda.Utils.Null
import Agda.Utils.Pretty

import Agda.Utils.Impossible

-- | A name in a binding position: we also compare the nameConcrete
-- when comparing the binders for equality.
--
-- With @--caching@ on we compare abstract syntax to determine if we can
-- reuse previous typechecking results: during that comparison two
-- names can have the same nameId but be semantically different,
-- e.g. in @{_ : A} -> ..@ vs. @{r : A} -> ..@.

newtype BindName = BindName { BindName -> Name
unBind :: Name }
  deriving (Int -> BindName -> ShowS
[BindName] -> ShowS
BindName -> String
(Int -> BindName -> ShowS)
-> (BindName -> String) -> ([BindName] -> ShowS) -> Show BindName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BindName] -> ShowS
$cshowList :: [BindName] -> ShowS
show :: BindName -> String
$cshow :: BindName -> String
showsPrec :: Int -> BindName -> ShowS
$cshowsPrec :: Int -> BindName -> ShowS
Show, Typeable BindName
DataType
Constr
Typeable BindName
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> BindName -> c BindName)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c BindName)
-> (BindName -> Constr)
-> (BindName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c BindName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BindName))
-> ((forall b. Data b => b -> b) -> BindName -> BindName)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> BindName -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> BindName -> r)
-> (forall u. (forall d. Data d => d -> u) -> BindName -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> BindName -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> BindName -> m BindName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BindName -> m BindName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BindName -> m BindName)
-> Data BindName
BindName -> DataType
BindName -> Constr
(forall b. Data b => b -> b) -> BindName -> BindName
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BindName -> c BindName
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BindName
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) -> BindName -> u
forall u. (forall d. Data d => d -> u) -> BindName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BindName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BindName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BindName -> m BindName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BindName -> m BindName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BindName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BindName -> c BindName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BindName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BindName)
$cBindName :: Constr
$tBindName :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> BindName -> m BindName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BindName -> m BindName
gmapMp :: (forall d. Data d => d -> m d) -> BindName -> m BindName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BindName -> m BindName
gmapM :: (forall d. Data d => d -> m d) -> BindName -> m BindName
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BindName -> m BindName
gmapQi :: Int -> (forall d. Data d => d -> u) -> BindName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BindName -> u
gmapQ :: (forall d. Data d => d -> u) -> BindName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BindName -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BindName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BindName -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BindName -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BindName -> r
gmapT :: (forall b. Data b => b -> b) -> BindName -> BindName
$cgmapT :: (forall b. Data b => b -> b) -> BindName -> BindName
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BindName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BindName)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c BindName)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BindName)
dataTypeOf :: BindName -> DataType
$cdataTypeOf :: BindName -> DataType
toConstr :: BindName -> Constr
$ctoConstr :: BindName -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BindName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BindName
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BindName -> c BindName
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BindName -> c BindName
$cp1Data :: Typeable BindName
Data, BindName -> Range
(BindName -> Range) -> HasRange BindName
forall a. (a -> Range) -> HasRange a
getRange :: BindName -> Range
$cgetRange :: BindName -> Range
HasRange, BindName -> BindName
(BindName -> BindName) -> KillRange BindName
forall a. KillRangeT a -> KillRange a
killRange :: BindName -> BindName
$ckillRange :: BindName -> BindName
KillRange, HasRange BindName
HasRange BindName
-> (Range -> BindName -> BindName) -> SetRange BindName
Range -> BindName -> BindName
forall a. HasRange a -> (Range -> a -> a) -> SetRange a
setRange :: Range -> BindName -> BindName
$csetRange :: Range -> BindName -> BindName
$cp1SetRange :: HasRange BindName
SetRange, BindName -> ()
(BindName -> ()) -> NFData BindName
forall a. (a -> ()) -> NFData a
rnf :: BindName -> ()
$crnf :: BindName -> ()
NFData)

mkBindName :: Name -> BindName
mkBindName :: Name -> BindName
mkBindName Name
x = Name -> BindName
BindName Name
x

instance Eq BindName where
  BindName Name
n == :: BindName -> BindName -> Bool
== BindName Name
m
    = (NameId -> NameId -> Bool
forall a. Eq a => a -> a -> Bool
(==) (NameId -> NameId -> Bool)
-> (Name -> NameId) -> Name -> Name -> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` Name -> NameId
nameId) Name
n Name
m
      Bool -> Bool -> Bool
&& (Name -> Name -> Bool
forall a. Eq a => a -> a -> Bool
(==) (Name -> Name -> Bool) -> (Name -> Name) -> Name -> Name -> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` Name -> Name
nameConcrete) Name
n Name
m

instance Ord BindName where
  BindName Name
n compare :: BindName -> BindName -> Ordering
`compare` BindName Name
m
    = (NameId -> NameId -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (NameId -> NameId -> Ordering)
-> (Name -> NameId) -> Name -> Name -> Ordering
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` Name -> NameId
nameId) Name
n Name
m
      Ordering -> Ordering -> Ordering
forall a. Monoid a => a -> a -> a
`mappend` (Name -> Name -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Name -> Name -> Ordering)
-> (Name -> Name) -> Name -> Name -> Ordering
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` Name -> Name
nameConcrete) Name
n Name
m

type Args = [NamedArg Expr]

-- | Expressions after scope checking (operators parsed, names resolved).
data Expr
  = Var  Name                          -- ^ Bound variable.
  | Def'  QName Suffix                 -- ^ Constant: axiom, function, data or record type,
                                       --   with a possible suffix.
  | Proj ProjOrigin AmbiguousQName     -- ^ Projection (overloaded).
  | Con  AmbiguousQName                -- ^ Constructor (overloaded).
  | PatternSyn AmbiguousQName          -- ^ Pattern synonym.
  | Macro QName                        -- ^ Macro.
  | Lit ExprInfo Literal               -- ^ Literal.
  | QuestionMark MetaInfo InteractionId
    -- ^ Meta variable for interaction.
    --   The 'InteractionId' is usually identical with the
    --   'metaNumber' of 'MetaInfo'.
    --   However, if you want to print an interaction meta as
    --   just @?@ instead of @?n@, you should set the
    --   'metaNumber' to 'Nothing' while keeping the 'InteractionId'.
  | Underscore   MetaInfo
    -- ^ Meta variable for hidden argument (must be inferred locally).
  | Dot ExprInfo Expr                  -- ^ @.e@, for postfix projection.
  | App  AppInfo Expr (NamedArg Expr)  -- ^ Ordinary (binary) application.
  | WithApp ExprInfo Expr [Expr]       -- ^ With application.
  | Lam  ExprInfo LamBinding Expr      -- ^ @λ bs → e@.
  | AbsurdLam ExprInfo Hiding          -- ^ @λ()@ or @λ{}@.
  | ExtendedLam ExprInfo DefInfo Erased QName (List1 Clause)
  | Pi   ExprInfo Telescope1 Expr      -- ^ Dependent function space @Γ → A@.
  | Generalized (Set QName) Expr       -- ^ Like a Pi, but the ordering is not known
  | Fun  ExprInfo (Arg Expr) Expr      -- ^ Non-dependent function space.
  | Let  ExprInfo (List1 LetBinding) Expr
                                       -- ^ @let bs in e@.
  | ETel Telescope                     -- ^ Only used when printing telescopes.
  | Rec  ExprInfo RecordAssigns        -- ^ Record construction.
  | RecUpdate ExprInfo Expr Assigns    -- ^ Record update.
  | ScopedExpr ScopeInfo Expr          -- ^ Scope annotation.
  | Quote ExprInfo                     -- ^ Quote an identifier 'QName'.
  | QuoteTerm ExprInfo                 -- ^ Quote a term.
  | Unquote ExprInfo                   -- ^ The splicing construct: unquote ...
  | DontCare Expr                      -- ^ For printing @DontCare@ from @Syntax.Internal@.
  deriving (Typeable Expr
DataType
Constr
Typeable Expr
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Expr -> c Expr)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Expr)
-> (Expr -> Constr)
-> (Expr -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Expr))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Expr))
-> ((forall b. Data b => b -> b) -> Expr -> Expr)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Expr -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Expr -> r)
-> (forall u. (forall d. Data d => d -> u) -> Expr -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Expr -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Expr -> m Expr)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Expr -> m Expr)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Expr -> m Expr)
-> Data Expr
Expr -> DataType
Expr -> Constr
(forall b. Data b => b -> b) -> Expr -> Expr
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Expr -> c Expr
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Expr
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) -> Expr -> u
forall u. (forall d. Data d => d -> u) -> Expr -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Expr -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Expr -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Expr -> m Expr
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Expr -> m Expr
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Expr
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Expr -> c Expr
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Expr)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Expr)
$cDontCare :: Constr
$cUnquote :: Constr
$cQuoteTerm :: Constr
$cQuote :: Constr
$cScopedExpr :: Constr
$cRecUpdate :: Constr
$cRec :: Constr
$cETel :: Constr
$cLet :: Constr
$cFun :: Constr
$cGeneralized :: Constr
$cPi :: Constr
$cExtendedLam :: Constr
$cAbsurdLam :: Constr
$cLam :: Constr
$cWithApp :: Constr
$cApp :: Constr
$cDot :: Constr
$cUnderscore :: Constr
$cQuestionMark :: Constr
$cLit :: Constr
$cMacro :: Constr
$cPatternSyn :: Constr
$cCon :: Constr
$cProj :: Constr
$cDef' :: Constr
$cVar :: Constr
$tExpr :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Expr -> m Expr
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Expr -> m Expr
gmapMp :: (forall d. Data d => d -> m d) -> Expr -> m Expr
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Expr -> m Expr
gmapM :: (forall d. Data d => d -> m d) -> Expr -> m Expr
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Expr -> m Expr
gmapQi :: Int -> (forall d. Data d => d -> u) -> Expr -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Expr -> u
gmapQ :: (forall d. Data d => d -> u) -> Expr -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Expr -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Expr -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Expr -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Expr -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Expr -> r
gmapT :: (forall b. Data b => b -> b) -> Expr -> Expr
$cgmapT :: (forall b. Data b => b -> b) -> Expr -> Expr
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Expr)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Expr)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Expr)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Expr)
dataTypeOf :: Expr -> DataType
$cdataTypeOf :: Expr -> DataType
toConstr :: Expr -> Constr
$ctoConstr :: Expr -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Expr
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Expr
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Expr -> c Expr
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Expr -> c Expr
$cp1Data :: Typeable Expr
Data, Int -> Expr -> ShowS
[Expr] -> ShowS
Expr -> String
(Int -> Expr -> ShowS)
-> (Expr -> String) -> ([Expr] -> ShowS) -> Show Expr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Expr] -> ShowS
$cshowList :: [Expr] -> ShowS
show :: Expr -> String
$cshow :: Expr -> String
showsPrec :: Int -> Expr -> ShowS
$cshowsPrec :: Int -> Expr -> ShowS
Show, (forall x. Expr -> Rep Expr x)
-> (forall x. Rep Expr x -> Expr) -> Generic Expr
forall x. Rep Expr x -> Expr
forall x. Expr -> Rep Expr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Expr x -> Expr
$cfrom :: forall x. Expr -> Rep Expr x
Generic)

-- | Pattern synonym for regular Def
pattern Def :: QName -> Expr
pattern $bDef :: QName -> Expr
$mDef :: forall r. Expr -> (QName -> r) -> (Void# -> r) -> r
Def x = Def' x NoSuffix

-- | Smart constructor for Generalized
generalized :: Set QName -> Expr -> Expr
generalized :: Set QName -> Expr -> Expr
generalized Set QName
s Expr
e
    | Set QName -> Bool
forall a. Null a => a -> Bool
null Set QName
s    = Expr
e
    | Bool
otherwise = Set QName -> Expr -> Expr
Generalized Set QName
s Expr
e

-- | Record field assignment @f = e@.
type Assign  = FieldAssignment' Expr
type Assigns = [Assign]
type RecordAssign  = Either Assign ModuleName
type RecordAssigns = [RecordAssign]

-- | Renaming (generic).
type Ren a = Map a (List1 a)

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

initCopyInfo :: ScopeCopyInfo
initCopyInfo :: ScopeCopyInfo
initCopyInfo = ScopeCopyInfo :: Ren ModuleName -> Ren QName -> ScopeCopyInfo
ScopeCopyInfo
  { renModules :: Ren ModuleName
renModules = Ren ModuleName
forall a. Monoid a => a
mempty
  , renNames :: Ren QName
renNames   = Ren QName
forall a. Monoid a => a
mempty
  }

instance Pretty ScopeCopyInfo where
  pretty :: ScopeCopyInfo -> Doc
pretty ScopeCopyInfo
i = [Doc] -> Doc
forall (t :: * -> *). Foldable t => t Doc -> Doc
vcat [ String -> Ren ModuleName -> Doc
forall a a.
(Pretty a, Pretty a) =>
String -> Map a (NonEmpty a) -> Doc
prRen String
"renModules =" (ScopeCopyInfo -> Ren ModuleName
renModules ScopeCopyInfo
i)
                  , String -> Ren QName -> Doc
forall a a.
(Pretty a, Pretty a) =>
String -> Map a (NonEmpty a) -> Doc
prRen String
"renNames   =" (ScopeCopyInfo -> Ren QName
renNames ScopeCopyInfo
i) ]
    where
      prRen :: String -> Map a (NonEmpty a) -> Doc
prRen String
s Map a (NonEmpty a)
r = [Doc] -> Doc
forall (t :: * -> *). Foldable t => t Doc -> Doc
sep [ String -> Doc
text String
s, Int -> Doc -> Doc
nest Int
2 (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
forall (t :: * -> *). Foldable t => t Doc -> Doc
vcat (((a, a) -> Doc) -> [(a, a)] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (a, a) -> Doc
forall a a. (Pretty a, Pretty a) => (a, a) -> Doc
pr [(a, a)]
xs) ]
        where
          xs :: [(a, a)]
xs = [ (a
k, a
v) | (a
k, NonEmpty a
vs) <- Map a (NonEmpty a) -> [(a, NonEmpty a)]
forall k a. Map k a -> [(k, a)]
Map.toList Map a (NonEmpty a)
r, a
v <- NonEmpty a -> [a]
forall a. NonEmpty a -> [a]
List1.toList NonEmpty a
vs ]
      pr :: (a, a) -> Doc
pr (a
x, a
y) = a -> Doc
forall a. Pretty a => a -> Doc
pretty a
x Doc -> Doc -> Doc
<+> Doc
"->" Doc -> Doc -> Doc
<+> a -> Doc
forall a. Pretty a => a -> Doc
pretty a
y

type RecordDirectives = RecordDirectives' QName

data Declaration
  = Axiom      KindOfName DefInfo ArgInfo (Maybe [Occurrence]) QName Expr
    -- ^ Type signature (can be irrelevant, but not hidden).
    --
    -- The fourth argument contains an optional assignment of
    -- polarities to arguments.
  | Generalize (Set QName) DefInfo ArgInfo QName Expr
    -- ^ First argument is set of generalizable variables used in the type.
  | Field      DefInfo QName (Arg Expr)              -- ^ record field
  | Primitive  DefInfo QName (Arg Expr)              -- ^ primitive function
  | Mutual     MutualInfo [Declaration]              -- ^ a bunch of mutually recursive definitions
  | Section    Range ModuleName GeneralizeTelescope [Declaration]
  | Apply      ModuleInfo ModuleName ModuleApplication ScopeCopyInfo ImportDirective
    -- ^ The @ImportDirective@ is for highlighting purposes.
  | Import     ModuleInfo ModuleName ImportDirective
    -- ^ The @ImportDirective@ is for highlighting purposes.
  | Pragma     Range      Pragma
  | Open       ModuleInfo ModuleName ImportDirective
    -- ^ only retained for highlighting purposes
  | FunDef     DefInfo QName Delayed [Clause] -- ^ sequence of function clauses
  | DataSig    DefInfo QName GeneralizeTelescope Expr -- ^ lone data signature
  | DataDef    DefInfo QName UniverseCheck DataDefParams [Constructor]
  | RecSig     DefInfo QName GeneralizeTelescope Expr -- ^ lone record signature
  | RecDef     DefInfo QName UniverseCheck RecordDirectives DataDefParams Expr [Declaration]
      -- ^ The 'Expr' gives the constructor type telescope, @(x1 : A1)..(xn : An) -> Prop@,
      --   and the optional name is the constructor's name.
      --   The optional 'Range' is for the @pattern@ attribute.
  | PatternSynDef QName [Arg BindName] (Pattern' Void)
      -- ^ Only for highlighting purposes
  | UnquoteDecl MutualInfo [DefInfo] [QName] Expr
  | UnquoteDef  [DefInfo] [QName] Expr
  | ScopedDecl ScopeInfo [Declaration]  -- ^ scope annotation
  deriving (Typeable Declaration
DataType
Constr
Typeable Declaration
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Declaration -> c Declaration)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Declaration)
-> (Declaration -> Constr)
-> (Declaration -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Declaration))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c Declaration))
-> ((forall b. Data b => b -> b) -> Declaration -> Declaration)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Declaration -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Declaration -> r)
-> (forall u. (forall d. Data d => d -> u) -> Declaration -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Declaration -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Declaration -> m Declaration)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Declaration -> m Declaration)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Declaration -> m Declaration)
-> Data Declaration
Declaration -> DataType
Declaration -> Constr
(forall b. Data b => b -> b) -> Declaration -> Declaration
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Declaration -> c Declaration
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Declaration
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) -> Declaration -> u
forall u. (forall d. Data d => d -> u) -> Declaration -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Declaration -> m Declaration
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Declaration -> m Declaration
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Declaration
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Declaration -> c Declaration
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Declaration)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Declaration)
$cScopedDecl :: Constr
$cUnquoteDef :: Constr
$cUnquoteDecl :: Constr
$cPatternSynDef :: Constr
$cRecDef :: Constr
$cRecSig :: Constr
$cDataDef :: Constr
$cDataSig :: Constr
$cFunDef :: Constr
$cOpen :: Constr
$cPragma :: Constr
$cImport :: Constr
$cApply :: Constr
$cSection :: Constr
$cMutual :: Constr
$cPrimitive :: Constr
$cField :: Constr
$cGeneralize :: Constr
$cAxiom :: Constr
$tDeclaration :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Declaration -> m Declaration
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Declaration -> m Declaration
gmapMp :: (forall d. Data d => d -> m d) -> Declaration -> m Declaration
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Declaration -> m Declaration
gmapM :: (forall d. Data d => d -> m d) -> Declaration -> m Declaration
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Declaration -> m Declaration
gmapQi :: Int -> (forall d. Data d => d -> u) -> Declaration -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Declaration -> u
gmapQ :: (forall d. Data d => d -> u) -> Declaration -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Declaration -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration -> r
gmapT :: (forall b. Data b => b -> b) -> Declaration -> Declaration
$cgmapT :: (forall b. Data b => b -> b) -> Declaration -> Declaration
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Declaration)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Declaration)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Declaration)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Declaration)
dataTypeOf :: Declaration -> DataType
$cdataTypeOf :: Declaration -> DataType
toConstr :: Declaration -> Constr
$ctoConstr :: Declaration -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Declaration
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Declaration
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Declaration -> c Declaration
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Declaration -> c Declaration
$cp1Data :: Typeable Declaration
Data, Int -> Declaration -> ShowS
[Declaration] -> ShowS
Declaration -> String
(Int -> Declaration -> ShowS)
-> (Declaration -> String)
-> ([Declaration] -> ShowS)
-> Show Declaration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Declaration] -> ShowS
$cshowList :: [Declaration] -> ShowS
show :: Declaration -> String
$cshow :: Declaration -> String
showsPrec :: Int -> Declaration -> ShowS
$cshowsPrec :: Int -> Declaration -> ShowS
Show, (forall x. Declaration -> Rep Declaration x)
-> (forall x. Rep Declaration x -> Declaration)
-> Generic Declaration
forall x. Rep Declaration x -> Declaration
forall x. Declaration -> Rep Declaration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Declaration x -> Declaration
$cfrom :: forall x. Declaration -> Rep Declaration x
Generic)

type DefInfo = DefInfo' Expr

type ImportDirective = ImportDirective' QName ModuleName
type Renaming        = Renaming'        QName ModuleName
type ImportedName    = ImportedName'    QName ModuleName

data ModuleApplication
    = SectionApp Telescope ModuleName [NamedArg Expr]
      -- ^ @tel. M args@:  applies @M@ to @args@ and abstracts @tel@.
    | RecordModuleInstance ModuleName
      -- ^ @M {{...}}@
  deriving (Typeable ModuleApplication
DataType
Constr
Typeable ModuleApplication
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> ModuleApplication
    -> c ModuleApplication)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ModuleApplication)
-> (ModuleApplication -> Constr)
-> (ModuleApplication -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ModuleApplication))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ModuleApplication))
-> ((forall b. Data b => b -> b)
    -> ModuleApplication -> ModuleApplication)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ModuleApplication -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ModuleApplication -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> ModuleApplication -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ModuleApplication -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> ModuleApplication -> m ModuleApplication)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ModuleApplication -> m ModuleApplication)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ModuleApplication -> m ModuleApplication)
-> Data ModuleApplication
ModuleApplication -> DataType
ModuleApplication -> Constr
(forall b. Data b => b -> b)
-> ModuleApplication -> ModuleApplication
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleApplication -> c ModuleApplication
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleApplication
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) -> ModuleApplication -> u
forall u. (forall d. Data d => d -> u) -> ModuleApplication -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleApplication -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleApplication -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ModuleApplication -> m ModuleApplication
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleApplication -> m ModuleApplication
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleApplication
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleApplication -> c ModuleApplication
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ModuleApplication)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleApplication)
$cRecordModuleInstance :: Constr
$cSectionApp :: Constr
$tModuleApplication :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> ModuleApplication -> m ModuleApplication
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleApplication -> m ModuleApplication
gmapMp :: (forall d. Data d => d -> m d)
-> ModuleApplication -> m ModuleApplication
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleApplication -> m ModuleApplication
gmapM :: (forall d. Data d => d -> m d)
-> ModuleApplication -> m ModuleApplication
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ModuleApplication -> m ModuleApplication
gmapQi :: Int -> (forall d. Data d => d -> u) -> ModuleApplication -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ModuleApplication -> u
gmapQ :: (forall d. Data d => d -> u) -> ModuleApplication -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ModuleApplication -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleApplication -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleApplication -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleApplication -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleApplication -> r
gmapT :: (forall b. Data b => b -> b)
-> ModuleApplication -> ModuleApplication
$cgmapT :: (forall b. Data b => b -> b)
-> ModuleApplication -> ModuleApplication
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleApplication)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleApplication)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ModuleApplication)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ModuleApplication)
dataTypeOf :: ModuleApplication -> DataType
$cdataTypeOf :: ModuleApplication -> DataType
toConstr :: ModuleApplication -> Constr
$ctoConstr :: ModuleApplication -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleApplication
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleApplication
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleApplication -> c ModuleApplication
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleApplication -> c ModuleApplication
$cp1Data :: Typeable ModuleApplication
Data, Int -> ModuleApplication -> ShowS
[ModuleApplication] -> ShowS
ModuleApplication -> String
(Int -> ModuleApplication -> ShowS)
-> (ModuleApplication -> String)
-> ([ModuleApplication] -> ShowS)
-> Show ModuleApplication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleApplication] -> ShowS
$cshowList :: [ModuleApplication] -> ShowS
show :: ModuleApplication -> String
$cshow :: ModuleApplication -> String
showsPrec :: Int -> ModuleApplication -> ShowS
$cshowsPrec :: Int -> ModuleApplication -> ShowS
Show, ModuleApplication -> ModuleApplication -> Bool
(ModuleApplication -> ModuleApplication -> Bool)
-> (ModuleApplication -> ModuleApplication -> Bool)
-> Eq ModuleApplication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModuleApplication -> ModuleApplication -> Bool
$c/= :: ModuleApplication -> ModuleApplication -> Bool
== :: ModuleApplication -> ModuleApplication -> Bool
$c== :: ModuleApplication -> ModuleApplication -> Bool
Eq, (forall x. ModuleApplication -> Rep ModuleApplication x)
-> (forall x. Rep ModuleApplication x -> ModuleApplication)
-> Generic ModuleApplication
forall x. Rep ModuleApplication x -> ModuleApplication
forall x. ModuleApplication -> Rep ModuleApplication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModuleApplication x -> ModuleApplication
$cfrom :: forall x. ModuleApplication -> Rep ModuleApplication x
Generic)

data Pragma
  = OptionsPragma [String]
  | BuiltinPragma RString ResolvedName
    -- ^ 'ResolvedName' is not 'UnknownName'.
    --   Name can be ambiguous e.g. for built-in constructors.
  | BuiltinNoDefPragma RString KindOfName QName
    -- ^ Builtins that do not come with a definition,
    --   but declare a name for an Agda concept.
  | RewritePragma Range [QName]
    -- ^ Range is range of REWRITE keyword.
  | CompilePragma RString QName String
  | StaticPragma QName
  | EtaPragma QName
    -- ^ For coinductive records, use pragma instead of regular
    --   @eta-equality@ definition (as it is might make Agda loop).
  | InjectivePragma QName
  | InlinePragma Bool QName -- INLINE or NOINLINE
  | DisplayPragma QName [NamedArg Pattern] Expr
  deriving (Typeable Pragma
DataType
Constr
Typeable Pragma
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Pragma -> c Pragma)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Pragma)
-> (Pragma -> Constr)
-> (Pragma -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Pragma))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pragma))
-> ((forall b. Data b => b -> b) -> Pragma -> Pragma)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Pragma -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Pragma -> r)
-> (forall u. (forall d. Data d => d -> u) -> Pragma -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Pragma -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Pragma -> m Pragma)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Pragma -> m Pragma)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Pragma -> m Pragma)
-> Data Pragma
Pragma -> DataType
Pragma -> Constr
(forall b. Data b => b -> b) -> Pragma -> Pragma
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pragma -> c Pragma
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Pragma
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) -> Pragma -> u
forall u. (forall d. Data d => d -> u) -> Pragma -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pragma -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pragma -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Pragma -> m Pragma
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pragma -> m Pragma
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Pragma
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pragma -> c Pragma
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Pragma)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pragma)
$cDisplayPragma :: Constr
$cInlinePragma :: Constr
$cInjectivePragma :: Constr
$cEtaPragma :: Constr
$cStaticPragma :: Constr
$cCompilePragma :: Constr
$cRewritePragma :: Constr
$cBuiltinNoDefPragma :: Constr
$cBuiltinPragma :: Constr
$cOptionsPragma :: Constr
$tPragma :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Pragma -> m Pragma
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pragma -> m Pragma
gmapMp :: (forall d. Data d => d -> m d) -> Pragma -> m Pragma
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pragma -> m Pragma
gmapM :: (forall d. Data d => d -> m d) -> Pragma -> m Pragma
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Pragma -> m Pragma
gmapQi :: Int -> (forall d. Data d => d -> u) -> Pragma -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Pragma -> u
gmapQ :: (forall d. Data d => d -> u) -> Pragma -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Pragma -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pragma -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pragma -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pragma -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pragma -> r
gmapT :: (forall b. Data b => b -> b) -> Pragma -> Pragma
$cgmapT :: (forall b. Data b => b -> b) -> Pragma -> Pragma
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pragma)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pragma)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Pragma)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Pragma)
dataTypeOf :: Pragma -> DataType
$cdataTypeOf :: Pragma -> DataType
toConstr :: Pragma -> Constr
$ctoConstr :: Pragma -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Pragma
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Pragma
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pragma -> c Pragma
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pragma -> c Pragma
$cp1Data :: Typeable Pragma
Data, Int -> Pragma -> ShowS
[Pragma] -> ShowS
Pragma -> String
(Int -> Pragma -> ShowS)
-> (Pragma -> String) -> ([Pragma] -> ShowS) -> Show Pragma
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Pragma] -> ShowS
$cshowList :: [Pragma] -> ShowS
show :: Pragma -> String
$cshow :: Pragma -> String
showsPrec :: Int -> Pragma -> ShowS
$cshowsPrec :: Int -> Pragma -> ShowS
Show, Pragma -> Pragma -> Bool
(Pragma -> Pragma -> Bool)
-> (Pragma -> Pragma -> Bool) -> Eq Pragma
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Pragma -> Pragma -> Bool
$c/= :: Pragma -> Pragma -> Bool
== :: Pragma -> Pragma -> Bool
$c== :: Pragma -> Pragma -> Bool
Eq, (forall x. Pragma -> Rep Pragma x)
-> (forall x. Rep Pragma x -> Pragma) -> Generic Pragma
forall x. Rep Pragma x -> Pragma
forall x. Pragma -> Rep Pragma x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Pragma x -> Pragma
$cfrom :: forall x. Pragma -> Rep Pragma x
Generic)

-- | Bindings that are valid in a @let@.
data LetBinding
  = LetBind LetInfo ArgInfo BindName Expr Expr
    -- ^ @LetBind info rel name type defn@
  | LetPatBind LetInfo Pattern Expr
    -- ^ Irrefutable pattern binding.
  | LetApply ModuleInfo ModuleName ModuleApplication ScopeCopyInfo ImportDirective
    -- ^ @LetApply mi newM (oldM args) renamings dir@.
    -- The @ImportDirective@ is for highlighting purposes.
  | LetOpen ModuleInfo ModuleName ImportDirective
    -- ^ only for highlighting and abstractToConcrete
  | LetDeclaredVariable BindName
    -- ^ Only used for highlighting. Refers to the first occurrence of
    -- @x@ in @let x : A; x = e@.
--  | LetGeneralize DefInfo ArgInfo Expr
  deriving (Typeable LetBinding
DataType
Constr
Typeable LetBinding
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LetBinding -> c LetBinding)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LetBinding)
-> (LetBinding -> Constr)
-> (LetBinding -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LetBinding))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c LetBinding))
-> ((forall b. Data b => b -> b) -> LetBinding -> LetBinding)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LetBinding -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LetBinding -> r)
-> (forall u. (forall d. Data d => d -> u) -> LetBinding -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> LetBinding -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> LetBinding -> m LetBinding)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LetBinding -> m LetBinding)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LetBinding -> m LetBinding)
-> Data LetBinding
LetBinding -> DataType
LetBinding -> Constr
(forall b. Data b => b -> b) -> LetBinding -> LetBinding
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LetBinding -> c LetBinding
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LetBinding
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) -> LetBinding -> u
forall u. (forall d. Data d => d -> u) -> LetBinding -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LetBinding -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LetBinding -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LetBinding -> m LetBinding
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LetBinding -> m LetBinding
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LetBinding
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LetBinding -> c LetBinding
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LetBinding)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LetBinding)
$cLetDeclaredVariable :: Constr
$cLetOpen :: Constr
$cLetApply :: Constr
$cLetPatBind :: Constr
$cLetBind :: Constr
$tLetBinding :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> LetBinding -> m LetBinding
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LetBinding -> m LetBinding
gmapMp :: (forall d. Data d => d -> m d) -> LetBinding -> m LetBinding
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LetBinding -> m LetBinding
gmapM :: (forall d. Data d => d -> m d) -> LetBinding -> m LetBinding
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LetBinding -> m LetBinding
gmapQi :: Int -> (forall d. Data d => d -> u) -> LetBinding -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LetBinding -> u
gmapQ :: (forall d. Data d => d -> u) -> LetBinding -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LetBinding -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LetBinding -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LetBinding -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LetBinding -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LetBinding -> r
gmapT :: (forall b. Data b => b -> b) -> LetBinding -> LetBinding
$cgmapT :: (forall b. Data b => b -> b) -> LetBinding -> LetBinding
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LetBinding)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LetBinding)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c LetBinding)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LetBinding)
dataTypeOf :: LetBinding -> DataType
$cdataTypeOf :: LetBinding -> DataType
toConstr :: LetBinding -> Constr
$ctoConstr :: LetBinding -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LetBinding
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LetBinding
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LetBinding -> c LetBinding
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LetBinding -> c LetBinding
$cp1Data :: Typeable LetBinding
Data, Int -> LetBinding -> ShowS
[LetBinding] -> ShowS
LetBinding -> String
(Int -> LetBinding -> ShowS)
-> (LetBinding -> String)
-> ([LetBinding] -> ShowS)
-> Show LetBinding
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LetBinding] -> ShowS
$cshowList :: [LetBinding] -> ShowS
show :: LetBinding -> String
$cshow :: LetBinding -> String
showsPrec :: Int -> LetBinding -> ShowS
$cshowsPrec :: Int -> LetBinding -> ShowS
Show, LetBinding -> LetBinding -> Bool
(LetBinding -> LetBinding -> Bool)
-> (LetBinding -> LetBinding -> Bool) -> Eq LetBinding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LetBinding -> LetBinding -> Bool
$c/= :: LetBinding -> LetBinding -> Bool
== :: LetBinding -> LetBinding -> Bool
$c== :: LetBinding -> LetBinding -> Bool
Eq, (forall x. LetBinding -> Rep LetBinding x)
-> (forall x. Rep LetBinding x -> LetBinding) -> Generic LetBinding
forall x. Rep LetBinding x -> LetBinding
forall x. LetBinding -> Rep LetBinding x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LetBinding x -> LetBinding
$cfrom :: forall x. LetBinding -> Rep LetBinding x
Generic)

-- | Only 'Axiom's.
type TypeSignature  = Declaration
type Constructor    = TypeSignature
type Field          = TypeSignature

type TacticAttr = Maybe Expr

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

type Binder = Binder' BindName

mkBinder :: a -> Binder' a
mkBinder :: a -> Binder' a
mkBinder = Maybe Pattern -> a -> Binder' a
forall a. Maybe Pattern -> a -> Binder' a
Binder Maybe Pattern
forall a. Maybe a
Nothing

mkBinder_ :: Name -> Binder
mkBinder_ :: Name -> Binder
mkBinder_ = BindName -> Binder
forall a. a -> Binder' a
mkBinder (BindName -> Binder) -> (Name -> BindName) -> Name -> Binder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> BindName
mkBindName

extractPattern :: Binder' a -> Maybe (Pattern, a)
extractPattern :: Binder' a -> Maybe (Pattern, a)
extractPattern (Binder Maybe Pattern
p a
a) = (,a
a) (Pattern -> (Pattern, a)) -> Maybe Pattern -> Maybe (Pattern, a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Pattern
p

-- | A lambda binding is either domain free or typed.
data LamBinding
  = DomainFree TacticAttr (NamedArg Binder)
    -- ^ . @x@ or @{x}@ or @.x@ or @{x = y}@ or @x\@p@ or @(p)@
  | DomainFull TypedBinding
    -- ^ . @(xs:e)@ or @{xs:e}@ or @(let Ds)@
  deriving (Typeable LamBinding
DataType
Constr
Typeable LamBinding
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LamBinding -> c LamBinding)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LamBinding)
-> (LamBinding -> Constr)
-> (LamBinding -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LamBinding))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c LamBinding))
-> ((forall b. Data b => b -> b) -> LamBinding -> LamBinding)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LamBinding -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LamBinding -> r)
-> (forall u. (forall d. Data d => d -> u) -> LamBinding -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> LamBinding -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> LamBinding -> m LamBinding)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LamBinding -> m LamBinding)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LamBinding -> m LamBinding)
-> Data LamBinding
LamBinding -> DataType
LamBinding -> Constr
(forall b. Data b => b -> b) -> LamBinding -> LamBinding
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamBinding -> c LamBinding
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LamBinding
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) -> LamBinding -> u
forall u. (forall d. Data d => d -> u) -> LamBinding -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LamBinding -> m LamBinding
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LamBinding -> m LamBinding
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LamBinding
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamBinding -> c LamBinding
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LamBinding)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LamBinding)
$cDomainFull :: Constr
$cDomainFree :: Constr
$tLamBinding :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> LamBinding -> m LamBinding
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LamBinding -> m LamBinding
gmapMp :: (forall d. Data d => d -> m d) -> LamBinding -> m LamBinding
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LamBinding -> m LamBinding
gmapM :: (forall d. Data d => d -> m d) -> LamBinding -> m LamBinding
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LamBinding -> m LamBinding
gmapQi :: Int -> (forall d. Data d => d -> u) -> LamBinding -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LamBinding -> u
gmapQ :: (forall d. Data d => d -> u) -> LamBinding -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LamBinding -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding -> r
gmapT :: (forall b. Data b => b -> b) -> LamBinding -> LamBinding
$cgmapT :: (forall b. Data b => b -> b) -> LamBinding -> LamBinding
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LamBinding)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LamBinding)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c LamBinding)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LamBinding)
dataTypeOf :: LamBinding -> DataType
$cdataTypeOf :: LamBinding -> DataType
toConstr :: LamBinding -> Constr
$ctoConstr :: LamBinding -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LamBinding
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LamBinding
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamBinding -> c LamBinding
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamBinding -> c LamBinding
$cp1Data :: Typeable LamBinding
Data, Int -> LamBinding -> ShowS
[LamBinding] -> ShowS
LamBinding -> String
(Int -> LamBinding -> ShowS)
-> (LamBinding -> String)
-> ([LamBinding] -> ShowS)
-> Show LamBinding
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LamBinding] -> ShowS
$cshowList :: [LamBinding] -> ShowS
show :: LamBinding -> String
$cshow :: LamBinding -> String
showsPrec :: Int -> LamBinding -> ShowS
$cshowsPrec :: Int -> LamBinding -> ShowS
Show, LamBinding -> LamBinding -> Bool
(LamBinding -> LamBinding -> Bool)
-> (LamBinding -> LamBinding -> Bool) -> Eq LamBinding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LamBinding -> LamBinding -> Bool
$c/= :: LamBinding -> LamBinding -> Bool
== :: LamBinding -> LamBinding -> Bool
$c== :: LamBinding -> LamBinding -> Bool
Eq, (forall x. LamBinding -> Rep LamBinding x)
-> (forall x. Rep LamBinding x -> LamBinding) -> Generic LamBinding
forall x. Rep LamBinding x -> LamBinding
forall x. LamBinding -> Rep LamBinding x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LamBinding x -> LamBinding
$cfrom :: forall x. LamBinding -> Rep LamBinding x
Generic)

mkDomainFree :: NamedArg Binder -> LamBinding
mkDomainFree :: NamedArg Binder -> LamBinding
mkDomainFree = TacticAttr -> NamedArg Binder -> LamBinding
DomainFree TacticAttr
forall a. Maybe a
Nothing

-- | A typed binding.  Appears in dependent function spaces, typed lambdas, and
--   telescopes.  It might be tempting to simplify this to only bind a single
--   name at a time, and translate, say, @(x y : A)@ to @(x : A)(y : A)@
--   before type-checking.  However, this would be slightly problematic:
--
--     1. We would have to typecheck the type @A@ several times.
--
--     2. If @A@ contains a meta variable or hole, it would be duplicated
--        by such a translation.
--
--   While 1. is only slightly inefficient, 2. would be an outright bug.
--   Duplicating @A@ could not be done naively, we would have to make sure
--   that the metas of the copy are aliases of the metas of the original.

data TypedBinding
  = TBind Range TacticAttr (List1 (NamedArg Binder)) Expr
    -- ^ As in telescope @(x y z : A)@ or type @(x y z : A) -> B@.
  | TLet Range (List1 LetBinding)
    -- ^ E.g. @(let x = e)@ or @(let open M)@.
  deriving (Typeable TypedBinding
DataType
Constr
Typeable TypedBinding
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TypedBinding -> c TypedBinding)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TypedBinding)
-> (TypedBinding -> Constr)
-> (TypedBinding -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TypedBinding))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c TypedBinding))
-> ((forall b. Data b => b -> b) -> TypedBinding -> TypedBinding)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TypedBinding -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TypedBinding -> r)
-> (forall u. (forall d. Data d => d -> u) -> TypedBinding -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> TypedBinding -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding)
-> Data TypedBinding
TypedBinding -> DataType
TypedBinding -> Constr
(forall b. Data b => b -> b) -> TypedBinding -> TypedBinding
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypedBinding -> c TypedBinding
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypedBinding
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) -> TypedBinding -> u
forall u. (forall d. Data d => d -> u) -> TypedBinding -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypedBinding
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypedBinding -> c TypedBinding
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypedBinding)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TypedBinding)
$cTLet :: Constr
$cTBind :: Constr
$tTypedBinding :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding
gmapMp :: (forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding
gmapM :: (forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypedBinding -> m TypedBinding
gmapQi :: Int -> (forall d. Data d => d -> u) -> TypedBinding -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypedBinding -> u
gmapQ :: (forall d. Data d => d -> u) -> TypedBinding -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypedBinding -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding -> r
gmapT :: (forall b. Data b => b -> b) -> TypedBinding -> TypedBinding
$cgmapT :: (forall b. Data b => b -> b) -> TypedBinding -> TypedBinding
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TypedBinding)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TypedBinding)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c TypedBinding)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypedBinding)
dataTypeOf :: TypedBinding -> DataType
$cdataTypeOf :: TypedBinding -> DataType
toConstr :: TypedBinding -> Constr
$ctoConstr :: TypedBinding -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypedBinding
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypedBinding
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypedBinding -> c TypedBinding
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypedBinding -> c TypedBinding
$cp1Data :: Typeable TypedBinding
Data, Int -> TypedBinding -> ShowS
[TypedBinding] -> ShowS
TypedBinding -> String
(Int -> TypedBinding -> ShowS)
-> (TypedBinding -> String)
-> ([TypedBinding] -> ShowS)
-> Show TypedBinding
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypedBinding] -> ShowS
$cshowList :: [TypedBinding] -> ShowS
show :: TypedBinding -> String
$cshow :: TypedBinding -> String
showsPrec :: Int -> TypedBinding -> ShowS
$cshowsPrec :: Int -> TypedBinding -> ShowS
Show, TypedBinding -> TypedBinding -> Bool
(TypedBinding -> TypedBinding -> Bool)
-> (TypedBinding -> TypedBinding -> Bool) -> Eq TypedBinding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypedBinding -> TypedBinding -> Bool
$c/= :: TypedBinding -> TypedBinding -> Bool
== :: TypedBinding -> TypedBinding -> Bool
$c== :: TypedBinding -> TypedBinding -> Bool
Eq, (forall x. TypedBinding -> Rep TypedBinding x)
-> (forall x. Rep TypedBinding x -> TypedBinding)
-> Generic TypedBinding
forall x. Rep TypedBinding x -> TypedBinding
forall x. TypedBinding -> Rep TypedBinding x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TypedBinding x -> TypedBinding
$cfrom :: forall x. TypedBinding -> Rep TypedBinding x
Generic)

mkTBind :: Range -> List1 (NamedArg Binder) -> Expr -> TypedBinding
mkTBind :: Range -> List1 (NamedArg Binder) -> Expr -> TypedBinding
mkTBind Range
r = Range
-> TacticAttr -> List1 (NamedArg Binder) -> Expr -> TypedBinding
TBind Range
r TacticAttr
forall a. Maybe a
Nothing

mkTLet :: Range -> [LetBinding] -> Maybe TypedBinding
mkTLet :: Range -> [LetBinding] -> Maybe TypedBinding
mkTLet Range
_ []     = Maybe TypedBinding
forall a. Maybe a
Nothing
mkTLet Range
r (LetBinding
d:[LetBinding]
ds) = TypedBinding -> Maybe TypedBinding
forall a. a -> Maybe a
Just (TypedBinding -> Maybe TypedBinding)
-> TypedBinding -> Maybe TypedBinding
forall a b. (a -> b) -> a -> b
$ Range -> List1 LetBinding -> TypedBinding
TLet Range
r (LetBinding
d LetBinding -> [LetBinding] -> List1 LetBinding
forall a. a -> [a] -> NonEmpty a
:| [LetBinding]
ds)

type Telescope1 = List1 TypedBinding
type Telescope  = [TypedBinding]

mkPi :: ExprInfo -> Telescope -> Expr -> Expr
mkPi :: ExprInfo -> [TypedBinding] -> Expr -> Expr
mkPi ExprInfo
i []     Expr
e = Expr
e
mkPi ExprInfo
i (TypedBinding
x:[TypedBinding]
xs) Expr
e = ExprInfo -> Telescope1 -> Expr -> Expr
Pi ExprInfo
i (TypedBinding
x TypedBinding -> [TypedBinding] -> Telescope1
forall a. a -> [a] -> NonEmpty a
:| [TypedBinding]
xs) Expr
e

data GeneralizeTelescope = GeneralizeTel
  { GeneralizeTelescope -> Map QName Name
generalizeTelVars :: Map QName Name
    -- ^ Maps generalize variables to the corresponding bound variable (to be
    --   introduced by the generalisation).
  , GeneralizeTelescope -> [TypedBinding]
generalizeTel     :: Telescope }
  deriving (Typeable GeneralizeTelescope
DataType
Constr
Typeable GeneralizeTelescope
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> GeneralizeTelescope
    -> c GeneralizeTelescope)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c GeneralizeTelescope)
-> (GeneralizeTelescope -> Constr)
-> (GeneralizeTelescope -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c GeneralizeTelescope))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c GeneralizeTelescope))
-> ((forall b. Data b => b -> b)
    -> GeneralizeTelescope -> GeneralizeTelescope)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> GeneralizeTelescope -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> GeneralizeTelescope -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> GeneralizeTelescope -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> GeneralizeTelescope -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> GeneralizeTelescope -> m GeneralizeTelescope)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> GeneralizeTelescope -> m GeneralizeTelescope)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> GeneralizeTelescope -> m GeneralizeTelescope)
-> Data GeneralizeTelescope
GeneralizeTelescope -> DataType
GeneralizeTelescope -> Constr
(forall b. Data b => b -> b)
-> GeneralizeTelescope -> GeneralizeTelescope
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> GeneralizeTelescope
-> c GeneralizeTelescope
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GeneralizeTelescope
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) -> GeneralizeTelescope -> u
forall u.
(forall d. Data d => d -> u) -> GeneralizeTelescope -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> GeneralizeTelescope -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> GeneralizeTelescope -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> GeneralizeTelescope -> m GeneralizeTelescope
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> GeneralizeTelescope -> m GeneralizeTelescope
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GeneralizeTelescope
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> GeneralizeTelescope
-> c GeneralizeTelescope
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c GeneralizeTelescope)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c GeneralizeTelescope)
$cGeneralizeTel :: Constr
$tGeneralizeTelescope :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> GeneralizeTelescope -> m GeneralizeTelescope
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> GeneralizeTelescope -> m GeneralizeTelescope
gmapMp :: (forall d. Data d => d -> m d)
-> GeneralizeTelescope -> m GeneralizeTelescope
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> GeneralizeTelescope -> m GeneralizeTelescope
gmapM :: (forall d. Data d => d -> m d)
-> GeneralizeTelescope -> m GeneralizeTelescope
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> GeneralizeTelescope -> m GeneralizeTelescope
gmapQi :: Int -> (forall d. Data d => d -> u) -> GeneralizeTelescope -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> GeneralizeTelescope -> u
gmapQ :: (forall d. Data d => d -> u) -> GeneralizeTelescope -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> GeneralizeTelescope -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> GeneralizeTelescope -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> GeneralizeTelescope -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> GeneralizeTelescope -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> GeneralizeTelescope -> r
gmapT :: (forall b. Data b => b -> b)
-> GeneralizeTelescope -> GeneralizeTelescope
$cgmapT :: (forall b. Data b => b -> b)
-> GeneralizeTelescope -> GeneralizeTelescope
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c GeneralizeTelescope)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c GeneralizeTelescope)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c GeneralizeTelescope)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c GeneralizeTelescope)
dataTypeOf :: GeneralizeTelescope -> DataType
$cdataTypeOf :: GeneralizeTelescope -> DataType
toConstr :: GeneralizeTelescope -> Constr
$ctoConstr :: GeneralizeTelescope -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GeneralizeTelescope
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GeneralizeTelescope
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> GeneralizeTelescope
-> c GeneralizeTelescope
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> GeneralizeTelescope
-> c GeneralizeTelescope
$cp1Data :: Typeable GeneralizeTelescope
Data, Int -> GeneralizeTelescope -> ShowS
[GeneralizeTelescope] -> ShowS
GeneralizeTelescope -> String
(Int -> GeneralizeTelescope -> ShowS)
-> (GeneralizeTelescope -> String)
-> ([GeneralizeTelescope] -> ShowS)
-> Show GeneralizeTelescope
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeneralizeTelescope] -> ShowS
$cshowList :: [GeneralizeTelescope] -> ShowS
show :: GeneralizeTelescope -> String
$cshow :: GeneralizeTelescope -> String
showsPrec :: Int -> GeneralizeTelescope -> ShowS
$cshowsPrec :: Int -> GeneralizeTelescope -> ShowS
Show, GeneralizeTelescope -> GeneralizeTelescope -> Bool
(GeneralizeTelescope -> GeneralizeTelescope -> Bool)
-> (GeneralizeTelescope -> GeneralizeTelescope -> Bool)
-> Eq GeneralizeTelescope
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeneralizeTelescope -> GeneralizeTelescope -> Bool
$c/= :: GeneralizeTelescope -> GeneralizeTelescope -> Bool
== :: GeneralizeTelescope -> GeneralizeTelescope -> Bool
$c== :: GeneralizeTelescope -> GeneralizeTelescope -> Bool
Eq, (forall x. GeneralizeTelescope -> Rep GeneralizeTelescope x)
-> (forall x. Rep GeneralizeTelescope x -> GeneralizeTelescope)
-> Generic GeneralizeTelescope
forall x. Rep GeneralizeTelescope x -> GeneralizeTelescope
forall x. GeneralizeTelescope -> Rep GeneralizeTelescope x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeneralizeTelescope x -> GeneralizeTelescope
$cfrom :: forall x. GeneralizeTelescope -> Rep GeneralizeTelescope x
Generic)

data DataDefParams = DataDefParams
  { DataDefParams -> Set Name
dataDefGeneralizedParams :: Set Name
    -- ^ We don't yet know the position of generalized parameters from the data
    --   sig, so we keep these in a set on the side.
  , DataDefParams -> [LamBinding]
dataDefParams :: [LamBinding]
  }
  deriving (Typeable DataDefParams
DataType
Constr
Typeable DataDefParams
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> DataDefParams -> c DataDefParams)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DataDefParams)
-> (DataDefParams -> Constr)
-> (DataDefParams -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DataDefParams))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DataDefParams))
-> ((forall b. Data b => b -> b) -> DataDefParams -> DataDefParams)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DataDefParams -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DataDefParams -> r)
-> (forall u. (forall d. Data d => d -> u) -> DataDefParams -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DataDefParams -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams)
-> Data DataDefParams
DataDefParams -> DataType
DataDefParams -> Constr
(forall b. Data b => b -> b) -> DataDefParams -> DataDefParams
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DataDefParams -> c DataDefParams
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DataDefParams
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) -> DataDefParams -> u
forall u. (forall d. Data d => d -> u) -> DataDefParams -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DataDefParams -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DataDefParams -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DataDefParams
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DataDefParams -> c DataDefParams
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DataDefParams)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DataDefParams)
$cDataDefParams :: Constr
$tDataDefParams :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams
gmapMp :: (forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams
gmapM :: (forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DataDefParams -> m DataDefParams
gmapQi :: Int -> (forall d. Data d => d -> u) -> DataDefParams -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DataDefParams -> u
gmapQ :: (forall d. Data d => d -> u) -> DataDefParams -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DataDefParams -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DataDefParams -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DataDefParams -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DataDefParams -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DataDefParams -> r
gmapT :: (forall b. Data b => b -> b) -> DataDefParams -> DataDefParams
$cgmapT :: (forall b. Data b => b -> b) -> DataDefParams -> DataDefParams
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DataDefParams)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DataDefParams)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c DataDefParams)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DataDefParams)
dataTypeOf :: DataDefParams -> DataType
$cdataTypeOf :: DataDefParams -> DataType
toConstr :: DataDefParams -> Constr
$ctoConstr :: DataDefParams -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DataDefParams
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DataDefParams
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DataDefParams -> c DataDefParams
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DataDefParams -> c DataDefParams
$cp1Data :: Typeable DataDefParams
Data, Int -> DataDefParams -> ShowS
[DataDefParams] -> ShowS
DataDefParams -> String
(Int -> DataDefParams -> ShowS)
-> (DataDefParams -> String)
-> ([DataDefParams] -> ShowS)
-> Show DataDefParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataDefParams] -> ShowS
$cshowList :: [DataDefParams] -> ShowS
show :: DataDefParams -> String
$cshow :: DataDefParams -> String
showsPrec :: Int -> DataDefParams -> ShowS
$cshowsPrec :: Int -> DataDefParams -> ShowS
Show, DataDefParams -> DataDefParams -> Bool
(DataDefParams -> DataDefParams -> Bool)
-> (DataDefParams -> DataDefParams -> Bool) -> Eq DataDefParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataDefParams -> DataDefParams -> Bool
$c/= :: DataDefParams -> DataDefParams -> Bool
== :: DataDefParams -> DataDefParams -> Bool
$c== :: DataDefParams -> DataDefParams -> Bool
Eq, (forall x. DataDefParams -> Rep DataDefParams x)
-> (forall x. Rep DataDefParams x -> DataDefParams)
-> Generic DataDefParams
forall x. Rep DataDefParams x -> DataDefParams
forall x. DataDefParams -> Rep DataDefParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataDefParams x -> DataDefParams
$cfrom :: forall x. DataDefParams -> Rep DataDefParams x
Generic)

noDataDefParams :: DataDefParams
noDataDefParams :: DataDefParams
noDataDefParams = Set Name -> [LamBinding] -> DataDefParams
DataDefParams Set Name
forall a. Set a
Set.empty []

-- | A user pattern together with an internal term that it should be equal to
--   after splitting is complete.
--   Special cases:
--    * User pattern is a variable but internal term isn't:
--      this will be turned into an as pattern.
--    * User pattern is a dot pattern:
--      this pattern won't trigger any splitting but will be checked
--      for equality after all splitting is complete and as patterns have
--      been bound.
--    * User pattern is an absurd pattern:
--      emptiness of the type will be checked after splitting is complete.
--    * User pattern is an annotated wildcard:
--      type annotation will be checked after splitting is complete.
data ProblemEq = ProblemEq
  { ProblemEq -> Pattern
problemInPat :: Pattern
  , ProblemEq -> Term
problemInst  :: I.Term
  , ProblemEq -> Dom Type
problemType  :: I.Dom I.Type
  } deriving (Typeable ProblemEq
DataType
Constr
Typeable ProblemEq
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ProblemEq -> c ProblemEq)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ProblemEq)
-> (ProblemEq -> Constr)
-> (ProblemEq -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ProblemEq))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProblemEq))
-> ((forall b. Data b => b -> b) -> ProblemEq -> ProblemEq)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ProblemEq -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ProblemEq -> r)
-> (forall u. (forall d. Data d => d -> u) -> ProblemEq -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ProblemEq -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq)
-> Data ProblemEq
ProblemEq -> DataType
ProblemEq -> Constr
(forall b. Data b => b -> b) -> ProblemEq -> ProblemEq
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProblemEq -> c ProblemEq
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProblemEq
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) -> ProblemEq -> u
forall u. (forall d. Data d => d -> u) -> ProblemEq -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemEq -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemEq -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProblemEq
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProblemEq -> c ProblemEq
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ProblemEq)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProblemEq)
$cProblemEq :: Constr
$tProblemEq :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq
gmapMp :: (forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq
gmapM :: (forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProblemEq -> m ProblemEq
gmapQi :: Int -> (forall d. Data d => d -> u) -> ProblemEq -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ProblemEq -> u
gmapQ :: (forall d. Data d => d -> u) -> ProblemEq -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ProblemEq -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemEq -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemEq -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemEq -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProblemEq -> r
gmapT :: (forall b. Data b => b -> b) -> ProblemEq -> ProblemEq
$cgmapT :: (forall b. Data b => b -> b) -> ProblemEq -> ProblemEq
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProblemEq)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProblemEq)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ProblemEq)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ProblemEq)
dataTypeOf :: ProblemEq -> DataType
$cdataTypeOf :: ProblemEq -> DataType
toConstr :: ProblemEq -> Constr
$ctoConstr :: ProblemEq -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProblemEq
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProblemEq
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProblemEq -> c ProblemEq
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProblemEq -> c ProblemEq
$cp1Data :: Typeable ProblemEq
Data, Int -> ProblemEq -> ShowS
[ProblemEq] -> ShowS
ProblemEq -> String
(Int -> ProblemEq -> ShowS)
-> (ProblemEq -> String)
-> ([ProblemEq] -> ShowS)
-> Show ProblemEq
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProblemEq] -> ShowS
$cshowList :: [ProblemEq] -> ShowS
show :: ProblemEq -> String
$cshow :: ProblemEq -> String
showsPrec :: Int -> ProblemEq -> ShowS
$cshowsPrec :: Int -> ProblemEq -> ShowS
Show, (forall x. ProblemEq -> Rep ProblemEq x)
-> (forall x. Rep ProblemEq x -> ProblemEq) -> Generic ProblemEq
forall x. Rep ProblemEq x -> ProblemEq
forall x. ProblemEq -> Rep ProblemEq x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProblemEq x -> ProblemEq
$cfrom :: forall x. ProblemEq -> Rep ProblemEq x
Generic)

-- These are not relevant for caching purposes
instance Eq ProblemEq where ProblemEq
_ == :: ProblemEq -> ProblemEq -> Bool
== ProblemEq
_ = Bool
True

-- | We could throw away @where@ clauses at this point and translate them to
--   @let@. It's not obvious how to remember that the @let@ was really a
--   @where@ clause though, so for the time being we keep it here.
data Clause' lhs = Clause
  { Clause' lhs -> lhs
clauseLHS        :: lhs
  , Clause' lhs -> [ProblemEq]
clauseStrippedPats :: [ProblemEq]
      -- ^ Only in with-clauses where we inherit some already checked patterns from the parent.
      --   These live in the context of the parent clause left-hand side.
  , Clause' lhs -> RHS
clauseRHS        :: RHS
  , Clause' lhs -> WhereDeclarations
clauseWhereDecls :: WhereDeclarations
  , Clause' lhs -> Bool
clauseCatchall   :: Bool
  } deriving (Typeable (Clause' lhs)
DataType
Constr
Typeable (Clause' lhs)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Clause' lhs -> c (Clause' lhs))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Clause' lhs))
-> (Clause' lhs -> Constr)
-> (Clause' lhs -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Clause' lhs)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Clause' lhs)))
-> ((forall b. Data b => b -> b) -> Clause' lhs -> Clause' lhs)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Clause' lhs -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Clause' lhs -> r)
-> (forall u. (forall d. Data d => d -> u) -> Clause' lhs -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Clause' lhs -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs))
-> Data (Clause' lhs)
Clause' lhs -> DataType
Clause' lhs -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Clause' lhs))
(forall b. Data b => b -> b) -> Clause' lhs -> Clause' lhs
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Clause' lhs -> c (Clause' lhs)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Clause' lhs)
forall lhs. Data lhs => Typeable (Clause' lhs)
forall lhs. Data lhs => Clause' lhs -> DataType
forall lhs. Data lhs => Clause' lhs -> Constr
forall lhs.
Data lhs =>
(forall b. Data b => b -> b) -> Clause' lhs -> Clause' lhs
forall lhs u.
Data lhs =>
Int -> (forall d. Data d => d -> u) -> Clause' lhs -> u
forall lhs u.
Data lhs =>
(forall d. Data d => d -> u) -> Clause' lhs -> [u]
forall lhs r r'.
Data lhs =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Clause' lhs -> r
forall lhs r r'.
Data lhs =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Clause' lhs -> r
forall lhs (m :: * -> *).
(Data lhs, Monad m) =>
(forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs)
forall lhs (m :: * -> *).
(Data lhs, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs)
forall lhs (c :: * -> *).
Data lhs =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Clause' lhs)
forall lhs (c :: * -> *).
Data lhs =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Clause' lhs -> c (Clause' lhs)
forall lhs (t :: * -> *) (c :: * -> *).
(Data lhs, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Clause' lhs))
forall lhs (t :: * -> * -> *) (c :: * -> *).
(Data lhs, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Clause' lhs))
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) -> Clause' lhs -> u
forall u. (forall d. Data d => d -> u) -> Clause' lhs -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Clause' lhs -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Clause' lhs -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Clause' lhs)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Clause' lhs -> c (Clause' lhs)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Clause' lhs))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Clause' lhs))
$cClause :: Constr
$tClause' :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs)
$cgmapMo :: forall lhs (m :: * -> *).
(Data lhs, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs)
gmapMp :: (forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs)
$cgmapMp :: forall lhs (m :: * -> *).
(Data lhs, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs)
gmapM :: (forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs)
$cgmapM :: forall lhs (m :: * -> *).
(Data lhs, Monad m) =>
(forall d. Data d => d -> m d) -> Clause' lhs -> m (Clause' lhs)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Clause' lhs -> u
$cgmapQi :: forall lhs u.
Data lhs =>
Int -> (forall d. Data d => d -> u) -> Clause' lhs -> u
gmapQ :: (forall d. Data d => d -> u) -> Clause' lhs -> [u]
$cgmapQ :: forall lhs u.
Data lhs =>
(forall d. Data d => d -> u) -> Clause' lhs -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Clause' lhs -> r
$cgmapQr :: forall lhs r r'.
Data lhs =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Clause' lhs -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Clause' lhs -> r
$cgmapQl :: forall lhs r r'.
Data lhs =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Clause' lhs -> r
gmapT :: (forall b. Data b => b -> b) -> Clause' lhs -> Clause' lhs
$cgmapT :: forall lhs.
Data lhs =>
(forall b. Data b => b -> b) -> Clause' lhs -> Clause' lhs
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Clause' lhs))
$cdataCast2 :: forall lhs (t :: * -> * -> *) (c :: * -> *).
(Data lhs, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Clause' lhs))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Clause' lhs))
$cdataCast1 :: forall lhs (t :: * -> *) (c :: * -> *).
(Data lhs, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Clause' lhs))
dataTypeOf :: Clause' lhs -> DataType
$cdataTypeOf :: forall lhs. Data lhs => Clause' lhs -> DataType
toConstr :: Clause' lhs -> Constr
$ctoConstr :: forall lhs. Data lhs => Clause' lhs -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Clause' lhs)
$cgunfold :: forall lhs (c :: * -> *).
Data lhs =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Clause' lhs)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Clause' lhs -> c (Clause' lhs)
$cgfoldl :: forall lhs (c :: * -> *).
Data lhs =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Clause' lhs -> c (Clause' lhs)
$cp1Data :: forall lhs. Data lhs => Typeable (Clause' lhs)
Data, Int -> Clause' lhs -> ShowS
[Clause' lhs] -> ShowS
Clause' lhs -> String
(Int -> Clause' lhs -> ShowS)
-> (Clause' lhs -> String)
-> ([Clause' lhs] -> ShowS)
-> Show (Clause' lhs)
forall lhs. Show lhs => Int -> Clause' lhs -> ShowS
forall lhs. Show lhs => [Clause' lhs] -> ShowS
forall lhs. Show lhs => Clause' lhs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Clause' lhs] -> ShowS
$cshowList :: forall lhs. Show lhs => [Clause' lhs] -> ShowS
show :: Clause' lhs -> String
$cshow :: forall lhs. Show lhs => Clause' lhs -> String
showsPrec :: Int -> Clause' lhs -> ShowS
$cshowsPrec :: forall lhs. Show lhs => Int -> Clause' lhs -> ShowS
Show, a -> Clause' b -> Clause' a
(a -> b) -> Clause' a -> Clause' b
(forall a b. (a -> b) -> Clause' a -> Clause' b)
-> (forall a b. a -> Clause' b -> Clause' a) -> Functor Clause'
forall a b. a -> Clause' b -> Clause' a
forall a b. (a -> b) -> Clause' a -> Clause' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Clause' b -> Clause' a
$c<$ :: forall a b. a -> Clause' b -> Clause' a
fmap :: (a -> b) -> Clause' a -> Clause' b
$cfmap :: forall a b. (a -> b) -> Clause' a -> Clause' b
Functor, Clause' a -> Bool
(a -> m) -> Clause' a -> m
(a -> b -> b) -> b -> Clause' a -> b
(forall m. Monoid m => Clause' m -> m)
-> (forall m a. Monoid m => (a -> m) -> Clause' a -> m)
-> (forall m a. Monoid m => (a -> m) -> Clause' a -> m)
-> (forall a b. (a -> b -> b) -> b -> Clause' a -> b)
-> (forall a b. (a -> b -> b) -> b -> Clause' a -> b)
-> (forall b a. (b -> a -> b) -> b -> Clause' a -> b)
-> (forall b a. (b -> a -> b) -> b -> Clause' a -> b)
-> (forall a. (a -> a -> a) -> Clause' a -> a)
-> (forall a. (a -> a -> a) -> Clause' a -> a)
-> (forall a. Clause' a -> [a])
-> (forall a. Clause' a -> Bool)
-> (forall a. Clause' a -> Int)
-> (forall a. Eq a => a -> Clause' a -> Bool)
-> (forall a. Ord a => Clause' a -> a)
-> (forall a. Ord a => Clause' a -> a)
-> (forall a. Num a => Clause' a -> a)
-> (forall a. Num a => Clause' a -> a)
-> Foldable Clause'
forall a. Eq a => a -> Clause' a -> Bool
forall a. Num a => Clause' a -> a
forall a. Ord a => Clause' a -> a
forall m. Monoid m => Clause' m -> m
forall a. Clause' a -> Bool
forall a. Clause' a -> Int
forall a. Clause' a -> [a]
forall a. (a -> a -> a) -> Clause' a -> a
forall m a. Monoid m => (a -> m) -> Clause' a -> m
forall b a. (b -> a -> b) -> b -> Clause' a -> b
forall a b. (a -> b -> b) -> b -> Clause' 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 :: Clause' a -> a
$cproduct :: forall a. Num a => Clause' a -> a
sum :: Clause' a -> a
$csum :: forall a. Num a => Clause' a -> a
minimum :: Clause' a -> a
$cminimum :: forall a. Ord a => Clause' a -> a
maximum :: Clause' a -> a
$cmaximum :: forall a. Ord a => Clause' a -> a
elem :: a -> Clause' a -> Bool
$celem :: forall a. Eq a => a -> Clause' a -> Bool
length :: Clause' a -> Int
$clength :: forall a. Clause' a -> Int
null :: Clause' a -> Bool
$cnull :: forall a. Clause' a -> Bool
toList :: Clause' a -> [a]
$ctoList :: forall a. Clause' a -> [a]
foldl1 :: (a -> a -> a) -> Clause' a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Clause' a -> a
foldr1 :: (a -> a -> a) -> Clause' a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Clause' a -> a
foldl' :: (b -> a -> b) -> b -> Clause' a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Clause' a -> b
foldl :: (b -> a -> b) -> b -> Clause' a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Clause' a -> b
foldr' :: (a -> b -> b) -> b -> Clause' a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Clause' a -> b
foldr :: (a -> b -> b) -> b -> Clause' a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Clause' a -> b
foldMap' :: (a -> m) -> Clause' a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Clause' a -> m
foldMap :: (a -> m) -> Clause' a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Clause' a -> m
fold :: Clause' m -> m
$cfold :: forall m. Monoid m => Clause' m -> m
Foldable, Functor Clause'
Foldable Clause'
Functor Clause'
-> Foldable Clause'
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Clause' a -> f (Clause' b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Clause' (f a) -> f (Clause' a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Clause' a -> m (Clause' b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Clause' (m a) -> m (Clause' a))
-> Traversable Clause'
(a -> f b) -> Clause' a -> f (Clause' 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 => Clause' (m a) -> m (Clause' a)
forall (f :: * -> *) a.
Applicative f =>
Clause' (f a) -> f (Clause' a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Clause' a -> m (Clause' b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Clause' a -> f (Clause' b)
sequence :: Clause' (m a) -> m (Clause' a)
$csequence :: forall (m :: * -> *) a. Monad m => Clause' (m a) -> m (Clause' a)
mapM :: (a -> m b) -> Clause' a -> m (Clause' b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Clause' a -> m (Clause' b)
sequenceA :: Clause' (f a) -> f (Clause' a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Clause' (f a) -> f (Clause' a)
traverse :: (a -> f b) -> Clause' a -> f (Clause' b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Clause' a -> f (Clause' b)
$cp2Traversable :: Foldable Clause'
$cp1Traversable :: Functor Clause'
Traversable, Clause' lhs -> Clause' lhs -> Bool
(Clause' lhs -> Clause' lhs -> Bool)
-> (Clause' lhs -> Clause' lhs -> Bool) -> Eq (Clause' lhs)
forall lhs. Eq lhs => Clause' lhs -> Clause' lhs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Clause' lhs -> Clause' lhs -> Bool
$c/= :: forall lhs. Eq lhs => Clause' lhs -> Clause' lhs -> Bool
== :: Clause' lhs -> Clause' lhs -> Bool
$c== :: forall lhs. Eq lhs => Clause' lhs -> Clause' lhs -> Bool
Eq, (forall x. Clause' lhs -> Rep (Clause' lhs) x)
-> (forall x. Rep (Clause' lhs) x -> Clause' lhs)
-> Generic (Clause' lhs)
forall x. Rep (Clause' lhs) x -> Clause' lhs
forall x. Clause' lhs -> Rep (Clause' lhs) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall lhs x. Rep (Clause' lhs) x -> Clause' lhs
forall lhs x. Clause' lhs -> Rep (Clause' lhs) x
$cto :: forall lhs x. Rep (Clause' lhs) x -> Clause' lhs
$cfrom :: forall lhs x. Clause' lhs -> Rep (Clause' lhs) x
Generic)

data WhereDeclarations = WhereDecls
  { WhereDeclarations -> Maybe ModuleName
whereModule :: Maybe ModuleName
      -- #2897: we need to restrict named where modules in refined contexts,
      --        so remember whether it was named here
  , WhereDeclarations -> Maybe Declaration
whereDecls  :: Maybe Declaration
      -- ^ The declaration is a 'Section'.
  } deriving (Typeable WhereDeclarations
DataType
Constr
Typeable WhereDeclarations
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> WhereDeclarations
    -> c WhereDeclarations)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c WhereDeclarations)
-> (WhereDeclarations -> Constr)
-> (WhereDeclarations -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c WhereDeclarations))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c WhereDeclarations))
-> ((forall b. Data b => b -> b)
    -> WhereDeclarations -> WhereDeclarations)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> WhereDeclarations -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> WhereDeclarations -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> WhereDeclarations -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> WhereDeclarations -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> WhereDeclarations -> m WhereDeclarations)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WhereDeclarations -> m WhereDeclarations)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WhereDeclarations -> m WhereDeclarations)
-> Data WhereDeclarations
WhereDeclarations -> DataType
WhereDeclarations -> Constr
(forall b. Data b => b -> b)
-> WhereDeclarations -> WhereDeclarations
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WhereDeclarations -> c WhereDeclarations
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WhereDeclarations
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) -> WhereDeclarations -> u
forall u. (forall d. Data d => d -> u) -> WhereDeclarations -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereDeclarations -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereDeclarations -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> WhereDeclarations -> m WhereDeclarations
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WhereDeclarations -> m WhereDeclarations
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WhereDeclarations
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WhereDeclarations -> c WhereDeclarations
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WhereDeclarations)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c WhereDeclarations)
$cWhereDecls :: Constr
$tWhereDeclarations :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> WhereDeclarations -> m WhereDeclarations
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WhereDeclarations -> m WhereDeclarations
gmapMp :: (forall d. Data d => d -> m d)
-> WhereDeclarations -> m WhereDeclarations
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WhereDeclarations -> m WhereDeclarations
gmapM :: (forall d. Data d => d -> m d)
-> WhereDeclarations -> m WhereDeclarations
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> WhereDeclarations -> m WhereDeclarations
gmapQi :: Int -> (forall d. Data d => d -> u) -> WhereDeclarations -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> WhereDeclarations -> u
gmapQ :: (forall d. Data d => d -> u) -> WhereDeclarations -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> WhereDeclarations -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereDeclarations -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereDeclarations -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereDeclarations -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereDeclarations -> r
gmapT :: (forall b. Data b => b -> b)
-> WhereDeclarations -> WhereDeclarations
$cgmapT :: (forall b. Data b => b -> b)
-> WhereDeclarations -> WhereDeclarations
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c WhereDeclarations)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c WhereDeclarations)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c WhereDeclarations)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WhereDeclarations)
dataTypeOf :: WhereDeclarations -> DataType
$cdataTypeOf :: WhereDeclarations -> DataType
toConstr :: WhereDeclarations -> Constr
$ctoConstr :: WhereDeclarations -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WhereDeclarations
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WhereDeclarations
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WhereDeclarations -> c WhereDeclarations
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WhereDeclarations -> c WhereDeclarations
$cp1Data :: Typeable WhereDeclarations
Data, Int -> WhereDeclarations -> ShowS
[WhereDeclarations] -> ShowS
WhereDeclarations -> String
(Int -> WhereDeclarations -> ShowS)
-> (WhereDeclarations -> String)
-> ([WhereDeclarations] -> ShowS)
-> Show WhereDeclarations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WhereDeclarations] -> ShowS
$cshowList :: [WhereDeclarations] -> ShowS
show :: WhereDeclarations -> String
$cshow :: WhereDeclarations -> String
showsPrec :: Int -> WhereDeclarations -> ShowS
$cshowsPrec :: Int -> WhereDeclarations -> ShowS
Show, WhereDeclarations -> WhereDeclarations -> Bool
(WhereDeclarations -> WhereDeclarations -> Bool)
-> (WhereDeclarations -> WhereDeclarations -> Bool)
-> Eq WhereDeclarations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WhereDeclarations -> WhereDeclarations -> Bool
$c/= :: WhereDeclarations -> WhereDeclarations -> Bool
== :: WhereDeclarations -> WhereDeclarations -> Bool
$c== :: WhereDeclarations -> WhereDeclarations -> Bool
Eq, (forall x. WhereDeclarations -> Rep WhereDeclarations x)
-> (forall x. Rep WhereDeclarations x -> WhereDeclarations)
-> Generic WhereDeclarations
forall x. Rep WhereDeclarations x -> WhereDeclarations
forall x. WhereDeclarations -> Rep WhereDeclarations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WhereDeclarations x -> WhereDeclarations
$cfrom :: forall x. WhereDeclarations -> Rep WhereDeclarations x
Generic)

instance Null WhereDeclarations where
  empty :: WhereDeclarations
empty = Maybe ModuleName -> Maybe Declaration -> WhereDeclarations
WhereDecls Maybe ModuleName
forall a. Null a => a
empty Maybe Declaration
forall a. Null a => a
empty

noWhereDecls :: WhereDeclarations
noWhereDecls :: WhereDeclarations
noWhereDecls = WhereDeclarations
forall a. Null a => a
empty

type Clause = Clause' LHS
type SpineClause = Clause' SpineLHS
type RewriteEqn  = RewriteEqn' QName BindName Pattern Expr
type WithExpr' e = Named BindName (Arg e)
type WithExpr    = WithExpr' Expr

data RHS
  = RHS
    { RHS -> Expr
rhsExpr     :: Expr
    , RHS -> Maybe Expr
rhsConcrete :: Maybe C.Expr
      -- ^ We store the original concrete expression in case
      --   we have to reproduce it during interactive case splitting.
      --   'Nothing' for internally generated rhss.
    }
  | AbsurdRHS
  | WithRHS QName [WithExpr] [Clause]
      -- ^ The 'QName' is the name of the with function.
  | RewriteRHS
    { RHS -> [RewriteEqn]
rewriteExprs      :: [RewriteEqn]
      -- ^ The 'QName's are the names of the generated with functions,
      --   one for each 'Expr'.
    , RHS -> [ProblemEq]
rewriteStrippedPats :: [ProblemEq]
      -- ^ The patterns stripped by with-desugaring. These are only present
      --   if this rewrite follows a with.
    , RHS -> RHS
rewriteRHS        :: RHS
      -- ^ The RHS should not be another @RewriteRHS@.
    , RHS -> WhereDeclarations
rewriteWhereDecls :: WhereDeclarations
      -- ^ The where clauses are attached to the @RewriteRHS@ by
      ---  the scope checker (instead of to the clause).
    }
  deriving (Typeable RHS
DataType
Constr
Typeable RHS
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> RHS -> c RHS)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c RHS)
-> (RHS -> Constr)
-> (RHS -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c RHS))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RHS))
-> ((forall b. Data b => b -> b) -> RHS -> RHS)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RHS -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RHS -> r)
-> (forall u. (forall d. Data d => d -> u) -> RHS -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> RHS -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> RHS -> m RHS)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> RHS -> m RHS)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> RHS -> m RHS)
-> Data RHS
RHS -> DataType
RHS -> Constr
(forall b. Data b => b -> b) -> RHS -> RHS
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RHS -> c RHS
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RHS
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) -> RHS -> u
forall u. (forall d. Data d => d -> u) -> RHS -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RHS -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RHS -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RHS -> m RHS
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RHS -> m RHS
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RHS
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RHS -> c RHS
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RHS)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RHS)
$cRewriteRHS :: Constr
$cWithRHS :: Constr
$cAbsurdRHS :: Constr
$cRHS :: Constr
$tRHS :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> RHS -> m RHS
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RHS -> m RHS
gmapMp :: (forall d. Data d => d -> m d) -> RHS -> m RHS
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RHS -> m RHS
gmapM :: (forall d. Data d => d -> m d) -> RHS -> m RHS
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RHS -> m RHS
gmapQi :: Int -> (forall d. Data d => d -> u) -> RHS -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> RHS -> u
gmapQ :: (forall d. Data d => d -> u) -> RHS -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> RHS -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RHS -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RHS -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RHS -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RHS -> r
gmapT :: (forall b. Data b => b -> b) -> RHS -> RHS
$cgmapT :: (forall b. Data b => b -> b) -> RHS -> RHS
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RHS)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RHS)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c RHS)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RHS)
dataTypeOf :: RHS -> DataType
$cdataTypeOf :: RHS -> DataType
toConstr :: RHS -> Constr
$ctoConstr :: RHS -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RHS
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RHS
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RHS -> c RHS
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RHS -> c RHS
$cp1Data :: Typeable RHS
Data, Int -> RHS -> ShowS
[RHS] -> ShowS
RHS -> String
(Int -> RHS -> ShowS)
-> (RHS -> String) -> ([RHS] -> ShowS) -> Show RHS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RHS] -> ShowS
$cshowList :: [RHS] -> ShowS
show :: RHS -> String
$cshow :: RHS -> String
showsPrec :: Int -> RHS -> ShowS
$cshowsPrec :: Int -> RHS -> ShowS
Show, (forall x. RHS -> Rep RHS x)
-> (forall x. Rep RHS x -> RHS) -> Generic RHS
forall x. Rep RHS x -> RHS
forall x. RHS -> Rep RHS x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RHS x -> RHS
$cfrom :: forall x. RHS -> Rep RHS x
Generic)

-- | Ignore 'rhsConcrete' when comparing 'RHS's.
instance Eq RHS where
  RHS Expr
e Maybe Expr
_          == :: RHS -> RHS -> Bool
== RHS Expr
e' Maybe Expr
_            = Expr
e Expr -> Expr -> Bool
forall a. Eq a => a -> a -> Bool
== Expr
e'
  RHS
AbsurdRHS        == RHS
AbsurdRHS           = Bool
True
  WithRHS QName
a [WithExpr]
b [Clause]
c    == WithRHS QName
a' [WithExpr]
b' [Clause]
c'    = (QName
a QName -> QName -> Bool
forall a. Eq a => a -> a -> Bool
== QName
a') Bool -> Bool -> Bool
&& ([WithExpr]
b [WithExpr] -> [WithExpr] -> Bool
forall a. Eq a => a -> a -> Bool
== [WithExpr]
b') Bool -> Bool -> Bool
&& ([Clause]
c [Clause] -> [Clause] -> Bool
forall a. Eq a => a -> a -> Bool
== [Clause]
c')
  RewriteRHS [RewriteEqn]
a [ProblemEq]
b RHS
c WhereDeclarations
d == RewriteRHS [RewriteEqn]
a' [ProblemEq]
b' RHS
c' WhereDeclarations
d' = [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and [ [RewriteEqn]
a [RewriteEqn] -> [RewriteEqn] -> Bool
forall a. Eq a => a -> a -> Bool
== [RewriteEqn]
a', [ProblemEq]
b [ProblemEq] -> [ProblemEq] -> Bool
forall a. Eq a => a -> a -> Bool
== [ProblemEq]
b', RHS
c RHS -> RHS -> Bool
forall a. Eq a => a -> a -> Bool
== RHS
c' , WhereDeclarations
d WhereDeclarations -> WhereDeclarations -> Bool
forall a. Eq a => a -> a -> Bool
== WhereDeclarations
d' ]
  RHS
_                == RHS
_                   = Bool
False

-- | The lhs of a clause in spine view (inside-out).
--   Projection patterns are contained in @spLhsPats@,
--   represented as @ProjP d@.
data SpineLHS = SpineLHS
  { SpineLHS -> LHSInfo
spLhsInfo     :: LHSInfo             -- ^ Range.
  , SpineLHS -> QName
spLhsDefName  :: QName               -- ^ Name of function we are defining.
  , SpineLHS -> [NamedArg Pattern]
spLhsPats     :: [NamedArg Pattern]  -- ^ Elimination by pattern, projections, with-patterns.
  }
  deriving (Typeable SpineLHS
DataType
Constr
Typeable SpineLHS
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SpineLHS -> c SpineLHS)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SpineLHS)
-> (SpineLHS -> Constr)
-> (SpineLHS -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SpineLHS))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SpineLHS))
-> ((forall b. Data b => b -> b) -> SpineLHS -> SpineLHS)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SpineLHS -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SpineLHS -> r)
-> (forall u. (forall d. Data d => d -> u) -> SpineLHS -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> SpineLHS -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS)
-> Data SpineLHS
SpineLHS -> DataType
SpineLHS -> Constr
(forall b. Data b => b -> b) -> SpineLHS -> SpineLHS
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SpineLHS -> c SpineLHS
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SpineLHS
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) -> SpineLHS -> u
forall u. (forall d. Data d => d -> u) -> SpineLHS -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SpineLHS -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SpineLHS -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SpineLHS
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SpineLHS -> c SpineLHS
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SpineLHS)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SpineLHS)
$cSpineLHS :: Constr
$tSpineLHS :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS
gmapMp :: (forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS
gmapM :: (forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SpineLHS -> m SpineLHS
gmapQi :: Int -> (forall d. Data d => d -> u) -> SpineLHS -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SpineLHS -> u
gmapQ :: (forall d. Data d => d -> u) -> SpineLHS -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SpineLHS -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SpineLHS -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SpineLHS -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SpineLHS -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SpineLHS -> r
gmapT :: (forall b. Data b => b -> b) -> SpineLHS -> SpineLHS
$cgmapT :: (forall b. Data b => b -> b) -> SpineLHS -> SpineLHS
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SpineLHS)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SpineLHS)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c SpineLHS)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SpineLHS)
dataTypeOf :: SpineLHS -> DataType
$cdataTypeOf :: SpineLHS -> DataType
toConstr :: SpineLHS -> Constr
$ctoConstr :: SpineLHS -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SpineLHS
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SpineLHS
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SpineLHS -> c SpineLHS
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SpineLHS -> c SpineLHS
$cp1Data :: Typeable SpineLHS
Data, Int -> SpineLHS -> ShowS
[SpineLHS] -> ShowS
SpineLHS -> String
(Int -> SpineLHS -> ShowS)
-> (SpineLHS -> String) -> ([SpineLHS] -> ShowS) -> Show SpineLHS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SpineLHS] -> ShowS
$cshowList :: [SpineLHS] -> ShowS
show :: SpineLHS -> String
$cshow :: SpineLHS -> String
showsPrec :: Int -> SpineLHS -> ShowS
$cshowsPrec :: Int -> SpineLHS -> ShowS
Show, SpineLHS -> SpineLHS -> Bool
(SpineLHS -> SpineLHS -> Bool)
-> (SpineLHS -> SpineLHS -> Bool) -> Eq SpineLHS
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SpineLHS -> SpineLHS -> Bool
$c/= :: SpineLHS -> SpineLHS -> Bool
== :: SpineLHS -> SpineLHS -> Bool
$c== :: SpineLHS -> SpineLHS -> Bool
Eq, (forall x. SpineLHS -> Rep SpineLHS x)
-> (forall x. Rep SpineLHS x -> SpineLHS) -> Generic SpineLHS
forall x. Rep SpineLHS x -> SpineLHS
forall x. SpineLHS -> Rep SpineLHS x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SpineLHS x -> SpineLHS
$cfrom :: forall x. SpineLHS -> Rep SpineLHS x
Generic)

-- | Ignore 'Range' when comparing 'LHS's.
instance Eq LHS where
  LHS LHSInfo
_ LHSCore
core == :: LHS -> LHS -> Bool
== LHS LHSInfo
_ LHSCore
core' = LHSCore
core LHSCore -> LHSCore -> Bool
forall a. Eq a => a -> a -> Bool
== LHSCore
core'

-- | The lhs of a clause in focused (projection-application) view (outside-in).
--   Projection patters are represented as 'LHSProj's.
data LHS = LHS
  { LHS -> LHSInfo
lhsInfo     :: LHSInfo               -- ^ Range.
  , LHS -> LHSCore
lhsCore     :: LHSCore               -- ^ Copatterns.
  }
  deriving (Typeable LHS
DataType
Constr
Typeable LHS
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LHS -> c LHS)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LHS)
-> (LHS -> Constr)
-> (LHS -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LHS))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LHS))
-> ((forall b. Data b => b -> b) -> LHS -> LHS)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LHS -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LHS -> r)
-> (forall u. (forall d. Data d => d -> u) -> LHS -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> LHS -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> LHS -> m LHS)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LHS -> m LHS)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LHS -> m LHS)
-> Data LHS
LHS -> DataType
LHS -> Constr
(forall b. Data b => b -> b) -> LHS -> LHS
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHS -> c LHS
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LHS
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) -> LHS -> u
forall u. (forall d. Data d => d -> u) -> LHS -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LHS -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LHS -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LHS -> m LHS
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LHS -> m LHS
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LHS
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHS -> c LHS
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LHS)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LHS)
$cLHS :: Constr
$tLHS :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> LHS -> m LHS
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LHS -> m LHS
gmapMp :: (forall d. Data d => d -> m d) -> LHS -> m LHS
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LHS -> m LHS
gmapM :: (forall d. Data d => d -> m d) -> LHS -> m LHS
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LHS -> m LHS
gmapQi :: Int -> (forall d. Data d => d -> u) -> LHS -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LHS -> u
gmapQ :: (forall d. Data d => d -> u) -> LHS -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LHS -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LHS -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LHS -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LHS -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LHS -> r
gmapT :: (forall b. Data b => b -> b) -> LHS -> LHS
$cgmapT :: (forall b. Data b => b -> b) -> LHS -> LHS
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LHS)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LHS)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c LHS)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LHS)
dataTypeOf :: LHS -> DataType
$cdataTypeOf :: LHS -> DataType
toConstr :: LHS -> Constr
$ctoConstr :: LHS -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LHS
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LHS
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHS -> c LHS
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHS -> c LHS
$cp1Data :: Typeable LHS
Data, Int -> LHS -> ShowS
[LHS] -> ShowS
LHS -> String
(Int -> LHS -> ShowS)
-> (LHS -> String) -> ([LHS] -> ShowS) -> Show LHS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LHS] -> ShowS
$cshowList :: [LHS] -> ShowS
show :: LHS -> String
$cshow :: LHS -> String
showsPrec :: Int -> LHS -> ShowS
$cshowsPrec :: Int -> LHS -> ShowS
Show, (forall x. LHS -> Rep LHS x)
-> (forall x. Rep LHS x -> LHS) -> Generic LHS
forall x. Rep LHS x -> LHS
forall x. LHS -> Rep LHS x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LHS x -> LHS
$cfrom :: forall x. LHS -> Rep LHS x
Generic)

-- | The lhs in projection-application and with-pattern view.
--   Parameterised over the type @e@ of dot patterns.
data LHSCore' e
    -- | The head applied to ordinary patterns.
  = LHSHead  { LHSCore' e -> QName
lhsDefName  :: QName
                 -- ^ Head @f@.
             , LHSCore' e -> [NamedArg (Pattern' e)]
lhsPats     :: [NamedArg (Pattern' e)]
                 -- ^ Applied to patterns @ps@.
             }
    -- | Projection.
  | LHSProj  { LHSCore' e -> AmbiguousQName
lhsDestructor :: AmbiguousQName
                 -- ^ Record projection identifier.
             , LHSCore' e -> NamedArg (LHSCore' e)
lhsFocus      :: NamedArg (LHSCore' e)
                 -- ^ Main argument of projection.
             , lhsPats       :: [NamedArg (Pattern' e)]
                 -- ^ Further applied to patterns.
             }
    -- | With patterns.
  | LHSWith  { LHSCore' e -> LHSCore' e
lhsHead         :: LHSCore' e
                 -- ^ E.g. the 'LHSHead'.
             , LHSCore' e -> [Arg (Pattern' e)]
lhsWithPatterns :: [Arg (Pattern' e)]
                 -- ^ Applied to with patterns @| p1 | ... | pn@.
                 --   These patterns are not prefixed with @WithP@!
             , lhsPats         :: [NamedArg (Pattern' e)]
                 -- ^ Further applied to patterns.
             }
  deriving (Typeable (LHSCore' e)
DataType
Constr
Typeable (LHSCore' e)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LHSCore' e -> c (LHSCore' e))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (LHSCore' e))
-> (LHSCore' e -> Constr)
-> (LHSCore' e -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (LHSCore' e)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (LHSCore' e)))
-> ((forall b. Data b => b -> b) -> LHSCore' e -> LHSCore' e)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LHSCore' e -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LHSCore' e -> r)
-> (forall u. (forall d. Data d => d -> u) -> LHSCore' e -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> LHSCore' e -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e))
-> Data (LHSCore' e)
LHSCore' e -> DataType
LHSCore' e -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (LHSCore' e))
(forall b. Data b => b -> b) -> LHSCore' e -> LHSCore' e
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHSCore' e -> c (LHSCore' e)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LHSCore' e)
forall e. Data e => Typeable (LHSCore' e)
forall e. Data e => LHSCore' e -> DataType
forall e. Data e => LHSCore' e -> Constr
forall e.
Data e =>
(forall b. Data b => b -> b) -> LHSCore' e -> LHSCore' e
forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> LHSCore' e -> u
forall e u.
Data e =>
(forall d. Data d => d -> u) -> LHSCore' e -> [u]
forall e r r'.
Data e =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore' e -> r
forall e r r'.
Data e =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore' e -> r
forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e)
forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e)
forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LHSCore' e)
forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHSCore' e -> c (LHSCore' e)
forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (LHSCore' e))
forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LHSCore' 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) -> LHSCore' e -> u
forall u. (forall d. Data d => d -> u) -> LHSCore' e -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore' e -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore' e -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LHSCore' e)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHSCore' e -> c (LHSCore' e)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (LHSCore' e))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LHSCore' e))
$cLHSWith :: Constr
$cLHSProj :: Constr
$cLHSHead :: Constr
$tLHSCore' :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e)
$cgmapMo :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e)
gmapMp :: (forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e)
$cgmapMp :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e)
gmapM :: (forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e)
$cgmapM :: forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d) -> LHSCore' e -> m (LHSCore' e)
gmapQi :: Int -> (forall d. Data d => d -> u) -> LHSCore' e -> u
$cgmapQi :: forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> LHSCore' e -> u
gmapQ :: (forall d. Data d => d -> u) -> LHSCore' e -> [u]
$cgmapQ :: forall e u.
Data e =>
(forall d. Data d => d -> u) -> LHSCore' e -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore' e -> r
$cgmapQr :: forall e r r'.
Data e =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore' e -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore' e -> r
$cgmapQl :: forall e r r'.
Data e =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore' e -> r
gmapT :: (forall b. Data b => b -> b) -> LHSCore' e -> LHSCore' e
$cgmapT :: forall e.
Data e =>
(forall b. Data b => b -> b) -> LHSCore' e -> LHSCore' e
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LHSCore' e))
$cdataCast2 :: forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LHSCore' e))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (LHSCore' e))
$cdataCast1 :: forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (LHSCore' e))
dataTypeOf :: LHSCore' e -> DataType
$cdataTypeOf :: forall e. Data e => LHSCore' e -> DataType
toConstr :: LHSCore' e -> Constr
$ctoConstr :: forall e. Data e => LHSCore' e -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LHSCore' e)
$cgunfold :: forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LHSCore' e)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHSCore' e -> c (LHSCore' e)
$cgfoldl :: forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHSCore' e -> c (LHSCore' e)
$cp1Data :: forall e. Data e => Typeable (LHSCore' e)
Data, Int -> LHSCore' e -> ShowS
[LHSCore' e] -> ShowS
LHSCore' e -> String
(Int -> LHSCore' e -> ShowS)
-> (LHSCore' e -> String)
-> ([LHSCore' e] -> ShowS)
-> Show (LHSCore' e)
forall e. Show e => Int -> LHSCore' e -> ShowS
forall e. Show e => [LHSCore' e] -> ShowS
forall e. Show e => LHSCore' e -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LHSCore' e] -> ShowS
$cshowList :: forall e. Show e => [LHSCore' e] -> ShowS
show :: LHSCore' e -> String
$cshow :: forall e. Show e => LHSCore' e -> String
showsPrec :: Int -> LHSCore' e -> ShowS
$cshowsPrec :: forall e. Show e => Int -> LHSCore' e -> ShowS
Show, a -> LHSCore' b -> LHSCore' a
(a -> b) -> LHSCore' a -> LHSCore' b
(forall a b. (a -> b) -> LHSCore' a -> LHSCore' b)
-> (forall a b. a -> LHSCore' b -> LHSCore' a) -> Functor LHSCore'
forall a b. a -> LHSCore' b -> LHSCore' a
forall a b. (a -> b) -> LHSCore' a -> LHSCore' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> LHSCore' b -> LHSCore' a
$c<$ :: forall a b. a -> LHSCore' b -> LHSCore' a
fmap :: (a -> b) -> LHSCore' a -> LHSCore' b
$cfmap :: forall a b. (a -> b) -> LHSCore' a -> LHSCore' b
Functor, LHSCore' a -> Bool
(a -> m) -> LHSCore' a -> m
(a -> b -> b) -> b -> LHSCore' a -> b
(forall m. Monoid m => LHSCore' m -> m)
-> (forall m a. Monoid m => (a -> m) -> LHSCore' a -> m)
-> (forall m a. Monoid m => (a -> m) -> LHSCore' a -> m)
-> (forall a b. (a -> b -> b) -> b -> LHSCore' a -> b)
-> (forall a b. (a -> b -> b) -> b -> LHSCore' a -> b)
-> (forall b a. (b -> a -> b) -> b -> LHSCore' a -> b)
-> (forall b a. (b -> a -> b) -> b -> LHSCore' a -> b)
-> (forall a. (a -> a -> a) -> LHSCore' a -> a)
-> (forall a. (a -> a -> a) -> LHSCore' a -> a)
-> (forall a. LHSCore' a -> [a])
-> (forall a. LHSCore' a -> Bool)
-> (forall a. LHSCore' a -> Int)
-> (forall a. Eq a => a -> LHSCore' a -> Bool)
-> (forall a. Ord a => LHSCore' a -> a)
-> (forall a. Ord a => LHSCore' a -> a)
-> (forall a. Num a => LHSCore' a -> a)
-> (forall a. Num a => LHSCore' a -> a)
-> Foldable LHSCore'
forall a. Eq a => a -> LHSCore' a -> Bool
forall a. Num a => LHSCore' a -> a
forall a. Ord a => LHSCore' a -> a
forall m. Monoid m => LHSCore' m -> m
forall a. LHSCore' a -> Bool
forall a. LHSCore' a -> Int
forall a. LHSCore' a -> [a]
forall a. (a -> a -> a) -> LHSCore' a -> a
forall m a. Monoid m => (a -> m) -> LHSCore' a -> m
forall b a. (b -> a -> b) -> b -> LHSCore' a -> b
forall a b. (a -> b -> b) -> b -> LHSCore' 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 :: LHSCore' a -> a
$cproduct :: forall a. Num a => LHSCore' a -> a
sum :: LHSCore' a -> a
$csum :: forall a. Num a => LHSCore' a -> a
minimum :: LHSCore' a -> a
$cminimum :: forall a. Ord a => LHSCore' a -> a
maximum :: LHSCore' a -> a
$cmaximum :: forall a. Ord a => LHSCore' a -> a
elem :: a -> LHSCore' a -> Bool
$celem :: forall a. Eq a => a -> LHSCore' a -> Bool
length :: LHSCore' a -> Int
$clength :: forall a. LHSCore' a -> Int
null :: LHSCore' a -> Bool
$cnull :: forall a. LHSCore' a -> Bool
toList :: LHSCore' a -> [a]
$ctoList :: forall a. LHSCore' a -> [a]
foldl1 :: (a -> a -> a) -> LHSCore' a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> LHSCore' a -> a
foldr1 :: (a -> a -> a) -> LHSCore' a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> LHSCore' a -> a
foldl' :: (b -> a -> b) -> b -> LHSCore' a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> LHSCore' a -> b
foldl :: (b -> a -> b) -> b -> LHSCore' a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> LHSCore' a -> b
foldr' :: (a -> b -> b) -> b -> LHSCore' a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> LHSCore' a -> b
foldr :: (a -> b -> b) -> b -> LHSCore' a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> LHSCore' a -> b
foldMap' :: (a -> m) -> LHSCore' a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> LHSCore' a -> m
foldMap :: (a -> m) -> LHSCore' a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> LHSCore' a -> m
fold :: LHSCore' m -> m
$cfold :: forall m. Monoid m => LHSCore' m -> m
Foldable, Functor LHSCore'
Foldable LHSCore'
Functor LHSCore'
-> Foldable LHSCore'
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> LHSCore' a -> f (LHSCore' b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    LHSCore' (f a) -> f (LHSCore' a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> LHSCore' a -> m (LHSCore' b))
-> (forall (m :: * -> *) a.
    Monad m =>
    LHSCore' (m a) -> m (LHSCore' a))
-> Traversable LHSCore'
(a -> f b) -> LHSCore' a -> f (LHSCore' 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 => LHSCore' (m a) -> m (LHSCore' a)
forall (f :: * -> *) a.
Applicative f =>
LHSCore' (f a) -> f (LHSCore' a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> LHSCore' a -> m (LHSCore' b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> LHSCore' a -> f (LHSCore' b)
sequence :: LHSCore' (m a) -> m (LHSCore' a)
$csequence :: forall (m :: * -> *) a. Monad m => LHSCore' (m a) -> m (LHSCore' a)
mapM :: (a -> m b) -> LHSCore' a -> m (LHSCore' b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> LHSCore' a -> m (LHSCore' b)
sequenceA :: LHSCore' (f a) -> f (LHSCore' a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
LHSCore' (f a) -> f (LHSCore' a)
traverse :: (a -> f b) -> LHSCore' a -> f (LHSCore' b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> LHSCore' a -> f (LHSCore' b)
$cp2Traversable :: Foldable LHSCore'
$cp1Traversable :: Functor LHSCore'
Traversable, LHSCore' e -> LHSCore' e -> Bool
(LHSCore' e -> LHSCore' e -> Bool)
-> (LHSCore' e -> LHSCore' e -> Bool) -> Eq (LHSCore' e)
forall e. Eq e => LHSCore' e -> LHSCore' e -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LHSCore' e -> LHSCore' e -> Bool
$c/= :: forall e. Eq e => LHSCore' e -> LHSCore' e -> Bool
== :: LHSCore' e -> LHSCore' e -> Bool
$c== :: forall e. Eq e => LHSCore' e -> LHSCore' e -> Bool
Eq, (forall x. LHSCore' e -> Rep (LHSCore' e) x)
-> (forall x. Rep (LHSCore' e) x -> LHSCore' e)
-> Generic (LHSCore' e)
forall x. Rep (LHSCore' e) x -> LHSCore' e
forall x. LHSCore' e -> Rep (LHSCore' e) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall e x. Rep (LHSCore' e) x -> LHSCore' e
forall e x. LHSCore' e -> Rep (LHSCore' e) x
$cto :: forall e x. Rep (LHSCore' e) x -> LHSCore' e
$cfrom :: forall e x. LHSCore' e -> Rep (LHSCore' e) x
Generic)

type LHSCore = LHSCore' Expr

---------------------------------------------------------------------------
-- * Patterns
---------------------------------------------------------------------------

-- | Parameterised over the type of dot patterns.
data Pattern' e
  = VarP BindName
  | ConP ConPatInfo AmbiguousQName (NAPs e)
  | ProjP PatInfo ProjOrigin AmbiguousQName
    -- ^ Destructor pattern @d@.
  | DefP PatInfo AmbiguousQName (NAPs e)
    -- ^ Defined pattern: function definition @f ps@.
    --   It is also abused to convert destructor patterns into concrete syntax
    --   thus, we put AmbiguousQName here as well.
  | WildP PatInfo
    -- ^ Underscore pattern entered by user.
    --   Or generated at type checking for implicit arguments.
  | AsP PatInfo BindName (Pattern' e)
  | DotP PatInfo e
    -- ^ Dot pattern @.e@
  | AbsurdP PatInfo
  | LitP PatInfo Literal
  | PatternSynP PatInfo AmbiguousQName (NAPs e)
  | RecP PatInfo [FieldAssignment' (Pattern' e)]
  | EqualP PatInfo [(e, e)]
  | WithP PatInfo (Pattern' e)  -- ^ @| p@, for with-patterns.
  | AnnP PatInfo e (Pattern' e) -- ^ Pattern with type annotation
  deriving (Typeable (Pattern' e)
DataType
Constr
Typeable (Pattern' e)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Pattern' e -> c (Pattern' e))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Pattern' e))
-> (Pattern' e -> Constr)
-> (Pattern' e -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Pattern' e)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Pattern' e)))
-> ((forall b. Data b => b -> b) -> Pattern' e -> Pattern' e)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Pattern' e -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Pattern' e -> r)
-> (forall u. (forall d. Data d => d -> u) -> Pattern' e -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Pattern' e -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e))
-> Data (Pattern' e)
Pattern' e -> DataType
Pattern' e -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Pattern' e))
(forall b. Data b => b -> b) -> Pattern' e -> Pattern' e
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern' e -> c (Pattern' e)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pattern' e)
forall e. Data e => Typeable (Pattern' e)
forall e. Data e => Pattern' e -> DataType
forall e. Data e => Pattern' e -> Constr
forall e.
Data e =>
(forall b. Data b => b -> b) -> Pattern' e -> Pattern' e
forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> Pattern' e -> u
forall e u.
Data e =>
(forall d. Data d => d -> u) -> Pattern' e -> [u]
forall e r r'.
Data e =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern' e -> r
forall e r r'.
Data e =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern' e -> r
forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e)
forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e)
forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pattern' e)
forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern' e -> c (Pattern' e)
forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Pattern' e))
forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Pattern' 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) -> Pattern' e -> u
forall u. (forall d. Data d => d -> u) -> Pattern' e -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern' e -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern' e -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pattern' e)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern' e -> c (Pattern' e)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Pattern' e))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Pattern' e))
$cAnnP :: Constr
$cWithP :: Constr
$cEqualP :: Constr
$cRecP :: Constr
$cPatternSynP :: Constr
$cLitP :: Constr
$cAbsurdP :: Constr
$cDotP :: Constr
$cAsP :: Constr
$cWildP :: Constr
$cDefP :: Constr
$cProjP :: Constr
$cConP :: Constr
$cVarP :: Constr
$tPattern' :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e)
$cgmapMo :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e)
gmapMp :: (forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e)
$cgmapMp :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e)
gmapM :: (forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e)
$cgmapM :: forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d) -> Pattern' e -> m (Pattern' e)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Pattern' e -> u
$cgmapQi :: forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> Pattern' e -> u
gmapQ :: (forall d. Data d => d -> u) -> Pattern' e -> [u]
$cgmapQ :: forall e u.
Data e =>
(forall d. Data d => d -> u) -> Pattern' e -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern' e -> r
$cgmapQr :: forall e r r'.
Data e =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern' e -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern' e -> r
$cgmapQl :: forall e r r'.
Data e =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern' e -> r
gmapT :: (forall b. Data b => b -> b) -> Pattern' e -> Pattern' e
$cgmapT :: forall e.
Data e =>
(forall b. Data b => b -> b) -> Pattern' e -> Pattern' e
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Pattern' e))
$cdataCast2 :: forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Pattern' e))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Pattern' e))
$cdataCast1 :: forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Pattern' e))
dataTypeOf :: Pattern' e -> DataType
$cdataTypeOf :: forall e. Data e => Pattern' e -> DataType
toConstr :: Pattern' e -> Constr
$ctoConstr :: forall e. Data e => Pattern' e -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pattern' e)
$cgunfold :: forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pattern' e)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern' e -> c (Pattern' e)
$cgfoldl :: forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern' e -> c (Pattern' e)
$cp1Data :: forall e. Data e => Typeable (Pattern' e)
Data, Int -> Pattern' e -> ShowS
[Pattern' e] -> ShowS
Pattern' e -> String
(Int -> Pattern' e -> ShowS)
-> (Pattern' e -> String)
-> ([Pattern' e] -> ShowS)
-> Show (Pattern' e)
forall e. Show e => Int -> Pattern' e -> ShowS
forall e. Show e => [Pattern' e] -> ShowS
forall e. Show e => Pattern' e -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Pattern' e] -> ShowS
$cshowList :: forall e. Show e => [Pattern' e] -> ShowS
show :: Pattern' e -> String
$cshow :: forall e. Show e => Pattern' e -> String
showsPrec :: Int -> Pattern' e -> ShowS
$cshowsPrec :: forall e. Show e => Int -> Pattern' e -> ShowS
Show, a -> Pattern' b -> Pattern' a
(a -> b) -> Pattern' a -> Pattern' b
(forall a b. (a -> b) -> Pattern' a -> Pattern' b)
-> (forall a b. a -> Pattern' b -> Pattern' a) -> Functor Pattern'
forall a b. a -> Pattern' b -> Pattern' a
forall a b. (a -> b) -> Pattern' a -> Pattern' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Pattern' b -> Pattern' a
$c<$ :: forall a b. a -> Pattern' b -> Pattern' a
fmap :: (a -> b) -> Pattern' a -> Pattern' b
$cfmap :: forall a b. (a -> b) -> Pattern' a -> Pattern' b
Functor, Pattern' a -> Bool
(a -> m) -> Pattern' a -> m
(a -> b -> b) -> b -> Pattern' a -> b
(forall m. Monoid m => Pattern' m -> m)
-> (forall m a. Monoid m => (a -> m) -> Pattern' a -> m)
-> (forall m a. Monoid m => (a -> m) -> Pattern' a -> m)
-> (forall a b. (a -> b -> b) -> b -> Pattern' a -> b)
-> (forall a b. (a -> b -> b) -> b -> Pattern' a -> b)
-> (forall b a. (b -> a -> b) -> b -> Pattern' a -> b)
-> (forall b a. (b -> a -> b) -> b -> Pattern' a -> b)
-> (forall a. (a -> a -> a) -> Pattern' a -> a)
-> (forall a. (a -> a -> a) -> Pattern' a -> a)
-> (forall a. Pattern' a -> [a])
-> (forall a. Pattern' a -> Bool)
-> (forall a. Pattern' a -> Int)
-> (forall a. Eq a => a -> Pattern' a -> Bool)
-> (forall a. Ord a => Pattern' a -> a)
-> (forall a. Ord a => Pattern' a -> a)
-> (forall a. Num a => Pattern' a -> a)
-> (forall a. Num a => Pattern' a -> a)
-> Foldable Pattern'
forall a. Eq a => a -> Pattern' a -> Bool
forall a. Num a => Pattern' a -> a
forall a. Ord a => Pattern' a -> a
forall m. Monoid m => Pattern' m -> m
forall a. Pattern' a -> Bool
forall a. Pattern' a -> Int
forall a. Pattern' a -> [a]
forall a. (a -> a -> a) -> Pattern' a -> a
forall m a. Monoid m => (a -> m) -> Pattern' a -> m
forall b a. (b -> a -> b) -> b -> Pattern' a -> b
forall a b. (a -> b -> b) -> b -> Pattern' 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 :: Pattern' a -> a
$cproduct :: forall a. Num a => Pattern' a -> a
sum :: Pattern' a -> a
$csum :: forall a. Num a => Pattern' a -> a
minimum :: Pattern' a -> a
$cminimum :: forall a. Ord a => Pattern' a -> a
maximum :: Pattern' a -> a
$cmaximum :: forall a. Ord a => Pattern' a -> a
elem :: a -> Pattern' a -> Bool
$celem :: forall a. Eq a => a -> Pattern' a -> Bool
length :: Pattern' a -> Int
$clength :: forall a. Pattern' a -> Int
null :: Pattern' a -> Bool
$cnull :: forall a. Pattern' a -> Bool
toList :: Pattern' a -> [a]
$ctoList :: forall a. Pattern' a -> [a]
foldl1 :: (a -> a -> a) -> Pattern' a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Pattern' a -> a
foldr1 :: (a -> a -> a) -> Pattern' a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Pattern' a -> a
foldl' :: (b -> a -> b) -> b -> Pattern' a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Pattern' a -> b
foldl :: (b -> a -> b) -> b -> Pattern' a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Pattern' a -> b
foldr' :: (a -> b -> b) -> b -> Pattern' a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Pattern' a -> b
foldr :: (a -> b -> b) -> b -> Pattern' a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Pattern' a -> b
foldMap' :: (a -> m) -> Pattern' a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Pattern' a -> m
foldMap :: (a -> m) -> Pattern' a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Pattern' a -> m
fold :: Pattern' m -> m
$cfold :: forall m. Monoid m => Pattern' m -> m
Foldable, Functor Pattern'
Foldable Pattern'
Functor Pattern'
-> Foldable Pattern'
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Pattern' a -> f (Pattern' b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Pattern' (f a) -> f (Pattern' a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Pattern' a -> m (Pattern' b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Pattern' (m a) -> m (Pattern' a))
-> Traversable Pattern'
(a -> f b) -> Pattern' a -> f (Pattern' 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 => Pattern' (m a) -> m (Pattern' a)
forall (f :: * -> *) a.
Applicative f =>
Pattern' (f a) -> f (Pattern' a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Pattern' a -> m (Pattern' b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Pattern' a -> f (Pattern' b)
sequence :: Pattern' (m a) -> m (Pattern' a)
$csequence :: forall (m :: * -> *) a. Monad m => Pattern' (m a) -> m (Pattern' a)
mapM :: (a -> m b) -> Pattern' a -> m (Pattern' b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Pattern' a -> m (Pattern' b)
sequenceA :: Pattern' (f a) -> f (Pattern' a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Pattern' (f a) -> f (Pattern' a)
traverse :: (a -> f b) -> Pattern' a -> f (Pattern' b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Pattern' a -> f (Pattern' b)
$cp2Traversable :: Foldable Pattern'
$cp1Traversable :: Functor Pattern'
Traversable, Pattern' e -> Pattern' e -> Bool
(Pattern' e -> Pattern' e -> Bool)
-> (Pattern' e -> Pattern' e -> Bool) -> Eq (Pattern' e)
forall e. Eq e => Pattern' e -> Pattern' e -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Pattern' e -> Pattern' e -> Bool
$c/= :: forall e. Eq e => Pattern' e -> Pattern' e -> Bool
== :: Pattern' e -> Pattern' e -> Bool
$c== :: forall e. Eq e => Pattern' e -> Pattern' e -> Bool
Eq, (forall x. Pattern' e -> Rep (Pattern' e) x)
-> (forall x. Rep (Pattern' e) x -> Pattern' e)
-> Generic (Pattern' e)
forall x. Rep (Pattern' e) x -> Pattern' e
forall x. Pattern' e -> Rep (Pattern' e) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall e x. Rep (Pattern' e) x -> Pattern' e
forall e x. Pattern' e -> Rep (Pattern' e) x
$cto :: forall e x. Rep (Pattern' e) x -> Pattern' e
$cfrom :: forall e x. Pattern' e -> Rep (Pattern' e) x
Generic)

type NAPs e   = [NamedArg (Pattern' e)]
type NAPs1 e  = List1 (NamedArg (Pattern' e))
type Pattern  = Pattern' Expr
type Patterns = [NamedArg Pattern]

instance IsProjP (Pattern' e) where
  -- Andreas, 2018-06-19, issue #3130
  -- Do not interpret things like .(p) as projection pattern any more.
  -- maybePostfixProjP (DotP _ e)    = isProjP e <&> \ (_o, d) -> (ProjPostfix, d)
  isProjP :: Pattern' e -> Maybe (ProjOrigin, AmbiguousQName)
isProjP (ProjP PatInfo
_ ProjOrigin
o AmbiguousQName
d) = (ProjOrigin, AmbiguousQName) -> Maybe (ProjOrigin, AmbiguousQName)
forall a. a -> Maybe a
Just (ProjOrigin
o, AmbiguousQName
d)
  isProjP Pattern' e
_ = Maybe (ProjOrigin, AmbiguousQName)
forall a. Maybe a
Nothing

instance IsProjP Expr where
  isProjP :: Expr -> Maybe (ProjOrigin, AmbiguousQName)
isProjP (Proj ProjOrigin
o AmbiguousQName
ds)      = (ProjOrigin, AmbiguousQName) -> Maybe (ProjOrigin, AmbiguousQName)
forall a. a -> Maybe a
Just (ProjOrigin
o, AmbiguousQName
ds)
  isProjP (ScopedExpr ScopeInfo
_ Expr
e) = Expr -> Maybe (ProjOrigin, AmbiguousQName)
forall a. IsProjP a => a -> Maybe (ProjOrigin, AmbiguousQName)
isProjP Expr
e
  isProjP Expr
_ = Maybe (ProjOrigin, AmbiguousQName)
forall a. Maybe a
Nothing

{--------------------------------------------------------------------------
    Things we parse but are not part of the Agda file syntax
 --------------------------------------------------------------------------}

type HoleContent = C.HoleContent' () BindName Pattern Expr

{--------------------------------------------------------------------------
    Instances
 --------------------------------------------------------------------------}

-- | Does not compare 'ScopeInfo' fields.
--   Does not distinguish between prefix and postfix projections.

instance Eq Expr where
  ScopedExpr ScopeInfo
_ Expr
a1            == :: Expr -> Expr -> Bool
== ScopedExpr ScopeInfo
_ Expr
a2            = Expr
a1 Expr -> Expr -> Bool
forall a. Eq a => a -> a -> Bool
== Expr
a2

  Var Name
a1                     == Var Name
a2                     = Name
a1 Name -> Name -> Bool
forall a. Eq a => a -> a -> Bool
== Name
a2
  Def' QName
a1 Suffix
s1                 == Def' QName
a2 Suffix
s2                 = (QName
a1, Suffix
s1) (QName, Suffix) -> (QName, Suffix) -> Bool
forall a. Eq a => a -> a -> Bool
== (QName
a2, Suffix
s2)
  Proj ProjOrigin
_ AmbiguousQName
a1                  == Proj ProjOrigin
_ AmbiguousQName
a2                  = AmbiguousQName
a1 AmbiguousQName -> AmbiguousQName -> Bool
forall a. Eq a => a -> a -> Bool
== AmbiguousQName
a2
  Con AmbiguousQName
a1                     == Con AmbiguousQName
a2                     = AmbiguousQName
a1 AmbiguousQName -> AmbiguousQName -> Bool
forall a. Eq a => a -> a -> Bool
== AmbiguousQName
a2
  PatternSyn AmbiguousQName
a1              == PatternSyn AmbiguousQName
a2              = AmbiguousQName
a1 AmbiguousQName -> AmbiguousQName -> Bool
forall a. Eq a => a -> a -> Bool
== AmbiguousQName
a2
  Macro QName
a1                   == Macro QName
a2                   = QName
a1 QName -> QName -> Bool
forall a. Eq a => a -> a -> Bool
== QName
a2
  Lit ExprInfo
r1 Literal
a1                  == Lit ExprInfo
r2 Literal
a2                  = (ExprInfo
r1, Literal
a1) (ExprInfo, Literal) -> (ExprInfo, Literal) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
r2, Literal
a2)
  QuestionMark MetaInfo
a1 InteractionId
b1         == QuestionMark MetaInfo
a2 InteractionId
b2         = (MetaInfo
a1, InteractionId
b1) (MetaInfo, InteractionId) -> (MetaInfo, InteractionId) -> Bool
forall a. Eq a => a -> a -> Bool
== (MetaInfo
a2, InteractionId
b2)
  Underscore MetaInfo
a1              == Underscore MetaInfo
a2              = MetaInfo
a1 MetaInfo -> MetaInfo -> Bool
forall a. Eq a => a -> a -> Bool
== MetaInfo
a2
  Dot ExprInfo
r1 Expr
e1                  == Dot ExprInfo
r2 Expr
e2                  = (ExprInfo
r1, Expr
e1) (ExprInfo, Expr) -> (ExprInfo, Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
r2, Expr
e2)
  App AppInfo
a1 Expr
b1 NamedArg Expr
c1               == App AppInfo
a2 Expr
b2 NamedArg Expr
c2               = (AppInfo
a1, Expr
b1, NamedArg Expr
c1) (AppInfo, Expr, NamedArg Expr)
-> (AppInfo, Expr, NamedArg Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (AppInfo
a2, Expr
b2, NamedArg Expr
c2)
  WithApp ExprInfo
a1 Expr
b1 [Expr]
c1           == WithApp ExprInfo
a2 Expr
b2 [Expr]
c2           = (ExprInfo
a1, Expr
b1, [Expr]
c1) (ExprInfo, Expr, [Expr]) -> (ExprInfo, Expr, [Expr]) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, Expr
b2, [Expr]
c2)
  Lam ExprInfo
a1 LamBinding
b1 Expr
c1               == Lam ExprInfo
a2 LamBinding
b2 Expr
c2               = (ExprInfo
a1, LamBinding
b1, Expr
c1) (ExprInfo, LamBinding, Expr)
-> (ExprInfo, LamBinding, Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, LamBinding
b2, Expr
c2)
  AbsurdLam ExprInfo
a1 Hiding
b1            == AbsurdLam ExprInfo
a2 Hiding
b2            = (ExprInfo
a1, Hiding
b1) (ExprInfo, Hiding) -> (ExprInfo, Hiding) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, Hiding
b2)
  ExtendedLam ExprInfo
a1 DefInfo
b1 Erased
c1 QName
d1 List1 Clause
e1 == ExtendedLam ExprInfo
a2 DefInfo
b2 Erased
c2 QName
d2 List1 Clause
e2 = (ExprInfo
a1, DefInfo
b1, Erased
c1, QName
d1, List1 Clause
e1) (ExprInfo, DefInfo, Erased, QName, List1 Clause)
-> (ExprInfo, DefInfo, Erased, QName, List1 Clause) -> Bool
forall a. Eq a => a -> a -> Bool
==
                                                             (ExprInfo
a2, DefInfo
b2, Erased
c2, QName
d2, List1 Clause
e2)
  Pi ExprInfo
a1 Telescope1
b1 Expr
c1                == Pi ExprInfo
a2 Telescope1
b2 Expr
c2                = (ExprInfo
a1, Telescope1
b1, Expr
c1) (ExprInfo, Telescope1, Expr)
-> (ExprInfo, Telescope1, Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, Telescope1
b2, Expr
c2)
  Generalized Set QName
a1 Expr
b1          == Generalized Set QName
a2 Expr
b2          = (Set QName
a1, Expr
b1) (Set QName, Expr) -> (Set QName, Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (Set QName
a2, Expr
b2)
  Fun ExprInfo
a1 Arg Expr
b1 Expr
c1               == Fun ExprInfo
a2 Arg Expr
b2 Expr
c2               = (ExprInfo
a1, Arg Expr
b1, Expr
c1) (ExprInfo, Arg Expr, Expr) -> (ExprInfo, Arg Expr, Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, Arg Expr
b2, Expr
c2)
  Let ExprInfo
a1 List1 LetBinding
b1 Expr
c1               == Let ExprInfo
a2 List1 LetBinding
b2 Expr
c2               = (ExprInfo
a1, List1 LetBinding
b1, Expr
c1) (ExprInfo, List1 LetBinding, Expr)
-> (ExprInfo, List1 LetBinding, Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, List1 LetBinding
b2, Expr
c2)
  ETel [TypedBinding]
a1                    == ETel [TypedBinding]
a2                    = [TypedBinding]
a1 [TypedBinding] -> [TypedBinding] -> Bool
forall a. Eq a => a -> a -> Bool
== [TypedBinding]
a2
  Rec ExprInfo
a1 RecordAssigns
b1                  == Rec ExprInfo
a2 RecordAssigns
b2                  = (ExprInfo
a1, RecordAssigns
b1) (ExprInfo, RecordAssigns) -> (ExprInfo, RecordAssigns) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, RecordAssigns
b2)
  RecUpdate ExprInfo
a1 Expr
b1 Assigns
c1         == RecUpdate ExprInfo
a2 Expr
b2 Assigns
c2         = (ExprInfo
a1, Expr
b1, Assigns
c1) (ExprInfo, Expr, Assigns) -> (ExprInfo, Expr, Assigns) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, Expr
b2, Assigns
c2)
  Quote ExprInfo
a1                   == Quote ExprInfo
a2                   = ExprInfo
a1 ExprInfo -> ExprInfo -> Bool
forall a. Eq a => a -> a -> Bool
== ExprInfo
a2
  QuoteTerm ExprInfo
a1               == QuoteTerm ExprInfo
a2               = ExprInfo
a1 ExprInfo -> ExprInfo -> Bool
forall a. Eq a => a -> a -> Bool
== ExprInfo
a2
  Unquote ExprInfo
a1                 == Unquote ExprInfo
a2                 = ExprInfo
a1 ExprInfo -> ExprInfo -> Bool
forall a. Eq a => a -> a -> Bool
== ExprInfo
a2
  DontCare Expr
a1                == DontCare Expr
a2                = Expr
a1 Expr -> Expr -> Bool
forall a. Eq a => a -> a -> Bool
== Expr
a2

  Expr
_                          == Expr
_                          = Bool
False

-- | Does not compare 'ScopeInfo' fields.

instance Eq Declaration where
  ScopedDecl ScopeInfo
_ [Declaration]
a1                == :: Declaration -> Declaration -> Bool
== ScopedDecl ScopeInfo
_ [Declaration]
a2                = [Declaration]
a1 [Declaration] -> [Declaration] -> Bool
forall a. Eq a => a -> a -> Bool
== [Declaration]
a2

  Axiom KindOfName
a1 DefInfo
b1 ArgInfo
c1 Maybe [Occurrence]
d1 QName
e1 Expr
f1        == Axiom KindOfName
a2 DefInfo
b2 ArgInfo
c2 Maybe [Occurrence]
d2 QName
e2 Expr
f2        = (KindOfName
a1, DefInfo
b1, ArgInfo
c1, Maybe [Occurrence]
d1, QName
e1, Expr
f1) (KindOfName, DefInfo, ArgInfo, Maybe [Occurrence], QName, Expr)
-> (KindOfName, DefInfo, ArgInfo, Maybe [Occurrence], QName, Expr)
-> Bool
forall a. Eq a => a -> a -> Bool
== (KindOfName
a2, DefInfo
b2, ArgInfo
c2, Maybe [Occurrence]
d2, QName
e2, Expr
f2)
  Generalize Set QName
a1 DefInfo
b1 ArgInfo
c1 QName
d1 Expr
e1      == Generalize Set QName
a2 DefInfo
b2 ArgInfo
c2 QName
d2 Expr
e2      = (Set QName
a1, DefInfo
b1, ArgInfo
c1, QName
d1, Expr
e1) (Set QName, DefInfo, ArgInfo, QName, Expr)
-> (Set QName, DefInfo, ArgInfo, QName, Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (Set QName
a2, DefInfo
b2, ArgInfo
c2, QName
d2, Expr
e2)
  Field DefInfo
a1 QName
b1 Arg Expr
c1                 == Field DefInfo
a2 QName
b2 Arg Expr
c2                 = (DefInfo
a1, QName
b1, Arg Expr
c1) (DefInfo, QName, Arg Expr) -> (DefInfo, QName, Arg Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (DefInfo
a2, QName
b2, Arg Expr
c2)
  Primitive DefInfo
a1 QName
b1 Arg Expr
c1             == Primitive DefInfo
a2 QName
b2 Arg Expr
c2             = (DefInfo
a1, QName
b1, Arg Expr
c1) (DefInfo, QName, Arg Expr) -> (DefInfo, QName, Arg Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (DefInfo
a2, QName
b2, Arg Expr
c2)
  Mutual MutualInfo
a1 [Declaration]
b1                   == Mutual MutualInfo
a2 [Declaration]
b2                   = (MutualInfo
a1, [Declaration]
b1) (MutualInfo, [Declaration]) -> (MutualInfo, [Declaration]) -> Bool
forall a. Eq a => a -> a -> Bool
== (MutualInfo
a2, [Declaration]
b2)
  Section Range
a1 ModuleName
b1 GeneralizeTelescope
c1 [Declaration]
d1            == Section Range
a2 ModuleName
b2 GeneralizeTelescope
c2 [Declaration]
d2            = (Range
a1, ModuleName
b1, GeneralizeTelescope
c1, [Declaration]
d1) (Range, ModuleName, GeneralizeTelescope, [Declaration])
-> (Range, ModuleName, GeneralizeTelescope, [Declaration]) -> Bool
forall a. Eq a => a -> a -> Bool
== (Range
a2, ModuleName
b2, GeneralizeTelescope
c2, [Declaration]
d2)
  Apply ModuleInfo
a1 ModuleName
b1 ModuleApplication
c1 ScopeCopyInfo
d1 ImportDirective
e1           == Apply ModuleInfo
a2 ModuleName
b2 ModuleApplication
c2 ScopeCopyInfo
d2 ImportDirective
e2           = (ModuleInfo
a1, ModuleName
b1, ModuleApplication
c1, ScopeCopyInfo
d1, ImportDirective
e1) (ModuleInfo, ModuleName, ModuleApplication, ScopeCopyInfo,
 ImportDirective)
-> (ModuleInfo, ModuleName, ModuleApplication, ScopeCopyInfo,
    ImportDirective)
-> Bool
forall a. Eq a => a -> a -> Bool
== (ModuleInfo
a2, ModuleName
b2, ModuleApplication
c2, ScopeCopyInfo
d2, ImportDirective
e2)
  Import ModuleInfo
a1 ModuleName
b1 ImportDirective
c1                == Import ModuleInfo
a2 ModuleName
b2 ImportDirective
c2                = (ModuleInfo
a1, ModuleName
b1, ImportDirective
c1) (ModuleInfo, ModuleName, ImportDirective)
-> (ModuleInfo, ModuleName, ImportDirective) -> Bool
forall a. Eq a => a -> a -> Bool
== (ModuleInfo
a2, ModuleName
b2, ImportDirective
c2)
  Pragma Range
a1 Pragma
b1                   == Pragma Range
a2 Pragma
b2                   = (Range
a1, Pragma
b1) (Range, Pragma) -> (Range, Pragma) -> Bool
forall a. Eq a => a -> a -> Bool
== (Range
a2, Pragma
b2)
  Open ModuleInfo
a1 ModuleName
b1 ImportDirective
c1                  == Open ModuleInfo
a2 ModuleName
b2 ImportDirective
c2                  = (ModuleInfo
a1, ModuleName
b1, ImportDirective
c1) (ModuleInfo, ModuleName, ImportDirective)
-> (ModuleInfo, ModuleName, ImportDirective) -> Bool
forall a. Eq a => a -> a -> Bool
== (ModuleInfo
a2, ModuleName
b2, ImportDirective
c2)
  FunDef DefInfo
a1 QName
b1 Delayed
c1 [Clause]
d1             == FunDef DefInfo
a2 QName
b2 Delayed
c2 [Clause]
d2             = (DefInfo
a1, QName
b1, Delayed
c1, [Clause]
d1) (DefInfo, QName, Delayed, [Clause])
-> (DefInfo, QName, Delayed, [Clause]) -> Bool
forall a. Eq a => a -> a -> Bool
== (DefInfo
a2, QName
b2, Delayed
c2, [Clause]
d2)
  DataSig DefInfo
a1 QName
b1 GeneralizeTelescope
c1 Expr
d1            == DataSig DefInfo
a2 QName
b2 GeneralizeTelescope
c2 Expr
d2            = (DefInfo
a1, QName
b1, GeneralizeTelescope
c1, Expr
d1) (DefInfo, QName, GeneralizeTelescope, Expr)
-> (DefInfo, QName, GeneralizeTelescope, Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (DefInfo
a2, QName
b2, GeneralizeTelescope
c2, Expr
d2)
  DataDef DefInfo
a1 QName
b1 UniverseCheck
c1 DataDefParams
d1 [Declaration]
e1         == DataDef DefInfo
a2 QName
b2 UniverseCheck
c2 DataDefParams
d2 [Declaration]
e2         = (DefInfo
a1, QName
b1, UniverseCheck
c1, DataDefParams
d1, [Declaration]
e1) (DefInfo, QName, UniverseCheck, DataDefParams, [Declaration])
-> (DefInfo, QName, UniverseCheck, DataDefParams, [Declaration])
-> Bool
forall a. Eq a => a -> a -> Bool
== (DefInfo
a2, QName
b2, UniverseCheck
c2, DataDefParams
d2, [Declaration]
e2)
  RecSig DefInfo
a1 QName
b1 GeneralizeTelescope
c1 Expr
d1             == RecSig DefInfo
a2 QName
b2 GeneralizeTelescope
c2 Expr
d2             = (DefInfo
a1, QName
b1, GeneralizeTelescope
c1, Expr
d1) (DefInfo, QName, GeneralizeTelescope, Expr)
-> (DefInfo, QName, GeneralizeTelescope, Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (DefInfo
a2, QName
b2, GeneralizeTelescope
c2, Expr
d2)
  RecDef DefInfo
a1 QName
b1 UniverseCheck
c1 RecordDirectives
d1 DataDefParams
e1 Expr
f1 [Declaration]
g1    == RecDef DefInfo
a2 QName
b2 UniverseCheck
c2 RecordDirectives
d2 DataDefParams
e2 Expr
f2 [Declaration]
g2    = (DefInfo
a1, QName
b1, UniverseCheck
c1, RecordDirectives
d1, DataDefParams
e1, Expr
f1, [Declaration]
g1) (DefInfo, QName, UniverseCheck, RecordDirectives, DataDefParams,
 Expr, [Declaration])
-> (DefInfo, QName, UniverseCheck, RecordDirectives, DataDefParams,
    Expr, [Declaration])
-> Bool
forall a. Eq a => a -> a -> Bool
== (DefInfo
a2, QName
b2, UniverseCheck
c2, RecordDirectives
d2, DataDefParams
e2, Expr
f2, [Declaration]
g2)
  PatternSynDef QName
a1 [Arg BindName]
b1 Pattern' Void
c1         == PatternSynDef QName
a2 [Arg BindName]
b2 Pattern' Void
c2         = (QName
a1, [Arg BindName]
b1, Pattern' Void
c1) (QName, [Arg BindName], Pattern' Void)
-> (QName, [Arg BindName], Pattern' Void) -> Bool
forall a. Eq a => a -> a -> Bool
== (QName
a2, [Arg BindName]
b2, Pattern' Void
c2)
  UnquoteDecl MutualInfo
a1 [DefInfo]
b1 [QName]
c1 Expr
d1        == UnquoteDecl MutualInfo
a2 [DefInfo]
b2 [QName]
c2 Expr
d2        = (MutualInfo
a1, [DefInfo]
b1, [QName]
c1, Expr
d1) (MutualInfo, [DefInfo], [QName], Expr)
-> (MutualInfo, [DefInfo], [QName], Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (MutualInfo
a2, [DefInfo]
b2, [QName]
c2, Expr
d2)
  UnquoteDef [DefInfo]
a1 [QName]
b1 Expr
c1            == UnquoteDef [DefInfo]
a2 [QName]
b2 Expr
c2            = ([DefInfo]
a1, [QName]
b1, Expr
c1) ([DefInfo], [QName], Expr) -> ([DefInfo], [QName], Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== ([DefInfo]
a2, [QName]
b2, Expr
c2)

  Declaration
_                              == Declaration
_                              = Bool
False

instance Underscore Expr where
  underscore :: Expr
underscore   = MetaInfo -> Expr
Underscore MetaInfo
emptyMetaInfo
  isUnderscore :: Expr -> Bool
isUnderscore = Expr -> Bool
forall a. HasCallStack => a
__IMPOSSIBLE__

instance LensHiding LamBinding where
  getHiding :: LamBinding -> Hiding
getHiding   (DomainFree TacticAttr
_ NamedArg Binder
x) = NamedArg Binder -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding NamedArg Binder
x
  getHiding   (DomainFull TypedBinding
tb)  = TypedBinding -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding TypedBinding
tb
  mapHiding :: (Hiding -> Hiding) -> LamBinding -> LamBinding
mapHiding Hiding -> Hiding
f (DomainFree TacticAttr
t NamedArg Binder
x) = TacticAttr -> NamedArg Binder -> LamBinding
DomainFree TacticAttr
t (NamedArg Binder -> LamBinding) -> NamedArg Binder -> LamBinding
forall a b. (a -> b) -> a -> b
$ (Hiding -> Hiding) -> NamedArg Binder -> NamedArg Binder
forall a. LensHiding a => (Hiding -> Hiding) -> a -> a
mapHiding Hiding -> Hiding
f NamedArg Binder
x
  mapHiding Hiding -> Hiding
f (DomainFull TypedBinding
tb)  = TypedBinding -> LamBinding
DomainFull (TypedBinding -> LamBinding) -> TypedBinding -> LamBinding
forall a b. (a -> b) -> a -> b
$ (Hiding -> Hiding) -> TypedBinding -> TypedBinding
forall a. LensHiding a => (Hiding -> Hiding) -> a -> a
mapHiding Hiding -> Hiding
f TypedBinding
tb

instance LensHiding TypedBinding where
  getHiding :: TypedBinding -> Hiding
getHiding (TBind Range
_ TacticAttr
_ (NamedArg Binder
x :|[NamedArg Binder]
_) Expr
_) = NamedArg Binder -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding NamedArg Binder
x   -- Slightly dubious
  getHiding TLet{}                = Hiding
forall a. Monoid a => a
mempty
  mapHiding :: (Hiding -> Hiding) -> TypedBinding -> TypedBinding
mapHiding Hiding -> Hiding
f (TBind Range
r TacticAttr
t List1 (NamedArg Binder)
xs Expr
e)    = Range
-> TacticAttr -> List1 (NamedArg Binder) -> Expr -> TypedBinding
TBind Range
r TacticAttr
t (((NamedArg Binder -> NamedArg Binder)
-> List1 (NamedArg Binder) -> List1 (NamedArg Binder)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((NamedArg Binder -> NamedArg Binder)
 -> List1 (NamedArg Binder) -> List1 (NamedArg Binder))
-> ((Hiding -> Hiding) -> NamedArg Binder -> NamedArg Binder)
-> (Hiding -> Hiding)
-> List1 (NamedArg Binder)
-> List1 (NamedArg Binder)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Hiding -> Hiding) -> NamedArg Binder -> NamedArg Binder
forall a. LensHiding a => (Hiding -> Hiding) -> a -> a
mapHiding) Hiding -> Hiding
f List1 (NamedArg Binder)
xs) Expr
e
  mapHiding Hiding -> Hiding
f b :: TypedBinding
b@TLet{}            = TypedBinding
b

instance HasRange a => HasRange (Binder' a) where
  getRange :: Binder' a -> Range
getRange (Binder Maybe Pattern
p a
n) = Maybe Pattern -> a -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange Maybe Pattern
p a
n

instance HasRange LamBinding where
    getRange :: LamBinding -> Range
getRange (DomainFree TacticAttr
_ NamedArg Binder
x) = NamedArg Binder -> Range
forall a. HasRange a => a -> Range
getRange NamedArg Binder
x
    getRange (DomainFull TypedBinding
b)   = TypedBinding -> Range
forall a. HasRange a => a -> Range
getRange TypedBinding
b

instance HasRange TypedBinding where
    getRange :: TypedBinding -> Range
getRange (TBind Range
r TacticAttr
_ List1 (NamedArg Binder)
_ Expr
_) = Range
r
    getRange (TLet Range
r List1 LetBinding
_)    = Range
r

instance HasRange Expr where
    getRange :: Expr -> Range
getRange (Var Name
x)                 = Name -> Range
forall a. HasRange a => a -> Range
getRange Name
x
    getRange (Def' QName
x Suffix
_)              = QName -> Range
forall a. HasRange a => a -> Range
getRange QName
x
    getRange (Proj ProjOrigin
_ AmbiguousQName
x)              = AmbiguousQName -> Range
forall a. HasRange a => a -> Range
getRange AmbiguousQName
x
    getRange (Con AmbiguousQName
x)                 = AmbiguousQName -> Range
forall a. HasRange a => a -> Range
getRange AmbiguousQName
x
    getRange (Lit ExprInfo
i Literal
_)               = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (QuestionMark MetaInfo
i InteractionId
_)      = MetaInfo -> Range
forall a. HasRange a => a -> Range
getRange MetaInfo
i
    getRange (Underscore  MetaInfo
i)         = MetaInfo -> Range
forall a. HasRange a => a -> Range
getRange MetaInfo
i
    getRange (Dot ExprInfo
i Expr
_)               = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (App AppInfo
i Expr
_ NamedArg Expr
_)             = AppInfo -> Range
forall a. HasRange a => a -> Range
getRange AppInfo
i
    getRange (WithApp ExprInfo
i Expr
_ [Expr]
_)         = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (Lam ExprInfo
i LamBinding
_ Expr
_)             = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (AbsurdLam ExprInfo
i Hiding
_)         = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (ExtendedLam ExprInfo
i DefInfo
_ Erased
_ QName
_ List1 Clause
_) = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (Pi ExprInfo
i Telescope1
_ Expr
_)              = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (Generalized Set QName
_ Expr
x)       = Expr -> Range
forall a. HasRange a => a -> Range
getRange Expr
x
    getRange (Fun ExprInfo
i Arg Expr
_ Expr
_)             = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (Let ExprInfo
i List1 LetBinding
_ Expr
_)             = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (Rec ExprInfo
i RecordAssigns
_)               = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (RecUpdate ExprInfo
i Expr
_ Assigns
_)       = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (ETel [TypedBinding]
tel)              = [TypedBinding] -> Range
forall a. HasRange a => a -> Range
getRange [TypedBinding]
tel
    getRange (ScopedExpr ScopeInfo
_ Expr
e)        = Expr -> Range
forall a. HasRange a => a -> Range
getRange Expr
e
    getRange (Quote ExprInfo
i)               = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (QuoteTerm ExprInfo
i)           = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (Unquote ExprInfo
i)             = ExprInfo -> Range
forall a. HasRange a => a -> Range
getRange ExprInfo
i
    getRange (DontCare{})            = Range
forall a. Range' a
noRange
    getRange (PatternSyn AmbiguousQName
x)          = AmbiguousQName -> Range
forall a. HasRange a => a -> Range
getRange AmbiguousQName
x
    getRange (Macro QName
x)               = QName -> Range
forall a. HasRange a => a -> Range
getRange QName
x

instance HasRange Declaration where
    getRange :: Declaration -> Range
getRange (Axiom    KindOfName
_ DefInfo
i ArgInfo
_ Maybe [Occurrence]
_ QName
_ Expr
_  ) = DefInfo -> Range
forall a. HasRange a => a -> Range
getRange DefInfo
i
    getRange (Generalize Set QName
_ DefInfo
i ArgInfo
_ QName
_ Expr
_)   = DefInfo -> Range
forall a. HasRange a => a -> Range
getRange DefInfo
i
    getRange (Field      DefInfo
i QName
_ Arg Expr
_      ) = DefInfo -> Range
forall a. HasRange a => a -> Range
getRange DefInfo
i
    getRange (Mutual     MutualInfo
i [Declaration]
_        ) = MutualInfo -> Range
forall a. HasRange a => a -> Range
getRange MutualInfo
i
    getRange (Section    Range
i ModuleName
_ GeneralizeTelescope
_ [Declaration]
_    ) = Range -> Range
forall a. HasRange a => a -> Range
getRange Range
i
    getRange (Apply      ModuleInfo
i ModuleName
_ ModuleApplication
_ ScopeCopyInfo
_ ImportDirective
_)   = ModuleInfo -> Range
forall a. HasRange a => a -> Range
getRange ModuleInfo
i
    getRange (Import     ModuleInfo
i ModuleName
_ ImportDirective
_      ) = ModuleInfo -> Range
forall a. HasRange a => a -> Range
getRange ModuleInfo
i
    getRange (Primitive  DefInfo
i QName
_ Arg Expr
_      ) = DefInfo -> Range
forall a. HasRange a => a -> Range
getRange DefInfo
i
    getRange (Pragma     Range
i Pragma
_        ) = Range -> Range
forall a. HasRange a => a -> Range
getRange Range
i
    getRange (Open       ModuleInfo
i ModuleName
_ ImportDirective
_      ) = ModuleInfo -> Range
forall a. HasRange a => a -> Range
getRange ModuleInfo
i
    getRange (ScopedDecl ScopeInfo
_ [Declaration]
d        ) = [Declaration] -> Range
forall a. HasRange a => a -> Range
getRange [Declaration]
d
    getRange (FunDef     DefInfo
i QName
_ Delayed
_ [Clause]
_    ) = DefInfo -> Range
forall a. HasRange a => a -> Range
getRange DefInfo
i
    getRange (DataSig    DefInfo
i QName
_ GeneralizeTelescope
_ Expr
_    ) = DefInfo -> Range
forall a. HasRange a => a -> Range
getRange DefInfo
i
    getRange (DataDef    DefInfo
i QName
_ UniverseCheck
_ DataDefParams
_ [Declaration]
_  ) = DefInfo -> Range
forall a. HasRange a => a -> Range
getRange DefInfo
i
    getRange (RecSig     DefInfo
i QName
_ GeneralizeTelescope
_ Expr
_    ) = DefInfo -> Range
forall a. HasRange a => a -> Range
getRange DefInfo
i
    getRange (RecDef DefInfo
i QName
_ UniverseCheck
_ RecordDirectives
_ DataDefParams
_ Expr
_ [Declaration]
_)   = DefInfo -> Range
forall a. HasRange a => a -> Range
getRange DefInfo
i
    getRange (PatternSynDef QName
x [Arg BindName]
_ Pattern' Void
_   ) = QName -> Range
forall a. HasRange a => a -> Range
getRange QName
x
    getRange (UnquoteDecl MutualInfo
_ [DefInfo]
i [QName]
_ Expr
_)    = [DefInfo] -> Range
forall a. HasRange a => a -> Range
getRange [DefInfo]
i
    getRange (UnquoteDef [DefInfo]
i [QName]
_ Expr
_)       = [DefInfo] -> Range
forall a. HasRange a => a -> Range
getRange [DefInfo]
i

instance HasRange (Pattern' e) where
    getRange :: Pattern' e -> Range
getRange (VarP BindName
x)           = BindName -> Range
forall a. HasRange a => a -> Range
getRange BindName
x
    getRange (ConP ConPatInfo
i AmbiguousQName
_ NAPs e
_)        = ConPatInfo -> Range
forall a. HasRange a => a -> Range
getRange ConPatInfo
i
    getRange (ProjP PatInfo
i ProjOrigin
_ AmbiguousQName
_)       = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (DefP PatInfo
i AmbiguousQName
_ NAPs e
_)        = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (WildP PatInfo
i)           = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (AsP PatInfo
i BindName
_ Pattern' e
_)         = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (DotP PatInfo
i e
_)          = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (AbsurdP PatInfo
i)         = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (LitP PatInfo
i Literal
l)          = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (PatternSynP PatInfo
i AmbiguousQName
_ NAPs e
_) = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (RecP PatInfo
i [FieldAssignment' (Pattern' e)]
_)          = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (EqualP PatInfo
i [(e, e)]
_)        = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (WithP PatInfo
i Pattern' e
_)         = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i
    getRange (AnnP PatInfo
i e
_ Pattern' e
_)        = PatInfo -> Range
forall a. HasRange a => a -> Range
getRange PatInfo
i

instance HasRange SpineLHS where
    getRange :: SpineLHS -> Range
getRange (SpineLHS LHSInfo
i QName
_ [NamedArg Pattern]
_)  = LHSInfo -> Range
forall a. HasRange a => a -> Range
getRange LHSInfo
i

instance HasRange LHS where
    getRange :: LHS -> Range
getRange (LHS LHSInfo
i LHSCore
_)   = LHSInfo -> Range
forall a. HasRange a => a -> Range
getRange LHSInfo
i

instance HasRange (LHSCore' e) where
    getRange :: LHSCore' e -> Range
getRange (LHSHead QName
f [NamedArg (Pattern' e)]
ps)         = QName -> [NamedArg (Pattern' e)] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange QName
f [NamedArg (Pattern' e)]
ps
    getRange (LHSProj AmbiguousQName
d NamedArg (LHSCore' e)
lhscore [NamedArg (Pattern' e)]
ps) = AmbiguousQName
d AmbiguousQName -> NamedArg (LHSCore' e) -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` NamedArg (LHSCore' e)
lhscore Range -> [NamedArg (Pattern' e)] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` [NamedArg (Pattern' e)]
ps
    getRange (LHSWith LHSCore' e
h [Arg (Pattern' e)]
wps [NamedArg (Pattern' e)]
ps)     = LHSCore' e
h LHSCore' e -> [Arg (Pattern' e)] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` [Arg (Pattern' e)]
wps Range -> [NamedArg (Pattern' e)] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` [NamedArg (Pattern' e)]
ps

instance HasRange a => HasRange (Clause' a) where
    getRange :: Clause' a -> Range
getRange (Clause a
lhs [ProblemEq]
_ RHS
rhs WhereDeclarations
ds Bool
catchall) = (a, RHS, WhereDeclarations) -> Range
forall a. HasRange a => a -> Range
getRange (a
lhs, RHS
rhs, WhereDeclarations
ds)

instance HasRange RHS where
    getRange :: RHS -> Range
getRange RHS
AbsurdRHS                 = Range
forall a. Range' a
noRange
    getRange (RHS Expr
e Maybe Expr
_)                 = Expr -> Range
forall a. HasRange a => a -> Range
getRange Expr
e
    getRange (WithRHS QName
_ [WithExpr]
e [Clause]
cs)          = [WithExpr] -> [Clause] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange [WithExpr]
e [Clause]
cs
    getRange (RewriteRHS [RewriteEqn]
xes [ProblemEq]
_ RHS
rhs WhereDeclarations
wh) = ([RewriteEqn], RHS, WhereDeclarations) -> Range
forall a. HasRange a => a -> Range
getRange ([RewriteEqn]
xes, RHS
rhs, WhereDeclarations
wh)

instance HasRange WhereDeclarations where
  getRange :: WhereDeclarations -> Range
getRange (WhereDecls Maybe ModuleName
_ Maybe Declaration
ds) = Maybe Declaration -> Range
forall a. HasRange a => a -> Range
getRange Maybe Declaration
ds

instance HasRange LetBinding where
    getRange :: LetBinding -> Range
getRange (LetBind LetInfo
i ArgInfo
_ BindName
_ Expr
_ Expr
_     ) = LetInfo -> Range
forall a. HasRange a => a -> Range
getRange LetInfo
i
    getRange (LetPatBind  LetInfo
i Pattern
_ Expr
_      ) = LetInfo -> Range
forall a. HasRange a => a -> Range
getRange LetInfo
i
    getRange (LetApply ModuleInfo
i ModuleName
_ ModuleApplication
_ ScopeCopyInfo
_ ImportDirective
_     ) = ModuleInfo -> Range
forall a. HasRange a => a -> Range
getRange ModuleInfo
i
    getRange (LetOpen  ModuleInfo
i ModuleName
_ ImportDirective
_         ) = ModuleInfo -> Range
forall a. HasRange a => a -> Range
getRange ModuleInfo
i
    getRange (LetDeclaredVariable BindName
x)  = BindName -> Range
forall a. HasRange a => a -> Range
getRange BindName
x

-- setRange for patterns applies the range to the outermost pattern constructor
instance SetRange (Pattern' a) where
    setRange :: Range -> Pattern' a -> Pattern' a
setRange Range
r (VarP BindName
x)            = BindName -> Pattern' a
forall e. BindName -> Pattern' e
VarP (Range -> BindName -> BindName
forall a. SetRange a => Range -> a -> a
setRange Range
r BindName
x)
    setRange Range
r (ConP ConPatInfo
i AmbiguousQName
ns NAPs a
as)       = ConPatInfo -> AmbiguousQName -> NAPs a -> Pattern' a
forall e. ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
ConP (Range -> ConPatInfo -> ConPatInfo
forall a. SetRange a => Range -> a -> a
setRange Range
r ConPatInfo
i) AmbiguousQName
ns NAPs a
as
    setRange Range
r (ProjP PatInfo
_ ProjOrigin
o AmbiguousQName
ns)       = PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' a
forall e. PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' e
ProjP (Range -> PatInfo
PatRange Range
r) ProjOrigin
o AmbiguousQName
ns
    setRange Range
r (DefP PatInfo
_ AmbiguousQName
ns NAPs a
as)       = PatInfo -> AmbiguousQName -> NAPs a -> Pattern' a
forall e. PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
DefP (Range -> PatInfo
PatRange Range
r) AmbiguousQName
ns NAPs a
as -- (setRange r n) as
    setRange Range
r (WildP PatInfo
_)            = PatInfo -> Pattern' a
forall e. PatInfo -> Pattern' e
WildP (Range -> PatInfo
PatRange Range
r)
    setRange Range
r (AsP PatInfo
_ BindName
n Pattern' a
p)          = PatInfo -> BindName -> Pattern' a -> Pattern' a
forall e. PatInfo -> BindName -> Pattern' e -> Pattern' e
AsP (Range -> PatInfo
PatRange Range
r) (Range -> BindName -> BindName
forall a. SetRange a => Range -> a -> a
setRange Range
r BindName
n) Pattern' a
p
    setRange Range
r (DotP PatInfo
_ a
e)           = PatInfo -> a -> Pattern' a
forall e. PatInfo -> e -> Pattern' e
DotP (Range -> PatInfo
PatRange Range
r) a
e
    setRange Range
r (AbsurdP PatInfo
_)          = PatInfo -> Pattern' a
forall e. PatInfo -> Pattern' e
AbsurdP (Range -> PatInfo
PatRange Range
r)
    setRange Range
r (LitP PatInfo
_ Literal
l)           = PatInfo -> Literal -> Pattern' a
forall e. PatInfo -> Literal -> Pattern' e
LitP (Range -> PatInfo
PatRange Range
r) Literal
l
    setRange Range
r (PatternSynP PatInfo
_ AmbiguousQName
n NAPs a
as) = PatInfo -> AmbiguousQName -> NAPs a -> Pattern' a
forall e. PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
PatternSynP (Range -> PatInfo
PatRange Range
r) AmbiguousQName
n NAPs a
as
    setRange Range
r (RecP PatInfo
i [FieldAssignment' (Pattern' a)]
as)          = PatInfo -> [FieldAssignment' (Pattern' a)] -> Pattern' a
forall e. PatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e
RecP (Range -> PatInfo
PatRange Range
r) [FieldAssignment' (Pattern' a)]
as
    setRange Range
r (EqualP PatInfo
_ [(a, a)]
es)        = PatInfo -> [(a, a)] -> Pattern' a
forall e. PatInfo -> [(e, e)] -> Pattern' e
EqualP (Range -> PatInfo
PatRange Range
r) [(a, a)]
es
    setRange Range
r (WithP PatInfo
i Pattern' a
p)          = PatInfo -> Pattern' a -> Pattern' a
forall e. PatInfo -> Pattern' e -> Pattern' e
WithP (Range -> PatInfo -> PatInfo
forall a. SetRange a => Range -> a -> a
setRange Range
r PatInfo
i) Pattern' a
p
    setRange Range
r (AnnP PatInfo
i a
a Pattern' a
p)         = PatInfo -> a -> Pattern' a -> Pattern' a
forall e. PatInfo -> e -> Pattern' e -> Pattern' e
AnnP (Range -> PatInfo -> PatInfo
forall a. SetRange a => Range -> a -> a
setRange Range
r PatInfo
i) a
a Pattern' a
p

instance KillRange a => KillRange (Binder' a) where
  killRange :: KillRangeT (Binder' a)
killRange (Binder Maybe Pattern
a a
b) = (Maybe Pattern -> a -> Binder' a)
-> Maybe Pattern -> a -> Binder' a
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Maybe Pattern -> a -> Binder' a
forall a. Maybe Pattern -> a -> Binder' a
Binder Maybe Pattern
a a
b

instance KillRange LamBinding where
  killRange :: LamBinding -> LamBinding
killRange (DomainFree TacticAttr
t NamedArg Binder
x) = (TacticAttr -> NamedArg Binder -> LamBinding)
-> TacticAttr -> NamedArg Binder -> LamBinding
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 TacticAttr -> NamedArg Binder -> LamBinding
DomainFree TacticAttr
t NamedArg Binder
x
  killRange (DomainFull TypedBinding
b)   = (TypedBinding -> LamBinding) -> TypedBinding -> LamBinding
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 TypedBinding -> LamBinding
DomainFull TypedBinding
b

instance KillRange GeneralizeTelescope where
  killRange :: GeneralizeTelescope -> GeneralizeTelescope
killRange (GeneralizeTel Map QName Name
s [TypedBinding]
tel) = Map QName Name -> [TypedBinding] -> GeneralizeTelescope
GeneralizeTel Map QName Name
s (KillRangeT [TypedBinding]
forall a. KillRange a => KillRangeT a
killRange [TypedBinding]
tel)

instance KillRange DataDefParams where
  killRange :: DataDefParams -> DataDefParams
killRange (DataDefParams Set Name
s [LamBinding]
tel) = Set Name -> [LamBinding] -> DataDefParams
DataDefParams Set Name
s (KillRangeT [LamBinding]
forall a. KillRange a => KillRangeT a
killRange [LamBinding]
tel)

instance KillRange TypedBinding where
  killRange :: TypedBinding -> TypedBinding
killRange (TBind Range
r TacticAttr
t List1 (NamedArg Binder)
xs Expr
e) = (Range
 -> TacticAttr -> List1 (NamedArg Binder) -> Expr -> TypedBinding)
-> Range
-> TacticAttr
-> List1 (NamedArg Binder)
-> Expr
-> TypedBinding
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 Range
-> TacticAttr -> List1 (NamedArg Binder) -> Expr -> TypedBinding
TBind Range
r TacticAttr
t List1 (NamedArg Binder)
xs Expr
e
  killRange (TLet Range
r List1 LetBinding
lbs)     = (Range -> List1 LetBinding -> TypedBinding)
-> Range -> List1 LetBinding -> TypedBinding
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Range -> List1 LetBinding -> TypedBinding
TLet Range
r List1 LetBinding
lbs

instance KillRange Expr where
  killRange :: Expr -> Expr
killRange (Var Name
x)                  = (Name -> Expr) -> Name -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Name -> Expr
Var Name
x
  killRange (Def' QName
x Suffix
v)               = (QName -> Suffix -> Expr) -> QName -> Suffix -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 QName -> Suffix -> Expr
Def' QName
x Suffix
v
  killRange (Proj ProjOrigin
o AmbiguousQName
x)               = (AmbiguousQName -> Expr) -> AmbiguousQName -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (ProjOrigin -> AmbiguousQName -> Expr
Proj ProjOrigin
o) AmbiguousQName
x
  killRange (Con AmbiguousQName
x)                  = (AmbiguousQName -> Expr) -> AmbiguousQName -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 AmbiguousQName -> Expr
Con AmbiguousQName
x
  killRange (Lit ExprInfo
i Literal
l)                = (ExprInfo -> Literal -> Expr) -> ExprInfo -> Literal -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 ExprInfo -> Literal -> Expr
Lit ExprInfo
i Literal
l
  killRange (QuestionMark MetaInfo
i InteractionId
ii)      = (MetaInfo -> InteractionId -> Expr)
-> MetaInfo -> InteractionId -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 MetaInfo -> InteractionId -> Expr
QuestionMark MetaInfo
i InteractionId
ii
  killRange (Underscore  MetaInfo
i)          = (MetaInfo -> Expr) -> MetaInfo -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 MetaInfo -> Expr
Underscore MetaInfo
i
  killRange (Dot ExprInfo
i Expr
e)                = (ExprInfo -> Expr -> Expr) -> ExprInfo -> Expr -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 ExprInfo -> Expr -> Expr
Dot ExprInfo
i Expr
e
  killRange (App AppInfo
i Expr
e1 NamedArg Expr
e2)            = (AppInfo -> Expr -> NamedArg Expr -> Expr)
-> AppInfo -> Expr -> NamedArg Expr -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 AppInfo -> Expr -> NamedArg Expr -> Expr
App AppInfo
i Expr
e1 NamedArg Expr
e2
  killRange (WithApp ExprInfo
i Expr
e [Expr]
es)         = (ExprInfo -> Expr -> [Expr] -> Expr)
-> ExprInfo -> Expr -> [Expr] -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ExprInfo -> Expr -> [Expr] -> Expr
WithApp ExprInfo
i Expr
e [Expr]
es
  killRange (Lam ExprInfo
i LamBinding
b Expr
e)              = (ExprInfo -> LamBinding -> Expr -> Expr)
-> ExprInfo -> LamBinding -> Expr -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ExprInfo -> LamBinding -> Expr -> Expr
Lam ExprInfo
i LamBinding
b Expr
e
  killRange (AbsurdLam ExprInfo
i Hiding
h)          = (ExprInfo -> Hiding -> Expr) -> ExprInfo -> Hiding -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 ExprInfo -> Hiding -> Expr
AbsurdLam ExprInfo
i Hiding
h
  killRange (ExtendedLam ExprInfo
i DefInfo
n Erased
e QName
d List1 Clause
ps) = (ExprInfo -> DefInfo -> Erased -> QName -> List1 Clause -> Expr)
-> ExprInfo -> DefInfo -> Erased -> QName -> List1 Clause -> Expr
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 ExprInfo -> DefInfo -> Erased -> QName -> List1 Clause -> Expr
ExtendedLam ExprInfo
i DefInfo
n Erased
e QName
d List1 Clause
ps
  killRange (Pi ExprInfo
i Telescope1
a Expr
b)               = (ExprInfo -> Telescope1 -> Expr -> Expr)
-> ExprInfo -> Telescope1 -> Expr -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ExprInfo -> Telescope1 -> Expr -> Expr
Pi ExprInfo
i Telescope1
a Expr
b
  killRange (Generalized Set QName
s Expr
x)        = (Expr -> Expr) -> Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Set QName -> Expr -> Expr
Generalized Set QName
s) Expr
x
  killRange (Fun ExprInfo
i Arg Expr
a Expr
b)              = (ExprInfo -> Arg Expr -> Expr -> Expr)
-> ExprInfo -> Arg Expr -> Expr -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ExprInfo -> Arg Expr -> Expr -> Expr
Fun ExprInfo
i Arg Expr
a Expr
b
  killRange (Let ExprInfo
i List1 LetBinding
ds Expr
e)             = (ExprInfo -> List1 LetBinding -> Expr -> Expr)
-> ExprInfo -> List1 LetBinding -> Expr -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ExprInfo -> List1 LetBinding -> Expr -> Expr
Let ExprInfo
i List1 LetBinding
ds Expr
e
  killRange (Rec ExprInfo
i RecordAssigns
fs)               = (ExprInfo -> RecordAssigns -> Expr)
-> ExprInfo -> RecordAssigns -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 ExprInfo -> RecordAssigns -> Expr
Rec ExprInfo
i RecordAssigns
fs
  killRange (RecUpdate ExprInfo
i Expr
e Assigns
fs)       = (ExprInfo -> Expr -> Assigns -> Expr)
-> ExprInfo -> Expr -> Assigns -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ExprInfo -> Expr -> Assigns -> Expr
RecUpdate ExprInfo
i Expr
e Assigns
fs
  killRange (ETel [TypedBinding]
tel)               = ([TypedBinding] -> Expr) -> [TypedBinding] -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 [TypedBinding] -> Expr
ETel [TypedBinding]
tel
  killRange (ScopedExpr ScopeInfo
s Expr
e)         = (Expr -> Expr) -> Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (ScopeInfo -> Expr -> Expr
ScopedExpr ScopeInfo
s) Expr
e
  killRange (Quote ExprInfo
i)                = (ExprInfo -> Expr) -> ExprInfo -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 ExprInfo -> Expr
Quote ExprInfo
i
  killRange (QuoteTerm ExprInfo
i)            = (ExprInfo -> Expr) -> ExprInfo -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 ExprInfo -> Expr
QuoteTerm ExprInfo
i
  killRange (Unquote ExprInfo
i)              = (ExprInfo -> Expr) -> ExprInfo -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 ExprInfo -> Expr
Unquote ExprInfo
i
  killRange (DontCare Expr
e)             = (Expr -> Expr) -> Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Expr -> Expr
DontCare Expr
e
  killRange (PatternSyn AmbiguousQName
x)           = (AmbiguousQName -> Expr) -> AmbiguousQName -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 AmbiguousQName -> Expr
PatternSyn AmbiguousQName
x
  killRange (Macro QName
x)                = (QName -> Expr) -> QName -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 QName -> Expr
Macro QName
x

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

instance KillRange Declaration where
  killRange :: Declaration -> Declaration
killRange (Axiom    KindOfName
p DefInfo
i ArgInfo
a Maybe [Occurrence]
b QName
c Expr
d     ) = (DefInfo -> ArgInfo -> QName -> Expr -> Declaration)
-> DefInfo -> ArgInfo -> QName -> Expr -> Declaration
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 (\DefInfo
i ArgInfo
a QName
c Expr
d -> KindOfName
-> DefInfo
-> ArgInfo
-> Maybe [Occurrence]
-> QName
-> Expr
-> Declaration
Axiom KindOfName
p DefInfo
i ArgInfo
a Maybe [Occurrence]
b QName
c Expr
d) DefInfo
i ArgInfo
a QName
c Expr
d
  killRange (Generalize Set QName
s DefInfo
i ArgInfo
j QName
x Expr
e     ) = (DefInfo -> ArgInfo -> QName -> Expr -> Declaration)
-> DefInfo -> ArgInfo -> QName -> Expr -> Declaration
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 (Set QName -> DefInfo -> ArgInfo -> QName -> Expr -> Declaration
Generalize Set QName
s) DefInfo
i ArgInfo
j QName
x Expr
e
  killRange (Field      DefInfo
i QName
a Arg Expr
b         ) = (DefInfo -> QName -> Arg Expr -> Declaration)
-> DefInfo -> QName -> Arg Expr -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 DefInfo -> QName -> Arg Expr -> Declaration
Field      DefInfo
i QName
a Arg Expr
b
  killRange (Mutual     MutualInfo
i [Declaration]
a           ) = (MutualInfo -> [Declaration] -> Declaration)
-> MutualInfo -> [Declaration] -> Declaration
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 MutualInfo -> [Declaration] -> Declaration
Mutual     MutualInfo
i [Declaration]
a
  killRange (Section    Range
i ModuleName
a GeneralizeTelescope
b [Declaration]
c       ) = (Range
 -> ModuleName
 -> GeneralizeTelescope
 -> [Declaration]
 -> Declaration)
-> Range
-> ModuleName
-> GeneralizeTelescope
-> [Declaration]
-> Declaration
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 Range
-> ModuleName
-> GeneralizeTelescope
-> [Declaration]
-> Declaration
Section    Range
i ModuleName
a GeneralizeTelescope
b [Declaration]
c
  killRange (Apply      ModuleInfo
i ModuleName
a ModuleApplication
b ScopeCopyInfo
c ImportDirective
d     ) = (ModuleInfo
 -> ModuleName
 -> ModuleApplication
 -> ScopeCopyInfo
 -> ImportDirective
 -> Declaration)
-> ModuleInfo
-> ModuleName
-> ModuleApplication
-> ScopeCopyInfo
-> ImportDirective
-> Declaration
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 ModuleInfo
-> ModuleName
-> ModuleApplication
-> ScopeCopyInfo
-> ImportDirective
-> Declaration
Apply      ModuleInfo
i ModuleName
a ModuleApplication
b ScopeCopyInfo
c ImportDirective
d
  killRange (Import     ModuleInfo
i ModuleName
a ImportDirective
b         ) = (ModuleInfo -> ModuleName -> ImportDirective -> Declaration)
-> ModuleInfo -> ModuleName -> ImportDirective -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ModuleInfo -> ModuleName -> ImportDirective -> Declaration
Import     ModuleInfo
i ModuleName
a ImportDirective
b
  killRange (Primitive  DefInfo
i QName
a Arg Expr
b         ) = (DefInfo -> QName -> Arg Expr -> Declaration)
-> DefInfo -> QName -> Arg Expr -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 DefInfo -> QName -> Arg Expr -> Declaration
Primitive  DefInfo
i QName
a Arg Expr
b
  killRange (Pragma     Range
i Pragma
a           ) = Range -> Pragma -> Declaration
Pragma (Range -> Range
forall a. KillRange a => KillRangeT a
killRange Range
i) Pragma
a
  killRange (Open       ModuleInfo
i ModuleName
x ImportDirective
dir       ) = (ModuleInfo -> ModuleName -> ImportDirective -> Declaration)
-> ModuleInfo -> ModuleName -> ImportDirective -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ModuleInfo -> ModuleName -> ImportDirective -> Declaration
Open       ModuleInfo
i ModuleName
x ImportDirective
dir
  killRange (ScopedDecl ScopeInfo
a [Declaration]
d           ) = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (ScopeInfo -> [Declaration] -> Declaration
ScopedDecl ScopeInfo
a) [Declaration]
d
  killRange (FunDef  DefInfo
i QName
a Delayed
b [Clause]
c          ) = (DefInfo -> QName -> Delayed -> [Clause] -> Declaration)
-> DefInfo -> QName -> Delayed -> [Clause] -> Declaration
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 DefInfo -> QName -> Delayed -> [Clause] -> Declaration
FunDef  DefInfo
i QName
a Delayed
b [Clause]
c
  killRange (DataSig DefInfo
i QName
a GeneralizeTelescope
b Expr
c          ) = (DefInfo -> QName -> GeneralizeTelescope -> Expr -> Declaration)
-> DefInfo -> QName -> GeneralizeTelescope -> Expr -> Declaration
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 DefInfo -> QName -> GeneralizeTelescope -> Expr -> Declaration
DataSig DefInfo
i QName
a GeneralizeTelescope
b Expr
c
  killRange (DataDef DefInfo
i QName
a UniverseCheck
b DataDefParams
c [Declaration]
d        ) = (DefInfo
 -> QName
 -> UniverseCheck
 -> DataDefParams
 -> [Declaration]
 -> Declaration)
-> DefInfo
-> QName
-> UniverseCheck
-> DataDefParams
-> [Declaration]
-> Declaration
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 DefInfo
-> QName
-> UniverseCheck
-> DataDefParams
-> [Declaration]
-> Declaration
DataDef DefInfo
i QName
a UniverseCheck
b DataDefParams
c [Declaration]
d
  killRange (RecSig  DefInfo
i QName
a GeneralizeTelescope
b Expr
c          ) = (DefInfo -> QName -> GeneralizeTelescope -> Expr -> Declaration)
-> DefInfo -> QName -> GeneralizeTelescope -> Expr -> Declaration
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 DefInfo -> QName -> GeneralizeTelescope -> Expr -> Declaration
RecSig  DefInfo
i QName
a GeneralizeTelescope
b Expr
c
  killRange (RecDef  DefInfo
i QName
a UniverseCheck
b RecordDirectives
c DataDefParams
d Expr
e [Declaration]
f    ) = (DefInfo
 -> QName
 -> UniverseCheck
 -> RecordDirectives
 -> DataDefParams
 -> Expr
 -> [Declaration]
 -> Declaration)
-> DefInfo
-> QName
-> UniverseCheck
-> RecordDirectives
-> DataDefParams
-> Expr
-> [Declaration]
-> Declaration
forall a b c d e f g h.
(KillRange a, KillRange b, KillRange c, KillRange d, KillRange e,
 KillRange f, KillRange g) =>
(a -> b -> c -> d -> e -> f -> g -> h)
-> a -> b -> c -> d -> e -> f -> g -> h
killRange7 DefInfo
-> QName
-> UniverseCheck
-> RecordDirectives
-> DataDefParams
-> Expr
-> [Declaration]
-> Declaration
RecDef  DefInfo
i QName
a UniverseCheck
b RecordDirectives
c DataDefParams
d Expr
e [Declaration]
f
  killRange (PatternSynDef QName
x [Arg BindName]
xs Pattern' Void
p     ) = (QName -> [Arg BindName] -> Pattern' Void -> Declaration)
-> QName -> [Arg BindName] -> Pattern' Void -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 QName -> [Arg BindName] -> Pattern' Void -> Declaration
PatternSynDef QName
x [Arg BindName]
xs Pattern' Void
p
  killRange (UnquoteDecl MutualInfo
mi [DefInfo]
i [QName]
x Expr
e     ) = (MutualInfo -> [DefInfo] -> [QName] -> Expr -> Declaration)
-> MutualInfo -> [DefInfo] -> [QName] -> Expr -> Declaration
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 MutualInfo -> [DefInfo] -> [QName] -> Expr -> Declaration
UnquoteDecl MutualInfo
mi [DefInfo]
i [QName]
x Expr
e
  killRange (UnquoteDef [DefInfo]
i [QName]
x Expr
e         ) = ([DefInfo] -> [QName] -> Expr -> Declaration)
-> [DefInfo] -> [QName] -> Expr -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 [DefInfo] -> [QName] -> Expr -> Declaration
UnquoteDef [DefInfo]
i [QName]
x Expr
e

instance KillRange ModuleApplication where
  killRange :: ModuleApplication -> ModuleApplication
killRange (SectionApp [TypedBinding]
a ModuleName
b [NamedArg Expr]
c  ) = ([TypedBinding]
 -> ModuleName -> [NamedArg Expr] -> ModuleApplication)
-> [TypedBinding]
-> ModuleName
-> [NamedArg Expr]
-> ModuleApplication
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 [TypedBinding]
-> ModuleName -> [NamedArg Expr] -> ModuleApplication
SectionApp [TypedBinding]
a ModuleName
b [NamedArg Expr]
c
  killRange (RecordModuleInstance ModuleName
a) = (ModuleName -> ModuleApplication)
-> ModuleName -> ModuleApplication
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 ModuleName -> ModuleApplication
RecordModuleInstance ModuleName
a

instance KillRange ScopeCopyInfo where
  killRange :: ScopeCopyInfo -> ScopeCopyInfo
killRange (ScopeCopyInfo Ren ModuleName
a Ren QName
b) = (Ren ModuleName -> Ren QName -> ScopeCopyInfo)
-> Ren ModuleName -> Ren QName -> ScopeCopyInfo
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Ren ModuleName -> Ren QName -> ScopeCopyInfo
ScopeCopyInfo Ren ModuleName
a Ren QName
b

instance KillRange e => KillRange (Pattern' e) where
  killRange :: KillRangeT (Pattern' e)
killRange (VarP BindName
x)           = (BindName -> Pattern' e) -> BindName -> Pattern' e
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 BindName -> Pattern' e
forall e. BindName -> Pattern' e
VarP BindName
x
  killRange (ConP ConPatInfo
i AmbiguousQName
a NAPs e
b)        = (ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e)
-> ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
forall e. ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
ConP ConPatInfo
i AmbiguousQName
a NAPs e
b
  killRange (ProjP PatInfo
i ProjOrigin
o AmbiguousQName
a)       = (PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' e)
-> PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' e
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' e
forall e. PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' e
ProjP PatInfo
i ProjOrigin
o AmbiguousQName
a
  killRange (DefP PatInfo
i AmbiguousQName
a NAPs e
b)        = (PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e)
-> PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
forall e. PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
DefP PatInfo
i AmbiguousQName
a NAPs e
b
  killRange (WildP PatInfo
i)           = (PatInfo -> Pattern' e) -> PatInfo -> Pattern' e
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 PatInfo -> Pattern' e
forall e. PatInfo -> Pattern' e
WildP PatInfo
i
  killRange (AsP PatInfo
i BindName
a Pattern' e
b)         = (PatInfo -> BindName -> KillRangeT (Pattern' e))
-> PatInfo -> BindName -> KillRangeT (Pattern' e)
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 PatInfo -> BindName -> KillRangeT (Pattern' e)
forall e. PatInfo -> BindName -> Pattern' e -> Pattern' e
AsP PatInfo
i BindName
a Pattern' e
b
  killRange (DotP PatInfo
i e
a)          = (PatInfo -> e -> Pattern' e) -> PatInfo -> e -> Pattern' e
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 PatInfo -> e -> Pattern' e
forall e. PatInfo -> e -> Pattern' e
DotP PatInfo
i e
a
  killRange (AbsurdP PatInfo
i)         = (PatInfo -> Pattern' e) -> PatInfo -> Pattern' e
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 PatInfo -> Pattern' e
forall e. PatInfo -> Pattern' e
AbsurdP PatInfo
i
  killRange (LitP PatInfo
i Literal
l)          = (PatInfo -> Literal -> Pattern' e)
-> PatInfo -> Literal -> Pattern' e
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 PatInfo -> Literal -> Pattern' e
forall e. PatInfo -> Literal -> Pattern' e
LitP PatInfo
i Literal
l
  killRange (PatternSynP PatInfo
i AmbiguousQName
a NAPs e
p) = (PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e)
-> PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
forall e. PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
PatternSynP PatInfo
i AmbiguousQName
a NAPs e
p
  killRange (RecP PatInfo
i [FieldAssignment' (Pattern' e)]
as)         = (PatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e)
-> PatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 PatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e
forall e. PatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e
RecP PatInfo
i [FieldAssignment' (Pattern' e)]
as
  killRange (EqualP PatInfo
i [(e, e)]
es)       = (PatInfo -> [(e, e)] -> Pattern' e)
-> PatInfo -> [(e, e)] -> Pattern' e
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 PatInfo -> [(e, e)] -> Pattern' e
forall e. PatInfo -> [(e, e)] -> Pattern' e
EqualP PatInfo
i [(e, e)]
es
  killRange (WithP PatInfo
i Pattern' e
p)         = (PatInfo -> KillRangeT (Pattern' e))
-> PatInfo -> KillRangeT (Pattern' e)
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 PatInfo -> KillRangeT (Pattern' e)
forall e. PatInfo -> Pattern' e -> Pattern' e
WithP PatInfo
i Pattern' e
p
  killRange (AnnP PatInfo
i e
a Pattern' e
p)        = (PatInfo -> e -> KillRangeT (Pattern' e))
-> PatInfo -> e -> KillRangeT (Pattern' e)
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 PatInfo -> e -> KillRangeT (Pattern' e)
forall e. PatInfo -> e -> Pattern' e -> Pattern' e
AnnP PatInfo
i e
a Pattern' e
p

instance KillRange SpineLHS where
  killRange :: SpineLHS -> SpineLHS
killRange (SpineLHS LHSInfo
i QName
a [NamedArg Pattern]
b)  = (LHSInfo -> QName -> [NamedArg Pattern] -> SpineLHS)
-> LHSInfo -> QName -> [NamedArg Pattern] -> SpineLHS
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 LHSInfo -> QName -> [NamedArg Pattern] -> SpineLHS
SpineLHS LHSInfo
i QName
a [NamedArg Pattern]
b

instance KillRange LHS where
  killRange :: LHS -> LHS
killRange (LHS LHSInfo
i LHSCore
a)   = (LHSInfo -> LHSCore -> LHS) -> LHSInfo -> LHSCore -> LHS
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 LHSInfo -> LHSCore -> LHS
LHS LHSInfo
i LHSCore
a

instance KillRange e => KillRange (LHSCore' e) where
  killRange :: KillRangeT (LHSCore' e)
killRange (LHSHead QName
a [NamedArg (Pattern' e)]
b)   = (QName -> [NamedArg (Pattern' e)] -> LHSCore' e)
-> QName -> [NamedArg (Pattern' e)] -> LHSCore' e
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 QName -> [NamedArg (Pattern' e)] -> LHSCore' e
forall e. QName -> [NamedArg (Pattern' e)] -> LHSCore' e
LHSHead QName
a [NamedArg (Pattern' e)]
b
  killRange (LHSProj AmbiguousQName
a NamedArg (LHSCore' e)
b [NamedArg (Pattern' e)]
c) = (AmbiguousQName
 -> NamedArg (LHSCore' e) -> [NamedArg (Pattern' e)] -> LHSCore' e)
-> AmbiguousQName
-> NamedArg (LHSCore' e)
-> [NamedArg (Pattern' e)]
-> LHSCore' e
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 AmbiguousQName
-> NamedArg (LHSCore' e) -> [NamedArg (Pattern' e)] -> LHSCore' e
forall e.
AmbiguousQName
-> NamedArg (LHSCore' e) -> [NamedArg (Pattern' e)] -> LHSCore' e
LHSProj AmbiguousQName
a NamedArg (LHSCore' e)
b [NamedArg (Pattern' e)]
c
  killRange (LHSWith LHSCore' e
a [Arg (Pattern' e)]
b [NamedArg (Pattern' e)]
c) = (LHSCore' e
 -> [Arg (Pattern' e)] -> [NamedArg (Pattern' e)] -> LHSCore' e)
-> LHSCore' e
-> [Arg (Pattern' e)]
-> [NamedArg (Pattern' e)]
-> LHSCore' e
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 LHSCore' e
-> [Arg (Pattern' e)] -> [NamedArg (Pattern' e)] -> LHSCore' e
forall e.
LHSCore' e
-> [Arg (Pattern' e)] -> [NamedArg (Pattern' e)] -> LHSCore' e
LHSWith LHSCore' e
a [Arg (Pattern' e)]
b [NamedArg (Pattern' e)]
c

instance KillRange a => KillRange (Clause' a) where
  killRange :: KillRangeT (Clause' a)
killRange (Clause a
lhs [ProblemEq]
spats RHS
rhs WhereDeclarations
ds Bool
catchall) = (a -> [ProblemEq] -> RHS -> WhereDeclarations -> Bool -> Clause' a)
-> a
-> [ProblemEq]
-> RHS
-> WhereDeclarations
-> Bool
-> Clause' a
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 a -> [ProblemEq] -> RHS -> WhereDeclarations -> Bool -> Clause' a
forall lhs.
lhs
-> [ProblemEq] -> RHS -> WhereDeclarations -> Bool -> Clause' lhs
Clause a
lhs [ProblemEq]
spats RHS
rhs WhereDeclarations
ds Bool
catchall

instance KillRange ProblemEq where
  killRange :: ProblemEq -> ProblemEq
killRange (ProblemEq Pattern
p Term
v Dom Type
a) = (Pattern -> Term -> Dom Type -> ProblemEq)
-> Pattern -> Term -> Dom Type -> ProblemEq
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 Pattern -> Term -> Dom Type -> ProblemEq
ProblemEq Pattern
p Term
v Dom Type
a

instance KillRange RHS where
  killRange :: RHS -> RHS
killRange RHS
AbsurdRHS                = RHS
AbsurdRHS
  killRange (RHS Expr
e Maybe Expr
c)                = (Expr -> Maybe Expr -> RHS) -> Expr -> Maybe Expr -> RHS
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Expr -> Maybe Expr -> RHS
RHS Expr
e Maybe Expr
c
  killRange (WithRHS QName
q [WithExpr]
e [Clause]
cs)         = (QName -> [WithExpr] -> [Clause] -> RHS)
-> QName -> [WithExpr] -> [Clause] -> RHS
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 QName -> [WithExpr] -> [Clause] -> RHS
WithRHS QName
q [WithExpr]
e [Clause]
cs
  killRange (RewriteRHS [RewriteEqn]
xes [ProblemEq]
spats RHS
rhs WhereDeclarations
wh) = ([RewriteEqn] -> [ProblemEq] -> RHS -> WhereDeclarations -> RHS)
-> [RewriteEqn] -> [ProblemEq] -> RHS -> WhereDeclarations -> RHS
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 [RewriteEqn] -> [ProblemEq] -> RHS -> WhereDeclarations -> RHS
RewriteRHS [RewriteEqn]
xes [ProblemEq]
spats RHS
rhs WhereDeclarations
wh

instance KillRange WhereDeclarations where
  killRange :: WhereDeclarations -> WhereDeclarations
killRange (WhereDecls Maybe ModuleName
a Maybe Declaration
b) = (Maybe ModuleName -> Maybe Declaration -> WhereDeclarations)
-> Maybe ModuleName -> Maybe Declaration -> WhereDeclarations
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Maybe ModuleName -> Maybe Declaration -> WhereDeclarations
WhereDecls Maybe ModuleName
a Maybe Declaration
b

instance KillRange LetBinding where
  killRange :: LetBinding -> LetBinding
killRange (LetBind   LetInfo
i ArgInfo
info BindName
a Expr
b Expr
c) = (LetInfo -> ArgInfo -> BindName -> Expr -> Expr -> LetBinding)
-> LetInfo -> ArgInfo -> BindName -> Expr -> Expr -> LetBinding
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 LetInfo -> ArgInfo -> BindName -> Expr -> Expr -> LetBinding
LetBind LetInfo
i ArgInfo
info BindName
a Expr
b Expr
c
  killRange (LetPatBind LetInfo
i Pattern
a Expr
b       ) = (LetInfo -> Pattern -> Expr -> LetBinding)
-> LetInfo -> Pattern -> Expr -> LetBinding
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 LetInfo -> Pattern -> Expr -> LetBinding
LetPatBind LetInfo
i Pattern
a Expr
b
  killRange (LetApply   ModuleInfo
i ModuleName
a ModuleApplication
b ScopeCopyInfo
c ImportDirective
d   ) = (ModuleInfo
 -> ModuleName
 -> ModuleApplication
 -> ScopeCopyInfo
 -> ImportDirective
 -> LetBinding)
-> ModuleInfo
-> ModuleName
-> ModuleApplication
-> ScopeCopyInfo
-> ImportDirective
-> LetBinding
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 ModuleInfo
-> ModuleName
-> ModuleApplication
-> ScopeCopyInfo
-> ImportDirective
-> LetBinding
LetApply ModuleInfo
i ModuleName
a ModuleApplication
b ScopeCopyInfo
c ImportDirective
d
  killRange (LetOpen    ModuleInfo
i ModuleName
x ImportDirective
dir     ) = (ModuleInfo -> ModuleName -> ImportDirective -> LetBinding)
-> ModuleInfo -> ModuleName -> ImportDirective -> LetBinding
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ModuleInfo -> ModuleName -> ImportDirective -> LetBinding
LetOpen  ModuleInfo
i ModuleName
x ImportDirective
dir
  killRange (LetDeclaredVariable BindName
x)  = (BindName -> LetBinding) -> BindName -> LetBinding
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 BindName -> LetBinding
LetDeclaredVariable BindName
x

instance NFData Expr
instance NFData ScopeCopyInfo
instance NFData Declaration
instance NFData ModuleApplication
instance NFData Pragma
instance NFData LetBinding
instance NFData a => NFData (Binder' a)
instance NFData LamBinding
instance NFData TypedBinding
instance NFData GeneralizeTelescope
instance NFData DataDefParams
instance NFData ProblemEq
instance NFData lhs => NFData (Clause' lhs)
instance NFData WhereDeclarations
instance NFData RHS
instance NFData SpineLHS
instance NFData LHS
instance NFData e => NFData (LHSCore' e)
instance NFData e => NFData (Pattern' e)

------------------------------------------------------------------------
-- Queries
------------------------------------------------------------------------

-- class AllNames moved to Abstract.Views.DeclaredNames

-- | The name defined by the given axiom.
--
-- Precondition: The declaration has to be a (scoped) 'Axiom'.

axiomName :: Declaration -> QName
axiomName :: Declaration -> QName
axiomName (Axiom KindOfName
_ DefInfo
_ ArgInfo
_ Maybe [Occurrence]
_ QName
q Expr
_)  = QName
q
axiomName (ScopedDecl ScopeInfo
_ (Declaration
d:[Declaration]
_)) = Declaration -> QName
axiomName Declaration
d
axiomName Declaration
_                    = QName
forall a. HasCallStack => a
__IMPOSSIBLE__

-- | Are we in an abstract block?
--
--   In that case some definition is abstract.
class AnyAbstract a where
  anyAbstract :: a -> Bool

instance AnyAbstract a => AnyAbstract [a] where
  anyAbstract :: [a] -> Bool
anyAbstract = (a -> Bool) -> [a] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
Fold.any a -> Bool
forall a. AnyAbstract a => a -> Bool
anyAbstract

instance AnyAbstract Declaration where
  anyAbstract :: Declaration -> Bool
anyAbstract (Axiom KindOfName
_ DefInfo
i ArgInfo
_ Maybe [Occurrence]
_ QName
_ Expr
_)    = DefInfo -> IsAbstract
forall t. DefInfo' t -> IsAbstract
defAbstract DefInfo
i IsAbstract -> IsAbstract -> Bool
forall a. Eq a => a -> a -> Bool
== IsAbstract
AbstractDef
  anyAbstract (Field DefInfo
i QName
_ Arg Expr
_)          = DefInfo -> IsAbstract
forall t. DefInfo' t -> IsAbstract
defAbstract DefInfo
i IsAbstract -> IsAbstract -> Bool
forall a. Eq a => a -> a -> Bool
== IsAbstract
AbstractDef
  anyAbstract (Mutual     MutualInfo
_ [Declaration]
ds)      = [Declaration] -> Bool
forall a. AnyAbstract a => a -> Bool
anyAbstract [Declaration]
ds
  anyAbstract (ScopedDecl ScopeInfo
_ [Declaration]
ds)      = [Declaration] -> Bool
forall a. AnyAbstract a => a -> Bool
anyAbstract [Declaration]
ds
  anyAbstract (Section Range
_ ModuleName
_ GeneralizeTelescope
_ [Declaration]
ds)     = [Declaration] -> Bool
forall a. AnyAbstract a => a -> Bool
anyAbstract [Declaration]
ds
  anyAbstract (FunDef DefInfo
i QName
_ Delayed
_ [Clause]
_)       = DefInfo -> IsAbstract
forall t. DefInfo' t -> IsAbstract
defAbstract DefInfo
i IsAbstract -> IsAbstract -> Bool
forall a. Eq a => a -> a -> Bool
== IsAbstract
AbstractDef
  anyAbstract (DataDef DefInfo
i QName
_ UniverseCheck
_ DataDefParams
_ [Declaration]
_)    = DefInfo -> IsAbstract
forall t. DefInfo' t -> IsAbstract
defAbstract DefInfo
i IsAbstract -> IsAbstract -> Bool
forall a. Eq a => a -> a -> Bool
== IsAbstract
AbstractDef
  anyAbstract (RecDef DefInfo
i QName
_ UniverseCheck
_ RecordDirectives
_ DataDefParams
_ Expr
_ [Declaration]
_) = DefInfo -> IsAbstract
forall t. DefInfo' t -> IsAbstract
defAbstract DefInfo
i IsAbstract -> IsAbstract -> Bool
forall a. Eq a => a -> a -> Bool
== IsAbstract
AbstractDef
  anyAbstract (DataSig DefInfo
i QName
_ GeneralizeTelescope
_ Expr
_)      = DefInfo -> IsAbstract
forall t. DefInfo' t -> IsAbstract
defAbstract DefInfo
i IsAbstract -> IsAbstract -> Bool
forall a. Eq a => a -> a -> Bool
== IsAbstract
AbstractDef
  anyAbstract (RecSig DefInfo
i QName
_ GeneralizeTelescope
_ Expr
_)       = DefInfo -> IsAbstract
forall t. DefInfo' t -> IsAbstract
defAbstract DefInfo
i IsAbstract -> IsAbstract -> Bool
forall a. Eq a => a -> a -> Bool
== IsAbstract
AbstractDef
  anyAbstract Declaration
_                      = Bool
forall a. HasCallStack => a
__IMPOSSIBLE__

-- | Turn a name into an expression.

class NameToExpr a where
  nameToExpr :: a -> Expr

-- | Turn an 'AbstractName' into an expression.

instance NameToExpr AbstractName where
  nameToExpr :: AbstractName -> Expr
nameToExpr AbstractName
d =
    case AbstractName -> KindOfName
anameKind AbstractName
d of
      KindOfName
DataName                 -> QName -> Expr
Def QName
x
      KindOfName
RecName                  -> QName -> Expr
Def QName
x
      KindOfName
AxiomName                -> QName -> Expr
Def QName
x
      KindOfName
PrimName                 -> QName -> Expr
Def QName
x
      KindOfName
FunName                  -> QName -> Expr
Def QName
x
      KindOfName
OtherDefName             -> QName -> Expr
Def QName
x
      KindOfName
GeneralizeName           -> QName -> Expr
Def QName
x
      KindOfName
DisallowedGeneralizeName -> QName -> Expr
Def QName
x
      KindOfName
FldName                  -> ProjOrigin -> AmbiguousQName -> Expr
Proj ProjOrigin
ProjSystem AmbiguousQName
ux
      KindOfName
ConName                  -> AmbiguousQName -> Expr
Con AmbiguousQName
ux
      KindOfName
CoConName                -> AmbiguousQName -> Expr
Con AmbiguousQName
ux
      KindOfName
PatternSynName           -> AmbiguousQName -> Expr
PatternSyn AmbiguousQName
ux
      KindOfName
MacroName                -> QName -> Expr
Macro QName
x
      KindOfName
QuotableName             -> AppInfo -> Expr -> NamedArg Expr -> Expr
App (Range -> AppInfo
defaultAppInfo Range
r) (ExprInfo -> Expr
Quote ExprInfo
i) (Expr -> NamedArg Expr
forall a. a -> NamedArg a
defaultNamedArg (Expr -> NamedArg Expr) -> Expr -> NamedArg Expr
forall a b. (a -> b) -> a -> b
$ QName -> Expr
Def QName
x)
    where
    x :: QName
x  = AbstractName -> QName
anameName AbstractName
d
    ux :: AmbiguousQName
ux = QName -> AmbiguousQName
unambiguous QName
x
    r :: Range
r  = QName -> Range
forall a. HasRange a => a -> Range
getRange QName
x
    i :: ExprInfo
i  = Range -> ExprInfo
ExprRange Range
r

-- | Turn a 'ResolvedName' into an expression.
--
--   Assumes name is not 'UnknownName'.

instance NameToExpr ResolvedName where
  nameToExpr :: ResolvedName -> Expr
nameToExpr = \case
    VarName Name
x BindingSource
_          -> Name -> Expr
Var Name
x
    DefinedName Access
_ AbstractName
x Suffix
s    -> Suffix -> Expr -> Expr
withSuffix Suffix
s (Expr -> Expr) -> Expr -> Expr
forall a b. (a -> b) -> a -> b
$ AbstractName -> Expr
forall a. NameToExpr a => a -> Expr
nameToExpr AbstractName
x  -- Can be 'isDefName', 'MacroName', 'QuotableName'.
    FieldName List1 AbstractName
xs         -> ProjOrigin -> AmbiguousQName -> Expr
Proj ProjOrigin
ProjSystem (AmbiguousQName -> Expr)
-> (List1 AbstractName -> AmbiguousQName)
-> List1 AbstractName
-> Expr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. List1 QName -> AmbiguousQName
AmbQ (List1 QName -> AmbiguousQName)
-> (List1 AbstractName -> List1 QName)
-> List1 AbstractName
-> AmbiguousQName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AbstractName -> QName) -> List1 AbstractName -> List1 QName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AbstractName -> QName
anameName (List1 AbstractName -> Expr) -> List1 AbstractName -> Expr
forall a b. (a -> b) -> a -> b
$ List1 AbstractName
xs
    ConstructorName Set Induction
_ List1 AbstractName
xs -> AmbiguousQName -> Expr
Con (AmbiguousQName -> Expr)
-> (List1 AbstractName -> AmbiguousQName)
-> List1 AbstractName
-> Expr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. List1 QName -> AmbiguousQName
AmbQ (List1 QName -> AmbiguousQName)
-> (List1 AbstractName -> List1 QName)
-> List1 AbstractName
-> AmbiguousQName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AbstractName -> QName) -> List1 AbstractName -> List1 QName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AbstractName -> QName
anameName (List1 AbstractName -> Expr) -> List1 AbstractName -> Expr
forall a b. (a -> b) -> a -> b
$ List1 AbstractName
xs
    PatternSynResName List1 AbstractName
xs -> AmbiguousQName -> Expr
PatternSyn (AmbiguousQName -> Expr)
-> (List1 AbstractName -> AmbiguousQName)
-> List1 AbstractName
-> Expr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. List1 QName -> AmbiguousQName
AmbQ (List1 QName -> AmbiguousQName)
-> (List1 AbstractName -> List1 QName)
-> List1 AbstractName
-> AmbiguousQName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AbstractName -> QName) -> List1 AbstractName -> List1 QName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AbstractName -> QName
anameName (List1 AbstractName -> Expr) -> List1 AbstractName -> Expr
forall a b. (a -> b) -> a -> b
$ List1 AbstractName
xs
    ResolvedName
UnknownName          -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    where
      withSuffix :: Suffix -> Expr -> Expr
withSuffix Suffix
NoSuffix   Expr
e       = Expr
e
      withSuffix s :: Suffix
s@Suffix{} (Def QName
x) = QName -> Suffix -> Expr
Def' QName
x Suffix
s
      withSuffix Suffix
_          Expr
_       = Expr
forall a. HasCallStack => a
__IMPOSSIBLE__

app :: Expr -> [NamedArg Expr] -> Expr
app :: Expr -> [NamedArg Expr] -> Expr
app = (Expr -> NamedArg Expr -> Expr) -> Expr -> [NamedArg Expr] -> Expr
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl (AppInfo -> Expr -> NamedArg Expr -> Expr
App AppInfo
defaultAppInfo_)

mkLet :: ExprInfo -> [LetBinding] -> Expr -> Expr
mkLet :: ExprInfo -> [LetBinding] -> Expr -> Expr
mkLet ExprInfo
_ []     Expr
e = Expr
e
mkLet ExprInfo
i (LetBinding
d:[LetBinding]
ds) Expr
e = ExprInfo -> List1 LetBinding -> Expr -> Expr
Let ExprInfo
i (LetBinding
d LetBinding -> [LetBinding] -> List1 LetBinding
forall a. a -> [a] -> NonEmpty a
:| [LetBinding]
ds) Expr
e

patternToExpr :: Pattern -> Expr
patternToExpr :: Pattern -> Expr
patternToExpr = \case
  VarP BindName
x             -> Name -> Expr
Var (BindName -> Name
unBind BindName
x)
  ConP ConPatInfo
_ AmbiguousQName
c [NamedArg Pattern]
ps        -> AmbiguousQName -> Expr
Con AmbiguousQName
c Expr -> [NamedArg Expr] -> Expr
`app` (NamedArg Pattern -> NamedArg Expr)
-> [NamedArg Pattern] -> [NamedArg Expr]
forall a b. (a -> b) -> [a] -> [b]
map ((Named NamedName Pattern -> Named NamedName Expr)
-> NamedArg Pattern -> NamedArg Expr
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Pattern -> Expr)
-> Named NamedName Pattern -> Named NamedName Expr
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Pattern -> Expr
patternToExpr)) [NamedArg Pattern]
ps
  ProjP PatInfo
_ ProjOrigin
o AmbiguousQName
ds       -> ProjOrigin -> AmbiguousQName -> Expr
Proj ProjOrigin
o AmbiguousQName
ds
  DefP PatInfo
_ AmbiguousQName
fs [NamedArg Pattern]
ps       -> QName -> Expr
Def (AmbiguousQName -> QName
headAmbQ AmbiguousQName
fs) Expr -> [NamedArg Expr] -> Expr
`app` (NamedArg Pattern -> NamedArg Expr)
-> [NamedArg Pattern] -> [NamedArg Expr]
forall a b. (a -> b) -> [a] -> [b]
map ((Named NamedName Pattern -> Named NamedName Expr)
-> NamedArg Pattern -> NamedArg Expr
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Pattern -> Expr)
-> Named NamedName Pattern -> Named NamedName Expr
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Pattern -> Expr
patternToExpr)) [NamedArg Pattern]
ps
  WildP PatInfo
_            -> MetaInfo -> Expr
Underscore MetaInfo
emptyMetaInfo
  AsP PatInfo
_ BindName
_ Pattern
p          -> Pattern -> Expr
patternToExpr Pattern
p
  DotP PatInfo
_ Expr
e           -> Expr
e
  AbsurdP PatInfo
_          -> MetaInfo -> Expr
Underscore MetaInfo
emptyMetaInfo  -- TODO: could this happen?
  LitP (PatRange Range
r) Literal
l-> ExprInfo -> Literal -> Expr
Lit (Range -> ExprInfo
ExprRange Range
r) Literal
l
  PatternSynP PatInfo
_ AmbiguousQName
c [NamedArg Pattern]
ps -> AmbiguousQName -> Expr
PatternSyn AmbiguousQName
c Expr -> [NamedArg Expr] -> Expr
`app` ((NamedArg Pattern -> NamedArg Expr)
-> [NamedArg Pattern] -> [NamedArg Expr]
forall a b. (a -> b) -> [a] -> [b]
map ((NamedArg Pattern -> NamedArg Expr)
 -> [NamedArg Pattern] -> [NamedArg Expr])
-> ((Pattern -> Expr) -> NamedArg Pattern -> NamedArg Expr)
-> (Pattern -> Expr)
-> [NamedArg Pattern]
-> [NamedArg Expr]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Named NamedName Pattern -> Named NamedName Expr)
-> NamedArg Pattern -> NamedArg Expr
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Named NamedName Pattern -> Named NamedName Expr)
 -> NamedArg Pattern -> NamedArg Expr)
-> ((Pattern -> Expr)
    -> Named NamedName Pattern -> Named NamedName Expr)
-> (Pattern -> Expr)
-> NamedArg Pattern
-> NamedArg Expr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Pattern -> Expr)
-> Named NamedName Pattern -> Named NamedName Expr
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap) Pattern -> Expr
patternToExpr [NamedArg Pattern]
ps
  RecP PatInfo
_ [FieldAssignment' Pattern]
as          -> ExprInfo -> RecordAssigns -> Expr
Rec ExprInfo
exprNoRange (RecordAssigns -> Expr) -> RecordAssigns -> Expr
forall a b. (a -> b) -> a -> b
$ (FieldAssignment' Pattern
 -> Either (FieldAssignment' Expr) ModuleName)
-> [FieldAssignment' Pattern] -> RecordAssigns
forall a b. (a -> b) -> [a] -> [b]
map (FieldAssignment' Expr -> Either (FieldAssignment' Expr) ModuleName
forall a b. a -> Either a b
Left (FieldAssignment' Expr
 -> Either (FieldAssignment' Expr) ModuleName)
-> (FieldAssignment' Pattern -> FieldAssignment' Expr)
-> FieldAssignment' Pattern
-> Either (FieldAssignment' Expr) ModuleName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Pattern -> Expr)
-> FieldAssignment' Pattern -> FieldAssignment' Expr
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Pattern -> Expr
patternToExpr) [FieldAssignment' Pattern]
as
  EqualP{}           -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__  -- Andrea TODO: where is this used?
  WithP PatInfo
r Pattern
p          -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
  AnnP PatInfo
_ Expr
_ Pattern
p         -> Pattern -> Expr
patternToExpr Pattern
p

type PatternSynDefn = ([Arg Name], Pattern' Void)
type PatternSynDefns = Map QName PatternSynDefn

lambdaLiftExpr :: [Name] -> Expr -> Expr
lambdaLiftExpr :: [Name] -> Expr -> Expr
lambdaLiftExpr [Name]
ns Expr
e
  = (Name -> Expr -> Expr) -> Expr -> [Name] -> Expr
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr
      (\ Name
n -> ExprInfo -> LamBinding -> Expr -> Expr
Lam ExprInfo
exprNoRange (NamedArg Binder -> LamBinding
mkDomainFree (NamedArg Binder -> LamBinding) -> NamedArg Binder -> LamBinding
forall a b. (a -> b) -> a -> b
$ Binder -> NamedArg Binder
forall a. a -> NamedArg a
defaultNamedArg (Binder -> NamedArg Binder) -> Binder -> NamedArg Binder
forall a b. (a -> b) -> a -> b
$ Name -> Binder
mkBinder_ Name
n))
      Expr
e
      [Name]
ns

-- NOTE: This is only used on expressions that come from right-hand sides of pattern synonyms, and
-- thus does not have to handle all forms of expressions.
class SubstExpr a where
  substExpr :: [(Name, Expr)] -> a -> a

  default substExpr
    :: (Functor t, SubstExpr b, t b ~ a)
    => [(Name, Expr)] -> a -> a
  substExpr = (b -> b) -> t b -> t b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((b -> b) -> t b -> t b)
-> ([(Name, Expr)] -> b -> b) -> [(Name, Expr)] -> t b -> t b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(Name, Expr)] -> b -> b
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr

instance SubstExpr a => SubstExpr (Maybe a)
instance SubstExpr a => SubstExpr [a]
instance SubstExpr a => SubstExpr (List1 a)
instance SubstExpr a => SubstExpr (Arg a)
instance SubstExpr a => SubstExpr (Named name a)
instance SubstExpr a => SubstExpr (FieldAssignment' a)

instance (SubstExpr a, SubstExpr b) => SubstExpr (a, b) where
  substExpr :: [(Name, Expr)] -> (a, b) -> (a, b)
substExpr [(Name, Expr)]
s (a
x, b
y) = ([(Name, Expr)] -> a -> a
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s a
x, [(Name, Expr)] -> b -> b
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s b
y)

instance (SubstExpr a, SubstExpr b) => SubstExpr (Either a b) where
  substExpr :: [(Name, Expr)] -> Either a b -> Either a b
substExpr [(Name, Expr)]
s (Left a
x)  = a -> Either a b
forall a b. a -> Either a b
Left ([(Name, Expr)] -> a -> a
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s a
x)
  substExpr [(Name, Expr)]
s (Right b
y) = b -> Either a b
forall a b. b -> Either a b
Right ([(Name, Expr)] -> b -> b
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s b
y)

instance SubstExpr C.Name where
  substExpr :: [(Name, Expr)] -> Name -> Name
substExpr [(Name, Expr)]
_ = Name -> Name
forall a. a -> a
id

instance SubstExpr ModuleName where
  substExpr :: [(Name, Expr)] -> ModuleName -> ModuleName
substExpr [(Name, Expr)]
_ = ModuleName -> ModuleName
forall a. a -> a
id

instance SubstExpr Expr where
  substExpr :: [(Name, Expr)] -> Expr -> Expr
substExpr [(Name, Expr)]
s Expr
e = case Expr
e of
    Var Name
n           -> Expr -> TacticAttr -> Expr
forall a. a -> Maybe a -> a
fromMaybe Expr
e (Name -> [(Name, Expr)] -> TacticAttr
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup Name
n [(Name, Expr)]
s)
    Con AmbiguousQName
_           -> Expr
e
    Proj{}          -> Expr
e
    Def' QName
_ Suffix
_        -> Expr
e
    PatternSyn{}    -> Expr
e
    Lit ExprInfo
_ Literal
_         -> Expr
e
    Underscore   MetaInfo
_  -> Expr
e
    App  AppInfo
i Expr
e NamedArg Expr
e'     -> AppInfo -> Expr -> NamedArg Expr -> Expr
App AppInfo
i ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e) ([(Name, Expr)] -> NamedArg Expr -> NamedArg Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s NamedArg Expr
e')
    Rec  ExprInfo
i RecordAssigns
nes      -> ExprInfo -> RecordAssigns -> Expr
Rec ExprInfo
i ([(Name, Expr)] -> RecordAssigns -> RecordAssigns
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s RecordAssigns
nes)
    ScopedExpr ScopeInfo
si Expr
e -> ScopeInfo -> Expr -> Expr
ScopedExpr ScopeInfo
si ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e)
    -- The below cannot appear in pattern synonym right-hand sides
    QuestionMark{}  -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    Dot{}           -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    WithApp{}       -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    Lam{}           -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    AbsurdLam{}     -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    ExtendedLam{}   -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    Pi{}            -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    Generalized{}   -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    Fun{}           -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    Let{}           -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    ETel{}          -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    RecUpdate{}     -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    Quote{}         -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    QuoteTerm{}     -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    Unquote{}       -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    DontCare{}      -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__
    Macro{}         -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__

-- TODO: more informative failure
insertImplicitPatSynArgs
  :: HasRange a
  => (Range -> a)
  -> Range
  -> [Arg Name]
  -> [NamedArg a]
  -> Maybe ([(Name, a)], [Arg Name])
insertImplicitPatSynArgs :: (Range -> a)
-> Range
-> [Arg Name]
-> [NamedArg a]
-> Maybe ([(Name, a)], [Arg Name])
insertImplicitPatSynArgs Range -> a
wild Range
r [Arg Name]
ns [NamedArg a]
as = Range
-> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name])
matchArgs Range
r [Arg Name]
ns [NamedArg a]
as
  where
    matchNextArg :: Range -> Arg Name -> [NamedArg a] -> Maybe (a, [NamedArg a])
matchNextArg Range
r Arg Name
n as :: [NamedArg a]
as@(~(NamedArg a
a : [NamedArg a]
as'))
      | Arg Name -> [NamedArg a] -> Bool
forall a.
(LensHiding a, LensNamed a, NameOf a ~ NamedName) =>
Arg Name -> [a] -> Bool
matchNext Arg Name
n [NamedArg a]
as = (a, [NamedArg a]) -> Maybe (a, [NamedArg a])
forall (m :: * -> *) a. Monad m => a -> m a
return (NamedArg a -> a
forall a. NamedArg a -> a
namedArg NamedArg a
a, [NamedArg a]
as')
      | Arg Name -> Bool
forall a. LensHiding a => a -> Bool
visible Arg Name
n      = Maybe (a, [NamedArg a])
forall a. Maybe a
Nothing
      | Bool
otherwise      = (a, [NamedArg a]) -> Maybe (a, [NamedArg a])
forall (m :: * -> *) a. Monad m => a -> m a
return (Range -> a
wild Range
r, [NamedArg a]
as)

    matchNext :: Arg Name -> [a] -> Bool
matchNext Arg Name
_ [] = Bool
False
    matchNext Arg Name
n (a
a:[a]
as) = Arg Name -> a -> Bool
forall a b. (LensHiding a, LensHiding b) => a -> b -> Bool
sameHiding Arg Name
n a
a Bool -> Bool -> Bool
&& Bool -> (String -> Bool) -> Maybe String -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
True (String
x String -> String -> Bool
forall a. Eq a => a -> a -> Bool
==) (a -> Maybe String
forall a. (LensNamed a, NameOf a ~ NamedName) => a -> Maybe String
bareNameOf a
a)
      where
        x :: String
x = Name -> String
C.nameToRawName (Name -> String) -> Name -> String
forall a b. (a -> b) -> a -> b
$ Name -> Name
nameConcrete (Name -> Name) -> Name -> Name
forall a b. (a -> b) -> a -> b
$ Arg Name -> Name
forall e. Arg e -> e
unArg Arg Name
n

    matchArgs :: Range
-> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name])
matchArgs Range
r [] []     = ([(Name, a)], [Arg Name]) -> Maybe ([(Name, a)], [Arg Name])
forall (m :: * -> *) a. Monad m => a -> m a
return ([], [])
    matchArgs Range
r [] [NamedArg a]
as     = Maybe ([(Name, a)], [Arg Name])
forall a. Maybe a
Nothing
    matchArgs Range
r (Arg Name
n:[Arg Name]
ns) [] | Arg Name -> Bool
forall a. LensHiding a => a -> Bool
visible Arg Name
n = ([(Name, a)], [Arg Name]) -> Maybe ([(Name, a)], [Arg Name])
forall (m :: * -> *) a. Monad m => a -> m a
return ([], Arg Name
n Arg Name -> [Arg Name] -> [Arg Name]
forall a. a -> [a] -> [a]
: [Arg Name]
ns)    -- under-applied
    matchArgs Range
r (Arg Name
n:[Arg Name]
ns) [NamedArg a]
as = do
      (a
p, [NamedArg a]
as) <- Range -> Arg Name -> [NamedArg a] -> Maybe (a, [NamedArg a])
matchNextArg Range
r Arg Name
n [NamedArg a]
as
      ([(Name, a)] -> [(Name, a)])
-> ([(Name, a)], [Arg Name]) -> ([(Name, a)], [Arg Name])
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first ((Arg Name -> Name
forall e. Arg e -> e
unArg Arg Name
n, a
p) (Name, a) -> [(Name, a)] -> [(Name, a)]
forall a. a -> [a] -> [a]
:) (([(Name, a)], [Arg Name]) -> ([(Name, a)], [Arg Name]))
-> Maybe ([(Name, a)], [Arg Name])
-> Maybe ([(Name, a)], [Arg Name])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range
-> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name])
matchArgs (a -> Range
forall a. HasRange a => a -> Range
getRange a
p) [Arg Name]
ns [NamedArg a]
as