mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
03038c013b
commit
b3f51e5259
|
|
@ -164,6 +164,7 @@ apply :: forall c m . ( IsContext c
|
||||||
-> [Syntax c]
|
-> [Syntax c]
|
||||||
-> RunM c m (Syntax c)
|
-> RunM c m (Syntax c)
|
||||||
apply name args' = do
|
apply name args' = do
|
||||||
|
-- notice $ red "APPLY" <+> pretty name
|
||||||
what <- ask >>= readTVarIO <&> HM.lookup name . fromDict
|
what <- ask >>= readTVarIO <&> HM.lookup name . fromDict
|
||||||
case bindAction <$> what of
|
case bindAction <$> what of
|
||||||
Just (BindLambda e) -> mapM runExpr args' >>= e
|
Just (BindLambda e) -> mapM runExpr args' >>= e
|
||||||
|
|
@ -180,6 +181,23 @@ runExpr syn = handle (handleForm syn) $ case syn of
|
||||||
ListVal [ w, SymbolVal ".", b] -> do
|
ListVal [ w, SymbolVal ".", b] -> do
|
||||||
pure $ mkList [w, b]
|
pure $ mkList [w, b]
|
||||||
|
|
||||||
|
ListVal [ SymbolVal "quot", ListVal b] -> do
|
||||||
|
pure $ mkList b
|
||||||
|
|
||||||
|
ListVal [SymbolVal "lambda", arglist, body] -> do
|
||||||
|
pure $ mkForm @c "lambda" [ arglist, body ]
|
||||||
|
|
||||||
|
ListVal (ListVal [SymbolVal "lambda", ListVal decl, body] : args) -> do
|
||||||
|
error "oopsie"
|
||||||
|
-- d <- ask
|
||||||
|
-- void $ liftIO do
|
||||||
|
-- dd <- readTVarIO d
|
||||||
|
-- undefined
|
||||||
|
-- runReaderT $ runExpr body
|
||||||
|
-- error "FUCK!"
|
||||||
|
-- -- liftIO (run d body)
|
||||||
|
pure nil
|
||||||
|
|
||||||
ListVal (SymbolVal name : args') -> do
|
ListVal (SymbolVal name : args') -> do
|
||||||
apply name args'
|
apply name args'
|
||||||
|
|
||||||
|
|
@ -404,6 +422,12 @@ main = do
|
||||||
es -> do
|
es -> do
|
||||||
pure $ mkForm "dict" es
|
pure $ mkForm "dict" es
|
||||||
|
|
||||||
|
tell $ bindMatch "lambda" $ \case
|
||||||
|
[a, b] -> do
|
||||||
|
pure $ mkForm @C "lamba" [ mkSym "_", mkSym "..." ]
|
||||||
|
|
||||||
|
_ -> error "SHIT"
|
||||||
|
|
||||||
tell $ bindMatch "map" $ \syn -> do
|
tell $ bindMatch "map" $ \syn -> do
|
||||||
case syn of
|
case syn of
|
||||||
[ListVal (SymbolVal "lambda" : SymbolVal fn : _), ListVal rs] -> do
|
[ListVal (SymbolVal "lambda" : SymbolVal fn : _), ListVal rs] -> do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue