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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to