<div dir="ltr"><div>I was wondering whether it was possible using fixed-vector, ut dependent types seem to be a new thing I can experiment with.</div><div><br></div><div>Thanks for the quick reply.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 12 March 2015 at 03:26, Adam Bergmark <span dir="ltr"><<a href="mailto:adam@bergmark.nl" target="_blank">adam@bergmark.nl</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">If I understand you correctly you seem to want dependent types, this article uses the same example you need, promoting the length of a vector/list to the type level: <a href="https://www.fpcomplete.com/user/konn/prove-your-haskell-for-great-safety/dependent-types-in-haskell" target="_blank">https://www.fpcomplete.com/user/konn/prove-your-haskell-for-great-safety/dependent-types-in-haskell</a><div><br></div><div>You'd end up with `plot :: (Vector n Double -> Double) -> Vector n (Double, Double) -> IO ()' where `n' is the length of the vector.</div><div><br></div><div>HTH,</div><div>Adam</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Mar 11, 2015 at 10:45 PM, Sumit Sahrawat, Maths & Computing, IIT (BHU) <span dir="ltr"><<a href="mailto:sumit.sahrawat.apm13@iitbhu.ac.in" target="_blank">sumit.sahrawat.apm13@iitbhu.ac.in</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi everybody,</div><div><br></div>I have a function of type<div><br></div><div><font face="monospace, monospace">    plot :: ([Double] -> Double)    -- A function to plot</font></div><div><font face="monospace, monospace">         -> [(Double, Double)]      -- Range for all arguments</font></div><div><font face="monospace, monospace">         -> IO ()</font><br clear="all"><div><br></div><div>I want to enforce the fact that ranges for all arguments should be provided.</div><div>Is there a way to make the type system enforce it?</div><span><font color="#888888"><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</font></span></div></div>
<br></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</div>