Some Haskell platformish questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Some Haskell platformish questions

David Pollak
Howdy,

I'm considering building a desktop app using Haskell.  The primary target for the app is Windows, but if it runs on Linux and Mac (Intel and PPC), that'd be a bonus.  I've got a bunch of questions that hopefully folks can answer.

Well, before I start, you might well be asking "Gee David, you're a Scala kind of guy... I mean, you're the primary contributor to lift... why not use Scala?"  Well, I'm looking to build something that compiles down to native code and has a smaller download (and runtime) footprint than the JVM offers.  I've come to love functional programming and am taking the current side project as an opportunity to learn Haskell.

So... on to the questions:
  • Can GHC generate stand-alone executables with all the dependencies linked in such that I can distribute the single file without worrying about including a bunch of DLLs/SOs? The answer seems to be yes, but I wanted to confirm.
  • How much of a distribution footprint is the Haskell runtime?  If I have a "Hello World" app, roughly how big will the EXE be (if one includes the JRE in the runtime, a Java/Scala program has a minimum footprint of 20M... that's big.)
  • Same goes for the runtime... I've looked at the stats on the Language Shootout home page and these look encouraging, but I wanted to see if the reasonable footprint is a reality.
  • How real/solid/stable is the wxHaskell widgets package?  Is it being well maintained?  Is there (okay... this is pie in the sky) an GUI Builder for it?
  • How are the Windows/COM bindings in Haskell... would it be possible to, for example, embed an IE Browser COM control in a a wxHaskell window?
  • I found a package to do HTTP requests in Haskell but it does not seem to support HTTPS.  Is there an HTTPS client package for Haskell?
  • How are Strings internally represented?  Are they single byte or multi-byte characters?  How easy it is to translate to/from internal representation to UTF-8?
  • How's the XML support?  Will the XML parser handle non-Latin characters and properly encode stuff?  Does XML get parsed down into easily mappable/filterable collections?
  • Is there support for SHA256 (I saw an SSLeay package which had support for a lot of stuff, but not SHA256)?
  • I understand that Haskell has "a better approach" to parallelizing tasks, but I have not seen much about the actual manifestation of this... would someone be so kind as to give me a pointer?
  • On a related note, I have become a fan (via Scala) of Erlang-style Actors and asynchronous message passing.  Are there any similar packages for Haskell?
  • I tend to do most of my coding in either Emacs or Eclipse... how's the Haskell support in either?  Is there a preferred editor (I don't mean to start any wars here... :-)
  • Are there any production Haskell-based desktop apps of note?
Anyway... sorry for the long list of questions.  I look forward to hearing from you all and learning more about Haskell.

Thanks,

David


--
lift, the fast, powerful, easy web framework
http://liftweb.net
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

Stefan O'Rear
On Wed, Aug 01, 2007 at 01:48:07PM -0700, David Pollak wrote:
> Howdy,
>
> I'm considering building a desktop app using Haskell.  The primary target
> for the app is Windows, but if it runs on Linux and Mac (Intel and PPC),
> that'd be a bonus.  I've got a bunch of questions that hopefully folks can
> answer.

I use a Unix; treat my answers as thus qualified.

> Well, before I start, you might well be asking "Gee David, you're a Scala
> kind of guy... I mean, you're the primary contributor to lift... why not use
> Scala?"  Well, I'm looking to build something that compiles down to native
> code and has a smaller download (and runtime) footprint than the JVM
> offers.  I've come to love functional programming and am taking the current
> side project as an opportunity to learn Haskell.
>
> So... on to the questions:
>
>    - Can GHC generate stand-alone executables with all the dependencies
>    linked in such that I can distribute the single file without worrying about
>    including a bunch of DLLs/SOs? The answer seems to be yes, but I wanted to
>    confirm.
Currently, GHC doesn't support generating shared libraries at all, so
all you have to worry about is libc and friends, but that's usually
pre-installled and some combination of -static -optl-static will fix it.

>    - How much of a distribution footprint is the Haskell runtime?  If I
>    have a "Hello World" app, roughly how big will the EXE be (if one includes
>    the JRE in the runtime, a Java/Scala program has a minimum footprint of
>    20M... that's big.)

About 500kb.

>    - Same goes for the runtime... I've looked at the stats on the
>    Language Shootout home page and these look encouraging, but I wanted to see
>    if the reasonable footprint is a reality.

It's pretty reasonable.  I don't have exact numbers due to the
vagarities of Linux demand loading, but Don reports that xmonad and dwm
use very similar amounts of memory, ie whatever RTS overhead exists is
swamped by the 2MB runtime footprint of Xlib.

>    - How real/solid/stable is the wxHaskell widgets package?  Is it being
>    well maintained?  Is there (okay... this is pie in the sky) an GUI Builder
>    for it?
>    - How are the Windows/COM bindings in Haskell... would it be possible
>    to, for example, embed an IE Browser COM control in a a wxHaskell window?

Unknown.

>    - I found a package to do HTTP requests in Haskell but it does not
>    seem to support HTTPS.  Is there an HTTPS client package for Haskell?

Maybe soon; the current HTTP package is widely acknowledged as being in
dire need of an overhaul, and Mietek Bak is doing exactly that as part
of the SoC.

>    - How are Strings internally represented?  Are they single byte or
>    multi-byte characters?  How easy it is to translate to/from internal
>    representation to UTF-8?

A cons-list of characters, so 12 bytes per character.  Characters are
internally memoized only if they are smaller than 256, so add 8 bytes
for every non-latin1 character.  Double the numbers for a 64-bit system.

They can represent full Unicode, but there's none of the traditional
"multi byte" stuff - one cell is one character.

Quite easy, Mertens et al recently released a utf8-string library that
should make it completely automatic.  (I haven't used it yet)

>    - How's the XML support?  Will the XML parser handle non-Latin
>    characters and properly encode stuff?  Does XML get parsed down into easily
>    mappable/filterable collections?

We have no less than three XML parsers, none of which I have experience
using.

>    - Is there support for SHA256 (I saw an SSLeay package which had
>    support for a lot of stuff, but not SHA256)?

Probably not.

>    - I understand that Haskell has "a better approach" to parallelizing
>    tasks, but I have not seen much about the actual manifestation of this...
>    would someone be so kind as to give me a pointer?

http://www.macs.hw.ac.uk/~dsg/gph/papers/abstracts/strategies.html

We also have ordinary threads with basic standard concurrency
abstractions, Control.Concurrent.*.

>    - On a related note, I have become a fan (via Scala) of Erlang-style
>    Actors and asynchronous message passing.  Are there any similar packages for
>    Haskell?

Sure.  Control.Concurrent.Chan gives asynchronous message passing.

>    - I tend to do most of my coding in either Emacs or Eclipse... how's
>    the Haskell support in either?  Is there a preferred editor (I don't mean to
>    start any wars here... :-)

Emacs and vi both have native support for Haskell.  Emacs additionally
has basic integration with the interactive environments (Reload buffer,
stuff like that) and passable auto-indenting (hard to do right in a
language with significant whitespace); B. Schmidt's "shim" package
provides more, like automatic error highlighting.

Eclipse supports Haskell via an addon-package "EclipseFP", I've only
heard about it never used it.

>    - Are there any production Haskell-based desktop apps of note?
>
> Anyway... sorry for the long list of questions.  I look forward to hearing
> from you all and learning more about Haskell.

Stefan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

Duncan Coutts
In reply to this post by David Pollak
On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote:

> So... on to the questions:

First of all I recommend you check out these resources:

The standard libraries:
http://haskell.org/ghc/docs/latest/html/libraries/

A large collection of other libraries:
http://hackage.haskell.org/

Another directory of apps and libraries, many of which are not yet
available through hackage:
http://haskell.org/haskellwiki/Applications_and_libraries


>       * Can GHC generate stand-alone executables with all the
>         dependencies linked in such that I can distribute the single
>         file without worrying about including a bunch of DLLs/SOs? The
>         answer seems to be yes, but I wanted to confirm.

Yes, but the same is not true of any C dlls you link to, eg GUI libs
like gtk or wx.

>       * How much of a distribution footprint is the Haskell runtime?
>         If I have a "Hello World" app, roughly how big will the EXE be
>         (if one includes the JRE in the runtime, a Java/Scala program
>         has a minimum footprint of 20M... that's big.)

Statically linked hello world is 470K on my amd64 linux box. An
equivalent GUI hello world with Gtk2Hs is 540K.

These are still dynamically liked to libc and libgmp.

>       * Same goes for the runtime... I've looked at the stats on the
>         Language Shootout home page and these look encouraging, but I
>         wanted to see if the reasonable footprint is a reality.

Not sure what you're asking here. The ghc rts is linked into the
program.

>       * How real/solid/stable is the wxHaskell widgets package?  Is it
>         being well maintained?  Is there (okay... this is pie in the
>         sky) an GUI Builder for it?

Perhaps someone who uses wxHaskell can help you with that. I help
maintain Gtk2Hs so can tell you about that...

Gtk2Hs is well maintained imho :-) We do releases roughly every 6
months. The last one was a couple weeks ago. It has an installer for
Windows and it's included in several other platforms like debian,
fedora, gentoo, freebsd and macports.

The glade GUI builder can be used with Gtk2Hs on all platforms.

>       * How are the Windows/COM bindings in Haskell... would it be
>         possible to, for example, embed an IE Browser COM control in a
>         a wxHaskell window?

There is a COM tool, not sure about embedding IE. Gtk2Hs supports
embedding the mozilla rendering engine, though not on Windows at the
moment.

HDirect has not seen much maintenance but apparently there is an updated
version that was used in VisualHaskell. Perhaps someone else can tell
you more about HDirect, I'm not especially familiar with it.
http://www.haskell.org/hdirect/
http://www.haskell.org/visualhaskell/

>       * I found a package to do HTTP requests in Haskell but it does
>         not seem to support HTTPS.  Is there an HTTPS client package
>         for Haskell?

There's work on a libcurl binding going on at the moment.

>       * How are Strings internally represented?  Are they single byte
>         or multi-byte characters?  How easy it is to translate to/from
>         internal representation to UTF-8?

Strings are represented as ordinary Haskell lists of Unicode code
points. There are functions available for converting to and from byte
sequences in UTF8 and other encodings (though not in the base packages
at the moment).

Both Gtk2Hs and wxHaskell support Unicode.

>       * How's the XML support?  Will the XML parser handle non-Latin
>         characters and properly encode stuff?  Does XML get parsed
>         down into easily mappable/filterable collections?

There are 2 major xml packages, HaXml and HXT. You can download them and
find their documentation on http://hackage.haskell.org/

>       * Is there support for SHA256 (I saw an SSLeay package which had
>         support for a lot of stuff, but not SHA256)?

The Crypto package supports SHA1.

>       * I understand that Haskell has "a better approach" to
>         parallelizing tasks, but I have not seen much about the actual
>         manifestation of this... would someone be so kind as to give
>         me a pointer?

Look for Haskell's lightweight threads, STM and parallel strategies:

Control.Concurrent
Control.Concurrent.STM
Control.Parallel.Strategies

>       * On a related note, I have become a fan (via Scala) of
>         Erlang-style Actors and asynchronous message passing.  Are
>         there any similar packages for Haskell?

Not so far as I know, though the concurrency library supports channels
so you can use a pattern where a thread reads messages from a channel
and post's messages to other channels.

>       * I tend to do most of my coding in either Emacs or Eclipse...
>         how's the Haskell support in either?  Is there a preferred
>         editor (I don't mean to start any wars here... :-)

Emacs, vim, nedit, gedit and others support Haskell syntax highlighting.
Emacs has some additional ghci integration mode. There's a project to
add Haskell support to Eclipse, though I'm not sure how mature it is.

>       * Are there any production Haskell-based desktop apps of note?

xmonad, an X11 window manager
VisualHaskell, a Haskell extension to VisualStudio

There are a number of programs that use Gtk2Hs or wxHaskell which you
can find linked from their websites including:

dazzle, http://wxhaskell.sourceforge.net/applications.html
pivotal, http://www.cs.kent.ac.uk/projects/pivotal/
himerge, http://fmap.us/himerge.html
HRay, http://trappist.elis.ugent.be/~kehoste/Haskell/HRay/


Duncan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

David Pollak
In reply to this post by Stefan O'Rear
Stefan,

Thanks for the wicked quick response!

On 8/1/07, Stefan O'Rear <[hidden email]> wrote:

>    - I found a package to do HTTP requests in Haskell but it does not
>    seem to support HTTPS.  Is there an HTTPS client package for Haskell?

Maybe soon; the current HTTP package is widely acknowledged as being in
dire need of an overhaul, and Mietek Bak is doing exactly that as part
of the SoC.

Kewl.  Are there any snapshots of his work?


>    - How's the XML support?  Will the XML parser handle non-Latin
>    characters and properly encode stuff?  Does XML get parsed down into easily
>    mappable/filterable collections?

We have no less than three XML parsers, none of which I have experience
using.

:-)

Thanks,

David



--
lift, the fast, powerful, easy web framework
http://liftweb.net
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

David Pollak
In reply to this post by Duncan Coutts
Duncan,

Many thanks to you as well!

On 8/1/07, Duncan Coutts <[hidden email]> wrote:
On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote:


>       * Can GHC generate stand-alone executables with all the
>         dependencies linked in such that I can distribute the single
>         file without worrying about including a bunch of DLLs/SOs? The
>         answer seems to be yes, but I wanted to confirm.

Yes, but the same is not true of any C dlls you link to, eg GUI libs
like gtk or wx.

Okay... so I'll have to include the (for example GTK2 DLLs) with the distribution...


>       * How real/solid/stable is the wxHaskell widgets package?  Is it
>         being well maintained?  Is there (okay... this is pie in the
>         sky) an GUI Builder for it?

Perhaps someone who uses wxHaskell can help you with that. I help
maintain Gtk2Hs so can tell you about that...

Gtk2Hs is well maintained imho :-) We do releases roughly every 6
months. The last one was a couple weeks ago. It has an installer for
Windows and it's included in several other platforms like debian,
fedora, gentoo, freebsd and macports.

I just grabbed a copy and installed it (on Ubuntu... my preferred development platform.)

The glade GUI builder can be used with Gtk2Hs on all platforms.

Very cool.  I grabbed Glade as well.  It's pretty sweet.


Both Gtk2Hs and wxHaskell support Unicode.

Excellent.


>       * Is there support for SHA256 (I saw an SSLeay package which had
>         support for a lot of stuff, but not SHA256)?

The Crypto package supports SHA1.



>       * Are there any production Haskell-based desktop apps of note?

xmonad, an X11 window manager
VisualHaskell, a Haskell extension to VisualStudio

There are a number of programs that use Gtk2Hs or wxHaskell which you
can find linked from their websites including:

dazzle, http://wxhaskell.sourceforge.net/applications.html
pivotal, http://www.cs.kent.ac.uk/projects/pivotal/
himerge, http://fmap.us/himerge.html
HRay, http://trappist.elis.ugent.be/~kehoste/Haskell/HRay/

Thanks!

David

Duncan




--
lift, the fast, powerful, easy web framework
http://liftweb.net
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

Stefan O'Rear
On Wed, Aug 01, 2007 at 03:31:56PM -0700, David Pollak wrote:

> Duncan,
>
> Many thanks to you as well!
>
> On 8/1/07, Duncan Coutts <[hidden email]> wrote:
> >
> > On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote:
> >
> >
> > >       * Can GHC generate stand-alone executables with all the
> > >         dependencies linked in such that I can distribute the single
> > >         file without worrying about including a bunch of DLLs/SOs? The
> > >         answer seems to be yes, but I wanted to confirm.
> >
> > Yes, but the same is not true of any C dlls you link to, eg GUI libs
> > like gtk or wx.
>
>
> Okay... so I'll have to include the (for example GTK2 DLLs) with the
> distribution...
You can just use -static or -optl-static, which will cause C libraries
like gtk or wx to be bundled statically.  (Out of curiousity, what did I
actually convey when I tried to express that in my last message?)

Stefan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

David Pollak


On 8/1/07, Stefan O'Rear <[hidden email]> wrote:
On Wed, Aug 01, 2007 at 03:31:56PM -0700, David Pollak wrote:

> Duncan,
>
> Many thanks to you as well!
>
> On 8/1/07, Duncan Coutts <[hidden email]> wrote:
> >
> > On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote:
> >
> >
> > >       * Can GHC generate stand-alone executables with all the
> > >         dependencies linked in such that I can distribute the single
> > >         file without worrying about including a bunch of DLLs/SOs? The
> > >         answer seems to be yes, but I wanted to confirm.
> >
> > Yes, but the same is not true of any C dlls you link to, eg GUI libs
> > like gtk or wx.
>
>
> Okay... so I'll have to include the (for example GTK2 DLLs) with the
> distribution...

You can just use -static or -optl-static, which will cause C libraries
like gtk or wx to be bundled statically.  (Out of curiousity, what did I
actually convey when I tried to express that in my last message?)

Stefan,

From your message, I understood that I could statically link the libraries and have a single large EXE.  I understood from Duncan's message that I could not statically link to some DLLs.  I was somewhat confused... :-)

Thanks,

David

Stefan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGsQwxFBz7OZ2P+dIRAmYDAKC8VYaXv2O5q3ajHZibrABGh41E+ACgwcwA
EkZ3zGUYvJxu6zRF6CPBR8g=
=zCC2
-----END PGP SIGNATURE-----




--
lift, the fast, powerful, easy web framework
http://liftweb.net
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

Duncan Coutts
In reply to this post by David Pollak
On Wed, 2007-08-01 at 15:31 -0700, David Pollak wrote:

> Duncan,
>
> Many thanks to you as well!
>
> On 8/1/07, Duncan Coutts <[hidden email]> wrote:
>         On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote:
>        
>         > * Can GHC generate stand-alone executables with all the
>         >   dependencies linked in such that I can distribute the
>         single
>         >   file without worrying about including a bunch of DLLs/SOs?
>         The
>         >   answer seems to be yes, but I wanted to confirm.
>        
>         Yes, but the same is not true of any C dlls you link to, eg
>         GUI libs like gtk or wx.
>
> Okay... so I'll have to include the (for example GTK2 DLLs) with the
> distribution...

Yes. Those are available here:
http://haskell.org/gtk2hs/win32/

As a demo of an windows installer for a prog that uses Gtk2Hs, see:
http://haskell.org/~duncan/gtk2hs/LSystemSetup.exe
(3.5Mb)

At some point I intend to write some more detailed instructions on this,
but in the mean time you can probably figure it out from the example.
It's just a matter of putting the right dlls and other file in the right
place, the .zip files have the right directory structure all ready, so
that's pretty easy.

> I just grabbed a copy and installed it (on Ubuntu... my preferred
> development platform.)

Note that it looks like Ubuntu doesn't have the latest version yet:
http://packages.ubuntu.com/feisty/libdevel/libghc6-gtk-dev
but that version should be ok for most stuff you want to do.

Duncan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

David Pollak
Duncan,

Okay... I'm pretty darned impressed.

I downloaded the packages and got my first Haskell/Glade app running in about the same amount of time as it took me to get my first VS.Net app up and running.

Thanks for the pointer to GTK2hs.

I hope to have a nice app to add to the list of Haskell apps pretty soon.

Thanks,

David

PS -- An extra big thanks to you and Stefan for your responsiveness!

On 8/1/07, Duncan Coutts <[hidden email]> wrote:
On Wed, 2007-08-01 at 15:31 -0700, David Pollak wrote:

> Duncan,
>
> Many thanks to you as well!
>
> On 8/1/07, Duncan Coutts <[hidden email]> wrote:
>         On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote:
>
>         > * Can GHC generate stand-alone executables with all the
>         >   dependencies linked in such that I can distribute the
>         single
>         >   file without worrying about including a bunch of DLLs/SOs?
>         The
>         >   answer seems to be yes, but I wanted to confirm.
>
>         Yes, but the same is not true of any C dlls you link to, eg
>         GUI libs like gtk or wx.
>
> Okay... so I'll have to include the (for example GTK2 DLLs) with the
> distribution...

Yes. Those are available here:
http://haskell.org/gtk2hs/win32/

As a demo of an windows installer for a prog that uses Gtk2Hs, see:
http://haskell.org/~duncan/gtk2hs/LSystemSetup.exe
(3.5Mb)

At some point I intend to write some more detailed instructions on this,
but in the mean time you can probably figure it out from the example.
It's just a matter of putting the right dlls and other file in the right
place, the .zip files have the right directory structure all ready, so
that's pretty easy.

> I just grabbed a copy and installed it (on Ubuntu... my preferred
> development platform.)

Note that it looks like Ubuntu doesn't have the latest version yet:
http://packages.ubuntu.com/feisty/libdevel/libghc6-gtk-dev
but that version should be ok for most stuff you want to do.

Duncan




--
lift, the fast, powerful, easy web framework
http://liftweb.net
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

Duncan Coutts
On Wed, 2007-08-01 at 17:29 -0700, David Pollak wrote:
> Duncan,
>
> Okay... I'm pretty darned impressed.
>
> I downloaded the packages and got my first Haskell/Glade app running
> in about the same amount of time as it took me to get my first VS.Net
> app up and running.

Excellent :-)

> Thanks for the pointer to GTK2hs.

You're welcome.

> I hope to have a nice app to add to the list of Haskell apps pretty
> soon.

We're always very happy to showcase applications of Gtk2Hs on the
website:

http://haskell.org/gtk2hs/archives/category/screenshots/


Duncan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

Bulat Ziganshin-2
In reply to this post by David Pollak
Hello David,

Thursday, August 2, 2007, 12:48:07 AM, you wrote:

about concurrency - necessarily read paper "Tackling the awkward squad:
monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell"
http://research.microsoft.com/Users/simonpj/papers/marktoberdorf/marktoberdorf.ps.gz

one of current GSOC projects is the binding to LibCurl

about SHA256 - if it's missed in Crypto package, you can use FFI to
import this function from any C library

--
Best regards,
 Bulat                            mailto:[hidden email]

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

Niko Korhonen
In reply to this post by David Pollak
My answers apply to Windows/GHC.

David Pollak wrote:
>     * Can GHC generate stand-alone executables with all the dependencies
>       linked in such that I can distribute the single file without
>       worrying about including a bunch of DLLs/SOs? The answer seems to
>       be yes, but I wanted to confirm.

Yes.

>     * How much of a distribution footprint is the Haskell runtime?  If I
>       have a "Hello World" app, roughly how big will the EXE be (if one
>       includes the JRE in the runtime, a Java/Scala program has a
>       minimum footprint of 20M... that's big.)

A hello world application executable on Windows/GHC 6.6.1 is 592,385
bytes. But the size grows very quickly to 1-2 MB when you start
including the basic libraries.

>     * Same goes for the runtime... I've looked at the stats on the
>       Language Shootout home page and these look encouraging, but I
>       wanted to see if the reasonable footprint is a reality.

The memory footprint of a well-written Haskell program seems to be very
small. I once wrote a text parser that only used a maximum of 2 MB of
memory while processing an infinite stream. This is much less than the
minimum footprint of the JVM. One reason for this is that the GHC
garbage collector officially kicks ass.

However, it is exceedingly easy to write memory-leaking programs in
Haskell. Fortunately memory leaks usually manifest themselves as a
program crash (stack overflow) or very high heap usage (easy to monitor
in task explorer). In any case, the memory usage is pretty easy to
monitor with GHC's built-in profiling facilities.

Now fixing Haskell memory leaks... a completely different story. It's
nothing short of black magic. Performing the simplest program
optimizations and fixing the simplest of memory leaks generally requires
 a level of gurudom that is not even possible to achieve just with
Java/C/C++ programming.

Fixing a Haskell program usually involves performing a couple of sacred
rites, sacrifices, voodoo rituals (you can consult your preferred deity,
it doesn't matter). When that doesn't help, approach the Gurus of this
forun, place the ritual Offering and plead for help. If they are
satisfied with you, they might, just might, throw you a scrap of wisdom
from their infinite mental capacity, which upon receiving will shock and
humble you for life. Usually it sounds like this:

"Here's a one line fold that replaces your entire program and doesn't
have the memory leak."

>     * I tend to do most of my coding in either Emacs or Eclipse... how's
>       the Haskell support in either?  Is there a preferred editor (I
>       don't mean to start any wars here... :-)

Yes, there's a plugin for Eclipse. It's actually slightly better than
the Scala plugin you're probably familiar with :)

There's also a good syntax highlighting file for jEdit.

Niko

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Some Haskell platformish questions

Jeremy O'Donoghue
In reply to this post by David Pollak
Hi David,

On 01/08/07, David Pollak <[hidden email]> wrote:

[snip]

> Can GHC generate stand-alone executables with all the dependencies linked in
> such that I can distribute the single file without worrying about including
> a bunch of DLLs/SOs? The answer seems to be yes, but I wanted to confirm.

Yes - and I've found it to be easy (on Windows) to wrap the whole
thing in an InnoSetup installer.

> How much of a distribution footprint is the Haskell runtime?  If I have a
> "Hello World" app, roughly how big will the EXE be (if one includes the JRE
> in the runtime, a Java/Scala program has a minimum footprint of 20M...
> that's big.)

I wrote a moderately complex GUI application for exploring and viewing
the contents of ELF binaries.

It comes up as an 8MB executable with another 4.6MB of DLLs (wxWidgets
at 2.7MB and the wxWidgets wrapper for wxhaskell at 1.8 MB). This
makes pretty extensive use of various Haskell libraries, and is
probably realistic for a GUI app of moderate complexity.

> Same goes for the runtime... I've looked at the stats on the Language
> Shootout home page and these look encouraging, but I wanted to see if the
> reasonable footprint is a reality.

Footprint is actually very reasonable. While browsing ELF binaries of
around 100MB, footprint is about 50MB, and I didn't try optimizing
very hard - it was 'good enough' out of the box.

> How real/solid/stable is the wxHaskell widgets package?  Is it being well
> maintained?  Is there (okay... this is pie in the sky) an GUI Builder for
> it?

I'm one of the maintainers of wxHaskell. It is maintained, but none of
us has anywhere near as much time as we would like (everyone has day
jobs...). It is very stable and reliable, but currently not much fun
to build (although watch this space...). There's no GUI builder, I'm
afraid.

The big bonus is that it runs well, and natively, on Windows, OS X and Linux.

> How are the Windows/COM bindings in Haskell... would it be possible to, for
> example, embed an IE Browser COM control in a a wxHaskell window?

I've yet to manage such a thing. My impression is that most of the COM
tools for Haskell suffer bit-rot to some degree or another. I've never
managed to get any of them to work properly.

> I understand that Haskell has "a better approach" to parallelizing tasks,
> but I have not seen much about the actual manifestation of this... would
> someone be so kind as to give me a pointer?

Note that some care is needed with GUI packages (wxhaskell for sure,
and I think Gtk2Hs also) when used in multi-threaded environment.

> I tend to do most of my coding in either Emacs or Eclipse... how's the
> Haskell support in either?  Is there a preferred editor (I don't mean to
> start any wars here... :-)

Emacs support is very good. It's where I spend my life (although sadly
more often in C++-mode than Haskell-mode right now...)

> Are there any production Haskell-based desktop apps of note?

The ELF explorer I mentioned early is deployed to about 100 people at
the company where I work, and has required almost no support as it
'just works'. I think this is due more to the excellence of Haskell
type checker than anything I did right...

Sadly I can't open-source it.

I can confirm that it took about 20% of the time to write and debug
than it would have in C++, despite the fact that I've been programming
in C and C++ for 20 years, and didn't know my monads from my functors
when I started :-)
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe