# LLM Prompt for Documentation ## Documentation ### Parse #### Parser **Type Annotation** **Description** ``` Parser a err : Str -> Result (a, Str) err ``` A Parser is a function which takes a Str and returns a Result containing a tuple of the matched value and the remaining Str after the match, or an error if the match was not found at the beginning of the Str. > Note that the matched value which is returned does not need to be a Str, but can be transformed in any way. #### string **Type Annotation** ```roc Str -> Parser Str [StringNotFound] ``` **Description** Create a parser that will match a specific string #### whitespace **Type Annotation** ```roc Parser Str [WhitespaceNotFound] ``` **Description** Match a string of one or more consecutive whitespace characters #### char **Type Annotation** ```roc Parser U8 [CharNotFound] ``` **Description** Parse a single character #### atomic_grapheme **Type Annotation** ```roc Parser Str [GraphemeNotFound] ``` **Description** Parse a non-clustered grapheme #### digit **Type Annotation** ```roc Parser U8 [NotADigit] ``` **Description** Parse a digit (converts from ASCII value to integer) #### integer **Type Annotation** ```roc Parser U64 [NotAnInteger] ``` **Description** Parse an integer #### float **Type Annotation** ```roc Parser F64 [NotAFloat] ``` **Description** Parse a floating point number #### filter **Type Annotation** ```roc Parser a , (a -> Bool) -> Parser a [FilteredOut] ``` **Description** Create a parser that will filter out matches that do not satisfy the given predicate #### excluding **Type Annotation** ```roc Parser a , (a -> Bool) -> Parser a [Excluded] ``` **Description** Create a parser that will exclude matches that satisfy the given predicate #### map **Type Annotation** ```roc Parser a , (a -> Result b ) -> Parser b ``` **Description** Convert a parser of one type into a parser of another type using a tranform function which turns the first type into a result of the second type #### flat_map **Type Annotation** ```roc Parser a , (a -> Parser b ) -> Parser b ``` **Description** Convert a parser of one type into a parser of another type using a transform function which turns the first type into a parser of the second type #### one_or_more **Type Annotation** ```roc Parser a -> Parser (List a) [LessThanOneFound] ``` **Description** Create a parser which matches one or more occurrences of the given parser #### zero_or_more **Type Annotation** ```roc Parser a -> Parser (List a) ``` **Description** Create a parser which matches zero or more occurrences of the given parser #### zip **Type Annotation** ```roc Parser a , Parser b -> Parser ( a, b ) ``` **Description** Combine 2 parsers into a single parser that returns a tuple of 2 values #### zip_3 **Type Annotation** ```roc Parser a , Parser b , Parser c -> Parser ( a, b, c ) ``` **Description** Combine 3 parsers into a single parser that returns a tuple of 3 values #### zip_4 **Type Annotation** ```roc Parser a , Parser b , Parser c , Parser d -> Parser ( a, b, c, d ) ``` **Description** Combine 4 parsers into a single parser that returns a tuple of 4 values #### zip_5 **Type Annotation** ```roc Parser a , Parser b , Parser c , Parser d , Parser e -> Parser ( a, b, c, d, e ) ``` **Description** Combine 5 parsers into a single parser that returns a tuple of 5 values #### zip_6 **Type Annotation** ```roc Parser a , Parser b , Parser c , Parser d , Parser e , Parser f -> Parser ( a, b, c, d, e, f ) ``` **Description** Combine 6 parsers into a single parser that returns a tuple of 6 values #### maybe **Type Annotation** ```roc Parser a -> Parser (Maybe a) ``` **Description** Convert a parser that can fail into a parser that can return a Maybe #### or_else **Type Annotation** ```roc Parser a err, Parser a err -> Parser a err ``` **Description** Try the first parser, if it fails, try the second parser #### one_of **Type Annotation** ```roc List (Parser a err) -> Parser a [NoMatchFound] ``` **Description** Try each parser in sequence until one succeeds #### keep_left **Type Annotation** ```roc Parser l , Parser r -> Parser l ``` **Description** keep the result of the left parser #### keep_right **Type Annotation** ```roc Parser l , Parser r -> Parser r ``` **Description** keep the result of the right parser #### lhs **Type Annotation** ```roc Parser l , Parser r -> Parser l ``` **Description** keep the result of the "left hand side" parser #### rhs **Type Annotation** ```roc Parser l , Parser r -> Parser r ``` **Description** keep the result of the "right hand side" parser #### both **Type Annotation** ```roc Parser l , Parser r -> Parser ( l, r ) ``` **Description** keep the result of both parsers #### finalize **Type Annotation** ```roc Result ( a, Str ) -> Result a [NotConsumed] ``` **Description** Finalize a parser result only if the Str has been fully consumed #### finalize_lazy **Type Annotation** ```roc Result ( a, Str ) err -> Result a err ``` **Description** Finalize a parser result without consuming the remaining Str ### CSV #### comma **Type Annotation** ```roc Parser U8 [CommaNotFound] ``` **Description** Match a comma character #### newline **Type Annotation** ```roc Parser U8 [NewlineNotFound] ``` **Description** Match a newline character #### csv_string **Type Annotation** ```roc Parser Str [InvalidString] ``` **Description** Match a string with or without quotation marks ### Maybe #### Maybe **Type Annotation** ```roc [ Some a, None ] ``` #### map **Type Annotation** ```roc Maybe a, (a -> b), b -> b ``` **Description** Transform a Maybe value. ``` expect Some(1) |> map(Number, Nothing) == Number(1) expect None |> map(Number, Nothing) == Nothing ```