-
Notifications
You must be signed in to change notification settings - Fork 195
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
Add interactive HLint website #144
Comments
Here's a demo of something I put together this afternoon. It needs to be cleaned up (and it relies on a hacked version of ghc-exactprint) but I think it could be good.. |
Very cool! |
I like this a lot. What tech did you use? Haskell server or GHCJS? |
I used servant. I tried to use GHCJS but it's hard to compile dependencies which depend on GHC. |
Something based on GHCJS would be my preference, so we can skip server issues. |
I have a sloppy but functional proof-of-concept up at https://lively-opaque-snipe.glitch.me/ using GHCJS, the code for which is here. I mostly followed the steps outlined in this blog post I wrote, and I had to make a couple of small changes to HLint:
The resulting app seems pretty laggy, because my Reflex-fu is weak and I'm probably using the HLint API in the simplest and slowest possible way, so it might not appear to work at first. I suggest trying with a warning-laden snippet of code such as: module Main where
main = do
print $ "Hello world"
print $ "Does this work?" and then editing the text until hints show up: I'd love to know what you think and if this is useful at all. |
Sweet!!!! This is awesome. Yep, it's a tad slow, but not that slow given what it's doing. I would have thought moving the parse/check compilation onto a separate background worker thread and cancelling existing compilations when a new one starts, or queuing them and deleting multiple ones, would have been sufficient. Two strands of thought here:
First one would be all about reducing the number of patches you have to maintain.
And to make the UI experience better, I suspect all these are on your list if it goes beyond proof of concept:
But fundamentally, yes, this is exactly what I was after, and I'd be very happy to put it front-and-centre on the README/Cabal and advertise people to it. |
Wonderful! I was envisioning something like ormolu-live and planning to reuse some of that code as well, but I thought it would be useful to get your feedback as soon as I got it minimally working so I could see if I was on the right track.
At the moment I'm only using the plain suggestions provided by HLint instead of the HTML ones and I've put no effort into styling or highlighting the input in the textarea (syntax highlighting, line numbers, etc.) so there's a lot of low-hanging fruit for me to work on. |
ormulu-live looks like a great target.
Awesome work thus far, super happy. |
Maybe patching |
@shayne-fletcher - that is indeed the intention of the GHSJS build system - they try and shim out HsVersions.h with their own version so they can pretend to be a different version. But they weren't aiming to invalid ghc-lib, only GHC itself. |
@ndmitchell Looking into the contents of |
Fixed in ghc-lib-parser-8.10.1.20200518 (released). |
I put this down for a while and when I picked it back up one of my dependencies had vanished from the internet Edit 1: It seemed to work before but is broken right now when I try it, sorry about that! |
Still looks good - would be great to make available more widely :) |
The repo is now at https://github.com/vaibhavsagar/hlint-live with the accompanying continously-deployed website at https://vaibhavsagar.com/hlint-live/. I'm not sure how much energy I can commit to doing all the fit and finish work that is required but I'm happy to accept contributions and/or transfer ownership to someone with more resources. I find it ironic that the most technically challenging part of this project (running HLint in the browser) was relatively easy but the least technically interesting/seemingly easiest things (adding CodeMirror, CSS, etc) are what I'm finding most difficult. |
Thanks, this is a great start :) |
Give a page you can paste in text and get back HLint suggestions. Either just link to an existing paste site that does it, or write my own on top of the HLint API.
The text was updated successfully, but these errors were encountered: