Hacker News new | ask | show | jobs
by fnordsensei 3462 days ago
I would probably use threading to achieve comparable readability.

  (def sazerac 
    (-> (mix :ice :whiskey :bitters :absinthe)
        shake
        strain
        garnish))

  (drink :me sazerac)
I never had a Sazerac. It sounds like a nice drink.
1 comments

I would create a Cocktail data structure and an instance of Monad for it.

    sazerac = do
        add ice
        add ryeWhisky
        add bitters
        add absinthe
        shake
        strainInto glass
        add lemonGarnish

    main = serve $ makeCocktail sazerac
Haskell really is a pretty nice imperative language sometimes.