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

Reply via email to