Copyright | (C) CSIRO 2017-2019 |
---|---|
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 # | |
Generic Comma Source # | |
HasTrailingWhitespace Comma Source # | |
Defined in Language.Python.Syntax.Punctuation | |
HasNewlines Comma Source # | |
Defined in Language.Python.Optics.Newlines | |
type Rep Comma Source # | |
Defined in Language.Python.Syntax.Punctuation type Rep Comma = D1 (MetaData "Comma" "Language.Python.Syntax.Punctuation" "hpython-0.2-7fNN6PEHntyHCqZaN2NGK0" True) (C1 (MetaCons "MkComma" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Whitespace]))) |
Items separated by commas, with optional whitespace following each comma
CommaSepNone | |
CommaSepOne a | |
CommaSepMany a Comma (CommaSep a) |
Instances
_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'