I decided to use my own Prelude for a larger project (containing some libraries and some executables). The prelude does not export some partial functions and does not export some common functions (i.e. From Control.Monad , etc.). However, I struggle with how to do this. I tried:
use base-noprelude . Create Prelude.hs in the my-common-module .
Same as above, but in my-common-module create My.Prelude . In each other module, create a "foreplay" of the directory, place it in the hs-source-dirs cabal section, create the prelude/Prelude.hs file using import My.Prelude
The problem is that in 1) I can’t just start ghci , since I get conflicting base and my-common-module . In 2) ghci works, cabal repl somehow doesn’t mysteriously fail to “try to use the Prelude module (prelude / Prelude.hs), which is not loaded”. Also, base-noprelude doesn't seem to be like ghcjs , which I want to use for part of the project (code sharing).
It seems to me that the only way to start each file is:
import Prelude () import My.Prelude
or
{-# LANGUAGE NoImplicitPrelude #-} -- or extensions: NoImplicitPrelude in .cabal ... import My.Prelude
The option 'extensions: NoImplicitPrelude' seems to me better, because importing any file requires My.Prelude , otherwise it will not work. Did I miss some obvious way to achieve a custom Prelude while working with cabal repl and ghcjs at the same time?
Update: base-noprelude works with GHCJS when I manually delete the re-export of GHC.Event.
Update: Well, I spent some time with this, and I should have spent more. It seems to me that 1) this is the right way. cabal repl works (thanks Yuras), ghci needs to be loaded using ghci -hide-package base and works too.
source share