Entries type: Re: tar-package was: Re: modules of cabal-install

Remi Turk rturk at science.uva.nl
Tue Feb 24 20:29:06 EST 2009


On Tue, Feb 24, 2009 at 01:19:49PM +0000, Duncan Coutts wrote:
> On Tue, 2009-02-24 at 13:57 +0100, Christian Maeder wrote:
> > Duncan Coutts wrote:
> > >> Manipulating Entries is also not a typical user task. (Maybe the type
> > >> Entries should just be "[Either String Entry]", but the given type is
> > >> fine, as it only allows a final failure string)
> > > 
> > > Yeah I think only one failure is good.
> > 
> >  data Entries = Entries [Entry] (Maybe String)
> > or
> >  directly using "([Entry], Maybe String)"
> 
> Sadly that does not account for streaming. We may not discover the error
> until we've processed 100 megabytes of tar file. So we cannot give top
> level access to an error that might happen at the end.

Something that does account for streaming is MList (Either String) Entry,
where MList is from "ListT done right". [1]
This would have the advantage of being able to use all the
standard Monad/MList machinery. It would also have the
disadvantage that MList isn't in any standard library, and adds
some extra constructor (un)packing.

Cheers, Remi

[1] http://www.haskell.org/haskellwiki/ListT_done_right


More information about the Libraries mailing list