slamdata / purescript-markdown

A Purescript library for parsing SlamData's dialect of Markdown.
Other
36 stars 23 forks source link

core parser #3

Closed jdegoes closed 9 years ago

jdegoes commented 9 years ago

The core parser should be capable of parsing a subset of Common Markdown to a strongly-typed ADT (SlamDown), as outlined on the project's README.md page. There should be no support for parsing HTML.

NightRa commented 9 years ago

Thinking about the strong-typeness of the ADT: For example, the headers can have weight only from 1 to 6. There are a couple of options:

  1. Use a plain integer as the README does, but then creating HTML may fail on an invalid integer. - invalid representable Markdown.
  2. Use prisms and an underlying integer. - As Purescript isn't dependantly typed, we might encounter places where we are sure the header size is provably correct (manual construction as in the README, the parser..), but we still encounter Maybe's.
  3. Create a sum type for 1..6.

What would be the preferred option?

jdegoes commented 9 years ago

(3) is the preferred option because it's simple and also type safe.