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

Bardur Arantsson spam at scientician.net
Tue Oct 6 07:40:49 UTC 2015


On 10/06/2015 02:40 AM, Gregory Collins wrote:
> 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

Having code meant for 4 different versions of a compiler be completely
-Wall clean is not a reasonable goal. This doesn't even happen for C++
compilers! (If my experience is anything to go by.)

It's also the reason -Werror is forbidden in Hackage uploads. (At least,
I think it is. Isn't it?)

Also, GHC 7.4 was released 2½ years ago. You may have my sympathies for
trying to support it, but unless you're getting paid for it I don't
think it's reasonable to expect you to. (If you're getting paid, then I
don't understand the complaint -- it might be a bit of make-work, but I
think everybody is subjected to that.)

>    - defaultTimeLocale moved from System.Locale to Data.Time.Format in
>    time-1.5 (no compat package for this, afaik)

"time-locale-compat" as Ivan pointed out.

>    - one of many various changes to Typeable in the GHC 7.* series
>    (deriving works better now, mkTyCon vs mkTyCon3, etc)

I think these were because people learned that they could be done
better? (Also, I believe there was something here about these changes
being necessary for Safe Haskell, namely forbidding user-written instances?)

Is Typeable part of Haskell 2010?

>    - 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)

Could you solve it with a qualified import? Then why use CPP?

(Incidentally, I think this is evidence that the Prelude should be an
explicit import like in PureScript.)

>    - 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

You don't *have* to shut up all warnings. (Unless we're talking
deprecation warnings *and* you're getting close to the cutoff point.)

>    - ==# and friends return Int# instead of Bool after GHC 7.8.1

Hoogle find ==# (and I've never heard it of before).

>    - 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)
> 

Well, yeah, new functions don't magically appear in old versions. I
don't anybody expects that :).

Regards,




More information about the Libraries mailing list