[Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Bernie Pope
2009/7/17 Andrew Coppin : > I've been working hard this week, and I'm stumbled upon something which is > probably of absolutely no surprise to anybody but me. > > Consider the following expression: > >  (foo True, foo 'x') > > Is this expression well-typed? > > Astonishingly, the answer depends on

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-16 Thread Johan Jeuring
Why is there no Zippable class? There is. You can use Data.Zippable from http://hackage.haskell.org/package/bff. It gives you a function tryZip :: Zippable k => k a -> k b -> Either String (k (a,b)) The Either in the return type is to capture an error message in case the two structures are

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-16 Thread Janis Voigtlaender
Why is there no Zippable class? There is. You can use Data.Zippable from http://hackage.haskell.org/package/bff. It gives you a function tryZip :: Zippable k => k a -> k b -> Either String (k (a,b)) The Either in the return type is to capture an error message in case the two structures are n

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-16 Thread Job Vranish
Yeah I tried applicative, but saw that the <*> operator didn't do what I want with lists, and started looking elsewhere. I didn't even see the ZipList! Actually the other problem is that the data structure that I'm using won't support pure, so no Applicative :( Though for a generic zip, Applicative

Re: [Haskell-cafe] Atom resources

2009-07-16 Thread Radamés Ajna
That would be great. I can post some of my works on arduino , haskell and atom there. Radamés On Thu, Jul 16, 2009 at 23:54, Thomas DuBuisson wrote: > No, I'm not starting a new wiki (though it someone does or has then it > should go on haskell.org, imo). > > Tom > > On Thu, Jul 16, 2009 at 7

Re: [Haskell-cafe] Atom resources

2009-07-16 Thread Thomas DuBuisson
No, I'm not starting a new wiki (though it someone does or has then it should go on haskell.org, imo). Tom On Thu, Jul 16, 2009 at 7:38 PM, John Van Enk wrote: > Are you starting a new Wiki? I'd absolutely love to have that resource. > > On Thu, Jul 16, 2009 at 8:14 PM, Thomas > DuBuisson wrote:

Re: [Haskell-cafe] Atom resources

2009-07-16 Thread John Van Enk
Are you starting a new Wiki? I'd absolutely love to have that resource. On Thu, Jul 16, 2009 at 8:14 PM, Thomas DuBuisson wrote: > The wiki [1] where Atom [2] once lived has been gone for some time > now.  The only resources I know for Atom are a couple blog posts, the > haddock docs, and the Atom

Re: [Haskell-cafe] Parsec for C or C++

2009-07-16 Thread Sterling Clover
A parser for JavaScript (admittedly a much simpler beast) is part of Brown's WebBits: http://hackage.haskell.org/packages/archive/WebBits/0.15/doc/html/ BrownPLT-JavaScript-Parser.html Cheers, Sterl. On Jul 16, 2009, at 1:40 PM, Roy Lowrance wrote: Turns out that Language.C uses alex and

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-16 Thread Dan Weston
Way cool. I have gained newfound respect for what I don't know. :) Can there ever be more than one (observably different) valid definition of pure for a given <*> that obeys all the laws? I would imagine that there could be at most one. Dan Ryan Ingram wrote: (I'm going to play fast and loo

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-16 Thread Ryan Ingram
(I'm going to play fast and loose with constructors for this post, treating MyList and ZipList as if they were []) On Thu, Jul 16, 2009 at 4:10 PM, Dan Weston wrote: > -- different from [], sum rather than product > instance Applicative MyList where >  pure x = x ::: Nil >  (<*>) (f ::: fs) (x :::

[Haskell-cafe] Re: another laziness blowup (this one unsolved)

2009-07-16 Thread Thomas Hartman
solved. see the haskell wiki for spoiler: http://haskell.org/haskellwiki/Blow_your_mind 2009/7/16 Thomas Hartman : > Is it possible to fix alternate' (the second version), or otherwise > define a fast stepwise alternate that doesn't blow up on long lists? > > alternate just breaks up [1,2,3,4,5]

[Haskell-cafe] Atom resources

2009-07-16 Thread Thomas DuBuisson
The wiki [1] where Atom [2] once lived has been gone for some time now. The only resources I know for Atom are a couple blog posts, the haddock docs, and the Atom source on patchtag. Is anyone aware of other resources? Tom [1] http://funhdl.org/wiki/doku.php [2] http://hackage.haskell.org/packa

[Haskell-cafe] another laziness blowup (this one unsolved)

2009-07-16 Thread Thomas Hartman
Is it possible to fix alternate' (the second version), or otherwise define a fast stepwise alternate that doesn't blow up on long lists? alternate just breaks up [1,2,3,4,5] into ([1,3,5],[2,4]) Thanks! {-# LANGUAGE BangPatterns #-} import Data.List import Control.Arrow import Control.Parallel.S

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread John Meacham
On Thu, Jul 16, 2009 at 08:52:40PM +0100, Andrew Coppin wrote: > Ross Mellgren wrote: >> It's not where -- let also works >> >> Prelude> let { foo x = x } in (foo 1, foo True) >> (1,True) > > Awesome. So by attempting to implement Haskell's type system, I have > discovered that I actually don't u

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-16 Thread Dan Weston
After rereading page 2 of McBride and Paterson's Functional Pearl, "Applicative programming with effects", I think you are just reinventing Control.Applicative. The problem is that the default Applicative instance for [] is wrong, being a direct product rather than a direct sum. If [] were not

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Ross Mellgren
Is "everything" an acceptable answer? -Ross On Jul 16, 2009, at 6:38 PM, Derek Elkins wrote: On Thu, Jul 16, 2009 at 2:52 PM, Andrew Coppin wrote: Ross Mellgren wrote: It's not where -- let also works Prelude> let { foo x = x } in (foo 1, foo True) (1,True) Awesome. So by attempting to i

Re: [Haskell-cafe] Leaner Haskell.org frontpage

2009-07-16 Thread Richard O'Keefe
I asked "why make life for regular Haskellers", and On Jul 17, 2009, at 4:56 AM, Thomas Davie replied: Because regular haskellers are perfectly capable of bookmarking http://haskell.org/usefullstuff.html , while newbies will only get what google tells them -- the front page. Sorry, but (1) I

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Derek Elkins
On Thu, Jul 16, 2009 at 2:52 PM, Andrew Coppin wrote: > Ross Mellgren wrote: >> >> It's not where -- let also works >> >> Prelude> let { foo x = x } in (foo 1, foo True) >> (1,True) > > Awesome. So by attempting to implement Haskell's type system, I have > discovered that I actually don't understan

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-16 Thread Jeff Heard
Beautiful. Can we have a version on hackage? On Thu, Jul 16, 2009 at 5:56 PM, Job Vranish wrote: > I was needing a way to zip generic data structures together today and was > very annoyed to find that there is no Zippable class, or variant there of. > > So I made my own: > > class (Foldable f, Fu

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-16 Thread Jake McArthur
I think there are some basic equivalents in the TypeCompose and category-extras packages, for the record, but a standalone version wouldn't hurt either! - Jake ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listi

[Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-16 Thread Job Vranish
I was needing a way to zip generic data structures together today and was very annoyed to find that there is no Zippable class, or variant there of. So I made my own: class (Foldable f, Functor f) => Zippable f where fmaps :: (Foldable g) => g (a -> b) -> f a -> f b fmaps' :: [a -> b] -> f a

Re: [Haskell-cafe] Applying different functions to different types for lists

2009-07-16 Thread Ryan Ingram
2009/7/16 Szekeres István : > class ListUpdater a where >     updateFn :: Char -> Char >     update :: a -> a > > so I can define the update function for the different types of lists: > > instance ListUpdater String where >     update = map updateFn > > instance ListUpdater L.ByteString where >    

[Haskell-cafe] Applying different functions to different types for lists

2009-07-16 Thread Szekeres István
Hi, I want to build a framework to apply different functions to different types of lists and I want to generalize the solution as much as possible but my Haskell knowledge is not really enough to do this (I'm a haskell novice). The problem has two dimensions: 1. Lets say I have two functions: r

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Andrew Coppin
Andrew Coppin wrote: Awesome. So by attempting to implement Haskell's type system, I have discovered that I actually don't understand Haskell's type system. Who'd have thought it? Clearly I must go consult the Report and check precisely what the rules are... I just read section 4.5 of the H

Re: [Haskell-cafe] RE: Haskell as a first language?

2009-07-16 Thread Christopher Done
2009/7/16 Daniel van den Eijkel : > In an ideal world, Haskell would be a perfect first programming language. > > But consider: If someone without any programming background learns Haskell > as first language, she or he might have big problems using any other > language after that. Unlearning what

Re: [Haskell-cafe] RE: Haskell as a first language?

2009-07-16 Thread Don Stewart
dvde: > In an ideal world, Haskell would be a perfect first programming language. > > But consider: If someone without any programming background learns > Haskell as first language, she or he might have big problems using any > other language after that. Unlearning what you can do with Haskell

Re: [Haskell-cafe] laziness blowup exercise

2009-07-16 Thread Ryan Ingram
> On Thu, Jul 16, 2009 at 8:22 PM, Thomas Hartman wrote: >> Is this being worked on? On Thu, Jul 16, 2009 at 12:35 PM, Bas van Dijk wrote: > I have no idea. Yes. Bolingbroke, Peyton-Jones. "Types are calling conventions" http://lambda-the-ultimate.org/node/3319 -- ryan __

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Andrew Coppin
Ross Mellgren wrote: It's not where -- let also works Prelude> let { foo x = x } in (foo 1, foo True) (1,True) Awesome. So by attempting to implement Haskell's type system, I have discovered that I actually don't understand Haskell's type system. Who'd have thought it? Clearly I must go co

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Jason Dagit
On Thu, Jul 16, 2009 at 12:40 PM, Andrew Coppin wrote: > Robert Greayer wrote: > >> f0 _ = (foo True, foo 'x') where foo = id >> >> is well-typed. >> >> > > Really? That actually works? How interesting... This suggests to me that > where-clauses also do strange things to the type system. You co

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Ross Mellgren
It's not where -- let also works let { foo Prelude> let { foo x = x } in (foo 1, foo True) (1,True) Can you send the code you're trying that doesn't work? -Ross On Jul 16, 2009, at 3:40 PM, Andrew Coppin wrote: Robert Greayer wrote: f0 _ = (foo True, foo 'x') where foo = id is well-typed.

Re: [Haskell-cafe] RE: Haskell as a first language?

2009-07-16 Thread Daniel van den Eijkel
In an ideal world, Haskell would be a perfect first programming language. But consider: If someone without any programming background learns Haskell as first language, she or he might have big problems using any other language after that. Unlearning what you can do with Haskell is much harder

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Andrew Coppin
Robert Greayer wrote: f0 _ = (foo True, foo 'x') where foo = id is well-typed. Really? That actually works? How interesting... This suggests to me that where-clauses also do strange things to the type system. whereas f1 foo = (foo True, foo 'x') requires 'foo' to be polymorphic in its

Re: [Haskell-cafe] laziness blowup exercise

2009-07-16 Thread Bas van Dijk
On Thu, Jul 16, 2009 at 8:22 PM, Thomas Hartman wrote: > I played with this a bit, and ok, it seems the difference between > iterate' and iterate'' is > > h _ = 2 > > tit' = head . drop 1 . iterate' h $ undefined > tit'' = head . drop 1 . iterate'' h $ undefined Exactly, iterate' first evaluates '

Re: [Haskell-cafe] laziness blowup exercise

2009-07-16 Thread Bas van Dijk
On Thu, Jul 16, 2009 at 7:45 PM, Thomas Hartman wrote: > the strict functions seem very nice, will they eventually make their way into > http://hackage.haskell.org/packages/archive/Stream/0.3.2/doc/html/Data-Stream.html Note that there are two stream packages: * 'Stream' by Wouter Swierstra (incl

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Robert Greayer
On Thu, Jul 16, 2009 at 2:34 PM, Andrew Coppin wrote: > I've been working hard this week, and I'm stumbled upon something which is > probably of absolutely no surprise to anybody but me. > > Consider the following expression: > >  (foo True, foo 'x') > > Is this expression well-typed? > > Astonishi

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Miguel Mitrofanov
Consider the following expression: (foo True, foo 'x') Is this expression well-typed? Astonishingly, the answer depends on where "foo" is defined. If "foo" is a local variable, then the above expression is guaranteed to be ill-typed. However, if we have (for example) That's not true: mai

Re: [Haskell-cafe] RE: Haskell as a first language?

2009-07-16 Thread Christopher Done
I believe that from Scheme to Haskell is a natural transition, as I made the same transition myself. If you grasp the fundamental concepts of Scheme, Haskell seems like a step up. I will describe Haskell in terms of Scheme: # Haskell programs are more correct from the ground up Scheme will let yo

[Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Andrew Coppin
I've been working hard this week, and I'm stumbled upon something which is probably of absolutely no surprise to anybody but me. Consider the following expression: (foo True, foo 'x') Is this expression well-typed? Astonishingly, the answer depends on where "foo" is defined. If "foo" is a l

Re: [Haskell-cafe] laziness blowup exercise

2009-07-16 Thread Thomas Hartman
I played with this a bit, and ok, it seems the difference between iterate' and iterate'' is h _ = 2 tit' = head . drop 1 . iterate' h $ undefined tit'' = head . drop 1 . iterate'' h $ undefined > (Bas wishes for a type system that can express the different strictness properties of these functio

Re: [Haskell-cafe] laziness blowup exercise

2009-07-16 Thread Thomas Hartman
the strict functions seem very nice, will they eventually make their way into http://hackage.haskell.org/packages/archive/Stream/0.3.2/doc/html/Data-Stream.html ? where is Control.Monad.StreamT? couldn't find it. 2009/7/15 Bas van Dijk : > On Wed, Jul 15, 2009 at 3:02 AM, Thomas Hartman wrote:

Re: [Haskell-cafe] Parsec for C or C++

2009-07-16 Thread Roy Lowrance
Turns out that Language.C uses alex and happy. I'm looking to use Parsec. So back to the original question: Does anyone know of a C or java parser written using Parsec? - Roy On Thu, Jul 16, 2009 at 12:43 PM, Roy Lowrance wrote: > Thanks Rick. A perfect tip! - Roy > > On Thu, Jul 16, 2009 at 12

Re: [Haskell-cafe] Leaner Haskell.org frontpage

2009-07-16 Thread Thomas Davie
On 15 Jul 2009, at 06:03, Richard O'Keefe wrote: On Jul 10, 2009, at 6:14 PM, Thomas Davie wrote: In my mind, the front page is for nothing more than enticing people to use Haskell for long enough to look at a second page where all the useful stuff is if you are a haskell programmer. I w

Re: [Haskell-cafe] Parsec for C or C++

2009-07-16 Thread Roy Lowrance
Thanks Rick. A perfect tip! - Roy On Thu, Jul 16, 2009 at 12:29 PM, Rick R wrote: > There is language.c > > http://www.sivity.net/projects/language.c/ > http://hackage.haskell.org/package/language-c > > > From a parsing standpoint, C++ is a massive departure from C. Good luck > though. > > > On Th

Re: [Haskell-cafe] Parsec for C or C++

2009-07-16 Thread Rick R
I too have a looming spectre of a C++ analysis project, one of the goals of the project is to be able to efficiently process huge volumes (read GBs) of code. Given the current benchmarks of language.c compared to the g++ front end. I was thinking of using an existing C++ parser written in C++, pro

Re: [Haskell-cafe] Parsec for C or C++

2009-07-16 Thread Rick R
There is language.c http://www.sivity.net/projects/language.c/ http://hackage.haskell.org/package/language-c >From a parsing standpoint, C++ is a massive departure from C. Good luck though. On Thu, Jul 16, 2009 at 12:25 PM, Roy Lowrance wrote: > I am working on a research language that is a v

[Haskell-cafe] Parsec for C or C++

2009-07-16 Thread Roy Lowrance
I am working on a research language that is a variant of C. I'd like to use Parsec as the parser. Is there an existing Parsec parser for C or C++ (or Java) that could serve as a starting point? Thanks, Roy ___ Haskell-Cafe mailing list Haskell-Cafe@hask

Re: [Haskell-cafe] Leaner Haskell.org frontpage

2009-07-16 Thread Yitzchak Gale
Don Stewart wrote: >  Newbies: >    http://haskell.org > >  Everything regular users need at fingertips >    http://dashboard.haskell.org/ That's fine. But please, no matter how minimalist the newbie page, make sure that there is a clear and prominent link there to the advanced page. Otherwise, i

Re: [Haskell-cafe] Re: Haskell Zippers on Wikibooks: teasing! :)

2009-07-16 Thread Dougal Stanton
On Thu, Jul 16, 2009 at 12:11 PM, Heinrich Apfelmus wrote: > >   Generic Programming: An introduction >   http://www.cse.chalmers.se/~patrikj/poly/afp98/ > > It's a bit verbose at times, but you only need the first few chapters to > get an idea about polynomial functors (sums and pairs) and  mu .

Re: [Haskell-cafe] Debugging methods for haskell

2009-07-16 Thread Magnus Therning
On Wed, Jul 15, 2009 at 11:13 PM, Don Stewart wrote: > fernanbolando: >> Hi all >> >> I recently used 2 hours of work looking for a bug that was causing >> >> Program error: Prelude.!!: index too large >> >> This is not very informative. It did not give me a hint which function >> was causing this.

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-16 Thread Jon Fairbairn
Fernan Bolando writes: > On Thu, Jul 16, 2009 at 4:10 PM, Jon > Fairbairn wrote: > >> I wonder if your code has to use !! at all? I took a look at a random >> module from the above link, and (without making much attempt at >> understanding it), I'd guess that using accumArray and friends would be

[Haskell-cafe] IFL 2009: Third Call for Papers

2009-07-16 Thread IFL 2009
Call for Papers IFL 2009 Seton Hall University SOUTH ORANGE, NJ, USA http://tltc.shu.edu/blogs/projects/IFL2009/ * NEW * Registration is now opened! Register at: http://tltc.shu.edu/blogs/projects/IFL2009/registration.html Invited Speaker:     Benjamin C. Pierce     University of Pe

[Haskell-cafe] Re: Haskell Zippers on Wikibooks: teasing! :)

2009-07-16 Thread Heinrich Apfelmus
Peter Verswyvelen wrote: > After my colleague explained me about zippers and how one could derive the > datatype using differential rules, I had to read about it. > > So I started reading > http://en.wikibooks.org/wiki/Haskell/Zippers#Mechanical_Differentiation > > This page contains the sentence

Re: [Haskell-cafe] Re: Debugging methods for haskell

2009-07-16 Thread Fernan Bolando
On Thu, Jul 16, 2009 at 4:10 PM, Jon Fairbairn wrote: > I wonder if your code has to use !! at all? I took a look at a random > module from the above link, and (without making much attempt at > understanding it), I'd guess that using accumArray and friends would be > more appropriate. Mostly you d

Re: [Haskell-cafe] Debugging methods for haskell

2009-07-16 Thread Matthias Görgens
> By the way, does Hat - the Haskell Tracer? Please append: "still work". ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Debugging methods for haskell

2009-07-16 Thread Matthias Görgens
By the way, does Hat - the Haskell Tracer? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Debugging methods for haskell

2009-07-16 Thread Thomas Schilling
2009/7/16 Marc Weber > > > I recall there was another method. Yeah, I even found it (using ghci and > set -fbreak-on-exception) > > http://donsbot.wordpress.com/2007/11/14/no-more-exceptions-debugging-haskell-code-with-ghci/ Careful, better use -fbreak-on-error rather than -fbreak-on-exception.

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-16 Thread Jon Fairbairn
Fernan Bolando writes: > Hi all > > I recently used 2 hours of work looking for a bug that was causing > > Program error: Prelude.!!: index too large > > This is not very informative. It did not give me a hint which function > was causing this. In C adding a few printf would have helped me, but >

Re: [Haskell-cafe] laziness blowup exercise

2009-07-16 Thread Bas van Dijk
On Wed, Jul 15, 2009 at 6:35 PM, Ryan Ingram wrote: > iterate' f x = x `seq` x : iterate' f (f x) > seems better; it doesn't evaluate list elements you don't visit. iterate'' f x = x : (iterate'' f $! f x) ...seems the most lazy strict iterate. (Bas wishes for a type system that can express the

Re: [Haskell-cafe] Pattern matching does not work like this?

2009-07-16 Thread Sebastian Fischer
On Jul 15, 2009, at 2:30 PM, Hans Aberg wrote: If ++ could be pattern matched, what should have been the result of "let (x++y)=[1,2,3] in (x,y)"? It will branch. In terms of unification, you get a list of substitutions. f :: [a] -> ([a],[a]) f (x ++ y) = (x,y) For an argument s, any pair