<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 21, 2014 at 10:06 AM, Nishant <span dir="ltr"><<a href="mailto:nishantgeek@gmail.com" target="_blank">nishantgeek@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br clear="all"><div>Hi, </div><div><br></div><div>Do I need to define indices and elem for Graph a w here explicitly ? </div>
<div><br></div><div><br></div><div><br></div><div><div>import Data.Array</div><div>
<br></div><div>data Graph a w = Array a [(a,w)]</div><div>-- array (1,3) [(1,[(2,3),(3,2)])]</div><div><br></div><br></div></div></blockquote></div><br></div><div class="gmail_extra">You probably meant to make "Graph a w" a type synonym but you used "data" thus it is a type constructor with one data constructor named Array which takes two parameters : an "a" and a list of pairs of "a" and "w".<br>
</div><div class="gmail_extra">You wanted to write :<br><br></div><div class="gmail_extra">> type Graph a w = Array a [(a,w)]<br><br></div><div class="gmail_extra">which should work better (indices will work on it like on an Array from Data.Array).<br>
<br>-- <br></div><div class="gmail_extra">Jedaï<br></div></div>