typelead / eta-hackage

A set of patches to make Hackage compatible with the Eta language.
64 stars 31 forks source link

network-transport-0.4.4.0 #47

Open dpwiz opened 7 years ago

dpwiz commented 7 years ago

Is a dependency for distributed-process.

Offending code:

#ifdef mingw32_HOST_OS

foreign import stdcall unsafe "htonl" htonl :: CInt -> CInt
foreign import stdcall unsafe "ntohl" ntohl :: CInt -> CInt
foreign import stdcall unsafe "htons" htons :: CShort -> CShort
foreign import stdcall unsafe "ntohs" ntohs :: CShort -> CShort

#else

foreign import ccall unsafe "htonl" htonl :: CInt -> CInt
foreign import ccall unsafe "ntohl" ntohl :: CInt -> CInt
foreign import ccall unsafe "htons" htons :: CShort -> CShort
foreign import ccall unsafe "ntohs" ntohs :: CShort -> CShort

#endif

Nothing fancy. It is used to convert numbers to network-order bytestrings.

I've downloaded etlas merely an hour ago, so no PR for now :wink:

rahulmutt commented 7 years ago

Java doesn't really have much of a concept of "network" and "host" byte order. We did tackle this problem in the network package itself. Take a look at the network patch (Note that it's incomplete - we just ported enough to get the wai package working).

rahulmutt commented 7 years ago

And on another note, Eta has a nice (hidden) feature that all Eta closures are serialisable so you can send closures over the wire w/o static pointers and distributed-process! The functionality is not yet exposed, but I'd be happy to add a bit of documentation if you're interested in playing around with it.

dpwiz commented 7 years ago

Oh... the DP itself has indeed loads of TH for closure magic, so this patch would'n help that much.