starter-snake-haskell: A Haskell Battlesnake starter

[ bsd3, game, library, program, web ] [ Propose Tags ]
Versions [RSS] 1.0.0, 1.1.0
Change log CHANGELOG.md
Dependencies aeson (>=1.4 && <3), base (>=4.13 && <5), containers (>=0.6 && <1), scotty (>=0.11 && <1), starter-snake-haskell, text (>=1.2 && <2) [details]
License BSD-3-Clause
Copyright 2021 Alexander Pankoff
Author Alexander Pankoff <ccntrq@screenri.de
Maintainer Alexander Pankoff <ccntrq@screenri.de>
Category Game, Web
Home page https://github.com/ccntrq/starter-snake-haskell#readme
Bug tracker https://github.com/ccntrq/starter-snake-haskell/issues
Source repo head: git clone https://github.com/ccntrq/starter-snake-haskell
Uploaded by ccntrq at 2023-08-26T16:33:20Z
Distributions
Executables starter-snake-haskell-exe
Downloads 59 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-08-26 [all 1 reports]

Readme for starter-snake-haskell-1.1.0

[back to package description]

starter-snake-haskell - A Haskell Battlesnake starter

This repository contains a Haskell Battlesnake starter project. It implements v1 of the Battlesnake API and can be deployed to Heroku.

Usage

This starter repo can be used in two different ways

  1. As a fork that is subsequently modified to your needs
  2. Installed as a hackage library in your haskell project

As a fork

First clone this repo or create a fork by pushing the fork button and clone your fork.

You can then start implementing your game logic in app/Main.hs.

This template uses Stack to build and run the project.

To start the server locally run stack run which will start a development webserver on port 3000. (The port can be changed by setting the PORT environment variable)

As hackage dependency

With cabal

Add the dependency to your-app.cabal

executable myfirstapp
    main-is: Main.hs
    build-depends:
        ...
        starter-snake-haskell ^>=1.1.0

With stack

Add the dependency as extra-dep in your stack.yaml

resolver: lts-20.26
packages:
  - .

extra-deps:
- starter-snake-haskell-1.1.0

Implementation

You can now start implementing your battlesnake logic in your project. You can use the Main from this repo as a starting point.

Deploy to Heroku

When using the repo as a fork you can use the provided Procfile to deploy it to heroku. Otherwise you will need to provide your own.

Afterwards you can use the Heroku CLI to deploy your project.

First, login to your account:

heroku login -i

Afterwards you can create a new deployment in heroku using the heroku-buildpack-stack.

heroku create your-battlesnake-name --buildpack https://github.com/mfine/heroku-buildpack-stack

You can then push your code to heroku with git where it will be build and deployed:

git push heroku master