The Yesod development of Haskell – side-stepping pit development (3)

Source: Internet
Author: User

Today, let's meet Yesod-bin.
Take the following installation steps from a clean environment, for example in Windows

    1. Install Haskell-platform (you can manually install cabal and GHC)
    2. to update cabal. Cabal Update
    3. updates caball-install. Cabal Install–global Cabal-install Remember to take the global parameter, otherwise your update is only in the current cabal environment, and there is nothing luan to switch to a directory with
    4. (for example, c:\lib\ Yesod) This directory will become your Yesod home directory, just like the JDK
    5. executes cabal sandbox init we use sandbox technology to install the required dependencies in this directory
    6. Here you can copy a file called Cabal.config, but I tried two links https://www.stackage.org/nightly-2015-05-28 and http://www.stackage.org/lts/ Cabal.config, instead of causing the Yesod installation to be unsuccessful, skip this step
    7. install Yesod-bin. Cabal Install Yesod-bin (in http://blog.pangyanhan.com/haskell/2013-11-31- using-cabal-sandbox-libraries.html here, the 7th and 8th steps are the opposite, but I can not install it according to what he said, and then it succeeds after inversion
    8. installs Yesod. Cabal Install Yesod (think there is nothing luan use, but to be safe to install)
    9. Set environment variables, C:\lib\yesod.cabal-sandbox and c:\lib\ Yesod.cabal-sandbox\bin added to path, you should notice that there is a yesod.exe under \ bin. Yes, we're going to use this for the next thing.
    10. now enters your project directory
    11. Execute Yesod Init as prompted to generate the kind of project you need. I chose simple
    12. here to test the HelloWorld here http://www.yesodweb.com/book/basics.
      Done

Next we want to engage in database. Experiment with the first code in Http://www.yesodweb.com/book-1.4/persistent.

>-package-db=c:\lib\yesod\.cabal-sandbox\i386-windows-ghc-7.8.3-packages.conf.

No accident, you will receive an error message, indicating that Database.Persist.Sqlite can not find, then we come back to install

Switch to C:\lib\yesod, execute cabal install Persistent-sqlite
Re-execute.

done!

If you want to try a MySQL connection, you can use YESOD init to generate a project with MySQL and then execute

-package-db=c:\lib\yesod\.cabal-sandbox\i386-windows-ghc-7.8.3-packages.conf.d app/main

Will prompt you, Classyprelude.yesod,database.persist.mysql,yesod.static,yesod.jesmini not installed
Or go back to the C:\lib\yesod directory
Execute cabal install yesod.static to eliminate yesod.static and Yesod.jesmini errors
However, when installing cabal install Persistent-mysql, you will be prompted to require a Linux environment to compile the Pcre-light package.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The Yesod development of Haskell – side-stepping pit development (3)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.