<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 5, 2015 at 3:18 PM, Bryan Richter <span dir="ltr"><<a href="mailto:b@chreekat.net" target="_blank">b@chreekat.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>Hang on a moment, are you saying that all the people writing to argue</div><div>that these changes would require them to write dozens more #ifdef's</div><div>actually don't have to write any at all?</div></blockquote></div><br>Um, no, it usually isn't anything like that. Here's a sampling of some of the things I've used CPP for in the past few years:</div><div class="gmail_extra"><ul><li>After GHC 7.4, when using a newtype in FFI imports you need to import the constructor, i.e. "import Foreign.C.Types(CInt(..))" --- afaik CPP is the only way to shut up warnings everywhere</li><li>defaultTimeLocale moved from System.Locale to Data.Time.Format in time-1.5 (no compat package for this, afaik)</li><li>one of many various changes to Typeable in the GHC 7.* series (deriving works better now, mkTyCon vs mkTyCon3, etc)</li><li>Do I have to hide "catch" from Prelude, or not? It got moved, and "hiding" gives an error if the symbol you're trying to hide is missing. Time to break out the CPP (and curse myself for not just using the qualified import in the first place)</li><li>Do I get monoid functions from Prelude or from Data.Monoid? Same w/ Applicative, Foldable, Word. I don't know where anything is supposed to live anymore, or which sequence of imports will shut up spurious warnings on all four versions of GHC I support, so the lowest-friction fix is: break out the #ifdef spackle<br></li><li>==# and friends return Int# instead of Bool after GHC 7.8.1</li><li>To use functions like "tryReadMVar", "unsafeShiftR", and "atomicModifyIORef'" that are in recent base versions but not older ones (this is a place where CPP use is actually justified)</li></ul>-- <br><div class="gmail_signature">Gregory Collins <<a href="mailto:greg@gregorycollins.net" target="_blank">greg@gregorycollins.net</a>></div>
</div></div>