https://github.com/wilberquito/johntheartist
Template John the artist
https://github.com/wilberquito/johntheartist
functional-programming graphics haskell opengl
Last synced: 6 months ago
JSON representation
Template John the artist
- Host: GitHub
- URL: https://github.com/wilberquito/johntheartist
- Owner: wilberquito
- License: mit
- Created: 2023-04-15T13:57:10.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-23T16:00:06.000Z (over 2 years ago)
- Last Synced: 2025-04-09T08:23:30.911Z (7 months ago)
- Topics: functional-programming, graphics, haskell, opengl
- Language: Haskell
- Homepage:
- Size: 248 KB
- Stars: 0
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# John the artist 🎨
Please make sure to clone or download the zip file of the current repository.
Once downloaded, you need `ghc` compiler (Glorious Haskell Compiler)
and `Cabal` (Common Architecture for Building Applications and Libraries)
as `Maven` for `Java`. The quickest way to
get `ghc` and `Cabal` is to use [ghcup](https://www.haskell.org/ghcup/)
which is the main installer for general Haskell porpuse.
[Here](https://www.haskell.org/ghcup/install/) are the instructions to download it in any operating system.
## How to interact with you program
This project has been tested with `ghc` version `8.10.7`.
So please, please, check your `ghc` version.
```sh
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7
(base)
```
If you don't have the correct version, use `ghcup` to change the default
default `ghc` compiler to `8.10.7`.
The following command opens a user interface to install and
change the default Haskell compiler.
```sh
$ ghcup tui
```
The first time you open this project you
need to compile the targets within the project.
```
$ cabal build
```
This command will create a folder `dist-newstyle` with the
resulting compilation, ignore it, but this is where the required
dependencies are installed. It also compiles the project's source code
and generates the executable or library output.
To run the `Main.hs` file run:
```sh
$ cabal run
```
To lunch `ghci` (Haskell interpreter) in the context of your Cabal project,
you should use:
```sh
$ cabal repl
```
Inside the interpreter you can load any module to interact with as:
```haskell
GHCi> :load
```
or
```haskell
GHCi> :m +
```
or
```haskell
GHCi> import
```
## Change `ghc` version
This explanation assumes that you will use `ghcup` as your main Haskell installer.
If you have access to
`ghcup tui` (which means you're not using Windows - lucky you!),
it will provide a user interface to help you install and set
the version of `ghc` and other programs related to Haskell.
If you don't have the `tui` program,
you can still install and set as default
any available `ghc` version by following these steps:
1. Install the desired `ghc` version
```bash
$ ghcup install ghc 8.10.7
```
2. Now you need to set the main `ghc` compiler.
```bash
$ ghcup set ghc 8.10.7
```
## Recomendations
- There should be non whitespace in any folder of the project path
- You may have problem building the project because of the `MAX_PATH` configuration
on your system. In windows the `MAX_PATH` is defined with 260 characters. So as the
build project generates long path for the build artifacts, put your project in a folder
with a short path.
## C libraries
The graphics of this projects run on OpenGL (Open Graphics Library) and
in GLUT (OpenGL Utility Toolkit).
OpenGL (Open Graphics Library) is a cross-platform API (Application Programming Interface) for rendering 2D and 3D computer graphics.
GLUT (OpenGL Utility Toolkit) is a library that provides a set of functions for creating graphical user interfaces (GUIs) and handling input events in OpenGL applications.
This modules may need some C libraries you may not have on your system.
Depending on your operating system,
you can usually install this C libraries using your package manager.
For example, on Ubuntu or Debian, you can install the library
using the following command:
### OpenGL
```sh
$ sudo apt-get install libgl1-mesa-dev
```
### GLUT
```sh
$ sudo apt-get install -y \
libglu1-mesa-dev \
freeglut3-dev
```
### GNU Multiple Precision Arithmetic Library (gmp)
```sh
$ sudo apt-get install libgmp-dev
```