Skip to content

Instantly share code, notes, and snippets.

@danidiaz
Last active December 29, 2015 04:29
Show Gist options
  • Select an option

  • Save danidiaz/7614715 to your computer and use it in GitHub Desktop.

Select an option

Save danidiaz/7614715 to your computer and use it in GitHub Desktop.
Composing with applicatives
import Data.Functor.Compose
import Control.Lens
foo = getCompose $ (*3) <$> Compose (pure succ) :: IO (Int -> Int)
-- return 5 <**> foo
-- 18
fim = (. (*3)) <$> pure succ :: IO (Int -> Int)
--return 5 <**> fim
--16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment