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

Krzysztof Skrzętnicki gtener at gmail.com
Fri Apr 24 08:08:09 EDT 2009


I disagree. There are plenty of non-total functions in various libraries.
Prefixing all of them with "unsafe" seems like overkill. Consider fromJust:
it should be called unsafeFromJust, same for head, tail, init...

Best regards

Christopher Skrzętnicki

On Fri, Apr 24, 2009 at 13:58, Chris Eidhof <chris at eidhof.nl> 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
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20090424/c0acebc6/attachment-0001.htm


More information about the Libraries mailing list