[Haskell-cafe] Function application layout
Jonas Almström Duregård
jonas.duregard at chalmers.se
Thu May 26 17:22:10 CEST 2011
That's a useful operator! Unfortunately it does not play nice with $. Of
less importance: some syntactic constructs can not appear in the arguments
without parenthesis, let bindings for instance (although lambda abstraction
works parenthesis-free).
Also I'm not sure this can be used for defining trees or nested function
application since a nesting of the operator inevitably require parenthesis.
/J
On 26 May 2011 14:52, Daniel Fischer <daniel.is.fischer at googlemail.com>wrote:
> On Thursday 26 May 2011 14:35:41, Neil Brown wrote:
> > foo is the function we want to apply, and eg shows how to apply it in
> > do-notation with an argument on each line. I couldn't manage to remove
> > the r$ at the beginning of each line, which rather ruins the whole
> > scheme :-( On the plus side, there's no brackets, it's only two extra
> > characters per line, and you can have whatever you like after the r$.
>
> Wouldn't that be also achievable with
>
> infixl 0 ?
>
> (?) :: (a -> b) -> a -> b
> f ? x = f x
>
> eg = foo
> ? 2 + 1
> ? 'c'
> ? "hello" ++ "goodbye"
> ? 3.0
>
> ?
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110526/ce7a1921/attachment.htm>
More information about the Haskell-Cafe
mailing list