[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] The mother of all functors/monads/categories
From:       Twan van Laarhoven <twanvl () gmail ! com>
Date:       2010-06-27 23:57:49
Message-ID: 4C27E57D.1090205 () gmail ! com
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic