I have trouble in returning a list of Figures. I want return a type of m (Maybe [Figure IO]), but the type of dv_findFigure is :: a -> Point -> s (Maybe (Figure s)). How can change the code below to get a s (Maybe [Figure s])?<br>
Thank you in advance!<br><br> dv_findFigure :: a -> Point -> s (Maybe (Figures))<br> fig_contains :: fig -> Point -> m Bool<br> anc :: Point<br>do<br> fs <- dv_getSelFigs dv<br> fs' <- filterM (`fig_contains` anc) fs<br>
f <- case fs' of<br> [] -> dv_findFigure dv anc<br> fig : _ -> return $ Just fig<br> case f of<br> Just f' -> tool_dragtrack self f'<br>
Nothing -> dv_clearSel dv >> tool_areatrack self<br><br> Couldn't match expected type `Figure m'<br> against inferred type `[Figure IO]'<br> Expected type: m (Maybe (Figure m))<br>
Inferred type: m (Maybe [Figure IO])<br> In the expression: return $ Just fs<br> In a case alternative: fig : _ -> return $ Just fs<br><br>