def- / ghc-vis Goto Github PK
View Code? Open in Web Editor NEWVisualize live Haskell data structures in GHCi
Home Page: https://dennis.felsing.org/ghc-vis
License: Other
Visualize live Haskell data structures in GHCi
Home Page: https://dennis.felsing.org/ghc-vis
License: Other
Could there be deployed a 0.9 version including latest master?
GHC 7.8.3 32bit, Windows
Consider the following example:
data Pair2 = Pair2 !Int !Int
let p2 = Pair2 (1+2) (3+4)
:vis
:view p2
the window is empty and nothing works. When I close the window and do
:vis
:view p2
I get
Prelude> Segmentation fault
. That's a minimal example I constructed; however, this exact same bug happened to me many times when trying to work with ghc-vis
on a small program.
@def- what work do you think is needed to get this project up and running again?
It will be great if BCO objects are hidden by default and shown only with an option. Currently they add a lot of noise and for the common case they are unnessecery.
When compiling with GHC 8.0.1 on NixOS, I have the following problems:
base
and transformers
.ImpredicativeTypes
extension used in that file. It seems to me that there are two paths to fixing these errors: either add a type signature to the Nothing
on line 228 and to the definition of withPNGSurface
, or disable ImpredicativeTypes
and fix another error, labelled Error 3 below. If you can compile without ImpredicativeTypes
on GHC 7.10, I strongly suspect it will compile on GHC 8.0.1 without modification.src/GHC/Vis.hs:228:16: error:
• Couldn't match type ‘forall a. Maybe a’ with ‘Maybe String’
Expected type: IO (Maybe String)
Actual type: IO (forall a. Maybe a)
• In a stmt of a 'do' block: return Nothing
In the expression:
do { put $ ExportSignal ((\ (Left x) -> x) mbDrawFn) filename;
return Nothing }
In a case alternative:
Left _
-> do { put $ ExportSignal ((\ (Left x) -> x) mbDrawFn) filename;
return Nothing }
src/GHC/Vis.hs:233:22: error:
• Couldn't match type ‘forall a a1 a2.
(RealFrac a2, RealFrac a1) =>
FilePath -> a1 -> a2 -> (Surface -> IO a) -> IO a’
with ‘forall a.
FilePath -> Double -> Double -> (Surface -> IO a) -> IO a’
Expected type: Either
(forall a.
FilePath -> Double -> Double -> (Surface -> IO a) -> IO a)
b
Actual type: Either
(forall a a1 a2.
(RealFrac a2, RealFrac a1) =>
FilePath -> a1 -> a2 -> (Surface -> IO a) -> IO a)
b
• In the expression: Left withPNGSurface
In a case alternative: ".png" -> Left withPNGSurface
In the expression:
case map toLower (reverse . take 4 . reverse $ filename) of {
".svg" -> Left withSVGSurface
".pdf" -> Left withPDFSurface
".png" -> Left withPNGSurface
_ : ".ps" -> Left withPSSurface
_ -> Right
"Unknown file extension, try one of the following: .svg, .pdf, .ps, .png" }
src/GHC/Vis.hs:569:29: error:
• Couldn't match type ‘DrawFunction’
with ‘FilePath -> Double -> Double -> (Surface -> IO a0) -> IO a0’
Expected type: View
-> (FilePath -> Double -> Double -> (Surface -> IO a0) -> IO a0)
-> String
-> IO ()
Actual type: View -> DrawFunction -> String -> IO ()
• In the first argument of ‘runCorrect’, namely ‘exportView’
In the first argument of ‘(>>=)’, namely ‘runCorrect exportView’
In the first argument of ‘catch’, namely
‘(runCorrect exportView >>= \ e -> e d f)’
I have installed ghc-vis succesfully in sandbox with:
cabal install ghc-vis --disable-library-profiling
When I start cabal-repl
and execute:
:set -package ghc-vis
Output:
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package bytestring-0.10.4.0 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.3.1 ... linking ... done.
Loading package text-1.2.0.4 ... linking ... done.
Loading package utf8-string-1 ... linking ... done.
Loading package cairo-0.13.1.0 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package fgl-5.5.1.0 ... linking ... done.
Loading package binary-0.7.1.0 ... linking ... done.
Loading package filepath-1.3.0.2 ... linking ... done.
Loading package old-locale-1.0.0.6 ... linking ... done.
Loading package time-1.4.2 ... linking ... done.
Loading package unix-2.7.0.1 ... linking ... done.
Loading package directory-1.2.1.0 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package process-1.2.0.0 ... linking ... done.
Loading package Cabal-1.18.1.5 ... linking ... done.
Loading package bin-package-db-0.0.0.0 ... linking ... done.
Loading package hoopl-3.10.0.1 ... linking ... done.
Loading package hpc-0.6.0.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package ghc-7.8.4 ... linking ... done.
Loading package ghc-heap-view-0.5.3 ... linking ... done.
Loading package colour-2.3.3 ... linking ... done.
Loading package dlist-0.7.1.1 ... linking ... done.
Loading package polyparse-1.9 ... linking ... done.
Loading package stm-2.4.4 ... linking ... done.
Loading package transformers-compat-0.4.0.4 ... linking ... done.
Loading package exceptions-0.8.0.2 ... linking ... done.
Loading package temporary-1.2.0.3 ... linking ... done.
Loading package wl-pprint-text-1.1.0.3 ... linking ... done.
Loading package graphviz-2999.17.0.2 ... linking ... done.
Loading package glib-0.13.1.0 ... linking ... done.
Loading package gio-0.13.0.4 ... linking ... done.
Loading package pango-0.13.0.5 ... linking ... done.
Loading package gtk-0.13.4 ... linking ... done.
Loading package svgcairo-0.13.0.2 ... linking ... done.
Loading package xdot-0.2.4.6 ... linking ... done.
Loading package ghc-vis-0.7.2.7 ... linking ... done.
When I execute:
:vis
Output:
unknown command ':vis' use :? for help.
Any idea what is going wrong?
Ubuntu and GHC 7.8.4
Windows 8.1 64bit, Haskell Platform 2014.2.0.0 32bit.
Following the process from page installing-windows, the last step does not work:
cabal install ghc-vis --enable-shared --disable-library-profiling
Multiple errors Perhaps you haven't installed the "dyn" libraries for package base
(and other packages).
Trying without --enable-shared
:
cabal install ghc-vis --disable-library-profiling
completes without error. Perhaps the instructions should be updated.
Finally, after the message
Follow the instructions in the output of cabal install ghc-vis to setup the ghci script.
nothing is displayed.
Using the latest cabal-install
cabal-install version 1.20.0.3
using version 1.20.0.2 of the Cabal library
Perhaps, cabal hides the message.
I copied ghci
from .cabal-sandbox/i386-windows-ghc-7.8.3/ghc-vis-0.7.2.5
to ~/.ghci
and when running ghci
and the :vis
command, I am getting
Prelude> :vis
<interactive>:2:1: Not in scope: `GHC.Vis.vis'
because I have ghc-vis
installed in the cabal sandbox. How can this be used from the sandbox?
Hi,
as a way to work around the issue with GHC-7.10, it might be prudent to upgrade to gtk3.
I gave it a shot and it compiles, but when I run it from ghci, I get
(<interactive>:21898): GLib-GObject-WARNING **: cannot register existing type 'GtkWidget'
(<interactive>:21898): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
(<interactive>:21898): GLib-GObject-WARNING **: cannot register existing type 'GtkBuildable'
(<interactive>:21898): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed
(<interactive>:21898): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(<interactive>:21898): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
(<interactive>:21898): Gtk-CRITICAL **: IA__gtk_widget_show_all: assertion 'GTK_IS_WIDGET (widget)' failed
Using it in ghc yields:
(nonghci-test:22194): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
I’ll keep digging.
let a = "11"
> :view a
> ghc: Unknown opcode 0
CallStack (from HasCallStack):
error, called at src/GHC/Disassembler.hs:238:18 in ghc-heap-view-0.5.9-I35KGkMGAdhFBgqAev4Hpi:GHC.Disassembler
CentOS 7, GHC 8.0.2 (LTS 8.8) from master branch of ghc-vis
I'm having a hell of a time (in a bad way) figuring how to get ghc-vis setup in a stack project.
Can a new version be uploaded of ghc-vis be uploaded to Hackage?
I just installed ghc-vis 0.7.2.3 with Cabal 1.20 installed, and it does not install the ghci script, it seems:
$ find ~/.cabal/ -name ghci
/home/jojo/.cabal/share/ghc-heap-view-0.5.1/ghci
/home/jojo/.cabal/share/ghc-heap-view-0.4.2.0/ghci
/home/jojo/.cabal/share/ghc-heap-view-0.5/ghci
/home/jojo/.cabal/share/x86_64-linux-ghc-7.6.3/ghc-vis-0.7.2.3/ghci
Maybe related: Installing it does not print the usual To use ghc-vis you have to load its ghci file in GHCi. To do ...
message.
minimal session to recreate:
$ ghci
snip
Loading package ghc-vis-0.7.2.7 ... linking ... done.
λ> let a = [1..5]
λ> :view a
λ> let b = filter even a
λ> :view b
ghc: Unknown opcode 0
Currently, the base version is restricted to <4.8
. Since 4.8 can reasonably be expected to come out real soon now, it's probably time to see what needs to be changed to make it work with that. Many packages experience build failures related to the Applicative => Monad
change. I don't know if this is one of them.
cabal install fails for when using ghc 8.0.2:
I am not able to visualize Haskell expressions using ghc-vis on Ubuntu. A simplified GHCi session transcript follows:
$ ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
...
λ: :vis
Loading package array-0.4.0.1 ... linking ... done.
...
Loading package xdot-0.2.4.7 ... linking ... done.
Loading package ghc-vis-0.7.2.7 ... linking ... done.
(visualization window appears)
λ: let x = head [1 .. 5]
λ: :view x
: Command not found: dot
λ:
I went through the first moves of the documentation and this happened:
Prelude> :vis
Loading package transformers-0.3.0.0 ... linking ... done.
[...]
Loading package ghc-vis-0.7.2.3 ... linking ... done.
it :: ()
Prelude> let x = [1..3]
x :: (Num t, Enum t) => [t]
Prelude> :view x
it ghc: Prelude.head: empty list
:: ()
Not sure where to go from here. If this could have anything to do with my system setup (Gtk issue? The UI also sometimes hangs even before I can do the above.) I can post details on that.
This will be very cool and easier for installation without any cloning.
Running the example from the tutorial page by either loading :vis
in ghci or executing runghc Main.hs
with the example code using GHC.Vis library returns error:
Main.hs: <command line>: can't load .so/.DLL for: /nix/store/6gzxjlw5pkmkc2dfvs4ah97i5icd011l-gtk3-0.14.5/lib/ghc-8.0.1/gtk3-0.14.5/libHSgtk3-0.14.5-6RxqQSGVKm7EZEV0nWrulp-ghc8.0.1.so (/nix/store/nzali6vchla7qj1755jl0nxaq9paj6qj-gtk 3-3.20.9/lib/libgdk-3.so.0: undefined symbol: wl_proxy_marshal_constructor_versioned)
Is this a ghc-vis bug, a nix bug, or a gtk bug? I've seen similar things happening on nixos with Stack, but this is different: in the Stack case nix can't even see the file, here obviously it can. A quick search revealed similar error appeared in other apps, but I found myself baffled.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.