[Haskell-beginners] f . g or f g or f $ g?
Mateusz Kowalczyk
fuuzetsu at fuuzetsu.co.uk
Wed Feb 13 18:50:14 CET 2013
Oops, you're right. Sorry for my oversight.
On 13/02/13 08:12, Ertugrul Söylemez wrote:
> Mateusz Kowalczyk <fuuzetsu at fuuzetsu.co.uk> wrote:
>
>> A less obvious interpretation is to treat ($) as `id'.
>>
>> (f . g) x = f $ g x = f (id g x) = f (g x)
>
> This is not how you get from ($) to id. The correct path is:
>
> f $ x = ($) f x = f x = id f x = f `id` x
>
> This equivalence is indicated by the type of ($). It's a specialized
> instance of a -> a:
>
> ($) :: (a -> b) -> (a -> b)
> ($) f = f
>
> or equivalently:
>
> ($) :: (a -> b) -> a -> b
> ($) f x = f x
>
> or equivalently:
>
> ($) :: (a ~ b -> c) => a -> a
> ($) = id
>
>
> Greets,
> Ertugrul
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
More information about the Beginners
mailing list