com-1.2.3 の System.Win32.Com に (#)と(##) が定義されていた。
Com.hs
infixl 1 # infixl 0 ## --Operators to provide OO-looking invocation of interface methods, e.g., -- -- ip # meth1 args -- | The @#@ operator permits /OO-style/ method application with @do@ syntax: -- -- @ -- obj # method arg1 arg2 -- @ -- -- is equivalent to @method arg1 arg2 obj@, so this assumes that the COM method -- wrappers takes the /this/ pointer as the last argument. Which the /HDirect/ -- generated wrappers do and the various base method provided by this COM+Automation library. ( # ) :: a -> (a -> IO b) -> IO b obj # method = method obj -- | A variation on @(#)@ where the /this/ pointer is an action returning an object reference -- rather than the reference itself. Sometimes useful when you create one-off objects -- and call methods on them: -- -- @ -- (createObject arg1) ## startUp arg2 -- @ -- -- instead of the wieldier, -- -- @ -- obj <- createObject arg1 -- obj # startUp arg2 or createObject arg1 >>= (startUp arg2) -- @ -- ( ## ) :: IO a -> (a -> IO b) -> IO b mObj ## method = mObj >>= method
ちょっとやってみる。
Prelude> let obj # method = method obj Prelude> :t (#) (#) :: t -> (t -> t1) -> t1 Prelude> length [1,2,3] 3 Prelude> [1,2,3]#length 3