solved: implementation dependent (was Re: [Haskell-beginners] better
way to create Array defined on all indices
Larry Evans
cppljevans at suddenlink.net
Thu Oct 16 10:17:40 EDT 2008
On 10/15/08 23:50, Larry Evans wrote:
> On 10/15/08 16:05, Larry Evans wrote:
>> I'd like to have an Array indices values
>> (see http://haskell.org/onlinereport/array.html)
>> defined on [minBound::indices ... maxBound::indices].
[snip]
> The aforementioned array.html has:
>
> _ -> error "Array.!: \
> \multiply defined array element")
>
> suggesting it should detect redefinitions;
> Is this a bug in my ghc library?
According to:
http://www.haskell.org/ghc/docs/6.6-latest/html/libraries/base/Data-Array.html
it's not. It's just implemented differently by libraries:
> The Haskell 98 Report further specifies that if any two associations
> in the list have the same index, the value at that index is undefined
> (i.e. bottom). However in GHC's implementation, the value at such an
> index is the value part of the last association with that index in the
> list.
So, if I want multiple definitions diagnosed as an error, I'll have to
do it myself :(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20081016/69ff3cfa/attachment.htm
More information about the Beginners
mailing list