Restrict list interpolation to numbers!

This commit is contained in:
Evan Czaplicki 2014-02-21 16:21:00 -05:00
parent fea6361da5
commit dd1b3d4d7c
2 changed files with 9 additions and 4 deletions

View file

@ -36,10 +36,10 @@ constrain env (A region expr) tipe =
| otherwise -> return (name <? tipe)
Range lo hi ->
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

View file

@ -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)