[Haskell-cafe] Syntax extension - adding import support to let/where bindings

Richard A. O'Keefe ok at cs.otago.ac.nz
Thu Aug 6 23:39:26 UTC 2015

On 5/08/2015, at 10:28 pm, Oliver Charles <ollie at ocharles.org.uk> wrote:
> That's not particularly bad here, the really pain is repeatedly having to do this for every single symbol I'm using. I'd prefer to be able to write
> image = 
>   let css = let import CSS in [ width (px 50) ]
>   in let import HTML in img [ width 50, style css ]

This is very like the 'open' directive in SML.
The SML version would be something like

val image =
    let val css = let open CSS in [width (px 50)] end
     in let open HTML in img [width 50, style css] end

So there's prior art.

More information about the Haskell-Cafe mailing list