[Haskell-cafe] Records (was Re: [Haskell] Improvements to GHC)

Bulat Ziganshin bulatz at HotPOP.com
Fri Nov 18 05:57:48 EST 2005


Hello Sebastian,

Thursday, November 17, 2005, 11:02:09 PM, you wrote:

SS> IMO it really only works well for simple "chains" like "foo . bar .
SS> oof . rab" but as soon as you start working with functions that take
SS> more parameters it starts looking very unreadable and you'd be better
SS> off to just use $ or write out paranthesis and apply arguments
SS> explicitly, or better yet, introduce some temporary descriptive
SS> variables in a let or where clause.

"are you don't like cats? you just don't know how to cook them right!" :)

-- |Returns length of initial segment of list, conforming to combined condition
-- F.e. "groupLen (fiSize) (+) (<16*mb) files" returns length of
-- initial segment of list, containing files with TOTAL size not exceeding 16 mb
groupLen mapper combinator tester  =  length . takeWhile tester . scanl1 combinator . map mapper

-- |Sort list by function result (use Schwarznegian transform)
sortOn  f  =  map snd . sortOn' fst . map (keyval f)
-- |Sort list by function result (don't use Schwarznegian transform!)
sortOn' f  =  sortBy (map2cmp f)

-- This defines filters for files, included in various operations on archives
  let arc_filter  =  andf [not.excluded_f cmd, not.overwrite_f cmd]
  let arc_filter  =  andf [included_f cmd, not.excluded_f cmd]
  let arc_filter  =  not.andf [included_f cmd, not.excluded_f cmd]
  let arc_filter  =  andf [included_f cmd, not.excluded_f cmd, not.overwrite_f cmd]
  let arc_filter  =  andf [included_f cmd, not.excluded_f cmd]


-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-Cafe mailing list