[Haskell-cafe] Unary functions and infix notation

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Sep 6 17:46:54 CEST 2013


On Fri, Sep 06, 2013 at 05:04:12PM +0200, Johannes Emerich wrote:
> Weirdly, however, infix notation can also be used for unary functions with
> polymorphic types, as the following ghci session shows:
> 
>    Prelude> :t (`id` 1)
>    (`id` 1) :: Num a => (a -> t) -> t
>    Prelude> (`id` 1) (\y -> show y ++ ".what")
>    "1.what"

There's nothing special about infix notation here:

    Prelude> :t \x -> id x 1
    \x -> id x 1 :: Num a => (a -> t) -> t
    Prelude> (\x -> id x 1) (\y -> show y ++ ".what")
    "1.what"

Tom




More information about the Haskell-Cafe mailing list