[Haskell-cafe] Deepest polymorphic functor
Eduard Sergeev
Eduard.Sergeev at gmail.com
Thu Jul 30 18:16:30 EDT 2009
PS In regards to the original
http://okmij.org/ftp/Haskell/deepest-functor.lhs
Am I right that the following code from the sample:
class IsCollection t coll | t -> coll
instance IsCollection (m a) (m ())
instance TypeCast Atom coll => IsCollection t coll
class TypeCast a b | a -> b, b->a where typeCast :: a -> b
class TypeCast' t a b | t a -> b, t b -> a where typeCast' :: t->a->b
class TypeCast'' t a b | t a -> b, t b -> a where typeCast'' :: t->a->b
instance TypeCast' () a b => TypeCast a b where typeCast x = typeCast' () x
instance TypeCast'' t a b => TypeCast' t a b where typeCast' = typeCast''
instance TypeCast'' () a a where typeCast'' _ x = x
may now be reduced to:
class IsCollection t coll | t -> coll
instance IsCollection (m a) (m ())
instance (Atom ~ coll) => IsCollection t coll
?
--
View this message in context: http://www.nabble.com/Deepest-polymorphic-functor-tp24709303p24748240.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list