Re: [Haskell-cafe] Is it possible to easily connect Haskell to JavaScript/JavaFX in the browser and use a browser as a Windows GUI? :)

2010-10-21 Thread Atze Dijkstra

On  20 Oct, 2010, at 22:30 , Stephen Sinclair wrote:

 
 P.s., it would be wrong not to also mention the latest development in
 UHC, which might exactly let you write the JavaScript part of the app
 in Haskell:
 
 http://utrechthaskellcompiler.wordpress.com/2010/10/18/haskell-to-javascript-backend/
 
 I haven't tried it, so can't comment on the readiness of this interpreter..

The intention is to have the next release of UHC include a first working 
version of the Javascript backend. I am currently busy with providing FFI based 
interfacing to Javascript and a set of basic libraries for this. When released 
I expect it to be sufficient for initial experiments and simple programs, but 
to provide a proper interface to XML/HTML DOM (see 
http://www.haskell.org/haskellwiki/Haskell_in_web_browser), or a GUI 
abstraction around it (perhaps a subset of wxHaskell?) will take more work  
time. I hope this can be done as part of a studentproject, or maybe picked up 
during a Hackathon.

cheers,


- Atze -

Atze Dijkstra, Department of Information and Computing Sciences. /|\
Utrecht University, PO Box 80089, 3508 TB Utrecht, Netherlands. / | \
Tel.: +31-30-2534118/1454 | WWW  : http://www.cs.uu.nl/~atze . /--|  \
Fax : +31-30-2513971  | Email: a...@cs.uu.nl  /   |___\



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


RE: [Haskell-cafe] Are newtypes optimised and how much?

2010-10-21 Thread Simon Peyton-Jones
|  Yes, you can freely use Foo/unFoo. There's no runtime penalty. (In the
|  jargon of GHC's intermediate language, Foo and unFoo translate to
|  *type-safe casts*, which generate no executable code.
| 
|  When does the conversion to type-safe casts occur relative to other
|  optimizations (namely, rewrite rules)?
| 
| That is, I know that rewrite rules operate on the source language not on
| Core, but to what extent does that mean that type-safe casts inhibit the
| firing of rules?

Rewrite rules work on Core, not source, so they see the type-safe casts.  I 
don't know how to say to what extent they inhibit rules.  If you show an 
example I will try to help.

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


Re: [Haskell-cafe] Haskell Weekly News: Issue 155 - October 20, 2010

2010-10-21 Thread Malcolm Wallace
I just noticed that the recent revival of HWN is only being posted to  
haskell-cafe.  I know there are lots of people who no longer subscribe  
to -cafe because of the amount of traffic, but who remain subscribed  
to the hask...@haskell.org list to receive announcements only, and who  
might value HWN as a quick-summary catchup of community news.  Can you  
resume posting HWN there as well please?


On 20 Oct 2010, at 23:00, Daniel Santa Cruz wrote:

  Welcome to issue 155 of the HWN, a newsletter covering  
developments in

  the [1]Haskell community in the week of October 10 - 16.

  This time around we again have 87 posts to HackageDB. Instead of
  posting the individual packages, we get to see and celebrate the 43
  people behind these efforts.

  Want to keep a close eye on the haskellers that lurk twitter? Don
  Steward made [2]a twitter list of tweeting haskellers! Let him  
know if

  you'd like to be added to the list.

  There were a total of 24 new stories posted to the Haskell Reddit
  channel, 27 new questions taged with Haskell in StackOverflow, and  
408

  messages posted to Haskell-Cafe.

  So, what was hot last week?

Announcements

  Gregory Crosswhite is pleased to [3]announce the release of a  
family of

  packages for type-level natural numbers. He also [4]announced
  tagged-list, a package which provides fixed-length lists that are
  tagged with a phantom type-level natural number corresponding to the
  length.

  Janis Voigtlander [5]announced that it is time to collect  
contributions

  for the 19th edition of the Haskell Communities  Activities Report.
  The submission deadline is November 1, 2010.

  Alexander Solla [6]announced his new Facts library. The Facts
  hierarchy is meant to contain commonly used, relatively static facts
  about the real world.

  Kevin Jardine [7]announced polyToMonoid: a library that supplies two
  very general polyvariadic functions that can map their arguments  
into

  any monoid you specify.

  Simon Hengel [8]announced a new version of DocTest. DocTest now uses
  Haddock for parsing of comments.

Interesting Threads on Haskell-Cafe

  Michael Snoyman [9]reported that Haskellers.com has become popular a
  lot falter that he anticipated. Read up on what changes are  
planned for

  Haskellers.com. Michael is very interested in some help with running
  the site.

  Jacek Generowicz [10]asked how to deal with dynamic dispatch on
  extensible sets of types.

  Uwe Schmidt [11]replied to a question about why HXT uses arrows as
  opposed to using monads. Good comments followed.

  Jason Dusek [12]asked if there is a way to write a Haskell data
  structure that is necessarily only one or two or seventeen items  
long;
  but that is nonetheless statically guaranteed to be of finite  
length?

  Twenty-three messages followed.

  Simon Thompson [13]annouced the availability of books for review for
  the Journal of Functonial Programming.

  Andrew Copping [14]summarized a report produced by Google  
Szwitzerland
  on taking a Python system and rewriting bits of it in Haskell,  
some of

  which is now in production use.

  Ben Franksen [15]ranted about the current Haskell Blurb on the  
first

  paragraph of haskell.org. Quite the read to end the week :)

Top Reddit Stories

 * Using Haskell’s ‘newtype’ in C
   Domain: blog.nelhage.com
   Score: 37, Comments: 5
   On Reddit: 
http://www.reddit.com/r/haskell/comments/dptzh/using_haskells_newtype_in_c/
   Original: http://blog.nelhage.com/2010/10/using-haskells-newtype-in-c/

 * The Haskell theme: consistent visual branding for Haskell
   Domain: haskell.org
   Score: 34, Comments: 11
   On Reddit: 
http://www.reddit.com/r/haskell/comments/dqiej/the_haskell_theme_consistent_visual_branding_for/
   Original: 
http://www.haskell.org/pipermail/haskell-cafe/2010-October/084781.html

 * Haskellers: Survey results and new site features
   Domain: haskellers.com
   Score: 22, Comments: 6
   On Reddit: 
http://www.reddit.com/r/haskell/comments/dr37b/haskellers_survey_results_and_new_site_features/
   Original: http://www.haskellers.com/news/1/

 * My Experience Learning Haskell
   Domain: blog.virtucal.com
   Score: 21, Comments: 6
   On Reddit: 
http://www.reddit.com/r/haskell/comments/drgcz/my_experience_learning_haskell/
   Original: 
http://blog.virtucal.com/cyclical/2010/10/14/my-experience-learning-haskell.html

 * Invertible monads for exception handling and memory allocations
   Domain: docs.yesodweb.com
   Score: 21, Comments: 0
   On Reddit: 
http://www.reddit.com/r/haskell/comments/drkdj/invertible_monads_for_exception_handling_and/
   Original: 
http://docs.yesodweb.com/blog/invertible-monads-exceptions-allocations/

 * Accelerating Haskell Array Codes with Multicore GPUs
   Domain: justtesting.org
   Score: 19, Comments: 0
   On Reddit: 
http://www.reddit.com/r/haskell/comments/dq1yo/accelerating_haskell_array_codes_with_multicore/
   Original: 

[Haskell-cafe] Announce: splot-0.1.1

2010-10-21 Thread Eugene Kirpichov
Hi cafe,

I wrote yet another tiny visualization tool for my purposes and
uploaded it on hackage.

splot is a tool for visualizing the lifecycle of many concurrent
multi-stage processes.

For example, I'm using it to find the performance bottlenecks in a
distributed application: processes are tasks and tasks have stages
like task in queue, validating, running, response in queue.

http://www.haskell.org/haskellwiki/Splot

The tool is very basic but sufficient for my purposes. I'll be happy
if anyone else also finds it useful (or not useful, but tells me in
which exact way).

P.S. Remember, there's also
http://www.haskell.org/haskellwiki/Timeplot - a tool with similar
purpose but a different (and bigger) set of features. There's a new
version coming in a few days.
However, I wasn't able to quickly implement the functionality of splot
in Timeplot, and I needed it quickly, so I wrote a separate tool.

-- 
Eugene Kirpichov
Senior Software Engineer,
Grid Dynamics http://www.griddynamics.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell Weekly News: Issue 155 - October 20, 2010

2010-10-21 Thread Ketil Malde
Malcolm Wallace malcolm.wall...@me.com writes:

 might value HWN as a quick-summary catchup of community news.  Can you
 resume posting HWN there as well please?

s/as well/instead/g

I'm always getting two copies of everything in haskell@, since
everything is cross-posted to -cafe.  Are there actually people
subscribed to -cafe, but *not* to hask...@?  And if so, why?

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell Weekly News: Issue 155 - October 20, 2010

2010-10-21 Thread Daniel Fischer
On Thursday 21 October 2010 11:38:37, Ketil Malde wrote:

 I'm always getting two copies of everything in haskell@, since
 everything is cross-posted to -cafe.  Are there actually people
 subscribed to -cafe, but *not* to hask...@?  And if so, why?


I have long been subscribed to -cafe but not to hask...@.
Regarding why, I wasn't interested in what haskell@ was supposed to be for, 
while I was interested in what -cafe is for.

I agree it's a little annoying to get two copies of everything cross-posted 
(sometimes three if libraries@ is also involved), but I'd be very cautious 
about removing -cafe from the recipients.

Cheers,
Daniel

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


Re: [Haskell-cafe] Haskell Weekly News: Issue 155 - October 20, 2010

2010-10-21 Thread Max Rabkin
On Thu, Oct 21, 2010 at 11:38, Ketil Malde ke...@malde.org wrote:
  Are there actually people
 subscribed to -cafe, but *not* to hask...@?

Yes.

 And if so, why?

Because...

 I'm always getting two copies of everything in haskell@, since
 everything is cross-posted to -cafe.

:)

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


Re: [Haskell-cafe] [ANNAUNCE] ghcjs-0.1.0 Haskell to Javascript compiler

2010-10-21 Thread Victor Nazarov
On Thu, Oct 21, 2010 at 6:35 AM, Richard O'Keefe o...@cs.otago.ac.nz wrote:

 On 21/10/2010, at 12:01 PM, Victor Nazarov wrote:

 I've been working on this for some month and I think now I'm ready to
 share the results.

 Given that this is alpha code, what's the performance like?


I don't have any numbers, yet. But can you suggest any benchmarks that
can be used to measure performance. Preferably, benchmarks shouldn't
use any low level stuff and Haskell IO.

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


Re: [Haskell-cafe] data.time.zoneinfo

2010-10-21 Thread Yitzchak Gale
Anatoly Yakovenko wrote:
 I am trying to figure out how to use this library, seems like this should work
 Data.Time.ZoneInfo...

Have you looked at my timezone-olson package?
I wrote it as an alternative to Data.Time.ZoneInfo.
I think it is more flexible, and better integrated with
Data.Time.

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


Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-21 Thread Yitzchak Gale
I wrote:
 2. mailHeaders should have an Ord instance that
 compares case-insensitively, though the underlying
 Strings should remain Strings.

I really meant Eq instance - which then affects the Ord
instance, too. Sorry.

wren ng thornton wrote:
 What is the intended use case? Since many uses of Ord imply filtering out
 duplicates, this seems like it could result in getting inconsistent
 capitalization. Granted, the RFC says it's case-insensitive, but some folks
 like their aesthetics... (then again, those folks should probably use
 case-normalizers. I'm mostly just curious if the Ord is intended for
 Data.Map or what.)

Of course the type will preserve case internally. I envision
something like a HeaderName type which is a newtype
wrapper for String. If you really want to see the details of
case when you are doing something other than rendering,
you can always extract the String out of the newtype.
But semantically, header names are case insensitive.

Here is a use case - I want to search for the From field
in an email. (Or all of the From fields, sometimes there
is more than one.) Well, someone may have used non-standard
case, but it should still match.

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


[Haskell-cafe] Is it possible to easily connect Haskell to JavaScript/JavaFX in the browser and use a browser as a Windows GUI? :)

2010-10-21 Thread Dimitry Golubovsky
Hi,

Atze Dijkstra wrote:


[skip]
but to provide a proper interface to XML/HTML DOM (see 
http://www.haskell.org/haskellwiki/Haskell_in_web_browser), or a GUI 
abstraction around it (perhaps a subset of wxHaskell?)
will take more work  time. I hope this can be done as part of a 
studentproject, or maybe picked up during a Hackathon.

I think a big portion of this task might be done using this package:

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

or its newer (not published on Hackage, but recommended) version split
into two (you need both):

http://code.haskell.org/yc2js/webidl/ -- lexer (FFI based),
parser, and a test program.*

http://code.haskell.org/yc2js/webidlsyn/-- just AST and pretty-printer

I must admit: I haven't touched this project for more than a year, and
have little plans to do so: it is up for grabs by anyone interested.

But if it can parse something like this:

http://es-operating-system.googlecode.com/svn/trunk/include/w3c/html5.idl

or

http://es-operating-system.googlecode.com/svn/trunk/include/w3c/svg.idl

it's likely still intact. Back in those days it could.

A WebIDL converter helps derive type signatures for DOM methods and
attributes (just like HSFFIG does this for C function prototypes).

Have fun ;) and don't hesitate to ask questions.

PS I'm glad that the idea lives on. With more GHC flrxibility on
backends than it was in 2006-2007, and with faster Javascript engines
in browsers, this can get a second life...

--
* the whole repo has to be downloaded: darcs get http://code.haskell.org/yc2js/

-- 
Dimitry Golubovsky

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


Re: [Haskell-cafe] Haskell Weekly News: Issue 155 - October 20, 2010

2010-10-21 Thread Jean-Marie Gaillourdet
Hi,

On 21.10.2010, at 11:38, Ketil Malde wrote:

 Malcolm Wallace malcolm.wall...@me.com writes:
 
 might value HWN as a quick-summary catchup of community news.  Can you
 resume posting HWN there as well please?
 
 s/as well/instead/g
+1
 
 I'm always getting two copies of everything in haskell@, since
 everything is cross-posted to -cafe.  Are there actually people
 subscribed to -cafe, but *not* to hask...@?  And if so, why?

Over the last year the volume of traffic in haskell-cafe has increased so much, 
that I am often not able to follow everything. Which means there are often 
hundreds of emails in my haskell-cafe folder marked as new. 

Having announcements separated or in haskell@ would be IMHO a real improvement.

If every announcement or periodic status update (as e.g. HWN) is cross posted 
then there is no need for having two separate mailinglist. And I'd assume there 
is no majority in favor of merging those two mailinglist. 

-- Jean

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


Re: [Haskell-cafe] Haskell Weekly News: Issue 155 - October 20, 2010

2010-10-21 Thread Ketil Malde
Daniel Fischer daniel.is.fisc...@web.de writes:

 I have long been subscribed to -cafe but not to hask...@.
 Regarding why, I wasn't interested in what haskell@ was supposed to be for, 
 while I was interested in what -cafe is for.

The Wiki documents these lists as:

hask...@haskell.org
Announcements, discussion openers, technical questions.
hask...@haskell.org is intended to be a low-bandwidth list, to which
it is safe to subscribe without risking being buried in email. If a
thread becomes longer than a handful of messages, please transfer to
haskell-c...@haskell.org. 

haskell-cafe@haskell.org (archives)
General Haskell questions; extended discussions. 
In Simon Peyton Jones' words: forum in which it's acceptable to ask
anything, no matter how naive, and get polite replies.

I'm not sure I understand your sentiment - if you wish to avoid
announcements or the initial bits of discussions, surely you would be in
favor of not cross-posting them?

A quick (and probably highly inaccurate) count in my inbox tells me that
a little over 700 of about 1200 mails to haskell@ were crossposted to
-cafe, and the latter has received 21000 messages in the same time
frame.

Could we not accept the 2.5% increase in traffic that the remaining 500
messages would mean, and get rid of the cross-postings?

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-21 Thread Michael Snoyman
On Wed, Oct 20, 2010 at 4:51 PM, Yitzchak Gale g...@sefer.org wrote:
 Michael Snoyman wrote:
 [1] http://hackage.haskell.org/package/mime-mail

 Great news! This is an important package.

 It's obviously very preliminary, though. This is not
 trivial to get right - look at the long and colorful
 history of the Python email library, detailed on the
 first page of the library documentation.

 Here are some initial suggestions for improvement:

Thanks for all of these comments, you're bringing up a lot of good
points. I'll go point-by-point below.

 1. The module name Network.Mail.Mime
 is too generic. There will also be a parser someday.
 We should have Types, Parse, and Render in
 separate modules. I expect each of those to grow
 gradually as more features are added.

If it's all going to live in the same package, I would imagine we'd
still want a single module that exports everything anyway. We can
worry more about this when we actually have the extra code, but for
now I think it would just add another module to maintain, plus an
extra few characters people type.

 On the other hand, I think I like the decision to
 re-implement just the features of RFC 2822
 message format needed for everyday MIME
 use rather than building this on top of a more
 generic message type, as is done in Python.
 It simplifies things.

 But are multi-line headers supported properly?
 That's trickier than it looks, there have historically
 been many wrong implementations out there.
 That itself could be a reason to build this on top
 of a proper RFC 2822 implementation.

No, multi-line headers are *not* supported. For that matter, I don't
believe non-ASCII characters in headers are handled properly either.
These would all be welcome patches ;).

 2. mailHeaders should have an Ord instance that
 compares case-insensitively, though the underlying
 Strings should remain Strings.

The main purpose of this package is simply rendering the messages, not
inspecting messages about to be rendered. As such, I'd like to
optimize for that case: adding a newtype wrapper here will simply
require more typing for users. Someone who wants to do a lookup can
always apply a newtype wrapper themselves.

By the way, this is the opposite answer I gave regarding the WAI,
where inspecting headers is very important. If this is something to be
reopened in the future, we should consider the solution used over
there (suggested by Gregory Collins), which stores both a regular and
lower-cased version of the header.

 3. It should be possible to control whether text
 parts get quoted-printable encoded. Perhaps add
 QuotedPrintable to Encoding?

Agree, I just didn't have time or need to implement it.

 4. I don't like having those sendmail things here in
 the same module and package. It's convenient,
 but messy in several ways - creates a spurious
 dependency on process, only works on certain
 platforms and even then with possible weird platform
 dependencies, etc. I think this should be in
 a separate package. Once there is a nice
 easy-to-use SMTP companion package, I
 don't think the sendmail things will be used
 that much anyway. Put them in a separate package,
 but mention it in prominent places so people
 will find it.

I'm not sure that having a process dependency is a problem for anyone.
Isn't it included with GHC? Having it there can be *incredibly* useful
for development systems, where you may not have a full SMTP server but
want to use something like ssmtp, or even a simple shell script that
spits the data into a text file (which is what I do).

Actually, on this topic, it may be convenient to provide such a
sendmailDebug function...

 5. Is the blaze-builder dependency necessary now that
 Bryan has built those techniques into Data.Text?

Yes. The rendered mail body isn't text, it's binary. While it's true
that actual binary data (like image attachments) should be base64
encoded, there's still the case of the message, which could be encoded
any way the user wishes.

 6. Are I18N text-encoded headers supported? That's
 very important, even for simple everyday usage.
 It's a bit complicated, though. That might be another
 reason to build on top of a full RFC 2822 implementation.

Agree, just like multi-line headers. But I'm not sure quite how
complicated it really is; shouldn't it be a single function that
checks for special characters (eg, non-ASCII, newlines) and then
escapes them?

 7. This very simple interface is great for everyday
 use. Think about how to add the less common
 options for more general use, without cluttering up
 the everyday interface - custom parameters for
 Content-Type and Content-Disposition, specifying
 the boundary rather than allowing it to be generated
 automatically, etc. It's important to think about
 those kinds of things now, before the interface
 gets set in cement.

I'm ambivalent about specifying the boundary manually; I can't really
think of a use case outside of testing where it's useful. Keep in mind
that there 

Re: [Haskell-cafe] JavaScript in a browser as a Windows GUI?

2010-10-21 Thread Andrew Coppin

 On 21/10/2010 01:28 AM, Anton van Straaten wrote:

Andrew Coppin wrote:

I'd like to have a go at writing CGI in Haskell.

...

Does anybody know of a solution that works on Windows?


I've previously run Happstack on Windows.  That was a couple of years 
ago, though, so I don't know whether its Windows support is currently 
working.




My understanding is that Happstack is a very large, powerful and complex 
framework for writing Haskell web applications. I was under the 
impression that you use it by statically linking the HTTP server and the 
actual application together, rather than Happstack providing a standard 
CGI interface that an external application can then use.


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


Re: [Haskell-cafe] Haskellers.com skills list moderation?

2010-10-21 Thread Michael Snoyman
In case anyway was worried, I *have* been following this thread, and
purposely not sticking my nose in to see what people's opinions are.
I've really appreciated the discussion; let me give my overall
response to everything:

It's good to remember that a user can always add whatever information
they want to their self-description. The main reason for the skills
list is so that employers and anyone else seeking Haskellers can
easily get a list of people. As such, the skills should be something
informative that people really want to search for.

I'm pretty convinced that Mathematics as-is is a bad idea. I can't
imagine *anyone* saying I want a Haskeller who knows math (maths for
you Brits), it just doesn't say anything.

We also need to make things much more explicit. Cabal, packaging,
build and distribution tools really doesn't explain whether it means
I can tweak Cabal, or if I can write a cabal file, or if I can build
something that's on Hackage. The breakdown John Lato gave (Cabal
internals and Software packaging/distribution tools) sounds good to
me.

On this one you may call be biased, but I think keeping Happstack and
Yesod on their own makes perfect sense. If I were an employer looking
to hire someone to work on a project, I would be looking to see that
they can use my tool of choice. Obviously we need to draw a line
somewhere; putting up that you can use the failure package seems silly
(I'm purposely picking on one of my own packages). But the web
frameworks are entire ecosystems of their own, and I think it makes
sense to keep them as-is.

The issue of having to judge something in which I'm not an expert is
definitely true. I don't have any experience with Attribute Grammar,
for instance, and so feel ill-equipped to make a judgement on that.
I'll trust the list on this, which seems to indicate leaving it in.
I'll probably need to ask similar questions in the future.

I also like the idea of dropping skills that everyone has. Algorithmic
Problem Solving may very well fit in that category.

Finally, the idea of a certification process is great. But I'm not
going to do it ;).

If I don't hear any major complaining in the next few hours, I'll
implement what I've said above.

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


[Haskell-cafe] Haskellers design

2010-10-21 Thread Michael Snoyman
I've gotten two offers for designs for Haskellers. The one uses the
Haskell color theme choices we seem to be standardizing on as a
community, the other uses a more custom theme. There is a screenshot
of the former[1] and a demo page for the latter[2]. So the questions
are:

* How important is adhering to a standard look?
* Which theme is overall more visually appealing?
* Which theme gives a more professional feel?

Please note that questions 1 and 2 may have different answers. Keep in
mind when evaluating these themes, especially the first, that it is
*not* in finalized form, just an basic idea of what could be. A third
option that I have not pursued yet due to time constraints would be to
leave the layout as-is currently but replace it with the Haskell color
scheme. Yet another option would be to take the second theme mentioned
above and try to force the Haskell color theme on it; I don't find
that a good idea. Options 5 and 6 are leaving the site as it is (both
layout and design), or proposing a totally different layout.

Michael

[1] http://imgur.com/lnkE7.png
[2] http://previasports.com/haskellers_website/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] JavaScript in a browser as a Windows GUI?

2010-10-21 Thread Jeremy Shaw
On Thu, Oct 21, 2010 at 12:04 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:

 My understanding is that Happstack is a very large, powerful and complex
 framework for writing Haskell web applications. I was under the impression
 that you use it by statically linking the HTTP server and the actual
 application together, rather than Happstack providing a standard CGI
 interface that an external application can then use.

powerful - yes! large and complex -- not so much. Though, the lower
bound on complexity is limited by the fundamental complexity of the
web itself.

But, you are correct that happstack does not currently have support
for running CGI executables. I imagine that you could write a CGI
handler (with out modifying the core code) in a few hours (maybe
less). Mostly just a matter of turning the values in the Request type
into a environment variables, and calling the executable?

That said, I am not sure why you want CGI. CGI is only simple in the
sense that it doesn't do anything for you. But that means you have to
handle all the complexity yourself. Perhaps it would be easier to just
learn happstack. It is much better documented now than it was a few
years ago (and some aspects have been simplified). And happstack-state
and happstack-server are now completely independent.

Here is a nice tutorial, http://happstack.com/docs/crashcourse/index.html
The darcs version (which will be released soon) has much better
haddock documentation as well. I would recommend the darcs version for
any new development.

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


Re: [Haskell-cafe] JavaScript in a browser as a Windows GUI?

2010-10-21 Thread Michael Snoyman
On Thu, Oct 21, 2010 at 8:00 PM, Jeremy Shaw jer...@n-heptane.com wrote:
 On Thu, Oct 21, 2010 at 12:04 PM, Andrew Coppin
 andrewcop...@btinternet.com wrote:

 My understanding is that Happstack is a very large, powerful and complex
 framework for writing Haskell web applications. I was under the impression
 that you use it by statically linking the HTTP server and the actual
 application together, rather than Happstack providing a standard CGI
 interface that an external application can then use.

 powerful - yes! large and complex -- not so much. Though, the lower
 bound on complexity is limited by the fundamental complexity of the
 web itself.

 But, you are correct that happstack does not currently have support
 for running CGI executables. I imagine that you could write a CGI
 handler (with out modifying the core code) in a few hours (maybe
 less). Mostly just a matter of turning the values in the Request type
 into a environment variables, and calling the executable?

 That said, I am not sure why you want CGI. CGI is only simple in the
 sense that it doesn't do anything for you. But that means you have to
 handle all the complexity yourself. Perhaps it would be easier to just
 learn happstack. It is much better documented now than it was a few
 years ago (and some aspects have been simplified). And happstack-state
 and happstack-server are now completely independent.

 Here is a nice tutorial, http://happstack.com/docs/crashcourse/index.html
 The darcs version (which will be released soon) has much better
 haddock documentation as well. I would recommend the darcs version for
 any new development.

Shouldn't it be possible to plug in the happstack-wai experimental
port with Network.Wai.Handler.CGI and then both get the power of
Happstack *and* easy CGI support? And then later on, when ready to
move past CGI it will be easy to move to a better deployment option.

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


Re: [Haskell-cafe] Haskellers design

2010-10-21 Thread Christopher Done
On 21 October 2010 19:54, Michael Snoyman mich...@snoyman.com wrote:
 Please note that questions 1 and 2 may have different answers. Keep in
 mind when evaluating these themes, especially the first, that it is
 *not* in finalized form, just an basic idea of what could be. A third
 option that I have not pursued yet due to time constraints would be to
 leave the layout as-is currently but replace it with the Haskell color
 scheme. Yet another option would be to take the second theme mentioned
 above and try to force the Haskell color theme on it; I don't find
 that a good idea. Options 5 and 6 are leaving the site as it is (both
 layout and design), or proposing a totally different layout.

 Michael

 [1] http://imgur.com/lnkE7.png
 [2] http://previasports.com/haskellers_website/

I like the colour theme of the former and the layout of the latter.
The colour theme of the first is more professional, I think. I vote
that styles should be consistent. When Haskell.org's theme finally
gets updated, Haskell will feel a lot more modern on the web, and
making that feeling go with you across the Haskell sites is important
to me. I would've provided a design myself, expanding upon this,[1] I
suppose, but time constraints are against me. I think layout of the
latter is very good, very obvious. Colours are just a bit fruit salad.

[1]: http://img840.imageshack.us/img840/3577/ideasv.png
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskellers design

2010-10-21 Thread David Virebayre
2010/10/21 Michael Snoyman mich...@snoyman.com



 * How important is adhering to a standard look?


Important yet it should not feel like it's impossible to try new things


 * Which theme is overall more visually appealing?


2nd


 * Which theme gives a more professional feel?


2nd

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


Re: [Haskell-cafe] Haskellers design

2010-10-21 Thread Gregory Collins
Christopher Done chrisd...@googlemail.com writes:

 I like the colour theme of the former and the layout of the latter.

Precisely what I was going to say.

G
-- 
Gregory Collins g...@gregorycollins.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskellers.com skills list moderation?

2010-10-21 Thread Jeremy Shaw
On Thu, Oct 21, 2010 at 12:16 PM, Michael Snoyman mich...@snoyman.com wrote:
 On this one you may call be biased, but I think keeping Happstack and
 Yesod on their own makes perfect sense. If I were an employer looking
 to hire someone to work on a project, I would be looking to see that
 they can use my tool of choice.

For the web development frameworks I think it makes sense to be able
to specify which ones you are comfortable with. It also seems like it
would make sense for them to be a sub-category of general web
development. A large portion of web develop knowledge is portable from
one framework to another. So, if you are hiring someone for a
full-time position, the amount of time it would take for them to learn
a different framework would be small in the big picture. But if you
want to hire someone to do a few hours of work, then already knowing
the framework could be critical.

But, I am not sure if sub-categories make sense for other skills. So,
adding that for sake of just one skill would be ugly.

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


Re: [Haskell-cafe] Haskellers design

2010-10-21 Thread Nubis
Hi guys,
I'm the author of that second design, although I'm not really a designer.
I'll try a variation using colors that resemble the 'official' ones so you
can choose which one you like better.
The thing is the current proposal uses 4 indicative colors and a greyscale
for the rest.
Green for general highlighting: Used in the overview section and all the
non-work related sections of the site.
Blue for haskellers, information mostly reelevant to people looking for
haskellers is in that color, so the 'find a haskeller' section and usernames
are in that color for example.
Orange for jobs, if you're looking for a job everything that's in orange may
be interesting to you.
Red is for site alerts or messages that prompt you to do something, like
registering or notifying you should add your screen name to your profile.

I think maybe I can use some shade of grey to replace green and red, and use
the 'official' maroon (red?) and blueish instead of red and blue.

Not that I want to start a debate, but below are my views on having an
official look, as I shared in a private conversation a few days back:

I'm not sold on the benefits of having the same palette across all sites.
I think the point mark Lentczner Makes about using different layouts also
applies to colors.
Colors also carry a message, they let you know for example if a website is
informal, technical, institutional, etc.
Visual consistency helps usability a lot, I probably wouldn't have different
layouts and colors for different parts of the same site. To me, everything
that's inside the same domain name should look consistent.
The other benefit of consistency is for brand recognition, ACME would make
their paper towels and soap look related, so if you like ACME's soap you're
more inclined towards buying also their paper towels instead of their
competitor's. Even then, some companies make some products look totally
unrelated so if the new product fails it doesn't hurt their other products
perception.
I don't think we need brand consistency since we don't have a central
authority to respond to, the only thing we have in common is haskell, we
even have several implementations, and we may as well have several projects
doing the same thing in different ways in our quest for the best.
Some people may even look for consistency with different things, someone may
try to mimic the design on linked.in for a strictly job-board like website,
or google's for a haskell search engine ( hehe :)
In some other places, consistency may be downright harmful and get you
confused about the site you're on. It's like those projects who keep their
documentation in 'trac's default theme and you don't know right away what
you're looking at or where you saw that snippet you need to use again. Local
user group's sites are another example, every local user group has their own
personality, and if consistent, we'll end up with a lot of sites that look
confusing and boringly similar.
I think we should rather err on the side of accepting much needed
contributions, and leaving it up to each developer to evaluate their
project's affinity with other projects in the community to mimic their color
scheme and even their layout as they see fit. Access to graphics sources
would be of great help for this.
All in all, I think design inconsistency makes it look friendlier for people
to contribute and shows the diversity we have in the haskell community. Both
are among the main reasons communities like ruby's and python's became so
widespread.


Cheers!
nubis :)

On Thu, Oct 21, 2010 at 3:41 PM, Gregory Collins g...@gregorycollins.netwrote:

 Christopher Done chrisd...@googlemail.com writes:

  I like the colour theme of the former and the layout of the latter.

 Precisely what I was going to say.

 G
 --
 Gregory Collins g...@gregorycollins.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] [ANNAUNCE] ghcjs-0.1.0 Haskell to Javascript compiler

2010-10-21 Thread Christopher Done
On 21 October 2010 01:01, Victor Nazarov asviraspossi...@gmail.com wrote:
 I've been working on this for some month and I think now I'm ready to
 share the results.

 http://github.com/sviperll/ghcjs

This is very cool, as a web developer I have a lot of interest in
this. All GHC's extensions is a fantastic incentive to use Haskell
with target language of JavaScript.

I'm testing it out now. Seems to compile okay with 6.12.3. Don't have
time to figure out how to run it right now, but I'll check back later!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Convert Either to Tree - Occurs check

2010-10-21 Thread André Batista Martins
hello,
 i want convert  Either to a tree.
 Example:
  Either ( Either  1 2 ) ( Either 3 4)  
Branch ( Branch (Leafl 1)  (Leafr2) ) ( Branch (Leafl 3)  (Leafr4)) )



Code:
data TreeE a b  = Empty |Leafl a | Leafr b | Branch (TreeE a b ) (TreeE a b)
deriving Show

f3 (Right b) (Branch l r) =case( isRight(b) || isLeft(b) )of
true - Branch l (f3 b r)
false - Branch l (Leafl b)
f3 (Left b) (Branch l r) = case( isRight(b) || isLeft(b) )of
true - Branch (f3 b l) r
false - Branch (Leafl b) r

Error:
 Occurs check: cannot construct the infinite type: b = Either a b
  Expected type: Either a b - TreeE t t1 - TreeE t t1
  Inferred type: Either a (Either a b) - TreeE t t1 - t2
In the second argument of `Branch', namely `(f3 b r)'
In the expression: Branch l (f3 b r)

I don't understand why this happen...
Can anyone help me?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskellers.com skills list moderation?

2010-10-21 Thread Michael Snoyman
OK, after reviewing the list again, here's some more that are on the
chopping block, given the new outlook we've been establishing here.
Speak up if you want it saved:

Denotational design
Programming using Arrows
Transactional business applications development
Categorical Programming

On Thu, Oct 21, 2010 at 7:16 PM, Michael Snoyman mich...@snoyman.com wrote:
 In case anyway was worried, I *have* been following this thread, and
 purposely not sticking my nose in to see what people's opinions are.
 I've really appreciated the discussion; let me give my overall
 response to everything:

 It's good to remember that a user can always add whatever information
 they want to their self-description. The main reason for the skills
 list is so that employers and anyone else seeking Haskellers can
 easily get a list of people. As such, the skills should be something
 informative that people really want to search for.

 I'm pretty convinced that Mathematics as-is is a bad idea. I can't
 imagine *anyone* saying I want a Haskeller who knows math (maths for
 you Brits), it just doesn't say anything.

 We also need to make things much more explicit. Cabal, packaging,
 build and distribution tools really doesn't explain whether it means
 I can tweak Cabal, or if I can write a cabal file, or if I can build
 something that's on Hackage. The breakdown John Lato gave (Cabal
 internals and Software packaging/distribution tools) sounds good to
 me.

 On this one you may call be biased, but I think keeping Happstack and
 Yesod on their own makes perfect sense. If I were an employer looking
 to hire someone to work on a project, I would be looking to see that
 they can use my tool of choice. Obviously we need to draw a line
 somewhere; putting up that you can use the failure package seems silly
 (I'm purposely picking on one of my own packages). But the web
 frameworks are entire ecosystems of their own, and I think it makes
 sense to keep them as-is.

 The issue of having to judge something in which I'm not an expert is
 definitely true. I don't have any experience with Attribute Grammar,
 for instance, and so feel ill-equipped to make a judgement on that.
 I'll trust the list on this, which seems to indicate leaving it in.
 I'll probably need to ask similar questions in the future.

 I also like the idea of dropping skills that everyone has. Algorithmic
 Problem Solving may very well fit in that category.

 Finally, the idea of a certification process is great. But I'm not
 going to do it ;).

 If I don't hear any major complaining in the next few hours, I'll
 implement what I've said above.

 Michael

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


[Haskell-cafe] Regression test utility suggestions?

2010-10-21 Thread Peter Schmitz
I am seeking suggestions for a regression test utility or framework
to use while developing in Haskell (in a MS Windows environment).

I am developing a Haskell application that parses an input text file,
and outputs some information about what was parsed.

The application is currently in a GUI, but the parsing/analysis code
does not require any user interaction, so it would be simple to
implement a command-line based version (that could be invoked by a
regression test utility --
http://en.wikipedia.org/wiki/Regression_testing), that takes as
args: the input and output file pathnames.

As I develop, I have a growing set of input files that are used to
test various aspects of the grammar. I am seeking a regression test
utility that I could point at a dir of test input files, and it
would process each input file using my app, creating a corresponding
output file.

The utility would then compare each output file with a known good
output file, and let me somehow review the results (i.e., the
differences), and for each test file (or all of them) allow me to
decide one of:

-- there were no diffs; all is well

-- the diff shows the output changed as I expected, due to coding
enhancements or fixes; take the new output file and use it as the
new good output file

-- oops, unexpected diffs; I need to fix my code and then re-run the
utility afterwards

I have reviewed
http://www.haskell.org/haskellwiki/Introduction_to_QuickCheck and
http://hackage.haskell.org/packages/archive/pkg-list.html#cat:testing
but I did not see anything that seems to fit.

I'm not sure whether (or how) QuickCheck would lend itself to this
type of testing. I don't want to generate any test cases; I have a
manually created collection of test cases that I want to use (which
is all I am interested in, at this point).

In the past I have coded something like this using shell or Perl
scripts, etc. I am wondering if there is a commonly used utility
available for this purpose that you like. (I use a MS Windows
environment, but I have a Bash and various gnu shell utils
installed.)

(It does not matter to me whether it is written in Haskell, although
I suppose that would make it more enjoyable to hack on.  :)

Thanks in advance very much for any suggestions.
-- Peter
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-21 Thread Bit Connor
On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke claus.rei...@talk21.com wrote:
 After it catches this error, the function returns (line 376):

 return (fail (show e))

 The fail is running in the Either monad (The Result type = Either).
 This calls the default Monad implementation of fail, which is just a
 call to plain old error. This basically causes the entire program to
 crash.

 Actually, it appears that simpleHTTP isn't actually supposed to throw
 an IOException, and it is instead supposed to return a ConnError
 result. So the real fix is to fix the code to make this happen. But

 Sounds like a victim of
   http://hackage.haskell.org/trac/ghc/ticket/4159

 For mtl clients, 'fail' for 'Either' used to call 'Left'. That was
 changed, though the ticket does not indicate the library
 versions affected.

This looks like the problem. Any idea how to get the HTTP package
fixed? I could try making a patch myself, but I would prefer hearing
from the HTTP maintainer first, who doesn't seem to be around.

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


[Haskell-cafe] readProcess exception

2010-10-21 Thread Leskó Dániel

Hi everyone!

I run into a problem with readProcessWithExitCode (from System.Process 
module). Basically what i want is to start an exe file, giving it some 
input on stdin and receiving the results on stdout. But id the stdin and 
out is bigger that 5000-7000 char (nondeterministically), i get 
commitAndReleaseBuffer exception and sometimes hFlush exception. I'm 
getting these errors with GHCi 6.12.3, if it matters.


Have you guys any idea what causes the problem, to how to avoid it?

Thanks
Daniel


Here is a dummy example, which produces the exception:
Haskell code:

import System.Process

test = do
result - sequence $ Prelude.map (\x - runOnce x) [1..1]
return ()
where
runOnce :: Int - IO [Int]
runOnce i = do
putStrLn (show i)
a - caller i
b - caller i
return (a++b)

caller a = do
(exit_code,stdout) - readProcessWithExitCode a.exe [show a] 
(unlines (map show [1..850]))

return (read stdout)

C code (for executable)
#include stdio.h
#include complex.h
#include stdlib.h


int main(int argc, char *argv[])
{

printf([%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d],100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, 

100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, 

100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, 

100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, 

100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, 

100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, 


100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100);

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


Re: [Haskell-cafe] Regression test utility suggestions?

2010-10-21 Thread Vo Minh Thu
2010/10/21 Peter Schmitz ps.hask...@gmail.com:
 I am seeking suggestions for a regression test utility or framework
 to use while developing in Haskell (in a MS Windows environment).
 [snip]

Hi,

Have a look at HUnit and, e.g. test-framework.

http://hackage.haskell.org/package/HUnit
http://hackage.haskell.org/package/test-framework

You would have to write some code to read the input and expected
output from files.

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


[Haskell-cafe] HELP

2010-10-21 Thread Yaadallah Khan

I am Studying for an exam, and i have just come accross the following 3 
questions, i am not familiar with the functions, therefore i would appreciate 
any help.
!! i have already created painting 2  3 all i need is the 3 functions, for the 
three different tasks as shown below. the functions are the showPic, sizeRaw 
and isPic.
questions are:
1)  – Define showPic :: Canvas - IO () for displaying pictures on theterminal. 
Examples:
Cw2010 showPic (painting 2)+---+---+---+---+---+| a | n | e | x | a 
|+---+---+---+---+---+| m | p | l | e | t |+---+---+---+---+---+| e | x | t | i 
| s |+---+---+---+---+---+| s | h | o | w | n |+---+---+---+---+---+
Cw2010 showPic (painting 3)+---+---+---+---+---+---+---+| A | n | o | t | h | 
e | r |+---+---+---+---+---+---+---+| | t | e | s | t | ! | 
|+---+---+---+---+---+---+---+
2)  – Furthermore, define sizeRaw :: Canvas - (Int, Int) for findingout the 
size of a raw picture as demonstrated here.Cw2010 sizeRaw 
[anexa,mplet,extis,shown](5,4)
3)  – Finally, define isPic :: Canvas - Bool for checking a 
particularnecessary condition which items of type Canvas must satisfy (full 
orraw). The condition you should check for is whether all the ‘rows’ ofthe 
input have the same length. (It may be assumed that the inputof isPic is of 
type Canvas.) Examples:
Cw2010 isPic (painting 3)TrueCw2010 isPic (painting 4)False
Suggestion. I found it useful in my implementation to define and usehere the 
auxiliary function isEqual :: [Int] - Bool; example:
Cw2008 isEqual [8,8,8,8]TrueCw2008 isEqual [8,8,4,8]FalseYou may wish to 
define and use isEqual in your implementation ofisPic too.  
   ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HELP

2010-10-21 Thread Brian Troutwine
I'm not sure what you're asking for; it looks like you have to
implement the functions from the specifications.

On Thu, Oct 21, 2010 at 6:11 PM, Yaadallah Khan yk...@hotmail.com wrote:
 I am Studying for an exam, and i have just come accross the following 3
 questions, i am not familiar with the functions, therefore i would
 appreciate any help.
 !! i have already created painting 2  3 all i need is the 3 functions, for
 the three different tasks as shown below. the functions are the showPic,
 sizeRaw and isPic.
 questions are:
 1)  – Define showPic :: Canvas - IO () for displaying pictures on the
 terminal. Examples:
 Cw2010 showPic (painting 2)
 +---+---+---+---+---+
 | a | n | e | x | a |
 +---+---+---+---+---+
 | m | p | l | e | t |
 +---+---+---+---+---+
 | e | x | t | i | s |
 +---+---+---+---+---+
 | s | h | o | w | n |
 +---+---+---+---+---+
 Cw2010 showPic (painting 3)
 +---+---+---+---+---+---+---+
 | A | n | o | t | h | e | r |
 +---+---+---+---+---+---+---+
 | | t | e | s | t | ! | |
 +---+---+---+---+---+---+---+
 2)  – Furthermore, define sizeRaw :: Canvas - (Int, Int) for finding
 out the size of a raw picture as demonstrated here.
 Cw2010 sizeRaw [anexa,mplet,extis,shown]
 (5,4)
 3)  – Finally, define isPic :: Canvas - Bool for checking a particular
 necessary condition which items of type Canvas must satisfy (full or
 raw). The condition you should check for is whether all the ‘rows’ of
 the input have the same length. (It may be assumed that the input
 of isPic is of type Canvas.) Examples:
 Cw2010 isPic (painting 3)
 True
 Cw2010 isPic (painting 4)
 False
 Suggestion. I found it useful in my implementation to define and use
 here the auxiliary function isEqual :: [Int] - Bool; example:
 Cw2008 isEqual [8,8,8,8]
 True
 Cw2008 isEqual [8,8,4,8]
 False
 You may wish to define and use isEqual in your implementation of
 isPic too.
 ___
 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] playing around with network.curl - redub

2010-10-21 Thread Michael Litchard
My current problem is how to pass around the cookie jar. I need to
gather cookies, while establishing a session. Could someone provide an
example? I've messed about with
CurlCookieFile and CurlCookieJar, to no avail. I'll provide my failed
attempt if needed. I'm using https, if it makes a difference.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Convert Either to Tree - Occurs check

2010-10-21 Thread Dan Piponi
André Batista Martins asked:

  i want convert  Either to a tree.
  Example:
   Either ( Either  1 2 ) ( Either 3 4)  
 Branch ( Branch (Leafl 1)  (Leafr2) ) ( Branch (Leafl 3)  (Leafr4)) )

Before writing the function to convert your data structure, why not
try writing down the precise type signature you expect it to have.

In fact, before that, try writing down the precise type signature of
the thing you call an Either.
--
Dan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] suspected problem with network.curl version 1.3.5

2010-10-21 Thread Michael Litchard
Here's my code, I'm pretty sure I am doing this right. The problem
seems to be with method_POST. I tried to duplicate manually, but I'm
not sure I used command line curl correctly. Take a look at the output
below.

 import Network.Curl
 import System (getArgs)
 import Text.Regex.Posix

 -- | Standard options used for all requests. Uncomment the @CurlVerbose@
 -- option for lots of info on STDOUT.
 opts = [ CurlCookieJar cookies , CurlVerbose True ]

 -- | Additional options to simulate submitting the login form.
 loginOptions user pass =
   CurlPostFields [ login= ++ user, password= ++ pass ] : method_POST

 main = withCurlDo $ do
   -- Get username and password from command line arguments (will cause
   -- pattern match failure if incorrect number of args provided).
   [user, pass] - getArgs

   -- Initialize curl instance.
   curl - initialize
   setopts curl opts

   -- POST request to login.
   r - do_curl_ curl https://github.com/login; (loginOptions user pass)
 :: IO CurlResponse
   if respCurlCode r /= CurlOK || respStatus r /= 200
 then error $ Failed to log in: 
++ show (respCurlCode r) ++  --  ++ respStatusLine r
 else do
   -- GET request to fetch account page.
   r - do_curl_ curl (https://github.com/session;) method_GET
 :: IO CurlResponse
   if respCurlCode r /= CurlOK || respStatus r /= 200
 then error $ Failed to retrieve account page: 
++ show (respCurlCode r) ++  --  ++ respStatusLine r
 else putStrLn $ extractToken $ respBody r
 -- | Extracts the token from GitHub account HTML page.
 extractToken body = head' GitHub token not found xs
   where
 head' msg l = if null l then error msg else head l
 (_,_,_,xs)  = body =~ github\\.token (.+)
:: (String, String, String,[String])

* About to connect() to github.com port 443 (#0)
*   Trying 207.97.227.239... * connected
* Connected to github.com (207.97.227.239) port 443 (#0)
* found 142 certificates in /etc/ssl/certs/ca-certificates.crt
*server certificate verification SKIPPED
*common name: *.github.com (matched)
*server certificate expiration date OK
*server certificate activation date OK
*certificate public key: RSA
*certificate version: #3
*subject: O=*.github.com,OU=Domain Control Validated,CN=*.github.com
*start date: Fri, 11 Dec 2009 05:02:36 GMT
*expire date: Thu, 11 Dec 2014 05:02:36 GMT
*issuer: C=US,ST=Arizona,L=Scottsdale,O=GoDaddy.com\,
Inc.,OU=http://certificates.godaddy.com/repository,CN=Go Daddy Secure
Certification Authority,serialNumber=07969287
*compression: NULL
*cipher: AES-128-CBC
*MAC: SHA1
 GET /login HTTP/1.1
Host: github.com
Accept: */*
snip

See, the code set a GET, where I thought I was doing a POST

here is my attempt to do a POST manually, it failed but I'm not sure it's right.
curl --data 
authenticity_token=BigAssTokenlogin=UserNamepassword=Passwordcommit=Log+in
https://github.com/login  login_out

anyway, could someone try to replicate this problem?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] [ANNOUNCE] text 0.10.0.0 - fast Unicode text handling

2010-10-21 Thread Bryan O'Sullivan
[Blog copy of the announcement
herehttp://www.serpentine.com/blog/2010/10/22/text-0-10-0-0-is-here/
.]

I just pushed it to bitbucket http://bitbucket.org/bos/text and
githubhttp://github.com/bos/text,
and you can install it from the text site on
Hackagehttp://hackage.haskell.org/package/text in
the usual way:

cabal update
cabal install text

What's in this release?

   -

   New functions for reading integers and floating point
numbershttp://hackage.haskell.org/packages/archive/text/0.10.0.0/doc/html/Data-Text-Read.html,
   an oft-requested feature. They're fast, too: they range from parity with
   their bytestring counterparts, to up to 4 times faster. You can expect to
   parse 3 to 4 million Int values per second out of a text file, or up 2
   million Double values per second. They're also easy to use, give error
   messages, and come in strict and lazy variants.
   -

   UTF-8 decoding and encoding are now very
fasthttp://www.serpentine.com/blog/2010/10/15/unicode-text-performance-improvements/.
   They're up to 9x faster than they were, and close to the performance of pure
   C UTF-8 decoding and encoding.
   -

   The Eq and Ord instances are also now very fast, up to 5x faster than
   
beforehttp://www.serpentine.com/blog/2010/10/19/a-brief-tale-of-faster-equality/.
   They're now faster than the bytestring instances.
   -

   Several other common functions received drive-by performance improvements
   too.
   -

   Better protection against rare crashes on really huge volumes of data.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe