{-# LANGUAGE DeriveDataTypeable    #-}
{-# LANGUAGE TemplateHaskell       #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

{-| 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
import Control.Arrow (first)--, second, (***))

import Data.Foldable (Foldable)
import qualified Data.Foldable as Fold
import Data.Function (on)
import Data.Map (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 Data.Monoid (mappend)

import Agda.Syntax.Concrete (FieldAssignment'(..), exprFieldA)--, HoleContent'(..))
import qualified Agda.Syntax.Concrete as C
import Agda.Syntax.Abstract.Name
import Agda.Syntax.Abstract.Name as A (QNamed)
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.Geniplate
import Agda.Utils.Lens
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 t. (t -> Range) -> HasRange t
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 t. HasRange t -> (Range -> t -> t) -> SetRange t
setRange :: Range -> BindName -> BindName
$csetRange :: Range -> BindName -> BindName
$cp1SetRange :: HasRange BindName
SetRange)

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                         -- ^ Constant: axiom, function, data or record type.
  | Proj ProjOrigin AmbiguousQName     -- ^ Projection (overloaded).
  | Con  AmbiguousQName                -- ^ Constructor (overloaded).
  | PatternSyn AmbiguousQName          -- ^ Pattern synonym.
  | Macro QName                        -- ^ Macro.
  | Lit 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 QName [Clause]
  | Pi   ExprInfo Telescope Expr       -- ^ Dependent function space @Γ → A@.
  | Generalized (Set.Set QName) Expr   -- ^ Like a Pi, but the ordering is not known
  | Fun  ExprInfo (Arg Expr) Expr      -- ^ Non-dependent function space.
  | Set  ExprInfo Integer              -- ^ @Set@, @Set1@, @Set2@, ...
  | Prop ExprInfo Integer              -- ^ @Prop@, @Prop1@, @Prop2@, ...
  | Let  ExprInfo [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 ...
  | Tactic ExprInfo Expr [NamedArg Expr]
                                       -- ^ @tactic e x1 .. xn@
  | 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
$cTactic :: Constr
$cUnquote :: Constr
$cQuoteTerm :: Constr
$cQuote :: Constr
$cScopedExpr :: Constr
$cRecUpdate :: Constr
$cRec :: Constr
$cETel :: Constr
$cLet :: Constr
$cProp :: Constr
$cSet :: 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)

-- | Smart constructor for Generalized
generalized :: Set.Set QName -> Expr -> Expr
generalized :: Set QName -> Expr -> Expr
generalized Set QName
s Expr
e
    | Set QName -> Bool
forall a. Set a -> Bool
Set.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]

-- | Is a type signature a `postulate' or a function signature?
data Axiom
  = FunSig    -- ^ A function signature.
  | NoFunSig  -- ^ Not a function signature, i.e., a postulate (in user input)
              --   or another (e.g. data/record) type signature (internally).
  deriving (Typeable Axiom
DataType
Constr
Typeable Axiom
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Axiom -> c Axiom)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Axiom)
-> (Axiom -> Constr)
-> (Axiom -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Axiom))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Axiom))
-> ((forall b. Data b => b -> b) -> Axiom -> Axiom)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Axiom -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Axiom -> r)
-> (forall u. (forall d. Data d => d -> u) -> Axiom -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Axiom -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Axiom -> m Axiom)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Axiom -> m Axiom)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Axiom -> m Axiom)
-> Data Axiom
Axiom -> DataType
Axiom -> Constr
(forall b. Data b => b -> b) -> Axiom -> Axiom
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Axiom -> c Axiom
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Axiom
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) -> Axiom -> u
forall u. (forall d. Data d => d -> u) -> Axiom -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Axiom -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Axiom -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Axiom -> m Axiom
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Axiom -> m Axiom
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Axiom
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Axiom -> c Axiom
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Axiom)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Axiom)
$cNoFunSig :: Constr
$cFunSig :: Constr
$tAxiom :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Axiom -> m Axiom
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Axiom -> m Axiom
gmapMp :: (forall d. Data d => d -> m d) -> Axiom -> m Axiom
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Axiom -> m Axiom
gmapM :: (forall d. Data d => d -> m d) -> Axiom -> m Axiom
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Axiom -> m Axiom
gmapQi :: Int -> (forall d. Data d => d -> u) -> Axiom -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Axiom -> u
gmapQ :: (forall d. Data d => d -> u) -> Axiom -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Axiom -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Axiom -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Axiom -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Axiom -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Axiom -> r
gmapT :: (forall b. Data b => b -> b) -> Axiom -> Axiom
$cgmapT :: (forall b. Data b => b -> b) -> Axiom -> Axiom
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Axiom)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Axiom)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Axiom)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Axiom)
dataTypeOf :: Axiom -> DataType
$cdataTypeOf :: Axiom -> DataType
toConstr :: Axiom -> Constr
$ctoConstr :: Axiom -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Axiom
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Axiom
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Axiom -> c Axiom
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Axiom -> c Axiom
$cp1Data :: Typeable Axiom
Data, Axiom -> Axiom -> Bool
(Axiom -> Axiom -> Bool) -> (Axiom -> Axiom -> Bool) -> Eq Axiom
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Axiom -> Axiom -> Bool
$c/= :: Axiom -> Axiom -> Bool
== :: Axiom -> Axiom -> Bool
$c== :: Axiom -> Axiom -> Bool
Eq, Eq Axiom
Eq Axiom
-> (Axiom -> Axiom -> Ordering)
-> (Axiom -> Axiom -> Bool)
-> (Axiom -> Axiom -> Bool)
-> (Axiom -> Axiom -> Bool)
-> (Axiom -> Axiom -> Bool)
-> (Axiom -> Axiom -> Axiom)
-> (Axiom -> Axiom -> Axiom)
-> Ord Axiom
Axiom -> Axiom -> Bool
Axiom -> Axiom -> Ordering
Axiom -> Axiom -> Axiom
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Axiom -> Axiom -> Axiom
$cmin :: Axiom -> Axiom -> Axiom
max :: Axiom -> Axiom -> Axiom
$cmax :: Axiom -> Axiom -> Axiom
>= :: Axiom -> Axiom -> Bool
$c>= :: Axiom -> Axiom -> Bool
> :: Axiom -> Axiom -> Bool
$c> :: Axiom -> Axiom -> Bool
<= :: Axiom -> Axiom -> Bool
$c<= :: Axiom -> Axiom -> Bool
< :: Axiom -> Axiom -> Bool
$c< :: Axiom -> Axiom -> Bool
compare :: Axiom -> Axiom -> Ordering
$ccompare :: Axiom -> Axiom -> Ordering
$cp1Ord :: Eq Axiom
Ord, Int -> Axiom -> ShowS
[Axiom] -> ShowS
Axiom -> String
(Int -> Axiom -> ShowS)
-> (Axiom -> String) -> ([Axiom] -> ShowS) -> Show Axiom
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Axiom] -> ShowS
$cshowList :: [Axiom] -> ShowS
show :: Axiom -> String
$cshow :: Axiom -> String
showsPrec :: Int -> Axiom -> ShowS
$cshowsPrec :: Int -> Axiom -> ShowS
Show)

-- | Renaming (generic).
type Ren a = [(a, 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)

initCopyInfo :: ScopeCopyInfo
initCopyInfo :: ScopeCopyInfo
initCopyInfo = ScopeCopyInfo :: Ren ModuleName -> Ren QName -> ScopeCopyInfo
ScopeCopyInfo
  { renModules :: Ren ModuleName
renModules = []
  , renNames :: Ren QName
renNames   = []
  }

instance Pretty ScopeCopyInfo where
  pretty :: ScopeCopyInfo -> Doc
pretty ScopeCopyInfo
i = [Doc] -> Doc
vcat [ String -> Ren ModuleName -> Doc
forall a a. (Pretty a, Pretty a) => String -> [(a, a)] -> Doc
prRen String
"renModules =" (ScopeCopyInfo -> Ren ModuleName
renModules ScopeCopyInfo
i)
                  , String -> Ren QName -> Doc
forall a a. (Pretty a, Pretty a) => String -> [(a, a)] -> Doc
prRen String
"renNames   =" (ScopeCopyInfo -> Ren QName
renNames ScopeCopyInfo
i) ]
    where
      prRen :: String -> [(a, a)] -> Doc
prRen String
s [(a, a)]
r = [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
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)]
r) ]
      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

data Declaration
  = Axiom      Axiom 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.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 Expr                    -- ^ primitive function
  | Mutual     MutualInfo [Declaration]              -- ^ a bunch of mutually recursive definitions
  | Section    ModuleInfo 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]
      -- ^ the 'LamBinding's are 'DomainFree' and bind the parameters of the datatype.
  | RecSig     DefInfo QName GeneralizeTelescope Expr -- ^ lone record signature
  | RecDef     DefInfo QName UniverseCheck (Maybe (Ranged Induction)) (Maybe HasEta) (Maybe QName) DataDefParams Expr [Declaration]
      -- ^ The 'LamBinding's are 'DomainFree' and bind the parameters of the datatype.
      --   The 'Expr' gives the constructor type telescope, @(x1 : A1)..(xn : An) -> Prop@,
      --   and the optional name is the constructor's name.
  | PatternSynDef QName [Arg Name] (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)

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)

data Pragma
  = OptionsPragma [String]
  | BuiltinPragma RString ResolvedName
    -- ^ 'ResolvedName' is not 'UnknownName'.
    --   Name can be ambiguous e.g. for built-in constructors.
  | BuiltinNoDefPragma RString 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)

-- | 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)


-- | 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)

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)

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 [NamedArg Binder] Expr
    -- ^ As in telescope @(x y z : A)@ or type @(x y z : A) -> B@.
  | TLet Range [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)

mkTBind :: Range -> [NamedArg Binder] -> Expr -> TypedBinding
mkTBind :: Range -> [NamedArg Binder] -> Expr -> TypedBinding
mkTBind Range
r = Range -> TacticAttr -> [NamedArg Binder] -> Expr -> TypedBinding
TBind Range
r TacticAttr
forall a. Maybe a
Nothing

type Telescope  = [TypedBinding]

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)

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)

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.
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)

-- 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)

data WhereDeclarations = WhereDecls
  { WhereDeclarations -> Maybe ModuleName
whereModule :: Maybe ModuleName
  , WhereDeclarations -> [Declaration]
whereDecls  :: [Declaration]
  } 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)

noWhereDecls :: WhereDeclarations
noWhereDecls :: WhereDeclarations
noWhereDecls = Maybe ModuleName -> [Declaration] -> WhereDeclarations
WhereDecls Maybe ModuleName
forall a. Maybe a
Nothing []

type Clause = Clause' LHS
type SpineClause = Clause' SpineLHS
type RewriteEqn  = RewriteEqn' QName Pattern 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 [WithHiding Expr] [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)

-- | 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 [WithHiding Expr]
b [Clause]
c    == WithRHS QName
a' [WithHiding Expr]
b' [Clause]
c'    = [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and [ QName
a QName -> QName -> Bool
forall a. Eq a => a -> a -> Bool
== QName
a', [WithHiding Expr]
b [WithHiding Expr] -> [WithHiding Expr] -> Bool
forall a. Eq a => a -> a -> Bool
== [WithHiding Expr]
b', [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)

-- | 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)

-- | 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 -> [Pattern' e]
lhsWithPatterns :: [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)

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 Literal
  | PatternSynP PatInfo AmbiguousQName (NAPs e)
  | RecP PatInfo [FieldAssignment' (Pattern' e)]
  | EqualP PatInfo [(e, e)]
  | WithP PatInfo (Pattern' e)  -- ^ @| p@, for with-patterns.
  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))
$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)

type NAPs e   = [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' () 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                  == Def QName
a2                  = QName
a1 QName -> QName -> Bool
forall a. Eq a => a -> a -> Bool
== QName
a2
  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 Literal
a1                  == Lit Literal
a2                  = Literal
a1 Literal -> Literal -> Bool
forall a. Eq a => a -> a -> Bool
== 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 QName
c1 [Clause]
d1 == ExtendedLam ExprInfo
a2 DefInfo
b2 QName
c2 [Clause]
d2 = (ExprInfo
a1, DefInfo
b1, QName
c1, [Clause]
d1) (ExprInfo, DefInfo, QName, [Clause])
-> (ExprInfo, DefInfo, QName, [Clause]) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, DefInfo
b2, QName
c2, [Clause]
d2)
  Pi ExprInfo
a1 [TypedBinding]
b1 Expr
c1             == Pi ExprInfo
a2 [TypedBinding]
b2 Expr
c2             = (ExprInfo
a1, [TypedBinding]
b1, Expr
c1) (ExprInfo, [TypedBinding], Expr)
-> (ExprInfo, [TypedBinding], Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, [TypedBinding]
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)
  Set ExprInfo
a1 Integer
b1               == Set ExprInfo
a2 Integer
b2               = (ExprInfo
a1, Integer
b1) (ExprInfo, Integer) -> (ExprInfo, Integer) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, Integer
b2)
  Prop ExprInfo
a1 Integer
b1              == Prop ExprInfo
a2 Integer
b2              = (ExprInfo
a1, Integer
b1) (ExprInfo, Integer) -> (ExprInfo, Integer) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, Integer
b2)
  Let ExprInfo
a1 [LetBinding]
b1 Expr
c1            == Let ExprInfo
a2 [LetBinding]
b2 Expr
c2            = (ExprInfo
a1, [LetBinding]
b1, Expr
c1) (ExprInfo, [LetBinding], Expr)
-> (ExprInfo, [LetBinding], Expr) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, [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
  Tactic ExprInfo
a1 Expr
b1 [NamedArg Expr]
c1         == Tactic ExprInfo
a2 Expr
b2 [NamedArg Expr]
c2         = (ExprInfo
a1, Expr
b1, [NamedArg Expr]
c1) (ExprInfo, Expr, [NamedArg Expr])
-> (ExprInfo, Expr, [NamedArg Expr]) -> Bool
forall a. Eq a => a -> a -> Bool
== (ExprInfo
a2, Expr
b2, [NamedArg Expr]
c2)
  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 Axiom
a1 DefInfo
b1 ArgInfo
c1 Maybe [Occurrence]
d1 QName
e1 Expr
f1        == Axiom Axiom
a2 DefInfo
b2 ArgInfo
c2 Maybe [Occurrence]
d2 QName
e2 Expr
f2        = (Axiom
a1, DefInfo
b1, ArgInfo
c1, Maybe [Occurrence]
d1, QName
e1, Expr
f1) (Axiom, DefInfo, ArgInfo, Maybe [Occurrence], QName, Expr)
-> (Axiom, DefInfo, ArgInfo, Maybe [Occurrence], QName, Expr)
-> Bool
forall a. Eq a => a -> a -> Bool
== (Axiom
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 Expr
c1             == Primitive 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)
  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 ModuleInfo
a1 ModuleName
b1 GeneralizeTelescope
c1 [Declaration]
d1            == Section ModuleInfo
a2 ModuleName
b2 GeneralizeTelescope
c2 [Declaration]
d2            = (ModuleInfo
a1, ModuleName
b1, GeneralizeTelescope
c1, [Declaration]
d1) (ModuleInfo, ModuleName, GeneralizeTelescope, [Declaration])
-> (ModuleInfo, ModuleName, GeneralizeTelescope, [Declaration])
-> Bool
forall a. Eq a => a -> a -> Bool
== (ModuleInfo
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 Maybe (Ranged Induction)
d1 Maybe HasEta
e1 Maybe QName
f1 DataDefParams
g1 Expr
h1 [Declaration]
i1 == RecDef DefInfo
a2 QName
b2 UniverseCheck
c2 Maybe (Ranged Induction)
d2 Maybe HasEta
e2 Maybe QName
f2 DataDefParams
g2 Expr
h2 [Declaration]
i2 = (DefInfo
a1, QName
b1, UniverseCheck
c1, Maybe (Ranged Induction)
d1, Maybe HasEta
e1, Maybe QName
f1, DataDefParams
g1, Expr
h1, [Declaration]
i1) (DefInfo, QName, UniverseCheck, Maybe (Ranged Induction),
 Maybe HasEta, Maybe QName, DataDefParams, Expr, [Declaration])
-> (DefInfo, QName, UniverseCheck, Maybe (Ranged Induction),
    Maybe HasEta, Maybe QName, DataDefParams, Expr, [Declaration])
-> Bool
forall a. Eq a => a -> a -> Bool
== (DefInfo
a2, QName
b2, UniverseCheck
c2, Maybe (Ranged Induction)
d2, Maybe HasEta
e2, Maybe QName
f2, DataDefParams
g2, Expr
h2, [Declaration]
i2)
  PatternSynDef QName
a1 [Arg Name]
b1 Pattern' Void
c1         == PatternSynDef QName
a2 [Arg Name]
b2 Pattern' Void
c2         = (QName
a1, [Arg Name]
b1, Pattern' Void
c1) (QName, [Arg Name], Pattern' Void)
-> (QName, [Arg Name], Pattern' Void) -> Bool
forall a. Eq a => a -> a -> Bool
== (QName
a2, [Arg Name]
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 (TBind Range
_ TacticAttr
_ [] Expr
_)      = Hiding
forall a. HasCallStack => a
__IMPOSSIBLE__
  getHiding TLet{}                = Hiding
forall a. Monoid a => a
mempty
  mapHiding :: (Hiding -> Hiding) -> TypedBinding -> TypedBinding
mapHiding Hiding -> Hiding
f (TBind Range
r TacticAttr
t [NamedArg Binder]
xs Expr
e)    = Range -> TacticAttr -> [NamedArg Binder] -> Expr -> TypedBinding
TBind Range
r TacticAttr
t (((NamedArg Binder -> NamedArg Binder)
-> [NamedArg Binder] -> [NamedArg Binder]
forall a b. (a -> b) -> [a] -> [b]
map ((NamedArg Binder -> NamedArg Binder)
 -> [NamedArg Binder] -> [NamedArg Binder])
-> ((Hiding -> Hiding) -> NamedArg Binder -> NamedArg Binder)
-> (Hiding -> Hiding)
-> [NamedArg Binder]
-> [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 [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 t. HasRange t => t -> Range
getRange NamedArg Binder
x
    getRange (DomainFull TypedBinding
b)   = TypedBinding -> Range
forall t. HasRange t => t -> Range
getRange TypedBinding
b

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

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

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

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

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

instance HasRange LHS where
    getRange :: LHS -> Range
getRange (LHS LHSInfo
i LHSCore
_)   = LHSInfo -> Range
forall t. HasRange t => t -> 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 [Pattern' e]
wps [NamedArg (Pattern' e)]
ps)     = LHSCore' e
h LHSCore' e -> [Pattern' e] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` [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 t. HasRange t => t -> 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 t. HasRange t => t -> Range
getRange Expr
e
    getRange (WithRHS QName
_ [WithHiding Expr]
e [Clause]
cs)          = [WithHiding Expr] -> [Clause] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange [WithHiding Expr]
e [Clause]
cs
    getRange (RewriteRHS [RewriteEqn]
xes [ProblemEq]
_ RHS
rhs WhereDeclarations
wh) = ([RewriteEqn], RHS, WhereDeclarations) -> Range
forall t. HasRange t => t -> Range
getRange ([RewriteEqn]
xes, RHS
rhs, WhereDeclarations
wh)

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

instance HasRange LetBinding where
    getRange :: LetBinding -> Range
getRange (LetBind LetInfo
i ArgInfo
_ BindName
_ Expr
_ Expr
_     ) = LetInfo -> Range
forall t. HasRange t => t -> Range
getRange LetInfo
i
    getRange (LetPatBind  LetInfo
i Pattern
_ Expr
_      ) = LetInfo -> Range
forall t. HasRange t => t -> Range
getRange LetInfo
i
    getRange (LetApply ModuleInfo
i ModuleName
_ ModuleApplication
_ ScopeCopyInfo
_ ImportDirective
_     ) = ModuleInfo -> Range
forall t. HasRange t => t -> Range
getRange ModuleInfo
i
    getRange (LetOpen  ModuleInfo
i ModuleName
_ ImportDirective
_         ) = ModuleInfo -> Range
forall t. HasRange t => t -> Range
getRange ModuleInfo
i
    getRange (LetDeclaredVariable BindName
x)  = BindName -> Range
forall t. HasRange t => t -> 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 t. SetRange t => Range -> t -> t
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 t. SetRange t => Range -> t -> t
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 t. SetRange t => Range -> t -> t
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 Literal
l)             = Literal -> Pattern' a
forall e. Literal -> Pattern' e
LitP (Range -> Literal -> Literal
forall t. SetRange t => Range -> t -> t
setRange 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 t. SetRange t => Range -> t -> t
setRange Range
r PatInfo
i) 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 [NamedArg Binder]
xs Expr
e) = (Range -> TacticAttr -> [NamedArg Binder] -> Expr -> TypedBinding)
-> Range -> TacticAttr -> [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 -> [NamedArg Binder] -> Expr -> TypedBinding
TBind Range
r TacticAttr
t [NamedArg Binder]
xs Expr
e
  killRange (TLet Range
r [LetBinding]
lbs)     = (Range -> [LetBinding] -> TypedBinding)
-> Range -> [LetBinding] -> TypedBinding
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Range -> [LetBinding] -> TypedBinding
TLet Range
r [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)                = (QName -> Expr) -> QName -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 QName -> Expr
Def QName
x
  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 Literal
l)                = (Literal -> Expr) -> Literal -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Literal -> Expr
Lit 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 QName
d [Clause]
ps) = (ExprInfo -> DefInfo -> QName -> [Clause] -> Expr)
-> ExprInfo -> DefInfo -> QName -> [Clause] -> Expr
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 ExprInfo -> DefInfo -> QName -> [Clause] -> Expr
ExtendedLam ExprInfo
i DefInfo
n QName
d [Clause]
ps
  killRange (Pi ExprInfo
i [TypedBinding]
a Expr
b)             = (ExprInfo -> [TypedBinding] -> Expr -> Expr)
-> ExprInfo -> [TypedBinding] -> Expr -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ExprInfo -> [TypedBinding] -> Expr -> Expr
Pi ExprInfo
i [TypedBinding]
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 (Set ExprInfo
i Integer
n)              = (ExprInfo -> Integer -> Expr) -> ExprInfo -> Integer -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 ExprInfo -> Integer -> Expr
Set ExprInfo
i Integer
n
  killRange (Prop ExprInfo
i Integer
n)             = (ExprInfo -> Integer -> Expr) -> ExprInfo -> Integer -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 ExprInfo -> Integer -> Expr
Prop ExprInfo
i Integer
n
  killRange (Let ExprInfo
i [LetBinding]
ds Expr
e)           = (ExprInfo -> [LetBinding] -> Expr -> Expr)
-> ExprInfo -> [LetBinding] -> Expr -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ExprInfo -> [LetBinding] -> Expr -> Expr
Let ExprInfo
i [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 (Tactic ExprInfo
i Expr
e [NamedArg Expr]
xs)        = (ExprInfo -> Expr -> [NamedArg Expr] -> Expr)
-> ExprInfo -> Expr -> [NamedArg Expr] -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 ExprInfo -> Expr -> [NamedArg Expr] -> Expr
Tactic ExprInfo
i Expr
e [NamedArg Expr]
xs
  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 Declaration where
  killRange :: Declaration -> Declaration
killRange (Axiom    Axiom
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 -> Axiom
-> DefInfo
-> ArgInfo
-> Maybe [Occurrence]
-> QName
-> Expr
-> Declaration
Axiom Axiom
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    ModuleInfo
i ModuleName
a GeneralizeTelescope
b [Declaration]
c       ) = (ModuleInfo
 -> ModuleName
 -> GeneralizeTelescope
 -> [Declaration]
 -> Declaration)
-> ModuleInfo
-> 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 ModuleInfo
-> ModuleName
-> GeneralizeTelescope
-> [Declaration]
-> Declaration
Section    ModuleInfo
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 Expr
b         ) = (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
Primitive  DefInfo
i QName
a 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 Maybe (Ranged Induction)
c Maybe HasEta
d Maybe QName
e DataDefParams
f Expr
g [Declaration]
h) = (DefInfo
 -> QName
 -> UniverseCheck
 -> Maybe (Ranged Induction)
 -> Maybe HasEta
 -> Maybe QName
 -> DataDefParams
 -> Expr
 -> [Declaration]
 -> Declaration)
-> DefInfo
-> QName
-> UniverseCheck
-> Maybe (Ranged Induction)
-> Maybe HasEta
-> Maybe QName
-> DataDefParams
-> Expr
-> [Declaration]
-> Declaration
forall a b c d e f g h i j.
(KillRange a, KillRange b, KillRange c, KillRange d, KillRange e,
 KillRange f, KillRange g, KillRange h, KillRange i) =>
(a -> b -> c -> d -> e -> f -> g -> h -> i -> j)
-> a -> b -> c -> d -> e -> f -> g -> h -> i -> j
killRange9 DefInfo
-> QName
-> UniverseCheck
-> Maybe (Ranged Induction)
-> Maybe HasEta
-> Maybe QName
-> DataDefParams
-> Expr
-> [Declaration]
-> Declaration
RecDef  DefInfo
i QName
a UniverseCheck
b Maybe (Ranged Induction)
c Maybe HasEta
d Maybe QName
e DataDefParams
f Expr
g [Declaration]
h
  killRange (PatternSynDef QName
x [Arg Name]
xs Pattern' Void
p     ) = (QName -> [Arg Name] -> Pattern' Void -> Declaration)
-> QName -> [Arg Name] -> 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 Name] -> Pattern' Void -> Declaration
PatternSynDef QName
x [Arg Name]
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 Literal
l)            = (Literal -> Pattern' e) -> Literal -> Pattern' e
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Literal -> Pattern' e
forall e. Literal -> Pattern' e
LitP 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

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 [Pattern' e]
b [NamedArg (Pattern' e)]
c) = (LHSCore' e
 -> [Pattern' e] -> [NamedArg (Pattern' e)] -> LHSCore' e)
-> LHSCore' e
-> [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 -> [Pattern' e] -> [NamedArg (Pattern' e)] -> LHSCore' e
forall e.
LHSCore' e -> [Pattern' e] -> [NamedArg (Pattern' e)] -> LHSCore' e
LHSWith LHSCore' e
a [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 [WithHiding Expr]
e [Clause]
cs)         = (QName -> [WithHiding Expr] -> [Clause] -> RHS)
-> QName -> [WithHiding Expr] -> [Clause] -> RHS
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 QName -> [WithHiding Expr] -> [Clause] -> RHS
WithRHS QName
q [WithHiding Expr]
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 [Declaration]
b) = (Maybe ModuleName -> [Declaration] -> WhereDeclarations)
-> Maybe ModuleName -> [Declaration] -> WhereDeclarations
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Maybe ModuleName -> [Declaration] -> WhereDeclarations
WhereDecls Maybe ModuleName
a [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

-- See Agda.Utils.GeniPlate:
-- Does not descend into ScopeInfo and renaming maps, for instance.

instanceUniverseBiT' [] [t| (Declaration, QName)          |]
instanceUniverseBiT' [] [t| (Declaration, AmbiguousQName) |]
instanceUniverseBiT' [] [t| (Declaration, Expr)           |]
instanceUniverseBiT' [] [t| (Declaration, LetBinding)     |]
instanceUniverseBiT' [] [t| (Declaration, LamBinding)     |]
instanceUniverseBiT' [] [t| (Declaration, TypedBinding)   |]
instanceUniverseBiT' [] [t| (Declaration, Pattern)        |]
instanceUniverseBiT' [] [t| (Declaration, Pattern' Void)  |]
instanceUniverseBiT' [] [t| (Declaration, Declaration)    |]
instanceUniverseBiT' [] [t| (Declaration, ModuleName)     |]
instanceUniverseBiT' [] [t| (Declaration, ModuleInfo)     |]
instanceUniverseBiT' [] [t| (Declaration, NamedArg LHSCore)  |]
instanceUniverseBiT' [] [t| (Declaration, NamedArg BindName) |]
instanceUniverseBiT' [] [t| (Declaration, NamedArg Expr)     |]
instanceUniverseBiT' [] [t| (Declaration, NamedArg Pattern)  |]
instanceUniverseBiT' [] [t| (Declaration, Quantity)          |]

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

-- | Extracts all the names which are declared in a 'Declaration'.
-- This does not include open public or let expressions, but it does
-- include local modules, where clauses and the names of extended
-- lambdas.

class AllNames a where
  allNames :: a -> Seq QName

instance AllNames a => AllNames [a] where
  allNames :: [a] -> Seq QName
allNames = (a -> Seq QName) -> [a] -> Seq QName
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Fold.foldMap a -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames

instance AllNames a => AllNames (Maybe a) where
  allNames :: Maybe a -> Seq QName
allNames = (a -> Seq QName) -> Maybe a -> Seq QName
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Fold.foldMap a -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames

instance AllNames a => AllNames (Arg a) where
  allNames :: Arg a -> Seq QName
allNames = (a -> Seq QName) -> Arg a -> Seq QName
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Fold.foldMap a -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames

instance AllNames a => AllNames (Named name a) where
  allNames :: Named name a -> Seq QName
allNames = (a -> Seq QName) -> Named name a -> Seq QName
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Fold.foldMap a -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames

instance (AllNames a, AllNames b) => AllNames (a,b) where
  allNames :: (a, b) -> Seq QName
allNames (a
a,b
b) = a -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames a
a Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< b -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames b
b

instance (AllNames a, AllNames b, AllNames c) => AllNames (a,b,c) where
  allNames :: (a, b, c) -> Seq QName
allNames (a
a,b
b,c
c) = a -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames a
a Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< b -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames b
b Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< c -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames c
c

instance AllNames QName where
  allNames :: QName -> Seq QName
allNames QName
q = QName -> Seq QName
forall a. a -> Seq a
Seq.singleton QName
q

instance AllNames Declaration where
  allNames :: Declaration -> Seq QName
allNames (Axiom   Axiom
_ DefInfo
_ ArgInfo
_ Maybe [Occurrence]
_ QName
q Expr
_)      = QName -> Seq QName
forall a. a -> Seq a
Seq.singleton QName
q
  allNames (Generalize Set QName
_ DefInfo
_ ArgInfo
_ QName
q Expr
_)     = QName -> Seq QName
forall a. a -> Seq a
Seq.singleton QName
q
  allNames (Field     DefInfo
_   QName
q Arg Expr
_)        = QName -> Seq QName
forall a. a -> Seq a
Seq.singleton QName
q
  allNames (Primitive DefInfo
_   QName
q Expr
_)        = QName -> Seq QName
forall a. a -> Seq a
Seq.singleton QName
q
  allNames (Mutual     MutualInfo
_ [Declaration]
defs)        = [Declaration] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [Declaration]
defs
  allNames (DataSig DefInfo
_ QName
q GeneralizeTelescope
_ Expr
_)          = QName -> Seq QName
forall a. a -> Seq a
Seq.singleton QName
q
  allNames (DataDef DefInfo
_ QName
q UniverseCheck
_ DataDefParams
_ [Declaration]
decls)    = QName
q QName -> Seq QName -> Seq QName
forall a. a -> Seq a -> Seq a
<| [Declaration] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [Declaration]
decls
  allNames (RecSig DefInfo
_ QName
q GeneralizeTelescope
_ Expr
_)           = QName -> Seq QName
forall a. a -> Seq a
Seq.singleton QName
q
  allNames (RecDef DefInfo
_ QName
q UniverseCheck
_ Maybe (Ranged Induction)
_ Maybe HasEta
_ Maybe QName
c DataDefParams
_ Expr
_ [Declaration]
decls) = QName
q QName -> Seq QName -> Seq QName
forall a. a -> Seq a -> Seq a
<| Maybe QName -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Maybe QName
c Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< [Declaration] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [Declaration]
decls
  allNames (PatternSynDef QName
q [Arg Name]
_ Pattern' Void
_)      = QName -> Seq QName
forall a. a -> Seq a
Seq.singleton QName
q
  allNames (UnquoteDecl MutualInfo
_ [DefInfo]
_ [QName]
qs Expr
_)     = [QName] -> Seq QName
forall a. [a] -> Seq a
Seq.fromList [QName]
qs
  allNames (UnquoteDef [DefInfo]
_ [QName]
qs Expr
_)        = [QName] -> Seq QName
forall a. [a] -> Seq a
Seq.fromList [QName]
qs
  allNames (FunDef DefInfo
_ QName
q Delayed
_ [Clause]
cls)         = QName
q QName -> Seq QName -> Seq QName
forall a. a -> Seq a -> Seq a
<| [Clause] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [Clause]
cls
  allNames (Section ModuleInfo
_ ModuleName
_ GeneralizeTelescope
_ [Declaration]
decls)      = [Declaration] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [Declaration]
decls
  allNames Apply{}                    = Seq QName
forall a. Seq a
Seq.empty
  allNames Import{}                   = Seq QName
forall a. Seq a
Seq.empty
  allNames Pragma{}                   = Seq QName
forall a. Seq a
Seq.empty
  allNames Open{}                     = Seq QName
forall a. Seq a
Seq.empty
  allNames (ScopedDecl ScopeInfo
_ [Declaration]
decls)       = [Declaration] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [Declaration]
decls

instance AllNames Clause where
  allNames :: Clause -> Seq QName
allNames Clause
cl = (RHS, WhereDeclarations) -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames (Clause -> RHS
forall lhs. Clause' lhs -> RHS
clauseRHS Clause
cl, Clause -> WhereDeclarations
forall lhs. Clause' lhs -> WhereDeclarations
clauseWhereDecls Clause
cl)

instance (AllNames qn, AllNames e) => AllNames (RewriteEqn' qn p e) where
    allNames :: RewriteEqn' qn p e -> Seq QName
allNames = \case
      Rewrite [(qn, e)]
es    -> ((qn, e) -> Seq QName) -> [(qn, e)] -> Seq QName
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Fold.foldMap (qn, e) -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [(qn, e)]
es
      Invert qn
qn [(p, e)]
pes -> qn -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames qn
qn Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< ((p, e) -> Seq QName) -> [(p, e)] -> Seq QName
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((e -> Seq QName) -> (p, e) -> Seq QName
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Fold.foldMap e -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames) [(p, e)]
pes

instance AllNames RHS where
  allNames :: RHS -> Seq QName
allNames (RHS Expr
e Maybe Expr
_)                 = Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e
  allNames AbsurdRHS{}               = Seq QName
forall a. Seq a
Seq.empty
  allNames (WithRHS QName
q [WithHiding Expr]
_ [Clause]
cls)         = QName
q QName -> Seq QName -> Seq QName
forall a. a -> Seq a -> Seq a
<| [Clause] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [Clause]
cls
  allNames (RewriteRHS [RewriteEqn]
qes [ProblemEq]
_ RHS
rhs WhereDeclarations
cls) = ([RewriteEqn], RHS, WhereDeclarations) -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames ([RewriteEqn]
qes, RHS
rhs, WhereDeclarations
cls)

instance AllNames WhereDeclarations where
  allNames :: WhereDeclarations -> Seq QName
allNames (WhereDecls Maybe ModuleName
_ [Declaration]
ds) = [Declaration] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [Declaration]
ds

instance AllNames Expr where
  allNames :: Expr -> Seq QName
allNames Var{}                   = Seq QName
forall a. Seq a
Seq.empty
  allNames Def{}                   = Seq QName
forall a. Seq a
Seq.empty
  allNames Proj{}                  = Seq QName
forall a. Seq a
Seq.empty
  allNames Con{}                   = Seq QName
forall a. Seq a
Seq.empty
  allNames Lit{}                   = Seq QName
forall a. Seq a
Seq.empty
  allNames QuestionMark{}          = Seq QName
forall a. Seq a
Seq.empty
  allNames Underscore{}            = Seq QName
forall a. Seq a
Seq.empty
  allNames (Dot ExprInfo
_ Expr
e)               = Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e
  allNames (App AppInfo
_ Expr
e1 NamedArg Expr
e2)           = Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e1 Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< NamedArg Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames NamedArg Expr
e2
  allNames (WithApp ExprInfo
_ Expr
e [Expr]
es)        = Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< [Expr] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [Expr]
es
  allNames (Lam ExprInfo
_ LamBinding
b Expr
e)             = LamBinding -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames LamBinding
b Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e
  allNames AbsurdLam{}             = Seq QName
forall a. Seq a
Seq.empty
  allNames (ExtendedLam ExprInfo
_ DefInfo
_ QName
q [Clause]
cls) = QName
q QName -> Seq QName -> Seq QName
forall a. a -> Seq a -> Seq a
<| [Clause] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [Clause]
cls
  allNames (Pi ExprInfo
_ [TypedBinding]
tel Expr
e)            = [TypedBinding] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [TypedBinding]
tel Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e
  allNames (Generalized Set QName
s Expr
e)       = [QName] -> Seq QName
forall a. [a] -> Seq a
Seq.fromList (Set QName -> [QName]
forall a. Set a -> [a]
Set.toList Set QName
s) Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e  -- TODO: or just (allNames e)?
  allNames (Fun ExprInfo
_ Arg Expr
e1 Expr
e2)           = Arg Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Arg Expr
e1 Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e2
  allNames Set{}                   = Seq QName
forall a. Seq a
Seq.empty
  allNames Prop{}                  = Seq QName
forall a. Seq a
Seq.empty
  allNames (Let ExprInfo
_ [LetBinding]
lbs Expr
e)           = [LetBinding] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [LetBinding]
lbs Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e
  allNames ETel{}                  = Seq QName
forall a. HasCallStack => a
__IMPOSSIBLE__
  allNames (Rec ExprInfo
_ RecordAssigns
fields)          = [Expr] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [ Assign
a Assign -> Lens' Expr Assign -> Expr
forall o i. o -> Lens' i o -> i
^. forall a. Lens' a (FieldAssignment' a)
Lens' Expr Assign
exprFieldA | Left Assign
a <- RecordAssigns
fields ]
  allNames (RecUpdate ExprInfo
_ Expr
e Assigns
fs)      = Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< [Expr] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames ((Assign -> Expr) -> Assigns -> [Expr]
forall a b. (a -> b) -> [a] -> [b]
map (Lens' Expr Assign -> Assign -> Expr
forall o (m :: * -> *) i. MonadReader o m => Lens' i o -> m i
view forall a. Lens' a (FieldAssignment' a)
Lens' Expr Assign
exprFieldA) Assigns
fs)
  allNames (ScopedExpr ScopeInfo
_ Expr
e)        = Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e
  allNames Quote{}                 = Seq QName
forall a. Seq a
Seq.empty
  allNames QuoteTerm{}             = Seq QName
forall a. Seq a
Seq.empty
  allNames Unquote{}               = Seq QName
forall a. Seq a
Seq.empty
  allNames (Tactic ExprInfo
_ Expr
e [NamedArg Expr]
xs)         = Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< [NamedArg Expr] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [NamedArg Expr]
xs
  allNames DontCare{}              = Seq QName
forall a. Seq a
Seq.empty
  allNames PatternSyn{}            = Seq QName
forall a. Seq a
Seq.empty
  allNames Macro{}                 = Seq QName
forall a. Seq a
Seq.empty

instance AllNames LamBinding where
  allNames :: LamBinding -> Seq QName
allNames DomainFree{}       = Seq QName
forall a. Seq a
Seq.empty
  allNames (DomainFull TypedBinding
binds) = TypedBinding -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames TypedBinding
binds

instance AllNames TypedBinding where
  allNames :: TypedBinding -> Seq QName
allNames (TBind Range
_ TacticAttr
t [NamedArg Binder]
_ Expr
e) = (TacticAttr, Expr) -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames (TacticAttr
t, Expr
e)
  allNames (TLet Range
_ [LetBinding]
lbs)  = [LetBinding] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [LetBinding]
lbs

instance AllNames LetBinding where
  allNames :: LetBinding -> Seq QName
allNames (LetBind LetInfo
_ ArgInfo
_ BindName
_ Expr
e1 Expr
e2)  = Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e1 Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e2
  allNames (LetPatBind LetInfo
_ Pattern
_ Expr
e)      = Expr -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames Expr
e
  allNames (LetApply ModuleInfo
_ ModuleName
_ ModuleApplication
app ScopeCopyInfo
_ ImportDirective
_)  = ModuleApplication -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames ModuleApplication
app
  allNames LetOpen{}               = Seq QName
forall a. Seq a
Seq.empty
  allNames (LetDeclaredVariable BindName
_) = Seq QName
forall a. Seq a
Seq.empty

instance AllNames ModuleApplication where
  allNames :: ModuleApplication -> Seq QName
allNames (SectionApp [TypedBinding]
bindss ModuleName
_ [NamedArg Expr]
es) = [TypedBinding] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [TypedBinding]
bindss Seq QName -> Seq QName -> Seq QName
forall a. Seq a -> Seq a -> Seq a
>< [NamedArg Expr] -> Seq QName
forall a. AllNames a => a -> Seq QName
allNames [NamedArg Expr]
es
  allNames RecordModuleInstance{}   = Seq QName
forall a. Seq a
Seq.empty

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

axiomName :: Declaration -> QName
axiomName :: Declaration -> QName
axiomName (Axiom Axiom
_ 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 Axiom
_ 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 ModuleInfo
_ 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
_ Maybe (Ranged Induction)
_ Maybe HasEta
_ Maybe QName
_ 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
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 t. HasRange t => t -> 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      -> AbstractName -> Expr
forall a. NameToExpr a => a -> Expr
nameToExpr AbstractName
x  -- Can be 'isDefName', 'MacroName', 'QuotableName'.
    FieldName NonEmpty AbstractName
xs         -> ProjOrigin -> AmbiguousQName -> Expr
Proj ProjOrigin
ProjSystem (AmbiguousQName -> Expr)
-> (NonEmpty AbstractName -> AmbiguousQName)
-> NonEmpty AbstractName
-> Expr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty QName -> AmbiguousQName
AmbQ (NonEmpty QName -> AmbiguousQName)
-> (NonEmpty AbstractName -> NonEmpty QName)
-> NonEmpty AbstractName
-> AmbiguousQName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AbstractName -> QName) -> NonEmpty AbstractName -> NonEmpty QName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AbstractName -> QName
anameName (NonEmpty AbstractName -> Expr) -> NonEmpty AbstractName -> Expr
forall a b. (a -> b) -> a -> b
$ NonEmpty AbstractName
xs
    ConstructorName NonEmpty AbstractName
xs   -> AmbiguousQName -> Expr
Con (AmbiguousQName -> Expr)
-> (NonEmpty AbstractName -> AmbiguousQName)
-> NonEmpty AbstractName
-> Expr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty QName -> AmbiguousQName
AmbQ (NonEmpty QName -> AmbiguousQName)
-> (NonEmpty AbstractName -> NonEmpty QName)
-> NonEmpty AbstractName
-> AmbiguousQName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AbstractName -> QName) -> NonEmpty AbstractName -> NonEmpty QName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AbstractName -> QName
anameName (NonEmpty AbstractName -> Expr) -> NonEmpty AbstractName -> Expr
forall a b. (a -> b) -> a -> b
$ NonEmpty AbstractName
xs
    PatternSynResName NonEmpty AbstractName
xs -> AmbiguousQName -> Expr
PatternSyn (AmbiguousQName -> Expr)
-> (NonEmpty AbstractName -> AmbiguousQName)
-> NonEmpty AbstractName
-> Expr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty QName -> AmbiguousQName
AmbQ (NonEmpty QName -> AmbiguousQName)
-> (NonEmpty AbstractName -> NonEmpty QName)
-> NonEmpty AbstractName
-> AmbiguousQName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AbstractName -> QName) -> NonEmpty AbstractName -> NonEmpty QName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AbstractName -> QName
anameName (NonEmpty AbstractName -> Expr) -> NonEmpty AbstractName -> Expr
forall a b. (a -> b) -> a -> b
$ NonEmpty AbstractName
xs
    ResolvedName
UnknownName          -> 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
i [] Expr
e = Expr
e
mkLet ExprInfo
i [LetBinding]
ds Expr
e = ExprInfo -> [LetBinding] -> Expr -> Expr
Let ExprInfo
i [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 Literal
l             -> Literal -> Expr
Lit 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 Assign ModuleName)
-> [FieldAssignment' Pattern] -> RecordAssigns
forall a b. (a -> b) -> [a] -> [b]
map (Assign -> Either Assign ModuleName
forall a b. a -> Either a b
Left (Assign -> Either Assign ModuleName)
-> (FieldAssignment' Pattern -> Assign)
-> FieldAssignment' Pattern
-> Either Assign ModuleName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Pattern -> Expr) -> FieldAssignment' Pattern -> Assign
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__

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

lambdaLiftExpr :: [Name] -> Expr -> Expr
lambdaLiftExpr :: [Name] -> Expr -> Expr
lambdaLiftExpr []     Expr
e = Expr
e
lambdaLiftExpr (Name
n:[Name]
ns) Expr
e =
  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 -> Expr) -> Expr -> Expr
forall a b. (a -> b) -> a -> b
$
  [Name] -> Expr -> Expr
lambdaLiftExpr [Name]
ns Expr
e

class SubstExpr a where
  substExpr :: [(Name, Expr)] -> a -> a

instance SubstExpr a => SubstExpr (Maybe a) where
  substExpr :: [(Name, Expr)] -> Maybe a -> Maybe a
substExpr = (a -> a) -> Maybe a -> Maybe a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a) -> Maybe a -> Maybe a)
-> ([(Name, Expr)] -> a -> a)
-> [(Name, Expr)]
-> Maybe a
-> Maybe a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(Name, Expr)] -> a -> a
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr

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

instance SubstExpr a => SubstExpr (Arg a) where
  substExpr :: [(Name, Expr)] -> Arg a -> Arg a
substExpr = (a -> a) -> Arg a -> Arg a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a) -> Arg a -> Arg a)
-> ([(Name, Expr)] -> a -> a) -> [(Name, Expr)] -> Arg a -> Arg a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(Name, Expr)] -> a -> a
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr

instance SubstExpr a => SubstExpr (Named name a) where
  substExpr :: [(Name, Expr)] -> Named name a -> Named name a
substExpr = (a -> a) -> Named name a -> Named name a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a) -> Named name a -> Named name a)
-> ([(Name, Expr)] -> a -> a)
-> [(Name, Expr)]
-> Named name a
-> Named name a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(Name, Expr)] -> a -> a
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr

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 Assign where
  substExpr :: [(Name, Expr)] -> Assign -> Assign
substExpr [(Name, Expr)]
s (FieldAssignment Name
n Expr
x) = Name -> Expr -> Assign
forall a. Name -> a -> FieldAssignment' a
FieldAssignment Name
n ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
x)

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)
    Def QName
_                 -> Expr
e
    Proj{}                -> Expr
e
    Con AmbiguousQName
_                 -> Expr
e
    Lit Literal
_                 -> Expr
e
    QuestionMark{}        -> Expr
e
    Underscore   MetaInfo
_        -> Expr
e
    Dot ExprInfo
i Expr
e               -> ExprInfo -> Expr -> Expr
Dot ExprInfo
i ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s 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')
    WithApp ExprInfo
i Expr
e [Expr]
es        -> ExprInfo -> Expr -> [Expr] -> Expr
WithApp ExprInfo
i ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e) ([(Name, Expr)] -> [Expr] -> [Expr]
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s [Expr]
es)
    Lam  ExprInfo
i LamBinding
lb Expr
e           -> ExprInfo -> LamBinding -> Expr -> Expr
Lam ExprInfo
i LamBinding
lb ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e)
    AbsurdLam ExprInfo
i Hiding
h         -> Expr
e
    ExtendedLam ExprInfo
i DefInfo
di QName
n [Clause]
cs -> Expr
forall a. HasCallStack => a
__IMPOSSIBLE__   -- Maybe later...
    Pi   ExprInfo
i [TypedBinding]
t Expr
e            -> ExprInfo -> [TypedBinding] -> Expr -> Expr
Pi ExprInfo
i ([(Name, Expr)] -> KillRangeT [TypedBinding]
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s [TypedBinding]
t) ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e)
    Generalized Set QName
ns Expr
e      -> Set QName -> Expr -> Expr
Generalized Set QName
ns ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e)
    Fun  ExprInfo
i Arg Expr
ae Expr
e           -> ExprInfo -> Arg Expr -> Expr -> Expr
Fun ExprInfo
i ([(Name, Expr)] -> Arg Expr -> Arg Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Arg Expr
ae) ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e)
    Set  ExprInfo
i Integer
n              -> Expr
e
    Prop ExprInfo
i Integer
n              -> Expr
e
    Let  ExprInfo
i [LetBinding]
ls Expr
e           -> ExprInfo -> [LetBinding] -> Expr -> Expr
Let ExprInfo
i ([(Name, Expr)] -> [LetBinding] -> [LetBinding]
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s [LetBinding]
ls) ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e)
    ETel [TypedBinding]
t                -> 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)
    RecUpdate ExprInfo
i Expr
e Assigns
nes     -> ExprInfo -> Expr -> Assigns -> Expr
RecUpdate ExprInfo
i ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e) ([(Name, Expr)] -> Assigns -> Assigns
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Assigns
nes)
    -- XXX: Do we need to do more with ScopedExprs?
    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)
    Quote ExprInfo
i               -> Expr
e
    QuoteTerm ExprInfo
i           -> Expr
e
    Unquote ExprInfo
i             -> Expr
e
    Tactic ExprInfo
i Expr
e [NamedArg Expr]
xs         -> ExprInfo -> Expr -> [NamedArg Expr] -> Expr
Tactic ExprInfo
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]
xs)
    DontCare Expr
e            -> Expr -> Expr
DontCare ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e)
    PatternSyn{}          -> Expr
e
    Macro{}               -> Expr
e

instance SubstExpr LetBinding where
  substExpr :: [(Name, Expr)] -> LetBinding -> LetBinding
substExpr [(Name, Expr)]
s LetBinding
lb = case LetBinding
lb of
    LetBind LetInfo
i ArgInfo
r BindName
n Expr
e Expr
e' -> LetInfo -> ArgInfo -> BindName -> Expr -> Expr -> LetBinding
LetBind LetInfo
i ArgInfo
r BindName
n ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e) ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e')
    LetPatBind LetInfo
i Pattern
p Expr
e   -> LetInfo -> Pattern -> Expr -> LetBinding
LetPatBind LetInfo
i Pattern
p ([(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e) -- Andreas, 2012-06-04: what about the pattern p
    LetBinding
_                  -> LetBinding
lb -- Nicolas, 2013-11-11: what about "LetApply" there is experessions in there

instance SubstExpr TypedBinding where
  substExpr :: [(Name, Expr)] -> TypedBinding -> TypedBinding
substExpr [(Name, Expr)]
s TypedBinding
tb = case TypedBinding
tb of
    TBind Range
r TacticAttr
t [NamedArg Binder]
ns Expr
e -> Range -> TacticAttr -> [NamedArg Binder] -> Expr -> TypedBinding
TBind Range
r ([(Name, Expr)] -> TacticAttr -> TacticAttr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s TacticAttr
t) [NamedArg Binder]
ns (Expr -> TypedBinding) -> Expr -> TypedBinding
forall a b. (a -> b) -> a -> b
$ [(Name, Expr)] -> Expr -> Expr
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s Expr
e
    TLet Range
r [LetBinding]
lbs     -> Range -> [LetBinding] -> TypedBinding
TLet Range
r ([LetBinding] -> TypedBinding) -> [LetBinding] -> TypedBinding
forall a b. (a -> b) -> a -> b
$ [(Name, Expr)] -> [LetBinding] -> [LetBinding]
forall a. SubstExpr a => [(Name, Expr)] -> a -> a
substExpr [(Name, Expr)]
s [LetBinding]
lbs

-- 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 NamedName a) =>
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 NamedName a => 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 (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
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 t. HasRange t => t -> Range
getRange a
p) [Arg Name]
ns [NamedArg a]
as