I’m trying to run a code example from Real World Haskell (published in 2008) on my fairly recent installation of Haskell, using Stack. I can’t get it to compile. The main obstacle so far, is that a function “sendTo” has been deprecated and then removed in the library where it first existed, and use slightly different types where it is now.
The code I’m trying to run is available from https://book.realworldhaskell.org/, in the file syslogclient.hs which is in Chapter 27. Sockets and Syslog.
It’s not clear to me, from the book, which modules various functions come from (such as sendTo), or which packages these modules come from. Hoogle is helpful, but I can’t easily see how it was back in 2008. It seems to me that the network package contains the Network.Socket module, which contained the sendTo function up to version v. 2.8.0.1. There, it’s deprecated, and they tell me to use Network.Socket.ByteString instead.
Now this starts to feel messy in my head. I can’t simply replace the old sendTo with the new one. When I try, I get type errors. I also get various import problems, with symbols being available in more than one place (module).
What would be a good strategy to solve the problem?
Since I’m using Stack, I need to update my package.yaml file with the right packages. I need to import the right modules. Conflicts with the same symbol being available in more than one module must be resolved. The new sendTo function must get an argument of type ByteString, instead of the String argument of the old function. But this is just one singel code example. My question is about a general strategy.