[Haskell-cafe] Seeking advice on a style question

Greg Buchholz haskell at sleepingsquirrel.org
Fri Dec 29 14:30:49 EST 2006


Conal Elliott wrote:
> Warning: I haven't tried to type-check and may have made a clerical error.
> Since questionCategories isn't used, use "fst" & eliminate another let.
> Then, for my personal preference, and just to mix things up, switch to
> "where" style:
> 
> process item mediaKind mediaSize language =
>  flip combineRows sequenceLayouts $
>  paginate item mediaKind mediaSize pagemaster $
>  groupBands $
>  resolveCrossReferences $
>  bands
> where
>   (bands,sequenceLayouts) =
>     buildLayout mediaKind language $
>     coalesceNAQuestions $
>     fst $
>     numberQuestions pagemaster $
>     stripUndisplayedQuestions mediaKind $
>     appendEndQuestions item
>       (loadPagemaster item mediaKind mediaSize) $
>     coalesceParentedQuestions $
>     validateQuestionContent $
>     loadQuestions item
>

   And just for the heck of it, trading parenthesis and layout for dollar
signs...


process item mediaKind mediaSize language =
 combineRows 
    (paginate 
       item 
       mediaKind 
       mediaSize 
       pagemaster 
       (groupBands (resolveCrossReferences bands)))
    sequenceLayouts 
where
 (bands,sequenceLayouts) =
   buildLayout 
     mediaKind 
     language 
     (coalesceNAQuestions 
       (fst (numberQuestions 
               pagemaster
               (stripUndisplayedQuestions 
                  mediaKind 
                  (appendEndQuestions 
                     item
                     (loadPagemaster item mediaKind mediaSize) 
                     (coalesceParentedQuestions 
                        (validateQuestionContent (loadQuestions item))))))))



More information about the Haskell-Cafe mailing list