Quoting Victor Gorokgov <m...@rkit.pp.ru>:

02.10.2011 19:55, David Barbour пишет:
Use TypeFamilies.


{-# LANGUAGE TypeFamilies #}
...
type family FType a :: *
type instance FType Char = Float
type instance FType Double = Int

class ExampleClass a where
f :: a -> FType a


Better to include type in class.

class ExampleClass a where
type FType a
f :: a -> FType a

instance ExampleClass Char where
type FType Char = Float
f char = ...

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

I guess this is what I want, thank you all. Although I still wonder why something so simple in C++ is actually more verbose and requires less known features in Haskell...What was the design intent to disallow simple overloading?


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to