Giter Club home page Giter Club logo

isotope's People

Contributors

kommusoft avatar michaelt293 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

isotope's Issues

renderMolecularFormula should use the Hill system

Currently, renderMolecularFormula does not produce molecular formulae strings with the right formatting. For example, the molecular formula for methane is represented as "H4C" rather than "CH4".

Nested parentheses

I was trying out the library with GHCi but when I tried an expression with nested parentheses, it didn't seem to work. Here is the GHCi session:

λ [mol|(((H2O)4)3)8|]

<interactive>:9:6:
    Could not parse formula: 1:2:
unexpected '('
expecting "Ag", "Al", "Ar", "As", "Au", "Ba", "Be", "Bi", "Br", "Ca", "Cd", "Ce", "Cl", "Co", "Cr", "Cs", "Cu", "Dy", "Er", "Eu", "Fe", "Ga", "Gd", "Ge", "He", "Hf", "Hg", "Ho", "In", "Ir", "Kr", "La", "Li", "Lu", "Mg", "Mn", "Mo", "Na", "Nb", "Nd", "Ne", "Ni", "Os", "Pa", "Pb", "Pd", "Pr", "Pt", "Rb", "Re", "Rh", "Ru", "Sb", "Sc", "Se", "Si", "Sm", "Sn", "Sr", "Ta", "Tb", "Te", "Th", "Ti", "Tl", "Tm", "Xe", "Yb", "Zn", "Zr", 'B', 'C', 'F', 'H', 'I', 'K', 'N', 'O', 'P', 'S', 'U', 'V', 'W', or 'Y'

Is it intended?

Parsing element symbols and chemical formulas

Using an older version of megaparsec (4.4.0), Isotope had really nice error messages -

ghci> [mol|Ch4|]

<interactive>:5:6: error:
    • Could not parse formula: 1:2:
unexpected 'h'
expecting "Ag", "Al", "Ar", "As", "Au", "Ba", "Be", "Bi", "Br", "Ca", "Cd", "Ce", "Cl", "Co", "Cr", "Cs", "Cu", "Dy", "Er", "Eu", "Fe", "Ga", "Gd", "Ge", "He", "Hf", "Hg", "Ho", "In", "Ir", "Kr", "La", "Li", "Lu", "Mg", "Mn", "Mo", "Na", "Nb", "Nd", "Ne", "Ni", "Os", "Pa", "Pb", "Pd", "Pr", "Pt", "Rb", "Re", "Rh", "Ru", "Sb", "Sc", "Se", "Si", "Sm", "Sn", "Sr", "Ta", "Tb", "Te", "Th", "Ti", "Tl", "Tm", "Xe", "Yb", "Zn", "Zr", '(', 'B', 'C', 'F', 'H', 'I', 'K', 'N', 'O', 'P', 'S', 'U', 'V', 'W', 'Y', or end of input
    • In the quasi-quotation: [mol|Ch4|]

With the latest version of megaparsec, error messages not as clear -

ghci> [mol|Ch4|]

<interactive>:2:6: error:
    • Could not parse formula: ParseError {errorPos = SourcePos {sourceName = "", sourceLine = Pos 1, sourceColumn = Pos 2} :| [], errorUnexpected = fromList [Tokens ('h' :| "")], errorExpected = fromList [Tokens ('(' :| ""),Tokens ('A' :| "g"),Tokens ('A' :| "l"),Tokens ('A' :| "r"),Tokens ('A' :| "s"),Tokens ('A' :| "u"),Tokens ('B' :| ""),Tokens ('B' :| "a"),Tokens ('B' :| "e"),Tokens ('B' :| "i"),Tokens ('B' :| "r"),Tokens ('C' :| ""),Tokens ('C' :| "a"),Tokens ('C' :| "d"),Tokens ('C' :| "e"),Tokens ('C' :| "l"),Tokens ('C' :| "o"),Tokens ('C' :| "r"),Tokens ('C' :| "s"),Tokens ('C' :| "u"),Tokens ('D' :| "y"),Tokens ('E' :| "r"),Tokens ('E' :| "u"),Tokens ('F' :| ""),Tokens ('F' :| "e"),Tokens ('G' :| "a"),Tokens ('G' :| "d"),Tokens ('G' :| "e"),Tokens ('H' :| ""),Tokens ('H' :| "e"),Tokens ('H' :| "f"),Tokens ('H' :| "g"),Tokens ('H' :| "o"),Tokens ('I' :| ""),Tokens ('I' :| "n"),Tokens ('I' :| "r"),Tokens ('K' :| ""),Tokens ('K' :| "r"),Tokens ('L' :| "a"),Tokens ('L' :| "i"),Tokens ('L' :| "u"),Tokens ('M' :| "g"),Tokens ('M' :| "n"),Tokens ('M' :| "o"),Tokens ('N' :| ""),Tokens ('N' :| "a"),Tokens ('N' :| "b"),Tokens ('N' :| "d"),Tokens ('N' :| "e"),Tokens ('N' :| "i"),Tokens ('O' :| ""),Tokens ('O' :| "s"),Tokens ('P' :| ""),Tokens ('P' :| "a"),Tokens ('P' :| "b"),Tokens ('P' :| "d"),Tokens ('P' :| "r"),Tokens ('P' :| "t"),Tokens ('R' :| "b"),Tokens ('R' :| "e"),Tokens ('R' :| "h"),Tokens ('R' :| "u"),Tokens ('S' :| ""),Tokens ('S' :| "b"),Tokens ('S' :| "c"),Tokens ('S' :| "e"),Tokens ('S' :| "i"),Tokens ('S' :| "m"),Tokens ('S' :| "n"),Tokens ('S' :| "r"),Tokens ('T' :| "a"),Tokens ('T' :| "b"),Tokens ('T' :| "e"),Tokens ('T' :| "h"),Tokens ('T' :| "i"),Tokens ('T' :| "l"),Tokens ('T' :| "m"),Tokens ('U' :| ""),Tokens ('V' :| ""),Tokens ('W' :| ""),Tokens ('X' :| "e"),Tokens ('Y' :| ""),Tokens ('Y' :| "b"),Tokens ('Z' :| "n"),Tokens ('Z' :| "r"),Label ('i' :| "nteger"),EndOfInput], errorCustom = fromList []}
    • In the quasi-quotation: [mol|Ch4|]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.