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
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
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] -
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
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
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
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