RE: [Haskell-cafe] New slogan for haskell.org

2007-10-08 Thread bf3
At my school the students are learning C/C++ in the programming courses, but
I'm teaching them a tiny bit of Haskell in the math courses, and most of
them seem to love it. I think every programmer should see an imperative,
object-oriented and lazy functional language, at least (and maybe also
Prolog...). And if you really want to have control over what the computer is
doing, stick to assembler... but who is still doing that these days?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Thomas Conway
Sent: Monday, October 08, 2007 12:55 PM
To: Don Stewart
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] New slogan for haskell.org

I just had a conversation today that seems relevant to this thread. I
was chatting with a friend who is working in the academic sector, and
I was observing that Melbourne Uni (my old school), is switching in
the new year from teaching Haskell as a first language, to teaching
Python. I was dismayed, but not surprised.

Anyway, I was talking about this with my friend said that he
understood the main reason for the change was that students were not
being "switched on" or excited learning Haskell as they used to be
learning C. He put it down to the fact that in C, you are more
obviously "making the computer do stuff", and that Haskell is
sufficiently high level and abstract that beginner programmers don't
get that thrill of feeling like you're making the computer work for
you.

I must say, I get that! but at the same time, of course, the high
level abstraction is exactly what *we* love about Haskell.

cheers,
T.
-- 
Thomas Conway
[EMAIL PROTECTED]

Silence is the perfectest herald of joy:
I were but little happy, if I could say how much.
___
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] Troubles understanding memoization in SOE

2007-09-26 Thread bf3
Gee you are right, how embarrasing. I mistakenly read the signature of ***
just above &&&, which is

(***) :: Arrow a ⇒ a b c → a b’ c’ → a (b,b’) (c,c’)

Now just to me sure I get it right, *** results in an arrow that has two
inputs (b,b') and two outputs (c,c')?

> (&&&) :: Arrow (~>) => (b ~> c) -> (b ~> c') -> (b ~> (c, c'))

Hey that’s a nice trick, and it is valid Haskell :)

Peter

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
org] On Behalf Of Bertram Felgenhauer
Sent: Wednesday, September 26, 2007 2:06 PM
To: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Troubles understanding memoization in SOE

Peter Verswyvelen wrote:
> Paul L wrote:
> A minor detail in your paper: on page 7, you represent *(d) sf1 &&& sf2
*as
> a big box taking one input and producing two outputs. The input is
> internally split using a Y. This does not seem consistent with the other
> boxes (e.g. *first *or *loop *internally) that show two arrows for an
> incoming/outgoing pair, so I would say the outer box of &&& would also
have
> two inputs and two outputs.

But look at the type of &&&:
  (&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
or, perhaps more readable,
  (&&&) :: Arrow (~>) => (b ~> c) -> (b ~> c') -> (b ~> (c, c'))

As you can see, the resulting arrow of type (b ~> (c, c')) really has
only one input and produces a pair, i.e. two outputs. Internally it
must duplicate the b input somehow and apply it to both input arrows,
exactly as the box shows.

Bertram
___
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] Troubles understanding memoization in SOE

2007-09-24 Thread bf3
I don't know, "me newbie, you expert" ;-) I just pasted the code from the
SOE website. 

But note that it is using pointers to the infinite lists to avoid comparing
them by content (which wouldn't work, since they're infinite), so it has to
use unsafePerformIO no?

inCache :: a -> [(a,b)] -> Maybe b
x `inCache` [] = Nothing
x `inCache` ((x',y'):xys) =
   if unsafePtrEq x x' then Just y' else x `inCache` xys

But what I don't understand is that I guess this code memoizes the full
list, while it should just memoize the tail that is still reachable through
the garbage collector? Or maybe that is what a "pointer to list" is? Some
kind of weak pointer / stable name that points to the tail of the list that
is still needed for evaluation? Hard stuff for a newbie, but I got to
understand how it works, so I can fit one more piece of the growing Haskell
puzzle :)

Peter

-Original Message-
From: Henning Thielemann [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 24, 2007 1:44 PM
To: Peter Verswyvelen
Cc: Haskell-Cafe
Subject: Re: [Haskell-cafe] Troubles understanding memoization in SOE


On Sat, 22 Sep 2007, Peter Verswyvelen wrote:

> Hi,
>
> in SOE, the following memoization function is implemented:
>
> memo1 :: (a->b) -> (a->b)
> memo1 f = unsafePerformIO $ do
> cache <- newIORef []
> return $ \x -> unsafePerformIO $ do
> vals <- readIORef cache
> case x `inCache` vals of
>   Nothing -> do let y = f x
> writeIORef cache [(x,y)] -- ((x,y) : -- 
> if null vals then [] else [head vals])
> return y
>   Just y  -> do return y

Hm, why the unsafePerformIO hacks? It should be possible without:
   http://www.haskell.org/haskellwiki/Memoization

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


RE: [Haskell-cafe] transparent parallelization

2007-09-18 Thread bf3
> http://haskell.org/haskellwiki/GHC/Data_Parallel_Haskell

Wow this is cool stuff! It would be nice to have something like this for the 
Playstation 3 :-)

Regarding parallelism, I wander how this extension will compare to Sun's 
Fortress language, if/when it gets finally released.

Peter


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


RE: [Haskell-cafe] Re: "Functional dependencies conflict between instance declarations"

2007-09-12 Thread bf3
Are you kidding, or has automatic proving of programs evolved that far?

Anyway, for my sector, videogames, "proving" if something works correctly is
subjective, it's very hard to check if "the gameplay of a game is good
enough" since that involves human fuzzy judgement ;-)  Although this might
just be statistics, so can be proven too! Aaarrrggg, soon we're all out
of job ;-)

Peter

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stefan Monnier
Sent: Wednesday, September 12, 2007 7:06 PM
To: haskell-cafe@haskell.org
Subject: [Haskell-cafe] Re: "Functional dependencies conflict between
instance declarations"

>> Never mind, that GHC compiler was again more clever than me, sigh.
>> That's really frustrating about Haskell: the compiler captures so many
>> errors at compile time, that newbies hardly get anything done, it's
>> a constant battle against the errors. But once it compiles, it usually
>> works at runtime :-)
> This is what I love about Haskell: If it typechecks, it probably does the
> thing you meant it to.  I've never seen any other language like
> it.  It's amazing!

Next stop: Coq, where the fight with the type checker is so much more
difficult that when the code finally type checks you don't even need to
run it at all.


Stefan

___
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] Can somebody give any advice for beginners?

2007-09-11 Thread bf3
LOL! 

Another problem is that I always have to descend again for my main job which
involves C#/C++, and all that climbing up and down is *very* tiersome.

Peter

-Original Message-
From: Dougal Stanton [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 11, 2007 12:44 PM
To: [EMAIL PROTECTED]
Cc: clisper; Haskell-Cafe
Subject: Re: [Haskell-cafe] Can somebody give any advice for beginners?

On 11/09/2007, Peter Verswyvelen <[EMAIL PROTECTED]> wrote:
> To me, Haskell was a bit like climbing a mountain which is largely
> covered by fog; you don't see anything until you've climbed high enough,
> and then the view is really beautiful ;-)

Either that or: the foothills are glorious, but as soon as you get
into the higher altitudes you can fall down a monad and not be able to
escape...

D.

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


RE: [Haskell-cafe] Haskell record extension?

2007-06-16 Thread bf3
Thanks. Yes I read this is syntactic sugar, and I actually like that
approach; it automatically "encapsulates" the data fileds by functions,
which from an OO programmers point of view, is a good thing. I'm doing my
best to get rid of that OO view though, which is not easy after 15 years of
OO and 10 years of imperative programming ;-)

However, I never understood why Haskell doesn't permit the same name for a
function acting on different types, even without using type classes. Must be
some deeper reason for it (currying?)

Now the type class approach is interesting; it's like saying "any type that
has an XXX field"... 

Lot's of typing, but IMHO it's worth it because it abstracts the concept of
a field. I read some papers that some extensions got proposed to treat
"fields" as first class values, so one could just do "get X (Vector2 1 2)".
Did something like that make it into GHC?

So the example becomes:

module Main where

-- "Vector" is a rather stupid example, because Haskell has tuples

data Vector2 = Vector2 Float Float
data Vector3 = Vector3 Float Float Float

class HasX v where
  getX :: v -> Float
  setX :: v -> Float -> v

class HasY v where
  getY :: v -> Float
  setY :: v -> Float -> v

class HasZ v where
  getZ :: v -> Float
  setZ :: v -> Float -> v

instance HasX Vector2 where 
getX (Vector2 x y) = x
setX (Vector2 x y) value =  Vector2 value y

instance HasY Vector2 where 
getY (Vector2 x y) = y
setY (Vector2 x y) value = Vector2 x value

instance HasX Vector3 where 
getX (Vector3 x y z) = x
setX (Vector3 x y z) value = Vector3 value y z

instance HasY Vector3 where 
getY (Vector3 x y z) = y
setY (Vector3 x y z) value = Vector3 x value z

instance HasZ Vector3 where 
getZ (Vector3 x y z) = z
setZ (Vector3 x y z) value = Vector3 x y value

test v x = getY (setX v x)

main = print $ test (Vector2 1 2) 3

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Johnson
Sent: Saturday, June 16, 2007 12:51 AM
To: Andrew Coppin
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Haskell record extension?

Andrew Coppin wrote:
> [EMAIL PROTECTED] wrote:
>> I'm learning Haskell.
>> I was surprised that the following example did not compile:
>>
>> data Vector2 = Vector2 { x :: Float, y :: Float }
>> data Vector3 = Vector3 { x :: Float, y :: Float, z :: Float }
>>
>> error: "Multiple declarations of `Main.x'"
>>
>
> AFAIK, GHC doesn't implement any fix for this. (I've been wrong before 
> tho...)
This is a feature, not a bug.  Haskell in general does not let you give 
two functions the same name (which is what you want to do).  This is 
true of all functions, not just the ones implicitly defined here.  Your 
"Vector2" type is pure syntactic sugar for:

data Vector2 = Vector2 Float Float
x, y :: Vector2 -> Float
x (Vector2 v _) = v
y (Vector2 _ v) = v

So now you also want

x (Vector3 v _ _) = v
   etc etc.

And no, you can't do that because "x" on its own might refer to either 
version, and its not clear which one you want.

Paul.
___
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] IDE?

2007-06-16 Thread bf3
Sorry I should have mentioned that I actually did all those searches you
provided, and read the wiki. I've been searching the internet for 6 months
now. I'm a professional software developer with 20 years of experience. I
actually (co-)developed integrated IDEs for visual programming languages,
type inferers, some refactoring tools, a version control system, some
compilers and linkers, and some commercial videogames for Commodore 64,
Amiga, PC, XBOX, PS2 and PS3. Now that I get to learn Haskell, I noticed
that I've always programmed in a horribly ugly, imperative/OO way ;) So I'm
not really a rookie, although I'm indeed a complete Haskell newby :)

I've tried VIM, Emacs, asked Rhinosoft for an evaluation (which I did not
get), tried the Eclipse plugin (can't get it to work on 3 PCs I tried),
tried Visual Haskell (incomplete, sometimes crashes or hangs Visual Studio),
an briefly looked at other alpha-level solutions. Currently I'm using
"Notepad++", which just does basic syntax highlighting but is usable out of
the box for a Windows programmer.

The point I wanted to make is, that I can't find an
easy-to-install-ready-to-use-and-rock-n-roll IDE for Windows that comes with
all or most of those features. I mean something like Borland TurboPascal
from the 80's, Visual Studio 2005, IntelliJ IDEA or Eclipse. I know that
people with a UNIX background have a completely different point of view on
this (they like separate tools they can fully configure). 

IMHO Haskell - although old - has a lot of potential that is rather
difficult to reach for "spoiled MTV generation inpatient plug-and-play
Windows programmers"... The people from Microsoft seem to understand that;
they made an excellent Visual Studio plugin for their F# research language.
Although far from perfect, this plugin works better for me than say Visual
Haskell. As I know most of the .NET framework, F# is still an option me, but
I'm tackling Haskell first, as it is pure and lazy (and I am the latter but
not the former ;-)

Cheers,
Peter

BTW: I also looked at UNICODE editor support (like Fortress), so it would
bring Haskell a step closer to mathematical notation (all Haskell books
already use UNICODE for their Haskell examples). Yes, this is also on the
wiki, but again, I fail to do something practical. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Claus Reinke
Sent: Saturday, June 16, 2007 1:18 AM
To: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] IDE?


> I've searched the internet for an Haskell IDE that supports the following:

my first reaction was: he can't be serious, not that again!-) however, i
tried to find the info by the "obvious" means, and found that to be a rather
sobering experience.

a simple google search does give rather a few relevant answers, but there
are entries on haskell.org that i've just had difficulty finding again, even
though i knew they were there.

i still can't help feeling that using google *and* haskell.org's own search
should have given some more results than the poster seems to be aware
of, but it also seems obvious that we have some serious barriers to finding
such info at the moment:

- external search engines are currently banned from indexing the wiki,
where much useful haskell info resides, so one does need to use
the internal search as well, to find wiki content.

perhaps the haskell.org main page should emphasise that and also
repeat the call for volunteers to fix the issue (there was something
like a consensus to try moving the dynamic parts of the wiki to a
distinguishable prefix, and banning search engines only from
that particular part; but someone needs to implement that and
monitor the effects).

- the current organisation of wiki indexing seems suboptimal. ide
related content used to be easier to find, but is now somewhat
spread out. debugging tools seem to have disappeared completely
from the most likely indexes (instead one finds some debug libs)?

the most "obvious" wiki pages are often not uptodate/complete,
the most "obvious" index headings do not lead to "important"
entries quickly (or at all). information is sometimes spread out
over several similar pages/index groups. all of which means that
information might be difficult to find, and finding a partial source
of information will miss out on much of the available info.

in best Prolog tradition, perhaps you could say where you've searched,
and someone (i'm calling all of you active haskell.org wiki volunteers:-)
might find a way to put a link to the info right where people are looking?-)

> - syntax highlighting
> - quick navigation (goto symbol, goto instance, find usages, etc)
> - code completion

http://www.google.com/search?q=haskell+ide

http://www.haskell.org/haskellwiki/Applications_and_libraries/Program_develo
pment
(i would have expected to see th

[Haskell-cafe] IDE?

2007-06-15 Thread bf3
I've searched the internet for an Haskell IDE that supports the following:

- syntax highlighting
- cross module refactoring 
- quick navigation (goto symbol, goto instance, find usages, etc)
- code completion
- "debugging" (not imperative debugging, so no breakpoints, but just
plugging in a visualizer/pretty printer for a function in a separate
dedicated window, like what http://www.apple.com/shake does on each "node")

So a bit what Jetbrains Resharper does for Visual Studio, but for Haskell.
IntelliJ and Eclipse also do this for Java.

This does not seem to exist? If this is correct, this is a real shame,
because although I read that the productivity increases a lot when correctly
using Haskell, it would increase even more when such an IDE is available.

Any help to find an IDE that comes closest to these features would be much
appreciated.

Thanks,
Peter


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


[Haskell-cafe] Haskell record extension?

2007-06-15 Thread bf3
I'm learning Haskell. 

I was surprised that the following example did not compile:

data Vector2 = Vector2 { x :: Float, y :: Float }
data Vector3 = Vector3 { x :: Float, y :: Float, z :: Float }

error: "Multiple declarations of `Main.x'"

This seems to be a known issue and if I understand it correctly it has to do
with the fact that Haskell does not support function general overloading ala
C++. One either has to use type classes, or put each record in a separate
module and fiddle with the qualified namespaces.

I read multiple papers with proposals to fix this, but does GHC implement
any of these?

Thanks,
Peter





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


[Haskell-cafe] GHCI hangs on Gtk2HS SOE on Windows, but GHC works fine?

2007-06-15 Thread bf3
I'm learning Haskell using Paul Hudak's book SOE. 

I'm using GHC 6.6 under Windows XP.

GHC on Windows does not seem to come with HGL (is this correct?), so I used
Gtk2HS, which contains a SOE implementation.

I noticed that most programs hang when using GHCI, but they work fine with
GHC.

For example, the following mini program:

import Graphics.SOE.Gtk
main = runGraphics (openWindow "Stuck" (300,300) >>= closeWindow)

completely hangs GHCI when running 'main', but using the GHC-created
executable, a window correctly pops up and closes immediately, nicely
returning to the command prompt.

As GHCI is easier for experimenting, it would be nice if this worked.

Thanks,
Peter

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