Today, let's meet Yesod-bin.
Take the following installation steps from a clean environment, for example in Windows
- Install Haskell-platform (you can manually install cabal and GHC)
- to update cabal. Cabal Update
- 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
- (for example, c:\lib\ Yesod) This directory will become your Yesod home directory, just like the JDK
- executes cabal sandbox init we use sandbox technology to install the required dependencies in this directory
- 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
- 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
- installs Yesod. Cabal Install Yesod (think there is nothing luan use, but to be safe to install)
- 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.
- now enters your project directory
- Execute Yesod Init as prompted to generate the kind of project you need. I chose simple
- 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)