shithub: MicroHs

Download patch

ref: 5d9e006be85458b1898d4be1c8c3de477f8d0380
parent: 82fe39465f1a68cedd6b5d42c165ee9c1dd76276
author: Lennart Augustsson <lennart@augustsson.net>
date: Sun Oct 29 11:55:36 EDT 2023

Make bootmhs compile again.

--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@
 PROF= #-prof -fprof-auto
 EXTS= -XScopedTypeVariables -XQualifiedDo -XTupleSections
 GHCB=ghc $(PROF) -outputdir $(BOOTDIR)
-GHCFLAGS=-i -ighc -ilib -i$(BOOTDIR) -hide-all-packages -XNoImplicitPrelude $(EXTS) -F -pgmF $(TOOLS)/convertY.sh 
+GHCFLAGS=-i -ighc -ilib -i$(BOOTDIR) -hide-all-packages -XNoImplicitPrelude -XRebindableSyntax $(EXTS) -F -pgmF $(TOOLS)/convertY.sh 
 GHCC=$(GHCB) $(GHCFLAGS)
 GHC=ghc
 # $(CURDIR) might not be quite right
@@ -91,7 +91,6 @@
 	$(GHCC) -c src/MicroHs/IdentMap.hs
 	$(GHCC) -c src/MicroHs/Exp.hs
 	$(GHCC) -c src/MicroHs/TCMonad.hs
-	$(GHCC) -c src/MicroHs/State.hs
 	$(GHCC) -c src/MicroHs/TypeCheck.hs
 	$(GHCC) -c src/MicroHs/Desugar.hs
 	$(GHCC) -c src/MicroHs/StateIO.hs
--- a/ghc/Primitives.hs
+++ b/ghc/Primitives.hs
@@ -10,6 +10,8 @@
   NFData(..),
   Type,
   ) where
+import Prelude hiding(fromInteger, fromRational)
+import qualified Prelude as P
 import Control.DeepSeq
 import Control.Exception(try)
 import Data.Time
@@ -238,3 +240,12 @@
 
 primRnf :: (NFData a) => a -> ()
 primRnf = rnf
+
+fromInteger :: Integer -> Int
+fromInteger = P.fromInteger
+
+fromRational :: Rational -> Double
+fromRational = P.fromRational
+
+ifThenElse :: Bool -> a -> a -> a
+ifThenElse c t e = if c then t else e
--- a/lib/Prelude.hs
+++ b/lib/Prelude.hs
@@ -17,7 +17,9 @@
   module Data.Tuple,
   module System.IO,
   module Text.String,
+  --Ymodule Primitives,
   ) where
+--Yimport Primitives(fromInteger, fromRational, ifThenElse)
 import Control.Applicative
 import Control.Error
 import Control.Monad
--- a/src/MicroHs/State.hs
+++ /dev/null
@@ -1,14 +1,0 @@
-{-# OPTIONS_GHC -Wno-orphans -Wno-dodgy-imports -Wno-unused-imports #-}
-module MicroHs.State(
-  State, runState,
-  fmap, (<$>), (<*>),
-  (>>=), (>>), return, fail,
-  get, put, gets,
-  mapM, mapM_,
-  sequence,
-  when,
-  ) where
---Ximport Control.Monad hiding(ap)
---Ximport Data.Functor.Identity
---Ximport GHC.Stack
-import Control.Monad.State.Strict --Xhiding(ap)
--- a/src/MicroHs/TypeCheck.hs
+++ b/src/MicroHs/TypeCheck.hs
@@ -16,7 +16,6 @@
 import Data.List
 import Data.Maybe
 import qualified Data.IntMap as IM
-import qualified MicroHs.State as S
 import MicroHs.TCMonad as T
 import qualified MicroHs.IdentMap as M
 import MicroHs.Ident
--