Re: [Haskell-cafe] Haskell syntax highlighting in a public blog

2011-08-09 Thread Bas van Gijzel
Another alternative is to use the HsColour package:
http://code.haskell.org/~malcolm/hscolour/ and choose html as output. (This
works for me on blogspot.com)

On 9 August 2011 05:16, Daniel Patterson lists.hask...@dbp.mm.st wrote:


 On Aug 8, 2011, at 10:26 PM, Ivan Lazar Miljenovic wrote:

 On 9 August 2011 12:04, Arlen Cuss cel...@sairyx.org wrote:

 9/08/2011 11:54 AM, Oscar Picasso kirjutas:

 Hi,


 Is there a public blog that that allow syntax highlighting of Haskell code?


 Are you talking about a plugin for a blog engine? CodeColourer on

 WordPress will do it.


 I think he meant more along the lines of wordpress.com, which as far
 as I know _doesn't_ support highlighting Haskell.


 I haven't done this personally, but here is a javascript based solution
 that should work with any blog that allows you to include custom stylesheets
 / javascript:
 http://nix-tips.blogspot.com/2010/09/javascript-highlighter-for-haskell-code.html

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




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


Re: [Haskell-cafe] Problems building lambdabot on osx

2011-08-09 Thread bobzhang


Hi, there is a conflict between ghc' libiconv and Ports installed libiconv.
make sure first sudo port deactivate -f libiconv
then install again, it should work.
however, it is very ugly since your other port installed libraries needs 
libiconv, like gnuplot, so when you need port installed libiconv,

sudo port activate -f libiconv again.


于 11-8-8 下午9:38, Adam Turoff 写道:

I've tried off and on the last couple of days to build Lambdabot on Mac OS X
(before and after the upgrade from 10.6 to 10.7) and I keep running into linker
errors with the 64-bit Haskell Platform (ghc 7.0.3).

First, there's the issue with linking against libiconv, which is solved this
way:

cabal install --extra-lib-dirs=/usr/lib

That leaves a whole mess of link errors against libHSreadline:

Linking dist/build/lambdabot/lambdabot ...
ld: warning: could not create compact unwind for _ffi_call_unix64: does 
not use RBP or RSP based frame
Undefined symbols for architecture x86_64:
  _rl_insert_completions, referenced from:
  _readlinezm1zi0zi1zi0_SystemziConsoleziReadline_zdwa5_info in 
libHSreadline-1.0.1.0.a(Readline.o)
  _rl_possible_completions, referenced from:
  _readlinezm1zi0zi1zi0_SystemziConsoleziReadline_zdwa7_info in 
libHSreadlin

(full error report at http://hpaste.org/50036 )

I did manage to install readline through macports:

$ port installed readline
The following ports are currently installed:
  readline @6.2.000_0 (active)

$ file /opt/local/lib/libreadline.dylib
/opt/local/lib/libreadline.dylib: Mach-O 64-bit dynamically linked 
shared library x86_64

and I did manage to get readline installed properly by specifying the
include/lib dirs from macports:

cabal install readline 
--configure-option=--with-readline-libraries=/opt/local/lib 
--configure-option=--with-readline-includes=/opt/local/include

and readline does work in ghci:

$ ghci
GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
Prelude  :m + System.Console.Readline
Prelude System.Console.Readline  readline testing  
testing  exit
exit
Just exit
Prelude System.Console.Readline

The only issue, which has me stumped, is that lambdabot can't seem to find the
readline dependency.  Adding the --with-readline options when trying to build
lambdabot has no effect.  Neither does adding --extra-lib-dirs=/opt/local/lib
to cabal install.

Anyone have a clue where to start to work around this?  Would switching to ghc
HEAD help here?

Thanks,

-- Adam



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


[Haskell-cafe] Question Formlets, file upload

2011-08-09 Thread Dr. Heinrich Hördegen

 Dear all,

I am using the library Text.XHtml.Strict.Formlets to build a validating 
form. I use the function file to get a file upload widget. The 
encoding is set to multipart. I want to check, if the user entered 
something or left the widget empty. However, when entering nothing, 
instead of an empty string, I always get a string like /tmp/12101 
which corresponds to an empty file.


It would be nice, if I could check for the empty string to see, weather 
the user entered something or not into the upload widget.


I appreciate any hints to achive this and wish you a good day,
Heinrich


--
--

hoerde...@funktional.info
www.funktional.info

--


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


[Haskell-cafe] PhD Position available at Strathclyde

2011-08-09 Thread Conor McBride

[My colleague, Patricia Johann, advertises the following...]

 PhD Position
 in
 Category Theory and Functional Programming

 Department of Computer and Information Sciences
  University of Strathclyde, Scotland

Applications are invited for one PhD position within the  
Mathematically Structured Programming group at the University of  
Strathclyde. The group comprises Prof. Neil Ghani, Dr. Patricia  
Johann, Dr. Conor McBride, Dr. Peter Hancock, Dr. Robert Atkey, and  
six PhD students. The PhD project centres around applications of  
categorical methods to functional programming languages. The project  
is under the direction of Patricia Johann.


The successful applicant will have either a first-class degree or an  
MSc in Mathematics or Computing Science or a related subject with a  
strong Mathematics or Computing Science component. Ideally, they will  
also have a strong, documented interest in doing research. Strong  
mathematical background and problem-solving skills are essential; good  
programming skills are a plus. Prior knowledge of category theory and/ 
or functional programming is an advantage, but is not required.


The PhD position is for 3 years; it starts in January 2012. The  
position is a fully-funded post for a UK or EU student, and includes  
both coverage of fees and an EPSRC-level stipend for each of the three  
years. More information about the department is available at


  http://www.strath.ac.uk/cis

The University of Strathclyde (http://www.strath.ac.uk) is located in  
the heart of Glasgow, which Lonely Planet Travel Guides hail as one  
of Britain's largest, liveliest and most interesting cities (seehttp://www.lonelyplanet.com/worldguide/scotland/glasgow/) 
. Southern Scotland provides a particularly stimulating environment  
for researchers in theoretical computer science, with active groups in  
this area at Heriot-Watt University, the University of Edinburgh, the  
University of Glasgow, the University of St. Andrews, and the  
University of Strathclyde.


Requests for further information and other informal enquiries can be  
sent to:

  Patricia Johann
  patricia at cis.strath.ac.uk

Those interested in the position are asked to send e-mail to the  
address given above in the next short while.



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


[Haskell-cafe] Second CFP: PADL'12 - Practical Aspects of Declarative Languages 2012

2011-08-09 Thread Claudio Russo
 [Apologies if you receive multiple copies.]

  Call for Papers
  ===

  14th International Symposium on 
  Practical Aspects of Declarative Languages (PADL 2012)

http://research.microsoft.com/~crusso/padl12

 Philadelphia, Pennsylvania, USA, January 23-24, 2012
Co-located with ACM POPL'12
   
  Abstract/Paper submission deadline: September 10th/17th, 2011

  Conference Description
  ==

   Declarative languages build on sound theoretical bases to provide
attractive frameworks for application development. These languages
have been successfully applied to many different real-world
situations, ranging from data base management to active networks to
software engineering to decision support systems.

   New developments in theory and implementation have opened up new
application areas. At the same time, applications of declarative
languages to novel problems raise numerous interesting research
issues. Well-known questions include designing for scalability,
language extensions for application deployment, and programming
environments. Thus, applications drive the progress in the theory and
implementation of declarative systems, and benefit from this progress
as well.

   PADL is a forum for researchers and practitioners to present
original work emphasizing novel applications and implementation
techniques for all forms of declarative concepts, including,
functional, logic, constraints, etc. Topics of interest include, but
are not limited to:

   * Innovative applications of declarative languages
   * Declarative domain-specific languages and applications
   * Practical applications of theoretical results
   * New language developments and their impact on applications
   * Declarative languages and Software Engineering
   * Evaluation of implementation techniques on practical applications
   * Practical experiences and industrial applications
   * Novel uses of declarative languages in the classroom
   * Practical extensions such as constraint-based, probabilistic, and 
 reactive languages.

   PADL'12 welcomes new ideas and approaches pertaining to
applications and implementation of declarative languages. In this
occasion PADL is co-located, as traditionally, with ACM POPL, which
will be held immediately following PADL, January 25-27. The symposium
will be held in Philadelphia, Pennsylvania, USA.



  Important Dates and Submission Guidelines
  =

  Abstract Submission:September 10, 2011
  Paper Submission:   September 17, 2011
  Notification: October 22, 2011
  Camera-ready: November 5, 2011
  Symposium: January 23-24, 2012

   Authors should submit an electronic copy of the full paper in PDF
using the Springer LNCS format. The submission will be done through
EasyChair conference system. If electronic submission is impossible,
please contact the program chairs for information on how to submit
hard copies. All submissions must be original work written in
English. Submissions must be unpublished and not submitted for
publication elsewhere. Work that already appeared in unpublished or
informally published workshops proceedings may be submitted. PADL'12
will accept both technical and application papers:

   * Technical papers must describe original, previously unpublished
 research results. Technical papers must not exceed 15 pages in
 Springer LNCS format.
   * Application papers are a mechanism to present important practical
 applications of declarative languages that occur in industry or
 in areas of research other than Computer Science. Application
 papers will be published in the Springer-Verlag conference
 proceedings, and will be presented in a separate session.
 Application papers are expected to describe complex and/or
 real-world applications that rely on an innovative use of
 declarative languages. Application descriptions, engineering
 solutions and real-world experiences (both positive and negative)
 are solicited. The limit for application papers is 6 pages in
 Springer LNCS format.


 Program Committee
 =

Marcello Balduccini, Intelligent Systems Department, Kodak Research Labs 
Edwin Brady, University of St Andrews, Scotland 
Henning Christiansen, Roskilde University, Denmark 
Agostino Dovier, University of Udine, Italy 
Matthew Flatt, University of Utah, USA 
Gopal Gupta, University of Texas at Dallas, USA 
John Hughes, Chalmers University of Technology, Sweden; Quviq AB 
Gabriele Keller, University of New South Wales, Australia 
Lunjin Lu, Oakland University, USA 
Marc Pouzet, 

Re: [Haskell-cafe] Problems building lambdabot on osx

2011-08-09 Thread Brandon Allbery
On Mon, Aug 8, 2011 at 21:38, Adam Turoff adam.tur...@gmail.com wrote:

 First, there's the issue with linking against libiconv, which is solved
 this
 way:

cabal install --extra-lib-dirs=/usr/lib

 That leaves a whole mess of link errors against libHSreadline:


Yes, because now it's finding the system readline, which isn't actually
readline (Apple ships a readline which is actually BSD editline, so you
get missing symbols for things editline doesn't support such as completion).
 I think you'll need to temporarily deactivate MacPorts' iconv instead of
using --extra-lib-dirs.

This can't really be fixed by either GHC or MacPorts; there doesn't seem to
be a good solution as yet, although the MacPorts folks may end up
implementing a hacky solution because Apple has introduced *another*
MacPorts-breaking library conflict in Lion (libnotify).

-- 
brandon s allbery  allber...@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Analyzing slow performance of a Haskell program

2011-08-09 Thread Chris Yuen
Hi all,

Thanks Bryan, reading your clean code was good for my Haskell health :)

I took your code and did some more research. I think I have found the
answer. I have written an extensive analysis in my blog post
http://cfc.kizzx2.com/index.php/in-search-of-performance-in-haskell/(comments
are very much welcome, btw :)

Here are summaries of key points:

- I was using GHC 32-bit. Int is 32-bit there, so I needed Int64. It turns
out 64-bit operations in 32-bit programs are just darn slow. Maybe it's a
Windows problem. On Linux 64 bit GHC Int is 64 bit so everything just works.
Changing Int64 to Int liberates me from many `fromIntegral` which saved 20%
- Changing `divMod` to `quotRem` saved another 20%
- Using `Data.Vector.Unboxed` and `unsafeIndex` saved another 15% or so
- Moving the length arrays to `where` clause in `solve` with bang patterns
on them save some more.

This was a great learning experience! Now I have more questions :P

1. Why are bangs needed on the length arrays?

If I remove them from below, performance drops 10%. I thought `unsafeIndex`
is straight in both arguments, no?

wordLength i = go i
  where
go n
  | n  10 = lengthOnes !! n
  | n  20 = lengthTeens !! (n-10)
  | n  100 = (lengthTens !! (n // 10)) + (lengthOnes !! (n % 10))
  | n  1000 = (lengthOnes !! (n // 100)) + 7 + go (n % 100)
  | n  100 = go (n // 1000) + 8 + go (n % 1000)
  | otherwise = go (n // 100) + 7 + go (n % 100)
!lengthOnes = lengthVec ones
!lengthTens = lengthVec tens
!lengthTeens = lengthVec teens

2. Why the single element worker wrapper pattern (`go` functions) increases
performance?

If we change wordLength to

wordLength n
  | n  10 = lengthOnes !! n
  | n  20 = lengthTeens !! (n-10)
  | n  100 = (lengthTens !! (n // 10)) + (lengthOnes !! (n % 10))
  | n  1000 = (lengthOnes !! (n // 100)) + 7 + wordLength (n % 100)
  | n  100 = wordLength (n // 1000) + 8 + wordLength (n % 1000)
  | otherwise = wordLength (n // 100) + 7 + wordLength (n % 100)
  where
!lengthOnes = lengthVec ones
!lengthTens = lengthVec tens
!lengthTeens = lengthVec teens

The performance drops by another 10%. This really surprised me. `go i`
seemed obvious to me and I don't understand how it could make any
difference. The full source code is available to GHC so it shouldn't be
related to call-by-pointer problem? If this is the case, shouldn't we always
wrap a go function for **any** recursive functions?

Thanks!

Chris

On Tue, Aug 9, 2011 at 9:09 AM, Reiner Pope reiner.p...@gmail.com wrote:

 On 9 August 2011 10:06, Bryan O'Sullivan b...@serpentine.com wrote:

 On Mon, Aug 8, 2011 at 9:24 AM, Chris Yuen kizzx2+hask...@gmail.comwrote:


 For reference I have asked the same question on StackOverflow. One person
 suggested that the reason might be that Int64 on Windows is broken (
 http://stackoverflow.com/questions/6970904/analyzing-slow-performance-of-a-haskell-program/6976448#6976448
 ).


 No, they're barking up the wrong tree.

 I've put an idiomatic Haskell translation of your C++ algorithm at
 https://gist.github.com/1133048#file_wordy.hs

 (I've also included a copy of your original C++, with a bug fixed, in the
 same gist.)

 As you can see, the two are almost identical. Not surprisingly, each one
 spends the bulk of its time computing word lengths.

 GHC simply doesn't do a great job of compiling fairly tight code like
 this. gcc generates about 100 lines of assembly that's mostly easy to follow
 (except for some bit-twiddling tricks to avoid div instructions). Although
 the Core it generates looks fine, GHC spends quite a bit of time in its
 generated assembly on what looks to me like STG housekeeping (it spends only
 0.3% of its time in the garbage collector, because it doesn't allocate
 memory). The overall result is that the Haskell code runs about 5x more
 slowly than the C++ code.


 GHC generating bad assembly suggests trying the llvm codegen (see
 http://donsbot.wordpress.com/2010/02/21/smoking-fast-haskell-code-using-ghcs-new-llvm-codegen/).
 Compiling Bryan's code with

 $ ghc -O2 -fllvm Wordy.hs

 it now runs only 2x slower than the C++ code.

 Reiner

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


Re: [Haskell-cafe] Haskell syntax highlighting in a public blog

2011-08-09 Thread Chris Yuen
You can probably just post your code as Gists in GitHub. They provide an
embed button to give you a script tag pair. See an example of it in
action in my blog
http://cfc.kizzx2.com/index.php/in-search-of-performance-in-haskell/

Chris

On Tue, Aug 9, 2011 at 6:07 PM, Bas van Gijzel neneko...@gmail.com wrote:

 Another alternative is to use the HsColour package:
 http://code.haskell.org/~malcolm/hscolour/ and choose html as output.
 (This works for me on blogspot.com)

 On 9 August 2011 05:16, Daniel Patterson lists.hask...@dbp.mm.st wrote:


 On Aug 8, 2011, at 10:26 PM, Ivan Lazar Miljenovic wrote:

 On 9 August 2011 12:04, Arlen Cuss cel...@sairyx.org wrote:

 9/08/2011 11:54 AM, Oscar Picasso kirjutas:

 Hi,


 Is there a public blog that that allow syntax highlighting of Haskell
 code?


 Are you talking about a plugin for a blog engine? CodeColourer on

 WordPress will do it.


 I think he meant more along the lines of wordpress.com, which as far
 as I know _doesn't_ support highlighting Haskell.


 I haven't done this personally, but here is a javascript based solution
 that should work with any blog that allows you to include custom stylesheets
 / javascript:
 http://nix-tips.blogspot.com/2010/09/javascript-highlighter-for-haskell-code.html

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




 --
 http://adoseoflogic.blogspot.com/


 ___
 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] Analyzing slow performance of a Haskell program

2011-08-09 Thread Johan Tibell
Hi Chris,

On Tue, Aug 9, 2011 at 12:47 PM, Chris Yuen kizzx2+hask...@gmail.com wrote:
 1. Why are bangs needed on the length arrays?

 If I remove them from below, performance drops 10%. I thought `unsafeIndex`
 is straight in both arguments, no?

 wordLength i = go i
   where
     go n
   | n  10 = lengthOnes !! n
   | n  20 = lengthTeens !! (n-10)
   | n  100 = (lengthTens !! (n // 10)) + (lengthOnes !! (n % 10))
   | n  1000 = (lengthOnes !! (n // 100)) + 7 + go (n % 100)
   | n  100 = go (n // 1000) + 8 + go (n % 1000)
   | otherwise = go (n // 100) + 7 + go (n % 100)
     !lengthOnes = lengthVec ones
     !lengthTens = lengthVec tens
     !lengthTeens = lengthVec teens

(It's strict, not straight.)

The different lengths are not used in all branches and since Haskell
is a lazy (or to be pendantic: non-strict) language we cannot compute
them before knowing which branch will be evaluated. For example, given
that we have

ones = ...
tens = error Boom!

test = wordLength 0

evaluating 'test' should not cause an exception to be raised as the
first (n  10) branch is taken, but it would if lengthOnes was strict.

Delaying the evaluation has some costs, namely allocating a thunk for
e.g. `lengthVec ones` and later evaluate that thunk. By making the
lengths strict we can evaluate them earlier and avoid some allocation
and forcing of thunks.

 2. Why the single element worker wrapper pattern (`go` functions) increases
 performance?

 If we change wordLength to

 wordLength n
   | n  10 = lengthOnes !! n
   | n  20 = lengthTeens !! (n-10)
   | n  100 = (lengthTens !! (n // 10)) + (lengthOnes !! (n % 10))
   | n  1000 = (lengthOnes !! (n // 100)) + 7 + wordLength (n % 100)
   | n  100 = wordLength (n // 1000) + 8 + wordLength (n % 1000)
   | otherwise = wordLength (n // 100) + 7 + wordLength (n % 100)
   where
     !lengthOnes = lengthVec ones
     !lengthTens = lengthVec tens
     !lengthTeens = lengthVec teens

 The performance drops by another 10%. This really surprised me. `go i`
 seemed obvious to me and I don't understand how it could make any
 difference. The full source code is available to GHC so it shouldn't be
 related to call-by-pointer problem? If this is the case, shouldn't we always
 wrap a go function for **any** recursive functions?

Making wordLength non-recursive lets GHC inline it, which can
sometimes help performance (e.g. if the inlining enables more
optimizations). Inlining does increase code size (and sometimes
allocation if a closure has to be allocated to capture free
variables), so it's not always a good idea.

Cheers,
Johan

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


Re: [Haskell-cafe] Analyzing slow performance of a Haskell program

2011-08-09 Thread Bryan O'Sullivan
On Tue, Aug 9, 2011 at 9:47 AM, Chris Yuen kizzx2+hask...@gmail.com wrote:


 - I was using GHC 32-bit. Int is 32-bit there, so I needed Int64. It turns
 out 64-bit operations in 32-bit programs are just darn slow. Maybe it's a
 Windows problem.


No, GHC calls out to C for 64-bit integer ops on all 32-bit platforms.


 On Linux 64 bit GHC Int is 64 bit so everything just works. Changing Int64
 to Int liberates me from many `fromIntegral` which saved 20%


Actually, fromIntegral is usually a no-op, so chances are you're seeing the
effect of something else.


 - Changing `divMod` to `quotRem` saved another 20%


It's cheaper again to use quotInt# and remInt# as I did in my code.


 1. Why are bangs needed on the length arrays?


GHC has to deconstruct the Vector in order to get at the real underlying
array, so that unsafeIndex can perform the actual index into the real
underlying array.

Without bang patterns, the code performs at least one deconstruction on
every iteration through the loop. Each deconstruction has a cost. With the
bang patterns, they're all hoisted out and performed just once.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problems building lambdabot on osx

2011-08-09 Thread Jack Henahan
I didn't have any trouble building lambdabot when linking to readline built 
through Homebrew. Currently using Lion, Xcode 4.1, and GHC 7.0.4.


On Aug 9, 2011, at 11:59 AM, Brandon Allbery wrote:

 On Mon, Aug 8, 2011 at 21:38, Adam Turoff adam.tur...@gmail.com wrote:
 First, there's the issue with linking against libiconv, which is solved this
 way:
 
cabal install --extra-lib-dirs=/usr/lib
 
 That leaves a whole mess of link errors against libHSreadline:
 
 Yes, because now it's finding the system readline, which isn't actually 
 readline (Apple ships a readline which is actually BSD editline, so you 
 get missing symbols for things editline doesn't support such as completion).  
 I think you'll need to temporarily deactivate MacPorts' iconv instead of 
 using --extra-lib-dirs.
 
 This can't really be fixed by either GHC or MacPorts; there doesn't seem to 
 be a good solution as yet, although the MacPorts folks may end up 
 implementing a hacky solution because Apple has introduced *another* 
 MacPorts-breaking library conflict in Lion (libnotify).
 
 -- 
 brandon s allbery  allber...@gmail.com
 wandering unix systems administrator (available) (412) 475-9364 vm/sms
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

Jack Henahan
jhena...@uvm.edu
==
Computer science is no more about computers than astronomy is about telescopes.
-- Edsger Dijkstra
==


398E692F.gpg
Description: application/apple-msg-attachment


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


[Haskell-cafe] Error in the asynchronous exception operational semantics

2011-08-09 Thread Edward Z. Yang
Hello all,

I was recently reading Asynchronous Exceptions as an Effect by Harrison,
Allwein, Gill and Procter, and noticed at the end that they found an error
in the operational semantics described in Asynchronous Exceptions in Haskell
by the Simons and Andrew Moran.  Does anyone know what this error was, and
whether or not it was corrected in the December 12, 2006 version of the paper
floating around on the net?

Thanks,
Edward

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


[Haskell-cafe] alex 3.0 broken with Data.ByteString.Lazy - w2c conversion missing (fix attached)

2011-08-09 Thread Eugene Kirpichov
Hi Simon,

I found a bug in alex-3.0 and I'm attaching a fixed source file -
templates/wrappers.hs (modified against alex-3.0 from cabal unpack).


Explanation:
I was installing bytestring-lexing 0.2.1 and it failed to install with
alex 3.0, which was released on Aug 4.
It succeeded, however, with the most recent earlier alex 2.3.5.

Turns out that the wrapper for lazy bytestrings (strict are ok) had
alexGetByte not doing w2c conversion:
alexGetByte (_, cs) | ByteString.null cs = Nothing
| otherwise  = Just (ByteString.head cs,
(ByteString.head cs, ByteString.tail cs))

It should say ByteString.w2c $ ByteString.head cs here.
With this and an additional import of Data.ByteString.Internal (w2c),
the generated code compiles.

To reproduce, cabal unpack bytestring-lexing and try installing it.
Installation will fail, then manually alex the .x files in
Data/ByteString/Lex{,/Lazy} and try ghci'ing to them, doing the
modification I did and ghci'ing again.



-- 
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/


wrappers.hs
Description: Binary data
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Snap Riak Extension v0.1

2011-08-09 Thread Edward Tate
Hi,

I released this library a while ago but didn't tell anyone, thought I would
let people know.

Would be cool to get feedback, suggestions etc.

https://github.com/et4te/snap-extension-riak/

PS: There are no recent commits since I'm going to be overhauling the
architecture once Snap 6 comes out with 'Snaplets'.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell syntax highlighting in a public blog

2011-08-09 Thread Oscar Picasso
Thanks for your input.

As stated by Ivan I was looking for a solution to use in a public blog
like wordpress.com.

I chose Chris Yuen solution with a minor revision because I use
Posterous. Posterous does not use the embed script but it accepts
Gists links.
See: http://blog.posterous.com/posterous-now-supports-traileraddict-embeds-a

On the other hand, Wordpress.com doesn't accept gists, see:
http://en.forums.wordpress.com/topic/support-gists?replies=2

On Tue, Aug 9, 2011 at 12:52 PM, Chris Yuen kizzx2+hask...@gmail.com wrote:
 You can probably just post your code as Gists in GitHub. They provide an
 embed button to give you a script tag pair. See an example of it in
 action in my blog
 http://cfc.kizzx2.com/index.php/in-search-of-performance-in-haskell/

 Chris

 On Tue, Aug 9, 2011 at 6:07 PM, Bas van Gijzel neneko...@gmail.com wrote:

 Another alternative is to use the HsColour
 package: http://code.haskell.org/~malcolm/hscolour/ and choose html as
 output. (This works for me on blogspot.com)

 On 9 August 2011 05:16, Daniel Patterson lists.hask...@dbp.mm.st wrote:

 On Aug 8, 2011, at 10:26 PM, Ivan Lazar Miljenovic wrote:

 On 9 August 2011 12:04, Arlen Cuss cel...@sairyx.org wrote:

 9/08/2011 11:54 AM, Oscar Picasso kirjutas:

 Hi,

 Is there a public blog that that allow syntax highlighting of Haskell
 code?

 Are you talking about a plugin for a blog engine? CodeColourer on

 WordPress will do it.

 I think he meant more along the lines of wordpress.com, which as far
 as I know _doesn't_ support highlighting Haskell.

 I haven't done this personally, but here is a javascript based solution
 that should work with any blog that allows you to include custom stylesheets
 /
 javascript: http://nix-tips.blogspot.com/2010/09/javascript-highlighter-for-haskell-code.html
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




 --
 http://adoseoflogic.blogspot.com/


 ___
 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] Analyzing slow performance of a Haskell program

2011-08-09 Thread Chris Yuen

 It's cheaper again to use quotInt# and remInt# as I did in my code.


Just want to point out that this is actually surprisingly less of an impact
than I thought. As I did the step-by-step break down (you can see my blog
post), this one (changing `quotRem` to `quotInt#` and `remInt#`) yielded
almost negligible differences. Every other change had more impact than this,
including turning the `Data.Array.Unboxed` into lookup functions (like
`lenOnes 0 = 0; lenOnes 1 = 3; lenOnes 2 = 3; ...`)

Chris

On Wed, Aug 10, 2011 at 2:16 AM, Bryan O'Sullivan b...@serpentine.comwrote:

 On Tue, Aug 9, 2011 at 9:47 AM, Chris Yuen kizzx2+hask...@gmail.comwrote:


 - I was using GHC 32-bit. Int is 32-bit there, so I needed Int64. It turns
 out 64-bit operations in 32-bit programs are just darn slow. Maybe it's a
 Windows problem.


 No, GHC calls out to C for 64-bit integer ops on all 32-bit platforms.


 On Linux 64 bit GHC Int is 64 bit so everything just works. Changing Int64
 to Int liberates me from many `fromIntegral` which saved 20%


 Actually, fromIntegral is usually a no-op, so chances are you're seeing the
 effect of something else.


 - Changing `divMod` to `quotRem` saved another 20%


 It's cheaper again to use quotInt# and remInt# as I did in my code.


 1. Why are bangs needed on the length arrays?


 GHC has to deconstruct the Vector in order to get at the real underlying
 array, so that unsafeIndex can perform the actual index into the real
 underlying array.

 Without bang patterns, the code performs at least one deconstruction on
 every iteration through the loop. Each deconstruction has a cost. With the
 bang patterns, they're all hoisted out and performed just once.

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


Re: [Haskell-cafe] Problems building lambdabot on osx

2011-08-09 Thread John Lato
 From: Brandon Allbery allber...@gmail.com

 On Mon, Aug 8, 2011 at 21:38, Adam Turoff adam.tur...@gmail.com wrote:

 First, there's the issue with linking against libiconv, which is solved
 this
 way:

        cabal install --extra-lib-dirs=/usr/lib

 That leaves a whole mess of link errors against libHSreadline:


 Yes, because now it's finding the system readline, which isn't actually
 readline (Apple ships a readline which is actually BSD editline, so you
 get missing symbols for things editline doesn't support such as completion).
  I think you'll need to temporarily deactivate MacPorts' iconv instead of
 using --extra-lib-dirs.

 This can't really be fixed by either GHC or MacPorts; there doesn't seem to
 be a good solution as yet, although the MacPorts folks may end up
 implementing a hacky solution because Apple has introduced *another*
 MacPorts-breaking library conflict in Lion (libnotify).

Yep, this is Apple's problem and everyone else just has to put up with it.

If you want to mix macports and a non-macports ghc, I think the best
solution is to self-compile ghc against the macports libiconv.  This
is easy, just configure ghc with

./configure --with-iconv-includes=/opt/local/include
--with-iconv-libraries=/opt/local/lib

I haven't had a problem since I started building ghc this way (10.5 and 10.6).

John L.

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


Re: [Haskell-cafe] Problems building lambdabot on osx

2011-08-09 Thread Adam Turoff
On Aug 9, 2011, at 7:17 PM, John Lato wrote:
 From: Brandon Allbery allber...@gmail.com
 
 Yes, because now it's finding the system readline, which isn't actually
 readline (Apple ships a readline which is actually BSD editline, so you
 get missing symbols for things editline doesn't support such as completion).
  I think you'll need to temporarily deactivate MacPorts' iconv instead of
 using --extra-lib-dirs.
 
 This can't really be fixed by either GHC or MacPorts; there doesn't seem to
 be a good solution as yet, although the MacPorts folks may end up
 implementing a hacky solution because Apple has introduced *another*
 MacPorts-breaking library conflict in Lion (libnotify).
 
 Yep, this is Apple's problem and everyone else just has to put up with it.

Thanks.  That got lambdabot happy and installed.  

For the record (and for the lazyweb):

$ sudo port deactivate -f libiconv
$ cabal install lambdabot
$ sudo port activate libiconv

 If you want to mix macports and a non-macports ghc, I think the best
 solution is to self-compile ghc against the macports libiconv.  This
 is easy, just configure ghc with
 
 ./configure --with-iconv-includes=/opt/local/include
 --with-iconv-libraries=/opt/local/lib
 
 I haven't had a problem since I started building ghc this way (10.5 and 10.6).

I may try that with a source install for the next release of the Haskell 
Platform.

Thanks again everyone,

-- Adam 


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


Re: [Haskell-cafe] Error in the asynchronous exception operational semantics

2011-08-09 Thread David Barbour
All you need to know about asynchronous exceptions is: *don't use
them!* They're
too difficult to reason about, in terms of failure modes and such. Use TVars
or MVars instead.


On Tue, Aug 9, 2011 at 1:40 PM, Edward Z. Yang ezy...@mit.edu wrote:

 Hello all,

 I was recently reading Asynchronous Exceptions as an Effect by Harrison,
 Allwein, Gill and Procter, and noticed at the end that they found an error
 in the operational semantics described in Asynchronous Exceptions in
 Haskell
 by the Simons and Andrew Moran.  Does anyone know what this error was, and
 whether or not it was corrected in the December 12, 2006 version of the
 paper
 floating around on the net?

 Thanks,
 Edward

 ___
 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] Continuation Workshop 2011: Call for participation

2011-08-09 Thread oleg

   ACM SIGPLAN Continuation Workshop 2011
 http://logic.cs.tsukuba.ac.jp/cw2011/
co-located with ICFP 2011, Tokyo, Japan
 Saturday, September 24, 2011

   Call for Participation
   Early Registration deadline is August 15!


Continuations have been discovered many times, which highlights their
many applications in programming language semantics and program
analysis, linguistics, logic, parallel processing, compilation and web
programming.  Recently, there has been a surge of interest
specifically in delimited continuations: new implementations (in
Scala, Ruby, OCaml, Haskell), new applications (to probabilistic
programming, event-driven distributed processing), substructural and
constructive logics, natural language semantics.

The goal of the Continuation Workshop is to make continuations more
accessible and useful -- to practitioners and to researchers in
various areas of computer science and outside computer science. We
wish to promote communication among the implementors and users in many
fields. We would like to publicize the applications of continuations
in academic (logic, linguistics) and practical fields and various
programming languages (OCaml, Haskell, Scala, Ruby, Scheme, etc.).

Invited talks
-
Mats Rooth, Cornell University
http://conf.ling.cornell.edu/mr249/


From Logic to Effects and Back
Noam Zeilberger, Universite' Paris 7
http://www.pps.jussieu.fr/~noam/


Tutorials
-
In the evening before the workshop, there will be a tutorial session
``Introduction to Programming with Shift and Reset''

Tutorial date and time: Friday, September 23, 2011, 19:00-21:00 
Tutorial place: IIJ (next to NII, the place of the ICFP conference)
Tutorial speakers: Kenichi Asai and Oleg Kiselyov


Presentations
-

Non-Deterministic Search Library
Kenichi ASAI, Chihiro KANEKO

`Focus movement' by delimited continuations
Daisuke BEKKI

Swarm: transparent scalability through portable continuations
James DOUGLAS

Correctness of Functions with Shift and Reset
Noriko HIROTA, Kenichi ASAI

Yield, the control operator: applications and a conjecture
Roshan P. JAMES, Amr SABRY

Demonstration of Continuation based C on GCC
Shinji KONO

Modular rollback through free monads
Conor McBRIDE, Olin SHIVERS, Aaron TURON

Using delimited continuations for distributed computing with the CIEL engine
Derek G. MURRAY, Malte SCHWARZKOPF, Christopher SMOWTON, 
Steven SMITH, Anil MADHAVAPEDDY, Steven HAND

The limit of the CPS hierarchy
Josef SVENNINGSSON

Visualizing continuations
Naoki TAKASHIMA, Yukiyoshi KAMEYAMA



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