[Haskell-beginners] general observation about programming
jeffbrown.the at gmail.com
Fri Feb 26 19:52:39 UTC 2016
If you want to know how to pronounce an infix, GHCI and Hackage can very
often solve the problem for you. For instance:
> :i <$>
(<$>) :: Functor f => (a -> b) -> f a -> f b
-- Defined in ‘Data.Functor’
infixl 4 <$>
If you then lookup Data.Functor on Hackage, you'll find in the description
of <$> "An infix synonym for fmap." Even if there's no comment provided,
you can from there view source; often you'll find a one-word definition
like "(>>=) = bind".
On Fri, Feb 26, 2016 at 1:55 AM, Mike Pentney <mike.pentney at physics.org>
> As a newbie, something I dislike about Haskell is the use of infix
> operators like <||> which are unpronouncable and therefore (if you don't
> happen to know the notation the symbol is based on) are more or less
> And Haskellers often seem to prefer 1 and 2 character variable names,
> which again convey little or no information.
> And don't get me started on point-free code...!
> N.B. I am not trying to start a flame war, these are just comments from my
> experience of trying to get beyond text-book examples and start using
> Haskell libraries and trying to learn from open source code. In general I
> find idiomatic Haskell hard to understand, and for me this is a barrier to
> using Haskell for real projects. Maybe someday I'll have learnt enough to
> get past this problem, but as the language and libraries seem to evolve
> quickly, I have my doubts...
> On 25/02/16 19:19, Jeffrey Brown wrote:
>> Something I like about functional programming is how it interfaces with
>> natural language.
>> Haskell, somehow to a greater extent than other languages, encourages me
>> to divide functions
>> into one or two-liners. Each has a type signature that means something in
>> English. Further, each
>> gives you the opportunity to choose a good name for the function and its
>> arguments. After doing
>> those things, the function is much easier to write, and much easier to
>> read -- so much so that
>> often you don't have to read the function body at all, just the type
>> signature, function name
>> and argument names.
>> On Thu, Feb 25, 2016 at 8:17 AM, Dudley Brooks <
>> dbrooks at runforyourlife.org
>> <mailto:dbrooks at runforyourlife.org>> wrote:
>> Ages and ages ago I saw this advice about programming:
>> Q: "What's the best language for a programmer to know?"
>> A: "English" (or whatever your native language is)
>> -- Dudley
>> On 2/24/16 4:03 PM, Dennis Raddle wrote:
>> This is more about programming in general than Haskell, although
>>> Haskellers probably know
>>> it well.
>>> I don't claim to have expert knowledge on this, but I'm gradually
>>> getting better at it.
>>> When I set out to write a program, or refactor a program, or modify
>>> a program, it helps to
>>> set out my thinking in a clear way. And how I make it clear is to
>>> document my thoughts.
>>> An outline is one good way to organize thoughts and is probably my
>>> main tool. But good
>>> English prose is also helpful.
>>> The key factor is "editing." In what sense do I mean that? Good
>>> writers do it, and the
>>> Haskell documentation does it. I mean (1) brevity and (2) good flow.
>>> To achieve brevity,
>>> you must think about the essence of each statement and trim away the
>>> unnecessary stuff.
>>> Good flow refers to how the document builds up and modifies your
>>> concepts as you read it.
>>> A document can actually mirror an effective learning process, or
>>> influence and change your
>>> I work with my documentation, making several editing passes. By the
>>> time I'm done, I am in
>>> a great position to write a concise and flexible program.
>>> It's interesting that not only is Haskell a concise language, but
>>> the Haskell library
>>> documentation is concise. Contrast that with the Python
>>> documentation which often wanders
>>> about into areas that are irrelevant--it could easily be cut into
>>> one third its present size.
>>> Beginners mailing list
>>> Beginners at haskell.org <mailto:Beginners at haskell.org>
>> Beginners mailing list
>> Beginners at haskell.org <mailto:Beginners at haskell.org>
>> Jeffrey Benjamin Brown
>> Beginners mailing list
>> Beginners at haskell.org
> Beginners mailing list
> Beginners at haskell.org
Jeffrey Benjamin Brown
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners