Re: [Haskell-cafe] Graphical graph reduction

2008-02-23 Thread Kim-Ee Yeoh


dainichi wrote:
 
 Now to the point: Wouldn't it be great if I had a visual tool that
 visually
 showed me the graph while the above evaluation unfolded? I could use it to
 show some of my co-workers to whom laziness is a mystery, what it's all
 about.
 

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

Explores several forms of laziness and them some.

-- 
View this message in context: 
http://www.nabble.com/Graphical-graph-reduction-tp15637156p15649433.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


[Haskell-cafe] Haskell w/ delimited continuations

2008-02-23 Thread oleg

Call-by-name lambda-calculus is strictly more expressive (in Felleisen
sense) than call-by-value lambda-calculus, and the call-by-need (aka, lazy)
lambda-calculus is observationally equivalent to the call-by-name.
One can add shift/reset to any of these calculi (CBV shift/reset is
most known; there are several CBN shift/reset, including the one I'm
particularly attached to; in principle one can add shift/reset to
call-by-need).

Adding control effects (shift/reset) changes the expressivity
results. Now all three calculi are distinct and none subsumes the
other. For example, the expression
reset( (\x - 1) (abort 2))
evaluates to 1 in call-by-name and evaluate to 2 in call-by-value.
The expression
reset ((\x - x + x) (shift f f))
has the type int-int in call-by-need (it is a function \x - x + x)
and it has the type int-int-int in call-by-name (and it is the
curried addition function).

The fact that call-by-need is no longer observationally equivalent to
call-by-name and sharing becomes observable is the most
distressing. It disables many optimizations GHC is allowed to
do. Types help: there are call-by-name calculi with shift/reset with
effect typing; one can look at the type and see what control effect an
expression may make. That will still permit GHC optimize pure
expressions and leave effectful expressions as they are. Alas, that
type system is complex and I don't think inference is decidable there
due to the presence of subtyping (one must annotate at least some of
the binders with types, in particular, the binders of shift). It seems
the simplest solution is to confine shift/reset to a monad.

Regarding purity: the obligatory reference is

Amr Sabry. What is a Purely Functional Language? 
In J. Functional Programming, 8(1), 1-22, Jan. 1998.
http://www.cs.indiana.edu/~sabry/papers/purelyFunctional.ps

Please see the definition 4.7. As Matthias Blume said, a bit
informally, evaluation of a pure expression should not depend on CBN
or CBV or some other such strategy. By this definition, an expression
that involves shift/reset is not pure, as the above examples
demonstrate.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Graphical graph reduction

2008-02-23 Thread Dominic Steinitz
About 7 years ago such a tool existed:

 http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/GHood/

I don't know if Claus is around. Perhaps he could give you more information.

Dominic.



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


[Haskell-cafe] Database relations mapping

2008-02-23 Thread Radosław Grzanka
Hi,
  I'm developing toy application to learn HDBC. I have problem with
doing relations mapping. Actually I don't know is it a problem or
feature. ;)

Anyway, I have two tables with relation between them:

(this example is simplified to the whole structure of database, you can imagine)

CREATE TABLE TD_set (
 setId INTEGER PRIMARY KEY,
 setName TEXT NOT NULL
 )

CREATE TABLE TO_card (
 cardId INTEGER PRIMARY KEY AUTOINCREMENT,
 setId INTEGER NOT NULL,   -- Relation to TD_set
 setSeq INTEGER NOT NULL
 )

(no foreign key as sqlite3 does not care anyway - at least AFAIK)

And in Haskell:

 type CardSet = String

 data Card = Card {
set :: CardSet,
seqNo:: Integer,
 }

There is no problem with filling the structure Card with seqNo but I
can't fill set. I would have to put there IO (CardSet) but I don't
want to do that as whole structure returned from my mapping function
is already inside IO monad. Can I do it?

Here is my (perfect) function - http://hpaste.org/5839 . See
getCards and some helper functions. This does not compile as (I
believe) getElement wants to return IO (CardSet)

Thank you in advance for all your input.
Radek.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Database relations mapping

2008-02-23 Thread Jonathan Cast

On 23 Feb 2008, at 3:30 AM, Radosław Grzanka wrote:


Hi,
  I'm developing toy application to learn HDBC. I have problem with
doing relations mapping. Actually I don't know is it a problem or
feature. ;)

Anyway, I have two tables with relation between them:

(this example is simplified to the whole structure of database, you  
can imagine)


CREATE TABLE TD_set (
 setId INTEGER PRIMARY KEY,
 setName TEXT NOT NULL
 )

CREATE TABLE TO_card (
 cardId INTEGER PRIMARY KEY AUTOINCREMENT,
 setId INTEGER NOT NULL,   -- Relation  
to TD_set

 setSeq INTEGER NOT NULL
 )

(no foreign key as sqlite3 does not care anyway - at least AFAIK)

And in Haskell:


type CardSet = String

data Card = Card {
   set :: CardSet,
   seqNo:: Integer,
}


There is no problem with filling the structure Card with seqNo but I
can't fill set. I would have to put there IO (CardSet) but I don't
want to do that as whole structure returned from my mapping function
is already inside IO monad. Can I do it?



Here is my (perfect) function - http://hpaste.org/5839 . See
getCards and some helper functions. This does not compile as (I
believe) getElement wants to return IO (CardSet)

Thank you in advance for all your input.


You want to put toItem into the IO monad:

toItem [cardId, setId, setSeq] = do
  set_ - getElement
  return $ Card {
set  = set_
seqNo= fromSql setSeq,
}
toItem x = fail (Unexpected result in getCards:  ++ (show x))

Then use

mapM toItem cards

instead of

return $ map toItem cards

jcc

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


[Haskell-cafe] A beginners question

2008-02-23 Thread Harri Kiiskinen
Dear All,

banging my head against Haskell, but liking the feeling of hurting
brains. Just a simple question:

If

fmap (^4) [1,2,3] = \i - shows i  

gives

1 16 81 

then why does 

let i = fmap (^4) [1,2,3] in shows i  

give

[1,16,81] 

Probably very simple, but there must be a delicate difference between
these two expressions. I just don't get it.
-- 
Harri Kiiskinen [EMAIL PROTECTED]

___
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-23 Thread Steve Lihn

 There's a link on the HackageDB Introduction page that gets you the
 latest versions of all packages (30MB).

Ross,
Thanks for the archive URL. 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

As I reflect on what I did, this result is kind of useful in learning
Haskell. Haskell is about re-using modules and building on top of
them. If a module is often used by Haskell community (especially,
library writers), a beginner better understand that module first (such
as Monad, List, Map, Exception, Array, etc).

On the other hand, I am thinking to display a eco-system kind of
graph/chart to show how the modules are connected with each other, and
which module is on the top of the eco-system (either the most
advanced module, or a module no one cares about!). But my data seem to
have a recursive nature. I don't quite understand why nor how to get
by it.

 Rewriting that script in Haskell could be an
 interesting exercise.  Do you have the source code?

Ben,
I think the best way to write this parser in Haskell is to use haddock
since haddock understands Haskell syntax much better than my
hacker-style script.

Here is the source code of both the parser(s) and cgi script. The code
is very experimental and low-quality... Let me know if you have any
question.

http://haskell.ecoin.net/haskell-trivia.tgz

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


Re: [Haskell-cafe] A beginners question

2008-02-23 Thread Steve Lihn

 fmap (^4) [1,2,3] = \i - shows i  

 gives

 1 16 81 

You are in the list comprehension in a monadic expression. shows is
called three times (i is int).

 then why does

 let i = fmap (^4) [1,2,3] in shows i  

 give

 [1,16,81] 


shows is called once (i is a list).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A beginners question

2008-02-23 Thread Adam Langley
On Sat, Feb 23, 2008 at 8:00 AM, Harri Kiiskinen [EMAIL PROTECTED] wrote:
  then why does

  let i = fmap (^4) [1,2,3] in shows i  

  give

  [1,16,81] 

I'll probably mess this up somewhere, but if I do, reset assured that
someone else here will correct me ;)

fmap (^4) [1,2,3] == [1,16,81] so shows   of that == [1,16,81] 
(note the trailing space), obvious I hope.

However, [1,16,81] = \i - shows i   operates in the list monad. I
can't find the actual instance of Monad [] right now, but it will
apply 'shows i  ' to each element in the first list and concat the
results. Since strings are just [Char], concating them is string
concatenation. And so you have 1 16 81  (again, note the trailing
space)


AGL

-- 
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] A beginners question

2008-02-23 Thread Chaddaï Fouché
2008/2/23, Harri Kiiskinen [EMAIL PROTECTED]:
 Dear All,

  banging my head against Haskell, but liking the feeling of hurting
  brains. Just a simple question:

  If

  fmap (^4) [1,2,3] = \i - shows i  

  gives

  1 16 81 

In the List Monad, (=) is defined as concatMap, so this code can be
translated by :
 concatMap (\i - shows i  ) (fmap (^4) [1,2,3])

shows is applied to each elements of the list, then the strings are concatened.

Whereas in
 let xs = fmap (^4) [1,2,3] in shows xs  
shows is applied to the whole list.

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


[Haskell-cafe] Re: [Haskell] *** JOB OFFER *** [...]

2008-02-23 Thread Paul Johnson

Peter Verswyvelen wrote:


PS: This job offer was already placed in the Haskell Café a while ago, 
but I was advised there to place it in the main Haskell list. I hope 
this is not considered as spam.


I certainly don't see it as spam.  One day there will be a dozen jobs 
for Haskell programmers on Monster or Jobserve, and at that point 
another such announcement *would* be spam.  But at the moment it has 
rarity value.


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


Re: [Haskell-cafe] A beginners question

2008-02-23 Thread Roberto Zunino

Harri Kiiskinen wrote:

fmap (^4) [1,2,3] = \i - shows i  
let i = fmap (^4) [1,2,3] in shows i  

Probably very simple, but there must be a delicate difference between
these two expressions. I just don't get it.


First, let's simplify these expressions using the following equation:

   fmap (^4) [1,2,3] == [1,16,81]

So, we have

x1 = [1,16,81] = \i - shows i  
x2 = let i = [1,16,81] in shows i  

Let's examine the x2 first. We can substitute i, and obtain

   shows [1,16,81]  

note that the whole list is passed to shows. shows then prints it to a 
string, using the notation for lists, and adds a trailing space. Note 
that shows is called here with type:


  shows :: [Integer] - String - String

Now, we consider x1. Here = is invoked for the list monad,
which extracts each member 1,16,81 from the
list and applies shows to them separately, and concatenates all the 
results. In other words, we can rewrite x1 as:


  shows 1   ++ shows 16   ++ shows 81  

Note that here we pass single elements to shows, and not the whole list. 
Indeed, here we are calling shows at a different type:


  shows :: Integer - String - String

But this is fine, since shows knows how to print Integers as well as 
lists of them.


Concluding: the monadic bind operator = is not function application.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Graphical graph reduction

2008-02-23 Thread Claus Reinke

About 7 years ago such a tool existed:

http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/GHood/


GHood was never intended to visualize graph reduction
directly (*). instead, it visualized observations - ie, you
could see if and when which parts of an observed data
structure was inspected during a program run, but not
the reductions themselves, and definitely not sharing as
in the cyclic programming example earlier in this thread.

GHood was very helpful in visualizing some aspects of
non-strict evaluation, and its main advantage over Hood
was in observing relative strictness, dynamically: you 
could not only see which parts of an observed data

structure were used at all, but by observing both the
input and the output of a function, you could see the
demands for the output drive the demands for the
input. very useful for spotting strictness bugs, such
as demanding too much of the input too early, instead
of just as much as needed to produce just as much as
used for producing the output. see the example applets
on that GHood page.

claus

(*) it was, however, the lack of reduction animation
in haskell implementations that kept me looking for 
such opportunities (i had grown up, functionally,
with the kiel reduction systems, and their built-in 
support for displaying and editing intermediate reduction 
results, with higher-order functions, free variables, avoiding
name clashes, and all, and was missing all that support in 
the supposedly more modern world of haskell..)  

an earlier, simpler, example was the use of overloading 
to visualize intermediate expressions, so you could see 
the difference between foldr and foldl, etc:


http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/R.hs

btw, in one of the previous incarnations of this thread,
Wolfram Kahl used the HOP System to generate
graphical traces of term-graph reductions:

http://www.cas.mcmaster.ca/~kahl/HOPS/


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


Re: [Haskell-cafe] Haskell w/ delimited continuations

2008-02-23 Thread Taral
On Sat, Feb 23, 2008 at 1:05 AM,  [EMAIL PROTECTED] wrote:
  Adding control effects (shift/reset) changes the expressivity
  results. Now all three calculi are distinct and none subsumes the
  other. For example, the expression
 reset( (\x - 1) (abort 2))
  evaluates to 1 in call-by-name and evaluate to 2 in call-by-value.
  The expression
 reset ((\x - x + x) (shift f f))
  has the type int-int in call-by-need (it is a function \x - x + x)
  and it has the type int-int-int in call-by-name (and it is the
  curried addition function).

Aha. Okay, so shift/reset exposes evaluation order, amongst other
things. Hm... thank you very much!

-- 
Taral [EMAIL PROTECTED]
Please let me know if there's any further trouble I can give you.
-- Unknown
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell w/ delimited continuations

2008-02-23 Thread Taral
On Sat, Feb 23, 2008 at 1:05 AM,  [EMAIL PROTECTED] wrote:
 reset ((\x - x + x) (shift f f))

This one doesn't typecheck, since you can't unify the types (a - r) and r.

-- 
Taral [EMAIL PROTECTED]
Please let me know if there's any further trouble I can give you.
-- Unknown
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] how to catch keyboard interrupts?

2008-02-23 Thread Uwe Hollerbach
Hi, all, I am continuing to mess with my little scheme interpreter,
and I decided that it would be nice to be able to hit control-C in the
middle of a long-running scheme computation to interrupt that and
return to the lisp prompt; hitting control-C and getting back to the
shell prompt works, but is a little drastic. So I looked at
System.Posix.Signals and after a bit of messing about got the
following:

 mysighandler =
   Catch (do hPutStrLn stderr caught a signal!
 fail Interrupt!)

 runREPL :: IO ()
 runREPL =
   do getProgName = writeHdr
  env - setupBindings [] True
  runInit env
  installHandler sigINT mysighandler Nothing
  installHandler sigQUIT mysighandler Nothing
  doREPL env

This compiles just fine, the interpreter runs as usual... but the
added code doesn't seem to do anything. You can probably guess
already... the print statement in mysighandler is there to see if it
actually caught a signal. It does: I see caught a signal! just fine,
in fact I see dozens of them as I lean on the control-C; but now my
scheme calculation doesn't get interrupted at all! I see in the
System.Posix.Signals documentation that the signal handler gets
invoked in a new thread; is this the source of the problem? If so,
what should I do to fix it? I'm afraid that sort of stuff is still
beyond my haskell-fu...

many thanks!

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


[Haskell-cafe] Haskell Weekly News: February 23, 2008

2008-02-23 Thread Don Stewart
---
Haskell Weekly News
http://sequence.complete.org/hwn/20080223
Issue 70 - February 23, 2008
---

   Welcome to issue 70 of HWN, a newsletter covering developments in the
   [1]Haskell community.

   One hundred unique new and updated libraries and applications in the
   past two weeks, including mutable arrays, compression, games, web
   frameworks, data structures, a file system, Haskell tools,
   concurrency, graphics, cryptography, systems administration, signal
   processing, new guis and several audio libraries

   1. http://haskell.org/

Hackage

   New and updated libraries in [2]the Hackage library database.

   2. http://hackage.haskell.org/

 * ArrayRef 0.1.2. Uploaded by Gwern Branwen. [3]ArrayRef: Unboxed
   references, dynamic arrays and more.

 * zlib 0.4.0.4. Uploaded by Duncan Coutts. [4]zlib: Compression and
   decompression in the gzip and zlib formats.

 * hetris 0.1. Uploaded by Gwern Branwen. [5]hetris: Text Tetris.

 * bzlib 0.4.0.3. Uploaded by Duncan Coutts. [6]bzlib: Compression
   and decompression in the bzip2 format.

 * HAppS-Server 0.9.2. Uploaded by David Himmelstrup.
   [7]HAppS-Server: Web related tools and services..

 * HAppS-State 0.9.2. Uploaded by David Himmelstrup. [8]HAppS-State:
   Event-based distributed state..

 * HAppS-Data 0.9.2. Uploaded by David Himmelstrup. [9]HAppS-Data:
   HAppS data manipulation libraries.

 * HAppS-IxSet 0.9.2. Uploaded by David Himmelstrup. [10]HAppS-IxSet:
   Added by DavidHimmelstrup, Fri Feb 22 15:18:20 PST 2008..

 * HAppS-Util 0.9.2. Uploaded by David Himmelstrup. [11]HAppS-Util:
   Web framework.

 * Ranged-sets 0.2.0. Uploaded by Paul Johnson. [12]Ranged-sets:
   Ranged sets for Haskell.

   3. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ArrayRef-0.1.2
   4. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib-0.4.0.4
   5. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hetris-0.1
   6. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bzlib-0.4.0.3
   7. 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Server-0.9.2
   8. 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-State-0.9.2
   9. 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Data-0.9.2
  10. 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-IxSet-0.9.2
  11. 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Util-0.9.2
  12. 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Ranged-sets-0.2.0

 * halfs 0.2. Uploaded by Gwern Branwen. [13]halfs: Haskell File
   System.

 * sessions 2008.2.22. Uploaded by Matthew Sackman. [14]sessions:
   Session Types for Haskell.

 * infix 0.1. Uploaded by Gwern Branwen. [15]infix: Infix expression
   re-parsing (for HsParser library).

 * reify 0.1. Uploaded by Gwern Branwen. [16]reify: Serialize data.

 * highWaterMark 0.1. Uploaded by Gwern Branwen. [17]highWaterMark:
   Memory usage statistics.

 * hinvaders 0.1. Uploaded by Gwern Branwen. [18]hinvaders: Space
   Invaders.

 * baskell 0.1. Uploaded by Gwern Branwen. [19]baskell: An
   interpreter for a small functional language.

 * control-event 0.2. Uploaded by Thomas DuBuisson.
   [20]control-event: Event scheduling system..

 * nymphaea 0.1. Uploaded by Gwern Branwen. [21]nymphaea: An
   interactive GUI for manipulating L-systems.

 * hopenssl 1.0. Uploaded by Peter Simons. [22]hopenssl: FFI bindings
   to OpenSSL's EVP digest interface.

  13. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/halfs-0.2
  14. 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/sessions-2008.2.22
  15. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/infix-0.1
  16. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/reify-0.1
  17. 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/highWaterMark-0.1
  18. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hinvaders-0.1
  19. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/baskell-0.1
  20. 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/control-event-0.2
  21. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/nymphaea-0.1
  22. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hopenssl-1.0

 * Monadius 0.91. Uploaded by Gwern Branwen. [23]Monadius: 2-D arcade
   scroller.

 * postmaster 0.1. Uploaded by Peter Simons. [24]postmaster:
   Postmaster ESMTP Server.

 * hsyslog 1.2. Uploaded by Peter Simons. [25]hsyslog: FFI interface
   to syslog(3) from POSIX.1-2001..

 * hsemail 1.2. Uploaded by Peter Simons. [26]hsemail: Internet
   Message Parsers.

 * hsdns 1.3. Uploaded by Peter Simons

[Haskell-cafe] Re: fast graph algorithms without object identities

2008-02-23 Thread apfelmus

Henning Thielemann wrote:

It seems that algorithms on graphs can be implemented particularly
efficient in low-level languages with pointers and in-place updates. E.g.
topological sort needs only linear time, provided that dereferencing
pointers requires constant time. I could simulate pointer dereferencings
and pointer updates by Map yielding linear logarithmic time for
topological sort. I wonder if it is possible to write a linear time
topological sort using lazy evaluation, since the runtime system of
Haskell implementations is a graph processor based on pointers.


First of all, topological sorting is only linear time because the 32 or 
64 bit used to label nodes aren't counted. Put differently, random 
access in constant time to a collection of  n  elements doesn't exist.


That being said, we want to use arrays of course. Preferably in a 
whole-meal way that doesn't involve incremental state updates. A few 
minutes ago, I stumbled upon the  lazyarray  packages which points to 
the paper


  Thomas Johnsson.
  Efficient Graph Algorithms Using Lazy Monolithic Arrays
  http://citeseer.ist.psu.edu/95126.html

which offers such a way! (Although I currently don't quite understand 
why this works, and these ad-hoc unique numbers bother me.)



Regards,
apfelmus

___
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-23 Thread Ross Paterson
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


[Haskell-cafe] Re: Haskell w/ delimited continuations

2008-02-23 Thread Chung-chieh Shan
Taral [EMAIL PROTECTED] wrote in article [EMAIL PROTECTED] in 
gmane.comp.lang.haskell.cafe:
 On Sat, Feb 23, 2008 at 1:05 AM,  [EMAIL PROTECTED] wrote:
  reset ((\x - x + x) (shift f f))
 This one doesn't typecheck, since you can't unify the types (a - r) and r.

Some type systems for delimited continuations, such as Danvy and
Filinski's (http://www.daimi.au.dk/~danvy/Papers/fatc.ps.gz; DIKU TR
89/12), allows changing the answer type and admits this code.

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
God exists since mathematics is consistent, and the devil exists 
since its consistency cannot be proved. --  Hermann Weyl.

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


[Haskell-cafe] haskellwiki and Project Euler

2008-02-23 Thread Daniel Fischer
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!

On top of that, the code for many problems isn't even Haskell, but C, WTF!
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!

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 call on the Haskell community to vote for immediate removal of these pages 
from the wiki!
Show that you're a sporting bunch.

Daniel Fischer
___
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-23 Thread Tony Morris

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.
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!

On top of that, the code for many problems isn't even Haskell, but C, WTF!
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!


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 call on the Haskell community to vote for immediate removal of these pages 
from the wiki!

Show that you're a sporting bunch.

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





You're going the right way about having the answers published in more 
ways than just the Haskell wiki. I'm only making a prediction, not a threat.


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

___
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-23 Thread Bulat Ziganshin
Hello Uwe,

Saturday, February 23, 2008, 11:35:35 PM, you wrote:

 mysighandler =
   Catch (do hPutStrLn stderr caught a signal!
 fail Interrupt!)

 scheme calculation doesn't get interrupted at all! I see in the
 System.Posix.Signals documentation that the signal handler gets
 invoked in a new thread; is this the source of the problem?

yes, fail kills only this thread :)

you should store thread id of thread running interpreter and send
async exception to it. control.concurrent is probably contains all
required functions


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
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-23 Thread Uwe Hollerbach
Thanks, Bulat, I'll look into this!

On 2/23/08, Bulat Ziganshin [EMAIL PROTECTED] wrote:
 Hello Uwe,


  Saturday, February 23, 2008, 11:35:35 PM, you wrote:

   mysighandler =
 Catch (do hPutStrLn stderr caught a signal!
   fail Interrupt!)


  scheme calculation doesn't get interrupted at all! I see in the
   System.Posix.Signals documentation that the signal handler gets
   invoked in a new thread; is this the source of the problem?


 yes, fail kills only this thread :)

  you should store thread id of thread running interpreter and send
  async exception to it. control.concurrent is probably contains all
  required functions



  --
  Best regards,
   Bulatmailto:[EMAIL PROTECTED]


___
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-23 Thread Daniel Fischer

 You're going the right way about having the answers published in more
 ways than just the Haskell wiki. I'm only making a prediction, not a
 threat.

Might be. And I've been over-angered. 
Having the Haskell code for the solutions in the wiki might be legitimate, but 
a) no code should be put there without the author's consent and
b) posting C/C++ code there indicates that the reason for that is to be a 
spoil-sport, not to further learning/thinking Haskell.
The latter even more applies to publishing the bare answers.
___
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-23 Thread Uwe Hollerbach
On 2/23/08, Bulat Ziganshin [EMAIL PROTECTED] wrote:

[about my question about keyboard interrupts]

  you should store thread id of thread running interpreter and send
  async exception to it. control.concurrent is probably contains all
  required functions

Most splendid! Here's what I did

 data MyInterrupt = MyInt Int
 instance Typeable MyInterrupt where
   typeOf x = typeOf (0 :: Int)

 catcher :: MyInterrupt - IO ()
 catcher e = hPutStrLn stderr interrupt!

then later, in the REPL

 catchDyn (evalAndPrint env True line)  (\e - catcher e)

and in the initialization

 mysighandler tid = Catch (throwDynTo tid (MyInt 0))

and

 myTID - myThreadId
 installHandler sigINT (mysighandler myTID) Nothing
 installHandler sigQUIT (mysighandler myTID) Nothing
 doREPL env

I had to add the MyInterrupt stuff because GHC was complaining about
ambiguous types, initially I had just (\e - hPutStrLn stderr (show
e)) as the second arg of the catchDyn.

And try it in the self-test...

Now test number/string conversions... this'll take a bit longer

interrupt!
lisp

It works! Cool! This is worth bumping the version number :-)

Many thanks!

Uwe
___
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-23 Thread Quân Ta
Shame on you Haskell wiki! :)

Perhaps it's a conpiracy to avoid wasting too much of the community effort
on PE, and direct that energy to darcs :)

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