Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Radosław Grzanka
2008/2/24, Daniel Fischer <[EMAIL PROTECTED]>:
> Hi all,
>  I try not to be too rude, although I'm rather disgusted.
>  I know there are several sites out on the web where solutions to PE problems
>  are given. That is of course absolutely against the sporting spirit of
>  Project Euler,

Actually, I've found this solutions pretty usefull. After I solved
another PE problem I went there to find out how newbie I still was!
And I've learned really huge amout of usefull stuff.

In fact, I've put my own solution there because the one that was
already on site was crappy against my newbie stuff. I hope it will be
helpfull to someone else.

If you are afraid about spoiling "sport spirit" of PE by someone that
just copies the solution then you are naive. Just google for answer.
If you are in compete with someone on PE I'm sure that if he doesn't
want to be fair then he won't be fair and removing this site won't
help it.

Another issue is submitting someone else's code. This would anger me
personally a lot! If you have evidence of such behaviour then I would
vote for removing the suspected stuff immiedietly.

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


Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Cale Gibbard
Hello,

It seems that I'm getting sucked into this argument solely due to my
unwillingness to allow people to damage useful content that has been
added to the Haskell wiki.

This started a couple of weeks ago when a user by the name Marypoppins
decided to arbitrarily remove all the Euler Problems solutions from
the wiki. I treated this as vandalism and immediately reverted all the
changes.

I'd like to state up front that I otherwise have no personal stake in
this, since the solutions pages are not ones that I've made
significant contributions to, nor have I even spent a significant
amount of time working on Project Euler problems. (They have not
enough universal quantifiers in them for my tastes.)

I do however, think it's important to not allow valid contributions to
the wiki to be damaged by people without good reason.

On 23/02/2008, Daniel Fischer <[EMAIL PROTECTED]> wrote:
> Hi all,
>  I try not to be too rude, although I'm rather disgusted.
>  I know there are several sites out on the web where solutions to PE problems
>  are given. That is of course absolutely against the sporting spirit of
>  Project Euler, but hey, not all people are sporting.
>  I've found http://www.haskell.org/haskellwiki/Euler_problems irritating for a
>  while, but wasn't overly annoyed by it while it only contained code for
>  solving a few dozen problems.
>  Today I learnt that it now contains code for all problems.
>  Really bad!

Why is this even the least bit bad? If you publish a bunch of
problems, expect people to publish a bunch of solutions to them. They
will do this regardless of what you demand, since there's educational
value to others in doing so.

If you're running a contest and you don't want people to be able to
look up all the solutions, then simply produce a bunch of problems to
which nobody has the solution, and make them available all at once,
with a time limit on solving them. If you want to see how this is done
correctly, have a look at what the ICFP does.

If Project Euler is instead, not a contest, as people on the Talk
pages on the wiki have claimed, then nobody should have any problem
with publishing solutions, as the only person one could possibly cheat
by looking up the solution is oneself. However, if one had already
given up on solving said problem, then there would likely be
significant educational value in reading a solution to it.

>  On top of that, the code for many problems isn't even Haskell, but C, WTF!

This indeed is a problem, as it is the Haskell wiki after all.
However, I feel that it's more valuable to keep such solutions until
such time as their Haskell counterparts are made available.

>  Other code was submitted without consent of the author, copied from the PE
>  fora, which are restricted access and so, even if perhaps not legally, but in
>  spirit, do not fall under the legitimate resources for haskellwiki:
>  "You are also promising us that you wrote this yourself, or copied it from a
>  public domain or similar free resource. DO NOT SUBMIT COPYRIGHTED WORK
>  WITHOUT PERMISSION!"

This is a legitimate concern. If the copyright of the original authors
can be proved, said solutions should indeed be removed. However, any
claim that the content as a whole, or the list of numeric solutions
violates the copyright of PE is clearly ridiculous. The problem
statements do not appear on the wiki, and the exact solutions, even if
PE were to publish them (that list doesn't appear to be anywhere on
the PE site), clearly qualifies as fair use.

>  To make matters worse still, there was a page containing nothing but the
>  answers. That was changed, but Cale chose to reintroduce that crap.
>  I just removed it again. Your turn, Cale.

I will not tolerate people coming along and arbitrarily blanking pages
for inappropriate reasons like this. Sorry. Such a list of solutions
would be useful to someone working on the problems, as a fast way to
check their solutions, for instance. It doesn't harm people wanting to
solve the problems on their own, as they can simply avoid looking at
it.

>  I call on the Haskell community to vote for immediate removal of these pages
>  from the wiki!
>  Show that you're a sporting bunch.

I call for the opposite. Sorry.

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


[Haskell-cafe] Binary IEEE floating point format for AMQP

2008-02-24 Thread Paul Johnson
I'm working on an implementation of the framing layer for AMQP 
(www.amqp.org).  I almost had 0.9 finished when I found they had 
released the spec for 0.10, so I have to redo quite a lot of work.


Amongst the new features of 0.10 are wire formats for floating point.  
These are the 4 and 8 byte IEEE formats.


* Is there a principled way of converting a Haskell Float or Double (or 
Rational, for that matter) to and from IEEE format?


* Since many computers use IEEE format natively, is there a quicker way 
of doing this on those architectures?


Paul.


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


Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Daniel Fischer
Am Sonntag, 24. Februar 2008 11:37 schrieb Cale Gibbard:
> Hello,
>
> It seems that I'm getting sucked into this argument solely due to my
> unwillingness to allow people to damage useful content that has been
> added to the Haskell wiki.

I'm sorry, I was angry that someone posted my code on that page and 
over-reacted. I apologize.

>
> This started a couple of weeks ago when a user by the name Marypoppins
> decided to arbitrarily remove all the Euler Problems solutions from
> the wiki. I treated this as vandalism and immediately reverted all the
> changes.
>
> I'd like to state up front that I otherwise have no personal stake in
> this, since the solutions pages are not ones that I've made
> significant contributions to, nor have I even spent a significant
> amount of time working on Project Euler problems. (They have not
> enough universal quantifiers in them for my tastes.)
>
> I do however, think it's important to not allow valid contributions to
> the wiki to be damaged by people without good reason.

Agreed, and the page with the code may indeed be considered a valid 
contribution. However, it certainly would be more valuable if it wasn't bare 
code, but also included explanations of the mathematical or programmatical 
ideas behind it.

The page with just the answers I cannot but find worthless.


> Why is this even the least bit bad? If you publish a bunch of
> problems, expect people to publish a bunch of solutions to them. They
> will do this regardless of what you demand, since there's educational
> value to others in doing so.

The educational value would be more visible if the code was explained, but 
okay.

> If Project Euler is instead, not a contest, as people on the Talk
> pages on the wiki have claimed, then nobody should have any problem
> with publishing solutions, as the only person one could possibly cheat
> by looking up the solution is oneself. However, if one had already
> given up on solving said problem, then there would likely be
> significant educational value in reading a solution to it.
>
> >  On top of that, the code for many problems isn't even Haskell, but C,
> > WTF!
>
> This indeed is a problem, as it is the Haskell wiki after all.
> However, I feel that it's more valuable to keep such solutions until
> such time as their Haskell counterparts are made available.

I disagree, more valuable would be an explanation of the ideas behind it, and 
perhaps contrasting a C (python,...) programme with a Haskell one to 
highlight the different approaches.

>
> >  Other code was submitted without consent of the author, copied from the
> > PE fora, which are restricted access and so, even if perhaps not legally,
> > but in spirit, do not fall under the legitimate resources for
> > haskellwiki: "You are also promising us that you wrote this yourself, or
> > copied it from a public domain or similar free resource. DO NOT SUBMIT
> > COPYRIGHTED WORK WITHOUT PERMISSION!"
>
> This is a legitimate concern. If the copyright of the original authors
> can be proved, said solutions should indeed be removed.

PE has a share-alike license, the very least to be demanded if someone posts 
other's code is proper attribution. 

Daniel

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


Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Philippa Cowderoy
On Sun, 24 Feb 2008, Daniel Fischer wrote:

> Agreed, and the page with the code may indeed be considered a valid 
> contribution. However, it certainly would be more valuable if it wasn't bare 
> code, but also included explanations of the mathematical or programmatical 
> ideas behind it.
> 
> The page with just the answers I cannot but find worthless.
> 

As this is a wiki we're talking about, feel free to add content? Taking 
things off it because they're not everything you want them to be is 
definitely not appropriate, and "not valuable enough yet" generally has 
little place in discussions about whether content belongs.

-- 
[EMAIL PROTECTED]

"I think you mean Philippa. I believe Phillipa is the one from an
alternate universe, who has a beard and programs in BASIC, using only
gotos for control flow." -- Anton van Straaten on Lambda the Ultimate
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Rodrigo Queiro
The only time I have found the solutions page useful is when I was working
on problem 100, which I'd been thinking about on and off for several months.
Eventually, I gave up and looked at the solution there, and was absolutely
none the wiser as to how it was solved! I thought about it more over the
next few months, and eventually just copied and ran that program, put it
into PE, and looked at the forum, and finally understood how I should have
solved the problem.

Without the solutions page, I would probably never have been able to solve
the problem, and would know even less about Diophantine Equations than I
currently do. However, the only value was the actual numerical solution,
since when I have solved a problem myself and want to see if my answer could
be improved, I just look in the forum where I can see a range of methods of
solution instead of just one.

That said, I vote to keep the solutions (providing they are written by the
page editor) since IMO they do no harm.

On 24/02/2008, Daniel Fischer <[EMAIL PROTECTED]> wrote:
>
> Am Sonntag, 24. Februar 2008 11:37 schrieb Cale Gibbard:
>
> > Hello,
> >
> > It seems that I'm getting sucked into this argument solely due to my
> > unwillingness to allow people to damage useful content that has been
> > added to the Haskell wiki.
>
>
> I'm sorry, I was angry that someone posted my code on that page and
> over-reacted. I apologize.
>
>
> >
> > This started a couple of weeks ago when a user by the name Marypoppins
> > decided to arbitrarily remove all the Euler Problems solutions from
> > the wiki. I treated this as vandalism and immediately reverted all the
> > changes.
> >
> > I'd like to state up front that I otherwise have no personal stake in
> > this, since the solutions pages are not ones that I've made
> > significant contributions to, nor have I even spent a significant
> > amount of time working on Project Euler problems. (They have not
> > enough universal quantifiers in them for my tastes.)
> >
> > I do however, think it's important to not allow valid contributions to
> > the wiki to be damaged by people without good reason.
>
>
> Agreed, and the page with the code may indeed be considered a valid
> contribution. However, it certainly would be more valuable if it wasn't
> bare
> code, but also included explanations of the mathematical or programmatical
> ideas behind it.
>
> The page with just the answers I cannot but find worthless.
>
>
>
> > Why is this even the least bit bad? If you publish a bunch of
> > problems, expect people to publish a bunch of solutions to them. They
> > will do this regardless of what you demand, since there's educational
> > value to others in doing so.
>
>
> The educational value would be more visible if the code was explained, but
> okay.
>
>
> > If Project Euler is instead, not a contest, as people on the Talk
> > pages on the wiki have claimed, then nobody should have any problem
> > with publishing solutions, as the only person one could possibly cheat
> > by looking up the solution is oneself. However, if one had already
> > given up on solving said problem, then there would likely be
> > significant educational value in reading a solution to it.
> >
> > >  On top of that, the code for many problems isn't even Haskell, but C,
> > > WTF!
> >
> > This indeed is a problem, as it is the Haskell wiki after all.
> > However, I feel that it's more valuable to keep such solutions until
> > such time as their Haskell counterparts are made available.
>
>
> I disagree, more valuable would be an explanation of the ideas behind it,
> and
> perhaps contrasting a C (python,...) programme with a Haskell one to
> highlight the different approaches.
>
>
> >
> > >  Other code was submitted without consent of the author, copied from
> the
> > > PE fora, which are restricted access and so, even if perhaps not
> legally,
> > > but in spirit, do not fall under the legitimate resources for
> > > haskellwiki: "You are also promising us that you wrote this yourself,
> or
> > > copied it from a public domain or similar free resource. DO NOT SUBMIT
> > > COPYRIGHTED WORK WITHOUT PERMISSION!"
> >
> > This is a legitimate concern. If the copyright of the original authors
> > can be proved, said solutions should indeed be removed.
>
>
> PE has a share-alike license, the very least to be demanded if someone
> posts
> other's code is proper attribution.
>
>
> Daniel
>
>
> ___
> 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] haskellwiki and Project Euler

2008-02-24 Thread Cale Gibbard
On 24/02/2008, Daniel Fischer <[EMAIL PROTECTED]> wrote:
> Am Sonntag, 24. Februar 2008 11:37 schrieb Cale Gibbard:
>  > This is a legitimate concern. If the copyright of the original authors
>  > can be proved, said solutions should indeed be removed.
>
> PE has a share-alike license, the very least to be demanded if someone posts
>  other's code is proper attribution.
>

To clarify, everything on the wiki is implicitly published under a
simple permissive license which is avilable here:

http://haskell.org/haskellwiki/HaskellWiki:Copyrights

If code cannot be made available under that license, it indeed should
be removed.

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


Re: [Haskell-cafe] Haskell + Windows Mobile?

2008-02-24 Thread Felix Martini
Bulat Ziganshin wrote:
>  is there any haskell implementation for Windows Mobile? does they are
>  support creation of GUI apps and internet networking features?

CeGCC (http://cegcc.sourceforge.net/) is a cross compiler for Windows
CE, so it's possible to port GHC to Windows Mobile with some effort.
But for GUI applications i personally would use C# and Microsoft's
development tools.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Philippa Cowderoy
On Sun, 24 Feb 2008, Daniel Fischer wrote:

> b) posting C/C++ code there indicates that the reason for that is to be a 
> spoil-sport, not to further learning/thinking Haskell.
> 

No, it doesn't. It provides code that people can port - an obvious step in 
building a more complete wiki page.

-- 
[EMAIL PROTECTED]

"The reason for this is simple yet profound. Equations of the form
x = x are completely useless. All interesting equations are of the
form x = y." -- John C. Baez
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Philippa Cowderoy
On Sun, 24 Feb 2008, Daniel Fischer wrote:

> Hi all,
> I try not to be too rude, although I'm rather disgusted.
> I know there are several sites out on the web where solutions to PE problems 
> are given. That is of course absolutely against the sporting spirit of 
> Project Euler, but hey, not all people are sporting.

What sporting spirit? The site itself doesn't indicate any such thing 
whatsoever and doesn't ask that people don't post solutions - as such, 
anything you have to say here is entirely about the culture on the forums 
there, not the problem set itself.

As such, you've taken it upon yourself to enforce the spirit of your PE 
participation upon others. That's far from sporting and in direct 
violation of the spirit of the wiki. Let people play how they choose.

> Other code was submitted without consent of the author

Can you demonstrate this? A statement from the author that they didn't 
consent, for example?

-- 
[EMAIL PROTECTED]

'In Ankh-Morpork even the shit have a street to itself...
 Truly this is a land of opportunity.' - Detritus, Men at Arms
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Chaddaï Fouché
2008/2/24, Rodrigo Queiro <[EMAIL PROTECTED]>:
> The only time I have found the solutions page useful is when I was working
> on problem 100, which I'd been thinking about on and off for several months.
> Eventually, I gave up and looked at the solution there, and was absolutely
> none the wiser as to how it was solved! I thought about it more over the
> next few months, and eventually just copied and ran that program, put it
> into PE, and looked at the forum, and finally understood how I should have
> solved the problem.
>
> Without the solutions page, I would probably never have been able to solve
> the problem, and would know even less about Diophantine Equations than I
> currently do. However, the only value was the actual numerical solution,
> since when I have solved a problem myself and want to see if my answer could
> be improved, I just look in the forum where I can see a range of methods of
> solution instead of just one.
>
> That said, I vote to keep the solutions (providing they are written by the
> page editor) since IMO they do no harm.

I agree with this (I personally contributed some small solutions and
tried to at least comment them a minimum), but I noticed a smartass
replaced valid solutions by references to the sequences dictionary...
As the goal of PE is to solve the question by program (at least in my
understanding), I feel this qualify as vandalism... especially as the
program replaced whatever their value were in Haskell whereas the
sequence dictionary has no relation to Haskell.

Otherwise I don't see where the fact that this page exists is in any
way harmful or unsporting, I never looked it up before solving a
question by myself but have found it valuable to check my solution
against.

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


Re: [Haskell-cafe] Binary IEEE floating point format for AMQP

2008-02-24 Thread Stefan O'Rear
On Sun, Feb 24, 2008 at 12:21:00PM +, Paul Johnson wrote:
> I'm working on an implementation of the framing layer for AMQP 
> (www.amqp.org).  I almost had 0.9 finished when I found they had released 
> the spec for 0.10, so I have to redo quite a lot of work.
>
> Amongst the new features of 0.10 are wire formats for floating point.  
> These are the 4 and 8 byte IEEE formats.
>
> * Is there a principled way of converting a Haskell Float or Double (or 
> Rational, for that matter) to and from IEEE format?
>
> * Since many computers use IEEE format natively, is there a quicker way of 
> doing this on those architectures?

{-# LANGUAGE MagicHash #-}
import Data.Int
import GHC.Exts

foo :: Double -> Int64 --ghc only
foo (D# x) = I64# (unsafeCoerce# x)

Stefan


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


Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Cale Gibbard
On 24/02/2008, Chaddaï Fouché <[EMAIL PROTECTED]> wrote:
> 2008/2/24, Rodrigo Queiro <[EMAIL PROTECTED]>:
> >
>  > That said, I vote to keep the solutions (providing they are written by the
>  > page editor) since IMO they do no harm.
>
>
> I agree with this (I personally contributed some small solutions and
>  tried to at least comment them a minimum), but I noticed a smartass
>  replaced valid solutions by references to the sequences dictionary...
>  As the goal of PE is to solve the question by program (at least in my
>  understanding), I feel this qualify as vandalism... especially as the
>  program replaced whatever their value were in Haskell whereas the
>  sequence dictionary has no relation to Haskell.
>

I encourage you to put your solutions back up, that would be good.
Referencing OEIS is a bit of a cheesy way to do things. (Though if
it's going to be done, one could at least make use of the excellent
Math.OEIS library :)

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


Re: [Haskell-cafe] Graphical graph reduction

2008-02-24 Thread Jacques Carette

I think HOPS is what you are looking for
http://www.cas.mcmaster.ca/~kahl/HOPS/

It may advertize itself otherwise, but the main thing you 'see' when 
running programs in fully explicit mode is exactly all the graph reductions.


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


Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Chaddaï Fouché
2008/2/24, Cale Gibbard <[EMAIL PROTECTED]>:
> I encourage you to put your solutions back up, that would be good.
>  Referencing OEIS is a bit of a cheesy way to do things. (Though if
>  it's going to be done, one could at least make use of the excellent
>  Math.OEIS library :)

Indeed !!
But I don't think any of my solutions was replaced, I just noticed this.

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


Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Rodrigo Queiro
What really puzzles me is that while Dan referred to the sporting spirit of
PE, this really doesn't seem to be a spirit embodied by many of the users.
Reading through the forum will reveal the first few posts to be of the form
"wrote a crappy brute force solver for the first few terms, searched OEIS,
'solved'". I really don't understand why someone would do that.

On 24/02/2008, Chaddaï Fouché <[EMAIL PROTECTED]> wrote:
>
> 2008/2/24, Rodrigo Queiro <[EMAIL PROTECTED]>:
>
> > The only time I have found the solutions page useful is when I was
> working
> > on problem 100, which I'd been thinking about on and off for several
> months.
> > Eventually, I gave up and looked at the solution there, and was
> absolutely
> > none the wiser as to how it was solved! I thought about it more over the
> > next few months, and eventually just copied and ran that program, put it
> > into PE, and looked at the forum, and finally understood how I should
> have
> > solved the problem.
> >
> > Without the solutions page, I would probably never have been able to
> solve
> > the problem, and would know even less about Diophantine Equations than I
> > currently do. However, the only value was the actual numerical solution,
> > since when I have solved a problem myself and want to see if my answer
> could
> > be improved, I just look in the forum where I can see a range of methods
> of
> > solution instead of just one.
> >
> > That said, I vote to keep the solutions (providing they are written by
> the
> > page editor) since IMO they do no harm.
>
>
> I agree with this (I personally contributed some small solutions and
> tried to at least comment them a minimum), but I noticed a smartass
> replaced valid solutions by references to the sequences dictionary...
> As the goal of PE is to solve the question by program (at least in my
> understanding), I feel this qualify as vandalism... especially as the
> program replaced whatever their value were in Haskell whereas the
> sequence dictionary has no relation to Haskell.
>
> Otherwise I don't see where the fact that this page exists is in any
> way harmful or unsporting, I never looked it up before solving a
> question by myself but have found it valuable to check my solution
> against.
>
>
> --
> Jedaï
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] how to catch keyboard interrupts?

2008-02-24 Thread Ryan Ingram
This is pretty cool, but I have one warning:

On Sat, Feb 23, 2008 at 4:37 PM, Uwe Hollerbach <[EMAIL PROTECTED]> wrote:
>  > data MyInterrupt = MyInt Int
>  > instance Typeable MyInterrupt where
>  >   typeOf x = typeOf (0 :: Int)

I am pretty sure that this makes Dynamic unsound; you could
accidentally cast from an Int to a MyInterrupt or vice versa.  Try
this instead:

> data MyException = Interrupt deriving Typeable

then you can safely use throwDyn and catchDyn on this type.

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


Re: [Haskell-cafe] how to catch keyboard interrupts?

2008-02-24 Thread Uwe Hollerbach
Thanks, I'll try that. -- Uwe

On 2/24/08, Ryan Ingram <[EMAIL PROTECTED]> wrote:
> This is pretty cool, but I have one warning:
>
>  On Sat, Feb 23, 2008 at 4:37 PM, Uwe Hollerbach <[EMAIL PROTECTED]> wrote:
>  >  > data MyInterrupt = MyInt Int
>  >  > instance Typeable MyInterrupt where
>  >  >   typeOf x = typeOf (0 :: Int)
>
>  I am pretty sure that this makes Dynamic unsound; you could
>  accidentally cast from an Int to a MyInterrupt or vice versa.  Try
>  this instead:
>
>  > data MyException = Interrupt deriving Typeable
>
>  then you can safely use throwDyn and catchDyn on this type.
>
>
>-- ryan
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Graphical graph reduction

2008-02-24 Thread Cale Gibbard
Is there any place that can we download the HOPS program itself? It
unfortunately doesn't seem available from that page.

On 24/02/2008, Jacques Carette <[EMAIL PROTECTED]> wrote:
> I think HOPS is what you are looking for
>
> http://www.cas.mcmaster.ca/~kahl/HOPS/
>
>
> It may advertize itself otherwise, but the main thing you 'see' when
>  running programs in fully explicit mode is exactly all the graph reductions.
>
>
>  Jacques
>
> ___
>  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] haskellwiki and Project Euler

2008-02-24 Thread Yitzchak Gale
Project Euler is excellent, lots of fun, and rewarding.
Thanks to Daniel and all the other members of the team.

Project Euler problems, by their nature, also happen
to be excellent material for teaching and learning Haskell.
Having various solutions to them on the wiki is a
valuable resource for the Haskell community, in my
opinion. Even without the universal quantifiers.

I agree that the best way to get the most benefit out of
Project Euler itself is by following the rules. So I admit to
having added some prominent "spoiler warning" wrappers to
the "Euler Problems" wiki pages some time ago. I haven't
looked there in a while, I hope they're still there. They
help those who want to "do it right" to avoid ruining it
for themselves.

Here are some use cases for Project Euler solutions
posted to our wiki:

1. Haskell newcomers who have already solved the
problems in their (former) favorite language. They'll
be _amazed_ when they see it in Haskell!

2. People who have already solved a problem in
Haskell, and want to see other Haskell solutions
concentrated in one place. Often the forum is
difficult to use in that way.

3. Someone who is using a certain specific problem
for learning to program in Haskell, and has
decided to trade the chance for full enjoyment of
the problem as a Project Euler problem for the
chance for advancement in learning Haskell.
I'm not sure I would recommend that, but it is a
choice that people are free to make, and
appropriate for our wiki if they should so decide.

I am opposed to allowing non-Haskell solutions
on our wiki, except when they are clearly needed for
comparison in order to make a point about Haskell.
General discussions about Project Euler solutions
should go elsewhere, like anything else off-topic.

As for those who want to intentionally cheat - they are
only hurting themselves. As others have pointed out,
there are plenty of other places out there to do it.
If those people think they will earn themselves any
respect that way, I think they are naive. I don't
feel that we should allow them to prevent _us_ from
benefiting just because they decided to do that to
themselves.

So the bottom line is, in my opinion:

o Of course, material that infringes on copyrights
  or licenses must go.
o Non-infringing solutions in Haskell, when wrapped
  in appropriate spoiler warnings, further the cause of
  Haskell without causing any significant damage
  to Project Euler. They should therefore remain.
o Solutions having nothing to do with Haskell are off-topic
  and should not be on our wiki.

I hope this position admits the possibility of a
continued amicable relationship with the Project Euler
team.

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


Re: [Haskell-cafe] Graphical graph reduction

2008-02-24 Thread dainichi
Thank you all for showing interest and responding.

> Check out http://thyer.name/lambda-animator/. Requires Java.

Wow, this is SUCH a cool tool. Best discovery in a long time! I think
I need to brush up on my lambda-calculus, because it took me some time
to figure out what settings to use to get something similar to
Haskell. Function strategy "substitute by name", Argument strategy
"call by need" and Reduce to "weak head normal form" seem to work OK,
though.

One issue, though. When trying out my infinite-list-of-fibs example, I
have an auxiliary function

(define nth (lambda (n xs) (if (= n 0)(head xs)(nth (- n 1) (tail xs)

and this is not behaving the way I want, i.e. like the Haskell function

nth n (x:xs) = if n == 0 then x else nth (n-1) xs

because it doesn't do pattern matching, i.e. it doesn't force the
argument to be evaluated until it fits the x:xs pattern. I can't
figure out to simulate this eager pattern in the lisp that the
lambda-animator uses. This means that if I e.g. do a (nth 8 fibs) in
the animator, I get a long string of tail's before it actually starts
expanding the fibs list...

Anyway, on the side, I also started working on this myself in SML New
Jersey. (Sorry, this will probably make me unpopular here on
Haskell-cafe, but the ability to use references was just too tempting,
and I'm not too experienced with purely functional data structures).
My approach isn't as general, though, I don't have lambda's and
apply's in my syntax tree. I just have functions there as nodes, and
then the application of them has to be implemented as reduction rules.
This approach does make the graph a bit less messy to look at, though.
Also, since I implement the reduction rules myself, the pattern
matching problem described above isn't a problem.

> I think HOPS is what you are looking for
> http://www.cas.mcmaster.ca/~kahl/HOPS/

Yes, HOPS looks very promising. However, I cannot find the download
link either. And Kahl hasn't replied to my email yet.

Again, thank you all for replying.
Kai
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] parsing c

2008-02-24 Thread Evan Martin
I'd like to parse some C headers for a toy project.
It seems like c2hs probably has the functionality I want, but it's not
packaged up as a library.

So two questions: Is there an alternative C-parsing library?  Has
anyone looked into librarifying c2hs's parser?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A little toy of Haskell Trivia

2008-02-24 Thread Steve Lihn
Ross,
I changed the query to "count(distinct package)" and indeed the
"noises" of same package imports are filtered out. The two top-10
lists now look somewhat similar.

GHC only: http://haskell.ecoin.net/cgi-bin/modules.pl?src=ghc
1 Control.Monad 22
2 Data.Char 20
3 System.IO 17
4 Data.List 16
5 Data.Maybe 16
6 System.IO.Unsafe 14
7 Control.Exception 13
8 Foreign.Ptr 11
9 Data.Word 11
10 Foreign.C 11

GHC+HackageDB: http://haskell.ecoin.net/cgi-bin/modules.pl?src=both
1 Control.Monad 178
2 Data.List 132
3 Data.Maybe 113
4 Data.Char 104
5 System.IO 99
6 Control.Exception 98
7 Data.Word 83
8 System.IO.Unsafe 81
9 Foreign 74
10 Data.Map 68

Steve

On Sat, Feb 23, 2008 at 5:25 PM, Ross Paterson <[EMAIL PROTECTED]> wrote:
> On Sat, Feb 23, 2008 at 10:59:40AM -0500, Steve Lihn wrote:
> > I parsed through all the hackagedb
> > modules. I also added the display of repository source (ghc, hdb) and
> > package source. HackageDB is 3-4 times bigger than GHC core. The
> > result is interesting, looking at the most used modules move up and
> > down the rank...
> >
> > http://haskell.ecoin.net/cgi-bin/modules.pl
>
> You'd get a different picture again if you excluded same-package imports.
> Some of the high-ranking modules are used internally in large packages.
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] parsing c

2008-02-24 Thread Adam Langley
On Sun, Feb 24, 2008 at 4:08 PM, Evan Martin <[EMAIL PROTECTED]> wrote:
>  So two questions: Is there an alternative C-parsing library?

You could use gcc-xml[1] with one of the various XML parsers.

[1] http://www.gccxml.org/HTML/Index.html

-- 
Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] parsing c

2008-02-24 Thread Bertram Felgenhauer
Evan Martin wrote:
> So two questions: Is there an alternative C-parsing library?  Has
> anyone looked into librarifying c2hs's parser?

I have split c2hs into three packages once, the remains of CTK
that it uses, the C parser and pretty printer, and c2hs itself.
(I also tried to give the modules more sensible hierarchical names -
CTK would reside in CTK.* and the C stuff in Language.C.*)

However, I found the result fairly hard to use, partly due to CTK
and partly because some aspects of the C ADT that c2hs uses appears
to be designed for c2hs, not as a general purpose C AST. There's
also a lot of room for adding new utility functions for inspecting
the AST.

I'm reluctant to publish the split packages because they really don't
add much value over c2hs and I don't want to create a c2hs fork, or
duplicate effort that goes into improving that code.

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


[Haskell-cafe] Re: static constants -- ideas?

2008-02-24 Thread Don Stewart
jay:
> Don Stewart [EMAIL PROTECTED]:
> >jay:
> >> I also have constants that are too large to compile. I am resigned to
> >> loading them from data files--other solutions seem even worse.
> ...
> >> Data.Binary eases the irritation somewhat.
> >
> >Did you try bytestring literals (and maybe parsing them in-memory with
> >Data.Binary)?
> 
> That didn't occur to me, since neither of my large constants includes
> strings I think you're suggesting that each constant could appear in
> the source as a long bytestring and be deserialized into the data
> structure. If that works, it should improve the startup time, but it's
> still not as nice as simply compiling it straight up.
> 
> I'll try it.

Here's an example, which stores a Data.Map in a gzip-compressed bytestring 
literal (a C
string literal in the compiled code). The Map is reconstructed on
startup.

{-# LANGUAGE OverloadedStrings #-}

import Data.Binary
import qualified Data.Map as M
import qualified Data.ByteString.Char8 as S
import Data.ByteString.Lazy
import Codec.Compression.GZip

--
-- this is a gzip compressed literal bytestring, storing a binary-encoded 
Data.Map
--
mytable =
"\US\139\b\NUL\NUL\NUL\NUL\NUL\NUL\ETXEN\219\SO\194 
\f\197\224\188\196\CAN\227\US\224\171~\NAKc\GS4ce\161`\178\191\215(\176\190\180\167\231\210\n\241\171\203\191\ti\157\217\149\249<
 
\ENQ\214\&9>\202\162\179a\132X\233\ESC=\231\215\164\SYN\157\DC2D\226*\146\174o\t\167\DLE\209\"i_\240\193\129\199http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] placeholders in hsql

2008-02-24 Thread Roman Cheplyaka
Is there an ability to use placeholders in SQL statement using hsql?
(Actually I'm interested in SQLite.)

E.g. "INSERT INTO sales (product_code, qty, price) VALUES (?, ?, ?)"
and then supply values that will be escaped and inserted in place of
each '?'.

-- 
Roman I. Cheplyaka :: http://ro-che.info/
...being in love is totally punk rock...


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