[erlang-questions] Fun type specifications

Loïc Hoguin <>
Mon Sep 17 13:33:38 CEST 2012


On 09/17/2012 01:33 PM, Francesco Mazzoli wrote:
> At Mon, 17 Sep 2012 13:20:12 +0200,
> Loïc Hoguin wrote:
>> -type my_fun_type() -> fun((Req) -> Req when Req::req()).
>>
>> This is a bit annoying as this makes the typing of the funs a little
>> less precise than I hoped.
>>
>> Did I miss something and can you still do something like this? Or if
>> not, can this be added eventually?
>
> Well, can't you simply do
>
> -type my_fun_type() -> fun((req()) -> req()) | other_type.

This doesn't show the relationship between the input and output, and I 
get many warnings in one case if I do that (probably due to req() being 
an opaque type).

-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the erlang-questions mailing list