[Haskell-cafe] Re: Sugar for function application

Heinrich Apfelmus apfelmus at quantentunnel.de
Thu Mar 25 04:26:46 EDT 2010


Tillmann Rendel wrote:
> I like this idea, because it would enable non-monadic embedded DSLs to
> use layout.
> 
> For example, consider setting properties in wxHaskell:
> 
>   layoutSet myButton $$
>     text := "Ok"
>     on action := doSomething

You can abuse  do  notation to achieve that, by wrapping the list in a
suitable  Writer  monad

    layoutSet myButton $ do
        text &= "Ok"
        on action &= doSomething

with

   (&=) :: Property a -> a -> Writer Properties ()

It's ugly semantically but pleasant syntactically.


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



More information about the Haskell-Cafe mailing list