Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Simplifying a 'split' function (Ben Sanders)
   2. Re:  Simplifying a 'split' function (Thomas Davie)
   3.  Re: Simplifying a 'split' function (Ertugrul Soeylemez)
   4. Re:  Simplifying a 'split' function (Ben Sanders)
   5.  Selecting a GUI toolkit (Daniel Carrera)
   6. Re:  Selecting a GUI toolkit (Felipe Lessa)
   7. Re:  Selecting a GUI toolkit (Daniel Carrera)
   8.  Re: Selecting a GUI toolkit (Andy Stewart)
   9. Re:  Selecting a GUI toolkit (Felipe Lessa)
  10.  List Function (Nathan Holden)


----------------------------------------------------------------------

Message: 1
Date: Wed, 29 Apr 2009 12:00:59 -0700
From: Ben Sanders <bwsand...@gmail.com>
Subject: [Haskell-beginners] Simplifying a 'split' function
To: beginners@haskell.org
Message-ID:
        <c947ee1e0904291200q456f50f0l1c77763d0075d...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

In looking through a merge sort implementation example, I came across this code:

split :: [a] -> [[a]]
split [] = []
split (x:xs) = [x] : split xs

I would have written the same code as

split :: [a] -> [[a]]
split = map (: [])

Is there any particular difference here (other than explicit
recursion)?  And is there any other nicer way to write it?

Thanks,
Ben Sanders


------------------------------

Message: 2
Date: Wed, 29 Apr 2009 21:55:05 +0200
From: Thomas Davie <tom.da...@gmail.com>
Subject: Re: [Haskell-beginners] Simplifying a 'split' function
To: Ben Sanders <bwsand...@gmail.com>
Cc: beginners@haskell.org
Message-ID: <50db0726-a0d4-4832-96e1-4d7e5dda2...@gmail.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On 29 Apr 2009, at 21:00, Ben Sanders wrote:

> In looking through a merge sort implementation example, I came  
> across this code:
>
> split :: [a] -> [[a]]
> split [] = []
> split (x:xs) = [x] : split xs
>
> I would have written the same code as
>
> split :: [a] -> [[a]]
> split = map (: [])
>
> Is there any particular difference here (other than explicit
> recursion)?  And is there any other nicer way to write it?

How about map pure.  I do like the robot monkey though :)

Bob


------------------------------

Message: 3
Date: Wed, 29 Apr 2009 21:56:05 +0200
From: Ertugrul Soeylemez <e...@ertes.de>
Subject: [Haskell-beginners] Re: Simplifying a 'split' function
To: beginners@haskell.org
Message-ID: <20090429215605.0c1f2...@tritium.xx>
Content-Type: text/plain; charset=US-ASCII

Ben Sanders <bwsand...@gmail.com> wrote:

> In looking through a merge sort implementation example, I came across
> this code:
>
> split :: [a] -> [[a]]
> split [] = []
> split (x:xs) = [x] : split xs
>
> I would have written the same code as
>
> split :: [a] -> [[a]]
> split = map (: [])
>
> Is there any particular difference here (other than explicit
> recursion)?

No.


> And is there any other nicer way to write it?

Yes:

  split = fmap return


Greets,
Ertugrul.


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://blog.ertes.de/




------------------------------

Message: 4
Date: Wed, 29 Apr 2009 13:12:07 -0700
From: Ben Sanders <bwsand...@gmail.com>
Subject: Re: [Haskell-beginners] Simplifying a 'split' function
To: beginners@haskell.org
Message-ID:
        <c947ee1e0904291312p4dce72dfn466abc89c80d7...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

> How about map pure.  I do like the robot monkey though :)
>
> Bob

What is 'map pure'?
And it took me a minute to figure out where you were getting 'robot
monkey' from :)

> split = fmap return
>Greets,
>Ertugrul.

Awesome!  Thanks!!


------------------------------

Message: 5
Date: Thu, 30 Apr 2009 00:11:26 +0200
From: Daniel Carrera <daniel.carr...@theingots.org>
Subject: [Haskell-beginners] Selecting a GUI toolkit
To: beginners@haskell.org
Message-ID: <49f8d08e....@theingots.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello,

This question is just idle curiosity. I don't actually plan to write a 
desktop GUI program. With that said, what library would you recommend to 
someone who wants to write a cross-platform desktop app with Haskell?

Consider the following requirements:

1) Cross-platform. Windows, Linux and preferably OS X too.
2) Maintained, stable, mature, documented, etc.
3) Easy to use.

Notice that this has much to do with the Haskell bindings. For example, 
Qt might be a fabulous toolkit, but qtHaskell might be immature (it 
looks like it started in Dec 2007).

wxHaskell looks good. I like the idea behind wxWidgets, but I have never 
used it (or any GUI toolkit for that matter).

Thank you for your input.

Cheers,
Daniel.


------------------------------

Message: 6
Date: Wed, 29 Apr 2009 19:33:25 -0300
From: Felipe Lessa <felipe.le...@gmail.com>
Subject: Re: [Haskell-beginners] Selecting a GUI toolkit
To: beginners@haskell.org
Message-ID: <20090429223325.gd32...@kira.casa>
Content-Type: text/plain; charset=us-ascii

If I were to write one right now (and I might actually need in a
few days), I'd use Gtk2Hs.

Cons:
 - Does not fit Haskell's style.
 - Very imperative, everything in IO.

Pros:
 - Terrific binding: (almost) complete, working, tested.
 - Multi-platform (as far as Gtk itself is).
 - If you need, reading Gtk's C docs is straightforward.
 - Seamless integration with Cairo (yay!).
 - ... (probably more)

I already used Gtk on other languages before Haskell, though, so
I'm somewhat biased.

--
Felipe.


------------------------------

Message: 7
Date: Thu, 30 Apr 2009 00:40:54 +0200
From: Daniel Carrera <daniel.carr...@theingots.org>
Subject: Re: [Haskell-beginners] Selecting a GUI toolkit
To: beginners@haskell.org
Message-ID: <49f8d776.9000...@theingots.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Felipe,

I think I read somewhere that Gtk2Hs is the more active project, so it 
might be more mature. On the other hand, Gtk kinda sucks on Mac OS X. I 
hate how Gimp or GnuCash look when I run them on OS X. On Windows Gtk 
runs fine except that the file browser looks out of place.

Daniel.

Felipe Lessa wrote:
> If I were to write one right now (and I might actually need in a
> few days), I'd use Gtk2Hs.
> 
> Cons:
>  - Does not fit Haskell's style.
>  - Very imperative, everything in IO.
> 
> Pros:
>  - Terrific binding: (almost) complete, working, tested.
>  - Multi-platform (as far as Gtk itself is).
>  - If you need, reading Gtk's C docs is straightforward.
>  - Seamless integration with Cairo (yay!).
>  - ... (probably more)
> 
> I already used Gtk on other languages before Haskell, though, so
> I'm somewhat biased.
> 
> --
> Felipe.
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
> 



------------------------------

Message: 8
Date: Thu, 30 Apr 2009 08:21:08 +0800
From: Andy Stewart <lazycat.mana...@gmail.com>
Subject: [Haskell-beginners] Re: Selecting a GUI toolkit
To: beginners@haskell.org
Message-ID: <871vrbvvnv....@ubuntu.domain>
Content-Type: text/plain; charset=us-ascii

Hi Daniel,
Daniel Carrera <daniel.carr...@theingots.org> writes:

> Hello,
>
> This question is just idle curiosity. I don't actually plan to write a 
> desktop GUI program. With
> that said, what library would you recommend to someone who wants to write a 
> cross-platform desktop
> app with Haskell?
>
> Consider the following requirements:
>
> 1) Cross-platform. Windows, Linux and preferably OS X too.
> 2) Maintained, stable, mature, documented, etc.
> 3) Easy to use.
I use gtk2hs, it yes to all your need above.

I use gtk2hs-0.10.0 with GHC 6.10 (6.10.1 or 6.10.2) in Ubuntu (or Debian).

Below is detail install method:
1) Install GHC 6.10, :)
2) Install depend libraries:
sudo aptitude install automake libglade2-dev libgtksourceview-dev 
libgtksourceview2.0-dev libgconf2-dev librsvg2-dev 
libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libgtkglext1-dev 
libgnomevfs2-dev xulrunner-dev -y
3) Download gtk2hs-0.10.0:
http://downloads.sourceforge.net/gtk2hs/gtk2hs-0.10.0.tar.gz
4) Compile gtk2hs-0.10.0:
autoconf && ./configure --enable-docs && make && sudo make install

And this have tutorial that introduce how to use gtk2hs:
http://darcs.haskell.org/gtk2hs/docs/tutorial/Tutorial_Port/

  -- Andy

>
> Notice that this has much to do with the Haskell bindings. For example, Qt 
> might be a fabulous
> toolkit, but qtHaskell might be immature (it looks like it started in Dec 
> 2007).
>
> wxHaskell looks good. I like the idea behind wxWidgets, but I have never used 
> it (or any GUI toolkit
> for that matter).
>
> Thank you for your input.
>
> Cheers,
> Daniel.



------------------------------

Message: 9
Date: Wed, 29 Apr 2009 22:15:25 -0300
From: Felipe Lessa <felipe.le...@gmail.com>
Subject: Re: [Haskell-beginners] Selecting a GUI toolkit
To: beginners@haskell.org
Message-ID: <20090430011525.ga12...@kira.casa>
Content-Type: text/plain; charset=us-ascii

On Thu, Apr 30, 2009 at 12:40:54AM +0200, Daniel Carrera wrote:
> I think I read somewhere that Gtk2Hs is the more active project, so it
> might be more mature. On the other hand, Gtk kinda sucks on Mac OS X. I
> hate how Gimp or GnuCash look when I run them on OS X. On Windows Gtk
> runs fine except that the file browser looks out of place.

Although I don't have access to a Mac, people usually don't like
Gtk there.  But there seems to be a native port somewhere that is
going to be merged into Gtk+ someday :).

Now, good support today for Mac OS X would be my only reason to
go through the wxWindows route.  I use Gtk+ because back in the
days that I tried wxWindows, it had a terrible appearence when
using Gtk as a backend, but probably things improved since then.

--
Felipe.


------------------------------

Message: 10
Date: Wed, 29 Apr 2009 22:25:43 -0400
From: Nathan Holden <nathanmhol...@gmail.com>
Subject: [Haskell-beginners] List Function
To: beginners@haskell.org
Message-ID:
        <305228b20904291925t5d1fa624s3f2e41c69cdfa...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

I don't know what you'd call it. Is there a function in any of the basic
functions that does this something like this:

Sending two lists, [1,2,3] and [2,3,4] it would return
[(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]. I managed to code
my way into returning a list of lists, which works. But it seemed like a
very basic list/matrix function, so I honestly believe that the Haskell
designers probably would've put it in.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090429/16efece4/attachment.htm

------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 10, Issue 32
*****************************************

Reply via email to