Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Matt Morrow
Very nice.

Gleb Alexeyev  wrote:
  http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vacuum-ubigraph
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Gleb Alexeyev

Iavor Diatchki wrote:

Hi,
The linking problem might be due to a bug in the cabal file:  if you
have modules that are not exposed, you still need to list them in the
"other-modules" section.


This was the problem, thanks!



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Iavor Diatchki
Hi,
The linking problem might be due to a bug in the cabal file:  if you
have modules that are not exposed, you still need to list them in the
"other-modules" section.
-Iavor

On Thu, Apr 2, 2009 at 10:01 AM, Gleb Alexeyev  wrote:
> Don Stewart wrote:
>>
>> Please upload!!
>>
>
> I've run into 2 problems while trying to do this.
> The first one - haxr won't build with HTTP-4000, so I had to edit haxr.cabal
> and add the upper version bound for HTTP.
>
> The second one is puzzling me.
>
> I've cabal-installed the package, but keep getting linking errors from ghci
> (though interactive loading of the same module from source works fine):
>
> Prelude> :m + System.Vacuum.Ubigraph
> Prelude System.Vacuum.Ubigraph> view 42
> Loading package syb ... linking ... done.
> 
> Loading package vacuum-0.0.6 ... linking ... done.
> Loading package haxr-3000.1.1.2 ... linking ... done.
> Loading package vacuum-ubigraph-0.1.0.2 ... linking ... :
> /home/gleb/.cabal/lib/vacuum-ubigraph-0.1.0.2/ghc-6.10.1/HSvacuum-ubigraph-0.1.0.2.o:
> unknown symbol `vacuumzmubigraphzm0zi1zi0zi2_GraphicsziUbigraph_lvl_closure'
> ghc: unable to load package `vacuum-ubigraph-0.1.0.2'
> Prelude System.Vacuum.Ubigraph>
>
> Non-working package is here:
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vacuum-ubigraph-0.1.0.1.
>
> Any hints appreciated.
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Gleb Alexeyev

Don Stewart wrote:

Please upload!!



I've run into 2 problems while trying to do this.
The first one - haxr won't build with HTTP-4000, so I had to edit 
haxr.cabal and add the upper version bound for HTTP.


The second one is puzzling me.

I've cabal-installed the package, but keep getting linking errors from 
ghci (though interactive loading of the same module from source works fine):


Prelude> :m + System.Vacuum.Ubigraph
Prelude System.Vacuum.Ubigraph> view 42
Loading package syb ... linking ... done.

Loading package vacuum-0.0.6 ... linking ... done.
Loading package haxr-3000.1.1.2 ... linking ... done.
Loading package vacuum-ubigraph-0.1.0.2 ... linking ... : 
/home/gleb/.cabal/lib/vacuum-ubigraph-0.1.0.2/ghc-6.10.1/HSvacuum-ubigraph-0.1.0.2.o: 
unknown symbol `vacuumzmubigraphzm0zi1zi0zi2_GraphicsziUbigraph_lvl_closure'

ghc: unable to load package `vacuum-ubigraph-0.1.0.2'
Prelude System.Vacuum.Ubigraph>

Non-working package is here: 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vacuum-ubigraph-0.1.0.1.


Any hints appreciated.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Gleb Alexeyev

Daryoush Mehrtash wrote:

When I try to install the hubigraph I get the following error:



skip


Network/XmlRpc/Client.hs:113:23:
Not in scope: type constructor or class `ConnError'

Network/XmlRpc/Client.hs:113:51:
Not in scope: type constructor or class `ConnError'
cabal: Error: some packages failed to install:
HUBIGraph-0.1 depends on haxr-3000.1.1.2 which failed to install.
haxr-3000.1.1.2 failed during the building phase. The exception was:
exit: ExitFailure 1

Any ideas?



I've just run into this problem as well. It seems that haxr doesn't 
build with HTTP-4000, though its cabal file doesn't specify the upper bound.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Daryoush Mehrtash
When I try to install the hubigraph I get the following error:


:~/Desktop/hubigraph-0.1$ cabal install
Resolving dependencies...
'haxr-3000.1.1.2' is cached.
Configuring haxr-3000.1.1.2...
Preprocessing library haxr-3000.1.1.2...
Building haxr-3000.1.1.2...
[1 of 6] Compiling Network.XmlRpc.DTD_XMLRPC ( Network/XmlRpc/DTD_XMLRPC.hs,
dist/build/Network/XmlRpc/DTD_XMLRPC.o )

Network/XmlRpc/DTD_XMLRPC.hs:183:4:
Warning: Pattern match(es) are overlapped
 In the definition of `fromElem':
 fromElem (CMisc _ : rest) = ...
 fromElem (CString _ s : rest) = ...
 fromElem rest = ...
[2 of 6] Compiling Network.XmlRpc.Base64 ( Network/XmlRpc/Base64.hs,
dist/build/Network/XmlRpc/Base64.o )
[3 of 6] Compiling Network.XmlRpc.Internals ( Network/XmlRpc/Internals.hs,
dist/build/Network/XmlRpc/Internals.o )
[4 of 6] Compiling Network.XmlRpc.Server ( Network/XmlRpc/Server.hs,
dist/build/Network/XmlRpc/Server.o )
[5 of 6] Compiling Network.XmlRpc.Client ( Network/XmlRpc/Client.hs,
dist/build/Network/XmlRpc/Client.o )

Network/XmlRpc/Client.hs:113:23:
Not in scope: type constructor or class `ConnError'

Network/XmlRpc/Client.hs:113:51:
Not in scope: type constructor or class `ConnError'
cabal: Error: some packages failed to install:
HUBIGraph-0.1 depends on haxr-3000.1.1.2 which failed to install.
haxr-3000.1.1.2 failed during the building phase. The exception was:
exit: ExitFailure 1

Any ideas?

Thanks,

Daryoush

On Thu, Apr 2, 2009 at 12:25 AM, Gleb Alexeyev wrote:

> Don Stewart wrote:
>
>> Did you use hubigraph?
>>
>>http://ooxo.org/hubigraph/
>>
>> This cabalized project doesn't appear to be on hackage!
>>
>>  Oh, I wasn't aware of hubigraph until now.
> Ubigraph has very simple XML-RPC-based API so I used it directly.
> Hubigraph, of course, looks nicer with its custom monad, datatypes for
> shapes etc.
>
> BTW, it seems that you didn't notice the complete source code attached to
> my first message. Like I said it's just a quick and dirty hack, all real job
> is done by vacuum, Ubigraph server and a bit of code copy-pasted from
> vacuum-cairo.
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Gleb Alexeyev

Don Stewart wrote:

Did you use hubigraph?

http://ooxo.org/hubigraph/

This cabalized project doesn't appear to be on hackage!


Oh, I wasn't aware of hubigraph until now.
Ubigraph has very simple XML-RPC-based API so I used it directly. 
Hubigraph, of course, looks nicer with its custom monad, datatypes for 
shapes etc.


BTW, it seems that you didn't notice the complete source code attached 
to my first message. Like I said it's just a quick and dirty hack, all 
real job is done by vacuum, Ubigraph server and a bit of code 
copy-pasted from vacuum-cairo.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-01 Thread Gwern Branwen
On Wed, Apr 1, 2009 at 4:13 PM, Don Stewart  wrote:
> Did you use hubigraph?
>
>    http://ooxo.org/hubigraph/
>
> This cabalized project doesn't appear to be on hackage!

The same author also has http://ooxo.org/dtwitzen/ and
http://github.com/smly/sys35tools/tree/master

-- 
gwern
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-01 Thread Don Stewart
Did you use hubigraph?

http://ooxo.org/hubigraph/

This cabalized project doesn't appear to be on hackage!

gleb.alexeev:
> Don Stewart wrote:
>> I am pleased to announce the release of vacuum-cairo, a Haskell library
>> for interactive rendering and display of values on the GHC heap using
>> Matt Morrow's vacuum library.
>
> Awesome stuff, kudos to you and Matt Morrow!
>
> I thought it'd be fun to visualize data structures in three dimensions.  
> Attached is quick and dirty hack based on your code and Ubigraph server  
> (http://ubietylab.net/ubigraph/).
>
> The demo video (apologies for poor quality):  
> http://www.youtube.com/watch?v=3mMH1cHWB6c
>
> If someone finds it fun enough, I'll cabalize it and upload to Hackage.

> module Ubigraph where
> 
> import Network.XmlRpc.Client
> 
> type Url = String
> type VertexId = Int
> type EdgeId = Int
> 
> defaultServer = "http://127.0.0.1:20738/RPC2";
> 
> void :: IO Int -> IO ()
> void m = m >> return ()
> 
> clear :: Url -> IO ()
> clear url = void (remote url "ubigraph.clear")
> 
> newVertex :: Url -> IO VertexId
> newVertex url = remote url "ubigraph.new_vertex"
> 
> newEdge :: Url -> VertexId -> VertexId -> IO EdgeId
> newEdge url = remote url "ubigraph.new_edge"
> 
> removeVertex :: Url -> VertexId -> IO ()
> removeVertex url vid = void (remote url "ubigraph.remove_vertex" vid)
> 
> removeEgde :: Url -> EdgeId -> IO ()
> removeEgde url eid= void (remote url "ubigraph.remove_edge" eid)
> 
> 
> zeroOnSuccess :: IO Int -> IO Bool
> zeroOnSuccess = fmap (==0) 
> 
> newVertexWithId :: Url -> VertexId -> IO Bool
> newVertexWithId url vid = zeroOnSuccess (remote url 
> "ubigraph.new_vertex_w_id" vid)
> 
> newEdgeWithId :: Url -> EdgeId -> VertexId -> VertexId -> IO Bool
> newEdgeWithId url eid x y = zeroOnSuccess (remote url 
> "ubigraph.new_edge_w_id" eid x y)
> 
> setVertexAttribute :: Url -> VertexId -> String -> String -> IO Bool
> setVertexAttribute url vid attr val = zeroOnSuccess (remote url 
> "ubigraph.set_vertex_attribute" vid attr val)
> 
> setEdgeAttribute :: Url -> VertexId -> String -> String -> IO Bool
> setEdgeAttribute url eid attr val = zeroOnSuccess (remote url 
> "ubigraph.set_edge_attribute" eid attr val)

> module VacuumUbigraph where
> 
> import GHC.Vacuum
> import Data.Char
> import Text.Printf
> import Data.List
> 
> import qualified Data.IntMap as IntMap
> import qualified Data.IntSet as IntSet
> 
> import qualified Ubigraph as U
> 
> nodeStyle n =
> case nodeName n of
>   ":"  -> ("(:)", "cube", "#ff")
> 
>   -- atomic stuff is special
>   k | k `elem` ["S#" ,"I#" ,"W#"
>,"I8#" ,"I16#" ,"I32#" ,"I64#"
>,"W8#" ,"W16#" ,"W32#" ,"W64#"] -> (showLit n, "sphere", 
> "#00ff00")
>   -- chars
>   "C#" -> (show . chr . fromIntegral . head . nodeLits $ n, "sphere", 
> "#00ff00")
>   "D#" -> ("Double", "sphere", "#009900")
>   "F#" -> ("Float", "sphere", "#009900")
> 
>   -- bytestrings
>   "PS"-> (printf "ByteString[%d,%d]" (nodeLits n !! 1) (nodeLits n !! 
> 2), "cube", "#ff")
>   "Chunk" -> (printf "Chunk[%d,%d]" (nodeLits n !! 1) (nodeLits n !! 2), 
> "cube", "#ff")
> 
>   -- otherwise just the constructor and local fields
>   c   | z > 0 ->
> (c ++ show (take (fromIntegral z) $ nodeLits n), "cube", 
> "#99")
>   | otherwise -> (c, "cube", "#99")
> where z = itabLits (nodeInfo n)
> where
>   showLit n = show (head $ nodeLits n)
> 
> view a = do
>   U.clear srv
>   mapM_ renderNode nodes
>   mapM_ renderEdge edges
> where  
>   g = vacuum a
>   alist = toAdjList g
>   nodes = nub $ map fst alist ++ concatMap snd alist
>   edges = concatMap (\(n, ns) -> map ((,) n) ns) alist
> 
>   style nid = maybe ("...", "cube", "#ff") nodeStyle (IntMap.lookup 
> nid g)
> 
>   renderNode nid = do
>U.newVertexWithId srv nid
>let (label, shape, color) = style nid
>U.setVertexAttribute srv nid "label" label
>U.setVertexAttribute srv nid "shape" shape
>U.setVertexAttribute srv nid "color" color
>   
>   renderEdge (a, b) = do
>e <- U.newEdge srv a b
>U.setEdgeAttribute srv e "stroke" "dotted"
>U.setEdgeAttribute srv e "arrow" "true"
> 
>   srv = U.defaultServer
> 

> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-01 Thread Don Stewart
Please upload!!

moonpatio:
> Holy crap! That looks amazing. I think you should most definitely upload it.
> 
> 2009/4/1 Gleb Alexeyev 
> 
> Don Stewart wrote:
> 
> I am pleased to announce the release of vacuum-cairo, a Haskell 
> library
> for interactive rendering and display of values on the GHC heap using
> Matt Morrow's vacuum library.
> 
> 
> Awesome stuff, kudos to you and Matt Morrow!
> 
> I thought it'd be fun to visualize data structures in three dimensions.
> Attached is quick and dirty hack based on your code and Ubigraph server (
> http://ubietylab.net/ubigraph/).
> 
> The demo video (apologies for poor quality): 
> http://www.youtube.com/watch?v
> =3mMH1cHWB6c
> 
> If someone finds it fun enough, I'll cabalize it and upload to Hackage.
> 
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 
> 

> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-01 Thread Matt Morrow
Holy crap! That looks amazing. I think you should most definitely upload it.

2009/4/1 Gleb Alexeyev 

> Don Stewart wrote:
>
>> I am pleased to announce the release of vacuum-cairo, a Haskell library
>> for interactive rendering and display of values on the GHC heap using
>> Matt Morrow's vacuum library.
>>
>
> Awesome stuff, kudos to you and Matt Morrow!
>
> I thought it'd be fun to visualize data structures in three dimensions.
> Attached is quick and dirty hack based on your code and Ubigraph server (
> http://ubietylab.net/ubigraph/).
>
> The demo video (apologies for poor quality):
> http://www.youtube.com/watch?v=3mMH1cHWB6c
>
> If someone finds it fun enough, I'll cabalize it and upload to Hackage.
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-01 Thread Gleb Alexeyev

Don Stewart wrote:

I am pleased to announce the release of vacuum-cairo, a Haskell library
for interactive rendering and display of values on the GHC heap using
Matt Morrow's vacuum library.


Awesome stuff, kudos to you and Matt Morrow!

I thought it'd be fun to visualize data structures in three dimensions. 
Attached is quick and dirty hack based on your code and Ubigraph server 
(http://ubietylab.net/ubigraph/).


The demo video (apologies for poor quality): 
http://www.youtube.com/watch?v=3mMH1cHWB6c


If someone finds it fun enough, I'll cabalize it and upload to Hackage.
module Ubigraph where

import Network.XmlRpc.Client

type Url = String
type VertexId = Int
type EdgeId = Int

defaultServer = "http://127.0.0.1:20738/RPC2";

void :: IO Int -> IO ()
void m = m >> return ()

clear :: Url -> IO ()
clear url = void (remote url "ubigraph.clear")

newVertex :: Url -> IO VertexId
newVertex url = remote url "ubigraph.new_vertex"

newEdge :: Url -> VertexId -> VertexId -> IO EdgeId
newEdge url = remote url "ubigraph.new_edge"

removeVertex :: Url -> VertexId -> IO ()
removeVertex url vid = void (remote url "ubigraph.remove_vertex" vid)

removeEgde :: Url -> EdgeId -> IO ()
removeEgde url eid= void (remote url "ubigraph.remove_edge" eid)


zeroOnSuccess :: IO Int -> IO Bool
zeroOnSuccess = fmap (==0) 

newVertexWithId :: Url -> VertexId -> IO Bool
newVertexWithId url vid = zeroOnSuccess (remote url "ubigraph.new_vertex_w_id" vid)

newEdgeWithId :: Url -> EdgeId -> VertexId -> VertexId -> IO Bool
newEdgeWithId url eid x y = zeroOnSuccess (remote url "ubigraph.new_edge_w_id" eid x y)

setVertexAttribute :: Url -> VertexId -> String -> String -> IO Bool
setVertexAttribute url vid attr val = zeroOnSuccess (remote url "ubigraph.set_vertex_attribute" vid attr val)

setEdgeAttribute :: Url -> VertexId -> String -> String -> IO Bool
setEdgeAttribute url eid attr val = zeroOnSuccess (remote url "ubigraph.set_edge_attribute" eid attr val)
module VacuumUbigraph where

import GHC.Vacuum
import Data.Char
import Text.Printf
import Data.List

import qualified Data.IntMap as IntMap
import qualified Data.IntSet as IntSet

import qualified Ubigraph as U

nodeStyle n =
case nodeName n of
  ":"  -> ("(:)", "cube", "#ff")

  -- atomic stuff is special
  k | k `elem` ["S#" ,"I#" ,"W#"
   ,"I8#" ,"I16#" ,"I32#" ,"I64#"
   ,"W8#" ,"W16#" ,"W32#" ,"W64#"] -> (showLit n, "sphere", "#00ff00")
  -- chars
  "C#" -> (show . chr . fromIntegral . head . nodeLits $ n, "sphere", "#00ff00")
  "D#" -> ("Double", "sphere", "#009900")
  "F#" -> ("Float", "sphere", "#009900")

  -- bytestrings
  "PS"-> (printf "ByteString[%d,%d]" (nodeLits n !! 1) (nodeLits n !! 2), "cube", "#ff")
  "Chunk" -> (printf "Chunk[%d,%d]" (nodeLits n !! 1) (nodeLits n !! 2), "cube", "#ff")

  -- otherwise just the constructor and local fields
  c   | z > 0 ->
(c ++ show (take (fromIntegral z) $ nodeLits n), "cube", "#99")
  | otherwise -> (c, "cube", "#99")
where z = itabLits (nodeInfo n)
where
  showLit n = show (head $ nodeLits n)

view a = do
  U.clear srv
  mapM_ renderNode nodes
  mapM_ renderEdge edges
where  
  g = vacuum a
  alist = toAdjList g
  nodes = nub $ map fst alist ++ concatMap snd alist
  edges = concatMap (\(n, ns) -> map ((,) n) ns) alist

  style nid = maybe ("...", "cube", "#ff") nodeStyle (IntMap.lookup nid g)

  renderNode nid = do
   U.newVertexWithId srv nid
   let (label, shape, color) = style nid
   U.setVertexAttribute srv nid "label" label
   U.setVertexAttribute srv nid "shape" shape
   U.setVertexAttribute srv nid "color" color
  
  renderEdge (a, b) = do
   e <- U.newEdge srv a b
   U.setEdgeAttribute srv e "stroke" "dotted"
   U.setEdgeAttribute srv e "arrow" "true"

  srv = U.defaultServer

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe