[Haskell-beginners] better way to create Array defined on all indices

Larry Evans cppljevans at suddenlink.net
Thu Oct 16 00:50:53 EDT 2008


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].
> The attached does this; however, it also allows
> duplicate definitions (e.g. in the attached, the
> value for Term index is defined twice).
>
> Is there a better way to do this?  Maybe a
> way that doesn't use all the contexts?
> Also, is there a way to do it so that the value
> associated with an index is not redefined?
The aforementioned array.html has:

                            _     -> error "Array.!: \
                                           \multiply defined array element")

suggesting it should detect redefinitions; however,
the library on my system apparently doesn't do that.
It will detect missing defintions with the same error
found in array.html:

                            []    -> error "Array.!: \
                                           \undefined array element"

Is this a bug in my ghc library?  I'n on ubuntu and
synaptic shows the ghc6 version as:

  6.8.2-2ubuntu1



 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20081015/c14acf5e/attachment-0001.htm


More information about the Beginners mailing list