haskell getArgs

haskell

Solution

`getArgs` is an `IO` action which produces a list of `String`

fmap someFunction $ readFile =<< fmap head getArgs

or in Applicative style:

someFunction <$> readFile =<< head <$> getArgs

Problem

How does getArgs work, I am trying to read in a text file from the terminal which then sends the contents to one of my defined functions. Can someone post an example code to give me an idea of how it works. Thanks.

Original source