How to pin dependencies in Haskell apps

cabal, functional-programming, haskell

Solution

Use the `build-depends` field in your `.cabal` file

build-depends:
    cmdargs == 0.10.3

But specifying one exact version is usually not the best idea, so

build-depends:
    cmdargs >= 0.8 && < 0.11

specifies a range of admissible versions.

And, is it ok distribute my package in Hackage?

Not if you know that it won't ever be useful to anyone.

In other words, yes, sure it is okay. You need an account on Hackage for that, and that may take some time to obtain, though.

Problem

I'm writing a todo.sh in Haskell now, to understand better how IO monads work, and I'm going to use cmdArgs to parse input, like argparse do in Python. My question is, how can I pin the dependency of cmdArgs like pip's requirements.txt? ``` Django==1.5.1 South==0.7.6 ``` And, is it ok distribute my package in Hackage?

Original source