[erlang-questions] How to access functions type signatures?
Dimitry Golubovsky
golubovsky@REDACTED
Wed Jul 30 15:56:29 CEST 2008
Hi,
If somewhere in the documentation we see:
fread([IoDevice,] Prompt, Format) -> Result
Types:
IoDevice = io_device()
Prompt = atom() | string()
Format = string()
Result = {ok, Terms} | eof | {error, What}
Terms = [term()]
What = term()
is the above type information stored anywhere in a machine-consumable
form (being readable by an Erlang program is fine)?
I am asking this in connection with my Haskell-to-Erlang conversion
experiments. Being able to access such information, it would be
possible to create Haskell type signatures to call these functions
from Haskell code, something like this (manually derived):
fread :: IoDevice -> Prompt -> Format -> Result -- or rather IO Result
data IoDevice = IoDevice -- perhaps an opaque type
data Term = Term -- another opaque type
type Prompt = String
type Format = String
data Result = <some algebraic data type>
etc.
I did something like this earlier for HSFFIG (derived foreign imports
from C function prototypes), but I had to parse C headers, which I
would like to avoid this time.
Thanks.
PS this must be somewhere in th docs, but I haven't been able to dig it up.
--
Dimitry Golubovsky
Anywhere on the Web
More information about the erlang-questions
mailing list