[erlang-questions] Types and specs [WAS: [enhancement] string:split/2]

Kostis Sagonas kostis@REDACTED
Mon Oct 13 08:49:11 CEST 2008

Richard O'Keefe wrote:
> On 11 Oct 2008, at 12:33 am, Kostis Sagonas wrote that
> [[char(),...]] means list of non-empty strings, which
> is more precise than [string()].
> Would [char()|string()] also work?

No.  This is a different type, which does not express what you want here.

Note that in the language of types | does not mean list tail, but 
instead means type union.  The above type denotes a (possibly empty) 
list consisting of characters or strings.

Quite different from [[char(),...]].


More information about the erlang-questions mailing list