RE: Monads in plain english (Was: Re: Licenses and Libraries)

1999-09-01 Thread Nick Kallen
> a <- b >c <- f a > > as > > c <- f b > > In Haskell I can't. Why? b is of type IO something, whereas f expects a > non-monadic argument. I don't see why this is any different from say, Pascal, where you can't: Writeln(Readln(a)); This distinction is made clear if the

RE: Still confused (was: Re: Type casting??)

1999-03-12 Thread Nick Kallen
> 2. I tried playing around with the foo function I was working with >last time, and am getting a different error now: >foo :: Int -> [Char] >foo 0 = [] >foo x = ['1'] ++ foo(x div 10) You should have typed "9 div 3" at the listener and you'd have figured out your error. No infix

RE: Haskell 2 -- Dependent types?

1999-02-25 Thread Nick Kallen
> > > 2) Yes, I agree that the possibility that user-supplied type > > > declarations can change the meaning of the program is a strike against > > > the idea. > > I don't find that so strange. If there are no principal types > > (which we can't hope for), then user added signatures can > > have

RE: Haskell 2 -- Dependent types?

1999-02-25 Thread Nick Kallen
> I don't understand. What behaviour is different here? > > Certainly the type is different. But how is the behaviour different? It behaves differently in that it accepts and returns more/less values. If this function is part of a program, then the behavior of the program is now different in th

RE: Haskell 2 -- Dependent types?

1999-02-25 Thread Nick Kallen
> > > If this is true, then what I'm doing is horrible. But I don't > see how this > > > leads to nondeterminism or broken referential transparency. > min2 returns the > > > same value for the same list, but it's simply more efficient > if we happen to > > > know some more information about the li

RE: Haskell 2 -- Dependent types?

1999-02-25 Thread Nick Kallen
> On 24-Feb-1999, Carl R. Witty <[EMAIL PROTECTED]> wrote: > > Fergus Henderson <[EMAIL PROTECTED]> writes: > > > What if the body of min2 were defined so that it returned > > > something different in the two cases? Your code has no proof that the > > > code for the two cases is equivalent. If i

RE: Haskell 2 -- Dependent types?

1999-02-25 Thread Nick Kallen
> Watch out here; there may be a limit to how much run-time type > inspection it is reasonable to do in the presence of dependent types. > Suppose you're examining a type which happens to be the type of some > sorting function: > (Ord a) => (l :: [a]) -> ((l' :: [a]), sorted l l') > How much typ

RE: Haskell 2 -- Dependent types?

1999-02-22 Thread Nick Kallen
> > min2 :: [a] -> a > > min2 ((l:ls) :: [a] <= Sorted) = l > > min2 l = min l > > What's the semantics of that supposed to be? > If the list is not known to be definitely sorted, > will it check sortedness at runtime? No. > If not, then the semantics could be nondeterministic, > in general, so

RE: Haskell-2

1999-02-22 Thread Nick Kallen
What is the general consensus on views and the extended pattern guards that are discussed at http://www.haskell.org/development/ ? I think views are really neat, but am not quite sure how I feel about pattern guards.

RE: Haskell 2 -- Dependent types?

1999-02-22 Thread Nick Kallen
> > apply :: (F a *) [a] -> (F a *) > > apply f [] = a > > apply f [a:as] = apply (f a) as > > > > The type gets noisier. > > (To correct a couple of minor typos, that should be > apply f [] = f > apply f (a:as) = apply (f a) as > ) Heh, thank you. :) > I agree it is in some sense si

RE: Haskell 2 -- Dependent types?

1999-02-22 Thread Nick Kallen
> If you return the same proof of correctness that you used > for the earlier definition of sort, then no it won't type check. > But if you return a proof defined as e.g. > > proof = proof > > then if I understand things correctly it will type check. On that note, since this has been of i

RE: Haskell 2 -- Dependent types?

1999-02-20 Thread Nick Kallen
> If your language supports optional dynamic type checking, as it should, > then expressing functions like apply shouldn't be too hard. Here's a dynamic apply in a pseudo Clean 2.0 syntax: apply :: Dynamic [a] -> a apply (f :: a -> b) (arg:args) = apply (dynamic (f arg) :: b) args apply (f :: a)

RE: Haskell 2 -- Dependent types?

1999-02-20 Thread Nick Kallen
> > I wanted to express the type as something like: > > > > > apply :: (a -> a -> ... -> a) [a] -> a > No, that's not what you want. :-) You want > apply :: (a -> a -> ... -> b) [a] -> b > I think the distinction is important (see below). > > > > F a * = member (map (F a) [0..]) // member [a] a

RE: Do Existential Types make Algebraic Types obsolete? (was Re: how toexploit existential types)

1999-02-20 Thread Nick Kallen
> On a related note, can anyone point out a good document that lists the > difference between universal quantification, existential quantification, > and "normal" quantification. I assume that normal quantification /is/ > universal quantification, but why would someone desire to be explicit? > Und

RE: Haskell 2 -- Dependent types?

1999-02-19 Thread Nick Kallen
> I'm curious: how many people have actually written a program in > Cayenne? How many people have written programs that made significant > use of the dependent typing? Has anybody tried to teach a programming > class using Cayenne? I'll admit to not having yet written something in Cayenne, but

Re: Haskell-2

1999-02-19 Thread Nick Kallen
> > My biggest wishes for Haskell-2 are existential types > > and the TREX extensible record system from Hugs 1.3. > > I've found these two extensions *extremely* handy. > > I agree; Haskell 2 should have existential (and universal) types. I > also think it should have both extensible records and