Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Brainfuck interpreter stack overflow (Felipe Lessa)
   2.  Programmers File Editor ([email protected])
   3.  single responsibility principle vs functional    programming
      (Joe Van Dyk)
   4. Re:  single responsibility principle vs functional
      programming (Isaac Dupree)
   5. Re:  Programmers File Editor (Henk-Jan van Tuyl)
   6. Re:  single responsibility principle vs functional
      programming (Stephen Blackheath [to Haskell-Beginners])
   7. Re:  single responsibility principle vs functional
      programming (Joe Van Dyk)
   8. Re:  single responsibility principle vs functional
      programming (Henk-Jan van Tuyl)
   9. Re:  single responsibility principle vs functional
      programming (Sriram Durbha)


----------------------------------------------------------------------

Message: 1
Date: Tue, 26 Jan 2010 17:49:29 -0200
From: Felipe Lessa <[email protected]>
Subject: Re: [Haskell-beginners] Brainfuck interpreter stack overflow
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Tue, Jan 26, 2010 at 05:06:25PM +0100, Edgar Klerks wrote:
>  I also have another question about deriving monads. I have modified
> Data.List.Zipper, so it supports 2 extra directions (up and down):
>
> data ZipperQuad a = Zip [a] [a] [a] [a]

(I've changed the name to ZipperQuad.)

How do you go up and down? If say that

  up :: ZipperQuad a -> ZipperQuad a
  up (Zip ls rs ds (u:us)) = Zip ls rs (u:ds) us
  up z                     = z

then your new zipper is isomorphic to two old zippers

  data ZipperQuad' a = Z4 !(Zipper a) !(Zipper a)

with functions

  up,down,left4,right4 :: ZipperQuad' a -> ZipperQuad' a
  up     (Z4 h v) = Z4 h (right v)
  down   (Z4 h v) = Z4 h (left v)
  left4  (Z4 h v) = Z4 (left h) v
  right4 (Z4 h v) = Z4 (right h) v

Wouldn't a really fair ZipperQuad walk on a grid?

--
Felipe.


------------------------------

Message: 2
Date: Tue, 26 Jan 2010 15:03:27 -0500
From: [email protected]
Subject: [Haskell-beginners] Programmers File Editor
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"


Hi!
Apologies for asking what is probably a very simple question...
...how do I map the drives/create a BAT file/etc so I can write and save 
programmes in the Programmers File Editor to use them in HUGS?
Is there an idiots guide?
Thanks.
W.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100126/7db2c1d2/attachment-0001.html

------------------------------

Message: 3
Date: Tue, 26 Jan 2010 17:37:34 -0800
From: Joe Van Dyk <[email protected]>
Subject: [Haskell-beginners] single responsibility principle vs
        functional      programming
To: beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

So I'm still pretty new to functional programming.

In OOP, you have the concept of each class having a
single-responsibility (or reason for changing).  See
http://en.wikipedia.org/wiki/Single_responsibility_principle

I'm having problems seeing how that concept maps to functional
programming.  Perhaps it doesn't?

-- 
Joe Van Dyk
http://fixieconsulting.com


------------------------------

Message: 4
Date: Tue, 26 Jan 2010 21:30:17 -0500
From: Isaac Dupree <[email protected]>
Subject: Re: [Haskell-beginners] single responsibility principle vs
        functional      programming
To: beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed

Joe Van Dyk wrote:
> So I'm still pretty new to functional programming.
> 
> In OOP, you have the concept of each class having a
> single-responsibility (or reason for changing).  See
> http://en.wikipedia.org/wiki/Single_responsibility_principle
> 
> I'm having problems seeing how that concept maps to functional
> programming.  Perhaps it doesn't?

It's called "modularity" in my book, and it even works in C.  You put 
functions/data-structures/etc. that are related* to each other in the 
same file, or directory-of-files, or entire library. (*a quite similar 
concept to your single-responsibility principle)

In Haskell, there is a module system that lets you choose what to export 
/ not export from which files (in a more principled way than in C). 
Think of it as "private"(a la OOP) implementation details if you like.

-Isaac


------------------------------

Message: 5
Date: Wed, 27 Jan 2010 16:22:48 +0100
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] Programmers File Editor
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
        delsp=yes

On Tue, 26 Jan 2010 21:03:27 +0100, <[email protected]> wrote:

>
> Hi!
> Apologies for asking what is probably a very simple question...
> ...how do I map the drives/create a BAT file/etc so I can write and save  
> programmes in the Programmers File Editor to use them in HUGS?
> Is there an idiots guide?
> Thanks.
> W.
>
>
>

The Hugs uesr's guide might be useful:
http://cvs.haskell.org/Hugs/pages/users_guide/index.html

-- 
Met vriendelijke groet,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://functor.bamikanarie.com
http://members.chello.nl/hjgtuyl/tourdemonad.html
--


------------------------------

Message: 6
Date: Thu, 28 Jan 2010 08:43:32 +1300
From: "Stephen Blackheath [to Haskell-Beginners]"
        <[email protected]>
Subject: Re: [Haskell-beginners] single responsibility principle vs
        functional      programming
To: Joe Van Dyk <[email protected]>
Cc: beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed

Joe,

IMHO:

Classes in OOP have several purposes, one of which is to manage the 
mutation of state so as to put a lid on the complexity that could 
result.  The inside of an OOP class is usually a C program, and the 
outside is (ideally) a semi-functional program with interfaces that are 
simple at the level of abstraction where they operate.  The single 
responsibility principle exists to stop the C programs getting big and 
messy, and to help the programmer to build neat layers of abstraction on 
top of each other by having more abstract classes constructed out of 
less abstract ones.

Functional programming essentially takes the C part away and makes the 
whole program into a layering of abstractions, even at the lowest level.

An FP function more-or-less maps to an OOP class, and the reason why it 
can be a much lighter-weight structure is because the need to manage 
mutation has been removed.  I think the same principle applies, though - 
an FP function should have only one responsibility.

Perhaps in FP the need for this principle to be explicitly stated and 
carefully observed is not so great, though.  If an FP function does two 
things and can be split up, it's not such a big deal, because 
re-factoring is easy in an FP language.  By comparison in OOP, splitting 
a big messy class up is a lot of work with a great risk of breakage. 
This amplifies the importance of applying the single responsibility 
principle before you start writing the class.


Steve

Joe Van Dyk wrote:
> So I'm still pretty new to functional programming.
> 
> In OOP, you have the concept of each class having a
> single-responsibility (or reason for changing).  See
> http://en.wikipedia.org/wiki/Single_responsibility_principle
> 
> I'm having problems seeing how that concept maps to functional
> programming.  Perhaps it doesn't?
> 


------------------------------

Message: 7
Date: Wed, 27 Jan 2010 14:43:27 -0800
From: Joe Van Dyk <[email protected]>
Subject: Re: [Haskell-beginners] single responsibility principle vs
        functional      programming
To: "Stephen Blackheath [to Haskell-Beginners]"
        <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

Thanks, I'm starting to get it.

Perhaps what I need to do is take a small standard OOP system and try
converting it to FP.

Or perhaps there's already examples of such a thing I could look at?

Joe

On Wed, Jan 27, 2010 at 11:43 AM, Stephen Blackheath [to
Haskell-Beginners] <[email protected]>
wrote:
> Joe,
>
> IMHO:
>
> Classes in OOP have several purposes, one of which is to manage the mutation
> of state so as to put a lid on the complexity that could result.  The inside
> of an OOP class is usually a C program, and the outside is (ideally) a
> semi-functional program with interfaces that are simple at the level of
> abstraction where they operate.  The single responsibility principle exists
> to stop the C programs getting big and messy, and to help the programmer to
> build neat layers of abstraction on top of each other by having more
> abstract classes constructed out of less abstract ones.
>
> Functional programming essentially takes the C part away and makes the whole
> program into a layering of abstractions, even at the lowest level.
>
> An FP function more-or-less maps to an OOP class, and the reason why it can
> be a much lighter-weight structure is because the need to manage mutation
> has been removed.  I think the same principle applies, though - an FP
> function should have only one responsibility.
>
> Perhaps in FP the need for this principle to be explicitly stated and
> carefully observed is not so great, though.  If an FP function does two
> things and can be split up, it's not such a big deal, because re-factoring
> is easy in an FP language.  By comparison in OOP, splitting a big messy
> class up is a lot of work with a great risk of breakage. This amplifies the
> importance of applying the single responsibility principle before you start
> writing the class.
>
>
> Steve
>
> Joe Van Dyk wrote:
>>
>> So I'm still pretty new to functional programming.
>>
>> In OOP, you have the concept of each class having a
>> single-responsibility (or reason for changing).  See
>> http://en.wikipedia.org/wiki/Single_responsibility_principle
>>
>> I'm having problems seeing how that concept maps to functional
>> programming.  Perhaps it doesn't?
>>
>



-- 
Joe Van Dyk
http://fixieconsulting.com


------------------------------

Message: 8
Date: Thu, 28 Jan 2010 00:27:42 +0100
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] single responsibility principle vs
        functional      programming
To: "Joe Van Dyk" <[email protected]>,   "Stephen Blackheath [to
        Haskell-Beginners]"
        <[email protected]>
Cc: beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
        delsp=yes


I have the experience that you better start from scratch when learning a  
new programming paradigm, do not try to write object oriented programs in  
Haskell. A great description of how to use the functional programming  
paradigm can be found in "Why Functional Programming Matters" [1]. Maybe  
also interesting is "The Monad.Reader/Issue3/Functional Programming vs  
Object Oriented Programming" [2].

[1] http://www.cs.chalmers.se/~rjmh/Papers/whyfp.html
[2]  
http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue3/Functional_Programming_vs_Object_Oriented_Programming

Regards,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--


On Wed, 27 Jan 2010 23:43:27 +0100, Joe Van Dyk <[email protected]>  
wrote:

> Thanks, I'm starting to get it.
>
> Perhaps what I need to do is take a small standard OOP system and try
> converting it to FP.
>
> Or perhaps there's already examples of such a thing I could look at?
>
> Joe
>
> On Wed, Jan 27, 2010 at 11:43 AM, Stephen Blackheath [to
> Haskell-Beginners] <[email protected]>
> wrote:
>> Joe,
>>
>> IMHO:
>>
>> Classes in OOP have several purposes, one of which is to manage the  
>> mutation
>> of state so as to put a lid on the complexity that could result.  The  
>> inside
>> of an OOP class is usually a C program, and the outside is (ideally) a
>> semi-functional program with interfaces that are simple at the level of
>> abstraction where they operate.  The single responsibility principle  
>> exists
>> to stop the C programs getting big and messy, and to help the  
>> programmer to
>> build neat layers of abstraction on top of each other by having more
>> abstract classes constructed out of less abstract ones.
>>
>> Functional programming essentially takes the C part away and makes the  
>> whole
>> program into a layering of abstractions, even at the lowest level.
>>
>> An FP function more-or-less maps to an OOP class, and the reason why it  
>> can
>> be a much lighter-weight structure is because the need to manage  
>> mutation
>> has been removed.  I think the same principle applies, though - an FP
>> function should have only one responsibility.
>>
>> Perhaps in FP the need for this principle to be explicitly stated and
>> carefully observed is not so great, though.  If an FP function does two
>> things and can be split up, it's not such a big deal, because  
>> re-factoring
>> is easy in an FP language.  By comparison in OOP, splitting a big messy
>> class up is a lot of work with a great risk of breakage. This amplifies  
>> the
>> importance of applying the single responsibility principle before you  
>> start
>> writing the class.
>>
>>
>> Steve
>>
>> Joe Van Dyk wrote:
>>>
>>> So I'm still pretty new to functional programming.
>>>
>>> In OOP, you have the concept of each class having a
>>> single-responsibility (or reason for changing).  See
>>> http://en.wikipedia.org/wiki/Single_responsibility_principle
>>>
>>> I'm having problems seeing how that concept maps to functional
>>> programming.  Perhaps it doesn't?
>>>
>>
>
>
>


-- 


------------------------------

Message: 9
Date: Wed, 27 Jan 2010 16:33:40 -0800
From: Sriram Durbha <[email protected]>
Subject: Re: [Haskell-beginners] single responsibility principle vs
        functional      programming
To: Henk-Jan van Tuyl <[email protected]>
Cc: beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

You might find this http://haskell.org/haskellwiki/OOP_vs_type_classes also
useful.
Cheers
Ram

On Wed, Jan 27, 2010 at 3:27 PM, Henk-Jan van Tuyl <[email protected]>wrote:

>
> I have the experience that you better start from scratch when learning a
> new programming paradigm, do not try to write object oriented programs in
> Haskell. A great description of how to use the functional programming
> paradigm can be found in "Why Functional Programming Matters" [1]. Maybe
> also interesting is "The Monad.Reader/Issue3/Functional Programming vs
> Object Oriented Programming" [2].
>
> [1] 
> http://www.cs.chalmers.se/~rjmh/Papers/whyfp.html<http://www.cs.chalmers.se/%7Erjmh/Papers/whyfp.html>
> [2]
> http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue3/Functional_Programming_vs_Object_Oriented_Programming
>
> Regards,
> Henk-Jan van Tuyl
>
>
> --
> http://Van.Tuyl.eu/
> http://members.chello.nl/hjgtuyl/tourdemonad.html
> --
>
>
>
> On Wed, 27 Jan 2010 23:43:27 +0100, Joe Van Dyk <[email protected]>
> wrote:
>
>  Thanks, I'm starting to get it.
>>
>> Perhaps what I need to do is take a small standard OOP system and try
>> converting it to FP.
>>
>> Or perhaps there's already examples of such a thing I could look at?
>>
>> Joe
>>
>> On Wed, Jan 27, 2010 at 11:43 AM, Stephen Blackheath [to
>> Haskell-Beginners] <[email protected]>
>> wrote:
>>
>>> Joe,
>>>
>>> IMHO:
>>>
>>> Classes in OOP have several purposes, one of which is to manage the
>>> mutation
>>> of state so as to put a lid on the complexity that could result.  The
>>> inside
>>> of an OOP class is usually a C program, and the outside is (ideally) a
>>> semi-functional program with interfaces that are simple at the level of
>>> abstraction where they operate.  The single responsibility principle
>>> exists
>>> to stop the C programs getting big and messy, and to help the programmer
>>> to
>>> build neat layers of abstraction on top of each other by having more
>>> abstract classes constructed out of less abstract ones.
>>>
>>> Functional programming essentially takes the C part away and makes the
>>> whole
>>> program into a layering of abstractions, even at the lowest level.
>>>
>>> An FP function more-or-less maps to an OOP class, and the reason why it
>>> can
>>> be a much lighter-weight structure is because the need to manage mutation
>>> has been removed.  I think the same principle applies, though - an FP
>>> function should have only one responsibility.
>>>
>>> Perhaps in FP the need for this principle to be explicitly stated and
>>> carefully observed is not so great, though.  If an FP function does two
>>> things and can be split up, it's not such a big deal, because
>>> re-factoring
>>> is easy in an FP language.  By comparison in OOP, splitting a big messy
>>> class up is a lot of work with a great risk of breakage. This amplifies
>>> the
>>> importance of applying the single responsibility principle before you
>>> start
>>> writing the class.
>>>
>>>
>>> Steve
>>>
>>> Joe Van Dyk wrote:
>>>
>>>>
>>>> So I'm still pretty new to functional programming.
>>>>
>>>> In OOP, you have the concept of each class having a
>>>> single-responsibility (or reason for changing).  See
>>>> http://en.wikipedia.org/wiki/Single_responsibility_principle
>>>>
>>>> I'm having problems seeing how that concept maps to functional
>>>> programming.  Perhaps it doesn't?
>>>>
>>>>
>>>
>>
>>
>>
>
> --
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100127/6045fd76/attachment.html

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 19, Issue 27
*****************************************

Reply via email to