Skip to content

Better support for inline examples with type signatures #2868

Open
@pchiusano

Description

So this works right now, allowing you to have hyperlinked type expressions inline in a Doc:

x = {{
  For example, given {{ docExample 1 '(x -> x : Map Nat Text) }}, blah blah blah.

This will render as x : Map Nat Text with the type annotation being clickable. Unfortunately, this trick only works if the annotation uses no type variables.

What should work:

somedoc = {{
  For instance in {{ docExample 1 '((x -> x) : forall a b . Map a b -> Map a b }}, 
  returns blah blah blah. 

And this could render as x : Map a b, I think with a minor tweak to the doc renderer.

Currently it renders as

(x -> x) : (∀ k v. Map k v -> Map k v)`

My proposed rule is that if the thing being rendered is a lambda with an annotation, and the first parameter of the lambda is being elided for display, move the thing to the right of the -> type arrow in as an annotation.

This could also use some better syntax than having to transclude out to docExample

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions