在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):joshcough/HaskellStarter开源软件地址(OpenSource Url):https://github.com/joshcough/HaskellStarter开源编程语言(OpenSource Language):Haskell 78.4%开源软件介绍(OpenSource Introduction):HaskellStarterThis project demonstrates how to set up your own real Haskell project, and helps you get a feel for the Haskell ecosystem. Currently, teaching Haskell is not a goal of this project, but it may in the future. As for now, basic knowledge of Haskell is assumed, and this project is aimed at people who want to build a real program or library in Haskell.
Getting started with this projectThe best way to get started with this project is to simply clone it, and poke around.
Here are the contents of the project:
Some valuable commands to play with (all of which will be explained) are: $ cabal --help
$ cabal update
$ cabal init
$ cabal install github
$ cabal build
$ cabal test
$ cabal repl
$ cabal install PrerequisitesAs stated, this project assumes some basic knowledge of Haskell. If you don't have that, I recommend Learn You a Haskell for Great Good!. Also, if you haven't already, go install the Haskell Platform. ghciIn order to have some basic knowledge of Haskell, it's highly likely that you've played with ghci, but a refresher still helps. ghci is a simple way to get started playing with Haskell, and is essential for testing out functions and types during development. Run ghci at the command line by simply typing ghci: $ ghci Input expressions prelude> 5 + 5
10
prelude> let x = 10
prelude> x + x
20 Get types with :t prelude> :t x
x :: Num a => a
prelude> let x = 7 :: Int
prelude> :t x + x
x + x :: Int Load files with :load prelude> :load Goop
*Goop> --now run some expressions in Goop Quit ghci prelude> ^d HoogleHoogle is the go to place for finding:
Maybe we want to write a library that does some fun stuff with the Github API (http://developer.github.com/v3/). Let's go search Hoogle to see if there is anything already there to help us: https://lmddgtfy.net/?q=!hoogle%20github Yay, we've discovered a Github package — http://hackage.haskell.org/package/github, complete with everything listed above. Poke around and find out more. After you're done poking, you should install the package: $ cabal install github CabalWhile ghci is useful for playing with Haskell code, it doesn't enable you to build libraries and programs. Cabal (Common Architecture for Building Applications and Libraries) is installed with the Haskell Platform, and is the canonical tool for building Haskell code. This section explains using Cabal, but where it lacks, you can get more info at: http://www.haskell.org/cabal/. Getting Started with CabalA few helpful commands for getting started with Cabal:
This project is a working Cabal project, and this document explains the Cabal configuration, which is in Cabal file header
Most of these fields are self explanatory, and are mostly for documentation, and only a couple of them are required. More information on what each of these fields means and which ones are required can be found at http://www.haskell.org/cabal/users-guide/developing-packages.html. Creating a LibraryModulesIn order to have a library, we need some code. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论