Skip to content

Instantly share code, notes, and snippets.

@tene
Created December 7, 2017 16:20
Show Gist options
  • Save tene/f73df7979a0bc7a87a4807cc784a3fa6 to your computer and use it in GitHub Desktop.
Save tene/f73df7979a0bc7a87a4807cc784a3fa6 to your computer and use it in GitHub Desktop.
[tene@vrici ~]$ ghci
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Prelude> :t foldl
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
Prelude> let x = [(+2),(+3),(+4)]
Prelude> :t x
x :: Num a => [a -> a]
Prelude> :t ($)
($) :: (a -> b) -> a -> b
Prelude> :t flip ($)
flip ($) :: a -> (a -> c) -> c
Prelude> :t foldl (flip ($))
foldl (flip ($)) :: Foldable t => a -> t (a -> a) -> a
Prelude> :t foldl (flip ($)) 0 x
foldl (flip ($)) 0 x :: Num a => a
Prelude> foldl (flip ($)) 0 x
9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment