MyNixOS website logo
Description

A Haskell Battlesnake starter.

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
Metadata

Version

1.1.0

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows