aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.envrc3
-rw-r--r--.gitignore2
-rw-r--r--README.md4
-rw-r--r--TODO.norg8
-rw-r--r--bin/Main.hs12
-rw-r--r--chelleport.cabal61
-rw-r--r--flake.lock74
-rw-r--r--flake.nix48
-rw-r--r--hie.yaml10
-rw-r--r--justfile14
-rw-r--r--specs/Main.hs8
-rw-r--r--src/Chelleport.hs18
12 files changed, 262 insertions, 0 deletions
diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..b8c7f1e
--- /dev/null
+++ b/.envrc
@@ -0,0 +1,3 @@
+use flake
+
+watch_file *.cabal
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a04c30d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+result
+dist-newstyle/
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c770ab3
--- /dev/null
+++ b/README.md
@@ -0,0 +1,4 @@
+# Chelleport
+
+WIP
+
diff --git a/TODO.norg b/TODO.norg
new file mode 100644
index 0000000..6e32140
--- /dev/null
+++ b/TODO.norg
@@ -0,0 +1,8 @@
+* Current
+ - ( )
+
+* Later
+ - ( )
+
+* Maybe
+ - ( )
diff --git a/bin/Main.hs b/bin/Main.hs
new file mode 100644
index 0000000..9cecd67
--- /dev/null
+++ b/bin/Main.hs
@@ -0,0 +1,12 @@
+module Main where
+
+import qualified Chelleport
+import Data.Text (Text, splitOn)
+import qualified Data.Text as Text
+import System.Environment (getArgs)
+import System.Exit (exitFailure)
+
+main :: IO ()
+main = do
+ putStrLn "Wow"
+ Chelleport.open
diff --git a/chelleport.cabal b/chelleport.cabal
new file mode 100644
index 0000000..e9587e6
--- /dev/null
+++ b/chelleport.cabal
@@ -0,0 +1,61 @@
+cabal-version: 3.0
+
+name: chelleport
+version: 0.1.0.0
+license: MIT
+author: Akshay Nair <phenax5@gmail.com>
+maintainer: Akshay Nair <phenax5@gmail.com>
+build-type: Simple
+synopsis: Mouse control
+description: Mouse control
+
+common common-config
+ default-extensions:
+ OverloadedStrings,
+ LambdaCase,
+ QuasiQuotes,
+ TemplateHaskell,
+ TupleSections,
+ NamedFieldPuns
+ default-language: Haskell2010
+ build-depends:
+ base,
+ text,
+ containers
+
+common warnings
+ ghc-options:
+ -Wall -Wincomplete-record-updates -Wincomplete-uni-patterns
+ -Wunused-foralls -Wextra -Wno-unused-do-bind -Wname-shadowing
+ -fwarn-tabs -fprint-explicit-foralls -fprint-explicit-kinds
+
+executable chelleport
+ import: common-config, warnings
+ hs-source-dirs: bin
+ main-is: Main.hs
+ build-depends: lib-chelleport
+ -- other-modules:
+
+library lib-chelleport
+ import: common-config, warnings
+ hs-source-dirs: src
+ build-depends:
+ gloss == 1.13.2.2,
+ sdl2 == 2.5.5.0
+ exposed-modules:
+ Chelleport
+
+test-suite specs
+ import: common-config
+ type: exitcode-stdio-1.0
+ hs-source-dirs: specs
+ main-is: Main.hs
+ other-modules:
+ Specs.ParserSpec,
+ Specs.SerializerSpec,
+ Specs.TransformerSpec
+ build-depends:
+ lib-chelleport,
+ neat-interpolation,
+ pretty-simple,
+ hspec
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..acebb8f
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,74 @@
+{
+ "nodes": {
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": "nixpkgs-lib"
+ },
+ "locked": {
+ "lastModified": 1733312601,
+ "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
+ }
+ },
+ "haskell-flake": {
+ "locked": {
+ "lastModified": 1733672669,
+ "narHash": "sha256-cJa3mhmWLj1+DLmb3Bkq+5cCkeBAsbTkSKf0XvlMo9w=",
+ "owner": "srid",
+ "repo": "haskell-flake",
+ "rev": "b13eb3f9b8f4666e2d7c9641d1f914e45afe575c",
+ "type": "github"
+ },
+ "original": {
+ "owner": "srid",
+ "repo": "haskell-flake",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1733935885,
+ "narHash": "sha256-xyiHLs6KJ1fxeGmcCxKjJE4yJknVJxbC8Y/ZRYyC8WE=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "5a48e3c2e435e95103d56590188cfed7b70e108c",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-lib": {
+ "locked": {
+ "lastModified": 1733096140,
+ "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=",
+ "type": "tarball",
+ "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
+ },
+ "original": {
+ "type": "tarball",
+ "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-parts": "flake-parts",
+ "haskell-flake": "haskell-flake",
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..ead8307
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,48 @@
+{
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ haskell-flake.url = "github:srid/haskell-flake";
+ };
+ outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
+ flake-parts.lib.mkFlake { inherit inputs; } {
+ systems = nixpkgs.lib.systems.flakeExposed;
+ imports = [ inputs.haskell-flake.flakeModule ];
+
+ perSystem = { self', pkgs, lib, config, ... }: {
+ haskellProjects.default = {
+ projectRoot = builtins.toString (lib.fileset.toSource {
+ root = ./.;
+ fileset = lib.fileset.unions [
+ ./src
+ ./specs
+ ./chelleport.cabal
+ ];
+ });
+
+ packages = {};
+ settings = {};
+
+ devShell = {
+ # tools = hp: { fourmolu = hp.fourmolu; ghcid = null; };
+ hlsCheck.enable = pkgs.stdenv.isDarwin;
+ };
+
+ autoWire = [ "packages" "apps" "checks" ];
+ };
+
+ packages.default = self'.packages.chelleport;
+ apps.default = self'.apps.chelleport;
+
+ devShells.default = pkgs.mkShell {
+ inputsFrom = [
+ config.haskellProjects.default.outputs.devShell
+ ];
+ packages = with pkgs; [
+ just
+ haskellPackages.hspec-golden
+ ];
+ };
+ };
+ };
+}
diff --git a/hie.yaml b/hie.yaml
new file mode 100644
index 0000000..1469d4a
--- /dev/null
+++ b/hie.yaml
@@ -0,0 +1,10 @@
+cradle:
+ cabal:
+ - path: "./src"
+ component: "lib:lib-chelleport"
+
+ - path: "./bin/Main.hs"
+ component: "exe:chelleport"
+
+ - path: "./specs"
+ component: "test:specs"
diff --git a/justfile b/justfile
new file mode 100644
index 0000000..fab0b56
--- /dev/null
+++ b/justfile
@@ -0,0 +1,14 @@
+default:
+ @just --choose
+
+run *args:
+ cabal run chelleport -- {{args}}
+
+test:
+ cabal test
+
+testw:
+ npx nodemon -e .hs -w src --exec 'ghcid -c "cabal repl test:specs" -T :main'
+
+build:
+ nix build
diff --git a/specs/Main.hs b/specs/Main.hs
new file mode 100644
index 0000000..436c6aa
--- /dev/null
+++ b/specs/Main.hs
@@ -0,0 +1,8 @@
+module Main (main) where
+
+import qualified Specs.ParserSpec
+import Test.Hspec (hspec)
+
+main :: IO ()
+main = hspec $ do
+ Specs.ParserSpec.test
diff --git a/src/Chelleport.hs b/src/Chelleport.hs
new file mode 100644
index 0000000..fdd443a
--- /dev/null
+++ b/src/Chelleport.hs
@@ -0,0 +1,18 @@
+module Chelleport where
+
+import Graphics.Gloss
+
+open =
+ display
+ ( InWindow
+ "Hello World" -- window title
+ (400, 150) -- window size
+ (10, 10) -- window position
+ )
+ white -- background color
+ picture -- picture to display
+
+picture =
+ Translate (-170) (-20) $ -- shift the text to the middle of the window
+ Scale 0.5 0.5 $ -- display it half the original size
+ Text "Hello World" -- text to display