
#14812: Dot-Notation for Function Application -------------------------------------+------------------------------------- Reporter: tepan | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Please allow to put a dot `.` (without spaces) between two things for ''flipped'' function application. This could make for code in pseudo-OOP style: {{{#!hs encrypt(str) = do { str.map(succ); } }}} Currently, as a workaround, this can be achieved by defining `(.) = flip ($)` (making `.` for function composition unavailable, though): {{{#!hs encrypt(str) = do { str.map(succ); } where (.) = flip ($) }}} (For a remotely similar look-and-feel, one could use `Data.Function.((&))` instead of `(.)`.) Please note that `.` without spaces is already an OOP-like notational convenience in order to denote Modules and their elements. {{{#!hs x = do { Prelude.length("Hello World!"); } }}} This means, that a distinction between ` . ` (with spaces) and `.` (without spaces) is already been made, which is why `Just . Just $ 42` compiles, wheras `Just.Just $ 42` doesn't. Analogously, with this Feature Request implemented, `"Hello".map(succ)` would compile whereas `"Hello" . map(succ)"` wouldn't. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14812 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler