diff --git a/compiler/Type/Constrain/Expression.hs b/compiler/Type/Constrain/Expression.hs index 21389e5..aa5df70 100644 --- a/compiler/Type/Constrain/Expression.hs +++ b/compiler/Type/Constrain/Expression.hs @@ -36,10 +36,10 @@ constrain env (A region expr) tipe = | otherwise -> return (name - exists $ \x -> do - clo <- constrain env lo x - chi <- constrain env hi x - return $ and [clo, chi, list x === tipe] + existsNumber $ \n -> do + clo <- constrain env lo n + chi <- constrain env hi n + return $ and [clo, chi, list n === tipe] ExplicitList exprs -> exists $ \x -> do diff --git a/compiler/Type/Type.hs b/compiler/Type/Type.hs index 023ecd3..55ec193 100644 --- a/compiler/Type/Type.hs +++ b/compiler/Type/Type.hs @@ -141,6 +141,11 @@ exists f = do v <- liftIO $ var Flexible ex [v] <$> f (VarN v) +existsNumber :: Error e => (Type -> ErrorT e IO TypeConstraint) -> ErrorT e IO TypeConstraint +existsNumber f = do + v <- liftIO $ var (Is Number) + ex [v] <$> f (VarN v) + instance Show a => Show (UF.Point a) where show point = unsafePerformIO $ fmap show (UF.descriptor point)