Restrict list interpolation to numbers!
This commit is contained in:
parent
fea6361da5
commit
dd1b3d4d7c
2 changed files with 9 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue