darcs

Patch 1935 add NoImplicitPrelude for lib:darcs and exe:darcs

Title add NoImplicitPrelude for lib:darcs and exe:darcs
Superseder Nosy List bf
Related Issues
Status accepted Assigned To
Milestone

Created on 2019-09-23.18:09:06 by bf, last changed 2019-09-25.21:05:06 by ganesh.

Files
File name Status Uploaded Type Edit Remove
add-imports-of-darcs_prelude-to-modules-under-src_win32.dpatch dead bf, 2019-09-23.23:45:01 application/x-darcs-patch
add-noimplicitprelude-for-lib_darcs-and-exe_darcs.dpatch dead bf, 2019-09-23.18:09:06 application/x-darcs-patch
add-noimplicitprelude-for-lib_darcs-and-exe_darcs.dpatch bf, 2019-09-25.11:35:45 application/x-darcs-patch
need-darcs_prelude-in-darcs_util_http.dpatch dead ganesh, 2019-09-24.10:36:12 application/x-darcs-patch
patch-preview.txt bf, 2019-09-23.18:09:06 text/x-darcs-patch
patch-preview.txt bf, 2019-09-23.23:45:01 text/x-darcs-patch
patch-preview.txt ganesh, 2019-09-24.10:36:12 text/x-darcs-patch
patch-preview.txt bf, 2019-09-25.11:35:45 text/x-darcs-patch
unnamed bf, 2019-09-23.18:09:06 text/plain
unnamed bf, 2019-09-23.23:45:01 text/plain
unnamed ganesh, 2019-09-24.10:36:12 text/plain
unnamed bf, 2019-09-25.11:35:45 text/plain
See mailing list archives for discussion on individual patches.
Messages
msg21556 (view) Author: bf Date: 2019-09-23.18:09:06
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
Attachments
msg21558 (view) Author: bf Date: 2019-09-23.20:42:36
[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.
msg21564 (view) Author: ganesh Date: 2019-09-23.23:20:18
Could you also fix the files in src/win32? I guess it should be obvious
what to do, but if not let me know and I'll do it.
msg21565 (view) Author: bf Date: 2019-09-23.23:45:01
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
Attachments
msg21566 (view) Author: ganesh Date: 2019-09-24.10:36:12
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
Attachments
msg21567 (view) Author: ganesh Date: 2019-09-24.10:44:34
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.
msg21575 (view) Author: bf Date: 2019-09-24.20:08:30
> 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.
msg21580 (view) Author: ganesh Date: 2019-09-24.21:07:50
> 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.
msg21585 (view) Author: bf Date: 2019-09-25.11:30:41
> 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.
msg21586 (view) Author: bf Date: 2019-09-25.11:35:45
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
Attachments
msg21591 (view) Author: ganesh Date: 2019-09-25.18:41:02
Looks fine
History
Date User Action Args
2019-09-23 18:09:06bfcreate
2019-09-23 20:42:36bfsetmessages: + msg21558
2019-09-23 23:20:18ganeshsetmessages: + msg21564
2019-09-23 23:45:01bfsetfiles: + patch-preview.txt, add-imports-of-darcs_prelude-to-modules-under-src_win32.dpatch, unnamed
messages: + msg21565
2019-09-24 10:36:12ganeshsetfiles: + patch-preview.txt, need-darcs_prelude-in-darcs_util_http.dpatch, unnamed
messages: + msg21566
2019-09-24 10:44:34ganeshsetmessages: + msg21567
2019-09-24 20:08:30bfsetmessages: + msg21575
2019-09-24 21:07:50ganeshsetmessages: + msg21580
2019-09-25 11:30:41bfsetmessages: + msg21585
2019-09-25 11:35:45bfsetfiles: + patch-preview.txt, add-noimplicitprelude-for-lib_darcs-and-exe_darcs.dpatch, unnamed
messages: + msg21586
2019-09-25 11:42:03bfsetstatus: needs-screening -> needs-review
2019-09-25 18:41:02ganeshsetstatus: needs-review -> accepted-pending-tests
messages: + msg21591
2019-09-25 21:05:06ganeshsetstatus: accepted-pending-tests -> accepted