<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">From the top of my head, I would expect that fromListN rejects both shorter and longer lists. If a user is under a wrong impression that some list has length N, it is better to fail early, before other, more dangerous implications of this impression are made (for example, using `unsafeIndex`).<div class=""><br class=""></div><div class="">However, my expectations disagree with the documentation, which states that the observable behaviour of fromListN should be equivalent to fromList: <a href="http://hackage.haskell.org/package/base-4.12.0.0/docs/GHC-Exts.html#v:fromListN" class="">http://hackage.haskell.org/package/base-4.12.0.0/docs/GHC-Exts.html#v:fromListN</a> I am not sure what was the motivation behind such choice.</div><div class=""><div><br class=""></div><div>Best regards,</div><div>Andrew</div><div><br class=""><blockquote type="cite" class=""><div class="">On 28 Feb 2020, at 02:53, Carter Schonwald <<a href="mailto:carter.schonwald@gmail.com" class="">carter.schonwald@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" class="">Hey everyone: </div><div dir="auto" class="">When you see fromListN as a function in a library, do you assume / presume it’s expecting an exactly N element list ? Or do you expect/tolerate other behavior ? </div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Should it reject shorter lists?</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Should it truncate or reject longer lists? </div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">A corner case of this came up in some bug discussion I was having regarding vector,  and I shall claim and or presume that most folks assume exact size with prompt rejection of too long or too short. </div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Thoughts please ?</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">-Carter </div>
</div></blockquote></div><br class=""></div></body></html>