Re: [Haskell-cafe] An easy way to represent and modify graphs?

2012-09-27 Thread Strake
On 21/09/2012, Takayuki Muranushi muranu...@gmail.com wrote:
 Yes Pointers. I've forgotten that. I have once dealt with structures,
 with lots of IORefs.  It was smooth and fast. Thank you for reminding
 me!

 On the other hand, use of pointers means that our values are not
 algebraic data type any more. We have to derive operations such as
 map, fold, serialize by ourselves. I can do that, but am I right? Or
 is there some systematic way to derive such operations?

If you mean that one can't write deriving (Class, ...) then yes, to
my knowledge, one can't, as it would not know to follow the pointers.

I doubt that such a derivation algorithm would be possible in general,
since it wouldn't know whether to compare by value, i.e. follow the
pointer.

 Best regards,

 Takayuki


Cheers,
Strake

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] An easy way to represent and modify graphs?

2012-09-21 Thread Takayuki Muranushi
Yes Pointers. I've forgotten that. I have once dealt with structures,
with lots of IORefs.  It was smooth and fast. Thank you for reminding
me!

On the other hand, use of pointers means that our values are not
algebraic data type any more. We have to derive operations such as
map, fold, serialize by ourselves. I can do that, but am I right? Or
is there some systematic way to derive such operations?

Best regards,

Takayuki

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] An easy way to represent and modify graphs?

2012-09-19 Thread Strake
Pointers.

Seriously.

In Haskell one could use STRef rather than the cumbersome Foreign.Ptr,
though STRef too can be kludgy.

I know not whether safe, pure, immutable pointers would be possible in
Haskell, but in my experience STRef can work well enough.

Cheers,
Strake

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe