[Haskell] (.) . (.)

Lennart Augustsson lennart at augustsson.net
Sun May 28 16:17:49 EDT 2006


Why not ask the computer?

	-- Lennart

bamse% ghci
    ___         ___ _
   / _ \ /\  /\/ __(_)
  / /_\// /_/ / /  | |      GHC Interactive, version 6.4.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.
Prelude> :t (.) . (.)
(.) . (.) :: (b -> c) -> (a -> a1 -> b) -> a -> a1 -> c
Prelude> Leaving GHCi.
bamse% djinn
Welcome to Djinn version 2005-12-12.
Type :h to get help.
Djinn> f ? (b -> c) -> (a -> a1 -> b) -> a -> a1 -> c
f :: (b -> c) -> (a -> a1 -> b) -> a -> a1 -> c
f x1 x2 x3 x4 = x1 (x2 x3 x4)
Djinn> :q
Bye.


Brian Hulley wrote:
> Taral wrote:
>> On 5/28/06, Dominic Steinitz <dominic.steinitz at blueyonder.co.uk>
>> wrote:
>>> Is this defined in some library? Thanks, Dominic.
>>
>> Don't think so. I use:
>>
>> \a b -> f (g a b)
> 
> I don't see how (.) . (.) translates into something so simple.
> Using c for (.) to make things easier to write, I get:
> 
> (.) . (.)
> === c c c
> === \x -> (c c c x)
> === \x -> (c (c x))
> === \x -> (\y z -> c (c x) y z)
> === \x -> (\y z -> (c x) (y z))
> === \x -> (\y z -> (\p q -> c x q p) (y z))
> === \x -> (\y z -> (\p q -> x (q p) (y z))
> === \x -> (\y z -> (\q -> x (q (y z))))
> 
> === \x y z q -> x (q (y z))
> 
> Have I made an error somewhere above?
> 
> Thanks, Brian.



More information about the Haskell mailing list