[Haskell-cafe] Wondering about c type in haskell.

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Mon Jun 29 22:01:48 EDT 2009

  There are times, when we need to make some system calls, or call C
library. So we have to deal with C data types.
  For example, CPid, which is an integer, actually. So we can do
"fromIntegral pid". Then why do not we define "type CPid = Integer",
and convert Haskell Integer with C Int internally. So the "user" does
not have to care about the type convert (everywhere, which is ugly).
And, specially, when doing something like serialisation, for Haskell
Integer, the user does not have to do things with precision. But for
CPid, without the fromIntegral, we have to specify its precision,
well, on different machine/OS, the precision may not be the same.


More information about the Haskell-Cafe mailing list