Fixed apply parser bug, more tests pass. Imported all unit tests from Haskell version to JS version.