ghcid 0.8 → 0.8.1
raw patch · 6 files changed
+23/−10 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.txt +3/−0
- LICENSE +1/−1
- README.md +12/−4
- ghcid.cabal +2/−2
- src/Ghcid.hs +1/−1
- src/Language/Haskell/Ghcid.hs +4/−2
CHANGES.txt view
@@ -1,5 +1,8 @@ Changelog for ghcid (* = breaking change) +0.8.1, released 2020-01-09+ #293, passing --allow-eval should disable -fno-code by default+ #291, try and be more robust to mucking with the console 0.8, released 2019-12-04 * Add an extra field to GhciError #288, include the last line of stderr in shutdown messages
LICENSE view
@@ -1,4 +1,4 @@-Copyright Neil Mitchell 2014-2019.+Copyright Neil Mitchell 2014-2020. All rights reserved. Redistribution and use in source and binary forms, with or without
README.md view
@@ -48,17 +48,21 @@ In general, to use `ghcid`, you first need to get `ghci` working well for you. In particular, craft a command line or `.ghci` file such that when you start `ghci` it has loaded all the files you care about (check `:show modules`). If you want to use `--test` check that whatever expression you want to use works in that `ghci` session. Getting `ghci` started properly is one of the hardest things of using `ghcid`, and while `ghcid` has a lot of defaults for common cases, it doesn't always work out of the box. +### Evaluation++Using the `ghci` session that `ghcid` manages you can also evaluate expressions:++* You can pass any `ghci` expression with the `--test` flag, e.g. `--test=:main`, which will be run whenever the code is warning free (or pass `--warnings` for when the code is merely error free).+* If you pass the `--allow-eval` flag then comments in the source files such as `-- $> expr` will run `expr` after loading - see [this blog post](https://jkeuhlen.com/2019/10/19/Compile-Your-Comments-In-Ghcid.html) for more details.+ ### FAQ #### This isn't as good as full IDE-I've gone for simplicity over features. It's a point in the design space, but not necessarily the best point in the design space for you. For "real" IDEs see [the Haskell wiki](http://www.haskell.org/haskellwiki/IDEs).+I've gone for simplicity over features. It's a point in the design space, but not necessarily the best point in the design space for you. For a "real" IDE see [Ghcide](https://github.com/digital-asset/ghcide). #### If I delete a file and put it back it gets stuck. Yes, that's a [bug in GHCi](https://ghc.haskell.org/trac/ghc/ticket/9648). If you see GHCi getting confused just kill `ghcid` and start it again. -#### I want to run my tests when files change.-You can pass any `ghci` expression with the `--test` flag, e.g. `--test=:main`, which will be run whenever the code is warning free (or pass `--warnings` for when the code is merely error free).- #### I want to run arbitrary commands when arbitrary files change. This project reloads `ghci` when files loaded by `ghci` change. If you want a more general mechanism something like [Steel Overseer](https://github.com/schell/steeloverseer) or [Watchman](https://facebook.github.io/watchman/) will probably work better. @@ -83,3 +87,7 @@ #### I use Alex (`.x`) and Happy (`.y`) files, how can I check them? Ghcid only notices when the `.hs` files change. To make it respond to other files you can pass the `.x` and `.y` files to `--restart`, e.g. `--restart=myparser.y`. As long as you set the initial command to something that runs Happy/Alex (e.g. `cabal repl`) then when those files change everything will restart, causing the initial command to be rerun.++#### How do I run pass command arguments with --test?++`ghcid ... --test Main.main --setup ":set args myargs"`
ghcid.cabal view
@@ -1,13 +1,13 @@ cabal-version: >= 1.18 build-type: Simple name: ghcid-version: 0.8+version: 0.8.1 license: BSD3 license-file: LICENSE category: Development author: Neil Mitchell <ndmitchell@gmail.com>, jpmoresmau maintainer: Neil Mitchell <ndmitchell@gmail.com>-copyright: Neil Mitchell 2014-2019+copyright: Neil Mitchell 2014-2020 synopsis: GHCi based bare bones IDE description: Either \"GHCi as a daemon\" or \"GHC + a bit of an IDE\". A very simple Haskell development tool which shows you the errors in your project and updates them whenever you save. Run @ghcid --topmost --command=ghci@, where @--topmost@ makes the window on top of all others (Windows only) and @--command@ is the command to start GHCi on your project (defaults to @ghci@ if you have a @.ghci@ file, or else to @cabal repl@).
src/Ghcid.hs view
@@ -145,7 +145,7 @@ stack <- firstJustM findStack [".",".."] -- stack file might be parent, see #62 let cabal = map (curdir </>) $ filter ((==) ".cabal" . takeExtension) files- let opts = ["-fno-code" | null test && null run] ++ ghciFlagsRequired ++ ghciFlagsUseful+ let opts = ["-fno-code" | null test && null run && not allow_eval] ++ ghciFlagsRequired ++ ghciFlagsUseful return $ case () of _ | Just stack <- stack -> let flags = if null arguments then
src/Language/Haskell/Ghcid.hs view
@@ -88,8 +88,10 @@ -- useful to avoid overloaded strings by showing the ['a','b','c'] form, see #109 let showStr xs = "[" ++ intercalate "," (map show xs) ++ "]" let msg = "#~GHCID-FINISH-" ++ show i ++ "~#"- writeInp $ "INTERNAL_GHCID.putStrLn " ++ showStr msg ++ "\n" ++- "INTERNAL_GHCID.hPutStrLn INTERNAL_GHCID.stderr " ++ showStr msg+ -- Prepend a leading \n to try and avoid junk already on stdout,+ -- e.g. https://github.com/ndmitchell/ghcid/issues/291+ writeInp $ "\nINTERNAL_GHCID.putStrLn " ++ showStr msg ++ "\n" +++ "INTERNAL_GHCID.hPutStrLn INTERNAL_GHCID.stderr " ++ showStr msg return $ isInfixOf msg let syncFresh = do modifyVar_ syncCount $ return . succ