
21 May
2010
21 May
'10
8:44 a.m.
Hi Daniel, Daniel Rozycki wrote:
Currently, I am storing the two values each as Word16s, bitshifting one of them left by nine (using shift in the Data.Bits module), and then adding the two. Is there a simpler and/or more elegant way of achieving this result?
That's about what I would do in C. What's wrong with doing it that way in Haskell? GHC should be smart enough to do pretty well with those kinds of combinations. If you do this sort of thing all the time and there are some combinators that would make it more convenient for you - go ahead and make a library out of them. And upload it to Hackage! Regards. Yitz