On 15-May-2000, S.D.Mechveliani <[EMAIL PROTECTED]> wrote:
> ... only several days ago I have realized or recalled that it is
> possible to replace some algebraic part of Prelude-98 with the 
> user prelude. Someone, - thanks for the help, - had confirmed 
> this recently: use       import qualified Prelude
>                          import MyPrelude
> 
> Probably, this makes the implementation easy.
> A small problem remains, for example, with the code like
>        case xs 
>        of 
>          [Prelude.Just]              -> [Prelude.True]
>          (Prelude.Just) Prelude.: xs -> Prelude.Nothing Prelude.: ys
> 
> I expect, it would not be good to repeat the definitions of  
>                 data Maybe,  data Bool
> in MyPrelude.

Right.  Instead, you can simply re-export them:

        module MyPrelude(Prelude.Maybe(..), Prelude.Bool(..)) where
        import qualified Prelude

Then you can go ahead and use these in code that uses your
standard Prelude:

        module Example where
        import qualified Prelude
        import MyPrelude

        conj :: Bool -> Bool -> Bool
        conj True x = x
        conj False _ = False

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.

Reply via email to