[Haskell-cafe] A question about State Monad and Monad in general

Claude Heiland-Allen claudiusmaximus at goto10.org
Fri Jul 16 04:58:54 EDT 2010


Hi,

On 16/07/10 07:35, C K Kashyap wrote:
> Haskell without using any standard library stuff?

> For example, if I wanted an image representation such as this
> [[(Int,Int.Int)]] - basically a list of lists of 3 tuples (rgb) and
> wanted to do in place replacement to set the pixel values, how could I
> go about it.

Break the problem down into parts:

1. replace a single pixel
2. modify an element in a list at a given index using a
    given modification function
3. modify an element in a list of lists at a pair of given
    indices using a given replacement function

I had a stab at it.  Without any standard library stuff I couldn't 
figure out how to print any output, though - so who knows if the code I 
wrote does what I intended.

The point is, it's libraries all the way down - so use them, study them 
where necessary for understanding, and write them and share them when 
you find something missing.


Claude
-- 
http://claudiusmaximus.goto10.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CKKashyap.hs
Type: text/x-haskell
Size: 2556 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100716/5eb79b3a/CKKashyap.bin


More information about the Haskell-Cafe mailing list