-
Notifications
You must be signed in to change notification settings - Fork 90
Description
Currently, the type environment restarts "numbering" tvars in type signatures from :a on. This can make docstrings in both Sly and generated documentation less clear.
Consider the standard library reference documentation for MonadState :: get:
GET :: (:A :B)
That's much less clear than the way the type signature is expressed in the declare in the code:
(get (:m :s))
For longer functions it gets even worse. Compare this function in the generated docstring:
UNMASK-THREAD-FINALLY :: ∀ A B C D E. (UNLIFTIO D A) (LIFTTO D E) (MONADIOTHREAD B C D) ⇒ (C → (UNMASKFINALLYMODE → (D UNIT)) → (E UNIT))
to the declare (maybe not immediately obvious, but trust me it's better):
(declare unmask-thread-finally ((UnliftIo :r :io) (LiftTo :r :m) (MonadIoThread :rt :t :r)
=> :t -> (UnmaskFinallyMode -> :r Unit) -> :m Unit))I think the worst part about this is that, in a library, you build up a consistent pattern of naming the tvars so that it kind of makes sense. In the above, :r is used for an UnLiftIo target consistently, :rt is used for a Runtime, :t is used for thread, etc. But across a whole library, those patterns get lost and what is :io in every declare block throughout the codebase could be :A in one function and :R in another.