shithub: MicroHs

Download patch

ref: fe98ed661d38e38c01d5a438990bfac8b742fb3f
parent: c9321a91358f39ccaa15420cd6224a497f38c461
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Thu Feb 8 13:57:13 EST 2024

Avoid name clashes

--- a/lib/Data/Foldable.hs
+++ b/lib/Data/Foldable.hs
@@ -42,9 +42,9 @@
     find
     ) where
 import Primitives
-import Control.Applicative
+import Control.Applicative(Applicative(..), Alternative(..))
 import Control.Error
-import Control.Monad
+import Control.Monad(Monad(..), MonadPlus(..))
 import Data.Bool
 import Data.Either
 import Data.Eq
@@ -51,7 +51,7 @@
 import Data.Function
 import Data.Functor.Const
 import Data.Functor.Identity
-import Data.List_Type
+import Data.List_Type hiding (concatMap)
 import qualified Data.List as List
 import Data.Maybe
 import Data.Monoid
--- a/lib/Data/Traversable.hs
+++ b/lib/Data/Traversable.hs
@@ -31,7 +31,7 @@
     ) where
 import Primitives
 import Control.Applicative
-import Control.Monad
+import Control.Monad(Monad(..), MonadPlus(..))
 --import Data.Coerce
 import Data.Either
 import Data.Foldable
--- a/lib/Primitives.hs
+++ b/lib/Primitives.hs
@@ -25,7 +25,6 @@
 -- Types
 data AnyType
 data Char
-data Handle
 data Int
 data Double
 data IO a
--- a/lib/Text/PrettyPrint/HughesPJ.hs
+++ b/lib/Text/PrettyPrint/HughesPJ.hs
@@ -16,7 +16,7 @@
   Style,
   render, renderStyle,
   ) where
-import Prelude
+import Prelude hiding ((<>))
 
 infixl 6 <>, <+>
 infixl 5 $$, $+$
--- a/tests/Foreign.hs
+++ b/tests/Foreign.hs
@@ -1,11 +1,11 @@
 module Foreign(main) where
 import Prelude
 
-foreign import ccall "llabs" abs :: Int -> IO Int
+foreign import ccall "llabs" iabs :: Int -> IO Int
 
 main :: IO ()
 main = do
-  x1 <- abs (3 - 8)
+  x1 <- iabs (3 - 8)
   putStrLn $ show x1
-  x2 <- abs (10 - 8)
+  x2 <- iabs (10 - 8)
   putStrLn $ show x2
--- a/tests/PolyKind.hs
+++ b/tests/PolyKind.hs
@@ -1,8 +1,8 @@
 module PolyKind(main) where
 import Prelude
 
-type Proxy :: forall (k::Kind) . k -> Type
-data Proxy a = Proxy
+type XProxy :: forall (k::Kind) . k -> Type
+data XProxy a = XProxy
 
 data TypeRep = TypeRep String [TypeRep]
 
@@ -18,7 +18,7 @@
   typeRep :: forall proxy . proxy a -> TypeRep
 
 typeOf :: forall a . Typeable a => a -> TypeRep
-typeOf _ = typeRep (Proxy :: Proxy a)
+typeOf _ = typeRep (XProxy :: XProxy a)
 
 instance Typeable Int where
   typeRep _ = TypeRep "Int" []
@@ -27,10 +27,10 @@
   typeRep _ = TypeRep "IO" []
 
 instance forall f a . (Typeable f, Typeable a) => Typeable (f a) where
-  typeRep _ = mkAppTy (typeRep (Proxy :: Proxy f)) (typeRep (Proxy :: Proxy a))
+  typeRep _ = mkAppTy (typeRep (XProxy :: XProxy f)) (typeRep (XProxy :: XProxy a))
 
 main :: IO ()
 main = do
-  print $ typeRep (Proxy :: Proxy Int)
-  print $ typeRep (Proxy :: Proxy IO)
-  print $ typeRep (Proxy :: Proxy (IO Int))
+  print $ typeRep (XProxy :: XProxy Int)
+  print $ typeRep (XProxy :: XProxy IO)
+  print $ typeRep (XProxy :: XProxy (IO Int))
--- a/tests/Record.hs
+++ b/tests/Record.hs
@@ -105,3 +105,7 @@
   print $ foow r2
 --  print $ sel_ra r7
   print r8
+  print s1.x
+  print s2.x
+  print (x s1)
+  print (x s2)
--- a/tests/Record.ref
+++ b/tests/Record.ref
@@ -24,3 +24,7 @@
 777
 2
 CR{a=333,b=True}
+10
+20
+10
+20
--