On Wed, May 7, 2014 at 2:41 PM, Tom Ellis <tom-lists-haskell-cafe-2013@jaguarpaw.co.uk> wrote:
On Wed, May 07, 2014 at 02:10:42PM +0300, Michael Snoyman wrote:
> > > Btw, as I can't think of an example right now, what would be an example
> > > for code that works with transformers-0.4.0.0 but wouldn't compile
> > > anymore with transformers-0.4.1.0?
> >
> > Surely just the reverse of the breaking change?
> >
> >
> > https://github.com/ibotty/streaming-commons/commit/b1137852e4f58520ad65d01b20623a968c18ae8f
> >
>
> No, that code is compatible with transformers 0.3, 0.4, and 0.4.1. With the
> syntax:
>
>     import Data.Functor.Constant (Constant (Constant), getConstant)
>
> We're importing the data type Constrant, the data construct Constant for
> that data type, and the function getConstant. It doesn't matter if
> getConstant is a normal function or a field accessor, it can still be
> accessed by that syntax.

Then I don't understand why field accessors are even *allowed* to be
imported beneath the type.  Surely that's only necessary to disambiguate
constructors from types?


In the case here, the syntax:

    import Control.Monad.Trans.Reader (ReaderT (..))

is very convenient. But it's true that you don't really gain much from the distinction between these two:

    import Control.Monad.Trans.Reader (ReaderT (ReaderT, runReaderT))
    import Control.Monad.Trans.Reader (ReaderT (ReaderT), runReaderT)

Perhaps the latter should be considered a better approach, since it's more resilient to changes in datatypes.

Michael