[Haskell-cafe] Point-free style
GK at ninebynine.org
Tue Feb 15 04:37:14 EST 2005
At 09:00 11/02/05 +0100, Ketil Malde wrote:
>Matthew Roberts <mattr at ics.mq.edu.au> writes:
> >> [Point-free] compositions of functions with arity greater than 1,
> >> [...] compositions of sections of composition or application,
> >> arrow notation without the sugar, and so forth---will always be more
> >> difficult to read and understand than the direct version.
> > I have to agree (although I suspect few others will :))
>I tend to agree, also. Type signatures help, of course. E.g. with
>the previously mentioned and rather cryptic function
> (.) . (.) .(.)
>I entered it into GHCi, and got
> :: forall a a b c a.
> (b -> c) -> (a -> a -> a -> b) -> a -> a -> a -> c
>and it suddenly is much clearer what it does.
Hmm... noting the discrepancy with HUGS mentioned later in this thread, I
entered this into GHCi and got this:
Prelude> :t (.) . (.) . (.)
(.) . (.) . (.) :: forall a a1 b c a2.
(b -> c) -> (a -> a1 -> a2 -> b) -> a -> a1 -> a2 -> c
I think you maybe dropped the digits in the type variable names?
More information about the Haskell-Cafe