Re: [Haskell-cafe] IO (Either a Error) question

2010-05-09 Thread wren ng thornton

Brandon S. Allbery KF8NH wrote:
It's not a call, it's a definition as shown above.  The simpler 
translation is:


  x - y

becomes

  y = \x -

(note incomplete expression; the next line must complete it) and the 
refutable pattern match takes place in the lambda binding.  But because 
of the whole fail thing, instead of letting pattern match failure be 
caught by the lambda binding it gets handled specially beforehand, which 
is especially silly when in most cases fail is defined to do the same 
thing as the lambda binding would.


I'm suggesting (as is David, I think) that a saner definition would let 
the lambda binding randle refutable patterns, and for something like 
Maybe (=) can decide how to deal with it in the usual way.  Otherwise 
you're either using a default fail that duplicates the lambda binding, 
or if you want custom handling (as with Maybe and Either that propagate 
Nothing/Left _ respectively) you end up reimplementing part of (=) as 
fail, which is just dumb.


+1.

I've never understood what exactly the goal of 'fail'-able patterns was. 
It's a *solution* to the problem of pattern matching, but what is the 
*goal* of allowing pattern matching in the first place? What semantics 
is the solution trying to capture?


The vast majority of code I've written or seen uses plain variables as 
the binding pattern, in which case the definition of (=) should handle 
issues like this. And in the cases where we want more than just a plain 
variable, we usually want to handle the exceptional branch on a 
case-by-case basis, so the pattern gets boiled out of the - syntax anyways.


The only examples I can think of where we'd want 'fail'-able patterns 
are entirely pedagogical (and are insignificantly altered by not using 
'fail'-able patterns). I can't think of any real code where it would 
actually help with clarity.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell and the Software design process

2010-05-09 Thread wren ng thornton

Rafael Cunha de Almeida wrote:

I don't think that safeSecondElement is worse than secondElement. I think it's
better for the program to crash right away when you try to do something that
doesn't make sense.

Getting the secondElement of a list with one or less elements doesn't make
sense, so you are definetely doing something wrong if you expected the list to
have two elements, but it doesn't. It's best that the program crashes there,
than propagate the error and crash somewhere else or, worse, not crash at all
and give a wrong answer.


There are two different issues at stake here, one is reactive and the 
other is proactive. You're responding to the reactive question: how do I 
deal with unexpected errors when they arise? But those who argue against 
partial functions are usually responding to the proactive question: how 
do I prevent unexpected errors from arising in the first place?


By allowing partial functions we allow for the introduction of 
unexpected errors, which then forces us to handle the reactive question 
of what to do when those errors show up. But if partial functions are 
avoided, then there are no unexpected errors (of that sort) which could 
ever show up.


We already have to deal with bottom, that's a fact of life for 
general-purpose programming. But partial functions allow us to introduce 
bottom in new ways. When we have bottom meaning just non-termination, 
then we have a good idea about how we should treat it. But once we start 
introducing other bottoms for things like non-exhaustive pattern 
matching or recoverable exceptions, then it's no longer clear what 
exactly bottom means. This in turn makes it hard to know whether the 
semantics of the program match the semantics we want. In particular, I'm 
a fan of semantics which say my program will not crash. Sure, crashing 
is better than silently corrupting everything; but not crashing is 
better than crashing.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: How efficient is read?

2010-05-09 Thread Paul R


PEM In fact, the time you'd spend writing read instances would not
PEM compare to the half hour required to learn parsec. 

maybe the wiki could be updated to give more clues for a newcomer.

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

in particular :

 - link 1 points to the parsec site, with an almost 10 years old
   documentation, for a previous major release
 - link 3 is broken


The rest of the page is a bit terse as well. I'm really wondering what
one should start reading to learn how to parse a stream in haskell.

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


Re: [Haskell-cafe] Haskell and the Software design process

2010-05-09 Thread wren ng thornton

Gregory Crosswhite wrote:

Yes, but I think that it is also important to distinguish between cases
where an error is expected to be able to occur at runtime, and cases
where an error could only occur at runtime *if the programmer screwed up*.


Well sure, but how can you demonstrate that you (the programmer) haven't 
screwed up? That's the point that I'm most interested in.


Certainly there is a difference between exceptional behavior at runtime 
(e.g., due to malformed inputs) vs programming errors. We can't stop the 
former without broadening the scope of the typesystem to include runtime 
inputs; but we can, at least idealistically, stop the latter. While 
complex invariants require full dependent types to capture, there are a 
surprising number of invariants that Haskell's type system can already 
capture (even without GADTs!).




If you structure your code to preserve and rely on the invariant that a
given list has at least two elements, then it makes sense to call secondElement
because if the list doesn't have two elements then you screwed up.  Furthermore,
there is no way to recover from such an error because you don't necessarily
know where the invariant was broken because if you did you would have
expected the possibility and already fixed it.


If you're structuring your code with that invariant, then why aren't you 
using the correct type?


data AtLeastTwo a = ALT a a [a]

If your response is that you use too many of the standard list 
functions, then write a module with ALT versions (because evidently you 
need one). If your response is that you convert between lists and ALT 
too often, then you probably need to restructure the code. At the very 
least you should be using a newtype and smart constructors, so that you 
can actually prove your invariant whenever necessary:


newtype AtLeastTwo a = Hidden_ALT [a]
altEnd   :: a - a - AtLeastTwo a
altCons  :: a - AtLeastTwo a - AtLeastTwo a
altList  :: a - a - [a] - AtLeastTwo a
fromList :: [a] - Maybe (AtLeastTwo a)
toList   :: AtLeastTwo a - [a]

Without smart constructors or an ADT to enforce your invariants, why 
should you be convinced that you (the programmer) haven't messed up? The 
cheap and easy access to ADTs is one of the greatest benefits of Haskell 
over mainstream languages, don't fear them.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How efficient is read?

2010-05-09 Thread Malcolm Wallace
In fact, the time you'd spend writing read instances would not  
compare to the half hour required to learn parsec.
And your parser will be efficient (at least, according to the guys  
from the parser team ;-)



I agree that Read is likely to be inefficient, but the more important  
aspect is that it gives you no useful error message if the parse fails.


Parser combinators are really rather easy to learn and use, and tend  
to give decent error reports when something goes wrong.  In fact, if  
you just want Read-like functionality for a set of Haskell datatypes,  
use polyparse: the DrIFT tool can derive polyparse's Text.Parse class  
(the equivalent of Read) for you, so you do not even need to write the  
parser yourself!


I would caution against using Parsec if your dataset is large.  Parsec  
does not return anything until it has seen the entire input, so can  
use a huge amount of memory.  The other day someone was observing on  
haskell-cafe that parsing a 9Mb XML file using a Parsec-based parser  
required 7Gb of memory, compared with 1.3Gb for a strict polyparse- 
based parser (still too much), and the happy conclusion was that the  
lazy polyparse variant uses a neglible amount by comparison.


(Declaration of interest: I wrote polyparse.)

Regards,
Malcolm

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


Re: [Haskell-cafe] How efficient is read?

2010-05-09 Thread Ivan Lazar Miljenovic
Malcolm Wallace malcolm.wall...@cs.york.ac.uk writes:
 (Declaration of interest: I wrote polyparse.)

For which I, for one, am grateful!

(So, when are you going to release an updated version with a fixed
definition of discard for the lazy parser? :p)

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Would it be evil to add deriving Typeable to newtype Q?

2010-05-09 Thread Jacques Carette

Mike Dillon wrote:

begin Ivan Lazar Miljenovic quotation:
  

I take it you haven't had the legal problems that DrIFT had when it used
to be called Derive?  http://www.dcs.gla.ac.uk/~nww/Derive/History.html



Looks
like they stopped selling it in June 2007, at least in the UK:


http://education.ti.com/educationportal/sites/UK/productDetail/uk_derive6.html

The other link I found redirected to a page that didn't mention Derive™
at all.
  


I can confirm that Derive, as a commercial product, no longer exists.  
[This comes from discussions with one of the original developers of 
Derive, as well as a developer at TI who worked on Derive until TI 
changed their computer algebra strategy]. 


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


Re: [Haskell-cafe] IO (Either a Error) question

2010-05-09 Thread Ben Millwood
On Sun, May 9, 2010 at 7:27 AM, wren ng thornton w...@freegeek.org wrote:

 The only examples I can think of where we'd want 'fail'-able patterns are
 entirely pedagogical (and are insignificantly altered by not using
 'fail'-able patterns). I can't think of any real code where it would
 actually help with clarity.


You're not a fan of e.g.

catMaybes xs = [x | Just x - xs]

or the do-notation form:

catMaybes xs = do
 Just x - xs
 return x

then? (I actually prefer foldr (maybe id (:)) [] but that's probably just me :)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How efficient is read?

2010-05-09 Thread Stephen Tetley
On 9 May 2010 08:45, Paul R paul.r...@gmail.com wrote:
[SNIP]

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

 in particular :

  - link 1 points to the parsec site, with an almost 10 years old
   documentation, for a previous major release
  - link 3 is broken


 The rest of the page is a bit terse as well. I'm really wondering what
 one should start reading to learn how to parse a stream in haskell.

Hi Paul

The 10 year old documentation is very good though - for my taste,
Parsec 2.0 is the best documented Haskell lib I've seen.

If you want to parse a stream, you don't want Parsec as produces as it
isn't an online parser - online meaning 'streaming' i.e. it can
produce some results during the 'work' rather than a single result at
the end. From the descriptions on Hackage, Parsimony and uu-parsinglib
sound like better candidates; similarly one of the Polyparse modules
provides an online parser.

If you want to learn how to write a streaming parser, pick one of
those - start work and post back to this list if/when you have
problems. Remember that a non-streaming parser is simpler than a
streaming one: you might want to write a version that works on short
input first and your result type has to support streaming (probably
best if it is a list). Also for any parser, but especially an online
one you'll have to be careful to use backtracking sparingly.

Best wishes

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


Re: [Haskell-cafe] Re: How efficient is read?

2010-05-09 Thread Ivan Lazar Miljenovic
Stephen Tetley stephen.tet...@gmail.com writes:
 The 10 year old documentation is very good though - for my taste,
 Parsec 2.0 is the best documented Haskell lib I've seen.

But does it help with Parsec-3?

 If you want to parse a stream, you don't want Parsec as produces as it
 isn't an online parser - online meaning 'streaming' i.e. it can
 produce some results during the 'work' rather than a single result at
 the end.

I thought this was one of the new features in Parsec-3...

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How efficient is read?

2010-05-09 Thread Stephen Tetley
On 9 May 2010 11:42, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote:

 If you want to parse a stream, you don't want Parsec ___ as it
 isn't an online parser - online meaning 'streaming' i.e. it can
 produce some results during the 'work' rather than a single result at
 the end.

 I thought this was one of the new features in Parsec-3...

Hi Ivan

Possibly?

If so, maybe the authors ought to mention it in the cabal.file /
package description. I know it can use bytestrings which have
efficiency advantages over String, but that doesn't make it online.


Best wishes

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


Re: [Haskell-cafe] Re: How efficient is read?

2010-05-09 Thread Ivan Lazar Miljenovic
Stephen Tetley stephen.tet...@gmail.com writes:

 On 9 May 2010 11:42, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote:

 If you want to parse a stream, you don't want Parsec ___ as it
 isn't an online parser - online meaning 'streaming' i.e. it can
 produce some results during the 'work' rather than a single result at
 the end.

 I thought this was one of the new features in Parsec-3...

 Possibly?

 If so, maybe the authors ought to mention it in the cabal.file /
 package description. I know it can use bytestrings which have
 efficiency advantages over String, but that doesn't make it online.

Well, RWH talks about Parsecs' input stream, so maybe I'm just
confusing the terms: http://book.realworldhaskell.org/read/using-parsec.html

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] mixing map and mapM ?

2010-05-09 Thread wren ng thornton

Pierre-Etienne Meunier wrote:

This way :

do
times-mapM PF.getFileStatus filenames = return.(map 
PF.modificationTime)

Or also :

do
times-mapM (PF.getFileStatus = (return.(PF.modificationTime))) 
filenames
let sorted=...

I do not know exactly how ghc compiles the IO monad, but it seems to me that 
the latter would allocate a little less.


FWIW, (a = (return . f)) == (liftM f a) ~= (fmap f a)

Where available, the fmap version is the most efficient. The liftM 
function can be less efficient since it's defined generically (namely 
with the bind/return definition above), whereas fmap can take advantage 
of knowing the specific monad it's working on. But then, not everyone 
defines Functor instances for their monads...


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: nun.haskell.org http services down?

2010-05-09 Thread Yitzchak Gale
Jason Dagit wrote:
 The last time I noticed it was down I made the following observations...
 I hope you find this info useful.

That is indeed very useful.

I had noticed a few times that the apache processes had not
exhausted memory when the problem occurred - though usually
they do exhaust memory. Your detective work is strong
evidence that the memory problem is probably just another
side effect of the real problem.

Right now, we are in the process of moving c.h.o to a server
with a more recent OS and more hardware capacity. That
will take a little while, so in the meantime we are trying to
use the available time most effectively by focusing mostly
on server upgrade. We are hoping to keep the old server
limping along in the meantime with band-aids like periodic
restarts of apache.

However, your work shows that this problem may not just
go away by itself with the upgrade.

Thanks for your help in further tracking down this problem.
Let us know (possibly off list) if you have any more
ideas.

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


Re: [Haskell-cafe] IO (Either a Error) question

2010-05-09 Thread Brandon S. Allbery KF8NH

On May 9, 2010, at 06:18 , Ben Millwood wrote:
On Sun, May 9, 2010 at 7:27 AM, wren ng thornton w...@freegeek.org  
wrote:


The only examples I can think of where we'd want 'fail'-able  
patterns are

entirely pedagogical (and are insignificantly altered by not using
'fail'-able patterns). I can't think of any real code where it would
actually help with clarity.


You're not a fan of e.g.

catMaybes xs = [x | Just x - xs]


I've always had the feeling that if I need catMaybes, I haven't  
thought through the data representation (or possibly manipulation)  
fully.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How efficient is read?

2010-05-09 Thread Brandon S. Allbery KF8NH

On May 9, 2010, at 06:53 , Ivan Lazar Miljenovic wrote:

Stephen Tetley stephen.tet...@gmail.com writes:
On 9 May 2010 11:42, Ivan Lazar Miljenovic  
ivan.miljeno...@gmail.com wrote:

If you want to parse a stream, you don't want Parsec ___ as it
isn't an online parser - online meaning 'streaming' i.e. it can
produce some results during the 'work' rather than a single  
result at

the end.


I thought this was one of the new features in Parsec-3...


Possibly?

If so, maybe the authors ought to mention it in the cabal.file /
package description. I know it can use bytestrings which have
efficiency advantages over String, but that doesn't make it online.


Well, RWH talks about Parsecs' input stream, so maybe I'm just
confusing the terms: http://book.realworldhaskell.org/read/using-parsec.html


Hm.  I'd understand that as referring to the fact that Parsec 3 can  
use arbitrary input types instead of [Char], not to streams as in  
stream fusion or lazy processing.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] mixing map and mapM ?

2010-05-09 Thread Brandon S. Allbery KF8NH

On May 9, 2010, at 07:18 , wren ng thornton wrote:
Where available, the fmap version is the most efficient. The liftM  
function can be less efficient since it's defined generically  
(namely with the bind/return definition above), whereas fmap can  
take advantage of knowing the specific monad it's working on. But  
then, not everyone defines Functor instances for their monads...



Arguably that deserves a bug report, as logically a Monad is an  
Applicative is a Functor (or read is a as subset of for pedantry).


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IO (Either a Error) question

2010-05-09 Thread Ivan Lazar Miljenovic
Brandon S. Allbery KF8NH allb...@ece.cmu.edu writes:
 I've always had the feeling that if I need catMaybes, I haven't
 thought through the data representation (or possibly manipulation)
 fully.

I've used catMaybes in several places: for example, in SourceGraph only
interesting analyses are reported (e.g. if there's only one connected
component, then don't bother mentioning it, as the big point is when
your module has more than one component); I indicate this by having each
separate analysis function returning a Maybe value and then applying
catMaybes.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Frama-C

2010-05-09 Thread Tom Hawkins
On Sun, May 9, 2010 at 12:54 AM, Lee Pike leep...@gmail.com wrote:
 Tom,

 Have you used any of these tools?  They're pretty cool.  I'd be
 interested to hear you opinion.

 http://frama-c.com/

 Not yet.  We were considering using them for a C security-analysis, but
 rolled-our-own stuff in Haskell.

Do you guys support ACSL or something similar?

One major short comings of Frama-C is its inability to prove a formula
false.  As such, the tool will not return any counter examples to help
with debugging.


 I'll ask around Galois if there's been any experience with it.

 Did anyone respond to your post about a Haskell interface?

Negative.

I'm looking into writing a bit of OCaml to dump out the Cil+ACSL
stuff, which I can then read with Haskell.

One thing I really like about Frama-C is its use of multiple solvers.
Some work better than others, and it's very easy to see this in the
gWhy GUI, as well as overall proof coverage.

It would be nice to have a Haskell library where we could stream in a
bunch of proof obligations and it would farm it out to different
solvers, possibly running on different machines.  It could also keep
track of which obligations have proved true or false, so it doesn't
wast time running the obligation on other solvers -- gWhy doesn't
currently do this.

You kind of alluded to these benefits when you recommended using
SMT-LIB instead of Yices for AFV, but I didn't appreciated it until
now.

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


Re: [Haskell-cafe] How efficient is read?

2010-05-09 Thread Tom Hawkins
On Sun, May 9, 2010 at 3:36 AM, Malcolm Wallace

 (Declaration of interest: I wrote polyparse.)

Yes, I used polyparse in the VCD library.  It rocks!

I'll check out the DrIFT tool.

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


Re: [Haskell-cafe] Re: How efficient is read?

2010-05-09 Thread Stephen Tetley
On 9 May 2010 13:25, Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote:
[SNIP]

 Hm.  I'd understand that as referring to the fact that Parsec 3 can use
 arbitrary input types instead of [Char], not to streams as in stream fusion
 or lazy processing.

Hi Brandon

Yes - that's my impression too.

There is a package for Parsec iteratee package on Hackage that would
presumably support for streaming (thats to say online, or synonymously
- 'piecemeal' / lazy processing). However unless I could find a
tutorial, I'd go with Polyparse or uu-parsinglib (Doaitse Swierstra
has a tech report that gives a very detailed guide to uu-parsinglib).

Best wishes

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


[Haskell-cafe] polyvariadic function for Applicative instances

2010-05-09 Thread Xiao-Yong Jin
Hi,

Is it possible to have a function accept variable number of
arguments, such that 'f' can be instantiated to different
concrete types as

f :: Applicative a = (e1 - f) - a e1 - A f
f g a = pure g * a

f :: Applicative a = (e1 - e2 - f) - a e1 - a e2 - A f
f g a b = pure g * a * b

Thanks,
Xiao-Yong
-- 
Jc/*__o/*
X\ * (__
Y*/\  
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Chicago Haskell Users Group Meeting Tuesday, May 11, 7PM

2010-05-09 Thread Jeremy Shaw

Hello Chicago People!

The Chicago Haskell Users Group will be meeting this Tuesday, May 11,  
at 7PM at The Grafton.
Say goodbye to Tom Tobin (our founder), and hello to Haskell world  
domination!
The Grafton is in Lincoln Square next to the Old Town School of Folk  
Music, close to the Western stop on the Brown

line.

We will be wishing Tom Tobin goodbye as he prepares to head back to
New York. Leon Smith is possibly doing a presentation on concurrency
and/or circular programming. And we will have open discussion on
Haskell and non-Haskell related topics.

Ideally we will be sitting in the back on the couches near the
fireplace, subject to availability (alas, we can't reserve them).

The Grafton has free wi-fi, and great Irish food, beer, and drinks.

Stay until 9PM and hear a variety of musicians playing rare and
original folk music songs.

http://www.thegrafton.com/

Also, be sure to join our brand new facebook group,

http://www.facebook.com/group.php?gid=119966508024820

And google  discussion group:

http://groups.google.com/group/haskell-chicago



Thanks!

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


Re: [Haskell-cafe] Haskell and the Software design process

2010-05-09 Thread Gregory Crosswhite

On May 9, 2010, at 1:04 AM, wren ng thornton wrote:

 If you're structuring your code with that invariant, then why aren't you 
 using the correct type?

I do try to use the type system as much as possible to enforce constraints.  
However. it is not always so simple as making sure that a list always has two 
elements;  you might be working with some kind of complicated data structure 
such that if you see that it satisfies some property then if you preserved the 
invariant correctly then you know that a given list must have at least two 
elements.

 If your response is that you use too many of the standard list functions, 
 then write a module with ALT versions (because evidently you need one)


While, again, I do agree that it is smart to use the type system as much as 
possible to enforce constraints in order to avoid refutable pattern matches, I 
would argue that when you start creating duplicates of entire pre-existing 
modules towards this end then the cure may be starting to become worse that the 
disease.

Cheers,
Greg

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


[Haskell-cafe] Re: Set Operations In Haskell's Type System

2010-05-09 Thread John Creighton


On May 9, 4:46 am, wren ng thornton w...@freegeek.org wrote:
 John Creighton wrote:
  On May 6, 4:30 am, Bartek Ćwikłowski paczesi...@gmail.com wrote:
  2010/5/6 John Creighton johns2...@gmail.com:

  a isa d if their exists a b and c such that the following
  conditions hold:
  a isa subset of b,
  b isa c
  c is a subset of d
  This definition doesn't make sense - it's recursive, but there's no
  base case, unless this is some kind of co-recursion.

  Are you sure that subset isn't what you really want? With subset you
  can already ask questions such as is tabby cat an animal?. If so, my
  code (from hpaste) already has this (iirc isDescendentOf ).

  When I succeed in implementing it I'll show you the result. Anyway,
  some perspective (perhaps), I once asked, what is the difference
  between a subset and an element of a set:

 http://www.n-n-a.com/science/about33342-0-asc-0.html

 And it's truly an interesting question. Too bad it didn't get a better
 discussion going (from what I read of it). Though the link Peter_Smith
 posted looks interesting.

  note 1) Okay I'm aware some will argue my definitions here and if it
  helps I could choose new words, the only question really is, is the
  relationship isa which I described a useful abstraction.

 I think the key issue comes down to what you want to do with it. I'm not
 entirely sure what the intended reading is for isa subset of, but I'll
 assume you mean the same as is a subset of[1]. One apparent side
 effect of the definition above is that it collapses the hierarchy.

 That is, with traditional predicates for testing element and subset
 membership, we really do construct a hierarchy. If A `elem` B and B
 `elem` C, it does not follow that A `elem` C (and similar examples). But
 with your definition it seems like there isn't that sort of
 stratification going on. If the requirements are A `subset` B, B `elem`
 C, and C `subset` D--- well we can set C=D, and now: A `elem` D = A
 `subset` B  B `elem` D.

 Depending on the ontology you're trying to construct, that may be
 perfectly fine, but it's certainly a nonstandard definition for elements
 and subsets. I don't know if this mathematical object has been worked on
 before, but it's not a hierarchy of sets.

 [1] My other, equivalent, guess would be you mean A isa (powerset B)
 but avoided that notation because it looks strange.

 --
 Live well,
 ~wren
 ___
 Haskell-Cafe mailing list
 haskell-c...@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe

 --
 You received this message because you are subscribed to the Google Groups 
 Haskell-cafe group.
 To post to this group, send email to haskell-c...@googlegroups.com.
 To unsubscribe from this group, send email to 
 haskell-cafe+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/haskell-cafe?hl=en.

Keep in mind that my recent definition of is a

  a isa d if their exists a b and c such that the following
  conditions hold:
  a isa subset of b,
  b isa c
  c is a subset of d

is distinct from the question I asked a long time ago of the
difference between a set and an element. The question I asked a long
time ago is largely philosophical but can have axiomatic consequences
in set theory. Ignoring the philosophical meanings behind a set, both
the operations of subset and element of, define a partial order. The
subset relationship seems to define things that are more similar then
the element of relationship.

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


Re: [Haskell-cafe] polyvariadic function for Applicative instances

2010-05-09 Thread Bartek Ćwikłowski
hello,

 Is it possible to have a function accept variable number of
 arguments, such that 'f' can be instantiated to different
 concrete types as

 f :: Applicative a = (e1 - f) - a e1 - A f
 f g a = pure g * a

 f :: Applicative a = (e1 - e2 - f) - a e1 - a e2 - A f
 f g a b = pure g * a * b

f is just a left fold over the list of arguments. I've written about
such things here:
http://paczesiowa.blogspot.com/2010/03/generalized-zipwithn.html

regards,
Bartek Ćwikłowski
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] FRP demos and tutorials page

2010-05-09 Thread Tom Poliquin
Haskell Cafe'rs,

My student and I (sometimes it's difficult to determine who is who) have 
struggled to understand Reactive for several months and thanks to some 
initial help from the Reactive list (thanks Paul C) have been able to write 
some demos and tutorials.

Apologies for posting this to the Haskell Cafe, instead of the FRP list
but we wanted to make our efforts available to a wider audience, and the
experts there are the choir.

We have created are a set of demos and tutorials for FRP (Conal reactive). 
It consists of four demos: the simple furnace, the human controlled furnace, 
the hybrid robot sim, and the FRP robot sim. The furnace demos both consist 
of a thermostat like application, in which a furnace heats up and cools down 
in attempt maintain a constant temperature. In the simple furnace, the goal 
temperature is a fixed constant, while in the human controlled furnace, the 
user can control the goal temperature. The robot sim demos both consist of a 
3D simulation in which a robot follows the walls of an arena using a simple 
control algorithm. The hybrid robot sim consists of two programs, one with 
FRP that simulates the robot, and one GLUT program that reads piped date from 
the first program to display the 3D view. The FRP robot sim is a single 
program that simulates the same robot scenario as the first, but uses 
reactive GLUT and FRP to do the whole demo in reactive style.

We attempted to but as much documentation in the programs as possible, as well 
as give an overview on the webpage about the functions we used. Please note 
that both of us are rather new to Haskell, and so, we may have used poor 
programming practices in these tutorials and demos. If you have any 
suggestions about them, please feel free to write to us.

Website:
http://www.formicite.com/dopage.php?frp/frp.html

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


[Haskell-cafe] Why cannot ghc find a existng module ?

2010-05-09 Thread zaxis

%pacman -Q|grep xmonad
xmonad 0.9.1-4
xmonad-contrib 0.9.1-2

%%xmonad --recompile
Error detected while loading xmonad configuration file:
/home/sw2wolf/.xmonad/xmonad.hs

xmonad.hs:20:7:
Could not find module `XMonad.Layout.LayoutHints':
  Use -v to see a list of the files searched for.

%ghc-pkg list|grep xmonad
xmonad-0.9.1
xmonad-contrib-0.9.1

%pacman -Ql xmonad-contrib|grep LayoutHints
xmonad-contrib
/usr/lib/ghc-6.12.1/site-local/xmonad-contrib-0.9.1/XMonad/Layout/LayoutHints.hi

Sincerely!

-
e^(π⋅i) + 1 = 0
-- 
View this message in context: 
http://old.nabble.com/Why-cannot-ghc-find-a-existng-module---tp28507704p28507704.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] Why cannot ghc find a existng module ?

2010-05-09 Thread Ivan Miljenovic
Does ghc-pkg check complain?

Is the version of GHC being used the same one that was used to build
xmonad-contrib?

What does ghc-pkg field xmonad-contrib exposed-modules | grep LayoutHints say?

On 10 May 2010 14:59, zaxis z_a...@163.com wrote:

 %pacman -Q|grep xmonad
 xmonad 0.9.1-4
 xmonad-contrib 0.9.1-2

 %%xmonad --recompile
 Error detected while loading xmonad configuration file:
 /home/sw2wolf/.xmonad/xmonad.hs

 xmonad.hs:20:7:
    Could not find module `XMonad.Layout.LayoutHints':
      Use -v to see a list of the files searched for.

 %ghc-pkg list|grep xmonad
    xmonad-0.9.1
    xmonad-contrib-0.9.1

 %pacman -Ql xmonad-contrib|grep LayoutHints
 xmonad-contrib
 /usr/lib/ghc-6.12.1/site-local/xmonad-contrib-0.9.1/XMonad/Layout/LayoutHints.hi

 Sincerely!

 -
 e^(π⋅i) + 1 = 0
 --
 View this message in context: 
 http://old.nabble.com/Why-cannot-ghc-find-a-existng-module---tp28507704p28507704.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




-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why cannot ghc find a existng module ?

2010-05-09 Thread zaxis

There is no any complain by ghc-pkg.
%ghc-pkg field xmonad-contrib exposed-modules | grep LayoutHints
 XMonad.Layout.LayoutCombinators XMonad.Layout.LayoutHints


Ivan Lazar Miljenovic wrote:
 
 Does ghc-pkg check complain?
 
 Is the version of GHC being used the same one that was used to build
 xmonad-contrib?
 
 What does ghc-pkg field xmonad-contrib exposed-modules | grep
 LayoutHints say?
 
 On 10 May 2010 14:59, zaxis z_a...@163.com wrote:

 %pacman -Q|grep xmonad
 xmonad 0.9.1-4
 xmonad-contrib 0.9.1-2

 %%xmonad --recompile
 Error detected while loading xmonad configuration file:
 /home/sw2wolf/.xmonad/xmonad.hs

 xmonad.hs:20:7:
    Could not find module `XMonad.Layout.LayoutHints':
      Use -v to see a list of the files searched for.

 %ghc-pkg list|grep xmonad
    xmonad-0.9.1
    xmonad-contrib-0.9.1

 %pacman -Ql xmonad-contrib|grep LayoutHints
 xmonad-contrib
 /usr/lib/ghc-6.12.1/site-local/xmonad-contrib-0.9.1/XMonad/Layout/LayoutHints.hi

 Sincerely!

 -
 e^(π⋅i) + 1 = 0
 --
 View this message in context:
 http://old.nabble.com/Why-cannot-ghc-find-a-existng-module---tp28507704p28507704.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

 
 
 
 -- 
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


-
e^(π⋅i) + 1 = 0
-- 
View this message in context: 
http://old.nabble.com/Why-cannot-ghc-find-a-existng-module---tp28507704p28507747.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] Why cannot ghc find a existng module ?

2010-05-09 Thread Ivan Miljenovic
(Note that this really should be on the xmonad mailing list, but anyway...).

On 10 May 2010 15:09, zaxis z_a...@163.com wrote:

 There is no any complain by ghc-pkg.
 %ghc-pkg field xmonad-contrib exposed-modules | grep LayoutHints
                 XMonad.Layout.LayoutCombinators XMonad.Layout.LayoutHints


Try rm ~/.xmonad/xmonad.{hi,o} and then xmonad --recompile again.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why cannot ghc find a existng module ?

2010-05-09 Thread zaxis

%rm ~/.xmonad/xmonad.{hi,o}
%ls ~/.xmonad 
history  xmonad-i386-linux*  xmonad.errors  xmonad.hs
%xmonad --recompile
Error detected while loading xmonad configuration file:
/home/sw2wolf/.xmonad/xmonad.hs

xmonad.hs:20:7:
Could not find module `XMonad.Layout.LayoutHints':
  Use -v to see a list of the files searched for.

Please check the file for errors.


Ivan Lazar Miljenovic wrote:
 
 (Note that this really should be on the xmonad mailing list, but
 anyway...).
 
 On 10 May 2010 15:09, zaxis z_a...@163.com wrote:

 There is no any complain by ghc-pkg.
 %ghc-pkg field xmonad-contrib exposed-modules | grep LayoutHints
                 XMonad.Layout.LayoutCombinators XMonad.Layout.LayoutHints

 
 Try rm ~/.xmonad/xmonad.{hi,o} and then xmonad --recompile again.
 
 -- 
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


-
e^(π⋅i) + 1 = 0
-- 
View this message in context: 
http://old.nabble.com/Why-cannot-ghc-find-a-existng-module---tp28507704p28507878.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] Why cannot ghc find a existng module ?

2010-05-09 Thread Ivan Miljenovic
I suggest you either go on #xmonad and ask the people there, or send
an email to the xmonad mailing list with your config attached.

On 10 May 2010 15:37, zaxis z_a...@163.com wrote:

 %rm ~/.xmonad/xmonad.{hi,o}
 %ls ~/.xmonad
 history  xmonad-i386-linux*  xmonad.errors  xmonad.hs
 %xmonad --recompile
 Error detected while loading xmonad configuration file:
 /home/sw2wolf/.xmonad/xmonad.hs

 xmonad.hs:20:7:
    Could not find module `XMonad.Layout.LayoutHints':
      Use -v to see a list of the files searched for.

 Please check the file for errors.


 Ivan Lazar Miljenovic wrote:

 (Note that this really should be on the xmonad mailing list, but
 anyway...).

 On 10 May 2010 15:09, zaxis z_a...@163.com wrote:

 There is no any complain by ghc-pkg.
 %ghc-pkg field xmonad-contrib exposed-modules | grep LayoutHints
                 XMonad.Layout.LayoutCombinators XMonad.Layout.LayoutHints


 Try rm ~/.xmonad/xmonad.{hi,o} and then xmonad --recompile again.

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




 -
 e^(π⋅i) + 1 = 0
 --
 View this message in context: 
 http://old.nabble.com/Why-cannot-ghc-find-a-existng-module---tp28507704p28507878.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




-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe