[Haskell-cafe] Re: Status of TypeDirectedNameResolution proposal?

Stefan Monnier monnier at iro.umontreal.ca
Fri Nov 20 10:08:45 EST 2009


> You know, another solution to the records problem, which is not quite
> as convenient but much simpler (and has other applications) is to
> allow local modules.

> module Foo where
>   module Bar where
>     data Bar = Bar { x :: Int, y :: Int }
>   module Baz where
>     data Baz = Baz { x :: Int, y :: Int }

>   f a b = Bar.x a + Baz.y b

For someone coming from an SML background, that makes a lot of sense.
You could also add an "automatic lightweight module", like Agda does,
where

  data Baz = Node { x :: Int, y :: Int }

implicitly defines a local module Baz with record selection functions
Baz.x and Baz.y and even a Baz.Node constructor.


        Stefan



More information about the Haskell-Cafe mailing list