[Haskell-beginners] A first try

Heinrich Apfelmus apfelmus at quantentunnel.de
Tue Jun 28 14:35:23 CEST 2011


Mike Meyer wrote:
> Yitzchak Gale wrote:
>> Heinrich Apfelmus wrote:
>>>
>>> Here one possibility for a lazier version of  withFile' :
> 
> Very nice. I hope you don't mind if I use it?

Sure, go ahead. (I hereby put it into the public domain.)

>> Whether you are using lazy IO or Iteratees, we really need
>> some better higher-level combinators with simpler semantics
>> for more of the common use cases. Then it won't really matter.
> 
> And that was my conclusion last night. Iteratees provide generalized
> tools that don't seem to have obvious ways to do common
> operations. While that kind of thing is needed, I suspect that over
> 90% of file processing (at least for command line arguments) could be
> handled by things like Heinrich's withFiles and the obvious variants
> of the HOF list functions, like:
> 
>     fileMap :: (String -> a) -> [FilePath] -> [a]
>     fileFoldl' :: (a -> String -> a) -> a -> [FilePath] -> a
> 
> The user doesn't care whether it's using lazy IO or iteratees, so
> long as it has the proper semantics.

Indeed. It might be worthwhile to make a package on Haskell that 
provides these functions, or even to put them into the base libraries.


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com




More information about the Beginners mailing list