haskell / haddock

Haskell Documentation Tool
www.haskell.org/haddock/
BSD 2-Clause "Simplified" License
361 stars 241 forks source link

Instance since forever #1274

Open treeowl opened 3 years ago

treeowl commented 3 years ago

There's a special case where a @since annotation on an instance can be just as annoying as it is helpful: when the instance has existed for as long as the youngest type in its instance head. In this case, a developer looking to use the instance may see the @since annotation and waste time checking that their Cabal bounds are tight enough, when in fact they already did everything necessary when they checked the bounds for the types. I'd like to be able to write

-- | @since forever
instance Num a => Monoid (Sum a)
andreasabel commented 2 years ago

Something like this could also be useful when you write new packages. Then @since forever or simply @since (with no version) could be understood that the item has existed since the initial version---as opposed to a missing @since whose semantics should stay to be "dunno".

With a lightweight @since forever or @since we could then also have a warning or if an item does not have a since information.