swarm-0.6.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Language.Syntax.Loc

Description

Types for working with locations of something in source code.

Synopsis

Documentation

data SrcLoc Source #

The location of something in the textual source code (recorded as an interval measured in terms of indices into the input stream).

Constructors

NoLoc 
SrcLoc Int Int

Half-open interval from start (inclusive) to end (exclusive)

Instances

Instances details
FromJSON SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

ToJSON SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Data SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcLoc -> c SrcLoc #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcLoc #

toConstr :: SrcLoc -> Constr #

dataTypeOf :: SrcLoc -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcLoc) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcLoc) #

gmapT :: (forall b. Data b => b -> b) -> SrcLoc -> SrcLoc #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r #

gmapQ :: (forall d. Data d => d -> u) -> SrcLoc -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcLoc -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc #

Monoid SrcLoc Source #

mempty is a special value which means we have no location information.

Instance details

Defined in Swarm.Language.Syntax.Loc

Semigroup SrcLoc Source #

x <> y is the smallest SrcLoc that subsumes both x and y.

Instance details

Defined in Swarm.Language.Syntax.Loc

Generic SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Associated Types

type Rep SrcLoc :: Type -> Type #

Methods

from :: SrcLoc -> Rep SrcLoc x #

to :: Rep SrcLoc x -> SrcLoc #

Show SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Eq SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

(==) :: SrcLoc -> SrcLoc -> Bool #

(/=) :: SrcLoc -> SrcLoc -> Bool #

Ord SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

type Rep SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

type Rep SrcLoc = D1 ('MetaData "SrcLoc" "Swarm.Language.Syntax.Loc" "swarm-0.6.0.0-ERx1HMcRMba59aI2b6aNrS-swarm-lang" 'False) (C1 ('MetaCons "NoLoc" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SrcLoc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))

data LocVar Source #

A variable with associated source location, used for variable binding sites. (Variable occurrences are a bare TVar which gets wrapped in a Syntax node, so we don't need LocVar for those.)

Constructors

LV 

Fields

Instances

Instances details
FromJSON LocVar Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

ToJSON LocVar Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Data LocVar Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LocVar -> c LocVar #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LocVar #

toConstr :: LocVar -> Constr #

dataTypeOf :: LocVar -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LocVar) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LocVar) #

gmapT :: (forall b. Data b => b -> b) -> LocVar -> LocVar #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LocVar -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LocVar -> r #

gmapQ :: (forall d. Data d => d -> u) -> LocVar -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> LocVar -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LocVar -> m LocVar #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LocVar -> m LocVar #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LocVar -> m LocVar #

Generic LocVar Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Associated Types

type Rep LocVar :: Type -> Type #

Methods

from :: LocVar -> Rep LocVar x #

to :: Rep LocVar x -> LocVar #

Show LocVar Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Eq LocVar Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

(==) :: LocVar -> LocVar -> Bool #

(/=) :: LocVar -> LocVar -> Bool #

Ord LocVar Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

type Rep LocVar Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

type Rep LocVar = D1 ('MetaData "LocVar" "Swarm.Language.Syntax.Loc" "swarm-0.6.0.0-ERx1HMcRMba59aI2b6aNrS-swarm-lang" 'False) (C1 ('MetaCons "LV" 'PrefixI 'True) (S1 ('MetaSel ('Just "lvSrcLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SrcLoc) :*: S1 ('MetaSel ('Just "lvVar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Var)))

srcLocBefore :: SrcLoc -> SrcLoc -> Bool Source #

Check whether one SrcLoc starts at or before another one, i.e. compare their starting indices to see if the first is <= the second.