I agree that the style-guide import should go separate from its development
or modifications.

I believe that the reason why Santi thought there is a mistake in the
Point-free section is that the example isn't actually point-free, because
all the variants reference all the variables explictly. So I'd suggest to
improve it for example like this:

Prefer the so-called [point-free](
http://www.haskell.org/haskellwiki/Pointfree) style when declaring
functions, if applicable:

-- bad
let a x = f (g (h x))
-- good
let a = f . g . h

Also use function composition in a similar manner to avoid extra
parentheses:

-- ... the original example ...



On Wed, Jan 8, 2014 at 4:04 PM, Klaus Aehlig <[email protected]> wrote:

> On Wed, Jan 08, 2014 at 03:48:43PM +0100, Santi Raffa wrote:
> > Here's an interdiff for an error in the original document I didn't
> > catch until now.
> >
> > diff --git a/doc/dev-codestyle.rst b/doc/dev-codestyle.rst
> > index 4a87a27..5c9f8b6 100644
> > --- a/doc/dev-codestyle.rst
> > +++ b/doc/dev-codestyle.rst
> > @@ -469,11 +469,11 @@ Parentheses, point free style
> >  Prefer the so-called point-free style to extra parentheses::
> >
> >    -- bad
> > -  let a = f ( g ( h x) )
> > +  let a x = f ( g ( h x) )
> >    -- better
> > -  let b = f $ g $ h x
> > +  let b x = f $ g $ h x
> >    -- best
> > -  let c = f . g . h $ x
> > +  let c = f . g . h
>
> NACK
>
> The example made sense, and demonstrated how to write down
> the expression
>
>   f ( g ( h x ) )
>
> assuming f, g, h, and x are variables available in the context.
>
> Personally, I'm not sure wheter
>
>   f . g . h $ x
>
> or
>
>  f . g $ h x
>
> is preferable, but that's a different question. In either case,
> the import of the style guide should be separate from any
> disussions on how to develop the style further.
>
> Klaus
>
> --
> Klaus Aehlig
> Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores
>

Reply via email to