[Haskell-beginners] IO / State / Do Syntax
Alexander Bernauer
alex-haskell at copton.net
Mon Aug 27 13:49:35 CEST 2012
Hi
you don't need the State monad for your problem. Standard functional
composition is enough:
---8<---
initResources =
let
images = ["someimage.png", "someimage2.png"]
keywords = ["pic1keyword", "pic2keyword"]
in do
pics <- mapM loadImage images
let rt = foldr go emptyResourceTracker $ zip pics keywords
-- use rt
where
go (pic, kw) rt = storeImage rt kw pic
--->8---
Anyways, if you are interested in Monad transformers in general, go
check out http://book.realworldhaskell.org/read/monad-transformers.html
HTH
Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120827/c5f15557/attachment.pgp>
More information about the Beginners
mailing list