Duncan Coutts | 1 Mar 2009 19:24
Picon
Picon
Favicon

ANNOUNCE: tar 0.3.0.0

All,

I'm pleased to announce a major new release of the tar package for
handling ".tar" archive files.

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/tar

This release has a completely new and much improved API. See the hackage
page for the API documentation.

There are high level "all in one" functions for extracting or
creating .tar files. More interestingly, it is easy to make variants by
composing a pipeline.

For example extracting a ".tar.gz" file is just:

> Tar.unpack dir . Tar.read . GZip.decompress =<< BS.readFile tar

Or creating a ".tar.bz2" file:

> BS.writeFile tar . BZip.compress . Tar.write =<< Tar.pack base dir

In addition it provides a full api for inspecting and constructing tar
files without having to pack or unpack to local files. The functions are
lazy which allows large archives to be processed in constant space.

It is based on the tar handling code that has been in use in the
cabal-install program for the last year or so. It has been tested on a
large number of real world .tar.gz files so compatibility should be
pretty good.
(Continue reading)

ChrisK | 1 Mar 2009 23:36

major speed improvement: regex-tdfa reaches 1.0.0

Announcing the version 1.0.0 release of regex-tdfa.

I am proud of this release.
This is not just a bug fix release.
It is a serious improvement in the asymptotic running time.

The previous versions allowed bad combinations of pattern and searched
text length to scale badly in the length of the text.  Previously the
worst case for text of length N was O(N^3).

The new worst case asymptotic runtime scaled as O(N).
There is never any backtracking.
And the worst case storage space is independent of N.

The package is on hackage at
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regex-tdfa
The darcs repository is at
http://darcs.haskell.org/packages/regex-unstable/regex-tdfa/

All non-overlapping matches are found and returned, along with all
captured (parenthesized) subexpressions.  The result is precisely what
Posix extended regular expressions are supposed to return.

To be concrete, consider example text with length of N of (2^n)+2:

 > longInput = replicate (2^n) 'a' ++ "bc"

And define 4 worst-case-scenario patterns.  I wrote the code and I
know how to kill it:

(Continue reading)

Henning Thielemann | 2 Mar 2009 00:21
Picon

Re: Foldable and Traversable vs. FunctorM


On Fri, 27 Feb 2009, Isaac Dupree wrote:

> Henning Thielemann wrote:
>> ? However 'foldMap' cannot utilize the additional information, namely
>> Position and (Maybe e), respectively. In the first case this is sad, in
>> the second case I consider this bad, since it is too easy to throw away
>> and thus ignore the exception (Maybe e). Some kind of fold is always
>> useful on these structures, but 'foldMap' is too limited.
>
> I'm not sure what you mean, but if you define Traversable in a sensible way,
> then you can define Foldable with Data.Traversable.foldMapDefault and get a
> sensible definition.

This reminds me on using Data.Traversable.foldMapDefault for the 
definition of foldMap. So thanks for that hint! However, what I like to 
complain about is, that this foldMap is pretty useless, at least for me. 
Are there data structures beyond very simple ones (that is, list, tree, 
graphs of elements without additional information) where you can make any 
use of it?
Thomas DuBuisson | 2 Mar 2009 10:53
Picon
Gravatar

Ticket #3058: Add 'hex' to the pretty package (and other thoughts)

All,

http://hackage.haskell.org/trac/ghc/ticket/3058

Attached is a patch for Text.PrettyPrint.HughesPJ that adds a 'hex'
function to print hexidecimal numbers.

The only point that I exepect to be contended is it varies slightly from
the surrounding functions in that it allows one to control the number of
characters printed:

> hex 5 31
0001f
> hex 2 8
08
> hex 3 7495
d47

While we can argue about the consistancy issues, I almost always want to
control the number of digits when dealing with hex.  Hence I feel this
is a reasonable special case.

Secondary Issues:
1) Is there a repo for pretty?  I didn't see one on code.haskell.org
2) If I submit a ticket+patch to move Text.PrettyPrint.HughesPJClass
(from prettyclass, Augustsson) into Text.PrettyPrint (of the 'pretty'
package) would anyone object?  It feels mis-placed / I feel things need
consolidated.

Thomas
(Continue reading)

Duncan Coutts | 2 Mar 2009 13:55
Picon
Picon
Favicon

Re: Ticket #3058: Add 'hex' to the pretty package (and other thoughts)

On Mon, 2009-03-02 at 01:53 -0800, Thomas DuBuisson wrote:
> All,
> 
> http://hackage.haskell.org/trac/ghc/ticket/3058
> 
> Attached is a patch for Text.PrettyPrint.HughesPJ that adds a 'hex'
> function to print hexidecimal numbers.

> The only point that I exepect to be contended is it varies slightly from
> the surrounding functions in that it allows one to control the number of
> characters printed:

There are a number of other functions from the Numeric module we should
also consider. These are all the ones that return ShowS, the equivalent
of the Doc type.

showEFloat :: (RealFloat a) => Maybe Int -> a -> ShowS
showFFloat :: (RealFloat a) => Maybe Int -> a -> ShowS
showGFloat :: (RealFloat a) => Maybe Int -> a -> ShowS
showHex :: (Integral a) => a -> ShowS
showInt :: (Integral a) => a -> ShowS
showIntAtBase :: (Integral a) => a -> (Int -> Char) -> a -> ShowS
showOct :: (Integral a) => a -> ShowS
showFloat :: (RealFloat a) => a -> ShowS
showSigned :: (Real a) => (a -> ShowS) -> Int -> a -> ShowS

> While we can argue about the consistancy issues, I almost always want to
> control the number of digits when dealing with hex.  Hence I feel this
> is a reasonable special case.

(Continue reading)

John Goerzen | 2 Mar 2009 15:20
Favicon

Re: [Haskell-cafe] ANNOUNCE: tar 0.3.0.0

Duncan Coutts wrote:
> All,
> 
> I'm pleased to announce a major new release of the tar package for
> handling ".tar" archive files.

Very nice!

I'm curious -- what specific variants of the tar format can it read and
write?

 * PAX?
 * GNU tar sparse files?
 * POSIX ustar
 * various pre-posix archives?
 * Solaris tar?
 * Binary and text numbers in numeric fields?

-- John
> 
Isaac Dupree | 2 Mar 2009 15:39

Re: Ticket #3058: Add 'hex' to the pretty package (and other thoughts)

Thomas DuBuisson wrote:
> The only point that I exepect to be contended is it varies slightly from
> the surrounding functions in that it allows one to control the number of
> characters printed:
> > hex 5 31
>
> 0001f
>
> > hex 2 8
>
> 08
>
> > hex 3 7495
>
> d47

what about when it doesn't fit in the given number of characters? Show us the 
answer to:

hex 1 31

-Isaac
Duncan Coutts | 2 Mar 2009 17:15
Picon
Picon
Favicon

Re: ANNOUNCE: tar 0.3.0.0

On Mon, 2009-03-02 at 08:20 -0600, John Goerzen wrote:
> Duncan Coutts wrote:
> > All,
> > 
> > I'm pleased to announce a major new release of the tar package for
> > handling ".tar" archive files.
> 
> Very nice!
> 
> I'm curious -- what specific variants of the tar format can it read and
> write?

It can read and write basic Unix V7 format, POSIX ustar and gnu formats.

>  * PAX?

PAX is a compatible extension of Posix ustar. It just standardises some
extra tar entry types ('x' and 'g'). These archives can be read and
written but there is no special support for them. You would match on
entryContents = OtherEntryType 'x' paxHeader _ -> and then parse the
paxHeader which is a utf-8 file containing name/value pairs.

>  * GNU tar sparse files?

No support. They'll get matched as OtherEntryType 'S'. However unlike
PAX, GNU sparse format puts the sparse info directly in the tar header
and that is not parsed and the lib does not provide direct access to the
data for you to be able to do it yourself.

>  * POSIX ustar
(Continue reading)

Thomas DuBuisson | 2 Mar 2009 20:18
Picon
Gravatar

Re: Ticket #3058: Add 'hex' to the pretty package (and other thoughts)

> what about when it doesn't fit in the given number of characters? Show us the
> answer to:
> hex 1 31

That was my third example.  As you can see from the source it will
show the least significant bits in this case.

> hex 1 31
f

Thomas
Thomas DuBuisson | 3 Mar 2009 02:16
Picon
Gravatar

Re: Ticket #3058: Add 'hex' to the pretty package (and other thoughts)

On Mon, 2009-03-02 at 12:55 +0000, Duncan Coutts wrote:
> On Mon, 2009-03-02 at 01:53 -0800, Thomas DuBuisson wrote:
> > All,
> > 
> > http://hackage.haskell.org/trac/ghc/ticket/3058
> There are a number of other functions from the Numeric module we should
> also consider. These are all the ones that return ShowS, the equivalent
> of the Doc type.

I've added another patch to that ticket for consideration.  It has hex,
oct, intAtBase  (plus padded variants).  Also included are {e,f,g}float
without any padding options.

Padding floats could be touchy - perhaps it should be a separate patch
by someone who would use such a feature and know what they want.

Thoughts?

Thomas

Gmane