# [erlang-questions] Fun type specifications

Loïc Hoguin <>
Mon Sep 17 13:20:12 CEST 2012

Hey,

I came across this limitation a few times now. Assuming this is a
limitation because I didn't find a solution.

For function specs you can do something like this:

-spec my_fun(Req) -> Req when Req::req().

You can't do this however.

-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?

Thanks.

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