shithub: MicroHs

Download patch

ref: e380df13ea0e9bd51da46df820071b637c46b0bd
parent: f20fbd7181f6b5b5489f0e2a0a3e214cdd9cc145
author: Lennart Augustsson <lennart@augustsson.net>
date: Fri Dec 15 08:27:29 EST 2023

More fixes

--- a/ghc/PrimTable.hs
+++ b/ghc/PrimTable.hs
@@ -16,7 +16,7 @@
 import Compat
 
 primitive :: String -> Any
-primitive s | trace ("primitive " ++ show s) False = undefined
+--primitive s | trace ("primitive " ++ show s) False = undefined
 primitive "dynsym" = unsafeCoerce dynsym
 primitive s = fromMaybe (error $ "primitive: " ++ s) $ lookup s primOps
 
@@ -65,8 +65,8 @@
   , cmp ">=" (>=)
   , comb "icmp" (\ x y -> fromOrdering (compare (x::Int) y))
 
-  , comb "scmp" (\ x y -> fromOrdering (compare (x::String) y))
-  , comb "sequal" (\ x y -> if (x :: String) == y then cTrue else cFalse)
+  , comb "scmp" (\ x y -> fromOrdering (compare (toString x) (toString y)))
+  , comb "sequal" (\ x y -> if toString x == toString y then cTrue else cFalse)
 
   , farith "fadd" (+)
   , farith "fsub" (-)
@@ -102,7 +102,8 @@
   ]
   where
     comb0 n f = (n, unsafeCoerce f)
-    comb n f = (n, unsafeCoerce (\ x -> trace (seq x n) (f x)))
+    comb n f = (n, unsafeCoerce f)
+--    comb n f = (n, unsafeCoerce (\ x -> trace (seq x n) (f x)))
     arith :: String -> (Int -> Int -> Int) -> (String, Any)
     arith = comb
     arithw :: String -> (Word -> Word -> Word) -> (String, Any)
@@ -161,7 +162,7 @@
 dynsym acfun =
   let s = toString acfun
   in
-      trace ("dynsym: " ++ show s) $
+--      trace ("dynsym: " ++ show s) $
       fromMaybe (error $ "cops: " ++ s) $ lookup s cops
 
 cops :: [(String, Any)]
--- a/src/MicroHs/Translate.hs
+++ b/src/MicroHs/Translate.hs
@@ -114,6 +114,7 @@
   ("itof", primitive "itof"),
   ("seq", primitive "seq"),
   ("error", primitive "error"),
+  ("sequal", primitive "sequal"),
   ("equal", primitive "equal"),
   ("scmp", primitive "scmp"),
   ("icmp", primitive "icmp"),
--