ref: 9b670ad5de381070da9f914319d725c355b3a056
parent: 03f5619ee2c5f845d0d821928791e1fbdd27ea52
author: Lennart Augustsson <lennart@augustsson.net>
date: Wed Feb 14 10:09:27 EST 2024
Minor tweaks
--- a/TODO
+++ b/TODO
@@ -42,4 +42,5 @@
- do everything in Haskell
- make a low level primError that takes a utf8 string
- get rid of noMatch and noDefault primitives
-* Fix bug with negative literal patterns
\ No newline at end of file
+* Fix bug with negative literal patterns
+* See TODO in TypeCheck
--- a/generated/mhs.c
+++ b/generated/mhs.c
@@ -64,7 +64,7 @@
64,32,64,32,83,39,32,67,32,64,32,67,32,83,39,32,64,32,64,32,
66,32,67,32,95,53,57,32,64,32,64,32,64,32,64,32,64,32,58,49,
53,56,53,32,64,10,65,32,102,114,111,109,85,84,70,56,32,34,48,46,
-57,46,51,46,48,34,32,64,32,58,49,53,56,52,32,64,10,65,32,66,
+57,46,53,46,48,34,32,64,32,58,49,53,56,52,32,64,10,65,32,66,
32,83,39,32,83,39,32,95,48,32,95,50,51,32,64,32,64,32,64,32,
83,32,83,39,32,83,39,32,64,32,95,49,50,52,32,95,49,53,52,56,
32,64,32,95,49,50,56,32,64,32,64,32,83,39,32,66,32,64,32,66,
@@ -5021,7 +5021,7 @@
32,64,32,90,32,75,32,64,32,64,32,64,32,75,32,64,32,64,32,110,
111,77,97,116,99,104,32,102,114,111,109,85,84,70,56,32,34,115,114,99,
47,77,105,99,114,111,72,115,47,84,121,112,101,67,104,101,99,107,46,104,
-115,34,32,64,32,64,32,35,49,50,49,56,32,64,32,35,50,53,32,64,
+115,34,32,64,32,64,32,35,49,50,50,53,32,64,32,35,50,53,32,64,
32,64,32,64,32,64,32,64,32,64,32,66,32,95,49,49,52,49,32,64,
32,95,54,48,32,95,56,53,52,32,64,32,64,32,64,32,64,32,64,32,
64,32,64,32,64,32,95,53,52,50,32,64,32,64,32,83,39,32,66,32,
@@ -5034,7 +5034,7 @@
32,90,32,75,32,64,32,64,32,64,32,65,32,64,32,64,32,110,111,77,
97,116,99,104,32,102,114,111,109,85,84,70,56,32,34,115,114,99,47,77,
105,99,114,111,72,115,47,84,121,112,101,67,104,101,99,107,46,104,115,34,
-32,64,32,64,32,35,49,50,49,55,32,64,32,35,50,53,32,64,32,64,
+32,64,32,64,32,35,49,50,50,52,32,64,32,35,50,53,32,64,32,64,
32,64,32,64,32,64,32,64,32,64,32,89,32,66,32,80,32,75,32,64,
32,64,32,83,39,32,67,32,64,32,66,32,83,39,32,83,39,32,64,32,
66,32,67,32,64,32,67,32,67,32,83,39,32,64,32,90,32,75,32,64,
--- a/src/MicroHs/Compile.hs
+++ b/src/MicroHs/Compile.hs
@@ -110,6 +110,7 @@
-- liftIO $ putStrLn $ showEModule mdl
-- liftIO $ putStrLn $ showEDefs defs
+ -- TODO: skip test when nm is a file name
when (nm /= nmn) $
error $ "module name does not agree with file name: " ++ showIdent nm ++ " " ++ showIdent nmn
let
@@ -188,6 +189,9 @@
------------------
+-- TODO:
+-- * if the IdentModule has suffix ".hs" then treat it as a file name.
+-- * with the CPP flag, run the prepocessor on the file
readModulePath :: Flags -> IdentModule -> IO (FilePath, String)
readModulePath flags mn = do
mh <- findModulePath flags mn
--- a/src/MicroHs/TypeCheck.hs
+++ b/src/MicroHs/TypeCheck.hs
@@ -1174,6 +1174,13 @@
tcDefsValue :: [EDef] -> T [EDef]
tcDefsValue ds = do
mapM_ addValueType ds
+ -- TODO:
+ -- * split Fcn into those without and with type signatures
+ -- * for those without, generate a type variable and add to the environment
+ -- * typecheck those without as a group, with no tcReset
+ -- * generalise types in the group
+ -- * add those to the (old) symbol table
+ -- * run the map below on the rest of them
mapM (\ d -> do { tcReset; tcDefValue d}) dsaddValueType :: EDef -> T ()
--
⑨