[Haskell-beginners] Import issue

Brandon Allbery allbery.b at gmail.com
Fri May 8 18:36:53 UTC 2015


On Fri, May 8, 2015 at 2:25 PM, Shishir Srivastava <
shishir.srivastava at gmail.com> wrote:

> I've imported the State monad module and used in the 'pop' function that
> will pop the head out of the list but am getting error in GHCi.
>

You are probably working from outdated documentation of some kind. The
original standalone monads like State from mtl1 were replaced several years
ago with type aliases (in this case `type State s a = StateT s Identity a`)
in mtl2, which means State is no longer a constructor. The `state` function
can be used as a quick replacement for the old `State` constructor for any
purpose other than pattern matching.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150508/914f43d0/attachment.html>


More information about the Beginners mailing list