What is the meaning of "|" in the type spec of list?

Hello, I’m using the :crypto lib of Erlang, and searching the document, there is a type spec of :crypto.verify.

And the type of arg Key is

Key = 
    rsa_public() |
    dss_public() |
    [ecdsa_public() | ecdsa_params()] |
    [eddsa_public() | eddsa_params()] |

My question why there is a | instead of , in type [ecdsa_public() | ecdsa_params()]?

An example value of that is [secp256r1, <<1, 2, 3,...>>]. So I think type `[ecdsa_public(), ecdsa_params()]

1 Like

In type specs, | is the union operator. [a | b | c]describes a list that may contain elements that are either a, b, or c.


It’s make sense, thank you!