Re: [Haskell-cafe] Haskell (GHC 7) on ARM

2012-06-10 Thread Ben Gamari


Joshua Poehls jos...@poehls.me writes:

 Hello Ben,

Hello,

Sorry for the latency. I'm currently on vacation in Germany so I haven't
had terribly consistent Internet access.

I've Cc'd haskell-cafe@ as I've been meaning to document my experiences
anyways and your email seems like a good excuse to do this.


 I just got a Raspberry Pi and I'm interested in running Haskell on it. So
 far I'm running Arch Linux ARM and I noticed there is is a GHC package
 available, but it is version 6.12.3.

 Doing research online I saw that you did some work on adding GHCi support
 for ARM in GHC 7.4. I was wondering if you had anything to share related to
 running GHC/GHCI 7.4 on ARM, specifically Arch Linux ARM.


Indeed my ARM linker patch was merged into GHC 7.4.2. This means that
ARM is now a fully supported target platform for GHC, complete with GHCi
support (which is pretty much necessary for many ubuiquitous packages).

My ARM development environment consists of a PandaBoard (and before this
a BeagleBoard) running Linaro's Ubuntu distribution. For this reason,
I'm afraid I won't be of terribly much help in the case of Arch. That
being said, GHC has a wonderful build system which has never given me
trouble (except in cases of my own stupidity). Just installing the
required development packages and following the build instructions on
Wiki[1] is generally quite sufficient. I've also have some notes of my
own[2] where I've collected my own experiences.

As you likely know, GHC doesn't have a native ARM code generator of its
own, instead relying on LLVM for low-level code generation. For this
reason, you'll first need to have a working LLVM build. I have found
that the ARM backend in the 3.0 release is a bit buggy and therefore
generally pull directly from git (HEAD on my development box is
currently sitting at 7750ff1e3cbb which seems to be stable). That being
said, I haven't done much work in this space recently and it's quite
likely that the 3.1 release is better in this respect.

Compiling LLVM is one case where I have found the limited memory of my
BeagleBoard (which is I believe is similar to the Raspberry Pi) to be
quite troublesome. There are cases during linking where over a gigabyte
of memory is necessary. At this stage the machine can sit for hours
thrashing against its poor SD card making little progress. For this
reason, I would strongly recommend that you cross-compile LLVM. The
process is pretty straightforward and I have collected some notes on the
matter[3].

The size of GHC means that in principle one would prefer to
cross-compile. Unfortunately, support[4] for this is very new (and
perhaps not even working/complete[5]?) so we have to make due with what
we have.  The build process itself is quite simple. You will want to be
very careful to ensure that the ghc/libraries/ trees are sitting on the
same branch as your ghc/ tree (with the ghc/sync-all
script). Inconsistency here can lead to very ambiguous build
failures. Otherwise, the build is nearly foolproof (insofar as this word
can describe any build process). The build takes the better part of a
day on my dual-core Pandaboard. I can't recall what the maximum memory
consumption was but I think it might fit
in 512MB.

Lastly, if I recall correctly, you will find that you'll need to first
build GHC 7.0 bootstrapped from 6.12 before you can build 7.4 (which
requires a fairly new stage 0 GHC).

Let the list know if you encounter any issues. I'll try to dust off my
own development environment once I get back to the states next week to
ensure that everything still works. I've been meaning to setup the
PandaBoard as a build slave as Karel's has been failing for some time
now (perhaps you could look into this, Karel?). Moreover, perhaps I can
find a way to produce redistributable binaries to help others get
started.

Cheers,

- Ben



[1] http://hackage.haskell.org/trac/ghc/wiki/Building
[2] http://bgamari.github.com/posts/ghc-llvm-arm.html
[3] http://bgamari.github.com/posts/cross-compiling_llvm.html
[4] http://hackage.haskell.org/trac/ghc/wiki/CrossCompilation
[5] http://www.haskell.org/pipermail/cvs-ghc/2012-February/070791.html


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


[Haskell-cafe] How to select n random words from a file ...

2012-06-10 Thread Noon Silk
Hi,

 I'm clearly new to haskell, and I suppose those is a basic question,
but after a bit of searching I've been unable to figure out the best
way to do this. I was first trying to find out how to, say, get a
random element from a list, but I'm starting to think that may not be
the best way (because list access isn't constant time, among other
reasons). So, I wonder if there is a more direct way to just get a
random word from a wordfile (i.e. one word per line) ... can anyone
suggest a method?

 Ideally I'd like to be able to adapt this to get n random words from
several files (i.e. randomly select n words from all files; i.e. just
read them into one merged array and choose from there?)

 Thanks for any advice ...

-- 
Noon Silk

Fancy a quantum lunch? https://sites.google.com/site/quantumlunch/

Every morning when I wake up, I experience an exquisite joy — the joy
of being this signature.

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


Re: [Haskell-cafe] converting functional dependencies to type families

2012-06-10 Thread Henning Thielemann


On Thu, 7 Jun 2012, Simon Peyton-Jones wrote:


Very useful!  Maybe worth turning into a page on the Haskell wiki?


I created one:
  http://www.haskell.org/haskellwiki/Functional_dependencies_vs._type_families

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


Re: [Haskell-cafe] How to select n random words from a file ...

2012-06-10 Thread Eugene Kirpichov
Hi,

Look up reservoir sampling, it will most probably help.

On Sun, Jun 10, 2012 at 6:21 AM, Noon Silk noonsli...@gmail.com wrote:
 Hi,

  I'm clearly new to haskell, and I suppose those is a basic question,
 but after a bit of searching I've been unable to figure out the best
 way to do this. I was first trying to find out how to, say, get a
 random element from a list, but I'm starting to think that may not be
 the best way (because list access isn't constant time, among other
 reasons). So, I wonder if there is a more direct way to just get a
 random word from a wordfile (i.e. one word per line) ... can anyone
 suggest a method?

  Ideally I'd like to be able to adapt this to get n random words from
 several files (i.e. randomly select n words from all files; i.e. just
 read them into one merged array and choose from there?)

  Thanks for any advice ...

 --
 Noon Silk

 Fancy a quantum lunch? https://sites.google.com/site/quantumlunch/

 Every morning when I wake up, I experience an exquisite joy — the joy
 of being this signature.

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



-- 
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/

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


Re: [Haskell-cafe] Two parallel libraries from Japan

2012-06-10 Thread Takayuki Muranushi
Hello everyone,

I, Takayuki, author of Paraiso, would like to make some follow ups.

First, the published version of the first paper on Paraiso is now
available from
http://iopscience.iop.org/1749-4699/5/1/015003 .
Please go ahead and read it because the typeset is better, the journal
is an open-access one and it has a most-read ranking!

Second, I have started to refactor Paraiso. Please refer to the blog
http://nushisblogger.blogspot.jp/search/label/ICFDP for the latest
specifications and examples. Comments are welcome!

--
MURANUSHI Takayuki
The Hakubi Center for Advanced Research, Kyoto University
http://www.hakubi.kyoto-u.ac.jp/02_mem/h22/muranushi.html

2012/6/7 Kazu Yamamoto k...@iij.ad.jp

 Hello cafe,

 I would like to announce two parallel libraries from Japan.

 - Paraiso (http://hackage.haskell.org/package/Paraiso)

    The purpose of this library is to design a high-level language for
    implementing explicit partial-differential equations solvers on
    supercomputers as well as today's advanced personal computers.

    Muranushi-san is also known as the author of Monadius and one of
    the two translators of Learn you.

 - GTALib (http://hackage.haskell.org/package/GTALib)

    This package provides the core functionalities of the GTA
    (Generate, Test, and Aggregate) programming framework on Haskell
    See Test, and Aggregate - A Calculation-based Framework for
    Systematic Parallel Programming with MapReduce for more
    information.

 Regards,

 --Kazu

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


[Haskell-cafe] ANN: scrobble-0.1.0.1: Scrobbling server

2012-06-10 Thread Christopher Done
Heyo,

If you use Last.fm/Libre.fm you might be interested in running your own
local scrobbling server in Haskell.

$ cabal update
$ cabal install scrobble
$ scrobble-server 8910

Source is here with further instructions for audio players and such:

https://github.com/chrisdone/scrobble

Exactly what the server does with the scrobbles it receives is purely up to
you, use it as a library and do as you please. Personally I might work on a
Last.fm replacement, at least as far as the statistics/reporting generation
goes.

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


Re: [Haskell-cafe] Two parallel libraries from Japan

2012-06-10 Thread Carter Schonwald
Thanks these look very interesting!

It seems that the parallelism is only available vai the JoinList module, am
i correct in thinking this (or at least that is the only place where it is
clearly inidicated in the haddock and source code).  Are there any plans to
leverage Cloud Haskell once the mature variant is released?
-Carter

On Thu, Jun 7, 2012 at 4:21 AM, Kazu Yamamoto k...@iij.ad.jp wrote:

 Hello cafe,

 I would like to announce two parallel libraries from Japan.

 - Paraiso (http://hackage.haskell.org/package/Paraiso)

The purpose of this library is to design a high-level language for
implementing explicit partial-differential equations solvers on
supercomputers as well as today's advanced personal computers.

Muranushi-san is also known as the author of Monadius and one of
the two translators of Learn you.

 - GTALib (http://hackage.haskell.org/package/GTALib)

This package provides the core functionalities of the GTA
(Generate, Test, and Aggregate) programming framework on Haskell
See Test, and Aggregate - A Calculation-based Framework for
Systematic Parallel Programming with MapReduce for more
information.

 Regards,

 --Kazu

 ___
 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


[Haskell-cafe] Haskell User Group Hamburg (Germany) - Meeting Thursday June 14th 2012

2012-06-10 Thread Stefan Schmidt
Hello cafe,

there's an upcomming meeting of the Haskell user group Hamburg next
Thursday (June 14th).

We'll start 19:00 at the Xing AG in Hamburg (Gänsemarkt 43, 20354 Hamburg).

Falko Peters will give a short talk about hedis (
http://hackage.haskell.org/package/hedis), a Redis client written in
Haskell. Although this announcement is written in english the talk will be
given in german.

So if you are interested to come, have a look at our doodle (also in
german) and give us a short note if you want to join us.
http://www.doodle.com/3fz45uqupp8pzutb

Further announcements will be made via Twitter, so you may want to follow
https://twitter.com/hug_hh.

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


Re: [Haskell-cafe] How to select n random words from a file ...

2012-06-10 Thread Alexander Solla
On Sun, Jun 10, 2012 at 6:21 AM, Noon Silk noonsli...@gmail.com wrote:

 Hi,

  I'm clearly new to haskell, and I suppose those is a basic question,
 but after a bit of searching I've been unable to figure out the best
 way to do this. I was first trying to find out how to, say, get a
 random element from a list, but I'm starting to think that may not be
 the best way (because list access isn't constant time, among other
 reasons). So, I wonder if there is a more direct way to just get a
 random word from a wordfile (i.e. one word per line) ... can anyone
 suggest a method?


My preferred option, assuming the file sizes make it amenable, is to use
Iteratees to fold the wordlists into an IntMap of words.  You can then take
the size of the map and choose n unique Ints in the range.

Note that any algorithm is going to include these basic steps. (Get the
size, pick randoms, access the words at the key/line number).  The most
direct approach would basically be imperative and in the IO monad, using
things like openFile and hSeek.

This approach gets harder if you want to pull words out of multiple
wordlists.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] attoparsec double precision, quickCheck and aeson

2012-06-10 Thread Bryan O'Sullivan
  On Wed, Jun 6, 2012 at 6:20 AM, Doug McIlroy d...@cs.dartmouth.eduwrote:

 Last I looked (admittedly quite a while ago), the state of
 the art was strtod in http://www.netlib.org/fp/dtoa.c.
 (Alas, dtoa.c achieves calculational perfection via a
 murmuration of #ifdefs.)


That was indeed the state of the art for about three decades, until Florian
Loitsch showed up in 2010 with an algorithm that is usually far faster:
http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-problems-you-didnt-even-know-you-had/

Unfortunately, although I've written Haskell bindings to his library, said
library is written in C++, and our FFI support for C++ libraries is
negligible and buggy. As a result, that code is disabled by default.

It's disheartening to hear that important Haskell code has
 needlessly fallen from perfection--perhaps even deliberately.


Indeed (and yes, it's deliberate). If I had the time to spare, I'd attempt
to fix the situation by porting Loitsch's algorithm to Haskell or C, but
either one would be a lot of work - the library is 5,600 lines of tricky
code.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to select n random words from a file ...

2012-06-10 Thread KC
An interesting related problem is if you are only allowed one pass through
the data how would you randomly choose one word.





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