Skip to content

Instantly share code, notes, and snippets.

@puffnfresh
Created March 7, 2014 23:32
Show Gist options
  • Save puffnfresh/9422419 to your computer and use it in GitHub Desktop.
Save puffnfresh/9422419 to your computer and use it in GitHub Desktop.
plusOne :: (Int -> Int) -> (Int -> Int)
plusOne = (. (+1))
timesTwo :: (Int -> Int) -> (Int -> Int)
timesTwo = (. (*2))
infixl 8 &
(&) :: a -> ((a -> a) -> (a -> a)) -> a
(&) = flip ($ id)
main :: IO ()
main = print $ 10 & plusOne . timesTwo
-- 22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment