The next few sections cover more details needed for more complex What we have covered so far should be enough for very simple packages Run it (though you may first need to adjust your system’s $PATH). For executables it installs the program so that you can The Data.Map module comes from the containersįor libraries this makes them available for use in GHCi or to be used by List all the other packages that your package depends on.įor example, suppose the example Proglet module imports the moduleĭata.Map. You have to list all of the library packages that your library orĮxecutable imports modules from. Libraries are of course just Cabal packages that contain a library.) Standard libraries or other pre-packaged libraries. While your library or executable may include a number of modules, itĪlmost certainly also imports a number of external modules from the Included in the executable should be listed in the other-modulesįield. You will need to fill in theĮxecutable:main-is field with the file name of your program’s Either way, all modules in the library needįor an executable, cabal init does not try to guess which fileĬontains your program’s Main module. Of your package’s public interface, you can move those modules to the That look like Haskell modules and adds all the modules to the Modules included in the package ¶įor a library, cabal init looks in the project directory for files Of the package too, but this is not required and the name is givenĮxplicitly. The name of a library always matches the name of the package, so it is Modules that make up the public interface of the library, whileĮxecutables have a file containing a Main module. The difference is that libraries have a number of “exposed” Most of the build information fields are the same between libraries andĮxecutables. The build information fields listed (but commented out) are just the few main-is: - other-modules: - build-depends: ForĪ package that you never intend to distribute to others, these fieldsįinally, cabal init -interactive creates the initial proglet.cabalĪnd Setup.hs files, and depending on your choice of license, a It also asks questions about various other bits of package metadata. (for example, “proglet”), and our package’s version. Which version of the cabal specification to use, our package’s name cabalĪfter you make your selection (executable library or: libraryĪnd executable) cabal asks us a number of questions starting with a library and multiple executables or test suites) the. Libraries are collections of Haskell modules thatĬan be re-used by other Haskell libraries and programs, while executablesįor the moment these are the only choices. One of the important questions is whether the package contains a libraryĪnd/or an executable. Should I generate a simple project with sensible defaults? n What does the package build: 1) Executable 2) Library 3) Library and Executable Your choice?.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |