Paris [EMAIL PROTECTED]
Date: Jun 21, 2007 6:20 PM
Subject: Re: Type classes vs C++ overloading Re: [Haskell-cafe] Messing
around with types [newbie]
To: Bulat Ziganshin [EMAIL PROTECTED]
On 6/21/07, Bulat Ziganshin [EMAIL PROTECTED] wrote:
Hello Cristiano,
Thursday, June 21, 2007, 4:46:27 PM
On Fri, Jun 22, 2007 at 10:57:58AM +0200, Cristiano Paris wrote:
Quoting Bryan:
*From this you can see that 10 is not necessarily an Int, and 5.0 is
*not necessarily a Double. So the typechecker does not know, given just
10 and 5.0, which instance of 'foo' to use. But when you explicitly
On 6/22/07, Tomasz Zielonka [EMAIL PROTECTED] wrote:
...
The problem is not that it can't tell whether 5.0 and 10 would fit Int
and Double (actually, they do fit), it's that it can't tell if they
won't fit another instance of FooOp.
You expressed the concept in more correct terms but I
Hi,
I'm making my way through Haskell which seems to me one of the languages
with steepest learning curve around.
Now, please consider this snippet:
{-# OPTIONS_GHC -fglasgow-exts #-}
module Main where
class FooOp a b where
foo :: a - b - IO ()
instance FooOp Int Double where
foo x y =
Hello Cristiano,
Thursday, June 21, 2007, 4:46:27 PM, you wrote:
class FooOp a b where
foo :: a - b - IO ()
instance FooOp Int Double where
foo x y = putStrLn $ (show x) ++ Double ++ (show y)
this is rather typical question :) unlike C++ which resolves any
overloading at COMPILE
On 6/21/07, Cristiano Paris [EMAIL PROTECTED] wrote:
Hi,
I'm making my way through Haskell which seems to me one of the languages
with steepest learning curve around.
Now, please consider this snippet:
{-# OPTIONS_GHC -fglasgow-exts #-}
module Main where
class FooOp a b where
foo :: a - b
Bulat Ziganshin wrote:
Hello Cristiano,
Thursday, June 21, 2007, 4:46:27 PM, you wrote:
class FooOp a b where
foo :: a - b - IO ()
instance FooOp Int Double where
foo x y = putStrLn $ (show x) ++ Double ++ (show y)
this is rather typical question :) unlike C++ which resolves any
Hello Dan,
Thursday, June 21, 2007, 7:39:35 PM, you wrote:
class FooOp a b where
foo :: a - b - IO ()
instance FooOp Int Double where
foo x y = putStrLn $ (show x) ++ Double ++ (show y)
this is rather typical question :) unlike C++ which resolves any
overloading at COMPILE
Cristiano Paris wrote:
class FooOp a b where
foo :: a - b - IO ()
instance FooOp Int Double where
foo x y = putStrLn $ (show x) ++ Double ++ (show y)
partialFoo = foo (10::Int)
bar = partialFoo (5.0::Double)
The Haskell type classes system works in an open world assumption:
while the