
On Wed, May 7, 2014 at 4:31 PM, Henning Thielemann < schlepptop@henning-thielemann.de> wrote:
Am 07.05.2014 13:43, schrieb Michael Snoyman:
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.
However, even if imported in the second way, runReaderT identifier can be used in record field update syntax. I guess it would be more consistent to allow only the use as a function when imported like an ordinary function.
If you think *that's* bad, you'll love this: module Person ( Person , name , age , defaultPerson ) where data Person = Person { name :: String, age :: Int} deriving Show defaultPerson = Person "Alice" 25 ---- module Main where import Person main = print defaultPerson { name = "Bob", age = 30 } ---- (Yes, I've been known to abuse this in my libraries, and in 20/20 hindsight, I wish I hadn't.) Michael