language-bash-0.11.1: Parsing and pretty-printing Bash shell scripts
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Bash.Cond

Description

Bash conditional commands.

Synopsis

Documentation

data CondExpr a Source #

Bash conditional expressions.

Constructors

Unary UnaryOp a 
Binary a BinaryOp a 
Not (CondExpr a) 
And (CondExpr a) (CondExpr a) 
Or (CondExpr a) (CondExpr a) 

Instances

Instances details
Foldable CondExpr Source # 
Instance details

Defined in Language.Bash.Cond

Methods

fold :: Monoid m => CondExpr m -> m #

foldMap :: Monoid m => (a -> m) -> CondExpr a -> m #

foldMap' :: Monoid m => (a -> m) -> CondExpr a -> m #

foldr :: (a -> b -> b) -> b -> CondExpr a -> b #

foldr' :: (a -> b -> b) -> b -> CondExpr a -> b #

foldl :: (b -> a -> b) -> b -> CondExpr a -> b #

foldl' :: (b -> a -> b) -> b -> CondExpr a -> b #

foldr1 :: (a -> a -> a) -> CondExpr a -> a #

foldl1 :: (a -> a -> a) -> CondExpr a -> a #

toList :: CondExpr a -> [a] #

null :: CondExpr a -> Bool #

length :: CondExpr a -> Int #

elem :: Eq a => a -> CondExpr a -> Bool #

maximum :: Ord a => CondExpr a -> a #

minimum :: Ord a => CondExpr a -> a #

sum :: Num a => CondExpr a -> a #

product :: Num a => CondExpr a -> a #

Traversable CondExpr Source # 
Instance details

Defined in Language.Bash.Cond

Methods

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

sequenceA :: Applicative f => CondExpr (f a) -> f (CondExpr a) #

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

sequence :: Monad m => CondExpr (m a) -> m (CondExpr a) #

Functor CondExpr Source # 
Instance details

Defined in Language.Bash.Cond

Methods

fmap :: (a -> b) -> CondExpr a -> CondExpr b #

(<$) :: a -> CondExpr b -> CondExpr a #

Data a => Data (CondExpr a) Source # 
Instance details

Defined in Language.Bash.Cond

Methods

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

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

toConstr :: CondExpr a -> Constr #

dataTypeOf :: CondExpr a -> DataType #

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

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

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

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

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

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

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

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

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

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

Generic (CondExpr a) Source # 
Instance details

Defined in Language.Bash.Cond

Associated Types

type Rep (CondExpr a) :: Type -> Type #

Methods

from :: CondExpr a -> Rep (CondExpr a) x #

to :: Rep (CondExpr a) x -> CondExpr a #

Read a => Read (CondExpr a) Source # 
Instance details

Defined in Language.Bash.Cond

Show a => Show (CondExpr a) Source # 
Instance details

Defined in Language.Bash.Cond

Methods

showsPrec :: Int -> CondExpr a -> ShowS #

show :: CondExpr a -> String #

showList :: [CondExpr a] -> ShowS #

Eq a => Eq (CondExpr a) Source # 
Instance details

Defined in Language.Bash.Cond

Methods

(==) :: CondExpr a -> CondExpr a -> Bool #

(/=) :: CondExpr a -> CondExpr a -> Bool #

Pretty a => Pretty (CondExpr a) Source # 
Instance details

Defined in Language.Bash.Cond

Methods

pretty :: CondExpr a -> Doc ann #

prettyList :: [CondExpr a] -> Doc ann #

type Rep (CondExpr a) Source # 
Instance details

Defined in Language.Bash.Cond

data UnaryOp Source #

Unary conditional operators.

Instances

Instances details
Data UnaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Methods

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

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

toConstr :: UnaryOp -> Constr #

dataTypeOf :: UnaryOp -> DataType #

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

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

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

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

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

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

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

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

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

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

Bounded UnaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Enum UnaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Generic UnaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Associated Types

type Rep UnaryOp :: Type -> Type #

Methods

from :: UnaryOp -> Rep UnaryOp x #

to :: Rep UnaryOp x -> UnaryOp #

Read UnaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Show UnaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Eq UnaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Methods

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

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

Ord UnaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Pretty UnaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Methods

pretty :: UnaryOp -> Doc ann #

prettyList :: [UnaryOp] -> Doc ann #

type Rep UnaryOp Source # 
Instance details

Defined in Language.Bash.Cond

type Rep UnaryOp = D1 ('MetaData "UnaryOp" "Language.Bash.Cond" "language-bash-0.11.1-inplace" 'False) ((((C1 ('MetaCons "BlockFile" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CharacterFile" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Directory" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FileExists" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RegularFile" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "SetGID" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Sticky" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NamedPipe" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Readable" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FileSize" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Terminal" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "SetUID" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Writable" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Executable" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "GroupOwned" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SymbolicLink" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Modified" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "UserOwned" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Socket" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Optname" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Varname" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ZeroString" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NonzeroString" 'PrefixI 'False) (U1 :: Type -> Type))))))

data BinaryOp Source #

Binary conditional operators.

Instances

Instances details
Data BinaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Methods

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

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

toConstr :: BinaryOp -> Constr #

dataTypeOf :: BinaryOp -> DataType #

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

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

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

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

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

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

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

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

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

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

Bounded BinaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Enum BinaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Generic BinaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Associated Types

type Rep BinaryOp :: Type -> Type #

Methods

from :: BinaryOp -> Rep BinaryOp x #

to :: Rep BinaryOp x -> BinaryOp #

Read BinaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Show BinaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Eq BinaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Ord BinaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Pretty BinaryOp Source # 
Instance details

Defined in Language.Bash.Cond

Methods

pretty :: BinaryOp -> Doc ann #

prettyList :: [BinaryOp] -> Doc ann #

type Rep BinaryOp Source # 
Instance details

Defined in Language.Bash.Cond

type Rep BinaryOp = D1 ('MetaData "BinaryOp" "Language.Bash.Cond" "language-bash-0.11.1-inplace" 'False) (((C1 ('MetaCons "SameFile" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NewerThan" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OlderThan" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "StrMatch" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "StrEQ" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "StrNE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "StrLT" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "StrGT" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ArithEQ" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ArithNE" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ArithLT" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ArithLE" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ArithGT" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ArithGE" 'PrefixI 'False) (U1 :: Type -> Type)))))

parseTestExpr :: [String] -> Either ParseError (CondExpr String) Source #

Parse a conditional expression for the Bash test builtin.