
Folks, GHC support will be intermittent at best for the next week or so, as Simon & I are both heading out to Pittsburgh for ICFP and the Haskell workshop. Catch you all later... Cheers, Simon

"Simon Marlow"
GHC support will be intermittent at best for the next week or so, as Simon & I are both heading out to Pittsburgh for ICFP and the Haskell workshop. Catch you all later...
And here I recently started using GHC 5.04 from the provided RH7.2 packages, and getting occasional "heapCensus" errors. Relatively rare, difficult to reproduce, rerunning on the same data usually works. (I was going to forward another question about a heap usage problem I had, but it turned out it was just a question of applying a bit more strictness in the right place. :-) -kzm -- If I haven't seen further, it is by standing in the footprints of giants

At the moment, I have a user defined data type on which I have defined some operations, instantiated (not derived) Eq and so on. However, for efficiency I'm storing the actual data in UArrays of Word8. In order for everything to work, I need functions 'toW8' and 'fromW8' to map between the data type and its representation in the array. I gather it is impossible to hide the 'Eq' instance of Word8 and/or redefine it, but could this be circumvented by instead of data Foo = F | G instance Eq Foo where F == _ = True _ == _ = False defining something like newtype Foo = F Word8 f, g, h :: Foo f = F 0 g = F 1 and using the same instance declaration? And will it still fit into a UArray? (It is of course possible that, while profiling indicates otherwise, the conversion functions have little impact in practice; i.e. the optimizer will do away with them.) -kzm -- If I haven't seen further, it is by standing in the footprints of giants

If I'm understanding you correctly, you just want to be able to put F|Gs into an unbooxed array. You don't need to do this conversion stuff...you can just define new instances. Something like: instance MArray IOUArray F IO where newArray (l,h) f = newArray (l,h) (f==F) >>= castIOUArray newArray_ (l,h) = do (arr :: IOUArray ix Bool) <- newArray_ (l,h) castIOUArray arr unsafeRead arr i = do arr' <- castIOUArray arr b <- unsafeRead arr' i return (if b then F else G) unsafeWrite arr i f = castIOUArray arr >>= \arr' -> unsafeWrite arr' i (f==F) here we have represented Fs by their isomorphic type Bool, which already has MArray instances. HTH - Hal -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume On 2 Oct 2002, Ketil Z. Malde wrote:
At the moment, I have a user defined data type on which I have defined some operations, instantiated (not derived) Eq and so on. However, for efficiency I'm storing the actual data in UArrays of Word8.
In order for everything to work, I need functions 'toW8' and 'fromW8' to map between the data type and its representation in the array.
I gather it is impossible to hide the 'Eq' instance of Word8 and/or redefine it, but could this be circumvented by instead of
data Foo = F | G
instance Eq Foo where F == _ = True _ == _ = False
defining something like
newtype Foo = F Word8 f, g, h :: Foo f = F 0 g = F 1
and using the same instance declaration? And will it still fit into a UArray?
(It is of course possible that, while profiling indicates otherwise, the conversion functions have little impact in practice; i.e. the optimizer will do away with them.)
-kzm -- If I haven't seen further, it is by standing in the footprints of giants _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Ketil, Simon and I have been tracking down this bug for some time now. A few days ago I was finally able to come up with a often repeatable, relatively short example (enough qualifiers? :P). Last I talked to him, Simon was getting it running in gdb, but because of how the moon was aligned yesterday (or something), it was refusing to fall over. If you have a short program which demonstrates the same problem, I'm sure Simon would love to get a copy... - Hal -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume On 2 Oct 2002, Ketil Z. Malde wrote:
"Simon Marlow"
writes: GHC support will be intermittent at best for the next week or so, as Simon & I are both heading out to Pittsburgh for ICFP and the Haskell workshop. Catch you all later...
And here I recently started using GHC 5.04 from the provided RH7.2 packages, and getting occasional "heapCensus" errors. Relatively rare, difficult to reproduce, rerunning on the same data usually works.
(I was going to forward another question about a heap usage problem I had, but it turned out it was just a question of applying a bit more strictness in the right place. :-)
-kzm -- If I haven't seen further, it is by standing in the footprints of giants _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Hal Daume III
If you have a short program which demonstrates the same problem, I'm sure Simon would love to get a copy...
I have a longish program that demonstrates the same problem; that is, it only fails when the moon is aligned or something. :-) It happens (has happened) rarely enough that it's not a problem for me. -kzm -- If I haven't seen further, it is by standing in the footprints of giants
participants (3)
-
Hal Daume III
-
ketil@ii.uib.no
-
Simon Marlow