circuits-parser
Safe HaskellNone
LanguageGHC2024

Circuit.Parser.Primitives

Description

Numeric primitives and string conversions for Circuit.Parser.

Synopsis

Character predicates

isDigit :: Char -> Bool Source #

Is the character an ASCII digit?

isLatinLetter :: Char -> Bool Source #

Is the character a Latin letter?

Numeric parsers

digit :: Parser Identity ByteString Char Int Source #

Parse a single digit.

digits :: Parser Identity ByteString Char (Int, Int) Source #

Parse one or more digits, returning (place, value) where place is 10 ^ number_of_digits.

>>> import Circuit.Parser (runParserIdentity)
>>> import Data.ByteString.Char8 qualified as B
>>> runParserIdentity digits (B.pack "123")
These (1000,123) ""

int :: Parser Identity ByteString Char Int Source #

Parse a non-empty sequence of digits as an integer.

double :: Parser Identity ByteString Char Double Source #

Parse a floating-point number.

signed :: Num a => Parser Identity ByteString Char a -> Parser Identity ByteString Char a Source #

Optionally negate the result of a parser.

String / ByteString conversions