shithub: MicroHs

Download patch

ref: b1afd1122a324ede0ff1576d7422163a0870ffa2
parent: 9b6056fc1528d9375fed9f780c226ddef51767dc
author: Lennart Augustsson <lennart@augustsson.net>
date: Sun Dec 29 08:26:16 EST 2024

Make Char a newtype over Word instead of some primitive.

--- a/lib/Primitives.hs
+++ b/lib/Primitives.hs
@@ -25,7 +25,8 @@
 
 -- Types
 data AnyType
-data Char
+--data Char
+newtype Char = Char Word
 data Int
 data FloatW
 data IO a
@@ -154,19 +155,19 @@
 primIntToWord :: Int -> Word
 primIntToWord = primitive "I"
 
--- Char is represented by Int
+-- Char is represented by Word
 primCharEQ :: Char -> Char -> Bool
 primCharEQ  = primitive "=="
 primCharNE :: Char -> Char -> Bool
 primCharNE  = primitive "/="
 primCharLT :: Char -> Char -> Bool
-primCharLT  = primitive "<"
+primCharLT  = primitive "u<"
 primCharLE :: Char -> Char -> Bool
-primCharLE  = primitive "<="
+primCharLE  = primitive "u<="
 primCharGT :: Char -> Char -> Bool
-primCharGT  = primitive ">"
+primCharGT  = primitive "u>"
 primCharGE :: Char -> Char -> Bool
-primCharGE  = primitive ">="
+primCharGE  = primitive "u>="
 
 primFix    :: forall a . (a -> a) -> a
 primFix    = primitive "Y"