6 Erlang Libraries
6.1 What's in the OTP libraries?
The full library descriptions are included with the open-source distribution and also on line. The highlights are:
O&M Support
SASL, EVA, INETS and SNMP provide Operations- and maintenance-related functionality: release handling, alarm and event handling, administration via web browser and SNMP.
CORBA
ORBER, CosEvent, CosTransactions and IC contain support for everything CORBA related.
Database
Mnesia and Mnemosyne provide a real-time distributed database which can be both in-RAM and on-disk. There is also a standard ODBC client driver.
ASN.1
There is an ASN.1 compiler which produces Erlang code.
Standard Library
A rich collection of modules provides everything from string, list and regular expression manipulation to random number generation and calendar lookups.
Structural Components
gen_server, gen_fsm, and supervision trees provide standard ways of implementing client/server subsystems, state machines and supervised fault-tolerant systems.
GUI and Graphics
wx, gs and webtool provide ways to build a gui.
Among other things, there are also HTTP, SSH and FTP servers.
6.2 Is there a collection of data structures, e.g. balanced trees?
Linked lists are a fundamental part of Erlang, as are tuples. The other standard data structures are:
Module | Description |
sets | sets, i.e. a collection of unique elements. |
gb_sets | sets, but based on a general balanced data structure |
gb_tree | a general balanced tree |
dict | maps, also called associative arrays |
queue | double-ended queues |
ets | hash tables and ordered sets (trees), stored outside the process |
dets | on-disk hash tables |
(Beware: the less frequently used modules ordset and orddict are merely ordered lists, and thus have O(n) for common operations such as insert.)
6.3 Is there a serial port driver for Erlang?
Johan Bevemyr wrote one which works for unix machines. The code has moved around a few times, for the moment it seems to be on github.
There have been discussions on the mailing list about writing a more general driver which also works on windows machines. Nothing much has come of this (lack of interest?).
6.4 Is there a toolkit for building GUIs?
There are several.
The wx application lets you make GUIs with wxWidgets, a cross-platform toolkit. wx is part of the OTP distribution.
For those who like glade, the GTK interface builder, there's a binding to GTK which is tightly coupled to glade.
Related work includes a popular OpenGL modeller.
6.5 I've written an application/library. How do I package it so others can use it?
It depends.
For open-source projects intended for use with other open source projects, the de-facto way to distribute is on github. Building and installing dependencies should then ideally involve no more than typing 'make'.
The most popular way of doing that is to use rebar.
An alternative is 'erlang.mk', which in turn can use relx.
6.6 I've written a library to handle XYZ. How do I get it into the standard Erlang distribution?
This takes more work and patience than most people have. Kent Boortz described many of the hurdles on the mailing list.
There are other ways to spread your code, including distributing it from your own website or starting a project at a code hosting site. github is quite popular with Erlang developers.