aboutsummaryrefslogtreecommitdiff
path: root/haskell
diff options
context:
space:
mode:
authorChris Wells <chris@mathematicaster.org>2026-02-25 10:39:15 -0600
committerChris Wells <chris@mathematicaster.org>2026-02-25 10:39:15 -0600
commitf2c4d486c0e5763b9fcd92987128df262233c1a9 (patch)
treea78ac2fcd93b60daa80eb12fc8928f251377c35f /haskell
downloadtemplates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar
templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar.gz
templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar.bz2
templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar.lz
templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar.xz
templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar.zst
templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.zip
Basic templates so farHEADmaster
Diffstat (limited to 'haskell')
-rw-r--r--haskell/.envrc1
-rw-r--r--haskell/app/Main.hs6
-rw-r--r--haskell/flake.nix74
-rw-r--r--haskell/package.yaml54
-rw-r--r--haskell/src/Prolog.hs54
5 files changed, 189 insertions, 0 deletions
diff --git a/haskell/.envrc b/haskell/.envrc
new file mode 100644
index 0000000..a5dbbcb
--- /dev/null
+++ b/haskell/.envrc
@@ -0,0 +1 @@
+use flake .
diff --git a/haskell/app/Main.hs b/haskell/app/Main.hs
new file mode 100644
index 0000000..571a6f1
--- /dev/null
+++ b/haskell/app/Main.hs
@@ -0,0 +1,6 @@
+module Main
+ ( main
+ ) where
+
+main :: IO ()
+main = undefined
diff --git a/haskell/flake.nix b/haskell/flake.nix
new file mode 100644
index 0000000..a637cde
--- /dev/null
+++ b/haskell/flake.nix
@@ -0,0 +1,74 @@
+{
+ description = "Haskell project";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs";
+ nix-filter.url = "github:numtide/nix-filter";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ systems.url = "github:nix-systems/default";
+ };
+
+ outputs =
+ inputs@{
+ self,
+ flake-parts,
+ nixpkgs,
+ nix-filter,
+ ...
+ }:
+ flake-parts.lib.mkFlake { inherit self inputs; } {
+ systems = import inputs.systems;
+
+ flake.overlays.default = final: prev: {
+ haskellPackages = prev.haskellPackages.extend (
+ hfinal: _hprev: {
+ PROJECT =
+ let
+ src = nix-filter {
+ root = ./.;
+ include = [
+ "src"
+ "app"
+ "package.yaml"
+ "PROJECT.cabal"
+ ];
+ };
+ in
+ hfinal.callCabal2nix "PROJECT" src { };
+ }
+ );
+ };
+
+ perSystem =
+ {
+ config,
+ pkgs,
+ system,
+ ...
+ }:
+ {
+ _module.args.pkkgs = import nixpkgs {
+ inherit system;
+ overlays = [ self.overlays.default ];
+ };
+
+ packages = rec {
+ default = PROJECT;
+ inherit (pkgs.haskellPackages) PROJECT;
+ };
+
+ devShells.default = pkgs.haskellPackages.shellFor {
+ packages = ps: [ ];
+ withHoogle = true;
+ buildInputs = with pkgs.haskellPackages; [
+ cabal-install
+ hpack
+ hlint
+ fast-tags
+ pkgs.haskell-language-server
+ ];
+ };
+
+ };
+ };
+}
diff --git a/haskell/package.yaml b/haskell/package.yaml
new file mode 100644
index 0000000..878a29b
--- /dev/null
+++ b/haskell/package.yaml
@@ -0,0 +1,54 @@
+name: PROJECT
+version: 0.1.0.0
+license: MIT
+author: Chris Wells
+maintainer: "chris@mathematicaster.org"
+copyright: "2026 Chris Wells"
+
+dependencies:
+ - base >= 4.7 && < 5
+
+language: GHC2021
+
+ghc-options:
+ - -Wall
+ - -Wcompat
+ - -Widentities
+ - -Wincomplete-record-updates
+ - -Wincomplete-uni-patterns
+ - -Wmissing-home-modules
+ - -Wpartial-fields
+ - -Wredundant-constraints
+
+default-extensions:
+ - BangPatterns
+ - DeriveGeneric
+ - DeriveLift
+ - DerivingStrategies
+ - DerivingVia
+ - DefaultSignatures
+ - FunctionalDependencies
+ - GADTs
+ - LambdaCse
+ - MultiWayIf
+ - OverloadedStrings
+ - PatternSynonyms
+ - RecordWildCards
+ - TypeFamilies
+ - UndecidableInstances
+ - ViewPatterns
+
+library:
+ source-dirs: src
+ dependencies:
+ - mtl
+
+executables:
+ PROJECT:
+ main: Main.hs
+ source-dirs: app
+ ghc-otpions:
+ - -threaded
+ - -O2
+ dependencies:
+ - PROJECT
diff --git a/haskell/src/Prolog.hs b/haskell/src/Prolog.hs
new file mode 100644
index 0000000..b435c5a
--- /dev/null
+++ b/haskell/src/Prolog.hs
@@ -0,0 +1,54 @@
+module Prolog
+ (
+ -- * Modules
+ module Control.Applicative
+ , module Control.Monad
+ , module Control.Monad.Identity
+ , module Control.Monad.IO.Class
+ , module Data.Bool
+ , module Data.Either
+ , module Data.Function
+ , module Data.Functor
+ , module Data.Maybe
+ -- * Types
+ , Generic
+ , Generic1
+ , Typeable
+ , Generically (..)
+ , IsString (..)
+ -- * Functions
+ , ffmap
+ , (<<$>>)
+ , (<<&>>)
+ ) where
+
+import Control.Applicative
+import Control.Monad
+import Control.Monad.Identity
+import Control.Monad.IO.Class
+import Data.Bool
+import Data.Either
+import Data.Function
+import Data.Functor
+import Data.Maybe
+import Data.Typeable (Typeable)
+import Data.String (IsString (..))
+import GHC.Generics
+
+
+-- | 'fmap' over nested functors
+ffmap :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
+ffmap = fmap fmap fmap
+{-# INLINE ffmap #-}
+
+-- | infix version of 'fmap'
+(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
+infixl 4 <<$>>
+(<<$>>) = ffmap
+{-# INLINE (<<$>>) #-}
+
+-- | flipped '(<<$>>)'
+(<<&>>) :: (Functor f, Functor g) => f (g a) -> (a -> b) -> f (g b)
+infixl 1 <<&>>
+(<<&>>) = flip (<<$>>)
+{-# INLINE (<<&>>) #-}