io monad binding, coding style

1999-01-16 Thread Greg O'Keefe
The Haskell 98 Report contains the following example, in section 7.2 on page 89: main = readFile "input-file" >>= \ s -> writeFile "output-file" (filter isAscii s) >> putStr "Filtering succesful\n" I am just learning Haskell, and this seemed extre

Re: Ackermann's function

1999-01-16 Thread Wayne Young
From: Theo Norvell <[EMAIL PROTECTED]> >See http://www.engr.mun.ca/~theo/Publications/indExamp.lgs >for three versions. The simplest is just > >> p 0 n = n+1 >> p (m+1) 0 = p m 1 >> p (m+1) (n+1) = p m (p (m+1) n) Thanks! =) Of course it was so simple that I couldn't figure it out.

Re: Ackermann's function

1999-01-16 Thread Theo Norvell
On Thu, 18 Nov 1999, Wayne Young wrote: > I'm still getting the syntax correct (playing with simple functions, > etc) and was wondering how I would define Ackermann's function in > Haskell. See http://www.engr.mun.ca/~theo/Publications/indExamp.lgs for three versions. The simplest is just >

Ackermann's function

1999-01-16 Thread Wayne Young
Greets, Sorry to intrude (new to both the list and to Haskell). I'm still getting the syntax correct (playing with simple functions, etc) and was wondering how I would define Ackermann's function in Haskell. I'm curious to see how Haskell (using Hugs) will outperform C and Pascal for th

Re: Partial Type Declarations

1999-01-16 Thread Wolfram Kahl
Jeffrey R. Lewis" <[EMAIL PROTECTED]> wrote: > > Anyway, the only thing missing now in the above proposal > is a similar flexibility with contexts. > Say, you want `b' to be a bound, and thus use :<=, > but you want the context to be exact > (i.e. you don't want extra context elements to be

Re: Partial Type Declarations

1999-01-16 Thread Wolfram Kahl
Starting from Jeffrey R. Lewis' <[EMAIL PROTECTED]> wish to let partial type declarations express binding of SOME type variables > > foo :: C a => a -> _b and modulating the syntax proposed by Claus Reinke <[EMAIL PROTECTED]>, > > foo :<= C a => a -> b I suggested the following notat

Re: Partial Type Declarations

1999-01-16 Thread Alex Ferguson
Patrik Jansson: > I like ? better than .., but maybe the Haskell "don't care"-symbol _ > could be even more suggesting: > > q :: a -> _ -> c > qa_ = c > > Syntactically this is closer to what is currently allowed as type > variables and it would easily (in the sense that such a pro

Re: Partial Type Declarations

1999-01-16 Thread Jeffrey R. Lewis
Wolfram Kahl wrote: > Jeffrey R. Lewis" <[EMAIL PROTECTED]> writes: > > > > foo :<= C a => a -> b roughly equiv to foo :: C _a => _a -> _b > > > > I can easily imagine that you might want some variables to be a bound, and > > others to be exact, as in > > > > foo :: C a =>

Re: Partial Type Declarations

1999-01-16 Thread Wolfram Kahl
To my last message: > Jeffrey R. Lewis" <[EMAIL PROTECTED]> writes: > > > > foo :<= C a => a -> b roughly equiv to foo :: C _a => _a -> _b > > > > I can easily imagine that you might want some variables to be a bound, and > > others to be exact, as in > > > > foo

Re: Partial Type Declarations

1999-01-16 Thread Wolfram Kahl
Jeffrey R. Lewis" <[EMAIL PROTECTED]> writes: > > foo :<= C a => a -> b roughly equiv to foo :: C _a => _a -> _b > > I can easily imagine that you might want some variables to be a bound, and > others to be exact, as in > > foo :: C a => a -> _b > > I don't think the

Re: Partial Type Declarations

1999-01-16 Thread Jeffrey R. Lewis
Claus Reinke wrote: > > what I wanted to write was > a partial specification, which I would want to write as > > foo :<= C a => a -> b > > Read e :<= t as "the type of e should be bounded by t". Choose a better > symbol if you like -- the idea is to keep the syntax of types unchanged, > and to

Re: Partial Type Declarations

1999-01-16 Thread Claus Reinke
>Koen Claessen wrote: >> We should allow "partial type specification". The programmer is >> allowed to specify as much information about the type as (s)he wants. >> >> The partial type specification would be taken as a "skeleton", >> merely filled in by the type inference algorithm. >> foo ::

Re: Partial Type Declarations

1999-01-16 Thread Patrik Jansson
On Wed, 17 Nov 1999, Koen Claessen wrote: > foo :: (..) => a -> b -> c This is certainly something I've been bitten by. I like ? better than .., but maybe the Haskell "don't care"-symbol _ could be even more suggesting: q :: a -> _ -> c qa_ = c Syntactically this is closer to w