I understood your code and I agree it's elegant.
Well, speaking of rigour, I don't think applicative functors, etc are actually the right approach. Using the list monad gives a much clearer idea of what's going on, plus it's massively generalisable.See http://jpembeddedsolutions.wordpress.com/2011/07/24/combining-haskell-lists-with-monads/ for a description.On 24 Jul 2011, at 01:13, aditya siram wrote:Ertugul,
I admire your passion for rigor and discipline. It is not natural for
me but I am slowly coming to the same place.
I also feel that Haskell development is like learning to play music.
I've seen many a student (myself included) turn away from an
instrument because of an over-emphasis on scales, arpeggios etc. and
less on playing what sounds good. It is true that eventually to play
seriously some understanding of that theory is required but the
musician will come to that conclusion on their own.
They will hear a pattern over and over and wonder if it has a name -
then you show them the major scale and it will all make sense because
it will be a solution to a problem, not a solution waiting for a
problem.
In some ways I feel that the Haskell community because of their
expertise and enthusiasm gives users answers to questions they haven't
asked yet. When they do (inevitably) ask your awesome monad tutorial
(which helped me a great deal) will be there.
-deech
On Sat, Jul 23, 2011 at 6:39 PM, Ertugrul Soeylemez <es@ertes.de> wrote:
David Place <d@vidplace.com> wrote:Point taken, but to get serious with Haskell you will want to learnapplicative functors and at least the function arrow anyway.
Interesting thoughts, Ertugrul. I would argue that you can get very
serious with Haskell without understanding applicative functors andthe function arrow. The very basic aspects of the language (the type
system, higher-order functions, lazy evaluation, etc…) are already sopowerful, that you really don't need to add complexity to simpleprograms by including some of the more obscure extensions. I couldsee if it made the code substantially more compact. In this case, itmakes the code more verbose as you need to import the two modules to
do something which can be so trivially expressed as an abstraction.Haskell application development is more than just the language. Thelanguage itself is very powerful, yes, but serious applications I writeusually have quite a few dependencies. If you want to reinvent thewheel for everything, then yes, I'm exaggerating. Personally I don'twant to, because there are great libraries and design patterns outthere, for which you simply need to understand more than just thelanguage.
It's as simple as this: To get serious with Haskell, you need tounderstand Haskell monads. Understanding them implies understanding
applicative functors (not necessarily the applicative style). For manyof the useful libraries you will want to go further and understand monad
transformers and more.I'm not talking about any ideals here. I'm talking about real world
application development, which is what I am doing.When you write a program, do you think of it as a document only forthe compiler to understand, or might some other people need tounderstand it someday?"It"? For me type signatures are specification for the compiler and
documentation for humans, along with Haddock-style comments. My code isusually very well documented. In most cases Haddock shows me a coverage
of 100% for all of my source files, and every top-level and'where'-definition has a type signature. I'm very rigorous here.All of the power I get from Haskell itself, the base library and themany libraries I use I view as tools to get stuff done quickly, safely
and elegantly. As said, there is always a simpler way to write stuff,but I have a certain style, which I follow consistently, and in thatstyle I write 'second pure'. That's it.Why not '(:[])'? Simply because I hate it and find it confusing. Why
not 'return'? Because I write my code reasonably general. Not thatusing 'return' would change the type signature in question, but it is
just my style. In a do-block I use 'return'. Everywhere else I use'pure'. Consistently. Why 'second'? Because it's convenient.
Greets,Ertugrul--nightmare = unsafePerformIO (getWrongWife >>= sex)http://ertes.de/
_______________________________________________Beginners mailing listBeginners@haskell.orghttp://www.haskell.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners