Copyright | (C) CSIRO 2017-2018 |
---|---|
License | BSD3 |
Maintainer | Isaac Elliott <isaace71295@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- newtype Comma = MkComma [Whitespace]
- data CommaSep a
- = CommaSepNone
- | CommaSepOne a
- | CommaSepMany a Comma (CommaSep a)
- _CommaSep :: Iso (Maybe (a, [(Comma, a)], Maybe Comma)) (Maybe (b, [(Comma, b)], Maybe Comma)) (CommaSep a) (CommaSep b)
- csTrailingWhitespace :: HasTrailingWhitespace a => Traversal' (CommaSep a) [Whitespace]
- appendCommaSep :: [Whitespace] -> CommaSep a -> CommaSep a -> CommaSep a
- maybeToCommaSep :: Maybe a -> CommaSep a
- listToCommaSep :: [a] -> CommaSep a
- data CommaSep1 a
- = CommaSepOne1 a
- | CommaSepMany1 a Comma (CommaSep1 a)
- commaSep1Head :: CommaSep1 a -> a
- appendCommaSep1 :: [Whitespace] -> CommaSep1 a -> CommaSep1 a -> CommaSep1 a
- listToCommaSep1 :: NonEmpty a -> CommaSep1 a
- listToCommaSep1' :: [a] -> Maybe (CommaSep1' a)
- data CommaSep1' a
- = CommaSepOne1' a (Maybe Comma)
- | CommaSepMany1' a Comma (CommaSep1' a)
- _CommaSep1' :: Iso (a, [(Comma, a)], Maybe Comma) (b, [(Comma, b)], Maybe Comma) (CommaSep1' a) (CommaSep1' b)
Documentation
The venerable comma separator
Instances
Eq Comma Source # | |
Show Comma Source # | |
HasTrailingWhitespace Comma Source # | |
Defined in Language.Python.Syntax.Punctuation trailingWhitespace :: Lens' Comma [Whitespace] Source # | |
HasNewlines Comma Source # | |
Items separated by commas, with optional whitespace following each comma
CommaSepNone | |
CommaSepOne a | |
CommaSepMany a Comma (CommaSep a) |
Instances
Functor CommaSep Source # | |
Foldable CommaSep Source # | |
Defined in Language.Python.Syntax.CommaSep fold :: Monoid m => CommaSep m -> m # foldMap :: Monoid m => (a -> m) -> CommaSep a -> m # foldr :: (a -> b -> b) -> b -> CommaSep a -> b # foldr' :: (a -> b -> b) -> b -> CommaSep a -> b # foldl :: (b -> a -> b) -> b -> CommaSep a -> b # foldl' :: (b -> a -> b) -> b -> CommaSep a -> b # foldr1 :: (a -> a -> a) -> CommaSep a -> a # foldl1 :: (a -> a -> a) -> CommaSep a -> a # elem :: Eq a => a -> CommaSep a -> Bool # maximum :: Ord a => CommaSep a -> a # minimum :: Ord a => CommaSep a -> a # | |
Traversable CommaSep Source # | |
Defined in Language.Python.Syntax.CommaSep | |
Eq a => Eq (CommaSep a) Source # | |
Show a => Show (CommaSep a) Source # | |
Semigroup (CommaSep a) Source # | |
Monoid (CommaSep a) Source # | |
HasNewlines a => HasNewlines (CommaSep a) Source # | |
_CommaSep :: Iso (Maybe (a, [(Comma, a)], Maybe Comma)) (Maybe (b, [(Comma, b)], Maybe Comma)) (CommaSep a) (CommaSep b) Source #
Iso to unpack a CommaSep
csTrailingWhitespace :: HasTrailingWhitespace a => Traversal' (CommaSep a) [Whitespace] Source #
Traversal
targeting the trailing whitespace in a comma separated list.
This can't be an instance of HasTrailingWhitespace
because CommaSepNone
never
has trailing whitespace.
appendCommaSep :: [Whitespace] -> CommaSep a -> CommaSep a -> CommaSep a Source #
Appends two comma separated values together.
The provided whitespace is to follow the joining comma which is added
listToCommaSep :: [a] -> CommaSep a Source #
Convert a list to a CommaSep
Anywhere where whitespace is ambiguous, this function puts a single space
Non-empty CommaSep
CommaSepOne1 a | |
CommaSepMany1 a Comma (CommaSep1 a) |
Instances
commaSep1Head :: CommaSep1 a -> a Source #
Get the first element of a CommaSep1
appendCommaSep1 :: [Whitespace] -> CommaSep1 a -> CommaSep1 a -> CommaSep1 a Source #
Appends two non-empty comma separated values together.
The provided whitespace is to follow the joining comma which is added
listToCommaSep1 :: NonEmpty a -> CommaSep1 a Source #
listToCommaSep1' :: [a] -> Maybe (CommaSep1' a) Source #
Attempt to insert comma separators into a list, which will not be terminated by a comma.
If the list is empty, Nothing
is returned.
data CommaSep1' a Source #
Non-empty CommaSep
, optionally terminated by a comma
Assumes that the contents consumes trailing whitespace
CommaSepOne1' a (Maybe Comma) | |
CommaSepMany1' a Comma (CommaSep1' a) |
Instances
_CommaSep1' :: Iso (a, [(Comma, a)], Maybe Comma) (b, [(Comma, b)], Maybe Comma) (CommaSep1' a) (CommaSep1' b) Source #
Iso to unpack a CommaSep1'