You could move that logic into Haskell, as illustrated in a previous
follow-up, but I can't think of any direct interface between C FILE
and Haskell Handle, and I guess that because of the essential internal
nature of the two, that's to be expected. (Or maybe I just don't
know where to look!)