- 
                Notifications
    
You must be signed in to change notification settings  - Fork 9
 
          Consider something a builtin when there's no sourceSpan
          #32
        
          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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I refactored my code a bit.
| 
           Also, I changed the string to be   | 
    
| 
           I think it might be preferable to use the same mechanism as the compiler here: a module is considered builtin if its first component is equal to "Prim", i.e.   | 
    
          
 Nice idea, I didn't know  We don't have access to module names as defined in source files here, though. We are just operating on file paths. And file names are not guaranteed to be the same as module names, so there may be false-positives.  | 
    
| 
           At the same time, I believe that nothing can go wrong when relying on   | 
    
| 
           While I'm not aware of any case where this might fail now, it's definitely plausible that the compiler might fail to produce a source span for something which isn't builtin: perhaps as the result of a bug, or as the result of some code having been put together during desugaring or otherwise having been produced or rewritten within the compiler, such as via deriving.  | 
    
| 
           Don't you have access to the module name via the   | 
    
          
 Yep, we can use it, thanks.  | 
    
| 
           @klntsky thank you so much for taking care of the fixes ❤️ I'll merge and cut a new release.  | 
    
So I patched
pursto include Prim modules when generating thedocs.jsonfiles: purescript/purescript#3769It turns out we were assuming the
sourceSpanwas always there, but it'snullin the case of builtins (which makes sense), so with this PR we'll consider something a "builtin" when there' nosourceSpanavailable.Demo: