Incorporating bug fix

58 views
Skip to first unread message

charl...@gmail.com

unread,
Feb 12, 2015, 10:22:57 PM2/12/15
to elm-d...@googlegroups.com
Hi,

I have found and fixed a bug in Array.map and Array.indexedMap that was preventing my application from working. I've submitted this fix to the elm-lang/core repository (https://github.com/elm-lang/core/pull/171) but I don't know how to proceed so I was hoping for some pointers.

I installed elm using Haskell cabal. Now how do I now incorporate my fix so that it applies to my local install? This is the first time I have worked with Haskell/cabal. it was painful and I'm a bit wary about trying stuff randomly.

Any guidelines on what I should do?

Cheers
/Charles

Dobes Vandermeer

unread,
Feb 12, 2015, 10:29:59 PM2/12/15
to elm-d...@googlegroups.com

In the past running "cabal install ." in my patched source code did the trick.


--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

charl...@gmail.com

unread,
Feb 12, 2015, 10:46:49 PM2/12/15
to elm-d...@googlegroups.com
elm-core 09:14:10 git@master
$cabal install
cabal: No cabal file found.
Please create a package description file <pkgname>.cabal

Doesn't seem to work.

Dobes Vandermeer

unread,
Feb 12, 2015, 11:04:51 PM2/12/15
to elm-d...@googlegroups.com

Did you try it with a period as the last parameter?  It's been a while for me, though. The folder structure might have changed. Look around for a cabal file.

Max Goldstein

unread,
Feb 13, 2015, 12:11:02 AM2/13/15
to elm-d...@googlegroups.com
I believe I have a demonstration that array equality is buggy, mapping not involved:

import Text (asText)
import Array as A

a1 = A.fromList [1..33]

a2 = A.append (A.fromList [1..17]) (A.fromList [18..33])

main = asText <| (a1 == a2, a1, a2)

I know that Dict (and Set, which wraps it) do not support semantic equality, but rather representational equality, which is useless. My guess is something similar is going on here, since if you change 33 to 32 it works (Array uses a tree with 32 children per node). However, Dict is implemented entirely within Elm, but Array is native and should be able to make equality work.

(Sorry if I'm harping on equality, I know we don't have a good ad hoc polymorphism/overloading solution yet, but one of the things I hate about JS is their arrays don't support equality either.)

Thanks for the bug report, and the issues may well be independent. Clearly there's a bit more work to be done here.

charl...@gmail.com

unread,
Feb 13, 2015, 12:35:57 AM2/13/15
to elm-d...@googlegroups.com
Hi Max,

This is a different issue from the one I fixed. The bug you've caught is due to the fact that `Array` seems to be implemented internally as some sort of table. Fixing this could be done by patching `Native.Utils.eq()` to handle "_ctor: _Array" but I don't think that's a clean solution. I haven't looked deeply into it yet. Maybe if I get some time.

My bug fix, however, applies to `Array.map` and `Array.indexedMap` and needs to be in separately from this issue.

Cheers
/Charles
Reply all
Reply to author
Forward
0 new messages