Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-implicits don't show up in :doc #3264

Closed
arianvp opened this issue Jul 10, 2016 · 5 comments
Closed

Auto-implicits don't show up in :doc #3264

arianvp opened this issue Jul 10, 2016 · 5 comments

Comments

@arianvp
Copy link

arianvp commented Jul 10, 2016

Idris Version: 0.12

Given the following datatype:

data Api : capture -> query -> req -> resp -> Type where
  |||
  ||| @ paths  a list of paths we can choose from
  ||| @ thereShouldBePaths  A proof that we have at least one path defined
  ||| @ noOverlappingPaths  A Proof that we have no paths that overlap
  OneOf : (Eq capture, Eq query)
        => (paths : List (Path capture query req resp))
       -> {auto thereShouldBePaths: NonEmpty paths}
       -> {auto noOverlappingPaths: map Servis.extractPathInfo paths = nub (map Servis.extractPathInfo paths)}
       -> Api capture query req resp

Expected behaviour of :doc:

Servis.OneOf : Eq capture => Eq query => (paths : List (Path capture
                                                             query
                                                             req
                                                             resp)) ->
    Api capture query req resp

    Arguments:
        paths : List (Path capture query req resp)  -- a list of paths we can choose from

        (implicit) thereShouldBePaths : NonEmpty paths  -- A proof that we have at least one
        path defined

        (implicit) noOverlappingPaths : map extractPathInfo paths =
                                        nub (map extractPathInfo paths)  -- A Proof that we have no paths
        that overlap

    The function is Total

Actual behaviour:

Servis.OneOf : Eq capture => Eq query => (paths : List (Path capture
                                                             query
                                                             req
                                                             resp)) ->
    {auto thereShouldBePaths : NonEmpty paths} ->
    {auto noOverlappingPaths : map extractPathInfo paths =
                               nub (map extractPathInfo paths)} -> Api capture query req resp

    Arguments:
        paths : List (Path capture query req resp)  -- a list of paths we can choose from

    The function is Total

@jfdm
Copy link
Contributor

jfdm commented Jul 13, 2016

@arianvp Thanks for the issue report. IdrisDoc was a contributed feature of Idris, as part of a Student Project. It is my understanding that the scope of the project was purposefully constrained. An understandable notion, so it is possible that auto implicit were not added.

I think that all labelled documentation should be present. I shall have a quick look today to see if I can fix it, otherwise: PRs welcome!

@jfdm
Copy link
Contributor

jfdm commented Jul 13, 2016

So, from a cursory glance something interesting is happening with Idris and implicits. I have filed an Issue in #3266. This may or may not be the cause of auto implicit documentation not being displayed.

I am still investigating the problem.

I hope this hasn't caused too much issue in your workflow.

However, for those interested in this issue, here is a small MFE:

module IdrisDocIssue

import Data.List

%default total

||| A foobar with an auto implicit
data Foobar : Type where
  ||| New Foo
  |||
  ||| @xs Some `xs`
  ||| @ys Some `ys`
  ||| @prf1 A prf
  NewFoo : (xs : List String)
        -> (ys : List Nat)
        -> {auto prf : NonEmpty ys}
        -> Foobar

@jfdm
Copy link
Contributor

jfdm commented Jul 13, 2016

There seems to be a case missing in the showing of arguments. Will try and fix if possible.

@jfdm jfdm self-assigned this Jul 13, 2016
@jfdm
Copy link
Contributor

jfdm commented Jul 13, 2016

There is a PR #3267 that fixes IdrisDoc to print documentation for auto implicits. This issue should auto close once the PR has been merged.

@jfdm jfdm closed this as completed in 088846b Jul 13, 2016
jfdm added a commit that referenced this issue Jul 13, 2016
Fixes #3264 Show auto implicit documentaton in Idris Doc.
@arianvp
Copy link
Author

arianvp commented Jul 13, 2016

Thanks a bunch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants