Re: [Haskell-cafe] Re: Recommended Haskell Books

2008-08-10 Thread Luke Palmer
On Mon, Aug 11, 2008 at 4:12 AM, Benjamin L. Russell <[EMAIL PROTECTED]
> wrote:

> On Sun, 10 Aug 2008 11:29:46 -0700, "Warren Aldred" <[EMAIL PROTECTED]>
> wrote:
>
> >Hi all,
> >
> >I'm new to Haskell and looking for recommendations on introductory Haskell
> >books.  Online or offline.  Any suggestions?
>
> Another suggestion is _The Haskell Road to Logic, Maths, and
> Programming,_ by Kees Doets and Jan van Eijck (see
> http://fldit-www.cs.uni-dortmund.de/~peter/PS07/HR.pdf).
>  This book
> assumes very little mathematical background, is written in a "literate
> programming" style, and is very easy to follow.
>
> In general, I would recommend focusing on the books, and not too much
> on most of the tutorials.  Some other readers have said that many
> Haskell tutorials try to cover too many topics in too short a
> tutorial, and wind up not discussing the material adequately.  Haskell
> has a very sharp learning curve, and it is essential to cover the
> basics adequately before diving into deeper material.


Depending, of course, on your learning style.  I was never very good at the
"dependency-driven" learning style; I have found it easier for me to learn
what I'm interested in. If I don't have the background to understand it yet,
then I'll half-understand it.  And gradually everything starts coming
together.  To each his own, YMMV, et cetera.

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


[Haskell-cafe] Re: Recommended Haskell Books

2008-08-10 Thread Benjamin L . Russell
On Sun, 10 Aug 2008 11:29:46 -0700, "Warren Aldred" <[EMAIL PROTECTED]>
wrote:

>Hi all,
>
>I'm new to Haskell and looking for recommendations on introductory Haskell 
>books.  Online or offline.  Any suggestions?

Another suggestion is _The Haskell Road to Logic, Maths, and
Programming,_ by Kees Doets and Jan van Eijck (see
http://fldit-www.cs.uni-dortmund.de/~peter/PS07/HR.pdf).  This book
assumes very little mathematical background, is written in a "literate
programming" style, and is very easy to follow.

In general, I would recommend focusing on the books, and not too much
on most of the tutorials.  Some other readers have said that many
Haskell tutorials try to cover too many topics in too short a
tutorial, and wind up not discussing the material adequately.  Haskell
has a very sharp learning curve, and it is essential to cover the
basics adequately before diving into deeper material.  I would
recommend taking the time to digest the material fully without
rushing.

-- Benjamin L. Russell

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


[Haskell-cafe] Re: please help me to find errors from my first app

2008-08-10 Thread Changying Li
thanks. I know how to do it. I should treat it as a stream. 
-- 

Thanks & Regards

Changying Li

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


Re: [Haskell-cafe] Thinking about an unlistN

2008-08-10 Thread Robert Greayer
--- On Sun, 8/10/08, Michael Feathers <[EMAIL PROTECTED]> wrote:

> I wrote this function the other day, and I was wondering if
> I'm missing 
> something.. whether there is already a function or idiom
> around to do this.
> 
> 
> unlist3 :: (a -> a -> a -> b) -> [a] -> b
> unlist3 f (x:y:z:xs) = f x y z
> 
> 
> I was also wondering whether the function can be
> generalized to N or 
> whether this is just one of those edges in the type system
> that you 
> can't abstract over.
> 

Well, there's always haskell's Swiss Army Knife, TH:

> module Unlist(unlistN) where
> 
> import Language.Haskell.TH
> 
> unlistN n = do
> f <- newName "f"
> xs <- sequence (replicate n (newName "x"))
> lamE [varP f,(foldr ((flip infixP) '(:)) (wildP) (map varP xs))] 
>  (foldl appE (varE f) (map varE xs))

> {-# OPTIONS_GHC -XTemplateHaskell #-}
> module UseUnlist where
> 
> import Unlist
> 
> f i0 i1 i2 i3 = i0 + i1 + i2 + i3
> 
> x = $(unlistN 4) f [1,2,3,4,5,6,7]

rcg


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


Re: [Haskell-cafe] ANN: Tutorial on information visualization and visual analytics in Haskell

2008-08-10 Thread Jefferson Heard
The final version will have graphics from the code that I present,
yes, as well as from other projects I've done in Haskell in
information visualization.  As for the comments next to the Haskell
Code, no -- there was no special tool involved. Sadly, I wrote the
entire document in Word 2007, as it was the best tool I had at hand.
After coming up with a template, I had basically everything I needed,
and it was going to be less work than tweaking LaTeX to do exactly
what I wanted to do with the code.

On Sun, Aug 10, 2008 at 2:34 PM, Justin Bailey <[EMAIL PROTECTED]> wrote:
> On Sat, Aug 9, 2008 at 11:30 AM, Jefferson Heard
> <[EMAIL PROTECTED]> wrote:
>> The link is:
>>
>> http://bluheron.europa.renci.org/docs/BeautifulCode.pdf
>
> Very readable and interesting. You may want to add some pictures or
> graphs if you weren't planning on that already.
>
> I really like how you have comments next to the haskell code. Is that
> a literate file? Are you using some well-known tool to weave the
> comments into the code? It looks like presentations I've seen with
> CWEB but I don't know of a tool like that for Haskell code ...
>
> Justin
>



-- 
I try to take things like a crow; war and chaos don't always ruin a
picnic, they just mean you have to be careful what you swallow.

-- Jessica Edwards

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


[Haskell-cafe] Re: Re[2]: heap lifetime question

2008-08-10 Thread Ben Franksen
Galchin, Vasili wrote:
> that is what I thought .. especially after just looking at the
> implementation for alloca/allocaBytes. For me and others on thie group is
> there documentation on the ghc run-time model and also the run-time
> library architecture. Both would help/aid in reading the code and of
> course educate more people?

I'd rather use the FFI Addendum
(http://www.cse.unsw.edu.au/~chak/haskell/ffi/) as reference than the ghc
implementation. Section 5.8 "MarshalAlloc" says

alloca :: Storable a => (Ptr a -> IO b) -> IO b 
 
 Allocate a block of memory of the same size as malloc, but the reference is
passed to a computation instead of being returned. When the computation
terminates, free the memory area again. The operation is exception-safe;
i.e., allocated memory is freed if an exception is thrown in the
marshalling computation. 

allocaBytes :: Int -> (Ptr a -> IO b) -> IO b 
 
 As alloca, but allocate a memory area of the given size. The same alignment
constraint as for mallocBytes holds. 

Cheers
Ben

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


Re: [Haskell-cafe] Thinking about an unlistN

2008-08-10 Thread Benja Fallenstein
Hi,

On Sun, Aug 10, 2008 at 8:57 PM, Michael Feathers
<[EMAIL PROTECTED]> wrote:
> If I have, say, a function f :: a -> a -> a -> a -> b it would be nice to be
> able to just:
>
> unlistN 4 f [1..4]

It indeed doesn't work like this; there's more than one way to do
something *like* this, if you really want to. The closest one is
probably to use type-level numbers:

{-# OPTIONS_GHC -fglasgow-exts #-}

data Zero
data Suc a

zero :: Zero; zero = undefined; suc :: a -> Suc a; suc = undefined
one = suc zero; two = suc one; three = suc two; four = suc three

class Unlist n a b where
type UnlistFn n a b
unlist :: n -> UnlistFn n a b -> [a] -> b

instance Unlist Zero a b where
type UnlistFn Zero a b = b
unlist _ r _ = r

instance Unlist n a b => Unlist (Suc n) a b where
type UnlistFn (Suc n) a b = a -> UnlistFn n a b
unlist _ f (x:xs) = unlist (undefined :: n) (f x) xs

main = print (unlist four (,,,) "abcd")

This prints ('a','b','c','d').

Hope this is fun[*],
- Benja

[*] I hesistate to say "hope this helps" in this case :-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Thinking about an unlistN

2008-08-10 Thread Anton van Straaten

Michael Feathers wrote:


I wrote this function the other day, and I was wondering if I'm missing 
something.. whether there is already a function or idiom around to do this.



unlist3 :: (a -> a -> a -> b) -> [a] -> b
unlist3 f (x:y:z:xs) = f x y z


I was also wondering whether the function can be generalized to N or 
whether this is just one of those edges in the type system that you 
can't abstract over.


In Scheme and Lisp, the "apply" function does this, so the following 
Scheme definition would do the trick:


  (define unlist apply)

(Although this doesn't ignore the xs as in the example; that would 
require some code to extract a sublist of the desired length.)


In Haskell, bring on the type system shenanigans!  ;)

Anton

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


Re: [Haskell-cafe] Recommended Haskell Books

2008-08-10 Thread Thomas M. DuBuisson
I know someone else is going to say it, so I may as well beat them to
the punch:

Real World Haskell isn't released yet, but beta chapters are available
online at book.realworldhaskell.org/beta

As for me, I learned though the Yet Another Haskell tutorial, Haskell
School of Expression (book), Haskell: The Craft of Functional
Programming (book), and plenty of playing around.

Tom

On Sun, 2008-08-10 at 11:29 -0700, Warren Aldred wrote:
> Hi all,
> 
> I'm new to Haskell and looking for recommendations on introductory Haskell 
> books.  Online or offline.  Any suggestions?
> 
> Thanks kindly,
> Warren 
> 
> ___
> 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] Re: ANN: interval and polynomial enclosure arithmetics

2008-08-10 Thread Michal Konecny
Roman Cheplyaka  ro-che.info> writes:

> * Michal Konecny  konecny.aow.cz> [2008-08-08 
13:38:56+0100]
> > and members of the KEG research group at Aston 
> > University have used  it for reliably solving differential 
equations 
> > and numerical constraint satisfaction problems.
> 
> This's very interesting. Do you have any published papers (or other
> sources of information) about it?

Unfortunately, there isn't much yet but more is on the way.
Only the following two papers are available at the moment:

http://www-users.aston.ac.uk/~konecnym/papers/cfv08.html
is about using our polynomial enclosures to prove NCSPs that arise
from floating-point software verification problems.

http://www-users.aston.ac.uk/~konecnym/papers/wollic08.html
analyses the convergence rate of an ODE solver that uses
piecewise constant enclosures (which is rather inefficient).

Best regards,
Michal
-- 
|o| Michal Konecny
|o|http://www-users.aston.ac.uk/~konecnym/
|o|office: (+42) (0)121 204 3462 
|o| PGP key http://www-users.aston.ac.uk/~konecnym/ki.aow


signature.asc
Description: This is a digitally signed message part.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Thinking about an unlistN

2008-08-10 Thread Michael Feathers



Philip,

Thanks.  It's not quite that, though.  It's more like an adapter for a 
function with a specific arity.


If I have, say, a function f :: a -> a -> a -> a -> b it would be nice 
to be able to just:


unlistN 4 f [1..4]


Michael (does look like there's no way to make that fly with the type 
system however)




Philip Neustrom wrote:

I'm no expert, but it looks like the generalization of that would be
some f that took a list:

f :: [a] -> b

so what you'd have is a fold, right?

foldr1 :: (a -> a -> a) -> [a] -> a

Best,
Philip Neustrom

On Sun, Aug 10, 2008 at 11:47 AM, Michael Feathers
<[EMAIL PROTECTED]> wrote:

I wrote this function the other day, and I was wondering if I'm missing
something.. whether there is already a function or idiom around to do this.


unlist3 :: (a -> a -> a -> b) -> [a] -> b
unlist3 f (x:y:z:xs) = f x y z


I was also wondering whether the function can be generalized to N or whether
this is just one of those edges in the type system that you can't abstract
over.


Thanks,

Michael



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






--
Now Playing: Clammbon - 246
http://youtube.com/watch?v=PO77bN8W1mA


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


Re: [Haskell-cafe] Thinking about an unlistN

2008-08-10 Thread Philip Neustrom
I'm no expert, but it looks like the generalization of that would be
some f that took a list:

f :: [a] -> b

so what you'd have is a fold, right?

foldr1 :: (a -> a -> a) -> [a] -> a

Best,
Philip Neustrom

On Sun, Aug 10, 2008 at 11:47 AM, Michael Feathers
<[EMAIL PROTECTED]> wrote:
>
> I wrote this function the other day, and I was wondering if I'm missing
> something.. whether there is already a function or idiom around to do this.
>
>
> unlist3 :: (a -> a -> a -> b) -> [a] -> b
> unlist3 f (x:y:z:xs) = f x y z
>
>
> I was also wondering whether the function can be generalized to N or whether
> this is just one of those edges in the type system that you can't abstract
> over.
>
>
> Thanks,
>
> Michael
>
>
>
> ___
> 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] Thinking about an unlistN

2008-08-10 Thread Michael Feathers


I wrote this function the other day, and I was wondering if I'm missing 
something.. whether there is already a function or idiom around to do this.



unlist3 :: (a -> a -> a -> b) -> [a] -> b
unlist3 f (x:y:z:xs) = f x y z


I was also wondering whether the function can be generalized to N or 
whether this is just one of those edges in the type system that you 
can't abstract over.



Thanks,

Michael



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


Re: [Haskell-cafe] Recommended Haskell Books

2008-08-10 Thread Philip Neustrom
Yup!  You should check out this page on the Haskell wiki:
http://haskell.org/haskellwiki/Books_and_tutorials  It has links to
lists of commonly recommended books and tutorials.

Personally, I like "Yet Another Haskell Tutorial" alongside "The
Haskell School of Expression" (book).

Best,
Philip Neustrom

On Sun, Aug 10, 2008 at 11:29 AM, Warren Aldred <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm new to Haskell and looking for recommendations on introductory Haskell
> books.  Online or offline.  Any suggestions?
>
> Thanks kindly,
> Warren
> ___
> 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] ANN: Tutorial on information visualization and visual analytics in Haskell

2008-08-10 Thread Justin Bailey
On Sat, Aug 9, 2008 at 11:30 AM, Jefferson Heard
<[EMAIL PROTECTED]> wrote:
> The link is:
>
> http://bluheron.europa.renci.org/docs/BeautifulCode.pdf

Very readable and interesting. You may want to add some pictures or
graphs if you weren't planning on that already.

I really like how you have comments next to the haskell code. Is that
a literate file? Are you using some well-known tool to weave the
comments into the code? It looks like presentations I've seen with
CWEB but I don't know of a tool like that for Haskell code ...

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


[Haskell-cafe] Recommended Haskell Books

2008-08-10 Thread Warren Aldred

Hi all,

I'm new to Haskell and looking for recommendations on introductory Haskell 
books.  Online or offline.  Any suggestions?


Thanks kindly,
Warren 


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


[Haskell-cafe] Re: ANN: Tutorial on information visualization and visual analytics in Haskell

2008-08-10 Thread Jefferson Heard
As is always the case with anything you release to the public, I've
discovered inconsistencies and typos in the text since I released it.
I've tried to clean up all the typos I could find.  Still working on
the code, but there's a new edition out there on the website.

On Sat, Aug 9, 2008 at 2:30 PM, Jefferson Heard
<[EMAIL PROTECTED]> wrote:
> This is the tutorial I'll be presenting at DEFUN 2008.  I'll be
> building a site around it until then, complete with compilable code
> examples, but I thought I would let everyone get a sneak peek at the
> long version of the tutorial before I'm done with it.  The code is as
> yet untested, and keep in mind, advanced Haskellers, that I'm
> purposefully simplifying some things to be understood by the beginner
> to the intermediate Haskeller.  Comments and questions are welcome and
> encouraged.  Please do ignore typos in the inline code for now,
> though, as I'll be spending this week testing it out and making sure
> everything works.
>
> The link is:
>
> http://bluheron.europa.renci.org/docs/BeautifulCode.pdf
>
> -- Jeff
>



-- 
I try to take things like a crow; war and chaos don't always ruin a
picnic, they just mean you have to be careful what you swallow.

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


Re: [Haskell-cafe] xmonad on the openmoko mobile phone

2008-08-10 Thread Miguel Mitrofanov


On 9 Aug 2008, at 23:43, Don Stewart wrote:


Haskell on the iphone next?


Did that. Hugs compiles well; GHC will probably too, I just didn't  
have time for this. No haskell-specific hacks, only jailbreak.

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


[Haskell-cafe] Last Reminder: The Italian Haskellers Summer Meeting takes place tomorrow at Monterosso, 5 Terre

2008-08-10 Thread Titto Assini
Il titolo dice tutto, maggiori dettagli ad:
http://www.haskell.org/haskellwiki/?title=ItaloHaskell/Summer_2008

A domani,

   titto

-- 
Pasqualino "Titto" Assini, Ph.D.
25 Heath Road - CO79PT
Wivenhoe - Colchester - U.K.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] xmonad on the openmoko mobile phone

2008-08-10 Thread Manuel M T Chakravarty

Don Stewart:


Haskell fans might be impressed by the good work of Joachim Breitner,
who got xmonad running on his openmoko phone,

   
http://www.joachim-breitner.de/blog/archives/300-Xmonad-on-my-mobile-phone.html

You can see a photo here,

   http://galois.com/~dons/images/openmoko-nomeata.jpg


Yay!


Haskell on the iphone next?


The iPhone SDK includes a version of gcc to generate code for the  
iPhone.  Be cool if anybody try to use that with GHC.


Manuel

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