A visual Haskell
Go to file
2022-03-20 13:40:39 -07:00
app Update stackage, fix warnings and format some app files with Ormolu. 2020-12-25 22:35:24 -08:00
examples Draw bounding boxes for lambdas. 2018-11-11 03:17:06 -08:00
gui Reformat long lines. 2021-01-03 17:02:16 -08:00
images Update to latest Stackage LTS. Upgrade diagrams-graphviz. Add images folder. 2016-08-26 20:09:09 -07:00
src Initial commit 2016-01-04 17:18:42 -08:00
test Make the embedMap a Map. 2019-07-31 12:01:37 -07:00
.gitignore Add pattern names to PApp. 2017-01-02 00:37:27 -08:00
glance.cabal Update Stackage and comment out glance-gui build target. 2022-03-20 13:30:34 -07:00
graph_algs.txt Transfer more pseudocode from graph_algs to GraphAlgorithms. 2016-11-15 15:19:05 -08:00
hie.yaml Add hie.yaml and update Stack to GHC 8.8.3. 2020-08-23 14:10:55 -07:00
LICENSE Switch to Apache-2.0 license. 2020-06-13 15:55:40 -07:00
notes.txt Add GUI skeleton based on gi-gtk-declarative. 2020-08-09 15:49:26 -07:00
README.md Add link to Only1Loatheb's fork in README. 2022-03-20 13:40:39 -07:00
Setup.hs Initial commit 2016-01-04 17:18:42 -08:00
stack.yaml Update Stackage and comment out glance-gui build target. 2022-03-20 13:30:34 -07:00
todo.md Create label text with keyboard. 2020-12-25 01:39:37 -08:00

Link to project wiki (for mobile viewers)

For updates and coding livestreams check out the Glance YouTube channel.

Also, check out Only1Loatheb's fork which has a different visual style and an interactive mode.

Glance

Glance is a visual syntax for the programming language Haskell. The goal of this project is to increase programmer happiness and productivity by allowing programmers to create and understand programs in new and different ways. Currently, the Glance executable produces a visual representation of your code in the form of an SVG image when given a textual Haskell source file. In the future, I hope to create a visual editor for Haskell. Please scroll down to see some example images.

The current Glance program is an experiment created to answer the question:
Is it possible to create a readable and compact graphical representation of Haskell function and value declarations?

For small to medium functions, in my opinion Glance produces images good enough to indicate that the answer is yes. For large functions, the results right now are inconclusive due to issues with graph layout. Specifically, large programs unnecessarily become very spread out. If you have any ideas about how to improve Glance, please create an issue.

The next steps for the project are to improve graph layout, and then to start work on a visual editor. If you would like to help and have any knowledge about graph layout, please make a comment on this issue. All contributions to any part of Glance are very much encouraged.

Try it

First install Graphviz. For instance, in Ubuntu run:

sudo apt install graphviz

Then build and execute glance:

stack build :glance-exe
stack exec glance-exe -- examples/fact.hs images/fact.svg 500

To see the command line options run

stack exec glance-exe -- --help

Now display the SVG image in a web browser

firefox --new-window images/fact.svg

You should now see in your browser window a visual representation of the factorial function. Next, you will probably want to read the Getting Started guide below to help understand the images Glance generates.

Issues

Glance is still in development, so for the time being, graph layout, line routing, and icon design all have much room for improvement. Here are some specific issues:

To learn more

To learn more about the project after reading this README, please check out the Glance wiki.

Getting started

Below is a getting started guide for Glance rendered by Glance itself (source here). To generate this image run

stack exec glance-exe -- examples/tutorial.hs examples/tutorial.svg 873 -c

Introduction to Glance

You should now be able to understand Glance's visual syntax. If you would like to see how visual code might be an improvement over textual code, or if you just want to see more examples, please take a look at the Glance wiki page Advantages of Glance.

Thanks

A large thanks to the creators of diagrams, the main Haskell library used in this project.

Thank you to the Santa Monica Haskell Users Group for their support and feedback.

Also thanks to the /r/haskell subreddit for reviewing a very early design of the language.