Maintainer | hapytexeu+gh@gmail.com |
---|---|
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
Unicode considers 60 characters to be brackets: brackets are organized in pairs: each opening bracket has a corresponding closing bracket and vice versa.
The following characters are considered brackets where the first character is closed by the last character, the second by the last but one, etc.:
([{༺༼᚛⁅⁽₍⌈⌊〈❨❪❬❮❰❲❴⟅⟦⟨⟪⟬⟮⦃⦅⦇⦉⦋⦍⦏⦑⦓⦕⦗⧘⧚⧼⸢⸤⸦⸨〈《「『【〔〖〘〚﹙﹛﹝([{⦅「」⦆}])﹞﹜﹚〛〙〗〕】』」》〉⸩⸧⸥⸣⧽⧛⧙⦘⦖⦔⦒⦎⦐⦌⦊⦈⦆⦄⟯⟭⟫⟩⟧⟆❵❳❱❯❭❫❩〉⌋⌉₎⁾⁆᚜༽༻}])
These characters span over several code blocks.
Synopsis
- bracketMaps :: [(Char, Char)]
- brackets :: [Char]
- openBrackets :: [Char]
- closeBrackets :: [Char]
- toOpen :: Map Char Char
- toClose :: Map Char Char
- data BracketType
- isBracket :: Char -> Bool
- bracketType :: Char -> Maybe BracketType
- bracketType' :: Char -> BracketType
- isOpenBracket :: Char -> Bool
- isCloseBracket :: Char -> Bool
- getOppositeChar :: Char -> Maybe Char
- getOppositeChar' :: Char -> Char
Listing and converting brackets
bracketMaps :: [(Char, Char)] Source #
A list of 2-tuples where the first item of each tuple is the opening bracket, and the second item its closing counterpart.
The list of all brackets characters.
A list of Char
s that contains all opening brackets.
A list of Char
s that contains all closing brackets.
toOpen :: Map Char Char Source #
A Map
that maps the given close bracket
characters to the corresponding open bracket.
toClose :: Map Char Char Source #
A Map
that maps the given open bracket
characters to the corresponding close bracket.
Check the given bracket type
data BracketType Source #
A data type that is used to specify the type of bracket.
Instances
Check if the given Char
is a bracket character.
bracketType :: Char -> Maybe BracketType Source #
Check the BracketType
of the Char
wrapped in a Just
data construct;
Nothing
if the given Char
is not a bracket character.
bracketType' :: Char -> BracketType Source #
Check the BracketType
of the Char
. For a Char
that is not a bracket
the behavior is unspecified.
Check if the given Char
is an open bracket.
Check if the given Char
is a close bracket.