Re: [Haskell-cafe] Loading bitmap with xlib

2011-02-02 Thread Francesco Mazzoli
Conrad Parker conrad at metadecks.org writes:

 
 On 31 January 2011 21:40, Francesco Mazzoli f at mazzo.li wrote:
  Francesco Mazzoli f at mazzo.li writes:
 
  At the end I gave up and I wrote the function myself:
 
  http://hpaste.org/43464/readbitmapfile
 
 
 cool ... the listed maintainer for the Xlib bindings is
 libraries at haskell.org. Perhaps you could prepare a patch and send it
 there? (does anyone know if there is an actual maintainer?)
 
 Conrad.
 
I will send a patch, but I'm sure there must be a reason behind the
fact that those functions were not included, even if I can't see it.

Francesco.




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


Re: [Haskell-cafe] Instancing Typeable for monad transformers?

2011-02-02 Thread oleg

One can do something a bit shorter

 instance (Typeable a, Typeable1 m) = Typeable1 (Iteratee a m) where
   typeOf1 i = mkTyConApp (mkTyCon Data.Enumerator.Iteratee) 
   [typeOf a, typeOf1 m]
where
(a,m) = peel i
peel :: Iteratee a m w - (a, m ())
peel = undefined


still a bother to write every time one needs it, but tolerable. Only
the signature of 'peel' matters.




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


[Haskell-cafe] ANN: HackageOneFive: Reverse dependency lookup for all packages on Hackage

2011-02-02 Thread Simon Hengel
Hello,
I wrote a tiny Snap app that provides reverse dependency lookup for all
packages on Hackage.

A git repository is at:

https://github.com/sol/HackageOneFive

Setup instructions are provide in the README[1] file.

It uses a PostgreSQL database for storage but it should be trivial to
port this to e.g. SQLite.

As always feedback and patches are gladly welcome!

btw: Is there still progress on Hackage 2.0?

Cheers,
Simon

[1] https://github.com/sol/HackageOneFive#readme

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


Re: [Haskell-cafe] ANN: HackageOneFive: Reverse dependency lookup for all packages on Hackage

2011-02-02 Thread Max Bolingbroke
On 2 February 2011 11:57, Simon Hengel simon.hen...@wiktory.org wrote:
 Hello,
 I wrote a tiny Snap app that provides reverse dependency lookup for all
 packages on Hackage.

Are you familiar with Roel van Djik's revdep Hackage?
http://bifunctor.homelinux.net/~roel/hackage/packages/hackage.html

It's usually quite up to date, and very useful.

 btw: Is there still progress on Hackage 2.0?

Last I heard was that Matt Gruen had done quite a lot of work on it in
the last Summer of Code (see http://cogracenotes.wordpress.com/), but
they haven't got around to actually deploying the new version - but
that was a few months ago.

Cheers,
Max

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


[Haskell-cafe] http-enumerator: redirects, streaming and keep-alive

2011-02-02 Thread Michael Snoyman
Hi all,

There are a number of new feature requests for http-enumerator, and I
wanted to discuss some possible API changes with everyone:

* Allow keep-alive requests, which will reuse the same connection.
* Allow client code to determine whether it accepts a server's SSL certificate.
* Allow the request body to be an Enumerator so we can send large
request bodies without using lazy IO. This is already implemented via
streamingHttp, but it would make more sense to modify the Request
datatype to replace L.ByteString with (Int, Enumerator ByteString IO
()).
* Fix redirect behavior. It seems that the right thing to do is change
a POST into a GET and remove the request body for a 303, and resend
the same request for all other 3xx codes. However, when using an
Enumerator for the request body, it is not guaranteed that we can
resend an Enumerator.

For addressing the last two, my plan is to:

* Change the Request datatype as mentioned, but provide a convenience
method for converting a lazy ByteString into a (Int, Enumerator
ByteString IO ()).
* Implement redirecting as I have described, and explain in the
documentation that automatic redirecting can only work with
Enumerators that can be run multiple times. AFAIK, this works with
most standard Enumerators, such as enumFile, and with the helper
function I will provide to convert lazy ByteStrings to Enumerators.
* Remove streamingHttp, as it will no longer be necessary.

As far as keep-alive goes, I still need to do a bit more research, but
my basic idea (with credit to Bryan O'Sullivan):

* http (and family) will all take an extra argument, Maybe Manager.
* Manager will be an abstract type that will keep an MVar (Map (Host,
Port, IsSecure) Socket).
* If http is provided with a Manager, then it uses the Socket
available in the Manager. If none is available, it creates a new
Socket and places it in the Manager.
* If http is *not* provided with a Manager, then it creates a new
socket and closes it before returning.
* There will be a newManager :: IO Manager, and a closeManager ::
Manager - IO (), which closes all Sockets in the Manager and empties
out the inner Map.

Some open questions are:

* Who is responsible to recover if a server is no longer responding on
a Socket from the Manager: http or the client code? I would assume
http.
* I haven't fully thought through how this will work with secure
connections: most likely in addition to storing the Socket in the
Manager I will need to store some certificate data.

And speaking of certificates, the main concern I have here is data
types: since http-enumerator can use either tls or OpenSSL, there
isn't a single certificate datatype I can use. If someone wants to
help out and write some code to convert an OpenSSL X509 datatype into
a Certificate from the certificate package (which tls uses), I will be
very grateful.

Assuming we had such a unified datatype, I would recommend changing
Request's secure record to be Certificate - IO Bool, where returning
True means the certificate is accepted and False means it is rejected.
To get the current functionality of trusting any certificate, we would
use (const $ return True).

Any thoughts?

Michael

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


Re: [Haskell-cafe] Haskell function help

2011-02-02 Thread Houdini

*can't
-- 
View this message in context: 
http://haskell.1045720.n5.nabble.com/Haskell-function-help-tp3365994p3368001.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] Haskell function help

2011-02-02 Thread Houdini

I didn't write it like that...because since I'm using the dot notation I can
specify aguments for the function...I rectified that...sorry I forgot to
mention
-- 
View this message in context: 
http://haskell.1045720.n5.nabble.com/Haskell-function-help-tp3365994p3368000.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] Gedit Haskell mode plugin indentation

2011-02-02 Thread yukkuri yu!yu!yu!
Update.

Current version: v0.8

Changelog:

* Fixed some issues with nested lists

---
ftp://neverb.net/soft/mine/gedit_haskell_mode/haskell_indentation-latest.tar.gz

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


[Haskell-cafe] Haskell DPLL

2011-02-02 Thread Houdini

One :Thank you Carsten Schultz,Daniel Fischer and all the other for your
help. 
Two:After my last post I wrote some function that should help me in the
future,but I need some help with the followint as I'm tired and have to fit
in a schedule.I know it is long so I'll try and explain it as short and
consice as I can.
The DPLL procedure has two main stages: a simplification stage and a search
stage. In the simplification
stage, functions are applied to the formula to assign truth values to
certain propositional variables. The
simplifications are made because if there is a satisfying assignment for the
simplified formula then it is also
a satisfying assignment for the original formula. This reduces the need for
search which can take a long
time. The search stage is performed when no more simplifications can be
made. In this stage a literal is
chosen and is assigned true or false leading to two new branches in the
search space.
I wrote some function wich should be helpfull,but I have to fit in a
schedule and I'm getting tired I need some additional help if possible.

module Algorithm where

import System.Random
import Data.Maybe
import Data.List

type Atom = String
type Literal = (Bool,Atom)
type Clause = [Literal]
type Formula = [Clause]
type Model = [(Atom, Bool)]
type Node = (Formula, ([Atom], Model))

-- This function  takess a Clause and return the set of Atoms of that
Clause.
atomsClause :: Clause - [Atom]
   

-- This function  takes a Formula returns the set of Atoms of a Formula
atoms :: Formula - [Atom]


-- This function returns True if the given Literal can be found within
-- the Clause.
isLiteral :: Literal - Clause - Bool


-- this function takes a Model and an Atom and flip the truthvalue of
-- the atom in the model
flipSymbol :: Model - Atom - Model -- is this ok?
  
Additional functions that I wrote:
remove :: (Eq a) )a -[a] -[a] 
-This function removes an item from a list.
 
 neg :: Literal-Literal
-This function flips a literal (ie. from P to :P and from :P to P).
falseClause :: Model - Clause - Bool 
-This function takes a Model and a Clause and returns True
if the clause is unsatisfied by the model or False otherwise.
falseClauses :: Formula - Model - [Clause]
-This function takes a Formula and a Model and returns the list of
clauses of the  formula that are not satisfied.
 assignModel :: Model - Formula - Formula 
 -This function applies the assign function for all the assignments of a
given model.
 checkFormula :: Formula - Maybe Bool This function checks whether a
formula can be  decided to be satisfiable or unsatisfiable based on the
effects of the assign function.
 satisfies :: Model - Formula -. Bool This function checks whether a
model satisfies a formula. This is done with the combination of the
assignModel and checkFormula functions.


--Where do I need help:

   removeTautologies :: Formula-Formula 
This function should output a simplified formula if tautologies
can be found in one or more clauses in the input
Notes: If in a clause, a literal and its negation are found, it means that
the clause will be true, regardless of the value
finally assigned to that propositional variable. Consider the following
example:
(A v B v -A) ^ (B v C v A)
The first clause contains the literals A and -A. This means that the clause
will always be true, in which case
it can be simplify the whole set to simply (B v C v A) (the second clause
alone)

 pureLiteralDeletion :: Formula-Formula
This function is suppose to implement a simplification step that assumes as
true any atom in a formula that appears exclusively in a positive or
negative form (not both). Consider the formula:
(P v Q v R) ^ (P v Q v -R) ^ (-Q v R)
Note that in this formula P is present but -P is not. Using Pure Literal
Deletion  it can be assumed that the value of P will be True thus
simplifying the formula to (-Q v R). If the literal were false then the
literal would simply be deleted from the clauses it appears in. In that case
any satisfying model for the resulting formula would also be a satisfying
model for the formula when we assume that the literal is true. Hence this
simplification is sound in that if there is a solution to the simplified
formula then there is a solution to the original formula.
   
  propagateUnits :: Formula-Formula
If a clause in a propositional formula contains only one literal, then that
literal must be true (so that the particular clause can be satisfied). When
this happens,we can remove the unit clauses (the ones that contain only one
literal), all the clauses where the literal appears and also, from the
remaining clauses, we can delete the negation of the literal (because if P
is true, -P will be false).For example, in the formula (P v Q v R) ^ (-P v Q
v -R) ^ (P) we have one unit clause (the third clause(P) ). Because this 

Re: [Haskell-cafe] Haskell DPLL

2011-02-02 Thread Houdini

I didn't upload the code for the funtion I wrote because of the space...I ca
do so If you require.
-- 
View this message in context: 
http://haskell.1045720.n5.nabble.com/Haskell-DPLL-tp3368123p3368130.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] Loading bitmap with xlib

2011-02-02 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2/2/11 04:03 , Francesco Mazzoli wrote:
 Conrad Parker conrad at metadecks.org writes:
 On 31 January 2011 21:40, Francesco Mazzoli f at mazzo.li wrote:
 Francesco Mazzoli f at mazzo.li writes:
 At the end I gave up and I wrote the function myself:
 http://hpaste.org/43464/readbitmapfile

 cool ... the listed maintainer for the Xlib bindings is
 libraries at haskell.org. Perhaps you could prepare a patch and send it
 there? (does anyone know if there is an actual maintainer?)

 I will send a patch, but I'm sure there must be a reason behind the
 fact that those functions were not included, even if I can't see it.

Pretty much what the comment says.  Graphics.X11 was never really a complete
set of bindings, just what people needed at the time.  The Extras stuff in
there was driven by xmonad development, for example (and named so because
originally it was a separate library before it got folded in, so the module
names were difficult to change while maintaining compatibility).  Dealing
with structs in the FFI is painful enough that I can easily imagine someone
saying we don't need those, let someone else figure it out --- which you
have done.  Patch away.

- -- 
brandon s. allbery [linux,solaris,freebsd,perl]  allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university  KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1Jq9cACgkQIn7hlCsL25XaJgCfc+CCngSmZlL9JOeZ21vZwkBO
BHkAn128z1dH2entJKEfH6pKJ2Y7qW4w
=LOMj
-END PGP SIGNATURE-

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


[Haskell-cafe] SYB: extending a generic reader with a type class

2011-02-02 Thread Sugar Bzzz
Dear -cafe,

Is it possible to extend a generic reader (extR / ext1R from syb) with a
type class?


For example, let

foo :: (Integral a) = SomeMonad a

I could write:

reader = ... `extR` (foo :: SomeMonad Int) `extR` (foo :: SomeMonad Integer)

However, that is tedious.  Could I do something like

reader = ... `extR` foo

and have it apply to all instances of Integral?


I hope I am being clear.

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


Re: [Haskell-cafe] SYB: extending a generic reader with a type class

2011-02-02 Thread José Pedro Magalhães
Hi,

I don't think you can do that, since `ext` relies on Typeable and Typeable
only works for monomorphic types.


Cheers,
Pedro

On Wed, Feb 2, 2011 at 20:31, Sugar Bzzz sugarbz...@gmail.com wrote:

 Dear -cafe,

 Is it possible to extend a generic reader (extR / ext1R from syb) with a
 type class?


 For example, let

 foo :: (Integral a) = SomeMonad a

 I could write:

 reader = ... `extR` (foo :: SomeMonad Int) `extR` (foo :: SomeMonad
 Integer)

 However, that is tedious.  Could I do something like

 reader = ... `extR` foo

 and have it apply to all instances of Integral?


 I hope I am being clear.

 Thank you.

 ___
 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] [web-devel] http-enumerator: redirects, streaming and keep-alive

2011-02-02 Thread Felipe Almeida Lessa
On Wed, Feb 2, 2011 at 11:57 AM, Michael Snoyman mich...@snoyman.com wrote:
 As far as keep-alive goes, I still need to do a bit more research, but
 my basic idea (with credit to Bryan O'Sullivan):

 * http (and family) will all take an extra argument, Maybe Manager.
 * Manager will be an abstract type that will keep an MVar (Map (Host,
 Port, IsSecure) Socket).
 * If http is provided with a Manager, then it uses the Socket
 available in the Manager. If none is available, it creates a new
 Socket and places it in the Manager.
 * If http is *not* provided with a Manager, then it creates a new
 socket and closes it before returning.
 * There will be a newManager :: IO Manager, and a closeManager ::
 Manager - IO (), which closes all Sockets in the Manager and empties
 out the inner Map.

How about concurrent use of Manager?  Should we do

A)
  do m - newManager
   forM xs $ forkIO $ doSomething m

B)
  forM xs $ forkIO $ do
m - newManager
doSomething m

While B) should work with any sane Manager implementation, it is not
optimal.  If all your connections are to the same host, than both
approaches are the same.  But if access hosts O and P, for example,
than it is possible that Manager m1 has an open connection to O, but
you try connect to O using another Manager m2.  That means that
ideally we should support approach A) as well.  However, to support A
a simple Map inside an MVar isn't sufficient.

Cheers! =)

-- 
Felipe.

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


Re: [Haskell-cafe] [web-devel] http-enumerator: redirects, streaming and keep-alive

2011-02-02 Thread Michael Snoyman
On Wed, Feb 2, 2011 at 10:15 PM, Felipe Almeida Lessa
felipe.le...@gmail.com wrote:
 On Wed, Feb 2, 2011 at 11:57 AM, Michael Snoyman mich...@snoyman.com wrote:
 As far as keep-alive goes, I still need to do a bit more research, but
 my basic idea (with credit to Bryan O'Sullivan):

 * http (and family) will all take an extra argument, Maybe Manager.
 * Manager will be an abstract type that will keep an MVar (Map (Host,
 Port, IsSecure) Socket).
 * If http is provided with a Manager, then it uses the Socket
 available in the Manager. If none is available, it creates a new
 Socket and places it in the Manager.
 * If http is *not* provided with a Manager, then it creates a new
 socket and closes it before returning.
 * There will be a newManager :: IO Manager, and a closeManager ::
 Manager - IO (), which closes all Sockets in the Manager and empties
 out the inner Map.

 How about concurrent use of Manager?  Should we do

 A)
  do m - newManager
       forM xs $ forkIO $ doSomething m

 B)
  forM xs $ forkIO $ do
    m - newManager
    doSomething m

 While B) should work with any sane Manager implementation, it is not
 optimal.  If all your connections are to the same host, than both
 approaches are the same.  But if access hosts O and P, for example,
 than it is possible that Manager m1 has an open connection to O, but
 you try connect to O using another Manager m2.  That means that
 ideally we should support approach A) as well.  However, to support A
 a simple Map inside an MVar isn't sufficient.

Good point: it should be a MVar (Map HostInfo (MVar Socket)) I think*

Thanks,
Michael

* It's late here, just make sure I'm not saying something stupid ;).

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


Re: [Haskell-cafe] [web-devel] http-enumerator: redirects, streaming and keep-alive

2011-02-02 Thread Antoine Latter
On Wed, Feb 2, 2011 at 2:28 PM, Michael Snoyman mich...@snoyman.com wrote:
 On Wed, Feb 2, 2011 at 10:15 PM, Felipe Almeida Lessa
 felipe.le...@gmail.com wrote:
 On Wed, Feb 2, 2011 at 11:57 AM, Michael Snoyman mich...@snoyman.com wrote:
 As far as keep-alive goes, I still need to do a bit more research, but
 my basic idea (with credit to Bryan O'Sullivan):

 * http (and family) will all take an extra argument, Maybe Manager.
 * Manager will be an abstract type that will keep an MVar (Map (Host,
 Port, IsSecure) Socket).
 * If http is provided with a Manager, then it uses the Socket
 available in the Manager. If none is available, it creates a new
 Socket and places it in the Manager.
 * If http is *not* provided with a Manager, then it creates a new
 socket and closes it before returning.
 * There will be a newManager :: IO Manager, and a closeManager ::
 Manager - IO (), which closes all Sockets in the Manager and empties
 out the inner Map.

 How about concurrent use of Manager?  Should we do

 A)
  do m - newManager
       forM xs $ forkIO $ doSomething m

 B)
  forM xs $ forkIO $ do
    m - newManager
    doSomething m

 While B) should work with any sane Manager implementation, it is not
 optimal.  If all your connections are to the same host, than both
 approaches are the same.  But if access hosts O and P, for example,
 than it is possible that Manager m1 has an open connection to O, but
 you try connect to O using another Manager m2.  That means that
 ideally we should support approach A) as well.  However, to support A
 a simple Map inside an MVar isn't sufficient.

 Good point: it should be a MVar (Map HostInfo (MVar Socket)) I think*


Or you could remove the socket from the map while it's in use.

Antoine

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


Re: [Haskell-cafe] [web-devel] http-enumerator: redirects, streaming and keep-alive

2011-02-02 Thread Felipe Almeida Lessa
On Wed, Feb 2, 2011 at 6:30 PM, Antoine Latter aslat...@gmail.com wrote:
 Or you could remove the socket from the map while it's in use.

And what about connection limits?  We shouldn't create a thousand
connections to the same host =).

-- 
Felipe.

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


Re: [Haskell-cafe] timely shutdown of timer threads

2011-02-02 Thread Warren Harris
Interesting. I hadn't thought of this solution. You're forking the timer to yet 
a third thread so that if it continues waiting beyond the checkpoint thread 
shutdown it doesn't really matter. I guess that works as long as the main 
thread doesn't wait for all other threads to terminate before terminating the 
app.

It still seems to me that haskell is lacking when it comes to operations that 
can wait for multiple conditions.

Warren


On Feb 1, 2011, at 6:25 PM, Albert Y. C. Lai wrote:

 On 11-02-01 02:58 PM, Warren Harris wrote:
 I have an application that forks a thread to run an activity on a timer. 
 (The activity happens to be Berkeley DB checkpointing, but that's actually 
 beside the point here.) The problem is that when the application wants to 
 quit, I would like my main thread to be able to tell the timer thread to 
 shut down in a timely way. However, I don't see a primitive in haskell that 
 allows me to both wait for a timeout, or a notification. (If I were to do 
 this in java, I would use wait/notify.)
 
 Use an MVar for signalling; use a two-valued data type to represent 
 time-to-work or time-to-die. For extra correctness, use a second MVar to be 
 notified that the child thread is really done --- because otherwise there 
 would be the race condition of the child thread still in the middle of 
 critical I/O when the program quits.
 
 import Control.Concurrent
 import Control.Exception(finally)
 
 data DoOrDie = Do | Die
 
 main = do
  v - newEmptyMVar
  finale - newEmptyMVar
  forkIO (timeloop v `finally` putMVar finale ())
  putStrLn press enter to quit
  getLine
  putMVar v Die
  takeMVar finale
 
 timeloop v = run where
  run = do
forkIO (threadDelay 1500  putMVar v Do)
m - takeMVar v
case m of
  Do - putStrLn checkpoint  run
  Die - putStrLn checkmate
 
 ___
 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] [web-devel] http-enumerator: redirects, streaming and keep-alive

2011-02-02 Thread Antoine Latter
On Wed, Feb 2, 2011 at 3:01 PM, Felipe Almeida Lessa
felipe.le...@gmail.com wrote:
 On Wed, Feb 2, 2011 at 6:30 PM, Antoine Latter aslat...@gmail.com wrote:
 Or you could remove the socket from the map while it's in use.

 And what about connection limits?  We shouldn't create a thousand
 connections to the same host =).


Not a bad idea, but that may be creeping outside the scope of the bug
as reported.

If you're writing a web-scraper/spider, it is true you might need some
sort of higher-level manager to handle concurrent access. I'm not sure
what that would look like, though

 --
 Felipe.


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


Re: [Haskell-cafe] timely shutdown of timer threads

2011-02-02 Thread Johan Tibell
On Wed, Feb 2, 2011 at 10:42 PM, Warren Harris warrensomeb...@gmail.com wrote:
 Interesting. I hadn't thought of this solution. You're forking the timer to 
 yet a third thread so that if it continues waiting beyond the checkpoint 
 thread shutdown it doesn't really matter. I guess that works as long as the 
 main thread doesn't wait for all other threads to terminate before 
 terminating the app.

 It still seems to me that haskell is lacking when it comes to operations that 
 can wait for multiple conditions.

I think we can make waiting for both I/O activity and timers at the
same time using the I/O manager. I will need to do this for my planned
timeout support in the network package.

Johan

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


Re: [Haskell-cafe] timely shutdown of timer threads

2011-02-02 Thread Warren Harris

On Feb 2, 2011, at 2:02 PM, Johan Tibell wrote:

 On Wed, Feb 2, 2011 at 10:42 PM, Warren Harris warrensomeb...@gmail.com 
 wrote:
 Interesting. I hadn't thought of this solution. You're forking the timer to 
 yet a third thread so that if it continues waiting beyond the checkpoint 
 thread shutdown it doesn't really matter. I guess that works as long as the 
 main thread doesn't wait for all other threads to terminate before 
 terminating the app.
 
 It still seems to me that haskell is lacking when it comes to operations 
 that can wait for multiple conditions.
 
 I think we can make waiting for both I/O activity and timers at the
 same time using the I/O manager. I will need to do this for my planned
 timeout support in the network package.

I could see wanting to wait for an MVar, timeout, IO activity, STM channels 
(anything that could block), all in the same event handler. (Rather like the 
old WaitForMultipleObjects on Windows.) This would also require a way to test 
each condition without blocking (MVar has this with tryTakeMVar, but it doesn't 
look like they all support it.)

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


[Haskell-cafe] Haskell Weekly News: Issue 167 - February 02, 2011

2011-02-02 Thread Daniel Santa Cruz
   Welcome to issue 167 of the HWN, a newsletter covering developments in
   the [1]Haskell community. This release covers the week of January 23 to
   29, 2011.

   This week I've added a section which compiles a list of the top answers
   given in StackOverflow during the week. These seem to be of more
   interest to more experienced Haskell users than the newbie questions
   usually posted on the site. See what you think.

Announcements

   R. Emre Basar [2]annouced the release of follower, a tool that allows
   you to follow people's tweets without having an account with Twitter.

   Alberto Ruiz [3]announced hmatrix version 0.11, a package for numerical
   computation based on LAPACK and SGL.

   Michael Snoyman [4]made some point updates for WAI and Warp. They fix
   some documentation issues, add some status aliases, make it possible to
   handle exceptions more easily, and make things more responsive on
   Windows.

   Antoine Latter [5]announced a minor point release for Parsec 3.1.0.

   John Meacham [6]announced version 0.7.7 of jhc is out! This release
   fixes a large number of bugs that cropped up when compiling haskell out
   in the wild as well as adds some more features. A major one being the
   garbage collector is enabled by default.

Quotes of the Week

 * Twey: Maybe Bool: the Haskell equivalent to True/False/FileNotFound
 * elliott: Only two things in the universe are certain: Death, and
   two of the libraries you've decided to use taking different types
   of ByteString.
 * shapr: my personal heuristics judge Haskell as totally practical,
   perhaps too practical.
 * monochrom: the guys that I see when I look into the irc window
   believe that I'm just a bunch of text.
 * bernardh: Refactoring: spend a week to get where you were
 * Question: How do I use fix, and how does it work? Answer (by
   TomMD): The prank answer is fix has no real use, it's just there
   so you can type 'fix error' in ghci and feel good about yourself.

Top Reddit Stories

   * Haskell at Bump
 Domain: devblog.bu.mp, Score: 44, Comments: 9
 On Reddit: http://www.reddit.com/r/haskell/comments/f8cr8/haskell_at_bump/
 Original: http://devblog.bu.mp/haskell-at-bump

   * How to write a simple TCP Server in Haskell
 Domain: catonmat.net, Score: 35, Comments: 5
 On Reddit:
http://www.reddit.com/r/haskell/comments/faa80/how_to_write_a_simple_tcp_server_in_haskell/
 Original: http://catonmat.net/blog/simple-haskell-tcp-server

   * Snap Framework article in IEEE Internet Computing
 Domain: steve.vinoski.net, Score: 32, Comments: 1
 On Reddit:
http://www.reddit.com/r/haskell/comments/fa0e0/snap_framework_article_in_ieee_internet_computing/
 Original: 
http://steve.vinoski.net/blog/2011/01/21/column-on-the-snap-framework/

   * My Dream GHCi Session, Take 2
 Domain: cdsmith.wordpress.com, Score: 23, Comments: 5
 On Reddit:
http://www.reddit.com/r/haskell/comments/f8im5/my_dream_ghci_session_take_2/
 Original: 
http://cdsmith.wordpress.com/2011/01/24/my-dream-ghci-session-take-2/

   * Text: a visual programming language based on Haskell, demo
 Domain: vimeo.com, Score: 20, Comments: 3
 On Reddit:
http://www.reddit.com/r/haskell/comments/fbgxd/text_a_visual_programming_language_based_on/
 Original: http://vimeo.com/19273744

   * Hoogle Embed
 Domain: neilmitchell.blogspot.com, Score: 16, Comments: 3
 On Reddit: http://www.reddit.com/r/haskell/comments/f7iqa/hoogle_embed/
 Original: http://neilmitchell.blogspot.com/2011/01/hoogle-embed.html

   * What does this mean for Haskell on Android?
 Domain: reddit.com, Score: 15, Comments: 12
 On Reddit:
http://www.reddit.com/r/haskell/comments/f9o67/what_does_this_mean_for_haskell_on_android/
 Original: 
http://www.reddit.com/r/Android/comments/f97zh/google_not_happy_with_number_of_android_app/c1ebkji

   * Evolving a computer with Genprog (exercises from the TECS book)
 Domain: jpmoresmau.blogspot.com, Score: 13, Comments:
 On Reddit:
http://www.reddit.com/r/haskell/comments/f7y6a/evolving_a_computer_with_genprog_exercises_from/
 Original: 
http://jpmoresmau.blogspot.com/2011/01/evolving-computer-with-tecs-and-genprog.html

   * All about MVars : Inside T5
 Domain: blog.ezyang.com, Score: 13, Comments: 4
 On Reddit:
http://www.reddit.com/r/haskell/comments/fduxb/all_about_mvars_inside_t5/
 Original: http://blog.ezyang.com/2011/02/all-about-mvars/

   * What textbooks would be useful to start approaching the
low-hanging fruit on the ghc project?
 Domain: self.haskell, Score: 12, Comments: 8
 On Reddit:
http://www.reddit.com/r/haskell/comments/f8dm5/what_textbooks_would_be_useful_to_start/
 Original: 
/r/haskell/comments/f8dm5/what_textbooks_would_be_useful_to_start/

Top StackOverflow Answers

   * What is an idiomatic way to add lists in Haskell?
 Votes: 14
 Read on SO:

Re: [Haskell-cafe] timely shutdown of timer threads

2011-02-02 Thread Albert Y. C. Lai

On 11-02-02 04:42 PM, Warren Harris wrote:

It still seems to me that haskell is lacking when it comes to operations that 
can wait for multiple conditions.


STM opens the avenue to waiting for multiple conditions.

import Control.Concurrent
import Control.Concurrent.STM
import Control.Exception(finally)

data DoOrDie = Do | Die

main = do
  die - atomically newEmptyTMVar
  finale - atomically newEmptyTMVar
  forkIO (timeloop die `finally` atomically (putTMVar finale ()))
  putStrLn press enter to quit
  getLine
  atomically (putTMVar die Die)
  atomically (takeTMVar finale)

timeloop die = run where
  run = do
w - atomically newEmptyTMVar
i - forkIO (threadDelay 1500  atomically (putTMVar w Do))
r - atomically (takeTMVar w `orElse` takeTMVar die)
case r of
  Do - putStrLn checkpoint  run
  Die - killThread i  putStrLn checkmate

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


[Haskell-cafe] Problems with iteratees

2011-02-02 Thread wren ng thornton
I'm working on a project that's using John Lato's old implementation of 
iteratees (iteratee = 0.3.5   0.4; I'm hoping to migrate to 0.7 
soon, but that's a ways off yet) and I'm running into some issues I 
haven't been able to untangle. Maybe a new set of eyes can help...


The overarching program brings three things together for doing some 
interprocess communication: the medium is Posix FIFOs, the messages 
themselves are encoded with Google's Protocol Buffers[1], and the 
control flow for getting and processing the messages is handled by 
iteratees. The error message indicates iteratees are at fault, though it 
could be an error elsewhere instead.


First, some boilerplate.

-- For messageWithLengthEnumeratee only
{-# LANGUAGE ScopedTypeVariables #-}

import qualified Text.ProtocolBuffers.Reflections as R
import qualified Text.ProtocolBuffers.WireMessage as W
import qualified Text.ProtocolBuffers.Get as G
import qualified Data.ByteString  as S
import qualified Data.ByteString.Lazy as L
import qualified Data.Iterateeas I
import   Data.Iteratee.WrappedByteString
import   Data.Word(Word8)
import   Control.Monad(liftM)


-- | Return a final value, and the remainder of the stream.
idone :: a - c el - I.IterGV c el m a
idone a xs = I.Done a (I.Chunk xs)
{-# INLINE idone #-}


-- | Convert a continuation into 'I.IterGV'.
icontinue
:: (I.StreamG c el - m (I.IterGV c el m a))
- I.IterGV c el m a
icontinue k = I.Cont (I.IterateeG k) Nothing
{-# INLINE icontinue #-}


-- | Throw an error message.
ifail :: (Monad m) = String - I.IterGV c el m a
ifail msg = ierror (I.Err msg)
{-# INLINE ifail #-}


-- | An 'I.IterGV' variant of 'I.throwErr'.
ierror :: (Monad m) = I.ErrMsg - I.IterGV c el m a
ierror err = I.Cont (I.throwErr err) (Just err)
{-# INLINE ierror #-}


toLazyBS :: S.ByteString - L.ByteString
toLazyBS = L.fromChunks . (:[])
{-# INLINE toLazyBS #-}


toStrictBS :: L.ByteString - S.ByteString
toStrictBS = S.concat . L.toChunks
{-# INLINE toStrictBS #-}

Now we have the code for converting the Get monad used by protocol 
buffers into an iteratee. This should be correct, and it's pretty 
straightforward.


-- | Convert a 'G.Result' iteratee state into a 'I.IterGV'
-- iteratee state.
result2iterv
:: (Monad m)
= G.Result a
- I.IterGV WrappedByteString Word8 m a
result2iterv (G.Finished rest _ a) = idone a (WrapBS $ toStrictBS rest)
result2iterv (G.Failed _ msg)  = ifail msg
result2iterv (G.Partial k) = I.Cont (iterify k) Nothing


-- | Convert a protobuf-style continuation into an
-- iteratee-style continuation.
iterify
:: (Monad m)
= (Maybe L.ByteString - G.Result a)
- I.IterateeG WrappedByteString Word8 m a
iterify k =
I.IterateeG $ \s - return $!
case s of
I.Chunk (WrapBS xs) - result2iterv $ k (Just $ toLazyBS xs)
I.EOF Nothing   - result2iterv $ k Nothing
I.EOF (Just err)- ierror err


-- | A variant of 'G.runGet' as an iteratee.
runGetIteratee
:: (Monad m, R.ReflectDescriptor a, W.Wire a)
= G.Get a
- I.IterateeG WrappedByteString Word8 m a
runGetIteratee g =
I.IterateeG $ \s - return $!
case s of
I.Chunk (WrapBS xs) - result2iterv $ G.runGet g (toLazyBS xs)
I.EOF Nothing   - result2iterv $ G.runGet g L.empty
I.EOF (Just err)- ierror err

Okay, now we have an iteratee which consumes a stream of bytestrings and 
will render a protocol buffer message. But what we really want is an 
enumeratee to do this repeatedly so we can use an iteratee to consume 
the stream of messages. I have the following definition which 
typechecks, but doesn't seem to work. The call to convStream seems like 
it always hangs:


-- | A variant of 'G.runGet' as an enumeratee.
runGetEnumeratee
:: (Monad m, R.ReflectDescriptor a, W.Wire a)
= G.Get a
- I.EnumeratorN WrappedByteString Word8 [] a m b
runGetEnumeratee =
I.convStream . liftM (Just . (:[])) . runGetIteratee

Once we have a working definition of runGetEnumeratee, then we can 
define the specific enumeratee we need:


-- | An enumeratee for converting bytestrings into protocol
-- buffer messages.
messageWithLengthEnumeratee
:: forall m msg a
.  (Monad m, R.ReflectDescriptor msg, W.Wire msg)
= I.EnumeratorN WrappedByteString Word8 [] msg m a
messageWithLengthEnumeratee =
   runGetEnumeratee (W.messageWithLengthGetM :: G.Get msg)

And then at the use site we have the following:

let processRequest = ... :: msg - IO ()
I.run -- run 

Re: [Haskell-cafe] Inheritance and Wrappers

2011-02-02 Thread Brandon Moore

OK, what about this as a use case then. I want to create a type class 'Term' 
with only one function in it. The function returns a 'termTag' which labels 
the 

kind of a value in a DSL.  

class Term a where
   termTag :: a - String


A user of this type-class can happily provide an instance without any other 
type 

class requirement. However, I want those types which are instances of Data to 
be 

an instance of Term automatically. On top of that, I don't want to stop the 
user 

from creating a special instance for their data type.

I want to be able to write the following instance to accomplish that:

instance Data t = Term t where
termTag = show . toConstr


A much more predictable option is to provide this default implementation
as a function

termTagData :: (Data t) = (t - String)

and let the library clients use it in their instances if the behavior is fine:

instance Term MyT where
  termTag = termTagData

And if the user wants to write a more specific instance, they should be 
welcome 

to do so:

instance Term UserDT where
termTag (...) = ...

I am not very much interested in the technical details about how things 
currently are, I am more interested in a discussion about why (if?) this would 
be considered a design flaw?


Here's one thing to consider:

Can you write a function

f :: (Data a) = a - String
f x = termTag x

It would seem the Data a = Term a instance justifies
this function, and it will always use the default instance.

Now, what happens if f is applied to a value of some type
T which is an instance of Data, but has a custom Term instance?

Brandon.


  

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


Re: [Haskell-cafe] Problems with iteratees

2011-02-02 Thread Maciej Wos
I think the problem is that the iteratee you give to I.convStream
always returns Just [something] while you should return Nothing on
EOF.

Suppose you want to have an enumeratee that adds 1 to each integer in
the stream and then use stream2list to get an iteratee that consumes
the result stream and returns it as a list:

 let iter = joinI $ (convStream (head = return . Just . (:[]) . (+1))) 
 stream2list :: IterateeG [] Int IO [Int]
 run iter
*** Exception: control message: Just (Err EOF)

Note that run simply passes EOF to iter and extracts the result.
Instead of throwing an error the code above should produce an [] (i.e.
no stream to consume, no elements in the list). This can be fixed by
checking whether the stream is empty:

 let iter = joinI $ (convStream (isFinished = maybe (head = return . Just 
 . (:[]) . (+1)) (\_ - return Nothing))) stream2list :: IterateeG [] Int IO 
 [Int]
 run iter
[]

I think you should do the same in your code:

runGetEnumeratee get =
I.convStream $ isFinished = maybe convIter (\_ - return Nothing)
where
convIter = (Just . return) `liftM` (runGetIteratee get)

When the stream is not empty, it runs (runGetIteratee get) and returns
its result wrapped in Just . (:[]). When the stream is empty, it
returns Nothing so convStream knows it is done.

-- Maciej

On Thu, Feb 3, 2011 at 10:06 AM, wren ng thornton w...@freegeek.org wrote:
 I'm working on a project that's using John Lato's old implementation of
 iteratees (iteratee = 0.3.5   0.4; I'm hoping to migrate to 0.7 soon,
 but that's a ways off yet) and I'm running into some issues I haven't been
 able to untangle. Maybe a new set of eyes can help...

 The overarching program brings three things together for doing some
 interprocess communication: the medium is Posix FIFOs, the messages
 themselves are encoded with Google's Protocol Buffers[1], and the control
 flow for getting and processing the messages is handled by iteratees. The
 error message indicates iteratees are at fault, though it could be an error
 elsewhere instead.

 First, some boilerplate.

    -- For messageWithLengthEnumeratee only
    {-# LANGUAGE ScopedTypeVariables #-}

    import qualified Text.ProtocolBuffers.Reflections as R
    import qualified Text.ProtocolBuffers.WireMessage as W
    import qualified Text.ProtocolBuffers.Get         as G
    import qualified Data.ByteString                  as S
    import qualified Data.ByteString.Lazy             as L
    import qualified Data.Iteratee                    as I
    import           Data.Iteratee.WrappedByteString
    import           Data.Word                        (Word8)
    import           Control.Monad                    (liftM)


    -- | Return a final value, and the remainder of the stream.
    idone :: a - c el - I.IterGV c el m a
    idone a xs = I.Done a (I.Chunk xs)
    {-# INLINE idone #-}


    -- | Convert a continuation into 'I.IterGV'.
    icontinue
        :: (I.StreamG c el - m (I.IterGV c el m a))
        - I.IterGV c el m a
    icontinue k = I.Cont (I.IterateeG k) Nothing
    {-# INLINE icontinue #-}


    -- | Throw an error message.
    ifail :: (Monad m) = String - I.IterGV c el m a
    ifail msg = ierror (I.Err msg)
    {-# INLINE ifail #-}


    -- | An 'I.IterGV' variant of 'I.throwErr'.
    ierror :: (Monad m) = I.ErrMsg - I.IterGV c el m a
    ierror err = I.Cont (I.throwErr err) (Just err)
    {-# INLINE ierror #-}


    toLazyBS :: S.ByteString - L.ByteString
    toLazyBS = L.fromChunks . (:[])
    {-# INLINE toLazyBS #-}


    toStrictBS :: L.ByteString - S.ByteString
    toStrictBS = S.concat . L.toChunks
    {-# INLINE toStrictBS #-}

 Now we have the code for converting the Get monad used by protocol buffers
 into an iteratee. This should be correct, and it's pretty straightforward.

    -- | Convert a 'G.Result' iteratee state into a 'I.IterGV'
    -- iteratee state.
    result2iterv
        :: (Monad m)
        = G.Result a
        - I.IterGV WrappedByteString Word8 m a
    result2iterv (G.Finished rest _ a) = idone a (WrapBS $ toStrictBS rest)
    result2iterv (G.Failed _ msg)      = ifail msg
    result2iterv (G.Partial k)         = I.Cont (iterify k) Nothing


    -- | Convert a protobuf-style continuation into an
    -- iteratee-style continuation.
    iterify
        :: (Monad m)
        = (Maybe L.ByteString - G.Result a)
        - I.IterateeG WrappedByteString Word8 m a
    iterify k =
        I.IterateeG $ \s - return $!
            case s of
            I.Chunk (WrapBS xs) - result2iterv $ k (Just $ toLazyBS xs)
            I.EOF Nothing       - result2iterv $ k Nothing
            I.EOF (Just err)    - ierror err


    -- | A variant of 'G.runGet' as an iteratee.
    runGetIteratee
        :: (Monad m, R.ReflectDescriptor a, W.Wire a)
        = G.Get a
        - I.IterateeG WrappedByteString Word8 m a
    runGetIteratee g =
        I.IterateeG $ \s - return $!
            case s of
            I.Chunk (WrapBS xs) - result2iterv $ G.runGet 

Re: [Haskell-cafe] [web-devel] http-enumerator: redirects, streaming and keep-alive

2011-02-02 Thread Michael Snoyman
On Thu, Feb 3, 2011 at 12:00 AM, Antoine Latter aslat...@gmail.com wrote:
 On Wed, Feb 2, 2011 at 3:01 PM, Felipe Almeida Lessa
 felipe.le...@gmail.com wrote:
 On Wed, Feb 2, 2011 at 6:30 PM, Antoine Latter aslat...@gmail.com wrote:
 Or you could remove the socket from the map while it's in use.

 And what about connection limits?  We shouldn't create a thousand
 connections to the same host =).


 Not a bad idea, but that may be creeping outside the scope of the bug
 as reported.

 If you're writing a web-scraper/spider, it is true you might need some
 sort of higher-level manager to handle concurrent access. I'm not sure
 what that would look like, though

 --
 Felipe.



I think Felipe's point is that using the approach I outlined, we will
never spawn more than one connection to a single host. By simply
taking the socket out of the map, there's no limit to the number of
sockets that will be created.

Michael

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


Re: [Haskell-cafe] [web-devel] http-enumerator: redirects, streaming and keep-alive

2011-02-02 Thread Antoine Latter
On Wed, Feb 2, 2011 at 11:06 PM, Michael Snoyman mich...@snoyman.com wrote:
 On Thu, Feb 3, 2011 at 12:00 AM, Antoine Latter aslat...@gmail.com wrote:
 On Wed, Feb 2, 2011 at 3:01 PM, Felipe Almeida Lessa
 felipe.le...@gmail.com wrote:
 On Wed, Feb 2, 2011 at 6:30 PM, Antoine Latter aslat...@gmail.com wrote:
 Or you could remove the socket from the map while it's in use.

 And what about connection limits?  We shouldn't create a thousand
 connections to the same host =).


 Not a bad idea, but that may be creeping outside the scope of the bug
 as reported.

 If you're writing a web-scraper/spider, it is true you might need some
 sort of higher-level manager to handle concurrent access. I'm not sure
 what that would look like, though

 --
 Felipe.



 I think Felipe's point is that using the approach I outlined, we will
 never spawn more than one connection to a single host. By simply
 taking the socket out of the map, there's no limit to the number of
 sockets that will be created.

Ah, then you would block one thread on another if the host info is in
the map? I get it.

Strictly one socket per host might be a tricky invariant to maintain -
you'd have to insert an empty socket MVar in the map on lookup
failure, and the shuffling of the nested MVars seems tricky off the
top of my head.

But even without all of that I don't think you'd be flooding the host
any more than without any keepalive support, which was what I was
getting at.

This is just speculation on my part - I don't have a stake in this, it
just sounded like an interesting problem. I'd hate to be steering this
into a design black hole.

Antoine


 Michael


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


[Haskell-cafe] Another Question

2011-02-02 Thread Navin Rustagi
hi , 

I am stuck in the following problem. 

I am maintaining  a list of  tuples of the form 
([Char],Int,Int, Int,Int) . The purpose of maintaining the tuples is that the 
program reads from a file line by line , Matches the contents with the first 
element of the tuple and updates the tuple respectively.

The precise function I am using is as follows 


tupup::Bool-[Char]-Int-Int-Int-Int-Char-([Char],Int,Int,Int,Int) 
tupup val elf els elr ell elx ys= if val then 
  case ys of  'A'  - (elf, 
els+1,elr,ell,elx) 
  'G'  - (elf,els, elr 
+1,ell,elx)
  'C'  - (elf,els,elr,  
ell 
+1,elx) 
  'T'  - (elf,els,elr,ell, 
 elx +1)
   else (elf,els,elr,ell,elx)


uptable::[[Char]]-[([Char],Int,Int,Int,Int)]-[([Char],Int,Int,Int,Int)]
uptable (xf:xs) main_array = map (\(x,y,z,r,t)- tupup (x==xf) x y z r t 
(secvalue xs) ) main_array
   
 
It gives the error ERROR - Control stack overflow. I assume it is because of 
the 
lazy evaluation . 
Is there a way to enforce strict evaluation only for the function tupup. 



Thanks, 

Navin 


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