ucsd-progsys/liquidhaskell

Question about Dependent Sums

Open

#1,615 创建于 2020年2月14日

在 GitHub 查看
 (9 评论) (0 反应) (0 负责人)Haskell (1,306 star) (157 fork)batch import
errormsggood first issue

描述

Hi, I'm trying to represent a function that returns a dependent sum like below

{-@ measure isLeft :: Either a b -> Bool @-}
isLeft (Left _) = True
isLeft (Right _) = False

{-@ example :: x:Int -> {v : Either Int String | (isLeft v && x > 0) || (not (isLeft v) && x <= 0)} @-}
example x =
    if x <= 0 then Right "hello" else Left 1

but am running into issues with liquid. Am I representing this correctly? Even without generics, this still doesn't seem to work in the way I might expect.

贡献者指南

Question about Dependent Sums · ucsd-progsys/liquidhaskell#1615 | Good First Issue