[Haskell-cafe] Why Kleisli composition is not in the Monad signature?

Jake McArthur jake.mcarthur at gmail.com
Mon Oct 15 17:39:20 CEST 2012


On Mon, Oct 15, 2012 at 11:33 AM, Jake McArthur <jake.mcarthur at gmail.com> wrote:
> On Mon, Oct 15, 2012 at 7:59 AM, Ertugrul Söylemez <es at ertes.de> wrote:
>> Try to express
>>
>>     do x <- getLine
>>        y <- getLine
>>        print (x, y)
>>
>> using only Kleisli composition (without cheating).

My previous answer didn't do the Kleisli style much justice. It could
look a bit nicer with more Arrow-style combinators:

    f &=& g = runKleisli $ Kleisli f &&& Kleisli g

    print <=< const getLine &=& const getLine $ ()



More information about the Haskell-Cafe mailing list