radium-0.4.2: Chemistry

CopyrightCopyright (C) 2014 Krzysztof Langner
LicenseBSD3
MaintainerKrzysztof Langner <klangner@gmail.com>
Stabilityalpha
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Radium.Formats.Condensed

Description

Parser for condensed formula format (http:/en.wikipedia.orgwiki/Structural_formula#Condensed_formulas). . Formula can be entered as H2O, 2H2O, SO4+2 (Sulfate) or (CH3)2CO (Acetone)

Synopsis

Documentation

data Molecule a Source

Constructors

Ion (Molecule a) Int 
Molecule [Molecule a] Int 
Element a Int 

Instances

Functor Molecule 
Eq a => Eq (Molecule a) 
Show a => Show (Molecule a) 

readCondensed :: String -> SymbolMolecule Source

Parse formula

parseFormula "C2H4" `shouldBe` Molecule [Element "C" 2, Element "H", 4)]  

writeCondensed :: SymbolMolecule -> String Source

Write Molecule to string