Re: [Haskell-cafe] subversion with haskell

2010-08-06 Thread Yuras Shumovich
Hi,

Try the next:
% env EXTRA_CPPFLAGS=-I/usr/local/include/subversion-1 \
  EXTRA_LDFLAGS=-L/usr/local/lib \
  runhaskell Setup.hs configure
% runhaskell Setup.hs build
% runhaskell Setup.hs install
(and read the installation instructions included into the tarball :) )

2010/8/5 Andrew U. Frank fran...@geoinfo.tuwien.ac.at:
 i found the file in usr/include/subversion-1 (i use an ubuntu (debian)
 installation form). but the cabal installer (i.e. the configure script)
 does not find the file.

 can you give me a hint where it could search and where i could copy the
 file to. i tried to read the configure script, but cannot see, where it
 searches. i am not familiar with cpp and do not understand what the hint
 'extra cpp flags' could mean.

 thanks for your help!

 andrew

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


Re: [Haskell-cafe] what's the best environment for haskell work?

2010-08-06 Thread David Virebayre
On Fri, Aug 6, 2010 at 6:11 AM, Hamish Mackenzie
hamish.k.macken...@googlemail.com wrote:

 On 5 Aug 2010, at 21:12, David Virebayre wrote:

 Can you try out this...

 ~/haskell/test$ cat ~/bin/cabal_quick_init
 #!/bin/sh

 SOURCE_FILE=$1
 CABAL_NAME=`basename -s .lhs $SOURCE_FILE`
 CABAL_NAME=`basename -s .hs $CABAL_NAME`
 echo Creating Cabal Package $CABAL_NAME
 echo For file $SOURCE_FILE
 mkdir $CABAL_NAME.package || exit
 cd $CABAL_NAME.package || exit
 cabal init -n -p $CABAL_NAME --is-executable --source-dir=.. || exit
 sed -e s/-- *[mM]ain-[iI]s *\:/Main-is:$SOURCE_FILE/ -i  
 $CABAL_NAME.cabal || exit

This script doesn't word as-is for me. basename doesn't have a -s
option, but that's easily corrected.
Then, I couldn't get the sed command to work, so I edited manually the
cabal file to modify and uncomment the Main-is line.

 This will make a Euler/Euler.cabal file.  You can then simply add that .cabal 
 file to your workspace (right click in the Workspace pane).

Actually it makes a Euler.package/Euler.cabal file. Minor detail :)

 I'll try to fix leksah Euler.hs so it does the following
 * if the file belongs to an package in the workspace open the file and 
 activate the package
 * if not ask the user if they want to simply open it or cabalize it

That would be great.

 We do plan to fix this in the same way we resolve missing imports.  I had a 
 look to see if I could do it when a user cabalizes the source, but ghc 
 --make -v does not include the packages automatically loaded in its output.  
 Instead we will need to wait for the error then resolve it when the user 
 presses Ctrl+R.

Continuing on my Euler.hs example, I then created the cabal package
with your script. Added the package, then tried to build.

../Euler.hs:1:0:
Failed to load interface for `Prelude':
  It is a member of the hidden package `base'.
  Perhaps you need to add `base' to the build-depends in your .cabal file.
  It is a member of the hidden package `base-3.0.3.2'.
  Perhaps you need to add `base' to the build-depends in your .cabal file.
  Use -v to see a list of the files searched for.


I didn't find a way to automatically fill the dependencies, Ctrl-R
doesn't seem to do something.
I added base = 4 using the package editor, then it build.

By the way, did I mention you guys are doing an awesome job with leksah ?

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


Re: [Haskell-cafe] what's the best environment for haskell work?

2010-08-06 Thread Hamish Mackenzie

On 6 Aug 2010, at 19:33, David Virebayre wrote:
 Continuing on my Euler.hs example, I then created the cabal package
 with your script. Added the package, then tried to build.
 
 ../Euler.hs:1:0:
Failed to load interface for `Prelude':
  It is a member of the hidden package `base'.
  Perhaps you need to add `base' to the build-depends in your .cabal file.
  It is a member of the hidden package `base-3.0.3.2'.
  Perhaps you need to add `base' to the build-depends in your .cabal file.
  Use -v to see a list of the files searched for.
 
 
 I didn't find a way to automatically fill the dependencies, Ctrl-R
 doesn't seem to do something.
 I added base = 4 using the package editor, then it build.

Yes Ctrl+R currently only fixes missing import errors where you called a 
function in a package you are using.  It does this by adding import X ( f ) 
to your source.  We have had plans for a while to extend this so it can handle 
these hidden package errors too by updating the .cabal file. 

 By the way, did I mention you guys are doing an awesome job with leksah ?

Thanks

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


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread Andrew Coppin

Tony Morris wrote:
Hello, does anyone happen to have the lambdacats page cached? The 
domain (arcanux.org http://arcanux.org) and server have disappeared 
and the wayback machine doesn't have the images.


Somebody else noticed, eh?

Good thing I grabbed most of the actually amusing images before it 
vanished. Still, that site was hardly ever updated anyway. And it's not 
like you need a special website just to stick broken English on pictures 
of cats...


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


[Haskell-cafe] Re: using Network.CGI

2010-08-06 Thread Andrew U. Frank
dear anders

indeed, the example on your page works perfectly and mine now too!

i did misunderstand something basic on how to use network.cgi. my wrong
approach:
1. i copied the program from the web page (commented out the getinput::
line, which seems to be in error).
2. i run it with runghc and pasted the result into a web page; this page
opens in the browser, but does not have actions.

correct is to compile with ghc and copy the executable into the cgi-bin
folder. then it works...

i will put this hint somewhere in the web wiki.

i think this limits what network.cgi can be used for: it will work only
on systems, where the output from the ghc can execute. specifically,
this means, i cannot move the executable to an android mobile phone and
use it there (assuming that there is a web server, e.g. i-jetty, which
understands cgi (does it?)). is this correct?

i appreciated your quick reply - thank you for your help!

andrew



On Thu, 2010-08-05 at 18:31 -0400, Anders Kaseorg wrote:
 On Thu, 5 Aug 2010, Andrew U. Frank wrote:
  which is clearly not producing the second part of the code, namely 
  output a greeting.
 
 That’s what it’s supposed to output.  Have you considered typing in a name 
 and submitting the form?  It works fine for me: 
 http://andersk.mit.edu/greet.cgi.
 
  i try to use the Network.CGI package from darcs.
 
 (Note also that the current version is maintained in Git, not Darcs, but 
 that’s a minor detail.  See http://hackage.haskell.org/package/cgi .)
 
 Anders

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


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread Hans Aberg

On 6 Aug 2010, at 09:48, Andrew Coppin wrote:

Hello, does anyone happen to have the lambdacats page cached? The  
domain (arcanux.org http://arcanux.org) and server have  
disappeared and the wayback machine doesn't have the images.


Somebody else noticed, eh?

Good thing I grabbed most of the actually amusing images before it  
vanished. Still, that site was hardly ever updated anyway. And it's  
not like you need a special website just to stick broken English on  
pictures of cats...


Search by an actual image can be done at http://www.tineye.com/.  
This is useful if one wants to find an original, or see its original  
context.


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


Re: [Haskell-cafe] Re: [web-devel] statically compiled css

2010-08-06 Thread Michael Snoyman
On Thu, Aug 5, 2010 at 3:41 PM, Tim Matthews tim.matthe...@gmail.comwrote:

 On Thu, Aug 5, 2010 at 11:33 PM, Mark Bradley barkmad...@gmail.comwrote:

 but CSS type checking might be possible within hamlet.


 I have often wondered OK haml implemented now what about sass. Michael
 Snoyman what is your opinions on sass? Would a sass inspired syntax like you
 did with the haml-hamlet fit in well and if so, as it often best to keep
 styles separate, could a quasi quoted language live in in a separate haskell
 module and then at run time it recreates the separate css files on first
 launch?

 After looking into sass a little bit, I've decided I like it ;). I see the
following benefits of implementing something sass-like in Haskell via
quasi-quotation:

* Compile-time guarantee of well-formedness.
* The speed benefits of blaze-builder. Of course, this will still be slower
than serving a static file.
* Ability to use the same Haskell variables for both Hamlet and CSS.

I've started a new repo on Github[1]; I'm tentatively calling the project
stylish. So far, I've gotten a quasi-quoter that handles nesting working,
and it's all built on top of blaze-builder. Here's some design decisions
that are up for grabs:

* I think the older sass syntax (whitespace sensitive) is a better call than
the newer scss syntax (a superset of CSS). It fits in better with Hamlet and
looks more like Haskell code.
* I'm not planning on implementing variable declarations within a Stylish
template; instead, it will use Haskell variables like Hamlet.
* I think mixins could be an awesome feature, but I think they'll be
implemented much closer to how embedding of templates works in Hamlet. I'm
thinking there will be a separate stylishMixin quasi-quoter.
* Sass has special support for colors and unit measurements. I think we
could provide the same thing with Haskell datatypes.

Another thing to consider is just throwing this in with Hamlet; once
blaze-html 0.2 is released and is based on blaze-builder, Stylish won't be
adding any extra dependencies to Hamlet.

I also think that the three forms of interpolation in Hamlet ($$, @@ and ^^)
make equals sense in Stylish: just imagine using url(@myUrl@) and not having
to guess how many parent directories to ascend.

Michael

[1] http://github.com/snoyberg/stylish
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] what's the best environment for haskell work?

2010-08-06 Thread Claus Reinke

For another programs (that compile fine with ghc --make), I didn't
bother making the package. But I had to find out the package
dependencies by building, checking where it fails, and trying to add a
package to the dependency list. Maybe there's a better way, didn't
find it.


We do plan to fix this in the same way we resolve missing imports.  
I had a look to see if I could do it when a user cabalizes the source, 
but ghc --make -v does not include the packages automatically 
loaded in its output.  Instead we will need to wait for the error then 
resolve it when the user presses Ctrl+R.


I looked into this for Vim's haskellmode (would also be nice for
cabal itself), never got the time to implement more than 
':show packages', but perhaps this info helps you along:


- 'ghc -v -e ..' instead of 'ghc -v --make ..' avoids the temporary files
   (assuming the file can be loaded by GHCi).

- GHCi's ':show packages' was intended to provide package info,
   but seems to have bitrotted (you could try the undocumented
   internal ':show linker' and please file a ticket for ':show packages').

- to force loading without running the code, one might have to 
   resort to ugly things like:

ghc -v -e 'snd(main,1)' -e ':show linker' tst.hs

- at which stage, we might as well use something like

   $ ghc -v -e 'snd(main,1)'  tst.hs 21 | grep Load
   Loading package ghc-prim ... linking ... done.
   Loading package integer-gmp ... linking ... done.
   Loading package base ... *** Parser:
   Loading package ffi-1.0 ... linking ... done.
   Loading package ghc-paths-0.1.0.6 ... linking ... done.
   Loading package array-0.3.0.1 ... linking ... done.
   Loading package containers-0.3.0.0 ... linking ... done.

- for automatic package generation, one would also need
   the language extensions in use (among other things);
   unfortunately, the code for that in GHC stops at the
   first missing extension and is not yet written in a way
   that makes it easy to identify all such cases.

- ideally, one would have ghc --show-languages and
   ghc --show-packages, or ghc --mk-cabal, or implement 
   them via GHC API.


Hth,
Claus

PS. if someone started a haskell-tools list (for cross-tool
   interests in haskellmodes, ides, ghc-api clients, etc., I
   would subscribe, though I can't afford the time to do
   much Haskell hacking at the moment)

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


Re: [Haskell-cafe] ANNOUNCE: DSTM 0.1.1

2010-08-06 Thread Frank Kupke
Paul,
Yes, I use Read and Show to serialize. I thought of switching to Binary myself 
but could not find the time yet ;-) Now, a student here is going to work on 
that. Also, as TCP communication involves a lot of overhead, the library makes 
some efforts to reduce the amount of messages and makes message exchange itself 
quite efficient which resulted in a significant efficiency gain. But, there is 
definitely more optimization potential buried...

Frank
Am 06.08.2010 um 00:49 schrieb Paul Johnson:

 Looks interesting.  One point: you seem to be using Read and Show typeclasses 
 for serialisation.  I think you would be better off using Binary, which is 
 much more efficient.
 
 Paul.
 
 On 03/08/10 09:35, Frank Kupke wrote:
 
 Hi,
 DSTM is an implementation of a robust distributed Software Transactional 
 Memory (STM) library for Haskell. Many real-life applications are 
 distributed by nature. Concurrent applications may profit from robustness 
 added by re-implementation as distributed applications. DSTM extends the STM 
 abstraction to distributed systems and presents an implementation efficient 
 enough to be used in soft real-time applications. Further, the implemented 
 library is robust in itself, offering the application developer a high 
 abstraction level to realize robustness, hence, significantly simplifying 
 this, in general, complex task.
 The DSTM package consists of the DSTM library, a name server application, 
 and three sample distributed programs using the library. Provided are a 
 simple Dining Philosophers, a Chat, and a soft real-time Bomberman game 
 application. Distributed communication is transparent to the application 
 programmer. The application designer uses a very simple name server 
 mechanism to set up the system. The DSTM library includes the management of 
 unavailable process nodes and provides the application with abstract error 
 information thus facilitating the implementation of robust distributed 
 application programs.
 For usage please look into the documentation file: DSTMManual.pdf.
 
 The package including the documentation can be found on:
 http://hackage.haskell.org/package/DSTM-0.1.1
  
 Best regards,
 Frank Kupke
 
  
 ___
 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] Re: [web-devel] statically compiled css

2010-08-06 Thread Benedict Eastaugh
On 6 August 2010 09:19, Michael Snoyman mich...@snoyman.com wrote:

 After looking into sass a little bit, I've decided I like it ;). I see the
 following benefits of implementing something sass-like in Haskell via
 quasi-quotation:

 * Compile-time guarantee of well-formedness.
 * The speed benefits of blaze-builder. Of course, this will still be slower
   than serving a static file.
 * Ability to use the same Haskell variables for both Hamlet and CSS.

 I've started a new repo on Github[1]; I'm tentatively calling the project
 stylish.

This sounds pretty interesting. I wrote a Ruby tool called Stylish [1]
a couple of years ago to solve a similar set of problems, and have
occasionally wondered about rewriting it in Haskell. I look forward to
seeing what you come up with.

One potentially useful feature is generating code that requires
browser prefixes (-webkit-border-radius etc.). There's also potential
for generating minified versions of the code, concatenating multiple
stylesheets etc.—it's a lot easier to do this stuff if you can
programmatically manipulate the stylesheet at run-time. Embedding
assets (graphics) as data URIs is another thing; have a look at how
something like Jammit [3] does this.

There's also a Firefox and Thunderbird extension [2] called Stylish.
Obviously you're free to call your project whatever you wish; I just
thought I should let you know.

Benedict.

[1] http://ionfish.github.com/stylish
[2] http://userstyles.org/stylish
[3] http://documentcloud.github.com/jammit/#embedding
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: DSTM 0.1.1

2010-08-06 Thread Frank Kupke

Am 04.08.2010 um 23:16 schrieb Andrew Coppin:

 Frank Kupke wrote:
 Andrew,
 
 Thanks for pointing your finger at it
 Am 04.08.2010 um 17:48 schrieb Andrew Coppin:
  
 In that case, is there a way to determine whether or not the rest of the 
 transaction completed? Because it looks like you can the same exception 
 either way, regardless of whether a commit happened or not.

 Ah, now I see. Excellent point. I was always focussing the commit case which 
 is well designed, I am certain.
  
 
 OK, so there's design work to do here. (Or at least, things to think about.) 
 But that's OK. It's new and exciting. :-)
 

Andrew,

oops. Your question was sure pointing me to an issue I had to rethink twice. My 
last reply to you was shot a bit too quickly. The implemented design throws an 
exception to the application in two cases:
- if  the app reads a TVar, calling readTVar, and the TVar is not accessible
- if a transaction, a call of atomic, is validated and one or more of the to be 
validated TVars are not accessible (that I said also before)

However, *no* exception is thrown if the transaction *has been* validated and 
the failure occurs afterwards during the commit phase (here my reply was 
incorrect). In this case the transaction silently commits all remaining (i.e. 
non failing) TVars. Failing TVars are simply ignored besides internal cleanup 
work which is transparent to the app.

Back to your original question then: A transaction throwing the distribution 
exception (other exceptions are possible, too, but are orthogonal to this one) 
signals to the app that the transaction did not commit because of a TVar 
failure  (Btw, reading a TVar also occurs in a transaction and in case of such 
an exception the app knows also that the transaction did not finish, it did not 
even try to validate, though). What about a transaction that committed in spite 
of unavailable TVars? Answer: The app would not know until the next time it 
tries to access the failing TVar. Then it definitely gets an exception, either 
because of reading it or validating the transaction. A committed (i.e. 
returning) transaction tells the app that whatever it wanted to synchronize 
with other parts of the system succeeded and it can continue its work. It does 
not guarantee, though, that the other parts are still alive.

This failure semantics, of course, can be discussed. Any input is welcome.

Frank

PS: I have uploaded DSTM 0.1.2 with minor changes based on the discussion here.

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


Re: [Haskell-cafe] Re: [web-devel] statically compiled css

2010-08-06 Thread Michael Snoyman
On Fri, Aug 6, 2010 at 12:28 PM, Benedict Eastaugh ionf...@gmail.comwrote:

 On 6 August 2010 09:19, Michael Snoyman mich...@snoyman.com wrote:

  After looking into sass a little bit, I've decided I like it ;). I see
 the
  following benefits of implementing something sass-like in Haskell via
  quasi-quotation:
 
  * Compile-time guarantee of well-formedness.
  * The speed benefits of blaze-builder. Of course, this will still be
 slower
than serving a static file.
  * Ability to use the same Haskell variables for both Hamlet and CSS.
 
  I've started a new repo on Github[1]; I'm tentatively calling the project
  stylish.

 This sounds pretty interesting. I wrote a Ruby tool called Stylish [1]
 a couple of years ago to solve a similar set of problems, and have
 occasionally wondered about rewriting it in Haskell. I look forward to
 seeing what you come up with.

 One potentially useful feature is generating code that requires
 browser prefixes (-webkit-border-radius etc.). There's also potential
 for generating minified versions of the code, concatenating multiple
 stylesheets etc.—it's a lot easier to do this stuff if you can
 programmatically manipulate the stylesheet at run-time. Embedding
 assets (graphics) as data URIs is another thing; have a look at how
 something like Jammit [3] does this.

 As far as the border-radius kind of stuff: the approach I'm taking to
mixins should make it possible to write a plain old Haskell function to
output multiple border-radius statements. I might even include such a mixin
in the main package.

Regarding concatenating stylesheets: I believe that would have to be handled
at the level *above* Stylish; Yesod, for example, automatically concatenates
all style statements added via the addStyle function.

There's also a Firefox and Thunderbird extension [2] called Stylish.
 Obviously you're free to call your project whatever you wish; I just
 thought I should let you know.

 I'm open to naming suggestions. Here's a few other ideas I'd had:

* sasslet: I don't really like too much, but makes clear the connection to
Hamlet and Sass.
* csser/cssar: pronounced Caesar, might give Shakespeare fans something to
chuckle at.

As it stands, I'm leaning fairly strongly towards including Stylish in the
Hamlet package.

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


[Haskell-cafe] Question about rpc design

2010-08-06 Thread lysgaard

Hi, I'm tinkering with making a DHT im my spare time this summer. For this i
need to do some unusual rpc calls. You see in a dht a query (rpc) is first
sent from you (node a) to a node b which probably doesn't know the
answer. If it still does know the answer it returns the value of the query
to node a.
This gives the latency: 2*latency(a,b)

On the other hand, if i t doesn't it sends a new rpc to a node c more
probable to know the ansver.
Then the latency is: latency(a,b) + 2*latency(b,c) + latency(b,a)

While what I would like is this: latency(a,b) + latency(b,c) + latency(c,a)
you see that for many forwards this adds considerable latency and also many
more calls than nessesary.
Is this way of sending messages already known? Does it have a name? And if
not, how hard do you think it would be to hack some rpc library to implement
this?
-- 
View this message in context: 
http://old.nabble.com/Question-about-rpc-design-tp29356441p29356441.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] Wildly off-topic: de Boor's algorithm

2010-08-06 Thread James Andrew Cook
On Aug 5, 2010, at 4:31 PM, Andrew Coppin wrote:

 mo...@deepbondi.net wrote:
 Andrew Coppin wrote:
  
 Given a suitable definition for Vector2 (i.e., a 2D vector with the
 appropriate classes), it is delightfully trivial to implement de
 Casteljau's algorithm:
 
 de_Casteljau :: Scalar - [Vector2] - [[Vector2]]
 de_Casteljau t [p] = [[p]]
 de_Casteljau t ps = ps : de_Casteljau t (zipWith (line t) ps (tail ps))
 
 line :: Scalar - Vector2 - Vector2 - Vector2
 line t a b = (1-t) *| a + t *| b
 
 Now, de Boor's algorithm is a generalisation of de Casteljau's
 algorithm. It draws B-splines instead of Bezier-splines (since B-splines
 generalise Bezier-splines). But I think I may have ACTUALLY MELTED MY
 BRAIN attempting to comprehend it. Can anybody supply a straightforward
 Haskell implementation?

 
 It took me a while to get around to it, and another while to work it out,
 but here's what I've come up with.
 
 OK, cool.
 
 First, here's a restatement of your
 code with a concrete choice of types (using Data.VectorSpace from the
 vector-space package)
 
 My types *are* concrete. They're from AC-Vector. ;-)

Nope, they were abstract until you told me where I can get an implementation ;)

 To generalize to De Boor's algorithm, the primary change is the
 interpolation operation.  In De Casteljau's algorithm, every interpolation
 is over the same fixed interval 0 = x = 1.  For De Boor's algorithm we
 need a more general linear interpolation on the arbitrary interval
 [x0,x1], because all the interpolations in De Boor's recurrence are
 between pairs of knots, which have arbitrary values instead of just 0 or
 1.
  
 
 Right. That's basically what I figured. I'm having trouble wrapping my brain 
 about the exact relationship between the number of control points, the number 
 of knots, the degree of the spline, which knots and control points are active 
 at a given parameter value, etc. There seems to be an utterly *huge* avenue 
 for off-by-one errors here.

It took me a while to get the intuition right on those, but here's a quick 
sketch.  Let n = number of control points, m = number of knots, and p = degree. 
 For p = 0 (constant segments), each control point corresponds to one span of 
the knot vector, so n = m - 1.  Each time you move up a degree, the basis 
functions span one more segment of the knot vector.  Thus, to keep the same 
number of control points you have to add a knot when you add a degree, so n = m 
- 1 + p.  Equivalently, n - p = m - 1, which incidentally makes an appearance 
in the deBoor function below when we zip spans p us with spans 1 ds.  This 
is just the property that ensures that  the length of these lists is equal.

As for off-by-one errors, I agree.  I am reasonably sure that I at least don't 
have any major ones, but I would only be slightly surprised if there are corner 
cases I have handled incorrectly.  After quite a bit of plotting and 
deliberately introducing errors in the implementation I found that in most of 
the obvious places for off-by-one type errors (such as getting the wrong pair 
of knots for the pair of control points) the results were spectacularly 
sensitive to those errors, so at least those ones I think are hard to get wrong 
if you're actually looking at the splines the implementation draws.

 Computing the table is now nearly as straightforward as in De Casteljau's
 algorithm:
 
  
 deBoor p  _ [] x = []
 deBoor p (_:us) ds x = ds : deBoor (p-1) us ds' x
where
ds' = zipWith (interp x) (spans p us) (spans 1 ds)

 
 Making use of a simple list function to select the spans:
 
  
 spans n xs = zip xs (drop n xs)

 
 Don't you need an uncurry in there? Or am I missing something?

Not unless I pasted the wrong version of the code.  I'm not sure where you mean 
- perhaps you're thinking of the arity of interp?  The interp function takes 3 
arguments, 2 of which are pairs - those pairs are the ones being supplied by 
zipWith above, and are the results of this function.  I had a version that used 
zipWith4 (interp t) us (drop p us) ds (tail ps) instead but I felt it was 
overly complicated, so I abstracted out the spans function.

 Note that the algorithm does not make use of @us!!0@ at all.
 
 Yeah, that's the killer, isn't it? Figuring out exactly which combination of 
 list function you need to pipe the correct values to the right places. (You 
 might remember be asking about expression dye for this exact reason...)
 
 I believe
 this is correct, based both on the Wikipedia description of the algorithm
 and the implementations I've seen.
 
 Heh, prove it. ;-)
 
 (I guess just go draw some splines and see if they look... spliney.)

Oh, believe me, I've done a lot of the informal stuff like that to check my 
sanity.

The next few paragraphs that were apparently confusing (probably due to my 
habit of rambling at times) were a gesture in the direction I believe a proof 
is to be found.  If I feel ambitious I'll probably revisit that line of 

Re: [Haskell-cafe] Preview the new haddock look and take a short survey

2010-08-06 Thread Ben Millwood
On Thu, Aug 5, 2010 at 2:35 PM, Dino Morelli d...@ui3.info wrote:

 One thing I haven't seen anyone else comment on is the width of the new
 docs. I have a large (26) monitor and use the browser full-screen (with
 xmonad, so even more screen space). When I load these pages, particularly
 the non-frame one, something like 50% of my screen real-estate is empty
 whitespace on either side of the doc content. There is also wasted space
 in the frames version, just a little less of it. I wish the docs were
 using that space like the current Haddock does. Is the plan to use a
 fixed width like this?

 Please say no, it's a disappointing trend that you see everywhere. Like
 Twitter's web interface, for instance, very narrow.


Yeah, I wrote about this in my survey response. It seems to me that if
I find text in a narrow page more readable, I can easily just resize
my browser window, this doesn't need to be enforced by the webpage
itself.

I'm also not so enthusiastic about tabbed synposis. I'm not convinced
you can easily use the synopsis and doc text simultaneously, so I
don't see any reason for it to be apart from the text body. Simplicity
is a virtue :)

I do think that in terms of colours, fonts etc. it's prettier, but the
fixed max width and kind of gimmicky synopsis tab are steps backward
in my opinion.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wildly off-topic: de Boor's algorithm

2010-08-06 Thread mokus
mo...@deepbondi.net wrote:
 It took me a while to get the intuition right on those, but here's a quick
 sketch.  Let n = number of control points, m = number of knots, and p =
 degree.  For p = 0 (constant segments), each control point corresponds to
 one span of the knot vector, so n = m - 1.  Each time you move up a
 degree, the basis functions span one more segment of the knot vector.
 Thus, to keep the same number of control points you have to add a knot
 when you add a degree, so n = m - 1 + p.  Equivalently, n - p = m - 1,
 which incidentally makes an appearance in the deBoor function below when
 we zip spans p us with spans 1 ds.  This is just the property that
 ensures that  the length of these lists is equal.

How embarrassing, I managed to get this simple math wrong.  That's what I
get for trying to think in the morning without either my notes or my
coffee, I suppose.  At least, I have that standard excuse to fall back on,
so I'll take advantage of it.  n = m - 1 + p should read n + p = m - 1
- I added p to the wrong side.

It is indeed the property that makes the zip line up, but not by the math
I gave.  Instantiating n and m as the respective length expressions
makes the equation:

 length ds + p = length us - 1

With subsequent derivation in light of the fact that the 1st control point
is being ignored (which introduces a - 1 on the RHS, if I'm not mistaken
again), as mentioned earlier, and the fact that the expression in question
is supposed to return a list one shorter than ds:

 length ds + p - 1 = length us - 1 = length (tail us)
 length ds - 1 = length (tail us) - p
 length (spans 1 ds) = length (spans p (tail us))

(Under the assumption that all the lists involved are long enough for the
tail and drop operations)
And all is (hopefully) right again.

-- James


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


Re: [Haskell-cafe] Wildly off-topic: de Boor's algorithm

2010-08-06 Thread Andrew Coppin

mo...@deepbondi.net wrote:

How embarrassing, I managed to get this simple math wrong.  That's what I
get for trying to think in the morning without either my notes or my
coffee, I suppose.


I _said_ it was tricky, didn't I? ;-)

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


Re: [Haskell-cafe] Question about rpc design

2010-08-06 Thread Vladimir Zlatanov
snip 
 Is this way of sending messages already known? Does it have a name? And if
 not, how hard do you think it would be to hack some rpc library to implement
 this?
I think you are describing telescopic routing. Of sorts. The easiest way
to achieve your goal is by making the communications asynchronous and
the party which has an answer to send it directly to the originator. It
won't necessarily reduce the latency though, and you would probably get
multiple answers, unless you have no redundant data in the network.

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


Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-06 Thread aditya siram
Thanks all for you suggestions!
Upon further reflection I realized that my audience is more pragmatic than
theoretical. Instead of emphasizing how monads are constructed and the monad
laws I think I want to dive right into the most common and useful monads.
From my vantage point they are (in no particular order) : Reader, Writer,
State, IO, ST, STM, Parsec (have I missed any?) and of course the
transformer versions. I am debating whether or not to add [] to the bunch.

To explain monads (now that I have Timothy's awesome blog post to reference)
I'll be drawing the parallel between monads and interfaces in Java. And
thanks to Tillman for showing me where the analogy breaks down. Are there
any such parallels in other languages like Perl and Python?

I'm still a little iffy on why the monad concept isn't used in other
languages. From where I sit it seems as though monads really let you play
with the order of evaluation - just because one statement is executed after
another doesn't mean they are executed in that order. I think other
languages don't make this easy.

-deech

On Wed, Aug 4, 2010 at 6:21 PM, Daniel van den Eijkel d...@gmx.net wrote:

  For me, the following two things did the magic, so I'll suggest them:

 1.
 Writing a recursive function that takes a binary tree and returns the same
 tree, but with its leaves enumerated. Each function call takes the tree and
 the counter and returns the resulting tree and the new counter value. The
 pattern that emerges is similar to the state monad. The pattern shows that
 the order of the recursive calls is not ambiguous, unlike in a function that
 just counts the leaves, for example. Changing the order of the recursive
 calls changes the result.
 (code below)

 2.
 Putting the above pattern into a datatype and rewriting the apply-funtion
 for this datatype (=) allows only to apply funtions in a non-ambiguous
 way. Not giving a deconstructor for the IO monad forces the programmer to
 decide in which order calls to IO functions have to be done.

 I hope this is clear enough; I was able to use the IO monad at the moment I
 realized that Haskell uses this kind of trick to ensure that the order of
 execution of function arguments is always well-defined and never ambiguous.
 Of course, there is much more about monads, but this was my entry point.

 Best regards
 Daniel


 code (tree enumeration):

 data Tree a = Leaf a | Node (Tree a) (Tree a) deriving Show

 enumTree n (Node a b) =
  let (n', a')  = enumTree n a in
  let (n'', b') = enumTree n' b in
  (n'', Node a' b')

 enumTree n (Leaf x) = (n+1, Leaf n)





 aditya siram schrieb:

 Hi all,
 I am doing an Intro To Monads talk in September [1]. The audience
 consists of experienced non-Haskell developers but they will be familiar
 with basic functional concepts (closures, first-class functions etc.).

 I am looking for suggestions on how to introduce the concept and its
 implications. I'd also like to include a section on why monads exist and why
 we don't really see them outside of Haskell.

 Has anyone here done a talk like this? And if so what parts of your
 presentation were successful and what would you stay away from.

 Thanks for the feedback.
 -deech

 [1] It's in St.Louis, Missouri at the St.Louis Perl Mongers 
 meetinghttp://St.Louis%20Perl%20Mongers%20meetingso come on by if you're 
 around!

 --

 ___
 Haskell-Cafe mailing 
 listhaskell-c...@haskell.orghttp://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] ANNOUNCE: DSTM 0.1.1

2010-08-06 Thread Daniel Peebles
Another interesting direction would be to use Matt Morrow's vaccum
infrastructure to make a neat, almost completely general, serialization
mechanism.

It's not safe, and can traverse any value that doesn't contain functions or
unevaluated thunks, but would be very helpful for sending values like `cycle
[1,2,3]` over the network. He and I were talking about writing such a
library before he disappeared, but it doesn't seem terribly difficult if you
have a good use for it.

Dan

On Fri, Aug 6, 2010 at 11:14 AM, Frank Kupke f...@informatik.uni-kiel.dewrote:

 Paul,
 Yes, I use Read and Show to serialize. I thought of switching to Binary
 myself but could not find the time yet ;-) Now, a student here is going to
 work on that. Also, as TCP communication involves a lot of overhead, the
 library makes some efforts to reduce the amount of messages and makes
 message exchange itself quite efficient which resulted in a significant
 efficiency gain. But, there is definitely more optimization potential
 buried...

 Frank
 Am 06.08.2010 um 00:49 schrieb Paul Johnson:

  Looks interesting.  One point: you seem to be using Read and Show
 typeclasses for serialisation.  I think you would be better off using
 Binary, which is much more efficient.

 Paul.

 On 03/08/10 09:35, Frank Kupke wrote:

 Hi,

  DSTM is an implementation of a robust distributed Software Transactional 
 Memory (STM) library for Haskell. Many real-life applications are distributed 
 by nature. Concurrent applications may profit from robustness added by 
 re-implementation as distributed applications. DSTM extends the STM 
 abstraction to distributed systems and presents an implementation efficient 
 enough to be used in soft real-time applications. Further, the implemented 
 library is robust in itself, offering the application developer a high 
 abstraction level to realize robustness, hence, significantly simplifying 
 this, in general, complex task.

  The DSTM package consists of the DSTM library, a name server application, 
 and three sample distributed programs using the library. Provided are a 
 simple Dining Philosophers, a Chat, and a soft real-time Bomberman game 
 application. Distributed communication is transparent to the application 
 programmer. The application designer uses a very simple name server mechanism 
 to set up the system. The DSTM library includes the management of unavailable 
 process nodes and provides the application with abstract error information 
 thus facilitating the implementation of robust distributed application 
 programs.

  For usage please look into the documentation file: DSTMManual.pdf.

 The package including the documentation can be found 
 on:http://hackage.haskell.org/package/DSTM-0.1.1


 Best regards,
 Frank Kupke



 ___
 Haskell-Cafe mailing 
 listhaskell-c...@haskell.orghttp://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


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


Re: [Haskell-cafe] real-time audio processing [Was: can Haskell do everyting as we want?]

2010-08-06 Thread C K Kashyap
Hey John,
The language you are working on - is it a EDSL in Haskell? If not, had you
considered such an option?

On Thu, Aug 5, 2010 at 8:11 PM, Job Vranish job.vran...@gmail.com wrote:

 Yeah Atom is pretty slick, though unfortunately it's not quite powerful
 enough for much of the stuff that we do.

 John Van Enk and I are actually working on a language that's similar to C
 (and compiles to C), but has polymorphism, type inference and other goodies.
 The goal is to make working on embedded systems a bit less painful, while
 still being able to do anything that C can do (like run on an 8 bit micro).
 Hopfully, if things go as planned, we'll have a working beta out by the end
 of the month :)

 - Job


 On Wed, Aug 4, 2010 at 5:58 PM, Don Stewart d...@galois.com wrote:

 job.vranish:
  + 1
 
 
  This is probably the biggest obstacle to using Haskell where I work.
 (Aviation
  industry, software for flight management systems for airplanes)
 
  We often need to perform some computations with hard deadlines, say
 every 20ms,
  with very little jitter.
  Major GC's spoil the fun; It's quite easy to have a major GC take longer
 than
  20ms, and currently they are not pauseable (nor is it trivial to make
 them
  so).
 
  It would be very nice to have some annotation/DSL/compiler-flag that
 would let
  me run a small block of mostly regular haskell code under hard,
 real-time
  constraints.
 
  Hmm, it looks like the HASP project is working on some of this, though
 I'm not
  sure how portable their work is back to GHC: http://hasp.cs.pdx.edu/
 

 Or look at EDSLs, like Atom:

http://hackage.haskell.org/package/atom



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




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


Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-06 Thread Alex Stangl
On Fri, Aug 06, 2010 at 10:17:26AM -0500, aditya siram wrote:
 From my vantage point they are (in no particular order) : Reader, Writer,
 State, IO, ST, STM, Parsec (have I missed any?) and of course the
 transformer versions. I am debating whether or not to add [] to the bunch.

Not sure how much time you have budgeted, but I'd start with a simple
one like Maybe, actually show how to implement it, then move on to list,
and then finally talk about Reader, Writer, State, etc. from a more high
level perspective. Hopefully people would grok the monad concept by that
point, and should realize how useful it is to add logging, or state,
etc. Then they may wonder about mixing in more than 1, so that could
lead to transformers.


 To explain monads (now that I have Timothy's awesome blog post to reference)
 I'll be drawing the parallel between monads and interfaces in Java. And
 thanks to Tillman for showing me where the analogy breaks down. Are there
 any such parallels in other languages like Perl and Python?

I get the type class / Java interface analogy, but trying to draw a
parallel between Java interface and monads seems likely to just create
confusion IMHO.


 I'm still a little iffy on why the monad concept isn't used in other
 languages. From where I sit it seems as though monads really let you play
 with the order of evaluation - just because one statement is executed after
 another doesn't mean they are executed in that order. I think other
 languages don't make this easy.

I first encountered monads in OCaml. And the concept exists in other languages,
although maybe not always explicitly by that name.

Good luck, should be a good talk,

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


Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-06 Thread Stephen Tetley
At version 2 Parsec was an amalgamation of a state and error monad -
by amalgamation I mean the data types and Monad instance encoded the
combination directly, it wasn't made from transformers. Version 3 of
Parsec complicates things a quite a bit.

If you're addressing Perl programmers, you could try and encode the
monads in Perl and see what it looks like. Maybe Mark Jason Dominus
the author of Higher Order Perl has done this already?


On 6 August 2010 16:17, aditya siram aditya.si...@gmail.com wrote:
 [SNIP] I think I want to dive right into the most common and useful monads.
 From my vantage point they are (in no particular order) : Reader, Writer,
 State, IO, ST, STM, Parsec (have I missed any?) and of course the
 transformer versions. I am debating whether or not to add [] to the bunch.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread John Van Enk
I happened to download them all (i think all) a while ago to torment my
coworkers:

http://sw17ch.com/dump/lambdacats.zip

Enjoy.

On Fri, Aug 6, 2010 at 12:12 AM, Tony Morris tonymor...@gmail.com wrote:

 Hello, does anyone happen to have the lambdacats page cached? The domain (
 arcanux.org) and server have disappeared and the wayback machine doesn't
 have the images.

 --
 Tony Morris
 http://tmorris.net/

 ___
 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] real-time audio processing [Was: can Haskell do everyting as we want?]

2010-08-06 Thread John Van Enk
It's not an EDSL (though I'm a huge fan of the concept) because we wan't to
pitch the language to programmers who currently use C/Ada.

As much as I love EDSL's, they are particularly hard to sell to entrenched
engineers without substantial effort or mandate.

Dangling a few neat features on top of a comfortable tool set hopefully will
stimulate some curiosity and help sell Haskell/EDSL's in the future...

On Fri, Aug 6, 2010 at 11:34 AM, C K Kashyap ckkash...@gmail.com wrote:

 Hey John,
 The language you are working on - is it a EDSL in Haskell? If not, had you
 considered such an option?

 On Thu, Aug 5, 2010 at 8:11 PM, Job Vranish job.vran...@gmail.com wrote:

 Yeah Atom is pretty slick, though unfortunately it's not quite powerful
 enough for much of the stuff that we do.

 John Van Enk and I are actually working on a language that's similar to C
 (and compiles to C), but has polymorphism, type inference and other goodies.
 The goal is to make working on embedded systems a bit less painful, while
 still being able to do anything that C can do (like run on an 8 bit micro).
 Hopfully, if things go as planned, we'll have a working beta out by the
 end of the month :)

 - Job


 On Wed, Aug 4, 2010 at 5:58 PM, Don Stewart d...@galois.com wrote:

 job.vranish:
  + 1
 
 
  This is probably the biggest obstacle to using Haskell where I work.
 (Aviation
  industry, software for flight management systems for airplanes)
 
  We often need to perform some computations with hard deadlines, say
 every 20ms,
  with very little jitter.
  Major GC's spoil the fun; It's quite easy to have a major GC take
 longer than
  20ms, and currently they are not pauseable (nor is it trivial to make
 them
  so).
 
  It would be very nice to have some annotation/DSL/compiler-flag that
 would let
  me run a small block of mostly regular haskell code under hard,
 real-time
  constraints.
 
  Hmm, it looks like the HASP project is working on some of this, though
 I'm not
  sure how portable their work is back to GHC: http://hasp.cs.pdx.edu/
 

 Or look at EDSLs, like Atom:

http://hackage.haskell.org/package/atom



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




 --
 Regards,
 Kashyap

 ___
 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] lambdacats

2010-08-06 Thread Sean Leather
 On Fri, Aug 6, 2010 at 12:12 AM, Tony Morris wrote:

 Hello, does anyone happen to have the lambdacats page cached? The domain (
 arcanux.org) and server have disappeared and the wayback machine doesn't
 have the images.


On Fri, Aug 6, 2010 at 18:43, John Van Enk wrote:

 I happened to download them all (i think all) a while ago to torment my
 coworkers:


 http://sw17ch.com/dump/lambdacats.zip


And from that to this:

http://spl.smugmug.com/Humor/Lambdacats/13227630_eKt46

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


[Haskell-cafe] finding out which gcc is hard-coded into a ghc?

2010-08-06 Thread Günther Schmidt

Hello,

how can I find out which gcc a ghc is hard-coded to use and is it 
possible to override it?


Günther

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


Re: [Haskell-cafe] finding out which gcc is hard-coded into a ghc?

2010-08-06 Thread John Van Enk
If you're on Windows, I believe you can find the gcc.exe at the following
location:

C:\Program Files\Haskell Platform\2009.2.0.2\gcc.exe

See this link for how to pick which C compiler to use:

http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/options-phases.html#replacing-phases

2010/8/6 Günther Schmidt gue.schm...@web.de

 Hello,

 how can I find out which gcc a ghc is hard-coded to use and is it possible
 to override it?

 Günther

 ___
 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] Preview the new haddock look and take a short survey

2010-08-06 Thread Dino Morelli

On Fri, 6 Aug 2010, Ben Millwood wrote:


On Thu, Aug 5, 2010 at 2:35 PM, Dino Morelli d...@ui3.info wrote:


One thing I haven't seen anyone else comment on is the width of the new
docs. I have a large (26) monitor and use the browser full-screen (with
xmonad, so even more screen space). When I load these pages, particularly
the non-frame one, something like 50% of my screen real-estate is empty
whitespace on either side of the doc content. There is also wasted space
in the frames version, just a little less of it. I wish the docs were
using that space like the current Haddock does. Is the plan to use a
fixed width like this?

Please say no, it's a disappointing trend that you see everywhere. Like
Twitter's web interface, for instance, very narrow.



Yeah, I wrote about this in my survey response. It seems to me that if
I find text in a narrow page more readable, I can easily just resize
my browser window, this doesn't need to be enforced by the webpage
itself.


Agreed, it's like a premature optimization for the Haddock page build to
decide and enforce width without knowing my needs, hardware or windowing
situation.



I'm also not so enthusiastic about tabbed synposis. I'm not convinced
you can easily use the synopsis and doc text simultaneously, so I
don't see any reason for it to be apart from the text body. Simplicity
is a virtue :)


The more I play with it, the more I'm not that thrilled with the sliding
synopsys thing as well. I think moving away from static pages is making
the docs less usable.

There was a period of time when the simple static alphabetic function
index was replaced with some dynamic JavaScript filtering that responded
to keystrokes in the edit control. It performed really terribly on even
my very modern systems with Firefox. I was happy when it went away. I
appreciate the idea, but it pays to be very very conservative with
reference material.



I do think that in terms of colours, fonts etc. it's prettier, but the
fixed max width and kind of gimmicky synopsis tab are steps backward
in my opinion.


I can agree with this too. I like the existing higher-contrast coloring
more, which was also mentioned by a couple of the other responses in
this thread.


--
Dino Morelli  email: d...@ui3.info  web: http://ui3.info/d/  irc: dino-
pubkey: http://ui3.info/d/dino-4AA4F02D-pub.gpg  twitter: dino8352
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread Andrew Coppin

Sean Leather wrote:


On Fri, Aug 6, 2010 at 12:12 AM, Tony Morris wrote:

Hello, does anyone happen to have the lambdacats page cached?
The domain (arcanux.org http://arcanux.org) and server have
disappeared and the wayback machine doesn't have the images.

 
On Fri, Aug 6, 2010 at 18:43, John Van Enk wrote:


I happened to download them all (i think all) a while ago to
torment my coworkers:


http://sw17ch.com/dump/lambdacats.zip


And from that to this:

http://spl.smugmug.com/Humor/Lambdacats/13227630_eKt46


Heh. unsafePerformDoggeh# still amuses me...

Sadly, I lack the 31337 skills required to think of original ideas 
myself. Just laugh at what other people have thought up.


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


[Haskell-cafe] Does Hackage have a connection to some SFT package (Significant FFT coefficients) ...

2010-08-06 Thread caseyh
Does Hackage have a connection to some SFT package (Significant FFT  
coefficients) and/or can one get the SFT from FFTW without generating  
all the coefficients?



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


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread Henning Thielemann
Sean Leather schrieb:
 
 On Fri, Aug 6, 2010 at 12:12 AM, Tony Morris wrote:
 
 Hello, does anyone happen to have the lambdacats page cached?
 The domain (arcanux.org http://arcanux.org) and server have
 disappeared and the wayback machine doesn't have the images.
 
  
 On Fri, Aug 6, 2010 at 18:43, John Van Enk wrote:
 
 I happened to download them all (i think all) a while ago to torment
 my coworkers:
 
 
 http://sw17ch.com/dump/lambdacats.zip
 
 
 And from that to this:
 
 http://spl.smugmug.com/Humor/Lambdacats/13227630_eKt46


I remember the first lambdacat said something like why can't u curry
this funkshun. I don't see it in this list. :-(
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread John Van Enk
I apologize if I missed any. :(

On Fri, Aug 6, 2010 at 3:03 PM, Henning Thielemann 
schlepp...@henning-thielemann.de wrote:

 Sean Leather schrieb:
 
  On Fri, Aug 6, 2010 at 12:12 AM, Tony Morris wrote:
 
  Hello, does anyone happen to have the lambdacats page cached?
  The domain (arcanux.org http://arcanux.org) and server have
  disappeared and the wayback machine doesn't have the images.
 
 
  On Fri, Aug 6, 2010 at 18:43, John Van Enk wrote:
 
  I happened to download them all (i think all) a while ago to torment
  my coworkers:
 
 
  http://sw17ch.com/dump/lambdacats.zip
 
 
  And from that to this:
 
  http://spl.smugmug.com/Humor/Lambdacats/13227630_eKt46


 I remember the first lambdacat said something like why can't u curry
 this funkshun. I don't see it in this list. :-(

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


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread Dan Doel
 I remember the first lambdacat said something like why can't u curry
 this funkshun. I don't see it in this list. :-(

Simon cat and Oleg cat are also missing, unfortunately.

Also the 'catamorphism' picture with the banana peel (there may be others I 
can't recall, too).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] finding out which gcc is hard-coded into a ghc?

2010-08-06 Thread Gaius Hammond


On 6 Aug 2010, at 18:05, Günther Schmidt wrote:


Hello,

how can I find out which gcc a ghc is hard-coded to use and is it  
possible to override it?






See this page: 
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/options-phases.html




Cheers,




G




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


Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-06 Thread Jonathan Geddes
On Fri, Aug 6, 2010 at 9:17 AM, aditya siram aditya.si...@gmail.com wrote:

 Upon further reflection I realized that my audience is more pragmatic than 
 theoretical. Instead of emphasizing how monads are constructed and the monad 
 laws I think I want to dive right into the most common and useful monads. 
 From my vantage point they are (in no particular order) : Reader, Writer, 
 State, IO, ST, STM, Parsec (have I missed any?) and of course the transformer 
 versions. I am debating whether or not to add [] to the bunch.

If your audience is indeed a pragmatic lot then they will not be
interested in the same things as a more theoretical crowd (obviously).
So they might not be interested in Monads at all. You've got your work
cut out for you!
With that said, I would suggest starting with the advantages of
purity. I would guess that 95% of bugs in imperative code are related
to some erroneous state. Pure code, on the other hand is immune to
this huge class of bugs. Sometimes state is useful or even necessary
(stateful computations, IO, in-place algorithms, etc), so you really
can't forgo state entirely. The cool thing about Monads is they allow
us to have our cake and eat it too! We can model stateful computations
in pure code. You might also mention the separation of pure and impure
code and how this helps us to reason about a program.

 I'm still a little iffy on why the monad concept isn't used in other 
 languages. From where I sit it seems as though monads really let you play 
 with the order of evaluation - just because one statement is executed after 
 another doesn't mean they are executed in that order. I think other languages 
 don't make this easy.


My guess would be that other languages have much less commitment to
purity. You don't need Monads in other languages because state is
implicit, everything is in the IO monad, in a sense. While Monads are
still an excellent abstraction in other languages they're often more
awkward than just using implicit state/IO/whatever operations. Haskell
has some sweet built-in syntax for monads.
Also related to advantages of purity:
http://www.haskell.org/haskellwiki/Why_Haskell_just_works
I think this approach (stating benefits of purity and maybe laziness)
would be more interesting to a pragmatic crowd. Just a guess though.
Good luck with your presentation!
--Jonathan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-06 Thread David Sankel
On Fri, Aug 6, 2010 at 11:17 AM, aditya siram aditya.si...@gmail.comwrote:

 I'm still a little iffy on why the monad concept isn't used in other
 languages.


The greatest feat that monads have accomplished, in my opinion, is providing
the right mathematical abstraction for declaring side-effect and stateful
computation in a pure functional language. For the first time it was now
possible for a pure functional programming language to be a general purpose
programming language. That's was quite an accomplishment!

The second most important feat of monads was their close offspring, the
monad transformers. These guys gave pure functional programmers the ability
to maintain invariants on which side-effect/stateful computations their end
users are going to use. This enhanced verifiability by a measured mix of
pure and impure.

The other languages that you mention are impure. So feat #1 is pointless
since they were already general purpose without monads, and feat #2 is
not realistically achievable since impure languages generally don't have a
way of restricting a function from having arbitrary side-effects.

There have been some clever things done with monads aside from #1 and #2.
Parsec is one, but it seems applicative functors are a better match for the
parsing domain. Other things are neat, but not killer features that would
turn the head of a pragmatist of the impure type in my opinion.

So, that is why I think the monad concept isn't generally used in other
languages.

David

-- 
David Sankel
Sankel Software
www.sankelsoftware.com
585 617 4748 (Office)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-06 Thread Gregory Crosswhite
 It might be a little late at this point, but here's my take on monads:

In most imperative languages sequencing of statements is a feature that
is hard-coded into the language to act in a certain way, e.g. to have a
particular implicit state (the global state plus possibly the fields
available from a class, if the code is in a method).  In Haskell,
sequencing of statements is a first-class feature of the language that
we can define to work however we want.  For example, the Maybe monad
allows us to define the sequencing operation to abort whenever we access
a Maybe value that is Nothing.  In most languages they have to introduce
a special keyword return to get this kind of early-exit functionality,
but in Haskell we don't need such a keyword because Monads allow us to
extend the sequencing operation to *add* this kind of functionality.

Similarly, in most languages you cannot completely change the implicit
state available to code;  the most that you can do is to use
Object-Oriented programming, which is an additional feature to the
language, to add additional implicit state that is available to code
(when it is inside a method) that stacks on top of the global state.  By
contrast, in Haskell defining an implicit state for code is trivial, and
furthermore we can do additional things like forcing this state to be
read-only, all without having to add new features to the language itself.

Not only is sequencing is a first-class operation that we can define at
will, but it is also possible to compose the functionality of multiple
sequencing operations so that, for example, we can get access to both a
read-only state, a global mutable state, *and* have the ability to
perform an early exit from our code, all (again) within the language. 
This technique is known as stacking Monad transformers, and there are
multiple libraries for doing it.

Finally, here is something that is trivial to do in Haskell:  create a
sequencing operation based on continuations that allows code to perform
operations asynchronously while writing code in a synchronous style. 
That is, you can define a monad that lets you write code that looks like

do
result - request x
case result of
A - request y
B - request z

which has the feature that rather than blocking a thread while we wait
for a request, we instead actually implicitly creates a callback that
runs the rest of the code as soon as the result as ready.  In most other
languages you'd have to invent a special language features such as
continuations in order to allow for a coding style like this, but in
Haskell we don't need them because *overriding the sequence operation
itself* is a first-class feature of the language that allows us to do this.

So again, the moral of this story is that just like having access to
continuations as a first-class object allows one to do powerful things,
so too does having access to the sequencing operation as a first-class
object let us do stuff that makes our job as programmers easier.

Cheers,
Greg

On 08/06/10 08:17, aditya siram wrote:
 Thanks all for you suggestions!
 Upon further reflection I realized that my audience is more pragmatic
 than theoretical. Instead of emphasizing how monads are constructed
 and the monad laws I think I want to dive right into the most common
 and useful monads. From my vantage point they are (in no particular
 order) : Reader, Writer, State, IO, ST, STM, Parsec (have I missed
 any?) and of course the transformer versions. I am debating whether or
 not to add [] to the bunch.

 To explain monads (now that I have Timothy's awesome blog post to
 reference) I'll be drawing the parallel between monads and interfaces
 in Java. And thanks to Tillman for showing me where the analogy breaks
 down. Are there any such parallels in other languages like Perl and
 Python?

 I'm still a little iffy on why the monad concept isn't used in other
 languages. From where I sit it seems as though monads really let you
 play with the order of evaluation - just because one statement is
 executed after another doesn't mean they are executed in that order. I
 think other languages don't make this easy.

 -deech

 On Wed, Aug 4, 2010 at 6:21 PM, Daniel van den Eijkel d...@gmx.net
 mailto:d...@gmx.net wrote:

 For me, the following two things did the magic, so I'll suggest them:

 1.
 Writing a recursive function that takes a binary tree and returns
 the same tree, but with its leaves enumerated. Each function call
 takes the tree and the counter and returns the resulting tree and
 the new counter value. The pattern that emerges is similar to the
 state monad. The pattern shows that the order of the recursive
 calls is not ambiguous, unlike in a function that just counts the
 leaves, for example. Changing the order of the recursive calls
 changes the result.
 (code below)

 2.
 Putting the above pattern into a datatype and rewriting the
 

Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-06 Thread Stephen Tetley
On 6 August 2010 20:47, David Sankel cam...@gmail.com wrote:

 There have been some clever things done with monads aside from #1 and #2.
 Parsec is one, but it seems applicative functors are a better match for the
 parsing domain.

Monadic bind is very, very handy for parsing, giving you context
sensitive parsing if you need it.

If you have a grammar that is LL1 plus helpers (i.e. the extended
Kleene operators - many1, sepBy etc.) then applicative formalism is
nice and as Doaitse Swierstra has shown provides good opportunities
for optimization; but I'd hasten to call it a better match in general.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread Andrew Coppin

Henning Thielemann wrote:

I remember the first lambdacat said something like why can't u curry
this funkshun. I don't see it in this list. :-(


Actually, I believe it said why u not curry that funkshun?!

In other news, I probably need to get a life...

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


[Haskell-cafe] Re: using Network.CGI

2010-08-06 Thread Anders Kaseorg
On Fri, 6 Aug 2010, Andrew U. Frank wrote:
 i think this limits what network.cgi can be used for: it will work only
 on systems, where the output from the ghc can execute.

That’s not a limitation of Network.CGI; it’s just the way CGI always 
works, no matter what language you use. 
http://en.wikipedia.org/wiki/Server-side_scripting

 specifically, this means, i cannot move the executable to an android 
 mobile phone and use it there (assuming that there is a web server, e.g. 
 i-jetty, which understands cgi (does it?)). is this correct?

You’d need a Haskell compiler that targets Android; I don’t know whether 
such a thing exists yet.

(Of course, keep in mind that if the CGI script is running on another 
computer, such as http://andersk.mit.edu/greet.cgi , you will still be 
able to visit it and use it from a browser running on Android.  That’s the 
point of CGI; only the server needs to know how to run the code.)

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


[Haskell-cafe] Haddock New Look Survey results

2010-08-06 Thread Mark Lentczner
Thank you to all who took the Haddock New Look Survey.  We got a 161 responses. 
Some graphs of the results can be found here:
http://www.ozonehouse.com/mark/snap-xhtml/Haddock-Survey-Summary.pdf

I've read through all of the comments, and I'd like to share some initial 
thoughts with you:

• Source links are indeed still supported in Haddock, I just happened to 
generate those sample pages with it turned off. Sorry for any confusion. The 
functionality remains exactly like it is in Haddock today.

• I also failed to turn off all the alternate style bits on the index page, 
and many of you found it, explored the other styles, and then wondered why it 
failed on the module pages. I had intended for the survey to just give pages in 
the new style, and missed updating the index page. In the new Haddock, you can 
specify which themes you want to render your documentation with. If you 
include more than one, the pages have a style switcher menu added. The 
default themes that will come with Haddock include Classic which is a pretty 
faithful recreation of the current look.

• Many great suggestions were made about ways to improve the UI experience of 
Synopsis drawer. Of course, the web is hardly a full featured UI framework, and 
to implement many of them we would have to decide to move to a much larger 
JavaScript framework. At present, Haddock attempts to use JavaScript very 
lightly, and only needs one small .js file. I think we are planning on keeping 
it that way for now.

• Several people mentioned that perhaps we should have user preferences for 
things like where the Synopsis section goes. This is possible (the style 
switcher menu above uses such a preference), but know that a page can only set 
a cookie for a site. So if we do such things, they will stick per site, and 
users will have to choose their preference for each new site of Haddock docs 
they browse to. Fortunately, all of Hackage would count as one site, as does 
your local machine, and those two settings probably cover the bulk one's use.

There were many many good suggestions, reported problems, and observations 
among the comments. I'm pulling together a short of list with the Haddock team 
of high priority changes based on these to be completed before the first 
release. To be sure, this will include:
- fixing the layout issues on Firefox  Chrome
- improving the expanding/collapsing behavior in module lists

The most difficult issue is how to handle the Synopsis. As evident both from 
the multiple choice question in the survey, and from the comments, there is no 
clear consensus. While 2/3rds of you like the Synopsis drawer, there is a wide 
range of how it should look and operate. Another 1/5th want it back where it 
was, in-line with the page. There were many other suggestions as well. I'm 
going to go have to spend some time mulling what to do.

Finally, thanks for the huge amount of positive feedback. When working on open 
source, often on speculation that it is what the community will want, it is 
really great to hear that you've done good! I realize that there is no way that 
such a change as this can please everyone 100%, but I'm glad to see that we 
are, on the whole, people are really happy with the work.

- Mark

Mark Lentczner
http://www.ozonehouse.com/mark/
m...@glyphic.com
irc: mtnviewmark


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


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread Sean Leather
 Simon cat and Oleg cat are also missing, unfortunately.

 Also the 'catamorphism' picture with the banana peel (there may be others I
 can't recall, too).


Well, I found what I could...

  http://spl.smugmug.com/Humor/Lambdacats/13227630_eKt46#960831913_rhDdG
  http://spl.smugmug.com/Humor/Lambdacats/13227630_eKt46#960824968_hNkLy

I welcome any others you want to share or create.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Preview the new haddock look and take a short survey

2010-08-06 Thread David Virebayre
I prefer the new look.

That being said, I'd rather like haddock handling unicode characters
in comments, at the moment it's unusable if I want to write comments
in French.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell in Industry

2010-08-06 Thread briand
On Thu, 5 Aug 2010 21:58:15 -0500
Tom Hawkins tomahawk...@gmail.com wrote:

 Good, we need more functional programmers actually solving real
 problems.  But please put your skills to work in an industry other
 than investment banking.

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


Re: [Haskell-cafe] Preview the new haddock look and take a short survey

2010-08-06 Thread Magnus Therning
On Sat, Aug 7, 2010 at 01:00, David Virebayre
dav.vire+hask...@gmail.com wrote:
 I prefer the new look.

 That being said, I'd rather like haddock handling unicode characters
 in comments, at the moment it's unusable if I want to write comments
 in French.

jokeWouldn't the docs be unusable if it were in French even if
Haddock handled unicode characters correctly?/joke

Seriously though, it would be useful for Haddock to handle unicode, if
for nothing else just to allow developers to have their names showing
properly.

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe