For discussion, initially, see http://bugs.darcs.net/msg21555 for motivation.
In the future I would also like us to include a few widely know pieces of
standard Haskell vocabulary to our custom Darcs.Prelude. For instance 'when'
and 'unless' from Control.Monad. I'll make a separate proposal about this.
1 patch for repository http://darcs.net/screened:
patch 0e233a46c07a6056b4ff0f937f4ceb1620052c06
Author: Ben Franksen <ben.franksen@online.de>
Date: Mon Sep 23 19:54:48 CEST 2019
* add NoImplicitPrelude for lib:darcs and exe:darcs
[redirecting discussion to patch1935]
> I think I've played with it before and didn't like the effects, but I
> can't remember the details so we might as well try it again.
> https://wiki.haskell.org/No_import_of_Prelude suggests it'd be ok given
> that we re-export the whole Prelude minus a few bits anyway.
Yes, that was my thinking. We don't want one of those super special
completely re-designed Preludes with lots of strange new classes and
stuff like that. Just a fairly regular one with a few identifiers hidden
to avoid collisions and compatibility problems; and perhaps a few
well-known and widely used extra exports for convenience.
> The other downside is it becomes a bit harder to read a single source
> file and understand what's happening.
Compared to what we have now the main difference is that instead of
import Prelude ()
import Darcs.Prelude
we have
import Darcs.Prelude
and I guess nobody takes any notice of all the import stuff anyway
unless they look for a specific definition of something they don't know
yet. The vast majority of our modules import lots of things from Darcs.*
anyway.
BTW, I have read a bit on @cafe and @libraries lately and there was some
discussion about changes to Prelude and compatibility. Some seasoned
Haskellers recommended to use NoImplicitPrelude and a customized own
Prelude for any non-trivial project by default.
Note my patch touched almost every file in lib:darcs so has a high
probability of conflicting with current WIP. I expect these conflicts to
be mostly easy to resolve, though.
Note System.Posix.Files consists only of 1:1 re-exports from
System.PosixCompat.Files so the import hasn't been added there.
1 patch for repository http://darcs.net/screened:
patch bf653b0a61cc0230c8799e439ab828effff882a6
Author: Ben Franksen <ben.franksen@online.de>
Date: Tue Sep 24 01:46:35 CEST 2019
* add imports of Darcs.Prelude to modules under src/win32
One more place Darcs.Prelude was needed
1 patch for repository /home/ganesh/darcs/wip-2:
patch 8222be889ae38578afb94c8c64a5f93d77898527
Author: Ganesh Sittampalam <ganesh@earth.li>
Date: Tue Sep 24 11:27:45 BST 2019
* need Darcs.Prelude in Darcs.Util.HTTP
With the last patch I sent this builds for me. There are quite a few
other files that don't have it added (I guess because they don't
do very much), I'd suggest it should be added to all of them too
to keep things consistent:
$ find src -name \*.hs | xargs grep -L Darcs.Prelude
src/Darcs/Patch/ApplyPatches.hs
src/Darcs/Patch/Debug.hs
src/Darcs/Patch/Prim/FileUUID/Details.hs
src/Darcs/Patch/Prim.hs
src/Darcs/Patch/RepoPatch.hs
src/Darcs/Patch/RepoType.hs
src/Darcs/Patch/V1.hs
src/Darcs/Patch/V2.hs
src/Darcs/Patch/Witnesses/Unsafe.hs
src/Darcs/Patch.hs
src/Darcs/Repository.hs
src/Darcs/Test/TestOnly.hs
src/Darcs/UI/TheCommands.hs
src/Darcs/Util/Ratified.hs -- perhaps leave this one out
Overall I'm fine with the principle. I'd suggesting squashing at
least what we have already into a single patch so we don't
unnecessarily have intermediate broken states.
> With the last patch I sent this builds for me. There are quite a few
> other files that don't have it added (I guess because they don't
> do very much), I'd suggest it should be added to all of them too
> to keep things consistent:
I think this will give us warnings about redundant imports.
> Overall I'm fine with the principle. I'd suggesting squashing at
> least what we have already into a single patch so we don't
> unnecessarily have intermediate broken states.
Will do.
> I think this will give us warnings about redundant imports.
Ah yes. I guess we just add it on demand then.
I am a bit confused about why Darcs.Util.HTTP didn't go wrong for you,
though. I had originally assumed it was being compiled conditionally in
some way, but that doesn't seem to be the case.
> I am a bit confused about why Darcs.Util.HTTP didn't go wrong for you,
> though. I had originally assumed it was being compiled conditionally in
> some way, but that doesn't seem to be the case.
My bad. I had this change locally but unrecorded, sent the patch without
checking that whatsnew is empty, amended locally, and then forgot to
re-send. Sorry for the confusion.
Final bundle that squashes all required changes.
1 patch for repository http://darcs.net/screened:
patch a028a10cb273653671317eca6af23fff2ca50caa
Author: Ben Franksen <ben.franksen@online.de>
Date: Mon Sep 23 19:50:12 CEST 2019
* add NoImplicitPrelude for lib:darcs and exe:darcs