Skip to content

cies/haskell-fractal

Repository files navigation

Haskell example:

A simple fractal image renderer

I've always been intrigued by fractals, and decided to make an example program in Haskell that renders a part of the Mandelbrot set to an image.

The code is based on Michael Bradshaw's Mandelbrot blog post, tweaked it for brevity and educational purposes. Finally I sharpened the contrast a bit. To find a nice contrast enhancing curve I used the awesome curve fitter of zunzun.com.

The idea is that it can show some of Haskell's features in a short program with a wonderfully complex output. Hopefully it is more suitable for introducing Haskell to newcomers then the fibonacci sequence and the quicksort algorithm.

Posting this project to Reddit resulted in some adjustments to the code, please find the details in the comments.

Output

A fairly large rendering (10000 x 14142) is commited to this repository in PNG format. Have a look (17MB, sorry Github).

PDF version

This code comes with a PDF version of the fractal rendering combined with the Haskell source code used to create it.

Usage

On a recent Haskell setup the following commands should be enough to build and run the code from a cabal sandbox:

cabal sandbox init
cabal install
./.cabal-sandbox/bin/haskell-fractal

To make test renderings a width of 2000 should be enough, for a final rendering the width may be increased to something like 10000.

Finally ShareLatex chimed in to compile the PDF.

About

Haskell example: A simple fractal image renderer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published