ref: 205756da6df51ce1a9c043aa4e4a46c4ae681c74
parent: b71f39140b9cf68efc88793632887ab8b9ad9d14
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Sun Oct 22 15:20:24 EDT 2023
Add function to select bindings.
--- a/src/MicroHs/Compile.hs
+++ b/src/MicroHs/Compile.hs
@@ -80,11 +80,9 @@
compile :: Flags -> IdentModule -> Cache -> IO ([LDef], Cache)
compile flags nm ach = IO.do
((_, t), ch) <- runStateIO (compileModuleCached flags nm) ach
- let
- defs (TModule _ _ _ _ _ _ _ ds) = ds
IO.when (verbose flags > 0) $
putStrLn $ "total import time " ++ padLeft 6 (showInt t) ++ "ms"
- IO.return (concatMap defs $ M.elems $ cache ch, ch)
+ IO.return (concatMap bindingsOf $ M.elems $ cache ch, ch)
-- Compile a module with the given name.
-- If the module has already been compiled, return the cached result.
--- a/src/MicroHs/TypeCheck.hs
+++ b/src/MicroHs/TypeCheck.hs
@@ -7,6 +7,7 @@
impossible,
mkClassConstructor,
mkSuperSel,
+ bindingsOf,
) where
import Prelude --Xhiding(showList)
import Data.Char
@@ -32,6 +33,9 @@
[ValueExport] -- exported values (including from T(..))
a -- bindings
--Xderiving (Show)
+
+bindingsOf :: forall a . TModule a -> a
+bindingsOf (TModule _ _ _ _ _ _ _ a) = a
data TypeExport = TypeExport
Ident -- unqualified name
--
⑨