[Haskell-cafe] Confused about missing data constructor

Bas van Dijk v.dijk.bas at gmail.com
Wed Nov 24 14:18:46 EST 2010


On Wed, Nov 24, 2010 at 7:08 PM, Antoine Latter <aslatter at gmail.com> wrote:
> I meant that 'pop' and 'push' should have been written with 'modify', 'get',
> and 'set' instead of the raw constructor, not as a drop-in replacement.

Indeed, you can also use the 'state' function instead of the 'State'
constructor in your definition of 'pop'.

'state' and the other "constructor functions" like 'reader' and
'writer' were introduced in mtl-2 to make the transition from mtl-1
easier.

Regards,

Bas


More information about the Haskell-Cafe mailing list