[Haskell-cafe] Monad of no `return` Proposal (MRP): Moving `return` out of `Monad`

Gregory Collins greg at gregorycollins.net
Tue Oct 6 00:40:43 UTC 2015


On Mon, Oct 5, 2015 at 3:18 PM, Bryan Richter <b at chreekat.net> wrote:

> Hang on a moment, are you saying that all the people writing to argue
> that these changes would require them to write dozens more #ifdef's
> actually don't have to write any at all?
>

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:

   - 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
   - defaultTimeLocale moved from System.Locale to Data.Time.Format in
   time-1.5 (no compat package for this, afaik)
   - one of many various changes to Typeable in the GHC 7.* series
   (deriving works better now, mkTyCon vs mkTyCon3, etc)
   - 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)
   - 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
   - ==# and friends return Int# instead of Bool after GHC 7.8.1
   - 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)

-- 
Gregory Collins <greg at gregorycollins.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151005/c398f795/attachment-0001.html>


More information about the Haskell-Cafe mailing list