Re[2]: Java-like

2006-02-08 Thread Bulat Ziganshin
Hello Ian, Wednesday, February 08, 2006, 9:28:51 PM, you wrote: >> nonrecursive let in Haskell so that I could write let x = ...x... in ..., IL> I would argue that the language should discourage variable shadowing, so IL> that shadow warnings can be used to find bugs. i use such shadowing to chan

Re: Java-like

2006-02-08 Thread Ian Lynagh
On Wed, Feb 08, 2006 at 06:01:15PM +, Ben Rudiak-Gould wrote: > > Well, I took it as a stripped-down example. I've often wished for a > nonrecursive let in Haskell so that I could write let x = ...x... in ..., > and restricting x's interface would be similarly useful. But you could > argue

Re: Java-like

2006-02-08 Thread Ben Rudiak-Gould
Marcin 'Qrczak' Kowalczyk wrote: Ben Rudiak-Gould <[EMAIL PROTECTED]> writes: Parametricity, what else? But he is writing the function inline. Well, I took it as a stripped-down example. I've often wished for a nonrecursive let in Haskell so that I could write let x = ...x... in ..., and re

Re: Java-like

2006-02-08 Thread Marcin 'Qrczak' Kowalczyk
Ben Rudiak-Gould <[EMAIL PROTECTED]> writes: >>> that i want to say is what the first variant allows to define type of >>> 'x' in such way that the only Show-specific operations are allowed, >> Why? > > Parametricity, what else? I'd much rather pass my precious String to a > function of type [a] -

Re: Java-like

2006-02-08 Thread Ben Rudiak-Gould
Bulat Ziganshin wrote: main = do return "xx" >>= ((\x -> print x) :: Show a => a -> IO ()) main2 = do return "xx" >>= (\(x:: (forall a . (Show a) => a)) -> print x) main3 = do (x :: forall a . Show a => a) <- return "xx" print x the second and third variant should do the same, to my

Re: Java-like

2006-02-08 Thread Ben Rudiak-Gould
Marcin 'Qrczak' Kowalczyk wrote: Bulat Ziganshin <[EMAIL PROTECTED]> writes: that i want to say is what the first variant allows to define type of 'x' in such way that the only Show-specific operations are allowed, Why? Parametricity, what else? I'd much rather pass my precious String to a

Re: Java-like

2006-02-08 Thread Marcin 'Qrczak' Kowalczyk
Bulat Ziganshin <[EMAIL PROTECTED]> writes: > that i want to say is what the first variant allows to define type of > 'x' in such way that the only Show-specific operations are allowed, Why? A class is not a type. Haskell has no non-trivial subtyping. If it's always a string, then it can be treat

Re[2]: Java-like

2006-02-07 Thread Bulat Ziganshin
Hello Ben, Tuesday, February 07, 2006, 11:21:56 PM, you wrote: >> {-# OPTIONS_GHC -fglasgow-exts #-} >> main = do return "xx" >>= ((\x -> print x) :: Show a => a -> IO ()) >> main2 = do return "xx" >>= (\(x:: (forall a . (Show a) => a)) -> print x) >> main3 = do (x :: forall a . Show a => a) <- r

Re: Java-like

2006-02-07 Thread Ben Rudiak-Gould
Bulat Ziganshin wrote: {-# OPTIONS_GHC -fglasgow-exts #-} main = do return "xx" >>= ((\x -> print x) :: Show a => a -> IO ()) main2 = do return "xx" >>= (\(x:: (forall a . (Show a) => a)) -> print x) main3 = do (x :: forall a . Show a => a) <- return "xx" print x in this module, only

Java-like

2006-02-07 Thread Bulat Ziganshin
Hello haskell-prime, about limiting variable usage inside a function to some interface - it is possible, although is not pleasant :) {-# OPTIONS_GHC -fglasgow-exts #-} main = do return "xx" >>= ((\x -> print x) :: Show a => a -> IO ()) main2 = do return "xx" >>= (\(x:: (forall a . (Show a) => a)