packages feed

debug 0.0 → 0.0.1

raw patch · 4 files changed

+31/−5 lines, 4 filesdep +open-browserPVP ok

version bump matches the API change (PVP)

Dependencies added: open-browser

API changes (from Hackage documentation)

Files

CHANGES.txt view
@@ -1,3 +1,6 @@ Changelog for Debug +0.0.1, released 2017-12-18+    Make debugView work on Linux+0.0, released 2017-12-15     Initial version
README.md view
@@ -1,6 +1,6 @@-# Shake [![Hackage version](https://img.shields.io/hackage/v/debug.svg?label=Hackage)](https://hackage.haskell.org/package/debug) [![Stackage version](https://www.stackage.org/package/debug/badge/lts?label=Stackage)](https://www.stackage.org/package/debug) [![Linux Build Status](https://img.shields.io/travis/ndmitchell/debug.svg?label=Linux%20build)](https://travis-ci.org/ndmitchell/debug) [![Windows Build Status](https://img.shields.io/appveyor/ci/ndmitchell/debug.svg?label=Windows%20build)](https://ci.appveyor.com/project/ndmitchell/debug)+# Haskell Debugger [![Hackage version](https://img.shields.io/hackage/v/debug.svg?label=Hackage)](https://hackage.haskell.org/package/debug) [![Stackage version](https://www.stackage.org/package/debug/badge/lts?label=Stackage)](https://www.stackage.org/package/debug) [![Linux Build Status](https://img.shields.io/travis/ndmitchell/debug.svg?label=Linux%20build)](https://travis-ci.org/ndmitchell/debug) [![Windows Build Status](https://img.shields.io/appveyor/ci/ndmitchell/debug.svg?label=Windows%20build)](https://ci.appveyor.com/project/ndmitchell/debug) -Module for debugging Haskell programs. To use, take the functions that you are interested in debugging, e.g.:+A library for debugging Haskell programs. To use, take the functions that you are interested in debugging, e.g.:  ```haskell module QuickSort(quicksort) where@@ -43,3 +43,21 @@ The call to `debugView` starts a web browser to view the recorded information, looking something like:  ![Debug view output](debug.png)++## Limitations++This tool is quite new, so it has both limitations, places it is incomplete and bugs. Some notable issues:++* It calls `show` on all the values in encounters, meaning they must all have a `Show` instance (it defines a global `Show` instance which should get used as a fallback), and they will be fully evaluated. If your program relies on laziness it probably won't work.+* It doesn't really understand shadowed variables, so it will work, but the debug results will be lower quality.+* For function values it won't give you a whole lot of information.++## Alternatives++For practical alternatives for debugging Haskell programs you may wish to consider:++* [GHCi debugger](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#the-ghci-debugger), simple imperative-style debugger in which you can stop a running computation in order to examine the values of variables. The debugger is integrated into GHCi. Robust, reliable, somewhat difficult to use.+* [Hood](https://hackage.haskell.org/package/hood) and [Hoed](https://hackage.haskell.org/package/Hoed), a value-based observational debugger with a difficult user interface, deals well with laziness.+* [Hat](https://hackage.haskell.org/package/hat), good ideas, but I've never got it working.++Compared to the above, `debug` stresses simplicitly of integration and user experience.
debug.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.18 build-type:         Simple name:               debug-version:            0.0+version:            0.0.1 license:            BSD3 license-file:       LICENSE category:           Development, Debugging@@ -38,6 +38,7 @@         containers,         directory,         template-haskell,+        open-browser,         uniplate,         js-jquery 
src/Debug/Record.hs view
@@ -23,11 +23,11 @@ import Data.List.Extra import System.IO import System.Directory-import System.Process.Extra import System.IO.Unsafe import Text.Show.Functions() -- Make sure the Show for functions instance exists import qualified Data.Map as Map import qualified Language.Javascript.JQuery as JQuery+import Web.Browser import Paths_debug  @@ -124,7 +124,11 @@         (hClose . snd)         (return . fst)     debugSave file-    system_ file+    b <- openBrowser file+    unless b $+        putStrLn $+            "Failed to start a web browser, open: " ++ file ++ "\n" +++            "In future you may wish to use 'debugSave'."   #if __GLASGOW_HASKELL__ >= 800