[Haskell-beginners] cabal: library and executable

emacstheviking objitsu at gmail.com
Thu May 9 17:38:15 CEST 2013


Harry,

Here is a complete cabal file for something I am working on now... it
contains some libraries and three executables that use the library. It's a
WIP for me BUt it works and I can even use it from Leksah by creating a
workspace and adding this hexwax.cabal file as a Package.

It's long but concise!

----
-- Initial hexwax.cabal generated by cabal init.  For further
-- documentation, see http://haskell.org/cabal/users-guide/

-- The name of the package.
name:                hexwax

-- The package version.  See the Haskell package versioning policy (PVP)
-- for standards guiding when and how versions should be incremented.
-- http://www.haskell.org/haskellwiki/Package_versioning_policy
-- PVP summary:      +-+------- breaking API changes
--                   | | +----- non-breaking API additions
--                   | | | +--- code changes with no API change
version:             0.1.0.0

-- A short (one-line) description of the package.
synopsis:            Hexwax ExnapdIO-USB wrapper

-- A longer description of the package.
-- description:

-- The license under which the package is released.
license:             LGPL-3

-- The file containing the license text.
license-file:        LICENSE

-- The package author(s).
author:              Sean Charles

-- An email address to which users can send suggestions, bug reports, and
-- patches.
maintainer:          sean at objitsu.com

-- A copyright notice.
-- copyright:

category:            Hardware Interfacing

build-type:          Simple

-- Constraint on the version of Cabal needed to build this package.
cabal-version:       >=1.8


executable hexwax
  -- .hs or .lhs file containing the Main module.
  main-is:             usb1.hs
  -- Modules included in this executable, other than Main.
  other-modules:       Hexwax
  -- Other library packages from which modules are imported.
  build-depends:       base ==4.5.*, MissingM ==0.0.*, bytestring ==0.9.*,
vector ==0.10.*, usb ==1.2.*

--
-- This is the STEPPER MOTOR CONTROLLER program as I want to create
-- separate little utilities rather than one big monolithic command
-- line bloated application.
--
executable smc
  -- .hs or .lhs file containing the Main module.
  main-is:             stepper.hs
  -- Modules included in this executable, other than Main.
  other-modules:       Hexwax
  -- Other library packages from which modules are imported.
  build-depends:       base ==4.5.*, MissingM ==0.0.*, bytestring ==0.9.*,
vector ==0.10.*, usb ==1.2.*, transformers


--
-- PULSE-WIDTH-MODULATION controller experiment... two leds on the board are
-- connected to CCP1 and CCP2, this will try to make them do something
-- interesting.  executable pwm
--
executable pwm
  -- .hs or .lhs file containing the Main module.
  main-is:             pwm.hs
  -- Modules included in this executable, other than Main.
  other-modules:       Hexwax
  -- Other library packages from which modules are imported.
  build-depends:       base ==4.5.*, MissingM ==0.0.*, bytestring ==0.9.*,
vector ==0.10.*, usb ==1.2.*, transformers

On 9 May 2013 16:24, harry <voldermort at hotmail.com> wrote:

> I've written a library, and a simple program to demonstrate it. I can write
> the cabal file for the library, but I can't get the executable section
> right. How can I tell it to use the library defined herein?
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130509/ab0d5d43/attachment.htm>


More information about the Beginners mailing list