GithubHelp home page GithubHelp logo

hotteok's Issues

More annotation-heavy approach

Documenting some things in Haddock is needlessly difficult. A good (and flaky) example is trying to document DerivingVia derivations:

-- | Some stripey data type.
newtype Foo = Foo Bar
    deriving ( Semigroup -- ^ @since 4.10
                 , Monoid -- ^ @since 4.12
                 ) via (Sum Bar)

This is extremely icky and quite awkward to write. If we make the 'new-style' documentation comments lean more on annotations, we could replace it with something like this:

-- hotteok:
-- 
-- Some stripy data type.
-- @deriving
--     Semigroup
--     @since 4.10
-- @deriving
--     Monoid
--     @since 4.12
newtype Foo = Foo Bar
    deriving (Semigroup, Monoid) via (Sum Foo)

Docbook back-end?

This is an interesting possibility. If we can generate DocBook, we can then potentially render it into a wide range of formats, rather than limiting ourselves to HTML.

Documentation database

Having to rely on GHC for linkage information is probably inevitable to some degree. However, we could store that in an embedded database, which means that future rebuilds will only need to call out to GHC for stuff that's stale.

New annotations

Based on #3, these are some of the annotations we should add in my opinion:

  • @see, functioning as a 'See also' section, similar to the one in JavaDocs
  • @deriving, as per #3.
  • @law for type class laws
  • @method for documenting individual methods of a type class
  • @throws for indicating what exceptions people should expect to have to catch from this function
  • @totality to describe whether something is total or partial
  • @unsafe for functions that should be used with care, like unsafePerformIO

Any others?

AsciiMath vs. LaTeX

LaTeX is a complex beast, and rendering it is no mean feat (even Pandoc basically gives up and outsources it). Having it be supported in the 'new-style' documentation comments is probably unnecessary as well, since most people only want a small amount of functionality LaTeX actually offers.

AsciiMath seems to offer some reasonably pleasant syntax for basically everything folks would want from LaTeX in a documentation generator, and embedding it (as well as natively rendering) is quite easy. Should we use this instead?

Use Cabal (the library)

It seems almost a complete no-brainer, as the needs served by Cabal overlap with ours considerably.

Different marker for 'new-style' versus 'legacy'

Haddock has a set of 'documentation markers' indicating that the comment in question is to be treated as documentation to render:

-- | This is a Haddock comment.
foo :: String
foo = "bar"

instance Foo Bar where
    quux = id -- ^ So is this.

Should we maintain this behaviour for the 'new-style' documentation comments? I was thinking that something like this would be good:

-- hotteok:
-- The rest is documentation.
foo :: String
foo = "bar"

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.