Josef Svenningsson | 29 Oct 2003 11:48
Picon
Picon

Re: fixed point

On Tue, 28 Oct 2003, Ross Paterson wrote:

> On Tue, Oct 28, 2003 at 11:56:21AM +0100, Josef Svenningsson wrote:
> > On Mon, 27 Oct 2003, Josef Svenningsson wrote:
> > > This is a very nice technique. As an exercise to the reader I suggest the
> > > following program:
> > >
> > > \being{code}
> > > data Tree a = Branch a (Tree (a,a)) | Leaf
> > >
> > > cross f (a,b) = (f a,f b)
> > >
> > > main1 =
> > >   let mapTree :: (a -> b) -> Tree a -> Tree b
> > >       mapTree = \f tree -> case tree of
> > >                             Branch a t -> Branch (f a) (mapTree (cross f) t)
> > >                             Leaf -> Leaf
> > >   in mapTree id (Branch 42 Leaf)
> > > \end{code}
> > >
> > I realise I was perhaps a bit dense in my previous mail. It was not my
> > intention to try to sound smart. Sorry for that.
> >
> > Does anyone know how to apply the transformation suggested by Paul Hudak
> > to my program and make it typecheck? Does there exist a type system where
> > the transformed program typechecks? I suppose so but I don't quite know
> > what it would look like.
>
> Polymorphic recursion implies a fix with a rank 3 type.  GHC can handle
> those, but each one needs its own declaration, as in
(Continue reading)

Hal Daume III | 29 Oct 2003 17:04
Picon
Favicon

Re: Haskell Asignement not working

This looks like a syntax error to me.

On Tue, 28 Oct 2003, Rachel Reid wrote:

> bLine n )

What is the close parenthesis for (or is this a character encoding 
issue?)?  Definitely shouldn't be there...I'm guessing it should be 
something like 'k' or the like.

>  |n==0     = )

Same comment.

>  |n>0         = `sideBySide` sb (bLine (n-1))

The `foo` notation is used to make a function (in your case sideBySide) 
into an infix function, so you can write "x `foo` y".  but in your case 
you're not using it infix, so you don't want the ``s.

HTH,

 - Hal

--

-- 
 Hal Daume III                                   | hdaume <at> isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume
Markus.Schnell | 29 Oct 2003 17:43

Heap profiling in GHC broken?

Hi.
When I tried to profile my program in search for space leaks,
it core dumped on me (actually on Win2000/Cygwin). I'm using ghc 6.0.1. 
Does anybody know what could be the problem?

(To be more precise: any +RTS -h_ options make problems, +RTS -p works fine.
 I get a message meaning the equivalent of "statement in '0x0058db43' points

 to memory in '0xfffffffc'. Could not read.")

Cheers,
Markus

--
Markus Schnell

Gmane