Convert socket_t to a viewtype.

Today has had a lot of failed attempts at cleaning up this code a bit.
I still don't like the explicit handling of boxed values, and the type
annotation for `nsock` was needed, or else the type system thought we
shouldn't be destroying the socket for some reason?