m4rw3r / chomp

A fast monadic-style parser combinator designed to work on stable Rust.
Apache License 2.0
243 stars 19 forks source link

Proper `prelude` module #46

Closed m4rw3r closed 8 years ago

m4rw3r commented 8 years ago

Does seem like a prelude module is frowned upon and people prefer explicit use-statements.

Most of the time a local Error type will be declared (and some other types with commonly used names) which would collide with the Error type from the prelude module. It would also lock the prelude module from actually having any additions or changes in any way, since an addition could cause a name-collision with a glob-use.

Example something I expect would be common:

// my_parser.rs
use chomp::parse_only;
use chomp::ascii::decimal;
use chomp::types::{Buffer, Input, ParseResult};
use chomp::parsers::Error as ChompError;
use chomp::parsers::{
    any,
    scan,
    token,
    take,
    take_till,
};
use chomp::combinators::{
    option,
    sep_by1,
};

pub enum Error {
    ChompError(ChompError<u8>),
    ExpectedKeyword,
    // ...
}