Rewrote curl call with Haskell code using libcurl