{-# LANGUAGE CPP #-}
{-# LANGUAGE ApplicativeDo #-}  -- see exprToPattern

{-| The concrete syntax is a raw representation of the program text
    without any desugaring at all.  This is what the parser produces.
    The idea is that if we figure out how to keep the concrete syntax
    around, it can be printed exactly as the user wrote it.
-}
module Agda.Syntax.Concrete
  ( -- * Expressions
    Expr(..)
  , OpApp(..), fromOrdinary
  , OpAppArgs, OpAppArgs'
  , module Agda.Syntax.Concrete.Name
  , AppView(..), appView, unAppView
  , rawApp, rawAppP
  , isSingleIdentifierP, removeParenP
  , isPattern, isAbsurdP, isBinderP
  , exprToPatternWithHoles
  , returnExpr
    -- * Bindings
  , Binder'(..)
  , Binder
  , mkBinder_
  , mkBinder
  , LamBinding
  , LamBinding'(..)
  , dropTypeAndModality
  , TypedBinding
  , TypedBinding'(..)
  , RecordAssignment
  , RecordAssignments
  , FieldAssignment, FieldAssignment'(..), nameFieldA, exprFieldA
  , ModuleAssignment(..)
  , BoundName(..), mkBoundName_, mkBoundName
  , TacticAttribute
  , Telescope, Telescope1
  , lamBindingsToTelescope
  , makePi
  , mkLam, mkLet, mkTLet
    -- * Declarations
  , RecordDirective(..)
  , isRecordDirective
  , RecordDirectives
  , Declaration(..)
  , ModuleApplication(..)
  , TypeSignature
  , TypeSignatureOrInstanceBlock
  , ImportDirective, Using, ImportedName
  , Renaming, RenamingDirective, HidingDirective
  , AsName'(..), AsName
  , OpenShortHand(..), RewriteEqn, WithExpr
  , LHS(..), Pattern(..), LHSCore(..)
  , observeHiding
  , observeRelevance
  , observeModifiers
  , LamClause(..)
  , RHS, RHS'(..), WhereClause, WhereClause'(..), ExprWhere(..)
  , DoStmt(..)
  , Pragma(..)
  , Module(..)
  , ThingWithFixity(..)
  , HoleContent, HoleContent'(..)
  , topLevelModuleName
  , spanAllowedBeforeModule
  )
  where

import Prelude hiding (null)

import Control.DeepSeq

import Data.Data        ( Data )
import Data.Functor.Identity
import Data.Set         ( Set  )
import Data.Text        ( Text )
-- import Data.Traversable ( forM )

import GHC.Generics     ( Generic )

import Agda.Syntax.Position
import Agda.Syntax.Common
import Agda.Syntax.Fixity
import Agda.Syntax.Literal

import Agda.Syntax.Concrete.Name
import qualified Agda.Syntax.Abstract.Name as A

import Agda.TypeChecking.Positivity.Occurrence

import Agda.Utils.Applicative ( forA )
import Agda.Utils.Either      ( maybeLeft )
import Agda.Utils.Lens
import Agda.Utils.List1       ( List1, pattern (:|) )
import qualified Agda.Utils.List1 as List1
import Agda.Utils.List2       ( List2, pattern List2 )
import Agda.Utils.Null

import Agda.Utils.Impossible

data OpApp e
  = SyntaxBindingLambda Range (List1 LamBinding) e
    -- ^ An abstraction inside a special syntax declaration
    --   (see Issue 358 why we introduce this).
  | Ordinary e
  deriving (Typeable (OpApp e)
Typeable (OpApp e)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> OpApp e -> c (OpApp e))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (OpApp e))
-> (OpApp e -> Constr)
-> (OpApp e -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (OpApp e)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OpApp e)))
-> ((forall b. Data b => b -> b) -> OpApp e -> OpApp e)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> OpApp e -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> OpApp e -> r)
-> (forall u. (forall d. Data d => d -> u) -> OpApp e -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> OpApp e -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e))
-> Data (OpApp e)
OpApp e -> DataType
OpApp e -> Constr
(forall b. Data b => b -> b) -> OpApp e -> OpApp e
forall {e}. Data e => Typeable (OpApp e)
forall e. Data e => OpApp e -> DataType
forall e. Data e => OpApp e -> Constr
forall e.
Data e =>
(forall b. Data b => b -> b) -> OpApp e -> OpApp e
forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> OpApp e -> u
forall e u.
Data e =>
(forall d. Data d => d -> u) -> OpApp e -> [u]
forall e r r'.
Data e =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OpApp e -> r
forall e r r'.
Data e =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OpApp e -> r
forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e)
forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e)
forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (OpApp e)
forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OpApp e -> c (OpApp e)
forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (OpApp e))
forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OpApp 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) -> OpApp e -> u
forall u. (forall d. Data d => d -> u) -> OpApp e -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OpApp e -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OpApp e -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (OpApp e)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OpApp e -> c (OpApp e)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (OpApp e))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OpApp e))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e)
$cgmapMo :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e)
$cgmapMp :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e)
$cgmapM :: forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d) -> OpApp e -> m (OpApp e)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> OpApp e -> u
$cgmapQi :: forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> OpApp e -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> OpApp e -> [u]
$cgmapQ :: forall e u.
Data e =>
(forall d. Data d => d -> u) -> OpApp e -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OpApp e -> r
$cgmapQr :: forall e r r'.
Data e =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OpApp e -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OpApp e -> r
$cgmapQl :: forall e r r'.
Data e =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OpApp e -> r
gmapT :: (forall b. Data b => b -> b) -> OpApp e -> OpApp e
$cgmapT :: forall e.
Data e =>
(forall b. Data b => b -> b) -> OpApp e -> OpApp e
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OpApp e))
$cdataCast2 :: forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OpApp e))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (OpApp e))
$cdataCast1 :: forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (OpApp e))
dataTypeOf :: OpApp e -> DataType
$cdataTypeOf :: forall e. Data e => OpApp e -> DataType
toConstr :: OpApp e -> Constr
$ctoConstr :: forall e. Data e => OpApp e -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (OpApp e)
$cgunfold :: forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (OpApp e)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OpApp e -> c (OpApp e)
$cgfoldl :: forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OpApp e -> c (OpApp e)
Data, (forall a b. (a -> b) -> OpApp a -> OpApp b)
-> (forall a b. a -> OpApp b -> OpApp a) -> Functor OpApp
forall a b. a -> OpApp b -> OpApp a
forall a b. (a -> b) -> OpApp a -> OpApp b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> OpApp b -> OpApp a
$c<$ :: forall a b. a -> OpApp b -> OpApp a
fmap :: forall a b. (a -> b) -> OpApp a -> OpApp b
$cfmap :: forall a b. (a -> b) -> OpApp a -> OpApp b
Functor, (forall m. Monoid m => OpApp m -> m)
-> (forall m a. Monoid m => (a -> m) -> OpApp a -> m)
-> (forall m a. Monoid m => (a -> m) -> OpApp a -> m)
-> (forall a b. (a -> b -> b) -> b -> OpApp a -> b)
-> (forall a b. (a -> b -> b) -> b -> OpApp a -> b)
-> (forall b a. (b -> a -> b) -> b -> OpApp a -> b)
-> (forall b a. (b -> a -> b) -> b -> OpApp a -> b)
-> (forall a. (a -> a -> a) -> OpApp a -> a)
-> (forall a. (a -> a -> a) -> OpApp a -> a)
-> (forall a. OpApp a -> [a])
-> (forall a. OpApp a -> Bool)
-> (forall a. OpApp a -> Int)
-> (forall a. Eq a => a -> OpApp a -> Bool)
-> (forall a. Ord a => OpApp a -> a)
-> (forall a. Ord a => OpApp a -> a)
-> (forall a. Num a => OpApp a -> a)
-> (forall a. Num a => OpApp a -> a)
-> Foldable OpApp
forall a. Eq a => a -> OpApp a -> Bool
forall a. Num a => OpApp a -> a
forall a. Ord a => OpApp a -> a
forall m. Monoid m => OpApp m -> m
forall a. OpApp a -> Bool
forall a. OpApp a -> Int
forall a. OpApp a -> [a]
forall a. (a -> a -> a) -> OpApp a -> a
forall m a. Monoid m => (a -> m) -> OpApp a -> m
forall b a. (b -> a -> b) -> b -> OpApp a -> b
forall a b. (a -> b -> b) -> b -> OpApp 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 :: forall a. Num a => OpApp a -> a
$cproduct :: forall a. Num a => OpApp a -> a
sum :: forall a. Num a => OpApp a -> a
$csum :: forall a. Num a => OpApp a -> a
minimum :: forall a. Ord a => OpApp a -> a
$cminimum :: forall a. Ord a => OpApp a -> a
maximum :: forall a. Ord a => OpApp a -> a
$cmaximum :: forall a. Ord a => OpApp a -> a
elem :: forall a. Eq a => a -> OpApp a -> Bool
$celem :: forall a. Eq a => a -> OpApp a -> Bool
length :: forall a. OpApp a -> Int
$clength :: forall a. OpApp a -> Int
null :: forall a. OpApp a -> Bool
$cnull :: forall a. OpApp a -> Bool
toList :: forall a. OpApp a -> [a]
$ctoList :: forall a. OpApp a -> [a]
foldl1 :: forall a. (a -> a -> a) -> OpApp a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> OpApp a -> a
foldr1 :: forall a. (a -> a -> a) -> OpApp a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> OpApp a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> OpApp a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> OpApp a -> b
foldl :: forall b a. (b -> a -> b) -> b -> OpApp a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> OpApp a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> OpApp a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> OpApp a -> b
foldr :: forall a b. (a -> b -> b) -> b -> OpApp a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> OpApp a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> OpApp a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> OpApp a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> OpApp a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> OpApp a -> m
fold :: forall m. Monoid m => OpApp m -> m
$cfold :: forall m. Monoid m => OpApp m -> m
Foldable, Functor OpApp
Foldable OpApp
Functor OpApp
-> Foldable OpApp
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> OpApp a -> f (OpApp b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    OpApp (f a) -> f (OpApp a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> OpApp a -> m (OpApp b))
-> (forall (m :: * -> *) a. Monad m => OpApp (m a) -> m (OpApp a))
-> Traversable OpApp
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 => OpApp (m a) -> m (OpApp a)
forall (f :: * -> *) a. Applicative f => OpApp (f a) -> f (OpApp a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> OpApp a -> m (OpApp b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> OpApp a -> f (OpApp b)
sequence :: forall (m :: * -> *) a. Monad m => OpApp (m a) -> m (OpApp a)
$csequence :: forall (m :: * -> *) a. Monad m => OpApp (m a) -> m (OpApp a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> OpApp a -> m (OpApp b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> OpApp a -> m (OpApp b)
sequenceA :: forall (f :: * -> *) a. Applicative f => OpApp (f a) -> f (OpApp a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => OpApp (f a) -> f (OpApp a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> OpApp a -> f (OpApp b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> OpApp a -> f (OpApp b)
Traversable, OpApp e -> OpApp e -> Bool
(OpApp e -> OpApp e -> Bool)
-> (OpApp e -> OpApp e -> Bool) -> Eq (OpApp e)
forall e. Eq e => OpApp e -> OpApp e -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OpApp e -> OpApp e -> Bool
$c/= :: forall e. Eq e => OpApp e -> OpApp e -> Bool
== :: OpApp e -> OpApp e -> Bool
$c== :: forall e. Eq e => OpApp e -> OpApp e -> Bool
Eq)

fromOrdinary :: e -> OpApp e -> e
fromOrdinary :: forall e. e -> OpApp e -> e
fromOrdinary e
d (Ordinary e
e) = e
e
fromOrdinary e
d OpApp e
_            = e
d

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

type FieldAssignment = FieldAssignment' Expr

data ModuleAssignment  = ModuleAssignment
                           { ModuleAssignment -> QName
_qnameModA     :: QName
                           , ModuleAssignment -> [Expr]
_exprModA      :: [Expr]
                           , ModuleAssignment -> ImportDirective
_importDirModA :: ImportDirective
                           }
  deriving (Typeable ModuleAssignment
Typeable ModuleAssignment
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ModuleAssignment -> c ModuleAssignment)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ModuleAssignment)
-> (ModuleAssignment -> Constr)
-> (ModuleAssignment -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ModuleAssignment))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ModuleAssignment))
-> ((forall b. Data b => b -> b)
    -> ModuleAssignment -> ModuleAssignment)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ModuleAssignment -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ModuleAssignment -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> ModuleAssignment -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ModuleAssignment -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> ModuleAssignment -> m ModuleAssignment)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ModuleAssignment -> m ModuleAssignment)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ModuleAssignment -> m ModuleAssignment)
-> Data ModuleAssignment
ModuleAssignment -> DataType
ModuleAssignment -> Constr
(forall b. Data b => b -> b)
-> ModuleAssignment -> ModuleAssignment
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) -> ModuleAssignment -> u
forall u. (forall d. Data d => d -> u) -> ModuleAssignment -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleAssignment -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleAssignment -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ModuleAssignment -> m ModuleAssignment
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleAssignment -> m ModuleAssignment
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleAssignment
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleAssignment -> c ModuleAssignment
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ModuleAssignment)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleAssignment)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleAssignment -> m ModuleAssignment
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleAssignment -> m ModuleAssignment
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleAssignment -> m ModuleAssignment
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleAssignment -> m ModuleAssignment
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ModuleAssignment -> m ModuleAssignment
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ModuleAssignment -> m ModuleAssignment
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ModuleAssignment -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ModuleAssignment -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> ModuleAssignment -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ModuleAssignment -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleAssignment -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleAssignment -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleAssignment -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleAssignment -> r
gmapT :: (forall b. Data b => b -> b)
-> ModuleAssignment -> ModuleAssignment
$cgmapT :: (forall b. Data b => b -> b)
-> ModuleAssignment -> ModuleAssignment
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleAssignment)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleAssignment)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ModuleAssignment)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ModuleAssignment)
dataTypeOf :: ModuleAssignment -> DataType
$cdataTypeOf :: ModuleAssignment -> DataType
toConstr :: ModuleAssignment -> Constr
$ctoConstr :: ModuleAssignment -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleAssignment
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleAssignment
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleAssignment -> c ModuleAssignment
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleAssignment -> c ModuleAssignment
Data, ModuleAssignment -> ModuleAssignment -> Bool
(ModuleAssignment -> ModuleAssignment -> Bool)
-> (ModuleAssignment -> ModuleAssignment -> Bool)
-> Eq ModuleAssignment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModuleAssignment -> ModuleAssignment -> Bool
$c/= :: ModuleAssignment -> ModuleAssignment -> Bool
== :: ModuleAssignment -> ModuleAssignment -> Bool
$c== :: ModuleAssignment -> ModuleAssignment -> Bool
Eq)

type RecordAssignment  = Either FieldAssignment ModuleAssignment
type RecordAssignments = [RecordAssignment]

nameFieldA :: Lens' Name (FieldAssignment' a)
nameFieldA :: forall a. Lens' Name (FieldAssignment' a)
nameFieldA Name -> f Name
f FieldAssignment' a
r = Name -> f Name
f (FieldAssignment' a -> Name
forall a. FieldAssignment' a -> Name
_nameFieldA FieldAssignment' a
r) f Name -> (Name -> FieldAssignment' a) -> f (FieldAssignment' a)
forall (m :: * -> *) a b. Functor m => m a -> (a -> b) -> m b
<&> \Name
x -> FieldAssignment' a
r { _nameFieldA :: Name
_nameFieldA = Name
x }

exprFieldA :: Lens' a (FieldAssignment' a)
exprFieldA :: forall a. Lens' a (FieldAssignment' a)
exprFieldA a -> f a
f FieldAssignment' a
r = a -> f a
f (FieldAssignment' a -> a
forall a. FieldAssignment' a -> a
_exprFieldA FieldAssignment' a
r) f a -> (a -> FieldAssignment' a) -> f (FieldAssignment' a)
forall (m :: * -> *) a b. Functor m => m a -> (a -> b) -> m b
<&> \a
x -> FieldAssignment' a
r { _exprFieldA :: a
_exprFieldA = a
x }

-- UNUSED Liang-Ting Chen 2019-07-16
--qnameModA :: Lens' QName ModuleAssignment
--qnameModA f r = f (_qnameModA r) <&> \x -> r { _qnameModA = x }
--
--exprModA :: Lens' [Expr] ModuleAssignment
--exprModA f r = f (_exprModA r) <&> \x -> r { _exprModA = x }
--
--importDirModA :: Lens' ImportDirective ModuleAssignment
--importDirModA f r = f (_importDirModA r) <&> \x -> r { _importDirModA = x }

-- | Concrete expressions. Should represent exactly what the user wrote.
data Expr
  = Ident QName                                -- ^ ex: @x@
  | Lit Range Literal                          -- ^ ex: @1@ or @\"foo\"@
  | QuestionMark Range (Maybe Nat)             -- ^ ex: @?@ or @{! ... !}@
  | Underscore Range (Maybe String)            -- ^ ex: @_@ or @_A_5@
  | RawApp Range (List2 Expr)                  -- ^ before parsing operators
  | App Range Expr (NamedArg Expr)             -- ^ ex: @e e@, @e {e}@, or @e {x = e}@
  | OpApp Range QName (Set A.Name) OpAppArgs   -- ^ ex: @e + e@
                                               -- The 'QName' is possibly ambiguous,
                                               -- but it must correspond to one of the names in the set.
  | WithApp Range Expr [Expr]                  -- ^ ex: @e | e1 | .. | en@
  | HiddenArg Range (Named_ Expr)              -- ^ ex: @{e}@ or @{x=e}@
  | InstanceArg Range (Named_ Expr)            -- ^ ex: @{{e}}@ or @{{x=e}}@
  | Lam Range (List1 LamBinding) Expr          -- ^ ex: @\\x {y} -> e@ or @\\(x:A){y:B} -> e@
  | AbsurdLam Range Hiding                     -- ^ ex: @\\ ()@
  | ExtendedLam Range Erased
      (List1 LamClause)                        -- ^ ex: @\\ { p11 .. p1a -> e1 ; .. ; pn1 .. pnz -> en }@
  | Fun Range (Arg Expr) Expr                  -- ^ ex: @e -> e@ or @.e -> e@ (NYI: @{e} -> e@)
  | Pi Telescope1 Expr                         -- ^ ex: @(xs:e) -> e@ or @{xs:e} -> e@
  | Rec Range RecordAssignments                -- ^ ex: @record {x = a; y = b}@, or @record { x = a; M1; M2 }@
  | RecUpdate Range Expr [FieldAssignment]     -- ^ ex: @record e {x = a; y = b}@
  | Let Range (List1 Declaration) (Maybe Expr) -- ^ ex: @let Ds in e@, missing body when parsing do-notation let
  | Paren Range Expr                           -- ^ ex: @(e)@
  | IdiomBrackets Range [Expr]                 -- ^ ex: @(| e1 | e2 | .. | en |)@ or @(|)@
  | DoBlock Range (List1 DoStmt)               -- ^ ex: @do x <- m1; m2@
  | Absurd Range                               -- ^ ex: @()@ or @{}@, only in patterns
  | As Range Name Expr                         -- ^ ex: @x\@p@, only in patterns
  | Dot Range Expr                             -- ^ ex: @.p@, only in patterns
  | DoubleDot Range Expr                       -- ^ ex: @..A@, used for parsing @..A -> B@
  | ETel Telescope                             -- ^ only used for printing telescopes
  | Quote Range                                -- ^ ex: @quote@, should be applied to a name
  | QuoteTerm Range                            -- ^ ex: @quoteTerm@, should be applied to a term
  | Tactic Range Expr                          -- ^ ex: @\@(tactic t)@, used to declare tactic arguments
  | Unquote Range                              -- ^ ex: @unquote@, should be applied to a term of type @Term@
  | DontCare Expr                              -- ^ to print irrelevant things
  | Equal Range Expr Expr                      -- ^ ex: @a = b@, used internally in the parser
  | Ellipsis Range                             -- ^ @...@, used internally to parse patterns.
  | Generalized Expr
  deriving (Typeable Expr
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 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)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
Monad m =>
(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 :: forall u. Int -> (forall d. Data d => d -> u) -> Expr -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Expr -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Expr -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Expr -> [u]
gmapQr :: forall r r'.
(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 :: forall r r'.
(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 (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(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 (t :: * -> *) (c :: * -> *).
Typeable t =>
(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 (c :: * -> *).
(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 (c :: * -> *).
(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
Data, Expr -> Expr -> Bool
(Expr -> Expr -> Bool) -> (Expr -> Expr -> Bool) -> Eq Expr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Expr -> Expr -> Bool
$c/= :: Expr -> Expr -> Bool
== :: Expr -> Expr -> Bool
$c== :: Expr -> Expr -> Bool
Eq)

type OpAppArgs = OpAppArgs' Expr
type OpAppArgs' e = [NamedArg (MaybePlaceholder (OpApp e))]

-- | Concrete patterns. No literals in patterns at the moment.
data Pattern
  = IdentP QName                           -- ^ @c@ or @x@
  | QuoteP Range                           -- ^ @quote@
  | AppP Pattern (NamedArg Pattern)        -- ^ @p p'@ or @p {x = p'}@
  | RawAppP Range (List2 Pattern)          -- ^ @p1..pn@ before parsing operators
  | OpAppP Range QName (Set A.Name)
           [NamedArg Pattern]              -- ^ eg: @p => p'@ for operator @_=>_@
                                           -- The 'QName' is possibly
                                           -- ambiguous, but it must
                                           -- correspond to one of
                                           -- the names in the set.
  | HiddenP Range (Named_ Pattern)         -- ^ @{p}@ or @{x = p}@
  | InstanceP Range (Named_ Pattern)       -- ^ @{{p}}@ or @{{x = p}}@
  | ParenP Range Pattern                   -- ^ @(p)@
  | WildP Range                            -- ^ @_@
  | AbsurdP Range                          -- ^ @()@
  | AsP Range Name Pattern                 -- ^ @x\@p@ unused
  | DotP Range Expr                        -- ^ @.e@
  | LitP Range Literal                     -- ^ @0@, @1@, etc.
  | RecP Range [FieldAssignment' Pattern]  -- ^ @record {x = p; y = q}@
  | EqualP Range [(Expr,Expr)]             -- ^ @i = i1@ i.e. cubical face lattice generator
  | EllipsisP Range (Maybe Pattern)        -- ^ @...@, only as left-most pattern.
                                           --   Second arg is @Nothing@ before expansion, and
                                           --   @Just p@ after expanding ellipsis to @p@.
  | WithP Range Pattern                    -- ^ @| p@, for with-patterns.
  deriving (Typeable Pattern
Typeable Pattern
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Pattern -> c Pattern)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Pattern)
-> (Pattern -> Constr)
-> (Pattern -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Pattern))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pattern))
-> ((forall b. Data b => b -> b) -> Pattern -> Pattern)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Pattern -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Pattern -> r)
-> (forall u. (forall d. Data d => d -> u) -> Pattern -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Pattern -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Pattern -> m Pattern)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Pattern -> m Pattern)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Pattern -> m Pattern)
-> Data Pattern
Pattern -> DataType
Pattern -> Constr
(forall b. Data b => b -> b) -> Pattern -> Pattern
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 -> u
forall u. (forall d. Data d => d -> u) -> Pattern -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Pattern -> m Pattern
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pattern -> m Pattern
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Pattern
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern -> c Pattern
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Pattern)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pattern)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pattern -> m Pattern
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pattern -> m Pattern
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pattern -> m Pattern
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pattern -> m Pattern
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Pattern -> m Pattern
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Pattern -> m Pattern
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Pattern -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Pattern -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Pattern -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Pattern -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern -> r
gmapT :: (forall b. Data b => b -> b) -> Pattern -> Pattern
$cgmapT :: (forall b. Data b => b -> b) -> Pattern -> Pattern
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pattern)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pattern)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Pattern)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Pattern)
dataTypeOf :: Pattern -> DataType
$cdataTypeOf :: Pattern -> DataType
toConstr :: Pattern -> Constr
$ctoConstr :: Pattern -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Pattern
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Pattern
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern -> c Pattern
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern -> c Pattern
Data, Pattern -> Pattern -> Bool
(Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Bool) -> Eq Pattern
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Pattern -> Pattern -> Bool
$c/= :: Pattern -> Pattern -> Bool
== :: Pattern -> Pattern -> Bool
$c== :: Pattern -> Pattern -> Bool
Eq)

data DoStmt
  = DoBind Range Pattern Expr [LamClause]   -- ^ @p ← e where cs@
  | DoThen Expr
  | DoLet Range (List1 Declaration)
  deriving (Typeable DoStmt
Typeable DoStmt
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> DoStmt -> c DoStmt)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DoStmt)
-> (DoStmt -> Constr)
-> (DoStmt -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DoStmt))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DoStmt))
-> ((forall b. Data b => b -> b) -> DoStmt -> DoStmt)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DoStmt -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DoStmt -> r)
-> (forall u. (forall d. Data d => d -> u) -> DoStmt -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> DoStmt -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> DoStmt -> m DoStmt)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DoStmt -> m DoStmt)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DoStmt -> m DoStmt)
-> Data DoStmt
DoStmt -> DataType
DoStmt -> Constr
(forall b. Data b => b -> b) -> DoStmt -> DoStmt
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) -> DoStmt -> u
forall u. (forall d. Data d => d -> u) -> DoStmt -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DoStmt -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DoStmt -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DoStmt -> m DoStmt
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DoStmt -> m DoStmt
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DoStmt
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DoStmt -> c DoStmt
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DoStmt)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DoStmt)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DoStmt -> m DoStmt
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DoStmt -> m DoStmt
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DoStmt -> m DoStmt
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DoStmt -> m DoStmt
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DoStmt -> m DoStmt
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DoStmt -> m DoStmt
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DoStmt -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DoStmt -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> DoStmt -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DoStmt -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DoStmt -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DoStmt -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DoStmt -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DoStmt -> r
gmapT :: (forall b. Data b => b -> b) -> DoStmt -> DoStmt
$cgmapT :: (forall b. Data b => b -> b) -> DoStmt -> DoStmt
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DoStmt)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DoStmt)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DoStmt)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DoStmt)
dataTypeOf :: DoStmt -> DataType
$cdataTypeOf :: DoStmt -> DataType
toConstr :: DoStmt -> Constr
$ctoConstr :: DoStmt -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DoStmt
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DoStmt
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DoStmt -> c DoStmt
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DoStmt -> c DoStmt
Data, DoStmt -> DoStmt -> Bool
(DoStmt -> DoStmt -> Bool)
-> (DoStmt -> DoStmt -> Bool) -> Eq DoStmt
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DoStmt -> DoStmt -> Bool
$c/= :: DoStmt -> DoStmt -> Bool
== :: DoStmt -> DoStmt -> Bool
$c== :: DoStmt -> DoStmt -> Bool
Eq)

-- | A Binder @x\@p@, the pattern is optional
data Binder' a = Binder
  { forall a. Binder' a -> Maybe Pattern
binderPattern :: Maybe Pattern
  , forall a. Binder' a -> a
binderName    :: a
  } deriving (Typeable (Binder' a)
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 b. Data b => b -> b) -> Binder' a -> 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))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
Monad m =>
(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 :: forall u. 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 u. (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 :: forall r r'.
(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 :: forall r r'.
(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 (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(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 (t :: * -> *) (c :: * -> *).
Typeable t =>
(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 (c :: * -> *).
(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 (c :: * -> *).
(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)
Data, 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, (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
<$ :: forall a b. a -> Binder' b -> Binder' a
$c<$ :: forall a b. a -> Binder' b -> Binder' a
fmap :: forall a b. (a -> b) -> Binder' a -> Binder' b
$cfmap :: forall a b. (a -> b) -> Binder' a -> Binder' b
Functor, (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 :: forall a. Num a => Binder' a -> a
$cproduct :: forall a. Num a => Binder' a -> a
sum :: forall a. Num a => Binder' a -> a
$csum :: forall a. Num a => Binder' a -> a
minimum :: forall a. Ord a => Binder' a -> a
$cminimum :: forall a. Ord a => Binder' a -> a
maximum :: forall a. Ord a => Binder' a -> a
$cmaximum :: forall a. Ord a => Binder' a -> a
elem :: forall a. Eq a => a -> Binder' a -> Bool
$celem :: forall a. Eq a => a -> Binder' a -> Bool
length :: forall a. Binder' a -> Int
$clength :: forall a. Binder' a -> Int
null :: forall a. Binder' a -> Bool
$cnull :: forall a. Binder' a -> Bool
toList :: forall a. Binder' a -> [a]
$ctoList :: forall a. Binder' a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Binder' a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Binder' a -> a
foldr1 :: forall a. (a -> a -> a) -> Binder' a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Binder' a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Binder' a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Binder' a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Binder' a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Binder' a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Binder' a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Binder' a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Binder' a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Binder' a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Binder' a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Binder' a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Binder' a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Binder' a -> m
fold :: forall m. Monoid m => 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'
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 :: forall (m :: * -> *) a. Monad m => Binder' (m a) -> m (Binder' a)
$csequence :: forall (m :: * -> *) a. Monad m => Binder' (m a) -> m (Binder' a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Binder' a -> m (Binder' b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Binder' a -> m (Binder' b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Binder' (f a) -> f (Binder' a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Binder' (f a) -> f (Binder' a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Binder' a -> f (Binder' b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Binder' a -> f (Binder' b)
Traversable)

type Binder = Binder' BoundName

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

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

-- | A lambda binding is either domain free or typed.

type LamBinding = LamBinding' TypedBinding
data LamBinding' a
  = DomainFree (NamedArg Binder)
    -- ^ . @x@ or @{x}@ or @.x@ or @.{x}@ or @{.x}@ or @x\@p@ or @(p)@
  | DomainFull a
    -- ^ . @(xs : e)@ or @{xs : e}@
  deriving (Typeable (LamBinding' a)
Typeable (LamBinding' a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LamBinding' a -> c (LamBinding' a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (LamBinding' a))
-> (LamBinding' a -> Constr)
-> (LamBinding' a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (LamBinding' a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (LamBinding' a)))
-> ((forall b. Data b => b -> b) -> LamBinding' a -> LamBinding' a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LamBinding' a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LamBinding' a -> r)
-> (forall u. (forall d. Data d => d -> u) -> LamBinding' a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> LamBinding' a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> LamBinding' a -> m (LamBinding' a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> LamBinding' a -> m (LamBinding' a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> LamBinding' a -> m (LamBinding' a))
-> Data (LamBinding' a)
LamBinding' a -> DataType
LamBinding' a -> Constr
(forall b. Data b => b -> b) -> LamBinding' a -> LamBinding' a
forall {a}. Data a => Typeable (LamBinding' a)
forall a. Data a => LamBinding' a -> DataType
forall a. Data a => LamBinding' a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> LamBinding' a -> LamBinding' a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> LamBinding' a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> LamBinding' a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding' a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding' a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> LamBinding' a -> m (LamBinding' a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> LamBinding' a -> m (LamBinding' a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LamBinding' a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamBinding' a -> c (LamBinding' a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (LamBinding' a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LamBinding' 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) -> LamBinding' a -> u
forall u. (forall d. Data d => d -> u) -> LamBinding' a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding' a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding' a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LamBinding' a -> m (LamBinding' a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LamBinding' a -> m (LamBinding' a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LamBinding' a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamBinding' a -> c (LamBinding' a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (LamBinding' a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LamBinding' a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LamBinding' a -> m (LamBinding' a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> LamBinding' a -> m (LamBinding' a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LamBinding' a -> m (LamBinding' a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> LamBinding' a -> m (LamBinding' a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LamBinding' a -> m (LamBinding' a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> LamBinding' a -> m (LamBinding' a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LamBinding' a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> LamBinding' a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> LamBinding' a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> LamBinding' a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding' a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding' a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding' a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LamBinding' a -> r
gmapT :: (forall b. Data b => b -> b) -> LamBinding' a -> LamBinding' a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> LamBinding' a -> LamBinding' a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LamBinding' a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LamBinding' a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (LamBinding' a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (LamBinding' a))
dataTypeOf :: LamBinding' a -> DataType
$cdataTypeOf :: forall a. Data a => LamBinding' a -> DataType
toConstr :: LamBinding' a -> Constr
$ctoConstr :: forall a. Data a => LamBinding' a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LamBinding' a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LamBinding' a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamBinding' a -> c (LamBinding' a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamBinding' a -> c (LamBinding' a)
Data, (forall a b. (a -> b) -> LamBinding' a -> LamBinding' b)
-> (forall a b. a -> LamBinding' b -> LamBinding' a)
-> Functor LamBinding'
forall a b. a -> LamBinding' b -> LamBinding' a
forall a b. (a -> b) -> LamBinding' a -> LamBinding' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> LamBinding' b -> LamBinding' a
$c<$ :: forall a b. a -> LamBinding' b -> LamBinding' a
fmap :: forall a b. (a -> b) -> LamBinding' a -> LamBinding' b
$cfmap :: forall a b. (a -> b) -> LamBinding' a -> LamBinding' b
Functor, (forall m. Monoid m => LamBinding' m -> m)
-> (forall m a. Monoid m => (a -> m) -> LamBinding' a -> m)
-> (forall m a. Monoid m => (a -> m) -> LamBinding' a -> m)
-> (forall a b. (a -> b -> b) -> b -> LamBinding' a -> b)
-> (forall a b. (a -> b -> b) -> b -> LamBinding' a -> b)
-> (forall b a. (b -> a -> b) -> b -> LamBinding' a -> b)
-> (forall b a. (b -> a -> b) -> b -> LamBinding' a -> b)
-> (forall a. (a -> a -> a) -> LamBinding' a -> a)
-> (forall a. (a -> a -> a) -> LamBinding' a -> a)
-> (forall a. LamBinding' a -> [a])
-> (forall a. LamBinding' a -> Bool)
-> (forall a. LamBinding' a -> Int)
-> (forall a. Eq a => a -> LamBinding' a -> Bool)
-> (forall a. Ord a => LamBinding' a -> a)
-> (forall a. Ord a => LamBinding' a -> a)
-> (forall a. Num a => LamBinding' a -> a)
-> (forall a. Num a => LamBinding' a -> a)
-> Foldable LamBinding'
forall a. Eq a => a -> LamBinding' a -> Bool
forall a. Num a => LamBinding' a -> a
forall a. Ord a => LamBinding' a -> a
forall m. Monoid m => LamBinding' m -> m
forall a. LamBinding' a -> Bool
forall a. LamBinding' a -> Int
forall a. LamBinding' a -> [a]
forall a. (a -> a -> a) -> LamBinding' a -> a
forall m a. Monoid m => (a -> m) -> LamBinding' a -> m
forall b a. (b -> a -> b) -> b -> LamBinding' a -> b
forall a b. (a -> b -> b) -> b -> LamBinding' 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 :: forall a. Num a => LamBinding' a -> a
$cproduct :: forall a. Num a => LamBinding' a -> a
sum :: forall a. Num a => LamBinding' a -> a
$csum :: forall a. Num a => LamBinding' a -> a
minimum :: forall a. Ord a => LamBinding' a -> a
$cminimum :: forall a. Ord a => LamBinding' a -> a
maximum :: forall a. Ord a => LamBinding' a -> a
$cmaximum :: forall a. Ord a => LamBinding' a -> a
elem :: forall a. Eq a => a -> LamBinding' a -> Bool
$celem :: forall a. Eq a => a -> LamBinding' a -> Bool
length :: forall a. LamBinding' a -> Int
$clength :: forall a. LamBinding' a -> Int
null :: forall a. LamBinding' a -> Bool
$cnull :: forall a. LamBinding' a -> Bool
toList :: forall a. LamBinding' a -> [a]
$ctoList :: forall a. LamBinding' a -> [a]
foldl1 :: forall a. (a -> a -> a) -> LamBinding' a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> LamBinding' a -> a
foldr1 :: forall a. (a -> a -> a) -> LamBinding' a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> LamBinding' a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> LamBinding' a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> LamBinding' a -> b
foldl :: forall b a. (b -> a -> b) -> b -> LamBinding' a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> LamBinding' a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> LamBinding' a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> LamBinding' a -> b
foldr :: forall a b. (a -> b -> b) -> b -> LamBinding' a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> LamBinding' a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> LamBinding' a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> LamBinding' a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> LamBinding' a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> LamBinding' a -> m
fold :: forall m. Monoid m => LamBinding' m -> m
$cfold :: forall m. Monoid m => LamBinding' m -> m
Foldable, Functor LamBinding'
Foldable LamBinding'
Functor LamBinding'
-> Foldable LamBinding'
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> LamBinding' a -> f (LamBinding' b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    LamBinding' (f a) -> f (LamBinding' a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> LamBinding' a -> m (LamBinding' b))
-> (forall (m :: * -> *) a.
    Monad m =>
    LamBinding' (m a) -> m (LamBinding' a))
-> Traversable LamBinding'
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 =>
LamBinding' (m a) -> m (LamBinding' a)
forall (f :: * -> *) a.
Applicative f =>
LamBinding' (f a) -> f (LamBinding' a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> LamBinding' a -> m (LamBinding' b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> LamBinding' a -> f (LamBinding' b)
sequence :: forall (m :: * -> *) a.
Monad m =>
LamBinding' (m a) -> m (LamBinding' a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
LamBinding' (m a) -> m (LamBinding' a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> LamBinding' a -> m (LamBinding' b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> LamBinding' a -> m (LamBinding' b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
LamBinding' (f a) -> f (LamBinding' a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
LamBinding' (f a) -> f (LamBinding' a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> LamBinding' a -> f (LamBinding' b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> LamBinding' a -> f (LamBinding' b)
Traversable, LamBinding' a -> LamBinding' a -> Bool
(LamBinding' a -> LamBinding' a -> Bool)
-> (LamBinding' a -> LamBinding' a -> Bool) -> Eq (LamBinding' a)
forall a. Eq a => LamBinding' a -> LamBinding' a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LamBinding' a -> LamBinding' a -> Bool
$c/= :: forall a. Eq a => LamBinding' a -> LamBinding' a -> Bool
== :: LamBinding' a -> LamBinding' a -> Bool
$c== :: forall a. Eq a => LamBinding' a -> LamBinding' a -> Bool
Eq)

-- | Drop type annotations and lets from bindings.
dropTypeAndModality :: LamBinding -> [LamBinding]
dropTypeAndModality :: LamBinding -> [LamBinding]
dropTypeAndModality (DomainFull (TBind Range
_ List1 (NamedArg Binder)
xs Expr
_)) =
  (NamedArg Binder -> LamBinding)
-> [NamedArg Binder] -> [LamBinding]
forall a b. (a -> b) -> [a] -> [b]
map (NamedArg Binder -> LamBinding
forall a. NamedArg Binder -> LamBinding' a
DomainFree (NamedArg Binder -> LamBinding)
-> (NamedArg Binder -> NamedArg Binder)
-> NamedArg Binder
-> LamBinding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Modality -> NamedArg Binder -> NamedArg Binder
forall a. LensModality a => Modality -> a -> a
setModality Modality
defaultModality) ([NamedArg Binder] -> [LamBinding])
-> [NamedArg Binder] -> [LamBinding]
forall a b. (a -> b) -> a -> b
$ List1 (NamedArg Binder) -> [NamedArg Binder]
forall a. NonEmpty a -> [a]
List1.toList List1 (NamedArg Binder)
xs
dropTypeAndModality (DomainFull TLet{}) = []
dropTypeAndModality (DomainFree NamedArg Binder
x) = [NamedArg Binder -> LamBinding
forall a. NamedArg Binder -> LamBinding' a
DomainFree (NamedArg Binder -> LamBinding) -> NamedArg Binder -> LamBinding
forall a b. (a -> b) -> a -> b
$ Modality -> NamedArg Binder -> NamedArg Binder
forall a. LensModality a => Modality -> a -> a
setModality Modality
defaultModality NamedArg Binder
x]

data BoundName = BName
  { BoundName -> Name
boundName   :: Name
  , BoundName -> Fixity'
bnameFixity :: Fixity'
  , BoundName -> Maybe Expr
bnameTactic :: TacticAttribute -- From @tactic attribute
  }
  deriving (Typeable BoundName
Typeable BoundName
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> BoundName -> c BoundName)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c BoundName)
-> (BoundName -> Constr)
-> (BoundName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c BoundName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BoundName))
-> ((forall b. Data b => b -> b) -> BoundName -> BoundName)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> BoundName -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> BoundName -> r)
-> (forall u. (forall d. Data d => d -> u) -> BoundName -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> BoundName -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> BoundName -> m BoundName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BoundName -> m BoundName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BoundName -> m BoundName)
-> Data BoundName
BoundName -> DataType
BoundName -> Constr
(forall b. Data b => b -> b) -> BoundName -> BoundName
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) -> BoundName -> u
forall u. (forall d. Data d => d -> u) -> BoundName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BoundName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BoundName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BoundName -> m BoundName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BoundName -> m BoundName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BoundName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BoundName -> c BoundName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BoundName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BoundName)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BoundName -> m BoundName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BoundName -> m BoundName
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BoundName -> m BoundName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BoundName -> m BoundName
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BoundName -> m BoundName
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BoundName -> m BoundName
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BoundName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BoundName -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> BoundName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BoundName -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BoundName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BoundName -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BoundName -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BoundName -> r
gmapT :: (forall b. Data b => b -> b) -> BoundName -> BoundName
$cgmapT :: (forall b. Data b => b -> b) -> BoundName -> BoundName
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BoundName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BoundName)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BoundName)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BoundName)
dataTypeOf :: BoundName -> DataType
$cdataTypeOf :: BoundName -> DataType
toConstr :: BoundName -> Constr
$ctoConstr :: BoundName -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BoundName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BoundName
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BoundName -> c BoundName
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BoundName -> c BoundName
Data, BoundName -> BoundName -> Bool
(BoundName -> BoundName -> Bool)
-> (BoundName -> BoundName -> Bool) -> Eq BoundName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BoundName -> BoundName -> Bool
$c/= :: BoundName -> BoundName -> Bool
== :: BoundName -> BoundName -> Bool
$c== :: BoundName -> BoundName -> Bool
Eq)

type TacticAttribute = Maybe Expr

mkBoundName_ :: Name -> BoundName
mkBoundName_ :: Name -> BoundName
mkBoundName_ Name
x = Name -> Fixity' -> BoundName
mkBoundName Name
x Fixity'
noFixity'

mkBoundName :: Name -> Fixity' -> BoundName
mkBoundName :: Name -> Fixity' -> BoundName
mkBoundName Name
x Fixity'
f = Name -> Fixity' -> Maybe Expr -> BoundName
BName Name
x Fixity'
f Maybe Expr
forall a. Maybe a
Nothing

-- | A typed binding.

type TypedBinding = TypedBinding' Expr

data TypedBinding' e
  = TBind Range (List1 (NamedArg Binder)) e
    -- ^ Binding @(x1\@p1 ... xn\@pn : A)@.
  | TLet  Range (List1 Declaration)
    -- ^ Let binding @(let Ds)@ or @(open M args)@.
  deriving (Typeable (TypedBinding' e)
Typeable (TypedBinding' e)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TypedBinding' e -> c (TypedBinding' e))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (TypedBinding' e))
-> (TypedBinding' e -> Constr)
-> (TypedBinding' e -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (TypedBinding' e)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (TypedBinding' e)))
-> ((forall b. Data b => b -> b)
    -> TypedBinding' e -> TypedBinding' e)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TypedBinding' e -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TypedBinding' e -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> TypedBinding' e -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> TypedBinding' e -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> TypedBinding' e -> m (TypedBinding' e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TypedBinding' e -> m (TypedBinding' e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TypedBinding' e -> m (TypedBinding' e))
-> Data (TypedBinding' e)
TypedBinding' e -> DataType
TypedBinding' e -> Constr
(forall b. Data b => b -> b) -> TypedBinding' e -> TypedBinding' e
forall {e}. Data e => Typeable (TypedBinding' e)
forall e. Data e => TypedBinding' e -> DataType
forall e. Data e => TypedBinding' e -> Constr
forall e.
Data e =>
(forall b. Data b => b -> b) -> TypedBinding' e -> TypedBinding' e
forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> TypedBinding' e -> u
forall e u.
Data e =>
(forall d. Data d => d -> u) -> TypedBinding' e -> [u]
forall e r r'.
Data e =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding' e -> r
forall e r r'.
Data e =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding' e -> r
forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d)
-> TypedBinding' e -> m (TypedBinding' e)
forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> TypedBinding' e -> m (TypedBinding' e)
forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TypedBinding' e)
forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypedBinding' e -> c (TypedBinding' e)
forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (TypedBinding' e))
forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (TypedBinding' 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) -> TypedBinding' e -> u
forall u. (forall d. Data d => d -> u) -> TypedBinding' e -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding' e -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding' e -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> TypedBinding' e -> m (TypedBinding' e)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TypedBinding' e -> m (TypedBinding' e)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TypedBinding' e)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypedBinding' e -> c (TypedBinding' e)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (TypedBinding' e))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (TypedBinding' e))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TypedBinding' e -> m (TypedBinding' e)
$cgmapMo :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> TypedBinding' e -> m (TypedBinding' e)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TypedBinding' e -> m (TypedBinding' e)
$cgmapMp :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> TypedBinding' e -> m (TypedBinding' e)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> TypedBinding' e -> m (TypedBinding' e)
$cgmapM :: forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d)
-> TypedBinding' e -> m (TypedBinding' e)
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> TypedBinding' e -> u
$cgmapQi :: forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> TypedBinding' e -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> TypedBinding' e -> [u]
$cgmapQ :: forall e u.
Data e =>
(forall d. Data d => d -> u) -> TypedBinding' e -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding' e -> r
$cgmapQr :: forall e r r'.
Data e =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding' e -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding' e -> r
$cgmapQl :: forall e r r'.
Data e =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypedBinding' e -> r
gmapT :: (forall b. Data b => b -> b) -> TypedBinding' e -> TypedBinding' e
$cgmapT :: forall e.
Data e =>
(forall b. Data b => b -> b) -> TypedBinding' e -> TypedBinding' e
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (TypedBinding' e))
$cdataCast2 :: forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (TypedBinding' e))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (TypedBinding' e))
$cdataCast1 :: forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (TypedBinding' e))
dataTypeOf :: TypedBinding' e -> DataType
$cdataTypeOf :: forall e. Data e => TypedBinding' e -> DataType
toConstr :: TypedBinding' e -> Constr
$ctoConstr :: forall e. Data e => TypedBinding' e -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TypedBinding' e)
$cgunfold :: forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TypedBinding' e)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypedBinding' e -> c (TypedBinding' e)
$cgfoldl :: forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypedBinding' e -> c (TypedBinding' e)
Data, (forall a b. (a -> b) -> TypedBinding' a -> TypedBinding' b)
-> (forall a b. a -> TypedBinding' b -> TypedBinding' a)
-> Functor TypedBinding'
forall a b. a -> TypedBinding' b -> TypedBinding' a
forall a b. (a -> b) -> TypedBinding' a -> TypedBinding' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> TypedBinding' b -> TypedBinding' a
$c<$ :: forall a b. a -> TypedBinding' b -> TypedBinding' a
fmap :: forall a b. (a -> b) -> TypedBinding' a -> TypedBinding' b
$cfmap :: forall a b. (a -> b) -> TypedBinding' a -> TypedBinding' b
Functor, (forall m. Monoid m => TypedBinding' m -> m)
-> (forall m a. Monoid m => (a -> m) -> TypedBinding' a -> m)
-> (forall m a. Monoid m => (a -> m) -> TypedBinding' a -> m)
-> (forall a b. (a -> b -> b) -> b -> TypedBinding' a -> b)
-> (forall a b. (a -> b -> b) -> b -> TypedBinding' a -> b)
-> (forall b a. (b -> a -> b) -> b -> TypedBinding' a -> b)
-> (forall b a. (b -> a -> b) -> b -> TypedBinding' a -> b)
-> (forall a. (a -> a -> a) -> TypedBinding' a -> a)
-> (forall a. (a -> a -> a) -> TypedBinding' a -> a)
-> (forall a. TypedBinding' a -> [a])
-> (forall a. TypedBinding' a -> Bool)
-> (forall a. TypedBinding' a -> Int)
-> (forall a. Eq a => a -> TypedBinding' a -> Bool)
-> (forall a. Ord a => TypedBinding' a -> a)
-> (forall a. Ord a => TypedBinding' a -> a)
-> (forall a. Num a => TypedBinding' a -> a)
-> (forall a. Num a => TypedBinding' a -> a)
-> Foldable TypedBinding'
forall a. Eq a => a -> TypedBinding' a -> Bool
forall a. Num a => TypedBinding' a -> a
forall a. Ord a => TypedBinding' a -> a
forall m. Monoid m => TypedBinding' m -> m
forall a. TypedBinding' a -> Bool
forall a. TypedBinding' a -> Int
forall a. TypedBinding' a -> [a]
forall a. (a -> a -> a) -> TypedBinding' a -> a
forall m a. Monoid m => (a -> m) -> TypedBinding' a -> m
forall b a. (b -> a -> b) -> b -> TypedBinding' a -> b
forall a b. (a -> b -> b) -> b -> TypedBinding' 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 :: forall a. Num a => TypedBinding' a -> a
$cproduct :: forall a. Num a => TypedBinding' a -> a
sum :: forall a. Num a => TypedBinding' a -> a
$csum :: forall a. Num a => TypedBinding' a -> a
minimum :: forall a. Ord a => TypedBinding' a -> a
$cminimum :: forall a. Ord a => TypedBinding' a -> a
maximum :: forall a. Ord a => TypedBinding' a -> a
$cmaximum :: forall a. Ord a => TypedBinding' a -> a
elem :: forall a. Eq a => a -> TypedBinding' a -> Bool
$celem :: forall a. Eq a => a -> TypedBinding' a -> Bool
length :: forall a. TypedBinding' a -> Int
$clength :: forall a. TypedBinding' a -> Int
null :: forall a. TypedBinding' a -> Bool
$cnull :: forall a. TypedBinding' a -> Bool
toList :: forall a. TypedBinding' a -> [a]
$ctoList :: forall a. TypedBinding' a -> [a]
foldl1 :: forall a. (a -> a -> a) -> TypedBinding' a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> TypedBinding' a -> a
foldr1 :: forall a. (a -> a -> a) -> TypedBinding' a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> TypedBinding' a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> TypedBinding' a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> TypedBinding' a -> b
foldl :: forall b a. (b -> a -> b) -> b -> TypedBinding' a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> TypedBinding' a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> TypedBinding' a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> TypedBinding' a -> b
foldr :: forall a b. (a -> b -> b) -> b -> TypedBinding' a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> TypedBinding' a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> TypedBinding' a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> TypedBinding' a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> TypedBinding' a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> TypedBinding' a -> m
fold :: forall m. Monoid m => TypedBinding' m -> m
$cfold :: forall m. Monoid m => TypedBinding' m -> m
Foldable, Functor TypedBinding'
Foldable TypedBinding'
Functor TypedBinding'
-> Foldable TypedBinding'
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> TypedBinding' a -> f (TypedBinding' b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    TypedBinding' (f a) -> f (TypedBinding' a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> TypedBinding' a -> m (TypedBinding' b))
-> (forall (m :: * -> *) a.
    Monad m =>
    TypedBinding' (m a) -> m (TypedBinding' a))
-> Traversable TypedBinding'
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 =>
TypedBinding' (m a) -> m (TypedBinding' a)
forall (f :: * -> *) a.
Applicative f =>
TypedBinding' (f a) -> f (TypedBinding' a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> TypedBinding' a -> m (TypedBinding' b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TypedBinding' a -> f (TypedBinding' b)
sequence :: forall (m :: * -> *) a.
Monad m =>
TypedBinding' (m a) -> m (TypedBinding' a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
TypedBinding' (m a) -> m (TypedBinding' a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> TypedBinding' a -> m (TypedBinding' b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> TypedBinding' a -> m (TypedBinding' b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
TypedBinding' (f a) -> f (TypedBinding' a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
TypedBinding' (f a) -> f (TypedBinding' a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TypedBinding' a -> f (TypedBinding' b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TypedBinding' a -> f (TypedBinding' b)
Traversable, TypedBinding' e -> TypedBinding' e -> Bool
(TypedBinding' e -> TypedBinding' e -> Bool)
-> (TypedBinding' e -> TypedBinding' e -> Bool)
-> Eq (TypedBinding' e)
forall e. Eq e => TypedBinding' e -> TypedBinding' e -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypedBinding' e -> TypedBinding' e -> Bool
$c/= :: forall e. Eq e => TypedBinding' e -> TypedBinding' e -> Bool
== :: TypedBinding' e -> TypedBinding' e -> Bool
$c== :: forall e. Eq e => TypedBinding' e -> TypedBinding' e -> Bool
Eq)

-- | A telescope is a sequence of typed bindings. Bound variables are in scope
--   in later types.
type Telescope1 = List1 TypedBinding
type Telescope  = [TypedBinding]

-- | We can try to get a @Telescope@ from a @[LamBinding]@.
--   If we have a type annotation already, we're happy.
--   Otherwise we manufacture a binder with an underscore for the type.
lamBindingsToTelescope :: Range -> [LamBinding] -> Telescope
lamBindingsToTelescope :: Range -> [LamBinding] -> Telescope
lamBindingsToTelescope Range
r = (LamBinding -> TypedBinding) -> [LamBinding] -> Telescope
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((LamBinding -> TypedBinding) -> [LamBinding] -> Telescope)
-> (LamBinding -> TypedBinding) -> [LamBinding] -> Telescope
forall a b. (a -> b) -> a -> b
$ \case
  DomainFull TypedBinding
ty -> TypedBinding
ty
  DomainFree NamedArg Binder
nm -> Range -> List1 (NamedArg Binder) -> Expr -> TypedBinding
forall e. Range -> List1 (NamedArg Binder) -> e -> TypedBinding' e
TBind Range
r (NamedArg Binder -> List1 (NamedArg Binder)
forall a. a -> NonEmpty a
List1.singleton NamedArg Binder
nm) (Expr -> TypedBinding) -> Expr -> TypedBinding
forall a b. (a -> b) -> a -> b
$ Range -> Maybe String -> Expr
Underscore Range
r Maybe String
forall a. Maybe a
Nothing

-- | Smart constructor for @Pi@: check whether the @Telescope@ is empty

makePi :: Telescope -> Expr -> Expr
makePi :: Telescope -> Expr -> Expr
makePi []     = Expr -> Expr
forall a. a -> a
id
makePi (TypedBinding
b:Telescope
bs) = Telescope1 -> Expr -> Expr
Pi (TypedBinding
b TypedBinding -> Telescope -> Telescope1
forall a. a -> [a] -> NonEmpty a
:| Telescope
bs)

-- | Smart constructor for @Lam@: check for non-zero bindings.

mkLam :: Range -> [LamBinding] -> Expr -> Expr
mkLam :: Range -> [LamBinding] -> Expr -> Expr
mkLam Range
r []     Expr
e = Expr
e
mkLam Range
r (LamBinding
x:[LamBinding]
xs) Expr
e = Range -> List1 LamBinding -> Expr -> Expr
Lam Range
r (LamBinding
x LamBinding -> [LamBinding] -> List1 LamBinding
forall a. a -> [a] -> NonEmpty a
:| [LamBinding]
xs) Expr
e

-- | Smart constructor for @Let@: check for non-zero let bindings.

mkLet :: Range -> [Declaration] -> Expr -> Expr
mkLet :: Range -> [Declaration] -> Expr -> Expr
mkLet Range
r []     Expr
e = Expr
e
mkLet Range
r (Declaration
d:[Declaration]
ds) Expr
e = Range -> List1 Declaration -> Maybe Expr -> Expr
Let Range
r (Declaration
d Declaration -> [Declaration] -> List1 Declaration
forall a. a -> [a] -> NonEmpty a
:| [Declaration]
ds) (Expr -> Maybe Expr
forall a. a -> Maybe a
Just Expr
e)

-- | Smart constructor for @TLet@: check for non-zero let bindings.

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

{-| Left hand sides can be written in infix style. For example:

    > n + suc m = suc (n + m)
    > (f ∘ g) x = f (g x)

   We use fixity information to see which name is actually defined.
-}
data LHS = LHS  -- ^ Original pattern (including with-patterns), rewrite equations and with-expressions.
  { LHS -> Pattern
lhsOriginalPattern :: Pattern
    -- ^ e.g. @f ps | wps@
  , LHS -> [RewriteEqn]
lhsRewriteEqn      :: [RewriteEqn]
    -- ^ @(rewrite e | with p <- e in eq)@ (many)
  , LHS -> [WithExpr]
lhsWithExpr        :: [WithExpr]
    -- ^ @with e1 in eq | {e2} | ...@ (many)
  }
  deriving (Typeable LHS
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 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)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
Monad m =>
(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 :: forall u. Int -> (forall d. Data d => d -> u) -> LHS -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LHS -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> LHS -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LHS -> [u]
gmapQr :: forall r r'.
(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 :: forall r r'.
(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 (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(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 (t :: * -> *) (c :: * -> *).
Typeable t =>
(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 (c :: * -> *).
(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 (c :: * -> *).
(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
Data, LHS -> LHS -> Bool
(LHS -> LHS -> Bool) -> (LHS -> LHS -> Bool) -> Eq LHS
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LHS -> LHS -> Bool
$c/= :: LHS -> LHS -> Bool
== :: LHS -> LHS -> Bool
$c== :: LHS -> LHS -> Bool
Eq)

type RewriteEqn = RewriteEqn' () Name Pattern Expr
type WithExpr   = Named Name (Arg Expr)

-- | Processed (operator-parsed) intermediate form of the core @f ps@ of 'LHS'.
--   Corresponds to 'lhsOriginalPattern'.
data LHSCore
  = LHSHead  { LHSCore -> QName
lhsDefName      :: QName               -- ^ @f@
             , LHSCore -> [NamedArg Pattern]
lhsPats         :: [NamedArg Pattern]  -- ^ @ps@
             }
  | LHSProj  { LHSCore -> QName
lhsDestructor   :: QName               -- ^ Record projection.
             , LHSCore -> [NamedArg Pattern]
lhsPatsLeft     :: [NamedArg Pattern]  -- ^ Patterns for record indices (currently none).
             , LHSCore -> NamedArg LHSCore
lhsFocus        :: NamedArg LHSCore    -- ^ Main argument.
             , lhsPats         :: [NamedArg Pattern]  -- ^ More application patterns.
             }
  | LHSWith  { LHSCore -> LHSCore
lhsHead         :: LHSCore
             , LHSCore -> [Pattern]
lhsWithPatterns :: [Pattern]          -- ^ Non-empty; at least one @(| p)@.
             , lhsPats         :: [NamedArg Pattern] -- ^ More application patterns.
             }
  | LHSEllipsis
             { LHSCore -> Range
lhsEllipsisRange :: Range
             , LHSCore -> LHSCore
lhsEllipsisPat   :: LHSCore           -- ^ Pattern that was expanded from an ellipsis @...@.
             }
  deriving (Typeable LHSCore
Typeable LHSCore
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LHSCore -> c LHSCore)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LHSCore)
-> (LHSCore -> Constr)
-> (LHSCore -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LHSCore))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LHSCore))
-> ((forall b. Data b => b -> b) -> LHSCore -> LHSCore)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LHSCore -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LHSCore -> r)
-> (forall u. (forall d. Data d => d -> u) -> LHSCore -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> LHSCore -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> LHSCore -> m LHSCore)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LHSCore -> m LHSCore)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LHSCore -> m LHSCore)
-> Data LHSCore
LHSCore -> DataType
LHSCore -> Constr
(forall b. Data b => b -> b) -> LHSCore -> LHSCore
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 -> u
forall u. (forall d. Data d => d -> u) -> LHSCore -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LHSCore -> m LHSCore
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LHSCore -> m LHSCore
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LHSCore
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHSCore -> c LHSCore
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LHSCore)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LHSCore)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LHSCore -> m LHSCore
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LHSCore -> m LHSCore
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LHSCore -> m LHSCore
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LHSCore -> m LHSCore
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LHSCore -> m LHSCore
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LHSCore -> m LHSCore
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LHSCore -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LHSCore -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> LHSCore -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LHSCore -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LHSCore -> r
gmapT :: (forall b. Data b => b -> b) -> LHSCore -> LHSCore
$cgmapT :: (forall b. Data b => b -> b) -> LHSCore -> LHSCore
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LHSCore)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LHSCore)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LHSCore)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LHSCore)
dataTypeOf :: LHSCore -> DataType
$cdataTypeOf :: LHSCore -> DataType
toConstr :: LHSCore -> Constr
$ctoConstr :: LHSCore -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LHSCore
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LHSCore
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHSCore -> c LHSCore
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LHSCore -> c LHSCore
Data, LHSCore -> LHSCore -> Bool
(LHSCore -> LHSCore -> Bool)
-> (LHSCore -> LHSCore -> Bool) -> Eq LHSCore
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LHSCore -> LHSCore -> Bool
$c/= :: LHSCore -> LHSCore -> Bool
== :: LHSCore -> LHSCore -> Bool
$c== :: LHSCore -> LHSCore -> Bool
Eq)

type RHS = RHS' Expr
data RHS' e
  = AbsurdRHS -- ^ No right hand side because of absurd match.
  | RHS e
  deriving (Typeable (RHS' e)
Typeable (RHS' e)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> RHS' e -> c (RHS' e))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (RHS' e))
-> (RHS' e -> Constr)
-> (RHS' e -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (RHS' e)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (RHS' e)))
-> ((forall b. Data b => b -> b) -> RHS' e -> RHS' e)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> RHS' e -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> RHS' e -> r)
-> (forall u. (forall d. Data d => d -> u) -> RHS' e -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> RHS' e -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e))
-> Data (RHS' e)
RHS' e -> DataType
RHS' e -> Constr
(forall b. Data b => b -> b) -> RHS' e -> RHS' e
forall {e}. Data e => Typeable (RHS' e)
forall e. Data e => RHS' e -> DataType
forall e. Data e => RHS' e -> Constr
forall e.
Data e =>
(forall b. Data b => b -> b) -> RHS' e -> RHS' e
forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> RHS' e -> u
forall e u. Data e => (forall d. Data d => d -> u) -> RHS' e -> [u]
forall e r r'.
Data e =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RHS' e -> r
forall e r r'.
Data e =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RHS' e -> r
forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e)
forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e)
forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RHS' e)
forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RHS' e -> c (RHS' e)
forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (RHS' e))
forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (RHS' 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) -> RHS' e -> u
forall u. (forall d. Data d => d -> u) -> RHS' e -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RHS' e -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RHS' e -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RHS' e)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RHS' e -> c (RHS' e)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (RHS' e))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (RHS' e))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e)
$cgmapMo :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e)
$cgmapMp :: forall e (m :: * -> *).
(Data e, MonadPlus m) =>
(forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e)
$cgmapM :: forall e (m :: * -> *).
(Data e, Monad m) =>
(forall d. Data d => d -> m d) -> RHS' e -> m (RHS' e)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> RHS' e -> u
$cgmapQi :: forall e u.
Data e =>
Int -> (forall d. Data d => d -> u) -> RHS' e -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> RHS' e -> [u]
$cgmapQ :: forall e u. Data e => (forall d. Data d => d -> u) -> RHS' e -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RHS' e -> r
$cgmapQr :: forall e r r'.
Data e =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RHS' e -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RHS' e -> r
$cgmapQl :: forall e r r'.
Data e =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RHS' e -> r
gmapT :: (forall b. Data b => b -> b) -> RHS' e -> RHS' e
$cgmapT :: forall e.
Data e =>
(forall b. Data b => b -> b) -> RHS' e -> RHS' e
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (RHS' e))
$cdataCast2 :: forall e (t :: * -> * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (RHS' e))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (RHS' e))
$cdataCast1 :: forall e (t :: * -> *) (c :: * -> *).
(Data e, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (RHS' e))
dataTypeOf :: RHS' e -> DataType
$cdataTypeOf :: forall e. Data e => RHS' e -> DataType
toConstr :: RHS' e -> Constr
$ctoConstr :: forall e. Data e => RHS' e -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RHS' e)
$cgunfold :: forall e (c :: * -> *).
Data e =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RHS' e)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RHS' e -> c (RHS' e)
$cgfoldl :: forall e (c :: * -> *).
Data e =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RHS' e -> c (RHS' e)
Data, (forall a b. (a -> b) -> RHS' a -> RHS' b)
-> (forall a b. a -> RHS' b -> RHS' a) -> Functor RHS'
forall a b. a -> RHS' b -> RHS' a
forall a b. (a -> b) -> RHS' a -> RHS' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> RHS' b -> RHS' a
$c<$ :: forall a b. a -> RHS' b -> RHS' a
fmap :: forall a b. (a -> b) -> RHS' a -> RHS' b
$cfmap :: forall a b. (a -> b) -> RHS' a -> RHS' b
Functor, (forall m. Monoid m => RHS' m -> m)
-> (forall m a. Monoid m => (a -> m) -> RHS' a -> m)
-> (forall m a. Monoid m => (a -> m) -> RHS' a -> m)
-> (forall a b. (a -> b -> b) -> b -> RHS' a -> b)
-> (forall a b. (a -> b -> b) -> b -> RHS' a -> b)
-> (forall b a. (b -> a -> b) -> b -> RHS' a -> b)
-> (forall b a. (b -> a -> b) -> b -> RHS' a -> b)
-> (forall a. (a -> a -> a) -> RHS' a -> a)
-> (forall a. (a -> a -> a) -> RHS' a -> a)
-> (forall a. RHS' a -> [a])
-> (forall a. RHS' a -> Bool)
-> (forall a. RHS' a -> Int)
-> (forall a. Eq a => a -> RHS' a -> Bool)
-> (forall a. Ord a => RHS' a -> a)
-> (forall a. Ord a => RHS' a -> a)
-> (forall a. Num a => RHS' a -> a)
-> (forall a. Num a => RHS' a -> a)
-> Foldable RHS'
forall a. Eq a => a -> RHS' a -> Bool
forall a. Num a => RHS' a -> a
forall a. Ord a => RHS' a -> a
forall m. Monoid m => RHS' m -> m
forall a. RHS' a -> Bool
forall a. RHS' a -> Int
forall a. RHS' a -> [a]
forall a. (a -> a -> a) -> RHS' a -> a
forall m a. Monoid m => (a -> m) -> RHS' a -> m
forall b a. (b -> a -> b) -> b -> RHS' a -> b
forall a b. (a -> b -> b) -> b -> RHS' 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 :: forall a. Num a => RHS' a -> a
$cproduct :: forall a. Num a => RHS' a -> a
sum :: forall a. Num a => RHS' a -> a
$csum :: forall a. Num a => RHS' a -> a
minimum :: forall a. Ord a => RHS' a -> a
$cminimum :: forall a. Ord a => RHS' a -> a
maximum :: forall a. Ord a => RHS' a -> a
$cmaximum :: forall a. Ord a => RHS' a -> a
elem :: forall a. Eq a => a -> RHS' a -> Bool
$celem :: forall a. Eq a => a -> RHS' a -> Bool
length :: forall a. RHS' a -> Int
$clength :: forall a. RHS' a -> Int
null :: forall a. RHS' a -> Bool
$cnull :: forall a. RHS' a -> Bool
toList :: forall a. RHS' a -> [a]
$ctoList :: forall a. RHS' a -> [a]
foldl1 :: forall a. (a -> a -> a) -> RHS' a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> RHS' a -> a
foldr1 :: forall a. (a -> a -> a) -> RHS' a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> RHS' a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> RHS' a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> RHS' a -> b
foldl :: forall b a. (b -> a -> b) -> b -> RHS' a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> RHS' a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> RHS' a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> RHS' a -> b
foldr :: forall a b. (a -> b -> b) -> b -> RHS' a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> RHS' a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> RHS' a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> RHS' a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> RHS' a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> RHS' a -> m
fold :: forall m. Monoid m => RHS' m -> m
$cfold :: forall m. Monoid m => RHS' m -> m
Foldable, Functor RHS'
Foldable RHS'
Functor RHS'
-> Foldable RHS'
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> RHS' a -> f (RHS' b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    RHS' (f a) -> f (RHS' a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> RHS' a -> m (RHS' b))
-> (forall (m :: * -> *) a. Monad m => RHS' (m a) -> m (RHS' a))
-> Traversable RHS'
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 => RHS' (m a) -> m (RHS' a)
forall (f :: * -> *) a. Applicative f => RHS' (f a) -> f (RHS' a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> RHS' a -> m (RHS' b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> RHS' a -> f (RHS' b)
sequence :: forall (m :: * -> *) a. Monad m => RHS' (m a) -> m (RHS' a)
$csequence :: forall (m :: * -> *) a. Monad m => RHS' (m a) -> m (RHS' a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> RHS' a -> m (RHS' b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> RHS' a -> m (RHS' b)
sequenceA :: forall (f :: * -> *) a. Applicative f => RHS' (f a) -> f (RHS' a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => RHS' (f a) -> f (RHS' a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> RHS' a -> f (RHS' b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> RHS' a -> f (RHS' b)
Traversable, RHS' e -> RHS' e -> Bool
(RHS' e -> RHS' e -> Bool)
-> (RHS' e -> RHS' e -> Bool) -> Eq (RHS' e)
forall e. Eq e => RHS' e -> RHS' e -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RHS' e -> RHS' e -> Bool
$c/= :: forall e. Eq e => RHS' e -> RHS' e -> Bool
== :: RHS' e -> RHS' e -> Bool
$c== :: forall e. Eq e => RHS' e -> RHS' e -> Bool
Eq)

-- | @where@ block following a clause.
type WhereClause = WhereClause' [Declaration]

-- The generalization @WhereClause'@ is for the sake of Concrete.Generic.
data WhereClause' decls
  = NoWhere
      -- ^ No @where@ clauses.
  | AnyWhere Range decls
      -- ^ Ordinary @where@.  'Range' of the @where@ keyword.
      --   List of declarations can be empty.
  | SomeWhere Range Name Access decls
      -- ^ Named where: @module M where ds@.
      --   'Range' of the keywords @module@ and @where@.
      --   The 'Access' flag applies to the 'Name' (not the module contents!)
      --   and is propagated from the parent function.
      --   List of declarations can be empty.
  deriving (Typeable (WhereClause' decls)
Typeable (WhereClause' decls)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> WhereClause' decls
    -> c (WhereClause' decls))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (WhereClause' decls))
-> (WhereClause' decls -> Constr)
-> (WhereClause' decls -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (WhereClause' decls)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (WhereClause' decls)))
-> ((forall b. Data b => b -> b)
    -> WhereClause' decls -> WhereClause' decls)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> WhereClause' decls -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> WhereClause' decls -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> WhereClause' decls -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> WhereClause' decls -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> WhereClause' decls -> m (WhereClause' decls))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WhereClause' decls -> m (WhereClause' decls))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WhereClause' decls -> m (WhereClause' decls))
-> Data (WhereClause' decls)
WhereClause' decls -> DataType
WhereClause' decls -> Constr
(forall b. Data b => b -> b)
-> WhereClause' decls -> WhereClause' decls
forall {decls}. Data decls => Typeable (WhereClause' decls)
forall decls. Data decls => WhereClause' decls -> DataType
forall decls. Data decls => WhereClause' decls -> Constr
forall decls.
Data decls =>
(forall b. Data b => b -> b)
-> WhereClause' decls -> WhereClause' decls
forall decls u.
Data decls =>
Int -> (forall d. Data d => d -> u) -> WhereClause' decls -> u
forall decls u.
Data decls =>
(forall d. Data d => d -> u) -> WhereClause' decls -> [u]
forall decls r r'.
Data decls =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereClause' decls -> r
forall decls r r'.
Data decls =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereClause' decls -> r
forall decls (m :: * -> *).
(Data decls, Monad m) =>
(forall d. Data d => d -> m d)
-> WhereClause' decls -> m (WhereClause' decls)
forall decls (m :: * -> *).
(Data decls, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> WhereClause' decls -> m (WhereClause' decls)
forall decls (c :: * -> *).
Data decls =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WhereClause' decls)
forall decls (c :: * -> *).
Data decls =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> WhereClause' decls
-> c (WhereClause' decls)
forall decls (t :: * -> *) (c :: * -> *).
(Data decls, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (WhereClause' decls))
forall decls (t :: * -> * -> *) (c :: * -> *).
(Data decls, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WhereClause' decls))
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) -> WhereClause' decls -> u
forall u. (forall d. Data d => d -> u) -> WhereClause' decls -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereClause' decls -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereClause' decls -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> WhereClause' decls -> m (WhereClause' decls)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WhereClause' decls -> m (WhereClause' decls)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WhereClause' decls)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> WhereClause' decls
-> c (WhereClause' decls)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (WhereClause' decls))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WhereClause' decls))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WhereClause' decls -> m (WhereClause' decls)
$cgmapMo :: forall decls (m :: * -> *).
(Data decls, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> WhereClause' decls -> m (WhereClause' decls)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WhereClause' decls -> m (WhereClause' decls)
$cgmapMp :: forall decls (m :: * -> *).
(Data decls, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> WhereClause' decls -> m (WhereClause' decls)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> WhereClause' decls -> m (WhereClause' decls)
$cgmapM :: forall decls (m :: * -> *).
(Data decls, Monad m) =>
(forall d. Data d => d -> m d)
-> WhereClause' decls -> m (WhereClause' decls)
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> WhereClause' decls -> u
$cgmapQi :: forall decls u.
Data decls =>
Int -> (forall d. Data d => d -> u) -> WhereClause' decls -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> WhereClause' decls -> [u]
$cgmapQ :: forall decls u.
Data decls =>
(forall d. Data d => d -> u) -> WhereClause' decls -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereClause' decls -> r
$cgmapQr :: forall decls r r'.
Data decls =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereClause' decls -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereClause' decls -> r
$cgmapQl :: forall decls r r'.
Data decls =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereClause' decls -> r
gmapT :: (forall b. Data b => b -> b)
-> WhereClause' decls -> WhereClause' decls
$cgmapT :: forall decls.
Data decls =>
(forall b. Data b => b -> b)
-> WhereClause' decls -> WhereClause' decls
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WhereClause' decls))
$cdataCast2 :: forall decls (t :: * -> * -> *) (c :: * -> *).
(Data decls, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WhereClause' decls))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (WhereClause' decls))
$cdataCast1 :: forall decls (t :: * -> *) (c :: * -> *).
(Data decls, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (WhereClause' decls))
dataTypeOf :: WhereClause' decls -> DataType
$cdataTypeOf :: forall decls. Data decls => WhereClause' decls -> DataType
toConstr :: WhereClause' decls -> Constr
$ctoConstr :: forall decls. Data decls => WhereClause' decls -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WhereClause' decls)
$cgunfold :: forall decls (c :: * -> *).
Data decls =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WhereClause' decls)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> WhereClause' decls
-> c (WhereClause' decls)
$cgfoldl :: forall decls (c :: * -> *).
Data decls =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> WhereClause' decls
-> c (WhereClause' decls)
Data, WhereClause' decls -> WhereClause' decls -> Bool
(WhereClause' decls -> WhereClause' decls -> Bool)
-> (WhereClause' decls -> WhereClause' decls -> Bool)
-> Eq (WhereClause' decls)
forall decls.
Eq decls =>
WhereClause' decls -> WhereClause' decls -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WhereClause' decls -> WhereClause' decls -> Bool
$c/= :: forall decls.
Eq decls =>
WhereClause' decls -> WhereClause' decls -> Bool
== :: WhereClause' decls -> WhereClause' decls -> Bool
$c== :: forall decls.
Eq decls =>
WhereClause' decls -> WhereClause' decls -> Bool
Eq, (forall a b. (a -> b) -> WhereClause' a -> WhereClause' b)
-> (forall a b. a -> WhereClause' b -> WhereClause' a)
-> Functor WhereClause'
forall a b. a -> WhereClause' b -> WhereClause' a
forall a b. (a -> b) -> WhereClause' a -> WhereClause' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> WhereClause' b -> WhereClause' a
$c<$ :: forall a b. a -> WhereClause' b -> WhereClause' a
fmap :: forall a b. (a -> b) -> WhereClause' a -> WhereClause' b
$cfmap :: forall a b. (a -> b) -> WhereClause' a -> WhereClause' b
Functor, (forall m. Monoid m => WhereClause' m -> m)
-> (forall m a. Monoid m => (a -> m) -> WhereClause' a -> m)
-> (forall m a. Monoid m => (a -> m) -> WhereClause' a -> m)
-> (forall a b. (a -> b -> b) -> b -> WhereClause' a -> b)
-> (forall a b. (a -> b -> b) -> b -> WhereClause' a -> b)
-> (forall b a. (b -> a -> b) -> b -> WhereClause' a -> b)
-> (forall b a. (b -> a -> b) -> b -> WhereClause' a -> b)
-> (forall a. (a -> a -> a) -> WhereClause' a -> a)
-> (forall a. (a -> a -> a) -> WhereClause' a -> a)
-> (forall a. WhereClause' a -> [a])
-> (forall a. WhereClause' a -> Bool)
-> (forall a. WhereClause' a -> Int)
-> (forall a. Eq a => a -> WhereClause' a -> Bool)
-> (forall a. Ord a => WhereClause' a -> a)
-> (forall a. Ord a => WhereClause' a -> a)
-> (forall a. Num a => WhereClause' a -> a)
-> (forall a. Num a => WhereClause' a -> a)
-> Foldable WhereClause'
forall a. Eq a => a -> WhereClause' a -> Bool
forall a. Num a => WhereClause' a -> a
forall a. Ord a => WhereClause' a -> a
forall m. Monoid m => WhereClause' m -> m
forall a. WhereClause' a -> Bool
forall a. WhereClause' a -> Int
forall a. WhereClause' a -> [a]
forall a. (a -> a -> a) -> WhereClause' a -> a
forall m a. Monoid m => (a -> m) -> WhereClause' a -> m
forall b a. (b -> a -> b) -> b -> WhereClause' a -> b
forall a b. (a -> b -> b) -> b -> WhereClause' 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 :: forall a. Num a => WhereClause' a -> a
$cproduct :: forall a. Num a => WhereClause' a -> a
sum :: forall a. Num a => WhereClause' a -> a
$csum :: forall a. Num a => WhereClause' a -> a
minimum :: forall a. Ord a => WhereClause' a -> a
$cminimum :: forall a. Ord a => WhereClause' a -> a
maximum :: forall a. Ord a => WhereClause' a -> a
$cmaximum :: forall a. Ord a => WhereClause' a -> a
elem :: forall a. Eq a => a -> WhereClause' a -> Bool
$celem :: forall a. Eq a => a -> WhereClause' a -> Bool
length :: forall a. WhereClause' a -> Int
$clength :: forall a. WhereClause' a -> Int
null :: forall a. WhereClause' a -> Bool
$cnull :: forall a. WhereClause' a -> Bool
toList :: forall a. WhereClause' a -> [a]
$ctoList :: forall a. WhereClause' a -> [a]
foldl1 :: forall a. (a -> a -> a) -> WhereClause' a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> WhereClause' a -> a
foldr1 :: forall a. (a -> a -> a) -> WhereClause' a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> WhereClause' a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> WhereClause' a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> WhereClause' a -> b
foldl :: forall b a. (b -> a -> b) -> b -> WhereClause' a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> WhereClause' a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> WhereClause' a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> WhereClause' a -> b
foldr :: forall a b. (a -> b -> b) -> b -> WhereClause' a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> WhereClause' a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> WhereClause' a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> WhereClause' a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> WhereClause' a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> WhereClause' a -> m
fold :: forall m. Monoid m => WhereClause' m -> m
$cfold :: forall m. Monoid m => WhereClause' m -> m
Foldable, Functor WhereClause'
Foldable WhereClause'
Functor WhereClause'
-> Foldable WhereClause'
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> WhereClause' a -> f (WhereClause' b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    WhereClause' (f a) -> f (WhereClause' a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> WhereClause' a -> m (WhereClause' b))
-> (forall (m :: * -> *) a.
    Monad m =>
    WhereClause' (m a) -> m (WhereClause' a))
-> Traversable WhereClause'
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 =>
WhereClause' (m a) -> m (WhereClause' a)
forall (f :: * -> *) a.
Applicative f =>
WhereClause' (f a) -> f (WhereClause' a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WhereClause' a -> m (WhereClause' b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WhereClause' a -> f (WhereClause' b)
sequence :: forall (m :: * -> *) a.
Monad m =>
WhereClause' (m a) -> m (WhereClause' a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
WhereClause' (m a) -> m (WhereClause' a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WhereClause' a -> m (WhereClause' b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WhereClause' a -> m (WhereClause' b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
WhereClause' (f a) -> f (WhereClause' a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
WhereClause' (f a) -> f (WhereClause' a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WhereClause' a -> f (WhereClause' b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WhereClause' a -> f (WhereClause' b)
Traversable)

data LamClause = LamClause
  { LamClause -> [Pattern]
lamLHS      :: [Pattern]   -- ^ Possibly empty sequence.
  , LamClause -> RHS
lamRHS      :: RHS
  , LamClause -> Bool
lamCatchAll :: Bool
  }
  deriving (Typeable LamClause
Typeable LamClause
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LamClause -> c LamClause)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LamClause)
-> (LamClause -> Constr)
-> (LamClause -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LamClause))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LamClause))
-> ((forall b. Data b => b -> b) -> LamClause -> LamClause)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LamClause -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LamClause -> r)
-> (forall u. (forall d. Data d => d -> u) -> LamClause -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> LamClause -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> LamClause -> m LamClause)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LamClause -> m LamClause)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LamClause -> m LamClause)
-> Data LamClause
LamClause -> DataType
LamClause -> Constr
(forall b. Data b => b -> b) -> LamClause -> LamClause
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) -> LamClause -> u
forall u. (forall d. Data d => d -> u) -> LamClause -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LamClause -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LamClause -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LamClause -> m LamClause
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LamClause -> m LamClause
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LamClause
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamClause -> c LamClause
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LamClause)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LamClause)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LamClause -> m LamClause
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LamClause -> m LamClause
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LamClause -> m LamClause
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LamClause -> m LamClause
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LamClause -> m LamClause
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LamClause -> m LamClause
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LamClause -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LamClause -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> LamClause -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LamClause -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LamClause -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LamClause -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LamClause -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LamClause -> r
gmapT :: (forall b. Data b => b -> b) -> LamClause -> LamClause
$cgmapT :: (forall b. Data b => b -> b) -> LamClause -> LamClause
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LamClause)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LamClause)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LamClause)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LamClause)
dataTypeOf :: LamClause -> DataType
$cdataTypeOf :: LamClause -> DataType
toConstr :: LamClause -> Constr
$ctoConstr :: LamClause -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LamClause
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LamClause
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamClause -> c LamClause
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LamClause -> c LamClause
Data, LamClause -> LamClause -> Bool
(LamClause -> LamClause -> Bool)
-> (LamClause -> LamClause -> Bool) -> Eq LamClause
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LamClause -> LamClause -> Bool
$c/= :: LamClause -> LamClause -> Bool
== :: LamClause -> LamClause -> Bool
$c== :: LamClause -> LamClause -> Bool
Eq)

-- | An expression followed by a where clause.
--   Currently only used to give better a better error message in interaction.
data ExprWhere = ExprWhere Expr WhereClause

-- | The things you are allowed to say when you shuffle names between name
--   spaces (i.e. in @import@, @namespace@, or @open@ declarations).
type ImportDirective = ImportDirective' Name Name
type Using           = Using'           Name Name
type Renaming        = Renaming'        Name Name
type RenamingDirective = RenamingDirective' Name Name
type HidingDirective   = HidingDirective'   Name Name  -- 'Hiding' is already taken

-- | An imported name can be a module or a defined name.
type ImportedName = ImportedName' Name Name

-- | The content of the @as@-clause of the import statement.
data AsName' a = AsName
  { forall a. AsName' a -> a
asName  :: a
    -- ^ The \"as\" name.
  , forall a. AsName' a -> Range
asRange :: Range
    -- ^ The range of the \"as\" keyword.  Retained for highlighting purposes.
  }
  deriving (Typeable (AsName' a)
Typeable (AsName' a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AsName' a -> c (AsName' a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (AsName' a))
-> (AsName' a -> Constr)
-> (AsName' a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (AsName' a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (AsName' a)))
-> ((forall b. Data b => b -> b) -> AsName' a -> AsName' a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> AsName' a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> AsName' a -> r)
-> (forall u. (forall d. Data d => d -> u) -> AsName' a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> AsName' a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a))
-> Data (AsName' a)
AsName' a -> DataType
AsName' a -> Constr
(forall b. Data b => b -> b) -> AsName' a -> AsName' a
forall {a}. Data a => Typeable (AsName' a)
forall a. Data a => AsName' a -> DataType
forall a. Data a => AsName' a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> AsName' a -> AsName' a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> AsName' a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> AsName' a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AsName' a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AsName' a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AsName' a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AsName' a -> c (AsName' a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (AsName' a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AsName' 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) -> AsName' a -> u
forall u. (forall d. Data d => d -> u) -> AsName' a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AsName' a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AsName' a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AsName' a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AsName' a -> c (AsName' a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (AsName' a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AsName' a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> AsName' a -> m (AsName' a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AsName' a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> AsName' a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> AsName' a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> AsName' a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AsName' a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AsName' a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AsName' a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AsName' a -> r
gmapT :: (forall b. Data b => b -> b) -> AsName' a -> AsName' a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> AsName' a -> AsName' a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AsName' a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AsName' a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (AsName' a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (AsName' a))
dataTypeOf :: AsName' a -> DataType
$cdataTypeOf :: forall a. Data a => AsName' a -> DataType
toConstr :: AsName' a -> Constr
$ctoConstr :: forall a. Data a => AsName' a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AsName' a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AsName' a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AsName' a -> c (AsName' a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AsName' a -> c (AsName' a)
Data, Int -> AsName' a -> ShowS
[AsName' a] -> ShowS
AsName' a -> String
(Int -> AsName' a -> ShowS)
-> (AsName' a -> String)
-> ([AsName' a] -> ShowS)
-> Show (AsName' a)
forall a. Show a => Int -> AsName' a -> ShowS
forall a. Show a => [AsName' a] -> ShowS
forall a. Show a => AsName' a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AsName' a] -> ShowS
$cshowList :: forall a. Show a => [AsName' a] -> ShowS
show :: AsName' a -> String
$cshow :: forall a. Show a => AsName' a -> String
showsPrec :: Int -> AsName' a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> AsName' a -> ShowS
Show, (forall a b. (a -> b) -> AsName' a -> AsName' b)
-> (forall a b. a -> AsName' b -> AsName' a) -> Functor AsName'
forall a b. a -> AsName' b -> AsName' a
forall a b. (a -> b) -> AsName' a -> AsName' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> AsName' b -> AsName' a
$c<$ :: forall a b. a -> AsName' b -> AsName' a
fmap :: forall a b. (a -> b) -> AsName' a -> AsName' b
$cfmap :: forall a b. (a -> b) -> AsName' a -> AsName' b
Functor, (forall m. Monoid m => AsName' m -> m)
-> (forall m a. Monoid m => (a -> m) -> AsName' a -> m)
-> (forall m a. Monoid m => (a -> m) -> AsName' a -> m)
-> (forall a b. (a -> b -> b) -> b -> AsName' a -> b)
-> (forall a b. (a -> b -> b) -> b -> AsName' a -> b)
-> (forall b a. (b -> a -> b) -> b -> AsName' a -> b)
-> (forall b a. (b -> a -> b) -> b -> AsName' a -> b)
-> (forall a. (a -> a -> a) -> AsName' a -> a)
-> (forall a. (a -> a -> a) -> AsName' a -> a)
-> (forall a. AsName' a -> [a])
-> (forall a. AsName' a -> Bool)
-> (forall a. AsName' a -> Int)
-> (forall a. Eq a => a -> AsName' a -> Bool)
-> (forall a. Ord a => AsName' a -> a)
-> (forall a. Ord a => AsName' a -> a)
-> (forall a. Num a => AsName' a -> a)
-> (forall a. Num a => AsName' a -> a)
-> Foldable AsName'
forall a. Eq a => a -> AsName' a -> Bool
forall a. Num a => AsName' a -> a
forall a. Ord a => AsName' a -> a
forall m. Monoid m => AsName' m -> m
forall a. AsName' a -> Bool
forall a. AsName' a -> Int
forall a. AsName' a -> [a]
forall a. (a -> a -> a) -> AsName' a -> a
forall m a. Monoid m => (a -> m) -> AsName' a -> m
forall b a. (b -> a -> b) -> b -> AsName' a -> b
forall a b. (a -> b -> b) -> b -> AsName' 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 :: forall a. Num a => AsName' a -> a
$cproduct :: forall a. Num a => AsName' a -> a
sum :: forall a. Num a => AsName' a -> a
$csum :: forall a. Num a => AsName' a -> a
minimum :: forall a. Ord a => AsName' a -> a
$cminimum :: forall a. Ord a => AsName' a -> a
maximum :: forall a. Ord a => AsName' a -> a
$cmaximum :: forall a. Ord a => AsName' a -> a
elem :: forall a. Eq a => a -> AsName' a -> Bool
$celem :: forall a. Eq a => a -> AsName' a -> Bool
length :: forall a. AsName' a -> Int
$clength :: forall a. AsName' a -> Int
null :: forall a. AsName' a -> Bool
$cnull :: forall a. AsName' a -> Bool
toList :: forall a. AsName' a -> [a]
$ctoList :: forall a. AsName' a -> [a]
foldl1 :: forall a. (a -> a -> a) -> AsName' a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> AsName' a -> a
foldr1 :: forall a. (a -> a -> a) -> AsName' a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> AsName' a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> AsName' a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> AsName' a -> b
foldl :: forall b a. (b -> a -> b) -> b -> AsName' a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> AsName' a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> AsName' a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> AsName' a -> b
foldr :: forall a b. (a -> b -> b) -> b -> AsName' a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> AsName' a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> AsName' a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> AsName' a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> AsName' a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> AsName' a -> m
fold :: forall m. Monoid m => AsName' m -> m
$cfold :: forall m. Monoid m => AsName' m -> m
Foldable, Functor AsName'
Foldable AsName'
Functor AsName'
-> Foldable AsName'
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> AsName' a -> f (AsName' b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AsName' (f a) -> f (AsName' a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> AsName' a -> m (AsName' b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AsName' (m a) -> m (AsName' a))
-> Traversable AsName'
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 => AsName' (m a) -> m (AsName' a)
forall (f :: * -> *) a.
Applicative f =>
AsName' (f a) -> f (AsName' a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AsName' a -> m (AsName' b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AsName' a -> f (AsName' b)
sequence :: forall (m :: * -> *) a. Monad m => AsName' (m a) -> m (AsName' a)
$csequence :: forall (m :: * -> *) a. Monad m => AsName' (m a) -> m (AsName' a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AsName' a -> m (AsName' b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AsName' a -> m (AsName' b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
AsName' (f a) -> f (AsName' a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
AsName' (f a) -> f (AsName' a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AsName' a -> f (AsName' b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AsName' a -> f (AsName' b)
Traversable, AsName' a -> AsName' a -> Bool
(AsName' a -> AsName' a -> Bool)
-> (AsName' a -> AsName' a -> Bool) -> Eq (AsName' a)
forall a. Eq a => AsName' a -> AsName' a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AsName' a -> AsName' a -> Bool
$c/= :: forall a. Eq a => AsName' a -> AsName' a -> Bool
== :: AsName' a -> AsName' a -> Bool
$c== :: forall a. Eq a => AsName' a -> AsName' a -> Bool
Eq)

-- | From the parser, we get an expression for the @as@-'Name', which
--   we have to parse into a 'Name'.
type AsName = AsName' (Either Expr Name)

{--------------------------------------------------------------------------
    Declarations
 --------------------------------------------------------------------------}

-- | Just type signatures.
type TypeSignature = Declaration

-- | Just field signatures
type FieldSignature = Declaration

-- | Just type signatures or instance blocks.
type TypeSignatureOrInstanceBlock = Declaration

-- | Isolated record directives parsed as Declarations
data RecordDirective
   = Induction (Ranged Induction)
       -- ^ Range of keyword @[co]inductive@.
   | Constructor Name IsInstance
   | Eta         (Ranged HasEta0)
       -- ^ Range of @[no-]eta-equality@ keyword.
   | PatternOrCopattern Range
       -- ^ If declaration @pattern@ is present, give its range.
   deriving (Typeable RecordDirective
Typeable RecordDirective
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> RecordDirective -> c RecordDirective)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c RecordDirective)
-> (RecordDirective -> Constr)
-> (RecordDirective -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c RecordDirective))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c RecordDirective))
-> ((forall b. Data b => b -> b)
    -> RecordDirective -> RecordDirective)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> RecordDirective -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> RecordDirective -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> RecordDirective -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> RecordDirective -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> RecordDirective -> m RecordDirective)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> RecordDirective -> m RecordDirective)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> RecordDirective -> m RecordDirective)
-> Data RecordDirective
RecordDirective -> DataType
RecordDirective -> Constr
(forall b. Data b => b -> b) -> RecordDirective -> RecordDirective
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) -> RecordDirective -> u
forall u. (forall d. Data d => d -> u) -> RecordDirective -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirective -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirective -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> RecordDirective -> m RecordDirective
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordDirective -> m RecordDirective
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RecordDirective
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RecordDirective -> c RecordDirective
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RecordDirective)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c RecordDirective)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordDirective -> m RecordDirective
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordDirective -> m RecordDirective
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordDirective -> m RecordDirective
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordDirective -> m RecordDirective
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> RecordDirective -> m RecordDirective
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> RecordDirective -> m RecordDirective
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> RecordDirective -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> RecordDirective -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> RecordDirective -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> RecordDirective -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirective -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirective -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirective -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordDirective -> r
gmapT :: (forall b. Data b => b -> b) -> RecordDirective -> RecordDirective
$cgmapT :: (forall b. Data b => b -> b) -> RecordDirective -> RecordDirective
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c RecordDirective)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c RecordDirective)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RecordDirective)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RecordDirective)
dataTypeOf :: RecordDirective -> DataType
$cdataTypeOf :: RecordDirective -> DataType
toConstr :: RecordDirective -> Constr
$ctoConstr :: RecordDirective -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RecordDirective
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RecordDirective
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RecordDirective -> c RecordDirective
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RecordDirective -> c RecordDirective
Data,RecordDirective -> RecordDirective -> Bool
(RecordDirective -> RecordDirective -> Bool)
-> (RecordDirective -> RecordDirective -> Bool)
-> Eq RecordDirective
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecordDirective -> RecordDirective -> Bool
$c/= :: RecordDirective -> RecordDirective -> Bool
== :: RecordDirective -> RecordDirective -> Bool
$c== :: RecordDirective -> RecordDirective -> Bool
Eq,Int -> RecordDirective -> ShowS
[RecordDirective] -> ShowS
RecordDirective -> String
(Int -> RecordDirective -> ShowS)
-> (RecordDirective -> String)
-> ([RecordDirective] -> ShowS)
-> Show RecordDirective
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecordDirective] -> ShowS
$cshowList :: [RecordDirective] -> ShowS
show :: RecordDirective -> String
$cshow :: RecordDirective -> String
showsPrec :: Int -> RecordDirective -> ShowS
$cshowsPrec :: Int -> RecordDirective -> ShowS
Show)

type RecordDirectives = RecordDirectives' (Name, IsInstance)

{-| The representation type of a declaration. The comments indicate
    which type in the intended family the constructor targets.
-}

data Declaration
  = TypeSig ArgInfo TacticAttribute Name Expr
      -- ^ Axioms and functions can be irrelevant. (Hiding should be NotHidden)
  | FieldSig IsInstance TacticAttribute Name (Arg Expr)
  | Generalize Range [TypeSignature] -- ^ Variables to be generalized, can be hidden and/or irrelevant.
  | Field Range [FieldSignature]
  | FunClause LHS RHS WhereClause Bool
  | DataSig     Range Name [LamBinding] Expr -- ^ lone data signature in mutual block
  | Data        Range Name [LamBinding] Expr [TypeSignatureOrInstanceBlock]
  | DataDef     Range Name [LamBinding] [TypeSignatureOrInstanceBlock]
  | RecordSig   Range Name [LamBinding] Expr -- ^ lone record signature in mutual block
  | RecordDef   Range Name RecordDirectives [LamBinding] [Declaration]
  | Record      Range Name RecordDirectives [LamBinding] Expr [Declaration]
  | RecordDirective RecordDirective -- ^ Should not survive beyond the parser
  | Infix Fixity (List1 Name)
  | Syntax      Name Notation -- ^ notation declaration for a name
  | PatternSyn  Range Name [Arg Name] Pattern
  | Mutual      Range [Declaration]  -- @Range@ of the whole @mutual@ block.
  | InterleavedMutual Range [Declaration]
  | Abstract    Range [Declaration]
  | Private     Range Origin [Declaration]
    -- ^ In "Agda.Syntax.Concrete.Definitions" we generate private blocks
    --   temporarily, which should be treated different that user-declared
    --   private blocks.  Thus the 'Origin'.
  | InstanceB   Range [Declaration]
    -- ^ The 'Range' here (exceptionally) only refers to the range of the
    --   @instance@ keyword.  The range of the whole block @InstanceB r ds@
    --   is @fuseRange r ds@.
  | LoneConstructor Range [Declaration]
  | Macro       Range [Declaration]
  | Postulate   Range [TypeSignatureOrInstanceBlock]
  | Primitive   Range [TypeSignature]
  | Open        Range QName ImportDirective
  | Import      Range QName (Maybe AsName) !OpenShortHand ImportDirective
  | ModuleMacro Range  Name ModuleApplication !OpenShortHand ImportDirective
  | Module      Range QName Telescope [Declaration]
  | UnquoteDecl Range [Name] Expr
  | UnquoteDef  Range [Name] Expr
  | Pragma      Pragma
  deriving (Typeable Declaration
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 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)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
Monad m =>
(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 :: forall u. Int -> (forall d. Data d => d -> u) -> Declaration -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Declaration -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Declaration -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Declaration -> [u]
gmapQr :: forall r r'.
(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 :: forall r r'.
(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 (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(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 (t :: * -> *) (c :: * -> *).
Typeable t =>
(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 (c :: * -> *).
(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 (c :: * -> *).
(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
Data, Declaration -> Declaration -> Bool
(Declaration -> Declaration -> Bool)
-> (Declaration -> Declaration -> Bool) -> Eq Declaration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Declaration -> Declaration -> Bool
$c/= :: Declaration -> Declaration -> Bool
== :: Declaration -> Declaration -> Bool
$c== :: Declaration -> Declaration -> Bool
Eq)

-- | Extract a record directive
isRecordDirective :: Declaration -> Maybe RecordDirective
isRecordDirective :: Declaration -> Maybe RecordDirective
isRecordDirective (RecordDirective RecordDirective
r) = RecordDirective -> Maybe RecordDirective
forall a. a -> Maybe a
Just RecordDirective
r
isRecordDirective (InstanceB Range
r [RecordDirective (Constructor Name
n IsInstance
p)]) = RecordDirective -> Maybe RecordDirective
forall a. a -> Maybe a
Just (Name -> IsInstance -> RecordDirective
Constructor Name
n (Range -> IsInstance
InstanceDef Range
r))
isRecordDirective Declaration
_ = Maybe RecordDirective
forall a. Maybe a
Nothing

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

-- Pragmas ----------------------------------------------------------------

data Pragma
  = OptionsPragma             Range [String]
  | BuiltinPragma             Range RString QName
  | RewritePragma             Range Range [QName]        -- ^ Second Range is for REWRITE keyword.
  | ForeignPragma             Range RString String       -- ^ first string is backend name
  | CompilePragma             Range RString QName String -- ^ first string is backend name
  | StaticPragma              Range QName
  | InlinePragma              Range Bool QName  -- ^ INLINE or NOINLINE

  | ImpossiblePragma          Range [String]
    -- ^ Throws an internal error in the scope checker.
    --   The 'String's are words to be displayed with the error.
  | EtaPragma                 Range QName
    -- ^ For coinductive records, use pragma instead of regular
    --   @eta-equality@ definition (as it is might make Agda loop).
  | WarningOnUsage            Range QName Text
    -- ^ Applies to the named function
  | WarningOnImport           Range Text
    -- ^ Applies to the current module
  | InjectivePragma           Range QName
    -- ^ Mark a definition as injective for the pattern matching unifier.
  | DisplayPragma             Range Pattern Expr
    -- ^ Display lhs as rhs (modifies the printer).

  -- Attached (more or less) pragmas handled in the nicifier (Concrete.Definitions):
  | CatchallPragma            Range
    -- ^ Applies to the following function clause.
  | TerminationCheckPragma    Range (TerminationCheck Name)
    -- ^ Applies to the following function (and all that are mutually recursive with it)
    --   or to the functions in the following mutual block.
  | NoCoverageCheckPragma     Range
    -- ^ Applies to the following function (and all that are mutually recursive with it)
    --   or to the functions in the following mutual block.
  | NoPositivityCheckPragma   Range
    -- ^ Applies to the following data/record type or mutual block.
  | PolarityPragma            Range Name [Occurrence]
  | NoUniverseCheckPragma     Range
    -- ^ Applies to the following data/record type.
  deriving (Typeable Pragma
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 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)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
Monad m =>
(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 :: forall u. Int -> (forall d. Data d => d -> u) -> Pragma -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Pragma -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Pragma -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Pragma -> [u]
gmapQr :: forall r r'.
(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 :: forall r r'.
(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 (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(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 (t :: * -> *) (c :: * -> *).
Typeable t =>
(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 (c :: * -> *).
(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 (c :: * -> *).
(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
Data, 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)

---------------------------------------------------------------------------

-- | Modules: Top-level pragmas plus other top-level declarations.

data Module = Mod
  { Module -> [Pragma]
modPragmas :: [Pragma]
  , Module -> [Declaration]
modDecls   :: [Declaration]
  }

-- | Computes the top-level module name.
--
-- Precondition: The 'Module' has to be well-formed.
-- This means that there are only allowed declarations before the
-- first module declaration, typically import declarations.
-- See 'spanAllowedBeforeModule'.

topLevelModuleName :: Module -> TopLevelModuleName
topLevelModuleName :: Module -> TopLevelModuleName
topLevelModuleName (Mod [Pragma]
_ []) = TopLevelModuleName
forall a. HasCallStack => a
__IMPOSSIBLE__
topLevelModuleName (Mod [Pragma]
_ [Declaration]
ds) = case [Declaration] -> ([Declaration], [Declaration])
spanAllowedBeforeModule [Declaration]
ds of
  ([Declaration]
_, Module Range
_ QName
n Telescope
_ [Declaration]
_ : [Declaration]
_) -> QName -> TopLevelModuleName
toTopLevelModuleName QName
n
  ([Declaration], [Declaration])
_ -> TopLevelModuleName
forall a. HasCallStack => a
__IMPOSSIBLE__

-- | Splits off allowed (= import) declarations before the first
--   non-allowed declaration.
--   After successful parsing, the first non-allowed declaration
--   should be a module declaration.
spanAllowedBeforeModule :: [Declaration] -> ([Declaration], [Declaration])
spanAllowedBeforeModule :: [Declaration] -> ([Declaration], [Declaration])
spanAllowedBeforeModule = (Declaration -> Bool)
-> [Declaration] -> ([Declaration], [Declaration])
forall a. (a -> Bool) -> [a] -> ([a], [a])
span Declaration -> Bool
isAllowedBeforeModule
  where
    isAllowedBeforeModule :: Declaration -> Bool
isAllowedBeforeModule (Pragma OptionsPragma{}) = Bool
True
    isAllowedBeforeModule (Pragma BuiltinPragma{}) = Bool
True
    isAllowedBeforeModule (Private Range
_ Origin
_ [Declaration]
ds) = (Declaration -> Bool) -> [Declaration] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Declaration -> Bool
isAllowedBeforeModule [Declaration]
ds
    isAllowedBeforeModule Import{}       = Bool
True
    isAllowedBeforeModule ModuleMacro{}  = Bool
True
    isAllowedBeforeModule Open{}         = Bool
True
    isAllowedBeforeModule Declaration
_              = Bool
False

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

-- | Extended content of an interaction hole.
data HoleContent' qn nm p e
  = HoleContentExpr    e                       -- ^ @e@
  | HoleContentRewrite [RewriteEqn' qn nm p e] -- ^ @(rewrite | invert) e0 | ... | en@
  deriving ((forall a b.
 (a -> b) -> HoleContent' qn nm p a -> HoleContent' qn nm p b)
-> (forall a b.
    a -> HoleContent' qn nm p b -> HoleContent' qn nm p a)
-> Functor (HoleContent' qn nm p)
forall a b. a -> HoleContent' qn nm p b -> HoleContent' qn nm p a
forall a b.
(a -> b) -> HoleContent' qn nm p a -> HoleContent' qn nm p b
forall qn nm p a b.
a -> HoleContent' qn nm p b -> HoleContent' qn nm p a
forall qn nm p a b.
(a -> b) -> HoleContent' qn nm p a -> HoleContent' qn nm p b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> HoleContent' qn nm p b -> HoleContent' qn nm p a
$c<$ :: forall qn nm p a b.
a -> HoleContent' qn nm p b -> HoleContent' qn nm p a
fmap :: forall a b.
(a -> b) -> HoleContent' qn nm p a -> HoleContent' qn nm p b
$cfmap :: forall qn nm p a b.
(a -> b) -> HoleContent' qn nm p a -> HoleContent' qn nm p b
Functor, (forall m. Monoid m => HoleContent' qn nm p m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> HoleContent' qn nm p a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> HoleContent' qn nm p a -> m)
-> (forall a b. (a -> b -> b) -> b -> HoleContent' qn nm p a -> b)
-> (forall a b. (a -> b -> b) -> b -> HoleContent' qn nm p a -> b)
-> (forall b a. (b -> a -> b) -> b -> HoleContent' qn nm p a -> b)
-> (forall b a. (b -> a -> b) -> b -> HoleContent' qn nm p a -> b)
-> (forall a. (a -> a -> a) -> HoleContent' qn nm p a -> a)
-> (forall a. (a -> a -> a) -> HoleContent' qn nm p a -> a)
-> (forall a. HoleContent' qn nm p a -> [a])
-> (forall a. HoleContent' qn nm p a -> Bool)
-> (forall a. HoleContent' qn nm p a -> Int)
-> (forall a. Eq a => a -> HoleContent' qn nm p a -> Bool)
-> (forall a. Ord a => HoleContent' qn nm p a -> a)
-> (forall a. Ord a => HoleContent' qn nm p a -> a)
-> (forall a. Num a => HoleContent' qn nm p a -> a)
-> (forall a. Num a => HoleContent' qn nm p a -> a)
-> Foldable (HoleContent' qn nm p)
forall a. Eq a => a -> HoleContent' qn nm p a -> Bool
forall a. Num a => HoleContent' qn nm p a -> a
forall a. Ord a => HoleContent' qn nm p a -> a
forall m. Monoid m => HoleContent' qn nm p m -> m
forall a. HoleContent' qn nm p a -> Bool
forall a. HoleContent' qn nm p a -> Int
forall a. HoleContent' qn nm p a -> [a]
forall a. (a -> a -> a) -> HoleContent' qn nm p a -> a
forall m a. Monoid m => (a -> m) -> HoleContent' qn nm p a -> m
forall b a. (b -> a -> b) -> b -> HoleContent' qn nm p a -> b
forall a b. (a -> b -> b) -> b -> HoleContent' qn nm p a -> b
forall qn nm p a. Eq a => a -> HoleContent' qn nm p a -> Bool
forall qn nm p a. Num a => HoleContent' qn nm p a -> a
forall qn nm p a. Ord a => HoleContent' qn nm p a -> a
forall qn nm p m. Monoid m => HoleContent' qn nm p m -> m
forall qn nm p a. HoleContent' qn nm p a -> Bool
forall qn nm p a. HoleContent' qn nm p a -> Int
forall qn nm p a. HoleContent' qn nm p a -> [a]
forall qn nm p a. (a -> a -> a) -> HoleContent' qn nm p a -> a
forall qn nm p m a.
Monoid m =>
(a -> m) -> HoleContent' qn nm p a -> m
forall qn nm p b a.
(b -> a -> b) -> b -> HoleContent' qn nm p a -> b
forall qn nm p a b.
(a -> b -> b) -> b -> HoleContent' qn nm p a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => HoleContent' qn nm p a -> a
$cproduct :: forall qn nm p a. Num a => HoleContent' qn nm p a -> a
sum :: forall a. Num a => HoleContent' qn nm p a -> a
$csum :: forall qn nm p a. Num a => HoleContent' qn nm p a -> a
minimum :: forall a. Ord a => HoleContent' qn nm p a -> a
$cminimum :: forall qn nm p a. Ord a => HoleContent' qn nm p a -> a
maximum :: forall a. Ord a => HoleContent' qn nm p a -> a
$cmaximum :: forall qn nm p a. Ord a => HoleContent' qn nm p a -> a
elem :: forall a. Eq a => a -> HoleContent' qn nm p a -> Bool
$celem :: forall qn nm p a. Eq a => a -> HoleContent' qn nm p a -> Bool
length :: forall a. HoleContent' qn nm p a -> Int
$clength :: forall qn nm p a. HoleContent' qn nm p a -> Int
null :: forall a. HoleContent' qn nm p a -> Bool
$cnull :: forall qn nm p a. HoleContent' qn nm p a -> Bool
toList :: forall a. HoleContent' qn nm p a -> [a]
$ctoList :: forall qn nm p a. HoleContent' qn nm p a -> [a]
foldl1 :: forall a. (a -> a -> a) -> HoleContent' qn nm p a -> a
$cfoldl1 :: forall qn nm p a. (a -> a -> a) -> HoleContent' qn nm p a -> a
foldr1 :: forall a. (a -> a -> a) -> HoleContent' qn nm p a -> a
$cfoldr1 :: forall qn nm p a. (a -> a -> a) -> HoleContent' qn nm p a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> HoleContent' qn nm p a -> b
$cfoldl' :: forall qn nm p b a.
(b -> a -> b) -> b -> HoleContent' qn nm p a -> b
foldl :: forall b a. (b -> a -> b) -> b -> HoleContent' qn nm p a -> b
$cfoldl :: forall qn nm p b a.
(b -> a -> b) -> b -> HoleContent' qn nm p a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> HoleContent' qn nm p a -> b
$cfoldr' :: forall qn nm p a b.
(a -> b -> b) -> b -> HoleContent' qn nm p a -> b
foldr :: forall a b. (a -> b -> b) -> b -> HoleContent' qn nm p a -> b
$cfoldr :: forall qn nm p a b.
(a -> b -> b) -> b -> HoleContent' qn nm p a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> HoleContent' qn nm p a -> m
$cfoldMap' :: forall qn nm p m a.
Monoid m =>
(a -> m) -> HoleContent' qn nm p a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> HoleContent' qn nm p a -> m
$cfoldMap :: forall qn nm p m a.
Monoid m =>
(a -> m) -> HoleContent' qn nm p a -> m
fold :: forall m. Monoid m => HoleContent' qn nm p m -> m
$cfold :: forall qn nm p m. Monoid m => HoleContent' qn nm p m -> m
Foldable, Functor (HoleContent' qn nm p)
Foldable (HoleContent' qn nm p)
Functor (HoleContent' qn nm p)
-> Foldable (HoleContent' qn nm p)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> HoleContent' qn nm p a -> f (HoleContent' qn nm p b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    HoleContent' qn nm p (f a) -> f (HoleContent' qn nm p a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> HoleContent' qn nm p a -> m (HoleContent' qn nm p b))
-> (forall (m :: * -> *) a.
    Monad m =>
    HoleContent' qn nm p (m a) -> m (HoleContent' qn nm p a))
-> Traversable (HoleContent' qn nm p)
forall qn nm p. Functor (HoleContent' qn nm p)
forall qn nm p. Foldable (HoleContent' qn nm p)
forall qn nm p (m :: * -> *) a.
Monad m =>
HoleContent' qn nm p (m a) -> m (HoleContent' qn nm p a)
forall qn nm p (f :: * -> *) a.
Applicative f =>
HoleContent' qn nm p (f a) -> f (HoleContent' qn nm p a)
forall qn nm p (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HoleContent' qn nm p a -> m (HoleContent' qn nm p b)
forall qn nm p (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HoleContent' qn nm p a -> f (HoleContent' qn nm p b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
HoleContent' qn nm p (m a) -> m (HoleContent' qn nm p a)
forall (f :: * -> *) a.
Applicative f =>
HoleContent' qn nm p (f a) -> f (HoleContent' qn nm p a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HoleContent' qn nm p a -> m (HoleContent' qn nm p b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HoleContent' qn nm p a -> f (HoleContent' qn nm p b)
sequence :: forall (m :: * -> *) a.
Monad m =>
HoleContent' qn nm p (m a) -> m (HoleContent' qn nm p a)
$csequence :: forall qn nm p (m :: * -> *) a.
Monad m =>
HoleContent' qn nm p (m a) -> m (HoleContent' qn nm p a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HoleContent' qn nm p a -> m (HoleContent' qn nm p b)
$cmapM :: forall qn nm p (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HoleContent' qn nm p a -> m (HoleContent' qn nm p b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
HoleContent' qn nm p (f a) -> f (HoleContent' qn nm p a)
$csequenceA :: forall qn nm p (f :: * -> *) a.
Applicative f =>
HoleContent' qn nm p (f a) -> f (HoleContent' qn nm p a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HoleContent' qn nm p a -> f (HoleContent' qn nm p b)
$ctraverse :: forall qn nm p (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HoleContent' qn nm p a -> f (HoleContent' qn nm p b)
Traversable)

type HoleContent = HoleContent' () Name Pattern Expr

---------------------------------------------------------------------------
-- * Smart constructors
---------------------------------------------------------------------------

rawApp :: List1 Expr -> Expr
rawApp :: List1 Expr -> Expr
rawApp es :: List1 Expr
es@(Expr
e1 :| Expr
e2 : [Expr]
rest) = Range -> List2 Expr -> Expr
RawApp (List1 Expr -> Range
forall a. HasRange a => a -> Range
getRange List1 Expr
es) (List2 Expr -> Expr) -> List2 Expr -> Expr
forall a b. (a -> b) -> a -> b
$ Expr -> Expr -> [Expr] -> List2 Expr
forall a. a -> a -> [a] -> List2 a
List2 Expr
e1 Expr
e2 [Expr]
rest
rawApp (Expr
e :| []) = Expr
e

rawAppP :: List1 Pattern -> Pattern
rawAppP :: List1 Pattern -> Pattern
rawAppP ps :: List1 Pattern
ps@(Pattern
p1 :| Pattern
p2 : [Pattern]
rest) = Range -> List2 Pattern -> Pattern
RawAppP (List1 Pattern -> Range
forall a. HasRange a => a -> Range
getRange List1 Pattern
ps) (List2 Pattern -> Pattern) -> List2 Pattern -> Pattern
forall a b. (a -> b) -> a -> b
$ Pattern -> Pattern -> [Pattern] -> List2 Pattern
forall a. a -> a -> [a] -> List2 a
List2 Pattern
p1 Pattern
p2 [Pattern]
rest
rawAppP (Pattern
p :| []) = Pattern
p

{--------------------------------------------------------------------------
    Views
 --------------------------------------------------------------------------}

-- | The 'Expr' is not an application.
data AppView = AppView Expr [NamedArg Expr]

appView :: Expr -> AppView
appView :: Expr -> AppView
appView = \case
    App Range
r Expr
e1 NamedArg Expr
e2      -> AppView -> NamedArg Expr -> AppView
vApp (Expr -> AppView
appView Expr
e1) NamedArg Expr
e2
    RawApp Range
_ (List2 Expr
e1 Expr
e2 [Expr]
es)
                     -> Expr -> [NamedArg Expr] -> AppView
AppView Expr
e1 ([NamedArg Expr] -> AppView) -> [NamedArg Expr] -> AppView
forall a b. (a -> b) -> a -> b
$ (Expr -> NamedArg Expr) -> [Expr] -> [NamedArg Expr]
forall a b. (a -> b) -> [a] -> [b]
map Expr -> NamedArg Expr
arg (Expr
e2Expr -> [Expr] -> [Expr]
forall a. a -> [a] -> [a]
:[Expr]
es)
    Expr
e                -> Expr -> [NamedArg Expr] -> AppView
AppView Expr
e []
  where
    vApp :: AppView -> NamedArg Expr -> AppView
vApp (AppView Expr
e [NamedArg Expr]
es) NamedArg Expr
arg = Expr -> [NamedArg Expr] -> AppView
AppView Expr
e ([NamedArg Expr]
es [NamedArg Expr] -> [NamedArg Expr] -> [NamedArg Expr]
forall a. [a] -> [a] -> [a]
++ [NamedArg Expr
arg])

    arg :: Expr -> NamedArg Expr
arg (HiddenArg   Range
_ Named_ Expr
e) = NamedArg Expr -> NamedArg Expr
forall a. LensHiding a => a -> a
hide         (NamedArg Expr -> NamedArg Expr) -> NamedArg Expr -> NamedArg Expr
forall a b. (a -> b) -> a -> b
$ Named_ Expr -> NamedArg Expr
forall a. a -> Arg a
defaultArg Named_ Expr
e
    arg (InstanceArg Range
_ Named_ Expr
e) = NamedArg Expr -> NamedArg Expr
forall a. LensHiding a => a -> a
makeInstance (NamedArg Expr -> NamedArg Expr) -> NamedArg Expr -> NamedArg Expr
forall a b. (a -> b) -> a -> b
$ Named_ Expr -> NamedArg Expr
forall a. a -> Arg a
defaultArg Named_ Expr
e
    arg Expr
e                 = Named_ Expr -> NamedArg Expr
forall a. a -> Arg a
defaultArg (Expr -> Named_ Expr
forall a name. a -> Named name a
unnamed Expr
e)

unAppView :: AppView -> Expr
unAppView :: AppView -> Expr
unAppView (AppView Expr
e [NamedArg Expr]
nargs) = List1 Expr -> Expr
rawApp (Expr
e Expr -> [Expr] -> List1 Expr
forall a. a -> [a] -> NonEmpty a
:| (NamedArg Expr -> Expr) -> [NamedArg Expr] -> [Expr]
forall a b. (a -> b) -> [a] -> [b]
map NamedArg Expr -> Expr
unNamedArg [NamedArg Expr]
nargs)

  where
    unNamedArg :: NamedArg Expr -> Expr
unNamedArg NamedArg Expr
narg = ((Named_ Expr -> Expr) -> Named_ Expr -> Expr
forall a b. (a -> b) -> a -> b
$ NamedArg Expr -> Named_ Expr
forall e. Arg e -> e
unArg NamedArg Expr
narg) ((Named_ Expr -> Expr) -> Expr) -> (Named_ Expr -> Expr) -> Expr
forall a b. (a -> b) -> a -> b
$ case NamedArg Expr -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding NamedArg Expr
narg of
      Hiding
Hidden     -> Range -> Named_ Expr -> Expr
HiddenArg (NamedArg Expr -> Range
forall a. HasRange a => a -> Range
getRange NamedArg Expr
narg)
      Hiding
NotHidden  -> Named_ Expr -> Expr
forall name a. Named name a -> a
namedThing
      Instance{} -> Range -> Named_ Expr -> Expr
InstanceArg (NamedArg Expr -> Range
forall a. HasRange a => a -> Range
getRange NamedArg Expr
narg)

isSingleIdentifierP :: Pattern -> Maybe Name
isSingleIdentifierP :: Pattern -> Maybe Name
isSingleIdentifierP = \case
  IdentP (QName Name
x) -> Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
  WildP Range
r          -> Name -> Maybe Name
forall a. a -> Maybe a
Just (Name -> Maybe Name) -> Name -> Maybe Name
forall a b. (a -> b) -> a -> b
$ Range -> Name
noName Range
r
  ParenP Range
_ Pattern
p       -> Pattern -> Maybe Name
isSingleIdentifierP Pattern
p
  Pattern
_                -> Maybe Name
forall a. Maybe a
Nothing

removeParenP :: Pattern -> Pattern
removeParenP :: Pattern -> Pattern
removeParenP = \case
    ParenP Range
_ Pattern
p -> Pattern -> Pattern
removeParenP Pattern
p
    Pattern
p -> Pattern
p

-- | Observe the hiding status of an expression
observeHiding :: Expr -> WithHiding Expr
observeHiding :: Expr -> WithHiding Expr
observeHiding = \case
  HiddenArg Range
_   (Named Maybe (WithOrigin (Ranged String))
Nothing Expr
e) -> Hiding -> Expr -> WithHiding Expr
forall a. Hiding -> a -> WithHiding a
WithHiding Hiding
Hidden Expr
e
  InstanceArg Range
_ (Named Maybe (WithOrigin (Ranged String))
Nothing Expr
e) -> Hiding -> Expr -> WithHiding Expr
forall a. Hiding -> a -> WithHiding a
WithHiding (Overlappable -> Hiding
Instance Overlappable
NoOverlap) Expr
e
  Expr
e                               -> Hiding -> Expr -> WithHiding Expr
forall a. Hiding -> a -> WithHiding a
WithHiding Hiding
NotHidden Expr
e

-- | Observe the relevance status of an expression
observeRelevance :: Expr -> (Relevance, Expr)
observeRelevance :: Expr -> (Relevance, Expr)
observeRelevance = \case
  Dot Range
_ Expr
e       -> (Relevance
Irrelevant, Expr
e)
  DoubleDot Range
_ Expr
e -> (Relevance
NonStrict, Expr
e)
  Expr
e             -> (Relevance
Relevant, Expr
e)

-- | Observe various modifiers applied to an expression
observeModifiers :: Expr -> Arg Expr
observeModifiers :: Expr -> Arg Expr
observeModifiers Expr
e =
  let (Relevance
rel, WithHiding Hiding
hid Expr
e') = (Expr -> WithHiding Expr)
-> (Relevance, Expr) -> (Relevance, WithHiding Expr)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Expr -> WithHiding Expr
observeHiding (Expr -> (Relevance, Expr)
observeRelevance Expr
e) in
  Relevance -> Arg Expr -> Arg Expr
forall a. LensRelevance a => Relevance -> a -> a
setRelevance Relevance
rel (Arg Expr -> Arg Expr) -> Arg Expr -> Arg Expr
forall a b. (a -> b) -> a -> b
$ Hiding -> Arg Expr -> Arg Expr
forall a. LensHiding a => Hiding -> a -> a
setHiding Hiding
hid (Arg Expr -> Arg Expr) -> Arg Expr -> Arg Expr
forall a b. (a -> b) -> a -> b
$ Expr -> Arg Expr
forall a. a -> Arg a
defaultArg Expr
e'

returnExpr :: Expr -> Maybe Expr
returnExpr :: Expr -> Maybe Expr
returnExpr (Pi Telescope1
_ Expr
e)        = Expr -> Maybe Expr
returnExpr Expr
e
returnExpr (Fun Range
_ Arg Expr
_  Expr
e)    = Expr -> Maybe Expr
returnExpr Expr
e
returnExpr (Let Range
_ List1 Declaration
_ Maybe Expr
e)     = Expr -> Maybe Expr
returnExpr (Expr -> Maybe Expr) -> Maybe Expr -> Maybe Expr
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Maybe Expr
e
returnExpr (Paren Range
_ Expr
e)     = Expr -> Maybe Expr
returnExpr Expr
e
returnExpr (Generalized Expr
e) = Expr -> Maybe Expr
returnExpr Expr
e
returnExpr Expr
e               = Expr -> Maybe Expr
forall (f :: * -> *) a. Applicative f => a -> f a
pure Expr
e

-- | Turn an expression into a pattern. Fails if the expression is not a
--   valid pattern.

isPattern :: Expr -> Maybe Pattern
isPattern :: Expr -> Maybe Pattern
isPattern = (Expr -> Maybe Pattern) -> Expr -> Maybe Pattern
forall (m :: * -> *).
Applicative m =>
(Expr -> m Pattern) -> Expr -> m Pattern
exprToPattern (Maybe Pattern -> Expr -> Maybe Pattern
forall a b. a -> b -> a
const Maybe Pattern
forall a. Maybe a
Nothing)

-- | Turn an expression into a pattern, turning non-pattern subexpressions into 'WildP'.

exprToPatternWithHoles :: Expr -> Pattern
exprToPatternWithHoles :: Expr -> Pattern
exprToPatternWithHoles = Identity Pattern -> Pattern
forall a. Identity a -> a
runIdentity (Identity Pattern -> Pattern)
-> (Expr -> Identity Pattern) -> Expr -> Pattern
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Expr -> Identity Pattern) -> Expr -> Identity Pattern
forall (m :: * -> *).
Applicative m =>
(Expr -> m Pattern) -> Expr -> m Pattern
exprToPattern (Pattern -> Identity Pattern
forall a. a -> Identity a
Identity (Pattern -> Identity Pattern)
-> (Expr -> Pattern) -> Expr -> Identity Pattern
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Range -> Pattern
WildP (Range -> Pattern) -> (Expr -> Range) -> Expr -> Pattern
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Expr -> Range
forall a. HasRange a => a -> Range
getRange)

-- | Generic expression to pattern conversion.

exprToPattern :: Applicative m
  => (Expr -> m Pattern)  -- ^ Default result for non-pattern things.
  -> Expr                 -- ^ The expression to translate.
  -> m Pattern            -- ^ The translated pattern (maybe).
exprToPattern :: forall (m :: * -> *).
Applicative m =>
(Expr -> m Pattern) -> Expr -> m Pattern
exprToPattern Expr -> m Pattern
fallback = Expr -> m Pattern
loop
  where
  loop :: Expr -> m Pattern
loop = \case
    Ident       QName
x        -> Pattern -> m Pattern
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pattern -> m Pattern) -> Pattern -> m Pattern
forall a b. (a -> b) -> a -> b
$ QName -> Pattern
IdentP QName
x
    App         Range
_ Expr
e1 NamedArg Expr
e2  -> Pattern -> NamedArg Pattern -> Pattern
AppP (Pattern -> NamedArg Pattern -> Pattern)
-> m Pattern -> m (NamedArg Pattern -> Pattern)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Expr -> m Pattern
loop Expr
e1 m (NamedArg Pattern -> Pattern)
-> m (NamedArg Pattern) -> m Pattern
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Named_ Expr -> m (Named_ Pattern))
-> NamedArg Expr -> m (NamedArg Pattern)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((Expr -> m Pattern) -> Named_ Expr -> m (Named_ Pattern)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse Expr -> m Pattern
loop) NamedArg Expr
e2
    Paren       Range
r Expr
e      -> Range -> Pattern -> Pattern
ParenP Range
r (Pattern -> Pattern) -> m Pattern -> m Pattern
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Expr -> m Pattern
loop Expr
e
    Underscore  Range
r Maybe String
_      -> Pattern -> m Pattern
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pattern -> m Pattern) -> Pattern -> m Pattern
forall a b. (a -> b) -> a -> b
$ Range -> Pattern
WildP Range
r
    Absurd      Range
r        -> Pattern -> m Pattern
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pattern -> m Pattern) -> Pattern -> m Pattern
forall a b. (a -> b) -> a -> b
$ Range -> Pattern
AbsurdP Range
r
    As          Range
r Name
x Expr
e    -> Range -> (Pattern -> Pattern) -> Pattern -> Pattern
pushUnderBracesP Range
r (Range -> Name -> Pattern -> Pattern
AsP Range
r Name
x) (Pattern -> Pattern) -> m Pattern -> m Pattern
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Expr -> m Pattern
loop Expr
e
    Dot         Range
r Expr
e      -> Pattern -> m Pattern
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pattern -> m Pattern) -> Pattern -> m Pattern
forall a b. (a -> b) -> a -> b
$ Range -> (Expr -> Pattern) -> Expr -> Pattern
pushUnderBracesE Range
r (Range -> Expr -> Pattern
DotP Range
r) Expr
e
    -- Wen, 2020-08-27: We disallow Float patterns, since equality for floating
    -- point numbers is not stable across architectures and with different
    -- compiler flags.
    e :: Expr
e@(Lit Range
_ LitFloat{}) -> Expr -> m Pattern
fallback Expr
e
    Lit         Range
r Literal
l      -> Pattern -> m Pattern
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pattern -> m Pattern) -> Pattern -> m Pattern
forall a b. (a -> b) -> a -> b
$ Range -> Literal -> Pattern
LitP Range
r Literal
l
    HiddenArg   Range
r Named_ Expr
e      -> Range -> Named_ Pattern -> Pattern
HiddenP   Range
r (Named_ Pattern -> Pattern) -> m (Named_ Pattern) -> m Pattern
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Expr -> m Pattern) -> Named_ Expr -> m (Named_ Pattern)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse Expr -> m Pattern
loop Named_ Expr
e
    InstanceArg Range
r Named_ Expr
e      -> Range -> Named_ Pattern -> Pattern
InstanceP Range
r (Named_ Pattern -> Pattern) -> m (Named_ Pattern) -> m Pattern
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Expr -> m Pattern) -> Named_ Expr -> m (Named_ Pattern)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse Expr -> m Pattern
loop Named_ Expr
e
    RawApp      Range
r List2 Expr
es     -> Range -> List2 Pattern -> Pattern
RawAppP   Range
r (List2 Pattern -> Pattern) -> m (List2 Pattern) -> m Pattern
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Expr -> m Pattern) -> List2 Expr -> m (List2 Pattern)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse Expr -> m Pattern
loop List2 Expr
es
    Quote       Range
r        -> Pattern -> m Pattern
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pattern -> m Pattern) -> Pattern -> m Pattern
forall a b. (a -> b) -> a -> b
$ Range -> Pattern
QuoteP Range
r
    Equal       Range
r Expr
e1 Expr
e2  -> Pattern -> m Pattern
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pattern -> m Pattern) -> Pattern -> m Pattern
forall a b. (a -> b) -> a -> b
$ Range -> [(Expr, Expr)] -> Pattern
EqualP Range
r [(Expr
e1, Expr
e2)]
    Ellipsis    Range
r        -> Pattern -> m Pattern
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pattern -> m Pattern) -> Pattern -> m Pattern
forall a b. (a -> b) -> a -> b
$ Range -> Maybe Pattern -> Pattern
EllipsisP Range
r Maybe Pattern
forall a. Maybe a
Nothing
    e :: Expr
e@(Rec Range
r RecordAssignments
es)
        -- We cannot translate record expressions with module parts.
      | Just [FieldAssignment]
fs <- (Either FieldAssignment ModuleAssignment -> Maybe FieldAssignment)
-> RecordAssignments -> Maybe [FieldAssignment]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Either FieldAssignment ModuleAssignment -> Maybe FieldAssignment
forall a b. Either a b -> Maybe a
maybeLeft RecordAssignments
es -> Range -> [FieldAssignment' Pattern] -> Pattern
RecP Range
r ([FieldAssignment' Pattern] -> Pattern)
-> m [FieldAssignment' Pattern] -> m Pattern
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (FieldAssignment -> m (FieldAssignment' Pattern))
-> [FieldAssignment] -> m [FieldAssignment' Pattern]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((Expr -> m Pattern)
-> FieldAssignment -> m (FieldAssignment' Pattern)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse Expr -> m Pattern
loop) [FieldAssignment]
fs
      | Bool
otherwise -> Expr -> m Pattern
fallback Expr
e
    -- WithApp has already lost the range information of the bars '|'
    WithApp     Range
r Expr
e [Expr]
es   -> do -- ApplicativeDo
      Pattern
p  <- Expr -> m Pattern
loop Expr
e
      [NamedArg Pattern]
ps <- [Expr] -> (Expr -> m (NamedArg Pattern)) -> m [NamedArg Pattern]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
t a -> (a -> f b) -> f (t b)
forA [Expr]
es ((Expr -> m (NamedArg Pattern)) -> m [NamedArg Pattern])
-> (Expr -> m (NamedArg Pattern)) -> m [NamedArg Pattern]
forall a b. (a -> b) -> a -> b
$ \ Expr
e -> do -- ApplicativeDo
        Pattern
p <- Expr -> m Pattern
loop Expr
e
        pure $ Pattern -> NamedArg Pattern
forall a. a -> NamedArg a
defaultNamedArg (Pattern -> NamedArg Pattern) -> Pattern -> NamedArg Pattern
forall a b. (a -> b) -> a -> b
$ Range -> Pattern -> Pattern
WithP (Expr -> Range
forall a. HasRange a => a -> Range
getRange Expr
e) Pattern
p   -- TODO #2822: Range!
      pure $ (Pattern -> NamedArg Pattern -> Pattern)
-> Pattern -> [NamedArg Pattern] -> Pattern
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl Pattern -> NamedArg Pattern -> Pattern
AppP Pattern
p [NamedArg Pattern]
ps
    Expr
e -> Expr -> m Pattern
fallback Expr
e

  pushUnderBracesP :: Range -> (Pattern -> Pattern) -> (Pattern -> Pattern)
  pushUnderBracesP :: Range -> (Pattern -> Pattern) -> Pattern -> Pattern
pushUnderBracesP Range
r Pattern -> Pattern
f = \case
    HiddenP   Range
_ Named_ Pattern
p   -> Range -> Named_ Pattern -> Pattern
HiddenP   Range
r (Named_ Pattern -> Pattern) -> Named_ Pattern -> Pattern
forall a b. (a -> b) -> a -> b
$ (Pattern -> Pattern) -> Named_ Pattern -> Named_ Pattern
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Pattern -> Pattern
f Named_ Pattern
p
    InstanceP Range
_ Named_ Pattern
p   -> Range -> Named_ Pattern -> Pattern
InstanceP Range
r (Named_ Pattern -> Pattern) -> Named_ Pattern -> Pattern
forall a b. (a -> b) -> a -> b
$ (Pattern -> Pattern) -> Named_ Pattern -> Named_ Pattern
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Pattern -> Pattern
f Named_ Pattern
p
    Pattern
p               -> Pattern -> Pattern
f Pattern
p

  pushUnderBracesE :: Range -> (Expr -> Pattern) -> (Expr -> Pattern)
  pushUnderBracesE :: Range -> (Expr -> Pattern) -> Expr -> Pattern
pushUnderBracesE Range
r Expr -> Pattern
f = \case
    HiddenArg   Range
_ Named_ Expr
p -> Range -> Named_ Pattern -> Pattern
HiddenP   Range
r (Named_ Pattern -> Pattern) -> Named_ Pattern -> Pattern
forall a b. (a -> b) -> a -> b
$ (Expr -> Pattern) -> Named_ Expr -> Named_ Pattern
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Expr -> Pattern
f Named_ Expr
p
    InstanceArg Range
_ Named_ Expr
p -> Range -> Named_ Pattern -> Pattern
InstanceP Range
r (Named_ Pattern -> Pattern) -> Named_ Pattern -> Pattern
forall a b. (a -> b) -> a -> b
$ (Expr -> Pattern) -> Named_ Expr -> Named_ Pattern
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Expr -> Pattern
f Named_ Expr
p
    Expr
p               -> Expr -> Pattern
f Expr
p

isAbsurdP :: Pattern -> Maybe (Range, Hiding)
isAbsurdP :: Pattern -> Maybe (Range, Hiding)
isAbsurdP = \case
  AbsurdP Range
r      -> (Range, Hiding) -> Maybe (Range, Hiding)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Range
r, Hiding
NotHidden)
  AsP Range
_ Name
_      Pattern
p -> Pattern -> Maybe (Range, Hiding)
isAbsurdP Pattern
p
  ParenP Range
_     Pattern
p -> Pattern -> Maybe (Range, Hiding)
isAbsurdP Pattern
p
  HiddenP   Range
_ Named_ Pattern
np -> (Hiding
Hidden Hiding -> (Range, Hiding) -> (Range, Hiding)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$)              ((Range, Hiding) -> (Range, Hiding))
-> Maybe (Range, Hiding) -> Maybe (Range, Hiding)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Pattern -> Maybe (Range, Hiding)
isAbsurdP (Named_ Pattern -> Pattern
forall name a. Named name a -> a
namedThing Named_ Pattern
np)
  InstanceP Range
_ Named_ Pattern
np -> (Overlappable -> Hiding
Instance Overlappable
YesOverlap Hiding -> (Range, Hiding) -> (Range, Hiding)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$) ((Range, Hiding) -> (Range, Hiding))
-> Maybe (Range, Hiding) -> Maybe (Range, Hiding)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Pattern -> Maybe (Range, Hiding)
isAbsurdP (Named_ Pattern -> Pattern
forall name a. Named name a -> a
namedThing Named_ Pattern
np)
  Pattern
_ -> Maybe (Range, Hiding)
forall a. Maybe a
Nothing

isBinderP :: Pattern -> Maybe Binder
isBinderP :: Pattern -> Maybe Binder
isBinderP = \case
  IdentP QName
qn  -> Name -> Binder
mkBinder_ (Name -> Binder) -> Maybe Name -> Maybe Binder
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> QName -> Maybe Name
isUnqualified QName
qn
  WildP Range
r    -> Binder -> Maybe Binder
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Binder -> Maybe Binder) -> Binder -> Maybe Binder
forall a b. (a -> b) -> a -> b
$ Name -> Binder
mkBinder_ (Name -> Binder) -> Name -> Binder
forall a b. (a -> b) -> a -> b
$ Range -> Name -> Name
forall a. SetRange a => Range -> a -> a
setRange Range
r Name
simpleHole
  AsP Range
r Name
n Pattern
p  -> Binder -> Maybe Binder
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Binder -> Maybe Binder) -> Binder -> Maybe Binder
forall a b. (a -> b) -> a -> b
$ Maybe Pattern -> BoundName -> Binder
forall a. Maybe Pattern -> a -> Binder' a
Binder (Pattern -> Maybe Pattern
forall a. a -> Maybe a
Just Pattern
p) (BoundName -> Binder) -> BoundName -> Binder
forall a b. (a -> b) -> a -> b
$ Name -> BoundName
mkBoundName_ Name
n
  ParenP Range
r Pattern
p -> Binder -> Maybe Binder
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Binder -> Maybe Binder) -> Binder -> Maybe Binder
forall a b. (a -> b) -> a -> b
$ Maybe Pattern -> BoundName -> Binder
forall a. Maybe Pattern -> a -> Binder' a
Binder (Pattern -> Maybe Pattern
forall a. a -> Maybe a
Just Pattern
p) (BoundName -> Binder) -> BoundName -> Binder
forall a b. (a -> b) -> a -> b
$ Name -> BoundName
mkBoundName_ (Name -> BoundName) -> Name -> BoundName
forall a b. (a -> b) -> a -> b
$ Range -> Name -> Name
forall a. SetRange a => Range -> a -> a
setRange Range
r Name
simpleHole
  Pattern
_ -> Maybe Binder
forall a. Maybe a
Nothing

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

-- Null
------------------------------------------------------------------------

-- | A 'WhereClause' is 'null' when the @where@ keyword is absent.
--   An empty list of declarations does not count as 'null' here.

instance Null (WhereClause' a) where
  empty :: WhereClause' a
empty = WhereClause' a
forall a. WhereClause' a
NoWhere
  null :: WhereClause' a -> Bool
null WhereClause' a
NoWhere = Bool
True
  null AnyWhere{} = Bool
False
  null SomeWhere{} = Bool
False

-- Lenses
------------------------------------------------------------------------

instance LensHiding LamBinding where
  getHiding :: LamBinding -> Hiding
getHiding   (DomainFree NamedArg Binder
x) = NamedArg Binder -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding NamedArg Binder
x
  getHiding   (DomainFull TypedBinding
a) = TypedBinding -> Hiding
forall a. LensHiding a => a -> Hiding
getHiding TypedBinding
a
  mapHiding :: (Hiding -> Hiding) -> LamBinding -> LamBinding
mapHiding Hiding -> Hiding
f (DomainFree NamedArg Binder
x) = NamedArg Binder -> LamBinding
forall a. NamedArg Binder -> LamBinding' a
DomainFree (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
a) = TypedBinding -> LamBinding
forall a. a -> LamBinding' a
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
a

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

instance LensRelevance TypedBinding where
  getRelevance :: TypedBinding -> Relevance
getRelevance (TBind Range
_ (NamedArg Binder
x :|[NamedArg Binder]
_) Expr
_) = NamedArg Binder -> Relevance
forall a. LensRelevance a => a -> Relevance
getRelevance NamedArg Binder
x   -- Slightly dubious
  getRelevance TLet{}              = Relevance
unitRelevance
  mapRelevance :: (Relevance -> Relevance) -> TypedBinding -> TypedBinding
mapRelevance Relevance -> Relevance
f (TBind Range
r List1 (NamedArg Binder)
xs Expr
e) = Range -> List1 (NamedArg Binder) -> Expr -> TypedBinding
forall e. Range -> List1 (NamedArg Binder) -> e -> TypedBinding' e
TBind Range
r ((NamedArg Binder -> NamedArg Binder)
-> List1 (NamedArg Binder) -> List1 (NamedArg Binder)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Relevance -> Relevance) -> NamedArg Binder -> NamedArg Binder
forall a. LensRelevance a => (Relevance -> Relevance) -> a -> a
mapRelevance Relevance -> Relevance
f) List1 (NamedArg Binder)
xs) Expr
e
  mapRelevance Relevance -> Relevance
f b :: TypedBinding
b@TLet{}       = TypedBinding
b

-- HasRange instances
------------------------------------------------------------------------

instance HasRange e => HasRange (OpApp e) where
  getRange :: OpApp e -> Range
getRange = \case
    Ordinary e
e -> e -> Range
forall a. HasRange a => a -> Range
getRange e
e
    SyntaxBindingLambda Range
r List1 LamBinding
_ e
_ -> Range
r

instance HasRange Expr where
  getRange :: Expr -> Range
getRange = \case
      Ident QName
x            -> QName -> Range
forall a. HasRange a => a -> Range
getRange QName
x
      Lit Range
r Literal
_            -> Range
r
      QuestionMark Range
r Maybe Int
_   -> Range
r
      Underscore Range
r Maybe String
_     -> Range
r
      App Range
r Expr
_ NamedArg Expr
_          -> Range
r
      RawApp Range
r List2 Expr
_         -> Range
r
      OpApp Range
r QName
_ Set Name
_ OpAppArgs
_      -> Range
r
      WithApp Range
r Expr
_ [Expr]
_      -> Range
r
      Lam Range
r List1 LamBinding
_ Expr
_          -> Range
r
      AbsurdLam Range
r Hiding
_      -> Range
r
      ExtendedLam Range
r Erased
_ List1 LamClause
_  -> Range
r
      Fun Range
r Arg Expr
_ Expr
_          -> Range
r
      Pi Telescope1
b Expr
e             -> Telescope1 -> Expr -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange Telescope1
b Expr
e
      Let Range
r List1 Declaration
_ Maybe Expr
_          -> Range
r
      Paren Range
r Expr
_          -> Range
r
      IdiomBrackets Range
r [Expr]
_  -> Range
r
      DoBlock Range
r List1 DoStmt
_        -> Range
r
      As Range
r Name
_ Expr
_           -> Range
r
      Dot Range
r Expr
_            -> Range
r
      DoubleDot Range
r Expr
_      -> Range
r
      Absurd Range
r           -> Range
r
      HiddenArg Range
r Named_ Expr
_      -> Range
r
      InstanceArg Range
r Named_ Expr
_    -> Range
r
      Rec Range
r RecordAssignments
_            -> Range
r
      RecUpdate Range
r Expr
_ [FieldAssignment]
_    -> Range
r
      ETel Telescope
tel           -> Telescope -> Range
forall a. HasRange a => a -> Range
getRange Telescope
tel
      Quote Range
r            -> Range
r
      QuoteTerm Range
r        -> Range
r
      Unquote Range
r          -> Range
r
      Tactic Range
r Expr
_         -> Range
r
      DontCare{}         -> Range
forall a. Range' a
noRange
      Equal Range
r Expr
_ Expr
_        -> Range
r
      Ellipsis Range
r         -> Range
r
      Generalized Expr
e      -> Expr -> Range
forall a. HasRange a => a -> Range
getRange Expr
e

-- instance HasRange Telescope where
--     getRange (TeleBind bs) = getRange bs
--     getRange (TeleFun x y) = fuseRange x y

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

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

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

instance HasRange BoundName where
  getRange :: BoundName -> Range
getRange = Name -> Range
forall a. HasRange a => a -> Range
getRange (Name -> Range) -> (BoundName -> Name) -> BoundName -> Range
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BoundName -> Name
boundName

instance HasRange WhereClause where
  getRange :: WhereClause -> Range
getRange  WhereClause
NoWhere             = Range
forall a. Range' a
noRange
  getRange (AnyWhere Range
r [Declaration]
ds)      = (Range, [Declaration]) -> Range
forall a. HasRange a => a -> Range
getRange (Range
r, [Declaration]
ds)
  getRange (SomeWhere Range
r Name
x Access
_ [Declaration]
ds) = (Range, Name, [Declaration]) -> Range
forall a. HasRange a => a -> Range
getRange (Range
r, Name
x, [Declaration]
ds)

instance HasRange ModuleApplication where
  getRange :: ModuleApplication -> Range
getRange (SectionApp Range
r Telescope
_ Expr
_) = Range
r
  getRange (RecordModuleInstance Range
r QName
_) = Range
r

instance HasRange a => HasRange (FieldAssignment' a) where
  getRange :: FieldAssignment' a -> Range
getRange (FieldAssignment Name
a a
b) = Name -> a -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange Name
a a
b

instance HasRange ModuleAssignment where
  getRange :: ModuleAssignment -> Range
getRange (ModuleAssignment QName
a [Expr]
b ImportDirective
c) = QName -> [Expr] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange QName
a [Expr]
b Range -> ImportDirective -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` ImportDirective
c

instance HasRange RecordDirective where
  getRange :: RecordDirective -> Range
getRange (Induction Ranged Induction
a)          = Ranged Induction -> Range
forall a. HasRange a => a -> Range
getRange Ranged Induction
a
  getRange (Eta Ranged HasEta0
a    )            = Ranged HasEta0 -> Range
forall a. HasRange a => a -> Range
getRange Ranged HasEta0
a
  getRange (Constructor Name
a IsInstance
b)      = (Name, IsInstance) -> Range
forall a. HasRange a => a -> Range
getRange (Name
a, IsInstance
b)
  getRange (PatternOrCopattern Range
r) = Range
r

instance HasRange Declaration where
  getRange :: Declaration -> Range
getRange (TypeSig ArgInfo
_ Maybe Expr
_ Name
x Expr
t)       = Name -> Expr -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange Name
x Expr
t
  getRange (FieldSig IsInstance
_ Maybe Expr
_ Name
x Arg Expr
t)      = Name -> Arg Expr -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange Name
x Arg Expr
t
  getRange (Field Range
r [Declaration]
_)             = Range
r
  getRange (FunClause LHS
lhs RHS
rhs WhereClause
wh Bool
_) = LHS -> RHS -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange LHS
lhs RHS
rhs Range -> WhereClause -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` WhereClause
wh
  getRange (DataSig Range
r Name
_ [LamBinding]
_ Expr
_)       = Range
r
  getRange (Data Range
r Name
_ [LamBinding]
_ Expr
_ [Declaration]
_)        = Range
r
  getRange (DataDef Range
r Name
_ [LamBinding]
_ [Declaration]
_)       = Range
r
  getRange (RecordSig Range
r Name
_ [LamBinding]
_ Expr
_)     = Range
r
  getRange (RecordDef Range
r Name
_ RecordDirectives
_ [LamBinding]
_ [Declaration]
_)   = Range
r
  getRange (Record Range
r Name
_ RecordDirectives
_ [LamBinding]
_ Expr
_ [Declaration]
_)    = Range
r
  getRange (RecordDirective RecordDirective
r)     = RecordDirective -> Range
forall a. HasRange a => a -> Range
getRange RecordDirective
r
  getRange (Mutual Range
r [Declaration]
_)            = Range
r
  getRange (InterleavedMutual Range
r [Declaration]
_) = Range
r
  getRange (LoneConstructor Range
r [Declaration]
_)   = Range
r
  getRange (Abstract Range
r [Declaration]
_)          = Range
r
  getRange (Generalize Range
r [Declaration]
_)        = Range
r
  getRange (Open Range
r QName
_ ImportDirective
_)            = Range
r
  getRange (ModuleMacro Range
r Name
_ ModuleApplication
_ OpenShortHand
_ ImportDirective
_) = Range
r
  getRange (Import Range
r QName
_ Maybe AsName
_ OpenShortHand
_ ImportDirective
_)      = Range
r
  getRange (InstanceB Range
r [Declaration]
_)         = Range
r
  getRange (Macro Range
r [Declaration]
_)             = Range
r
  getRange (Private Range
r Origin
_ [Declaration]
_)         = Range
r
  getRange (Postulate Range
r [Declaration]
_)         = Range
r
  getRange (Primitive Range
r [Declaration]
_)         = Range
r
  getRange (Module Range
r QName
_ Telescope
_ [Declaration]
_)        = Range
r
  getRange (Infix Fixity
f List1 Name
_)             = Fixity -> Range
forall a. HasRange a => a -> Range
getRange Fixity
f
  getRange (Syntax Name
n Notation
_)            = Name -> Range
forall a. HasRange a => a -> Range
getRange Name
n
  getRange (PatternSyn Range
r Name
_ [Arg Name]
_ Pattern
_)    = Range
r
  getRange (UnquoteDecl Range
r [Name]
_ Expr
_)     = Range
r
  getRange (UnquoteDef Range
r [Name]
_ Expr
_)      = Range
r
  getRange (Pragma Pragma
p)              = Pragma -> Range
forall a. HasRange a => a -> Range
getRange Pragma
p

instance HasRange LHS where
  getRange :: LHS -> Range
getRange (LHS Pattern
p [RewriteEqn]
eqns [WithExpr]
ws) = Pattern
p Pattern -> [RewriteEqn] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` [RewriteEqn]
eqns Range -> [WithExpr] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` [WithExpr]
ws

instance HasRange LHSCore where
  getRange :: LHSCore -> Range
getRange (LHSHead QName
f [NamedArg Pattern]
ps)              = QName -> [NamedArg Pattern] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange QName
f [NamedArg Pattern]
ps
  getRange (LHSProj QName
d [NamedArg Pattern]
ps1 NamedArg LHSCore
lhscore [NamedArg Pattern]
ps2) = QName
d QName -> [NamedArg Pattern] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` [NamedArg Pattern]
ps1 Range -> NamedArg LHSCore -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` NamedArg LHSCore
lhscore Range -> [NamedArg Pattern] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` [NamedArg Pattern]
ps2
  getRange (LHSWith LHSCore
f [Pattern]
wps [NamedArg Pattern]
ps)          = LHSCore
f LHSCore -> [Pattern] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` [Pattern]
wps Range -> [NamedArg Pattern] -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
`fuseRange` [NamedArg Pattern]
ps
  getRange (LHSEllipsis Range
r LHSCore
p)           = Range
r

instance HasRange RHS where
  getRange :: RHS -> Range
getRange RHS
AbsurdRHS = Range
forall a. Range' a
noRange
  getRange (RHS Expr
e)   = Expr -> Range
forall a. HasRange a => a -> Range
getRange Expr
e

instance HasRange LamClause where
  getRange :: LamClause -> Range
getRange (LamClause [Pattern]
lhs RHS
rhs Bool
_) = ([Pattern], RHS) -> Range
forall a. HasRange a => a -> Range
getRange ([Pattern]
lhs, RHS
rhs)

instance HasRange DoStmt where
  getRange :: DoStmt -> Range
getRange (DoBind Range
r Pattern
_ Expr
_ [LamClause]
_) = Range
r
  getRange (DoThen Expr
e)       = Expr -> Range
forall a. HasRange a => a -> Range
getRange Expr
e
  getRange (DoLet Range
r List1 Declaration
_)      = Range
r

instance HasRange Pragma where
  getRange :: Pragma -> Range
getRange (OptionsPragma Range
r [String]
_)               = Range
r
  getRange (BuiltinPragma Range
r Ranged String
_ QName
_)             = Range
r
  getRange (RewritePragma Range
r Range
_ [QName]
_)             = Range
r
  getRange (CompilePragma Range
r Ranged String
_ QName
_ String
_)           = Range
r
  getRange (ForeignPragma Range
r Ranged String
_ String
_)             = Range
r
  getRange (StaticPragma Range
r QName
_)                = Range
r
  getRange (InjectivePragma Range
r QName
_)             = Range
r
  getRange (InlinePragma Range
r Bool
_ QName
_)              = Range
r
  getRange (ImpossiblePragma Range
r [String]
_)            = Range
r
  getRange (EtaPragma Range
r QName
_)                   = Range
r
  getRange (TerminationCheckPragma Range
r TerminationCheck Name
_)      = Range
r
  getRange (NoCoverageCheckPragma Range
r)         = Range
r
  getRange (WarningOnUsage Range
r QName
_ Text
_)            = Range
r
  getRange (WarningOnImport Range
r Text
_)             = Range
r
  getRange (CatchallPragma Range
r)                = Range
r
  getRange (DisplayPragma Range
r Pattern
_ Expr
_)             = Range
r
  getRange (NoPositivityCheckPragma Range
r)       = Range
r
  getRange (PolarityPragma Range
r Name
_ [Occurrence]
_)            = Range
r
  getRange (NoUniverseCheckPragma Range
r)         = Range
r

instance HasRange AsName where
  getRange :: AsName -> Range
getRange AsName
a = (Range, Either Expr Name) -> Range
forall a. HasRange a => a -> Range
getRange (AsName -> Range
forall a. AsName' a -> Range
asRange AsName
a, AsName -> Either Expr Name
forall a. AsName' a -> a
asName AsName
a)

instance HasRange Pattern where
  getRange :: Pattern -> Range
getRange (IdentP QName
x)         = QName -> Range
forall a. HasRange a => a -> Range
getRange QName
x
  getRange (AppP Pattern
p NamedArg Pattern
q)         = Pattern -> NamedArg Pattern -> Range
forall u t. (HasRange u, HasRange t) => u -> t -> Range
fuseRange Pattern
p NamedArg Pattern
q
  getRange (OpAppP Range
r QName
_ Set Name
_ [NamedArg Pattern]
_)   = Range
r
  getRange (RawAppP Range
r List2 Pattern
_)      = Range
r
  getRange (ParenP Range
r Pattern
_)       = Range
r
  getRange (WildP Range
r)          = Range
r
  getRange (AsP Range
r Name
_ Pattern
_)        = Range
r
  getRange (AbsurdP Range
r)        = Range
r
  getRange (LitP Range
r Literal
_)         = Range
r
  getRange (QuoteP Range
r)         = Range
r
  getRange (HiddenP Range
r Named_ Pattern
_)      = Range
r
  getRange (InstanceP Range
r Named_ Pattern
_)    = Range
r
  getRange (DotP Range
r Expr
_)         = Range
r
  getRange (RecP Range
r [FieldAssignment' Pattern]
_)         = Range
r
  getRange (EqualP Range
r [(Expr, Expr)]
_)       = Range
r
  getRange (EllipsisP Range
r Maybe Pattern
_)    = Range
r
  getRange (WithP Range
r Pattern
_)        = Range
r

-- SetRange instances
------------------------------------------------------------------------

instance SetRange Pattern where
  setRange :: Range -> Pattern -> Pattern
setRange Range
r (IdentP QName
x)         = QName -> Pattern
IdentP (Range -> QName -> QName
forall a. SetRange a => Range -> a -> a
setRange Range
r QName
x)
  setRange Range
r (AppP Pattern
p NamedArg Pattern
q)         = Pattern -> NamedArg Pattern -> Pattern
AppP (Range -> Pattern -> Pattern
forall a. SetRange a => Range -> a -> a
setRange Range
r Pattern
p) (Range -> NamedArg Pattern -> NamedArg Pattern
forall a. SetRange a => Range -> a -> a
setRange Range
r NamedArg Pattern
q)
  setRange Range
r (OpAppP Range
_ QName
x Set Name
ns [NamedArg Pattern]
ps) = Range -> QName -> Set Name -> [NamedArg Pattern] -> Pattern
OpAppP Range
r QName
x Set Name
ns [NamedArg Pattern]
ps
  setRange Range
r (RawAppP Range
_ List2 Pattern
ps)     = Range -> List2 Pattern -> Pattern
RawAppP Range
r List2 Pattern
ps
  setRange Range
r (ParenP Range
_ Pattern
p)       = Range -> Pattern -> Pattern
ParenP Range
r Pattern
p
  setRange Range
r (WildP Range
_)          = Range -> Pattern
WildP Range
r
  setRange Range
r (AsP Range
_ Name
x Pattern
p)        = Range -> Name -> Pattern -> Pattern
AsP Range
r (Range -> Name -> Name
forall a. SetRange a => Range -> a -> a
setRange Range
r Name
x) Pattern
p
  setRange Range
r (AbsurdP Range
_)        = Range -> Pattern
AbsurdP Range
r
  setRange Range
r (LitP Range
_ Literal
l)         = Range -> Literal -> Pattern
LitP Range
r Literal
l
  setRange Range
r (QuoteP Range
_)         = Range -> Pattern
QuoteP Range
r
  setRange Range
r (HiddenP Range
_ Named_ Pattern
p)      = Range -> Named_ Pattern -> Pattern
HiddenP Range
r Named_ Pattern
p
  setRange Range
r (InstanceP Range
_ Named_ Pattern
p)    = Range -> Named_ Pattern -> Pattern
InstanceP Range
r Named_ Pattern
p
  setRange Range
r (DotP Range
_ Expr
e)         = Range -> Expr -> Pattern
DotP Range
r Expr
e
  setRange Range
r (RecP Range
_ [FieldAssignment' Pattern]
fs)        = Range -> [FieldAssignment' Pattern] -> Pattern
RecP Range
r [FieldAssignment' Pattern]
fs
  setRange Range
r (EqualP Range
_ [(Expr, Expr)]
es)      = Range -> [(Expr, Expr)] -> Pattern
EqualP Range
r [(Expr, Expr)]
es
  setRange Range
r (EllipsisP Range
_ Maybe Pattern
mp)   = Range -> Maybe Pattern -> Pattern
EllipsisP Range
r Maybe Pattern
mp
  setRange Range
r (WithP Range
_ Pattern
p)        = Range -> Pattern -> Pattern
WithP Range
r Pattern
p

instance SetRange TypedBinding where
  setRange :: Range -> TypedBinding -> TypedBinding
setRange Range
r (TBind Range
_ List1 (NamedArg Binder)
xs Expr
e) = Range -> List1 (NamedArg Binder) -> Expr -> TypedBinding
forall e. Range -> List1 (NamedArg Binder) -> e -> TypedBinding' e
TBind Range
r List1 (NamedArg Binder)
xs Expr
e
  setRange Range
r (TLet Range
_ List1 Declaration
ds)    = Range -> List1 Declaration -> TypedBinding
forall e. Range -> List1 Declaration -> TypedBinding' e
TLet Range
r List1 Declaration
ds

-- KillRange instances
------------------------------------------------------------------------

instance KillRange a => KillRange (FieldAssignment' a) where
  killRange :: KillRangeT (FieldAssignment' a)
killRange (FieldAssignment Name
a a
b) = (Name -> a -> FieldAssignment' a)
-> Name -> a -> FieldAssignment' a
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Name -> a -> FieldAssignment' a
forall a. Name -> a -> FieldAssignment' a
FieldAssignment Name
a a
b

instance KillRange ModuleAssignment where
  killRange :: ModuleAssignment -> ModuleAssignment
killRange (ModuleAssignment QName
a [Expr]
b ImportDirective
c) = (QName -> [Expr] -> ImportDirective -> ModuleAssignment)
-> QName -> [Expr] -> ImportDirective -> ModuleAssignment
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 QName -> [Expr] -> ImportDirective -> ModuleAssignment
ModuleAssignment QName
a [Expr]
b ImportDirective
c

instance KillRange AsName where
  killRange :: KillRangeT AsName
killRange (AsName Either Expr Name
n Range
_) = (Either Expr Name -> AsName) -> Either Expr Name -> AsName
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 ((Either Expr Name -> Range -> AsName)
-> Range -> Either Expr Name -> AsName
forall a b c. (a -> b -> c) -> b -> a -> c
flip Either Expr Name -> Range -> AsName
forall a. a -> Range -> AsName' a
AsName Range
forall a. Range' a
noRange) Either Expr Name
n

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

instance KillRange BoundName where
  killRange :: BoundName -> BoundName
killRange (BName Name
n Fixity'
f Maybe Expr
t) = (Name -> Fixity' -> Maybe Expr -> BoundName)
-> Name -> Fixity' -> Maybe Expr -> BoundName
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 Name -> Fixity' -> Maybe Expr -> BoundName
BName Name
n Fixity'
f Maybe Expr
t

instance KillRange RecordDirective where
  killRange :: RecordDirective -> RecordDirective
killRange (Induction Ranged Induction
a)          = (Ranged Induction -> RecordDirective)
-> Ranged Induction -> RecordDirective
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Ranged Induction -> RecordDirective
Induction Ranged Induction
a
  killRange (Eta Ranged HasEta0
a    )            = (Ranged HasEta0 -> RecordDirective)
-> Ranged HasEta0 -> RecordDirective
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Ranged HasEta0 -> RecordDirective
Eta Ranged HasEta0
a
  killRange (Constructor Name
a IsInstance
b)      = (Name -> IsInstance -> RecordDirective)
-> Name -> IsInstance -> RecordDirective
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Name -> IsInstance -> RecordDirective
Constructor Name
a IsInstance
b
  killRange (PatternOrCopattern Range
_) = Range -> RecordDirective
PatternOrCopattern Range
forall a. Range' a
noRange

instance KillRange Declaration where
  killRange :: Declaration -> Declaration
killRange (TypeSig ArgInfo
i Maybe Expr
t Name
n Expr
e)       = (Maybe Expr -> Name -> Expr -> Declaration)
-> Maybe Expr -> Name -> Expr -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (ArgInfo -> Maybe Expr -> Name -> Expr -> Declaration
TypeSig ArgInfo
i) Maybe Expr
t Name
n Expr
e
  killRange (FieldSig IsInstance
i Maybe Expr
t Name
n Arg Expr
e)      = (IsInstance -> Maybe Expr -> Name -> Arg Expr -> Declaration)
-> IsInstance -> Maybe Expr -> Name -> Arg 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 IsInstance -> Maybe Expr -> Name -> Arg Expr -> Declaration
FieldSig IsInstance
i Maybe Expr
t Name
n Arg Expr
e
  killRange (Generalize Range
r [Declaration]
ds )      = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> Declaration
Generalize Range
forall a. Range' a
noRange) [Declaration]
ds
  killRange (Field Range
r [Declaration]
fs)            = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> Declaration
Field Range
forall a. Range' a
noRange) [Declaration]
fs
  killRange (FunClause LHS
l RHS
r WhereClause
w Bool
ca)    = (LHS -> RHS -> WhereClause -> Bool -> Declaration)
-> LHS -> RHS -> WhereClause -> Bool -> 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 LHS -> RHS -> WhereClause -> Bool -> Declaration
FunClause LHS
l RHS
r WhereClause
w Bool
ca
  killRange (DataSig Range
_ Name
n [LamBinding]
l Expr
e)       = (Name -> [LamBinding] -> Expr -> Declaration)
-> Name -> [LamBinding] -> Expr -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (Range -> Name -> [LamBinding] -> Expr -> Declaration
DataSig Range
forall a. Range' a
noRange) Name
n [LamBinding]
l Expr
e
  killRange (Data Range
_ Name
n [LamBinding]
l Expr
e [Declaration]
c)        = (Name -> [LamBinding] -> Expr -> [Declaration] -> Declaration)
-> Name -> [LamBinding] -> Expr -> [Declaration] -> Declaration
forall a b c d e.
(KillRange a, KillRange b, KillRange c, KillRange d) =>
(a -> b -> c -> d -> e) -> a -> b -> c -> d -> e
killRange4 (Range
-> Name -> [LamBinding] -> Expr -> [Declaration] -> Declaration
Data Range
forall a. Range' a
noRange) Name
n [LamBinding]
l Expr
e [Declaration]
c
  killRange (DataDef Range
_ Name
n [LamBinding]
l [Declaration]
c)       = (Name -> [LamBinding] -> [Declaration] -> Declaration)
-> Name -> [LamBinding] -> [Declaration] -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (Range -> Name -> [LamBinding] -> [Declaration] -> Declaration
DataDef Range
forall a. Range' a
noRange) Name
n [LamBinding]
l [Declaration]
c
  killRange (RecordSig Range
_ Name
n [LamBinding]
l Expr
e)     = (Name -> [LamBinding] -> Expr -> Declaration)
-> Name -> [LamBinding] -> Expr -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (Range -> Name -> [LamBinding] -> Expr -> Declaration
RecordSig Range
forall a. Range' a
noRange) Name
n [LamBinding]
l Expr
e
  killRange (RecordDef Range
_ Name
n RecordDirectives
dir [LamBinding]
k [Declaration]
d) = (Name
 -> RecordDirectives
 -> [LamBinding]
 -> [Declaration]
 -> Declaration)
-> Name
-> RecordDirectives
-> [LamBinding]
-> [Declaration]
-> Declaration
forall a b c d e.
(KillRange a, KillRange b, KillRange c, KillRange d) =>
(a -> b -> c -> d -> e) -> a -> b -> c -> d -> e
killRange4 (Range
-> Name
-> RecordDirectives
-> [LamBinding]
-> [Declaration]
-> Declaration
RecordDef Range
forall a. Range' a
noRange) Name
n RecordDirectives
dir [LamBinding]
k [Declaration]
d
  killRange (RecordDirective RecordDirective
a)     = (RecordDirective -> Declaration) -> RecordDirective -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 RecordDirective -> Declaration
RecordDirective RecordDirective
a
  killRange (Record Range
_ Name
n RecordDirectives
dir [LamBinding]
k Expr
e [Declaration]
d)  = (Name
 -> RecordDirectives
 -> [LamBinding]
 -> Expr
 -> [Declaration]
 -> Declaration)
-> Name
-> RecordDirectives
-> [LamBinding]
-> Expr
-> [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 (Range
-> Name
-> RecordDirectives
-> [LamBinding]
-> Expr
-> [Declaration]
-> Declaration
Record Range
forall a. Range' a
noRange) Name
n RecordDirectives
dir [LamBinding]
k Expr
e [Declaration]
d
  killRange (Infix Fixity
f List1 Name
n)             = (Fixity -> List1 Name -> Declaration)
-> Fixity -> List1 Name -> Declaration
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Fixity -> List1 Name -> Declaration
Infix Fixity
f List1 Name
n
  killRange (Syntax Name
n Notation
no)           = (Name -> Declaration) -> Name -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (\Name
n -> Name -> Notation -> Declaration
Syntax Name
n Notation
no) Name
n
  killRange (PatternSyn Range
_ Name
n [Arg Name]
ns Pattern
p)   = (Name -> [Arg Name] -> Pattern -> Declaration)
-> Name -> [Arg Name] -> Pattern -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (Range -> Name -> [Arg Name] -> Pattern -> Declaration
PatternSyn Range
forall a. Range' a
noRange) Name
n [Arg Name]
ns Pattern
p
  killRange (Mutual Range
_ [Declaration]
d)            = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> Declaration
Mutual Range
forall a. Range' a
noRange) [Declaration]
d
  killRange (InterleavedMutual Range
_ [Declaration]
d) = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> Declaration
InterleavedMutual Range
forall a. Range' a
noRange) [Declaration]
d
  killRange (LoneConstructor Range
_ [Declaration]
d)   = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> Declaration
LoneConstructor Range
forall a. Range' a
noRange) [Declaration]
d
  killRange (Abstract Range
_ [Declaration]
d)          = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> Declaration
Abstract Range
forall a. Range' a
noRange) [Declaration]
d
  killRange (Private Range
_ Origin
o [Declaration]
d)         = (Origin -> [Declaration] -> Declaration)
-> Origin -> [Declaration] -> Declaration
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> Origin -> [Declaration] -> Declaration
Private Range
forall a. Range' a
noRange) Origin
o [Declaration]
d
  killRange (InstanceB Range
_ [Declaration]
d)         = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> Declaration
InstanceB Range
forall a. Range' a
noRange) [Declaration]
d
  killRange (Macro Range
_ [Declaration]
d)             = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> Declaration
Macro Range
forall a. Range' a
noRange) [Declaration]
d
  killRange (Postulate Range
_ [Declaration]
t)         = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> Declaration
Postulate Range
forall a. Range' a
noRange) [Declaration]
t
  killRange (Primitive Range
_ [Declaration]
t)         = ([Declaration] -> Declaration) -> [Declaration] -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> Declaration
Primitive Range
forall a. Range' a
noRange) [Declaration]
t
  killRange (Open Range
_ QName
q ImportDirective
i)            = (QName -> ImportDirective -> Declaration)
-> QName -> ImportDirective -> Declaration
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> QName -> ImportDirective -> Declaration
Open Range
forall a. Range' a
noRange) QName
q ImportDirective
i
  killRange (Import Range
_ QName
q Maybe AsName
a OpenShortHand
o ImportDirective
i)      = (QName -> Maybe AsName -> ImportDirective -> Declaration)
-> QName -> Maybe AsName -> ImportDirective -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (\QName
q Maybe AsName
a -> Range
-> QName
-> Maybe AsName
-> OpenShortHand
-> ImportDirective
-> Declaration
Import Range
forall a. Range' a
noRange QName
q Maybe AsName
a OpenShortHand
o) QName
q Maybe AsName
a ImportDirective
i
  killRange (ModuleMacro Range
_ Name
n ModuleApplication
m OpenShortHand
o ImportDirective
i) = (Name -> ModuleApplication -> ImportDirective -> Declaration)
-> Name -> ModuleApplication -> ImportDirective -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (\Name
n ModuleApplication
m -> Range
-> Name
-> ModuleApplication
-> OpenShortHand
-> ImportDirective
-> Declaration
ModuleMacro Range
forall a. Range' a
noRange Name
n ModuleApplication
m OpenShortHand
o) Name
n ModuleApplication
m ImportDirective
i
  killRange (Module Range
_ QName
q Telescope
t [Declaration]
d)        = (QName -> Telescope -> [Declaration] -> Declaration)
-> QName -> Telescope -> [Declaration] -> Declaration
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (Range -> QName -> Telescope -> [Declaration] -> Declaration
Module Range
forall a. Range' a
noRange) QName
q Telescope
t [Declaration]
d
  killRange (UnquoteDecl Range
_ [Name]
x Expr
t)     = ([Name] -> Expr -> Declaration) -> [Name] -> Expr -> Declaration
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> [Name] -> Expr -> Declaration
UnquoteDecl Range
forall a. Range' a
noRange) [Name]
x Expr
t
  killRange (UnquoteDef Range
_ [Name]
x Expr
t)      = ([Name] -> Expr -> Declaration) -> [Name] -> Expr -> Declaration
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> [Name] -> Expr -> Declaration
UnquoteDef Range
forall a. Range' a
noRange) [Name]
x Expr
t
  killRange (Pragma Pragma
p)              = (Pragma -> Declaration) -> Pragma -> Declaration
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Pragma -> Declaration
Pragma Pragma
p

instance KillRange Expr where
  killRange :: Expr -> Expr
killRange (Ident QName
q)             = (QName -> Expr) -> QName -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 QName -> Expr
Ident QName
q
  killRange (Lit Range
_ Literal
l)             = (Literal -> Expr) -> Literal -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Literal -> Expr
Lit Range
forall a. Range' a
noRange) Literal
l
  killRange (QuestionMark Range
_ Maybe Int
n)    = Range -> Maybe Int -> Expr
QuestionMark Range
forall a. Range' a
noRange Maybe Int
n
  killRange (Underscore Range
_ Maybe String
n)      = Range -> Maybe String -> Expr
Underscore Range
forall a. Range' a
noRange Maybe String
n
  killRange (RawApp Range
_ List2 Expr
e)          = (List2 Expr -> Expr) -> List2 Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> List2 Expr -> Expr
RawApp Range
forall a. Range' a
noRange) List2 Expr
e
  killRange (App Range
_ Expr
e NamedArg Expr
a)           = (Expr -> NamedArg Expr -> Expr) -> Expr -> NamedArg Expr -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> Expr -> NamedArg Expr -> Expr
App Range
forall a. Range' a
noRange) Expr
e NamedArg Expr
a
  killRange (OpApp Range
_ QName
n Set Name
ns OpAppArgs
o)      = (QName -> Set Name -> OpAppArgs -> Expr)
-> QName -> Set Name -> OpAppArgs -> Expr
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (Range -> QName -> Set Name -> OpAppArgs -> Expr
OpApp Range
forall a. Range' a
noRange) QName
n Set Name
ns OpAppArgs
o
  killRange (WithApp Range
_ Expr
e [Expr]
es)      = (Expr -> [Expr] -> Expr) -> Expr -> [Expr] -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> Expr -> [Expr] -> Expr
WithApp Range
forall a. Range' a
noRange) Expr
e [Expr]
es
  killRange (HiddenArg Range
_ Named_ Expr
n)       = (Named_ Expr -> Expr) -> Named_ Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Named_ Expr -> Expr
HiddenArg Range
forall a. Range' a
noRange) Named_ Expr
n
  killRange (InstanceArg Range
_ Named_ Expr
n)     = (Named_ Expr -> Expr) -> Named_ Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Named_ Expr -> Expr
InstanceArg Range
forall a. Range' a
noRange) Named_ Expr
n
  killRange (Lam Range
_ List1 LamBinding
l Expr
e)           = (List1 LamBinding -> Expr -> Expr)
-> List1 LamBinding -> Expr -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> List1 LamBinding -> Expr -> Expr
Lam Range
forall a. Range' a
noRange) List1 LamBinding
l Expr
e
  killRange (AbsurdLam Range
_ Hiding
h)       = (Hiding -> Expr) -> Hiding -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Hiding -> Expr
AbsurdLam Range
forall a. Range' a
noRange) Hiding
h
  killRange (ExtendedLam Range
_ Erased
e List1 LamClause
lrw) = (Erased -> List1 LamClause -> Expr)
-> Erased -> List1 LamClause -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> Erased -> List1 LamClause -> Expr
ExtendedLam Range
forall a. Range' a
noRange) Erased
e List1 LamClause
lrw
  killRange (Fun Range
_ Arg Expr
e1 Expr
e2)         = (Arg Expr -> Expr -> Expr) -> Arg Expr -> Expr -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> Arg Expr -> Expr -> Expr
Fun Range
forall a. Range' a
noRange) Arg Expr
e1 Expr
e2
  killRange (Pi Telescope1
t Expr
e)              = (Telescope1 -> Expr -> Expr) -> Telescope1 -> Expr -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Telescope1 -> Expr -> Expr
Pi Telescope1
t Expr
e
  killRange (Rec Range
_ RecordAssignments
ne)            = (RecordAssignments -> Expr) -> RecordAssignments -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> RecordAssignments -> Expr
Rec Range
forall a. Range' a
noRange) RecordAssignments
ne
  killRange (RecUpdate Range
_ Expr
e [FieldAssignment]
ne)    = (Expr -> [FieldAssignment] -> Expr)
-> Expr -> [FieldAssignment] -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> Expr -> [FieldAssignment] -> Expr
RecUpdate Range
forall a. Range' a
noRange) Expr
e [FieldAssignment]
ne
  killRange (Let Range
_ List1 Declaration
d Maybe Expr
e)           = (List1 Declaration -> Maybe Expr -> Expr)
-> List1 Declaration -> Maybe Expr -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> List1 Declaration -> Maybe Expr -> Expr
Let Range
forall a. Range' a
noRange) List1 Declaration
d Maybe Expr
e
  killRange (Paren Range
_ Expr
e)           = (Expr -> Expr) -> Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Expr -> Expr
Paren Range
forall a. Range' a
noRange) Expr
e
  killRange (IdiomBrackets Range
_ [Expr]
es)  = ([Expr] -> Expr) -> [Expr] -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Expr] -> Expr
IdiomBrackets Range
forall a. Range' a
noRange) [Expr]
es
  killRange (DoBlock Range
_ List1 DoStmt
ss)        = (List1 DoStmt -> Expr) -> List1 DoStmt -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> List1 DoStmt -> Expr
DoBlock Range
forall a. Range' a
noRange) List1 DoStmt
ss
  killRange (Absurd Range
_)            = Range -> Expr
Absurd Range
forall a. Range' a
noRange
  killRange (As Range
_ Name
n Expr
e)            = (Name -> Expr -> Expr) -> Name -> Expr -> Expr
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> Name -> Expr -> Expr
As Range
forall a. Range' a
noRange) Name
n Expr
e
  killRange (Dot Range
_ Expr
e)             = (Expr -> Expr) -> Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Expr -> Expr
Dot Range
forall a. Range' a
noRange) Expr
e
  killRange (DoubleDot Range
_ Expr
e)       = (Expr -> Expr) -> Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Expr -> Expr
DoubleDot Range
forall a. Range' a
noRange) Expr
e
  killRange (ETel Telescope
t)              = (Telescope -> Expr) -> Telescope -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Telescope -> Expr
ETel Telescope
t
  killRange (Quote Range
_)             = Range -> Expr
Quote Range
forall a. Range' a
noRange
  killRange (QuoteTerm Range
_)         = Range -> Expr
QuoteTerm Range
forall a. Range' a
noRange
  killRange (Unquote Range
_)           = Range -> Expr
Unquote Range
forall a. Range' a
noRange
  killRange (Tactic Range
_ Expr
t)          = (Expr -> Expr) -> Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Expr -> Expr
Tactic Range
forall a. Range' a
noRange) Expr
t
  killRange (DontCare Expr
e)          = (Expr -> Expr) -> Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Expr -> Expr
DontCare Expr
e
  killRange (Equal Range
_ Expr
x Expr
y)         = Range -> Expr -> Expr -> Expr
Equal Range
forall a. Range' a
noRange Expr
x Expr
y
  killRange (Ellipsis Range
_)          = Range -> Expr
Ellipsis Range
forall a. Range' a
noRange
  killRange (Generalized Expr
e)       = (Expr -> Expr) -> Expr -> Expr
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Expr -> Expr
Generalized Expr
e

instance KillRange LamBinding where
  killRange :: LamBinding -> LamBinding
killRange (DomainFree NamedArg Binder
b) = (NamedArg Binder -> LamBinding) -> NamedArg Binder -> LamBinding
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 NamedArg Binder -> LamBinding
forall a. NamedArg Binder -> LamBinding' a
DomainFree NamedArg Binder
b
  killRange (DomainFull TypedBinding
t) = (TypedBinding -> LamBinding) -> TypedBinding -> LamBinding
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 TypedBinding -> LamBinding
forall a. a -> LamBinding' a
DomainFull TypedBinding
t

instance KillRange LHS where
  killRange :: LHS -> LHS
killRange (LHS Pattern
p [RewriteEqn]
r [WithExpr]
w)  = (Pattern -> [RewriteEqn] -> [WithExpr] -> LHS)
-> Pattern -> [RewriteEqn] -> [WithExpr] -> LHS
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 Pattern -> [RewriteEqn] -> [WithExpr] -> LHS
LHS Pattern
p [RewriteEqn]
r [WithExpr]
w

instance KillRange LamClause where
  killRange :: LamClause -> LamClause
killRange (LamClause [Pattern]
a RHS
b Bool
c) = ([Pattern] -> RHS -> Bool -> LamClause)
-> [Pattern] -> RHS -> Bool -> LamClause
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 [Pattern] -> RHS -> Bool -> LamClause
LamClause [Pattern]
a RHS
b Bool
c

instance KillRange DoStmt where
  killRange :: DoStmt -> DoStmt
killRange (DoBind Range
r Pattern
p Expr
e [LamClause]
w) = (Range -> Pattern -> Expr -> [LamClause] -> DoStmt)
-> Range -> Pattern -> Expr -> [LamClause] -> DoStmt
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 -> Pattern -> Expr -> [LamClause] -> DoStmt
DoBind Range
r Pattern
p Expr
e [LamClause]
w
  killRange (DoThen Expr
e)       = (Expr -> DoStmt) -> Expr -> DoStmt
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Expr -> DoStmt
DoThen Expr
e
  killRange (DoLet Range
r List1 Declaration
ds)     = (Range -> List1 Declaration -> DoStmt)
-> Range -> List1 Declaration -> DoStmt
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Range -> List1 Declaration -> DoStmt
DoLet Range
r List1 Declaration
ds

instance KillRange ModuleApplication where
  killRange :: ModuleApplication -> ModuleApplication
killRange (SectionApp Range
_ Telescope
t Expr
e)    = (Telescope -> Expr -> ModuleApplication)
-> Telescope -> Expr -> ModuleApplication
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> Telescope -> Expr -> ModuleApplication
SectionApp Range
forall a. Range' a
noRange) Telescope
t Expr
e
  killRange (RecordModuleInstance Range
_ QName
q) = (QName -> ModuleApplication) -> QName -> ModuleApplication
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> QName -> ModuleApplication
RecordModuleInstance Range
forall a. Range' a
noRange) QName
q

instance KillRange e => KillRange (OpApp e) where
  killRange :: KillRangeT (OpApp e)
killRange (SyntaxBindingLambda Range
_ List1 LamBinding
l e
e) = (List1 LamBinding -> e -> OpApp e)
-> List1 LamBinding -> e -> OpApp e
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> List1 LamBinding -> e -> OpApp e
forall e. Range -> List1 LamBinding -> e -> OpApp e
SyntaxBindingLambda Range
forall a. Range' a
noRange) List1 LamBinding
l e
e
  killRange (Ordinary e
e)                = (e -> OpApp e) -> e -> OpApp e
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 e -> OpApp e
forall e. e -> OpApp e
Ordinary e
e

instance KillRange Pattern where
  killRange :: Pattern -> Pattern
killRange (IdentP QName
q)        = (QName -> Pattern) -> QName -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 QName -> Pattern
IdentP QName
q
  killRange (AppP Pattern
p NamedArg Pattern
ps)       = (Pattern -> NamedArg Pattern -> Pattern)
-> Pattern -> NamedArg Pattern -> Pattern
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Pattern -> NamedArg Pattern -> Pattern
AppP Pattern
p NamedArg Pattern
ps
  killRange (RawAppP Range
_ List2 Pattern
p)     = (List2 Pattern -> Pattern) -> List2 Pattern -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> List2 Pattern -> Pattern
RawAppP Range
forall a. Range' a
noRange) List2 Pattern
p
  killRange (OpAppP Range
_ QName
n Set Name
ns [NamedArg Pattern]
p) = (QName -> Set Name -> [NamedArg Pattern] -> Pattern)
-> QName -> Set Name -> [NamedArg Pattern] -> Pattern
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (Range -> QName -> Set Name -> [NamedArg Pattern] -> Pattern
OpAppP Range
forall a. Range' a
noRange) QName
n Set Name
ns [NamedArg Pattern]
p
  killRange (HiddenP Range
_ Named_ Pattern
n)     = (Named_ Pattern -> Pattern) -> Named_ Pattern -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Named_ Pattern -> Pattern
HiddenP Range
forall a. Range' a
noRange) Named_ Pattern
n
  killRange (InstanceP Range
_ Named_ Pattern
n)   = (Named_ Pattern -> Pattern) -> Named_ Pattern -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Named_ Pattern -> Pattern
InstanceP Range
forall a. Range' a
noRange) Named_ Pattern
n
  killRange (ParenP Range
_ Pattern
p)      = (Pattern -> Pattern) -> Pattern -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Pattern -> Pattern
ParenP Range
forall a. Range' a
noRange) Pattern
p
  killRange (WildP Range
_)         = Range -> Pattern
WildP Range
forall a. Range' a
noRange
  killRange (AbsurdP Range
_)       = Range -> Pattern
AbsurdP Range
forall a. Range' a
noRange
  killRange (AsP Range
_ Name
n Pattern
p)       = (Name -> Pattern -> Pattern) -> Name -> Pattern -> Pattern
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> Name -> Pattern -> Pattern
AsP Range
forall a. Range' a
noRange) Name
n Pattern
p
  killRange (DotP Range
_ Expr
e)        = (Expr -> Pattern) -> Expr -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Expr -> Pattern
DotP Range
forall a. Range' a
noRange) Expr
e
  killRange (LitP Range
_ Literal
l)        = (Literal -> Pattern) -> Literal -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Literal -> Pattern
LitP Range
forall a. Range' a
noRange) Literal
l
  killRange (QuoteP Range
_)        = Range -> Pattern
QuoteP Range
forall a. Range' a
noRange
  killRange (RecP Range
_ [FieldAssignment' Pattern]
fs)       = ([FieldAssignment' Pattern] -> Pattern)
-> [FieldAssignment' Pattern] -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [FieldAssignment' Pattern] -> Pattern
RecP Range
forall a. Range' a
noRange) [FieldAssignment' Pattern]
fs
  killRange (EqualP Range
_ [(Expr, Expr)]
es)     = ([(Expr, Expr)] -> Pattern) -> [(Expr, Expr)] -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [(Expr, Expr)] -> Pattern
EqualP Range
forall a. Range' a
noRange) [(Expr, Expr)]
es
  killRange (EllipsisP Range
_ Maybe Pattern
mp)  = (Maybe Pattern -> Pattern) -> Maybe Pattern -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Maybe Pattern -> Pattern
EllipsisP Range
forall a. Range' a
noRange) Maybe Pattern
mp
  killRange (WithP Range
_ Pattern
p)       = (Pattern -> Pattern) -> Pattern -> Pattern
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Pattern -> Pattern
WithP Range
forall a. Range' a
noRange) Pattern
p

instance KillRange Pragma where
  killRange :: Pragma -> Pragma
killRange (OptionsPragma Range
_ [String]
s)               = Range -> [String] -> Pragma
OptionsPragma Range
forall a. Range' a
noRange [String]
s
  killRange (BuiltinPragma Range
_ Ranged String
s QName
e)             = (QName -> Pragma) -> QName -> Pragma
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Ranged String -> QName -> Pragma
BuiltinPragma Range
forall a. Range' a
noRange Ranged String
s) QName
e
  killRange (RewritePragma Range
_ Range
_ [QName]
qs)            = ([QName] -> Pragma) -> [QName] -> Pragma
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Range -> [QName] -> Pragma
RewritePragma Range
forall a. Range' a
noRange Range
forall a. Range' a
noRange) [QName]
qs
  killRange (StaticPragma Range
_ QName
q)                = (QName -> Pragma) -> QName -> Pragma
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> QName -> Pragma
StaticPragma Range
forall a. Range' a
noRange) QName
q
  killRange (InjectivePragma Range
_ QName
q)             = (QName -> Pragma) -> QName -> Pragma
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> QName -> Pragma
InjectivePragma Range
forall a. Range' a
noRange) QName
q
  killRange (InlinePragma Range
_ Bool
b QName
q)              = (QName -> Pragma) -> QName -> Pragma
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> Bool -> QName -> Pragma
InlinePragma Range
forall a. Range' a
noRange Bool
b) QName
q
  killRange (CompilePragma Range
_ Ranged String
b QName
q String
s)           = (QName -> Pragma) -> QName -> Pragma
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (\ QName
q -> Range -> Ranged String -> QName -> String -> Pragma
CompilePragma Range
forall a. Range' a
noRange Ranged String
b QName
q String
s) QName
q
  killRange (ForeignPragma Range
_ Ranged String
b String
s)             = Range -> Ranged String -> String -> Pragma
ForeignPragma Range
forall a. Range' a
noRange Ranged String
b String
s
  killRange (ImpossiblePragma Range
_ [String]
strs)         = Range -> [String] -> Pragma
ImpossiblePragma Range
forall a. Range' a
noRange [String]
strs
  killRange (TerminationCheckPragma Range
_ TerminationCheck Name
t)      = Range -> TerminationCheck Name -> Pragma
TerminationCheckPragma Range
forall a. Range' a
noRange (KillRangeT (TerminationCheck Name)
forall a. KillRange a => KillRangeT a
killRange TerminationCheck Name
t)
  killRange (NoCoverageCheckPragma Range
_)         = Range -> Pragma
NoCoverageCheckPragma Range
forall a. Range' a
noRange
  killRange (WarningOnUsage Range
_ QName
nm Text
str)         = Range -> QName -> Text -> Pragma
WarningOnUsage Range
forall a. Range' a
noRange (QName -> QName
forall a. KillRange a => KillRangeT a
killRange QName
nm) Text
str
  killRange (WarningOnImport Range
_ Text
str)           = Range -> Text -> Pragma
WarningOnImport Range
forall a. Range' a
noRange Text
str
  killRange (CatchallPragma Range
_)                = Range -> Pragma
CatchallPragma Range
forall a. Range' a
noRange
  killRange (DisplayPragma Range
_ Pattern
lhs Expr
rhs)         = (Pattern -> Expr -> Pragma) -> Pattern -> Expr -> Pragma
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> Pattern -> Expr -> Pragma
DisplayPragma Range
forall a. Range' a
noRange) Pattern
lhs Expr
rhs
  killRange (EtaPragma Range
_ QName
q)                   = (QName -> Pragma) -> QName -> Pragma
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> QName -> Pragma
EtaPragma Range
forall a. Range' a
noRange) QName
q
  killRange (NoPositivityCheckPragma Range
_)       = Range -> Pragma
NoPositivityCheckPragma Range
forall a. Range' a
noRange
  killRange (PolarityPragma Range
_ Name
q [Occurrence]
occs)         = (Name -> Pragma) -> Name -> Pragma
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (\Name
q -> Range -> Name -> [Occurrence] -> Pragma
PolarityPragma Range
forall a. Range' a
noRange Name
q [Occurrence]
occs) Name
q
  killRange (NoUniverseCheckPragma Range
_)         = Range -> Pragma
NoUniverseCheckPragma Range
forall a. Range' a
noRange

instance KillRange RHS where
  killRange :: KillRangeT RHS
killRange RHS
AbsurdRHS = RHS
forall e. RHS' e
AbsurdRHS
  killRange (RHS Expr
e)   = (Expr -> RHS) -> Expr -> RHS
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 Expr -> RHS
forall e. e -> RHS' e
RHS Expr
e

instance KillRange TypedBinding where
  killRange :: TypedBinding -> TypedBinding
killRange (TBind Range
_ List1 (NamedArg Binder)
b Expr
e) = (List1 (NamedArg Binder) -> Expr -> TypedBinding)
-> List1 (NamedArg Binder) -> Expr -> TypedBinding
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 (Range -> List1 (NamedArg Binder) -> Expr -> TypedBinding
forall e. Range -> List1 (NamedArg Binder) -> e -> TypedBinding' e
TBind Range
forall a. Range' a
noRange) List1 (NamedArg Binder)
b Expr
e
  killRange (TLet Range
r List1 Declaration
ds)   = (Range -> List1 Declaration -> TypedBinding)
-> Range -> List1 Declaration -> TypedBinding
forall a b c.
(KillRange a, KillRange b) =>
(a -> b -> c) -> a -> b -> c
killRange2 Range -> List1 Declaration -> TypedBinding
forall e. Range -> List1 Declaration -> TypedBinding' e
TLet Range
r List1 Declaration
ds

instance KillRange WhereClause where
  killRange :: KillRangeT WhereClause
killRange WhereClause
NoWhere             = WhereClause
forall a. WhereClause' a
NoWhere
  killRange (AnyWhere Range
r [Declaration]
d)      = ([Declaration] -> WhereClause) -> [Declaration] -> WhereClause
forall a b. KillRange a => (a -> b) -> a -> b
killRange1 (Range -> [Declaration] -> WhereClause
forall decls. Range -> decls -> WhereClause' decls
AnyWhere Range
forall a. Range' a
noRange) [Declaration]
d
  killRange (SomeWhere Range
r Name
n Access
a [Declaration]
d) = (Name -> Access -> [Declaration] -> WhereClause)
-> Name -> Access -> [Declaration] -> WhereClause
forall a b c d.
(KillRange a, KillRange b, KillRange c) =>
(a -> b -> c -> d) -> a -> b -> c -> d
killRange3 (Range -> Name -> Access -> [Declaration] -> WhereClause
forall decls.
Range -> Name -> Access -> decls -> WhereClause' decls
SomeWhere Range
forall a. Range' a
noRange) Name
n Access
a [Declaration]
d

------------------------------------------------------------------------
-- NFData instances

-- | Ranges are not forced.

instance NFData Expr where
  rnf :: Expr -> ()
rnf (Ident QName
a)           = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a
  rnf (Lit Range
_ Literal
a)           = Literal -> ()
forall a. NFData a => a -> ()
rnf Literal
a
  rnf (QuestionMark Range
_ Maybe Int
a)  = Maybe Int -> ()
forall a. NFData a => a -> ()
rnf Maybe Int
a
  rnf (Underscore Range
_ Maybe String
a)    = Maybe String -> ()
forall a. NFData a => a -> ()
rnf Maybe String
a
  rnf (RawApp Range
_ List2 Expr
a)        = List2 Expr -> ()
forall a. NFData a => a -> ()
rnf List2 Expr
a
  rnf (App Range
_ Expr
a NamedArg Expr
b)         = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
a () -> () -> ()
`seq` NamedArg Expr -> ()
forall a. NFData a => a -> ()
rnf NamedArg Expr
b
  rnf (OpApp Range
_ QName
a Set Name
b OpAppArgs
c)     = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a () -> () -> ()
`seq` Set Name -> ()
forall a. NFData a => a -> ()
rnf Set Name
b () -> () -> ()
`seq` OpAppArgs -> ()
forall a. NFData a => a -> ()
rnf OpAppArgs
c
  rnf (WithApp Range
_ Expr
a [Expr]
b)     = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
a () -> () -> ()
`seq` [Expr] -> ()
forall a. NFData a => a -> ()
rnf [Expr]
b
  rnf (HiddenArg Range
_ Named_ Expr
a)     = Named_ Expr -> ()
forall a. NFData a => a -> ()
rnf Named_ Expr
a
  rnf (InstanceArg Range
_ Named_ Expr
a)   = Named_ Expr -> ()
forall a. NFData a => a -> ()
rnf Named_ Expr
a
  rnf (Lam Range
_ List1 LamBinding
a Expr
b)         = List1 LamBinding -> ()
forall a. NFData a => a -> ()
rnf List1 LamBinding
a () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
b
  rnf (AbsurdLam Range
_ Hiding
a)     = Hiding -> ()
forall a. NFData a => a -> ()
rnf Hiding
a
  rnf (ExtendedLam Range
_ Erased
a List1 LamClause
b) = Erased -> ()
forall a. NFData a => a -> ()
rnf Erased
a () -> () -> ()
`seq` List1 LamClause -> ()
forall a. NFData a => a -> ()
rnf List1 LamClause
b
  rnf (Fun Range
_ Arg Expr
a Expr
b)         = Arg Expr -> ()
forall a. NFData a => a -> ()
rnf Arg Expr
a () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
b
  rnf (Pi Telescope1
a Expr
b)            = Telescope1 -> ()
forall a. NFData a => a -> ()
rnf Telescope1
a () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
b
  rnf (Rec Range
_ RecordAssignments
a)           = RecordAssignments -> ()
forall a. NFData a => a -> ()
rnf RecordAssignments
a
  rnf (RecUpdate Range
_ Expr
a [FieldAssignment]
b)   = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
a () -> () -> ()
`seq` [FieldAssignment] -> ()
forall a. NFData a => a -> ()
rnf [FieldAssignment]
b
  rnf (Let Range
_ List1 Declaration
a Maybe Expr
b)         = List1 Declaration -> ()
forall a. NFData a => a -> ()
rnf List1 Declaration
a () -> () -> ()
`seq` Maybe Expr -> ()
forall a. NFData a => a -> ()
rnf Maybe Expr
b
  rnf (Paren Range
_ Expr
a)         = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
a
  rnf (IdiomBrackets Range
_ [Expr]
a) = [Expr] -> ()
forall a. NFData a => a -> ()
rnf [Expr]
a
  rnf (DoBlock Range
_ List1 DoStmt
a)       = List1 DoStmt -> ()
forall a. NFData a => a -> ()
rnf List1 DoStmt
a
  rnf (Absurd Range
_)          = ()
  rnf (As Range
_ Name
a Expr
b)          = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
b
  rnf (Dot Range
_ Expr
a)           = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
a
  rnf (DoubleDot Range
_ Expr
a)     = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
a
  rnf (ETel Telescope
a)            = Telescope -> ()
forall a. NFData a => a -> ()
rnf Telescope
a
  rnf (Quote Range
_)           = ()
  rnf (QuoteTerm Range
_)       = ()
  rnf (Tactic Range
_ Expr
a)        = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
a
  rnf (Unquote Range
_)         = ()
  rnf (DontCare Expr
a)        = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
a
  rnf (Equal Range
_ Expr
a Expr
b)       = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
a () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
b
  rnf (Ellipsis Range
_)        = ()
  rnf (Generalized Expr
e)     = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
e

-- | Ranges are not forced.

instance NFData Pattern where
  rnf :: Pattern -> ()
rnf (IdentP QName
a)       = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a
  rnf (QuoteP Range
_)       = ()
  rnf (AppP Pattern
a NamedArg Pattern
b)       = Pattern -> ()
forall a. NFData a => a -> ()
rnf Pattern
a () -> () -> ()
`seq` NamedArg Pattern -> ()
forall a. NFData a => a -> ()
rnf NamedArg Pattern
b
  rnf (RawAppP Range
_ List2 Pattern
a)    = List2 Pattern -> ()
forall a. NFData a => a -> ()
rnf List2 Pattern
a
  rnf (OpAppP Range
_ QName
a Set Name
b [NamedArg Pattern]
c) = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a () -> () -> ()
`seq` Set Name -> ()
forall a. NFData a => a -> ()
rnf Set Name
b () -> () -> ()
`seq` [NamedArg Pattern] -> ()
forall a. NFData a => a -> ()
rnf [NamedArg Pattern]
c
  rnf (HiddenP Range
_ Named_ Pattern
a)    = Named_ Pattern -> ()
forall a. NFData a => a -> ()
rnf Named_ Pattern
a
  rnf (InstanceP Range
_ Named_ Pattern
a)  = Named_ Pattern -> ()
forall a. NFData a => a -> ()
rnf Named_ Pattern
a
  rnf (ParenP Range
_ Pattern
a)     = Pattern -> ()
forall a. NFData a => a -> ()
rnf Pattern
a
  rnf (WildP Range
_)        = ()
  rnf (AbsurdP Range
_)      = ()
  rnf (AsP Range
_ Name
a Pattern
b)      = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` Pattern -> ()
forall a. NFData a => a -> ()
rnf Pattern
b
  rnf (DotP Range
_ Expr
a)       = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
a
  rnf (LitP Range
_ Literal
a)       = Literal -> ()
forall a. NFData a => a -> ()
rnf Literal
a
  rnf (RecP Range
_ [FieldAssignment' Pattern]
a)       = [FieldAssignment' Pattern] -> ()
forall a. NFData a => a -> ()
rnf [FieldAssignment' Pattern]
a
  rnf (EqualP Range
_ [(Expr, Expr)]
es)    = [(Expr, Expr)] -> ()
forall a. NFData a => a -> ()
rnf [(Expr, Expr)]
es
  rnf (EllipsisP Range
_ Maybe Pattern
mp) = Maybe Pattern -> ()
forall a. NFData a => a -> ()
rnf Maybe Pattern
mp
  rnf (WithP Range
_ Pattern
a)      = Pattern -> ()
forall a. NFData a => a -> ()
rnf Pattern
a

-- | Ranges are not forced.

instance NFData RecordDirective where
  rnf :: RecordDirective -> ()
rnf (Induction Ranged Induction
a)          = Ranged Induction -> ()
forall a. NFData a => a -> ()
rnf Ranged Induction
a
  rnf (Eta Ranged HasEta0
a    )            = Ranged HasEta0 -> ()
forall a. NFData a => a -> ()
rnf Ranged HasEta0
a
  rnf (Constructor Name
a IsInstance
b)      = (Name, IsInstance) -> ()
forall a. NFData a => a -> ()
rnf (Name
a, IsInstance
b)
  rnf (PatternOrCopattern Range
_) = ()

instance NFData Declaration where
  rnf :: Declaration -> ()
rnf (TypeSig ArgInfo
a Maybe Expr
b Name
c Expr
d)       = ArgInfo -> ()
forall a. NFData a => a -> ()
rnf ArgInfo
a () -> () -> ()
`seq` Maybe Expr -> ()
forall a. NFData a => a -> ()
rnf Maybe Expr
b () -> () -> ()
`seq` Name -> ()
forall a. NFData a => a -> ()
rnf Name
c () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
d
  rnf (FieldSig IsInstance
a Maybe Expr
b Name
c Arg Expr
d)      = IsInstance -> ()
forall a. NFData a => a -> ()
rnf IsInstance
a () -> () -> ()
`seq` Maybe Expr -> ()
forall a. NFData a => a -> ()
rnf Maybe Expr
b () -> () -> ()
`seq` Name -> ()
forall a. NFData a => a -> ()
rnf Name
c () -> () -> ()
`seq` Arg Expr -> ()
forall a. NFData a => a -> ()
rnf Arg Expr
d
  rnf (Generalize Range
_ [Declaration]
a)        = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
a
  rnf (Field Range
_ [Declaration]
fs)            = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
fs
  rnf (FunClause LHS
a RHS
b WhereClause
c Bool
d)     = LHS -> ()
forall a. NFData a => a -> ()
rnf LHS
a () -> () -> ()
`seq` RHS -> ()
forall a. NFData a => a -> ()
rnf RHS
b () -> () -> ()
`seq` WhereClause -> ()
forall a. NFData a => a -> ()
rnf WhereClause
c () -> () -> ()
`seq` Bool -> ()
forall a. NFData a => a -> ()
rnf Bool
d
  rnf (DataSig Range
_ Name
a [LamBinding]
b Expr
c)       = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` [LamBinding] -> ()
forall a. NFData a => a -> ()
rnf [LamBinding]
b () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
c
  rnf (Data Range
_ Name
a [LamBinding]
b Expr
c [Declaration]
d)        = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` [LamBinding] -> ()
forall a. NFData a => a -> ()
rnf [LamBinding]
b () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
c () -> () -> ()
`seq` [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
d
  rnf (DataDef Range
_ Name
a [LamBinding]
b [Declaration]
c)       = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` [LamBinding] -> ()
forall a. NFData a => a -> ()
rnf [LamBinding]
b () -> () -> ()
`seq` [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
c
  rnf (RecordSig Range
_ Name
a [LamBinding]
b Expr
c)     = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` [LamBinding] -> ()
forall a. NFData a => a -> ()
rnf [LamBinding]
b () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
c
  rnf (RecordDef Range
_ Name
a RecordDirectives
b [LamBinding]
c [Declaration]
d)   = (Name, RecordDirectives, [LamBinding], [Declaration]) -> ()
forall a. NFData a => a -> ()
rnf (Name
a, RecordDirectives
b, [LamBinding]
c, [Declaration]
d)
  rnf (Record Range
_ Name
a RecordDirectives
b [LamBinding]
c Expr
d [Declaration]
e)    = (Name, RecordDirectives, [LamBinding], Expr, [Declaration]) -> ()
forall a. NFData a => a -> ()
rnf (Name
a, RecordDirectives
b, [LamBinding]
c, Expr
d, [Declaration]
e)
  rnf (RecordDirective RecordDirective
a)     = RecordDirective -> ()
forall a. NFData a => a -> ()
rnf RecordDirective
a
  rnf (Infix Fixity
a List1 Name
b)             = Fixity -> ()
forall a. NFData a => a -> ()
rnf Fixity
a () -> () -> ()
`seq` List1 Name -> ()
forall a. NFData a => a -> ()
rnf List1 Name
b
  rnf (Syntax Name
a Notation
b)            = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` Notation -> ()
forall a. NFData a => a -> ()
rnf Notation
b
  rnf (PatternSyn Range
_ Name
a [Arg Name]
b Pattern
c)    = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` [Arg Name] -> ()
forall a. NFData a => a -> ()
rnf [Arg Name]
b () -> () -> ()
`seq` Pattern -> ()
forall a. NFData a => a -> ()
rnf Pattern
c
  rnf (Mutual Range
_ [Declaration]
a)            = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
a
  rnf (InterleavedMutual Range
_ [Declaration]
a) = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
a
  rnf (LoneConstructor Range
_ [Declaration]
a)   = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
a
  rnf (Abstract Range
_ [Declaration]
a)          = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
a
  rnf (Private Range
_ Origin
_ [Declaration]
a)         = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
a
  rnf (InstanceB Range
_ [Declaration]
a)         = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
a
  rnf (Macro Range
_ [Declaration]
a)             = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
a
  rnf (Postulate Range
_ [Declaration]
a)         = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
a
  rnf (Primitive Range
_ [Declaration]
a)         = [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
a
  rnf (Open Range
_ QName
a ImportDirective
b)            = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a () -> () -> ()
`seq` ImportDirective -> ()
forall a. NFData a => a -> ()
rnf ImportDirective
b
  rnf (Import Range
_ QName
a Maybe AsName
b OpenShortHand
_ ImportDirective
c)      = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a () -> () -> ()
`seq` Maybe AsName -> ()
forall a. NFData a => a -> ()
rnf Maybe AsName
b () -> () -> ()
`seq` ImportDirective -> ()
forall a. NFData a => a -> ()
rnf ImportDirective
c
  rnf (ModuleMacro Range
_ Name
a ModuleApplication
b OpenShortHand
_ ImportDirective
c) = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` ModuleApplication -> ()
forall a. NFData a => a -> ()
rnf ModuleApplication
b () -> () -> ()
`seq` ImportDirective -> ()
forall a. NFData a => a -> ()
rnf ImportDirective
c
  rnf (Module Range
_ QName
a Telescope
b [Declaration]
c)        = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a () -> () -> ()
`seq` Telescope -> ()
forall a. NFData a => a -> ()
rnf Telescope
b () -> () -> ()
`seq` [Declaration] -> ()
forall a. NFData a => a -> ()
rnf [Declaration]
c
  rnf (UnquoteDecl Range
_ [Name]
a Expr
b)     = [Name] -> ()
forall a. NFData a => a -> ()
rnf [Name]
a () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
b
  rnf (UnquoteDef Range
_ [Name]
a Expr
b)      = [Name] -> ()
forall a. NFData a => a -> ()
rnf [Name]
a () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
b
  rnf (Pragma Pragma
a)              = Pragma -> ()
forall a. NFData a => a -> ()
rnf Pragma
a

instance NFData OpenShortHand

-- | Ranges are not forced.

instance NFData Pragma where
  rnf :: Pragma -> ()
rnf (OptionsPragma Range
_ [String]
a)               = [String] -> ()
forall a. NFData a => a -> ()
rnf [String]
a
  rnf (BuiltinPragma Range
_ Ranged String
a QName
b)             = Ranged String -> ()
forall a. NFData a => a -> ()
rnf Ranged String
a () -> () -> ()
`seq` QName -> ()
forall a. NFData a => a -> ()
rnf QName
b
  rnf (RewritePragma Range
_ Range
_ [QName]
a)             = [QName] -> ()
forall a. NFData a => a -> ()
rnf [QName]
a
  rnf (CompilePragma Range
_ Ranged String
a QName
b String
c)           = Ranged String -> ()
forall a. NFData a => a -> ()
rnf Ranged String
a () -> () -> ()
`seq` QName -> ()
forall a. NFData a => a -> ()
rnf QName
b () -> () -> ()
`seq` String -> ()
forall a. NFData a => a -> ()
rnf String
c
  rnf (ForeignPragma Range
_ Ranged String
b String
s)             = Ranged String -> ()
forall a. NFData a => a -> ()
rnf Ranged String
b () -> () -> ()
`seq` String -> ()
forall a. NFData a => a -> ()
rnf String
s
  rnf (StaticPragma Range
_ QName
a)                = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a
  rnf (InjectivePragma Range
_ QName
a)             = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a
  rnf (InlinePragma Range
_ Bool
_ QName
a)              = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a
  rnf (ImpossiblePragma Range
_ [String]
a)            = [String] -> ()
forall a. NFData a => a -> ()
rnf [String]
a
  rnf (EtaPragma Range
_ QName
a)                   = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a
  rnf (TerminationCheckPragma Range
_ TerminationCheck Name
a)      = TerminationCheck Name -> ()
forall a. NFData a => a -> ()
rnf TerminationCheck Name
a
  rnf (NoCoverageCheckPragma Range
_)         = ()
  rnf (WarningOnUsage Range
_ QName
a Text
b)            = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a () -> () -> ()
`seq` Text -> ()
forall a. NFData a => a -> ()
rnf Text
b
  rnf (WarningOnImport Range
_ Text
a)             = Text -> ()
forall a. NFData a => a -> ()
rnf Text
a
  rnf (CatchallPragma Range
_)                = ()
  rnf (DisplayPragma Range
_ Pattern
a Expr
b)             = Pattern -> ()
forall a. NFData a => a -> ()
rnf Pattern
a () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
b
  rnf (NoPositivityCheckPragma Range
_)       = ()
  rnf (PolarityPragma Range
_ Name
a [Occurrence]
b)            = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` [Occurrence] -> ()
forall a. NFData a => a -> ()
rnf [Occurrence]
b
  rnf (NoUniverseCheckPragma Range
_)         = ()

-- | Ranges are not forced.

instance NFData AsName where
  rnf :: AsName -> ()
rnf (AsName Either Expr Name
a Range
_) = Either Expr Name -> ()
forall a. NFData a => a -> ()
rnf Either Expr Name
a

-- | Ranges are not forced.

instance NFData a => NFData (TypedBinding' a) where
  rnf :: TypedBinding' a -> ()
rnf (TBind Range
_ List1 (NamedArg Binder)
a a
b) = List1 (NamedArg Binder) -> ()
forall a. NFData a => a -> ()
rnf List1 (NamedArg Binder)
a () -> () -> ()
`seq` a -> ()
forall a. NFData a => a -> ()
rnf a
b
  rnf (TLet Range
_ List1 Declaration
a)    = List1 Declaration -> ()
forall a. NFData a => a -> ()
rnf List1 Declaration
a

-- | Ranges are not forced.

instance NFData ModuleApplication where
  rnf :: ModuleApplication -> ()
rnf (SectionApp Range
_ Telescope
a Expr
b)    = Telescope -> ()
forall a. NFData a => a -> ()
rnf Telescope
a () -> () -> ()
`seq` Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
b
  rnf (RecordModuleInstance Range
_ QName
a) = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a

-- | Ranges are not forced.

instance NFData a => NFData (OpApp a) where
  rnf :: OpApp a -> ()
rnf (SyntaxBindingLambda Range
_ List1 LamBinding
a a
b) = List1 LamBinding -> ()
forall a. NFData a => a -> ()
rnf List1 LamBinding
a () -> () -> ()
`seq` a -> ()
forall a. NFData a => a -> ()
rnf a
b
  rnf (Ordinary a
a)                = a -> ()
forall a. NFData a => a -> ()
rnf a
a

-- | Ranges are not forced.

instance NFData LHS where
  rnf :: LHS -> ()
rnf (LHS Pattern
a [RewriteEqn]
b [WithExpr]
c) = Pattern -> ()
forall a. NFData a => a -> ()
rnf Pattern
a () -> () -> ()
`seq` [RewriteEqn] -> ()
forall a. NFData a => a -> ()
rnf [RewriteEqn]
b () -> () -> ()
`seq` [WithExpr] -> ()
forall a. NFData a => a -> ()
rnf [WithExpr]
c

instance NFData a => NFData (FieldAssignment' a) where
  rnf :: FieldAssignment' a -> ()
rnf (FieldAssignment Name
a a
b) = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` a -> ()
forall a. NFData a => a -> ()
rnf a
b

instance NFData ModuleAssignment where
  rnf :: ModuleAssignment -> ()
rnf (ModuleAssignment QName
a [Expr]
b ImportDirective
c) = QName -> ()
forall a. NFData a => a -> ()
rnf QName
a () -> () -> ()
`seq` [Expr] -> ()
forall a. NFData a => a -> ()
rnf [Expr]
b () -> () -> ()
`seq` ImportDirective -> ()
forall a. NFData a => a -> ()
rnf ImportDirective
c

instance NFData a => NFData (WhereClause' a) where
  rnf :: WhereClause' a -> ()
rnf WhereClause' a
NoWhere             = ()
  rnf (AnyWhere Range
_ a
a)      = a -> ()
forall a. NFData a => a -> ()
rnf a
a
  rnf (SomeWhere Range
_ Name
a Access
b a
c) = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` Access -> ()
forall a. NFData a => a -> ()
rnf Access
b () -> () -> ()
`seq` a -> ()
forall a. NFData a => a -> ()
rnf a
c

instance NFData LamClause where
  rnf :: LamClause -> ()
rnf (LamClause [Pattern]
a RHS
b Bool
c) = ([Pattern], RHS, Bool) -> ()
forall a. NFData a => a -> ()
rnf ([Pattern]
a, RHS
b, Bool
c)

instance NFData a => NFData (LamBinding' a) where
  rnf :: LamBinding' a -> ()
rnf (DomainFree NamedArg Binder
a) = NamedArg Binder -> ()
forall a. NFData a => a -> ()
rnf NamedArg Binder
a
  rnf (DomainFull a
a) = a -> ()
forall a. NFData a => a -> ()
rnf a
a

instance NFData Binder where
  rnf :: Binder -> ()
rnf (Binder Maybe Pattern
a BoundName
b) = Maybe Pattern -> ()
forall a. NFData a => a -> ()
rnf Maybe Pattern
a () -> () -> ()
`seq` BoundName -> ()
forall a. NFData a => a -> ()
rnf BoundName
b

instance NFData BoundName where
  rnf :: BoundName -> ()
rnf (BName Name
a Fixity'
b Maybe Expr
c) = Name -> ()
forall a. NFData a => a -> ()
rnf Name
a () -> () -> ()
`seq` Fixity' -> ()
forall a. NFData a => a -> ()
rnf Fixity'
b () -> () -> ()
`seq` Maybe Expr -> ()
forall a. NFData a => a -> ()
rnf Maybe Expr
c

instance NFData a => NFData (RHS' a) where
  rnf :: RHS' a -> ()
rnf RHS' a
AbsurdRHS = ()
  rnf (RHS a
a)   = a -> ()
forall a. NFData a => a -> ()
rnf a
a

instance NFData DoStmt where
  rnf :: DoStmt -> ()
rnf (DoBind Range
_ Pattern
p Expr
e [LamClause]
w) = (Pattern, Expr, [LamClause]) -> ()
forall a. NFData a => a -> ()
rnf (Pattern
p, Expr
e, [LamClause]
w)
  rnf (DoThen Expr
e)       = Expr -> ()
forall a. NFData a => a -> ()
rnf Expr
e
  rnf (DoLet Range
_ List1 Declaration
ds)     = List1 Declaration -> ()
forall a. NFData a => a -> ()
rnf List1 Declaration
ds