Re: [Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-08 Thread Stephen Tetley
Hi Myles

It seems odd to mix parsing (consuming input) with mutation.

What problem are you trying to solve and are you sure you can't get
better phase separation than this paragraph suggests?


 My first idea was to simply parse all the deltas, and later apply them
 to the input list. However, I can't do that because the value of the
 deltas depend on the value they're modifying.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Too much inlining on text package

2012-04-08 Thread Michael Snoyman
On Apr 8, 2012 8:47 AM, Bryan Oapos;Sullivan b...@serpentine.com wrote:

 On Sun, Mar 18, 2012 at 12:02 AM, Michael Snoyman mich...@snoyman.com
wrote:


 OK, issue created: https://github.com/bos/text/issues/19


 I fixed the too-much-inlining bug tonight. As a bonus, Text literals are
now decoded straight from GHC's packed encoding, without an intermediate
step through String.

 Generated code now looks like this at -O and above:

 $ ghc -O -ddump-simpl -c CS.hs
 CS.foo :: Data.Text.Internal.Text
 [GblId, ...]
 CS.foo = Data.Text.unpackCString# x\NULy

This looks great Bryan, thank you!

Michael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Too much inlining on text package

2012-04-08 Thread Felipe Almeida Lessa
On Sun, Apr 8, 2012 at 2:47 AM, Bryan O'Sullivan b...@serpentine.com wrote:
 I fixed the too-much-inlining bug tonight. As a bonus, Text literals are now
 decoded straight from GHC's packed encoding, without an intermediate step
 through String.

 Generated code now looks like this at -O and above:

 $ ghc -O -ddump-simpl -c CS.hs
 CS.foo :: Data.Text.Internal.Text
 [GblId, ...]
 CS.foo = Data.Text.unpackCString# x\NULy

Very nice!  =)

Cheers,

-- 
Felipe.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-08 Thread Myles C. Maxfield
It's a JPEG parser.

Progressive JPEG is set up where there's a vector Word8s, and some of
the entries in the vector may be 0. The JPEG has a stream of bits, and
the decoder is supposed to shift in one bit to each successive element
in the vector, skipping over 0s, and stop when it reaches some
specified number of 0s.

So if your partially decoded vector is
2, 8, 0, 12, 0, 10, 6, 0, 2, 10
and the jpeg has this bit stream
1, 1, 0, 1, 0, 0, 1, 0, ...
and the jpeg says shift in until the 3rd zero is found
that would result in the partially decoded vector being
3, 9, 0, 12, 0, 11, 6, 0, 2, 10
with the leftover part of the stream being
0, 1, 0, ...

The JPEG parser has to keep track of where it is in the partially
decoded vector to know how many bits to shift in, and where they
belong, so the next iteration is aligned to the right place. It would
be possible to keep track of this stuff throughout the parsing, and
have the result of the parse be a second delta framebuffer and apply
it to the original after each scan is parsed, but that's fairly ugly
and I'd like to avoid doing that.

If that's what I have to do, though, I guess I have to do it. Isn't
there a better way?

--Myles

On Sat, Apr 7, 2012 at 11:56 PM, Stephen Tetley
stephen.tet...@gmail.com wrote:
 Hi Myles

 It seems odd to mix parsing (consuming input) with mutation.

 What problem are you trying to solve and are you sure you can't get
 better phase separation than this paragraph suggests?


 My first idea was to simply parse all the deltas, and later apply them
 to the input list. However, I can't do that because the value of the
 deltas depend on the value they're modifying.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-08 Thread Stephen Tetley
On 8 April 2012 19:17, Myles C. Maxfield myles.maxfi...@gmail.com wrote:
 It's a JPEG parser.


Ahem, I'm a bit of of my depth then, but one thing you should consider
is that writing your own parser monad is trivial, especially for well
defined binary formats. Well defined binary formats should be
deterministic and don't need backtracking, hence you won't need to
worry about defining Alternative / MonadPlus instances which is where
the complication lies.

As you should be able to live without backtracking for JPEG it
shouldn't be hard to make the parser efficient if you stick closely to
the API of the Vector or Array library you are using - e.g. you might
want to move a cursor forward through the Array rather than
unconsing [*] at the head which would create work for the garbage
collector. This should still be amenable to streaming - you just work
at a larger chunk size.


Presumably you've seen Jeroen Fokker's paper on JPEG decoding with
Gofer? (Gofer is ~= Haskell).

[*] Parsec etc. work by unconsing the head of the input stream.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] building ghc on arch linux ARM?

2012-04-08 Thread .
Hi Cafe,
I hope this is the right place to ask this kind of stuff.
I would like to try ghc on a panda board (armv7l) with arch linux.
There is apparently no pre-built package, so I was trying the
instructions to build, from here:
http://hackage.haskell.org/trac/ghc/wiki/Building/Porting.

However, I still seem to need a ghc and ghc-pkg installed: I am getting
this error message:

checking for tar... /bin/tar
checking for gpatch... no
checking for patch... /usr/bin/patch
checking for dtrace... no
checking for HsColour... no
checking for xmllint... no
configure: WARNING: cannot find xmllint in your PATH, you will not be
able to validate your documentation
checking for xsltproc... no
configure: WARNING: cannot find xsltproc in your PATH, you will not be
able to build the HTML documentation
checking for dblatex... no
configure: WARNING: cannot find dblatex in your PATH, you will not be
able to build the PDF and PS documentation
checking for ghc-pkg matching ... configure: error: Cannot find matching
ghc-pkg

-

Does anyone know if it is possible to build ghc without ghc on this
platform?
I was using the tarball sources for ghc 7.4.1.


Thanks,
Christian



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-08 Thread Francesco Mazzoli
No, it is not possible to build GHC without GHC. Building GHC on ARM is 
going to be extremely tricky (I'm not sure anyone has ever done it).


What you should be able to do easily with the next release is 
cross-compile to ARM through the LLVM backend.


Francesco.

On 08/04/12 23:28, . wrote:

Hi Cafe,
I hope this is the right place to ask this kind of stuff.
I would like to try ghc on a panda board (armv7l) with arch linux.
There is apparently no pre-built package, so I was trying the
instructions to build, from here:
http://hackage.haskell.org/trac/ghc/wiki/Building/Porting.

However, I still seem to need a ghc and ghc-pkg installed: I am getting
this error message:

checking for tar... /bin/tar
checking for gpatch... no
checking for patch... /usr/bin/patch
checking for dtrace... no
checking for HsColour... no
checking for xmllint... no
configure: WARNING: cannot find xmllint in your PATH, you will not be
able to validate your documentation
checking for xsltproc... no
configure: WARNING: cannot find xsltproc in your PATH, you will not be
able to build the HTML documentation
checking for dblatex... no
configure: WARNING: cannot find dblatex in your PATH, you will not be
able to build the PDF and PS documentation
checking for ghc-pkg matching ... configure: error: Cannot find matching
ghc-pkg

-

Does anyone know if it is possible to build ghc without ghc on this
platform?
I was using the tarball sources for ghc 7.4.1.


Thanks,
Christian



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-08 Thread Thomas DuBuisson
On Sun, Apr 8, 2012 at 4:03 PM, Francesco Mazzoli f...@mazzo.li wrote:
 No, it is not possible to build GHC without GHC. Building GHC on ARM is
 going to be extremely tricky (I'm not sure anyone has ever done it).

I used to use an unregistered build of GHC built by someone in the
Debian community - it worked well enough.

Cheers,
Thomas


 What you should be able to do easily with the next release is cross-compile
 to ARM through the LLVM backend.

 Francesco.


 On 08/04/12 23:28, . wrote:

 Hi Cafe,
 I hope this is the right place to ask this kind of stuff.
 I would like to try ghc on a panda board (armv7l) with arch linux.
 There is apparently no pre-built package, so I was trying the
 instructions to build, from here:
 http://hackage.haskell.org/trac/ghc/wiki/Building/Porting.

 However, I still seem to need a ghc and ghc-pkg installed: I am getting
 this error message:
 
 checking for tar... /bin/tar
 checking for gpatch... no
 checking for patch... /usr/bin/patch
 checking for dtrace... no
 checking for HsColour... no
 checking for xmllint... no
 configure: WARNING: cannot find xmllint in your PATH, you will not be
 able to validate your documentation
 checking for xsltproc... no
 configure: WARNING: cannot find xsltproc in your PATH, you will not be
 able to build the HTML documentation
 checking for dblatex... no
 configure: WARNING: cannot find dblatex in your PATH, you will not be
 able to build the PDF and PS documentation
 checking for ghc-pkg matching ... configure: error: Cannot find matching
 ghc-pkg

 -

 Does anyone know if it is possible to build ghc without ghc on this
 platform?
 I was using the tarball sources for ghc 7.4.1.


 Thanks,
 Christian



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-08 Thread Joey Hess
Thomas DuBuisson wrote:
 On Sun, Apr 8, 2012 at 4:03 PM, Francesco Mazzoli f...@mazzo.li wrote:
  No, it is not possible to build GHC without GHC. Building GHC on ARM is
  going to be extremely tricky (I'm not sure anyone has ever done it).
 
 I used to use an unregistered build of GHC built by someone in the
 Debian community - it worked well enough.

It ships with Debian, along with the full Haskell Platform built for ARM
and lots of other libraries. Other than speed, it's fine.

-- 
see shy jo


signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Category Theory Questions

2012-04-08 Thread Sergiu Ivanov
Hello,

I have a question not that directly related to Haskell, but I still
think this is a good place to ask it.

I am currently studying category theory by the book Joy of Cats.  Are
there any people whom I could ask some questions related to category
theory from time to time?  Or could I just post my questions here
directly?

The reason I'm asking is that I seen very nice discussions related to
category theory on this list.

I hope to be able to deal with most of the stuff myself, but having
someone to discuss the matters with is always nice :-)

Sergiu

[0] katmat.math.uni-bremen.de/acc/acc.pdf

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Category Theory Questions

2012-04-08 Thread dilawar rajput
I am not sure if this is a good forum to ask Category theory related
questions as such. Some better options may be math.stackexchange.com or
mathoverflow.net. Many category theory ideas are implemented in Haskell. So
some discussion may have happened over here but surely its not a forum on
category theory (IMHO) . Just a thought.

--
Dilawar Singh




On Mon, Apr 9, 2012 at 10:07 AM, Sergiu Ivanov
unlimitedscol...@gmail.comwrote:

 Hello,

 I have a question not that directly related to Haskell, but I still
 think this is a good place to ask it.

 I am currently studying category theory by the book Joy of Cats.  Are
 there any people whom I could ask some questions related to category
 theory from time to time?  Or could I just post my questions here
 directly?

 The reason I'm asking is that I seen very nice discussions related to
 category theory on this list.

 I hope to be able to deal with most of the stuff myself, but having
 someone to discuss the matters with is always nice :-)

 Sergiu

 [0] katmat.math.uni-bremen.de/acc/acc.pdf

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Category Theory Questions

2012-04-08 Thread Daniel Peebles
I doubt anyone will mind too much, but you probably want to stick to the
category theory that is obviously applicable to Haskell (and ideally
talk/ask about how it applies). Questions about initial algebras and
Lambek's lemma will probably get decent responses, whereas globe categories
and anafunctors, for example, might not.

If it's just straight-up category theory for its own sake, you might have
better luck on math-specific forums (stack exchange, for example), though.

Dan

On Mon, Apr 9, 2012 at 12:37 AM, Sergiu Ivanov
unlimitedscol...@gmail.comwrote:

 Hello,

 I have a question not that directly related to Haskell, but I still
 think this is a good place to ask it.

 I am currently studying category theory by the book Joy of Cats.  Are
 there any people whom I could ask some questions related to category
 theory from time to time?  Or could I just post my questions here
 directly?

 The reason I'm asking is that I seen very nice discussions related to
 category theory on this list.

 I hope to be able to deal with most of the stuff myself, but having
 someone to discuss the matters with is always nice :-)

 Sergiu

 [0] katmat.math.uni-bremen.de/acc/acc.pdf

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe