[Haskell-beginners] getopt

Gaius Hammond gaius at gaius.org.uk
Thu Aug 5 15:18:16 EDT 2010


Hi all,


I have used GetOpt in Python and Ocaml so I am reasonably familiar  
with it, and I have been studying the technique here:


http://www.haskell.org/haskellwiki/High-level_option_handling_with_GetOpt


Can anyone explain to me what is actually happening here:


     opts <- foldl (>>=) (return startOptions) actions

     let Options { optVerbose = verbose
                 , optInput = input
                 , optOutput = output   } = opts
     input >>= output

I understand the fold is evaluating everything in the actions list  
overlaying them onto the startOptions record, then getting these out  
of IO and into the opts record - but where are "verbose", "input" and  
"output" coming from? Are they just aliases?



Any insight gratefully received :-)



Thanks,




G

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100805/805c4d73/attachment.html


More information about the Beginners mailing list