I'm currently writing a Haskell package. I want it to behave differently on Windows and Unix. What is the most "correct" way to detect what OS my code is being compiled on?
I did try using CPP and #ifdef _WIN32
, but that doesn't appear to work at all.
Is there another macro? Can I get Cabal to tell me? Do I need to try something else entirely?
You could use System.Info
as defined in the base package here:
> :m + System.Info
> os
"darwin"
> arch
"i386"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With