You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone, I have confusion. And I search this question in this issues, don't help me.
I write the following solution for the exercise.
{-@ fromList:: n:Int-> ps:[(Int, a)] ->Maybe (SparseNan) @-}
fromList::Int-> [(Int, a)] ->Maybe (Sparsea)
fromList dim elts =if dim >=0thenSP dim <$>traverse f elts elseNothingwhere
f (i, x)
| i >=0&& i < dim =Just (i, x)
|otherwise=Nothing
LiquidTypeMismatch.The inferred typeVV: {v : (GHC.Maybe.Maybe {v : (Tutorial_05_Datatypes.Sparse [GHC.Types.Char]) | spDim v == (3: int)}) | v ==?c}
.
is not a subtype of the required typeVV: {VV: (GHC.Maybe.Maybe (Tutorial_05_Datatypes.Sparse [GHC.Types.Char])) | isJust VV}
I notice that I should prove that the argument of fromJust is Just, so I want to encode the information in the refinement type signature, but I don't know how to express it exactly, and the following are failed attempts.
Attempt 1
{-@ predicate ListInNXs=filter (between N) Xs==Xs@-}
{-@ fromList :: n:Int -> ps:[(Int, a)] -> {vs:Maybe (SparseN a n)| ListIn n ps => isJust vs } @-}
complains: Unbound symbol Data.Vector.filter
Attempt 2
{-@ fromList:: n:Int-> ps:[(index:Int, a)] -> {vs:Maybe (SparseNan)| 0<= index && index < n => isJust vs }@-}
complains: Unbound symbol index
Wish for your help!
The text was updated successfully, but these errors were encountered:
Hello everyone, I have confusion. And I search this question in this issues, don't help me.
I write the following solution for the exercise.
But the test case:
complains:
I notice that I should prove that the argument of fromJust is Just, so I want to encode the information in the refinement type signature, but I don't know how to express it exactly, and the following are failed attempts.
Attempt 1
complains:
Unbound symbol Data.Vector.filter
Attempt 2
complains:
Unbound symbol index
Wish for your help!
The text was updated successfully, but these errors were encountered: