
22 Jan
2013
22 Jan
'13
3:51 a.m.
On Tue, Jan 22, 2013 at 7:41 AM, wren ng thornton
On 1/21/13 1:40 AM, Shachaf Ben-Kiki wrote:
For example:
{-# LANGUAGE TypeFamilies #-} import Unsafe.Coerce
newtype Id a = MkId { unId :: a }
{-# RULES "fmap unId" fmap unId = unsafeCoerce #-}
data family Foo x y a data instance Foo x y (Id a) = FooI x data instance Foo x y Bool = FooB { unB :: y }
instance Functor (Foo x y) where fmap = undefined
You can define instances for type functions? Eek!
Only for data families / instances. -- Your ship was destroyed in a monadic eruption.