[Haskell-cafe] Defining new operators

Albert Y. C. Lai trebla at vex.net
Fri Aug 10 17:02:37 EDT 2007


rodrigo.bonifacio wrote:
>> owner :: Step -> Scenario
>> owner (Step id scenario action state response) = scenario
> 
> Is it possible to define the owner function in such way that I can write x.owner (returning the scenario related with the Step x)?

The . is already taken. Choose some other symbol, say &

x & f = f x

Now you can use x&owner.

P.S. What's wrong with plain and simple "owner x"?


More information about the Haskell-Cafe mailing list