Skip to content

Allow documentary type signatures

In some cases (e.g., lens) it's useful to document a binding with a more specific type signature than the true one, to show a useful special case. Unfortunately, this documentation can potentially be wrong or go out of date. I'd like to propose a pragma for this:

{-# Documentary #-} f :: T -> U

would ask the type checker to verify that f :: T -> U. Specifically, it would have the effect of creating and type checking, but then discarding, a hidden binding

f_doc :: T -> U
f_doc t = f t
Trac metadata
Trac field Value
Version 7.10.3
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information