Reading strings from stdin or argument in Haskell CLI

172 Views Asked by At

I'm trying to build a Haskell CLI that can either read in strings from stdin or from arguments like so:

cat colors-multi-line | colorshift -d 10

colorshift -d 10 "#FFFFFF"

How would I accomplish this?

1

There are 1 best solutions below

0
bergey On

There are several libraries to handle CLI argument parsing. optparse-applicative is the one with which I'm most familiar. getLine and getContents in Preluderead from STDIN.