From 490992c8abc4635b6db80a67e8a04d1886098564 Mon Sep 17 00:00:00 2001 From: Jeremy Schlatter Date: Thu, 19 Dec 2019 00:12:21 -0800 Subject: [PATCH] don't crash when falling back to unary numbers This is useful for doing optimization work, but not useful for end users. I'd like to add a toggle for this shortly. --- src/Data.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data.hs b/src/Data.hs index d60835a..94b92ed 100644 --- a/src/Data.hs +++ b/src/Data.hs @@ -118,8 +118,8 @@ readPair :: (MonadMutableRef m, r ~ Ref m) => String -> r (Pair r) -> m (Object readPair _why x = readRef x >>= \case MkPair p -> pure p -- Collapse the optimized representation! :( - Number n -> interpreterBug $ "tried to collapse number " <> show n <> " " <> _why - -- Number n -> collapseNumber n >>= \p -> (writeRef x (MkPair p)) $> p + -- Number n -> interpreterBug $ "tried to collapse number " <> show n <> " " <> _why + Number n -> collapseNumber n >>= \p -> (writeRef x (MkPair p)) $> p Continuation _ -> pure (Symbol Nil, Symbol Nil) -- Collapse the optimized representation! :( OptimizedFunction f -> writeRef x (MkPair (fnFallback f)) $> fnFallback f