circus: Types and a small DSL for working with netlistsvg

[ bsd3, hardware, library ] [ Propose Tags ]

Please see the README on GitHub at

[Skip to Readme]
Versions [RSS] [faq]
Change log
Dependencies aeson (>=, base (>=4.10 && <5), bytestring, containers, mtl, syb, text [details]
License BSD-3-Clause
Copyright Sandy Maguire
Author Sandy Maguire
Category Hardware
Home page
Bug tracker
Source repo head: git clone
Uploaded by isovector at 2021-07-16T20:01:23Z
Distributions NixOS:
Downloads 54 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2021-07-16 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees


Readme for circus-

[back to package description]


Build Status


Like it? Well I don't see why I oughtn't to like it. Does a boy get a chance to whitewash a fence every day?"

--Tom Sawyer, 'The Adventures Of Tom Sawyer'


This package contains types and a little DSL for producing JSON worthy of netlistsvg --- a fantastic program for drawing circuit diagrams.


While the Circus.Types module contains the bare-metal types that serialize in the expected format, it's not a joyful experience to use for yourself. Instead, mkCell is a smart constructor that will do what you want.

The most interesting types are Cells, which correspond to electrical components, and Modules, which are circuits themselves. The oddly named Bit represents an electrical node (a wire), and two components are connected by making them share a Bit.

Of course, Modules form a monoid, so they're easy to put together.

But what makes them easier to put together is the Circus.DSL module, which provides some monadic actions for building Modules. It gives you access to a fresh supply of unique Bits, automatically accumulates Cells, and allows for Bit unification (feedback loops.)

Optimistically added components that never ended up getting used? Automatically prune them with the simplify from Circus.Simplify!

When you're all done, call renderModuleBS or renderModuleString to get a JSON representation ready to ship off to netlistsvg. Easy as that, my dude.