Hello, all,

It is again on re-preluding.
MyPrelude  aims to hide
  Ord(..), Bounded(..), Num(..), Integral(..),
  Fractional(..),  subtract, fromIntegral, even, odd, gcd, lcm, 
  (^), (^^)

of  Prelude  and to re-define  Ord, (+),(*),(^), even, odd, gcd, lcm

The attempt of    module MyPrelude (...) where 
                                         import qualified Prelude 
                                         ...
leads to that MyPrelude has to write  f (x Prelude.: xs) = ... 
instead of                            f (x:xs)           = ... 
So, I set
  import qualified Prelude
  import Prelude hiding (Ord(..), Bounded(..), Num(..), Integral(..),
                         Fractional(..), subtract, fromIntegral, 
                         even, odd, gcd, lcm, (^), (^^)
                        )
  ...,
and the user modules have to copy this "import" part. 
Looks like it helps.


But it remains the problem of numerals:
---------------------------------------
The compiler replaces  (23, -23)
with                   (Num.fromInteger 23, Num.negate 23),
while it is needed     (A.fromInteger   23, A.negate   23).

Could the language put is  `23' -> `fromInteger 23',
so that  fromInteger  is the operation of any *visible* class?
Standardly,  Num          is visible.
In my case,  MyPrelude.A  is visible instead.
?

If the Simon P. Jones's suggestion  import Prelude ()
                                    import {-# SYNTAX #-} MyPrelude
will work, then OK.
Probably, someone has to decide what to put for the language and to
implement this ...


------------------
Sergey Mechveliani
[EMAIL PROTECTED]








Reply via email to