Proposal: rename Data.Map.fromAscList to Data.Map.unsafeFromAscList

Christian Maeder Christian.Maeder at dfki.de
Fri Apr 24 08:36:05 EDT 2009


There is an old thread about this, where Daan suggested "unchecked"
instead of "unsafe".
http://www.haskell.org/pipermail/haskell/2004-March/013787.html

"unsafe" reminds to "IO" stuff.

Didn't you read the comment about fromAscList? Isn't the name long
enough to scare you?

Would you have not taken "unsafeFromAscList" under the same
circumstances you've chosen "fromAscList"?

Cheers Christian

Chris Eidhof wrote:
> Hey all,
> 
> I had some code where the function elems said a certain key was present,
> but looking it up returned a Nothing. After some debugging I found out
> that it did work if I used Prelude's lookup in combination with toList.
> After even more debugging it turned out there was a fromAscList
> somewhere deep down in my code where it should have been a fromList.
> 
> Now, I know that I shouldn't have used fromAscList and that it was
> totally my fault. I also realize this is something that can't easily be
> checked using the type system, so I propose we do the next best thing:
> prefix the name with 'unsafe'.
> 
> -chris


More information about the Libraries mailing list