hpython-0.3: Python language tools

Copyright(C) CSIRO 2017-2019
LicenseBSD3
MaintainerIsaac Elliott <isaace71295@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Language.Python.Syntax.Ident

Contents

Description

 
Synopsis

Documentation

data Ident (v :: [*]) a Source #

An identifier. Like many types in hpython, it has an optional annotation and tracks its trailing whitespace.

Raw Idents have an IsString instance.

See https://docs.python.org/3.5/reference/lexical_analysis.html#identifiers

Constructors

MkIdent 
Instances
Validated Ident Source # 
Instance details

Defined in Language.Python.Syntax.Ident

Methods

unvalidated :: Getter (Ident v a) (Ident [] a) Source #

HasIdents Ident Source # 
Instance details

Defined in Language.Python.Optics.Idents

Methods

_Idents :: Traversal (Ident v a) (Ident [] a) (Ident v a) (Ident [] a) Source #

DoubleStarSyntax Ident Param Source #

See def_

Instance details

Defined in Language.Python.DSL

Methods

ss_ :: Raw Ident -> Raw Param Source #

StarSyntax Ident Param Source #

See def_

Instance details

Defined in Language.Python.DSL

Methods

s_ :: Raw Ident -> Raw Param Source #

PositionalSyntax Param Ident Source #

See def_

Instance details

Defined in Language.Python.DSL

Methods

p_ :: Raw Ident -> Raw Param Source #

As Expr Ident ExceptAs Source #

See exceptAs_

Instance details

Defined in Language.Python.DSL

Methods

as_ :: Raw Expr -> Raw Ident -> Raw ExceptAs Source #

Functor (Ident v) Source # 
Instance details

Defined in Language.Python.Syntax.Ident

Methods

fmap :: (a -> b) -> Ident v a -> Ident v b #

(<$) :: a -> Ident v b -> Ident v a #

IsString (Raw Ident) Source # 
Instance details

Defined in Language.Python.Syntax.Ident

Methods

fromString :: String -> Raw Ident #

Foldable (Ident v) Source # 
Instance details

Defined in Language.Python.Syntax.Ident

Methods

fold :: Monoid m => Ident v m -> m #

foldMap :: Monoid m => (a -> m) -> Ident v a -> m #

foldr :: (a -> b -> b) -> b -> Ident v a -> b #

foldr' :: (a -> b -> b) -> b -> Ident v a -> b #

foldl :: (b -> a -> b) -> b -> Ident v a -> b #

foldl' :: (b -> a -> b) -> b -> Ident v a -> b #

foldr1 :: (a -> a -> a) -> Ident v a -> a #

foldl1 :: (a -> a -> a) -> Ident v a -> a #

toList :: Ident v a -> [a] #

null :: Ident v a -> Bool #

length :: Ident v a -> Int #

elem :: Eq a => a -> Ident v a -> Bool #

maximum :: Ord a => Ident v a -> a #

minimum :: Ord a => Ident v a -> a #

sum :: Num a => Ident v a -> a #

product :: Num a => Ident v a -> a #

Traversable (Ident v) Source # 
Instance details

Defined in Language.Python.Syntax.Ident

Methods

traverse :: Applicative f => (a -> f b) -> Ident v a -> f (Ident v b) #

sequenceA :: Applicative f => Ident v (f a) -> f (Ident v a) #

mapM :: Monad m => (a -> m b) -> Ident v a -> m (Ident v b) #

sequence :: Monad m => Ident v (m a) -> m (Ident v a) #

HasAnn (Ident v) Source # 
Instance details

Defined in Language.Python.Syntax.Ident

Methods

annot :: Lens' (Ident v a) (Ann a) Source #

Eq a => Eq (Ident v a) Source # 
Instance details

Defined in Language.Python.Syntax.Ident

Methods

(==) :: Ident v a -> Ident v a -> Bool #

(/=) :: Ident v a -> Ident v a -> Bool #

Show a => Show (Ident v a) Source # 
Instance details

Defined in Language.Python.Syntax.Ident

Methods

showsPrec :: Int -> Ident v a -> ShowS #

show :: Ident v a -> String #

showList :: [Ident v a] -> ShowS #

Generic (Ident v a) Source # 
Instance details

Defined in Language.Python.Syntax.Ident

Associated Types

type Rep (Ident v a) :: Type -> Type #

Methods

from :: Ident v a -> Rep (Ident v a) x #

to :: Rep (Ident v a) x -> Ident v a #

HasTrailingWhitespace (Ident v a) Source # 
Instance details

Defined in Language.Python.Syntax.Ident

HasNewlines (Ident v a) Source # 
Instance details

Defined in Language.Python.Optics.Newlines

type Rep (Ident v a) Source # 
Instance details

Defined in Language.Python.Syntax.Ident

type Rep (Ident v a) = D1 (MetaData "Ident" "Language.Python.Syntax.Ident" "hpython-0.3-inplace" False) (C1 (MetaCons "MkIdent" PrefixI True) (S1 (MetaSel (Just "_identAnn") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann a)) :*: (S1 (MetaSel (Just "_identValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: S1 (MetaSel (Just "_identWhitespace") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Whitespace]))))

Lenses

identAnn :: Lens (Ident v a) (Ident v a) a a Source #

Extra functions

isIdentifierStart :: Char -> Bool Source #

Determine whether this character could start a valid identifier

isIdentifierChar :: Char -> Bool Source #

Determine whether this character could be part of a valid identifier