<div dir="ltr"><div>How do I return Nothing from a function?<br><br>When there is no edge in the graph this code fails.<br>*** Exception: Graph.hs:65:9-26: Irrefutable pattern failed for pattern (Data.Maybe.Just w)<br><br>
<br clear="all">*Main> :t weight<br>weight<br>  :: (Ix t1, Ix t2) => t1 -> t2 -> Array (t1, t2) (Maybe t) -> t<br><br>weight x y g = w<br>    where<br>        (Just w) = g!(x,y)<br><br><br></div>Thank you for your time.<br>
<br><div>-- <br><div dir="ltr"><p dir="ltr">--<br>
</p><p dir="ltr">Sent from an expensive device which will be obsolete in a few months! :D</p>
Casey<br><br></div>
</div></div>