[Haskell-cafe] The mother of all functors/monads/categories
Twan van Laarhoven
twanvl at gmail.com
Sun Jun 27 19:57:49 EDT 2010
Max Bolingbroke wrote:
> I don't actually know what the right name for this data type is, I
> just invented it and it seems to work:
>
>> -- (>>>) :: forall a b. t a b -> (forall c. t b c -> t a c)
>> newtype Wotsit t a b = Wotsit { runWotsit :: forall c. t b c -> t a c }
There is of course no reason to prefer (>>>) to (<<<), so you can instead
quantify over the first argument as opposed to second one:
newtype Wotsit' t a b = Wotsit' { runWotsit' :: forall c. t c a -> t c b }
liftWotsit' :: Category t => t a b -> Wotsit' t a b
liftWotsit' t = Wotsit' ((<<<) t)
lowerWotsit' :: Category t => Wotsit' t a b -> t a b
lowerWotsit' t = runWotsit' t id
instance Category (Wotsit' t) where
id = Wotsit' id
t1 . t2 = Wotsit' (runWotsit' t1 . runWotsit' t2)
Twan
More information about the Haskell-Cafe
mailing list