diff options
| author | Chris Wells <chris@mathematicaster.org> | 2024-12-19 11:46:31 -0600 |
|---|---|---|
| committer | Chris Wells <chris@mathematicaster.org> | 2024-12-19 11:46:31 -0600 |
| commit | cbdb612f85355930ea7a6fbc453edbdf76715f69 (patch) | |
| tree | c71441d654c6727a49719c51e8ce16c9e9f0bb54 | |
| parent | 23c9c4e32d2f54aae627c1cff7bc7fc91e771e3d (diff) | |
| download | cv-cbdb612f85355930ea7a6fbc453edbdf76715f69.tar cv-cbdb612f85355930ea7a6fbc453edbdf76715f69.tar.gz cv-cbdb612f85355930ea7a6fbc453edbdf76715f69.tar.bz2 cv-cbdb612f85355930ea7a6fbc453edbdf76715f69.tar.lz cv-cbdb612f85355930ea7a6fbc453edbdf76715f69.tar.xz cv-cbdb612f85355930ea7a6fbc453edbdf76715f69.tar.zst cv-cbdb612f85355930ea7a6fbc453edbdf76715f69.zip | |
Thinking about doing this in haskell
| -rw-r--r-- | flake.nix | 31 | ||||
| -rw-r--r-- | nix/overlay.nix | 16 | ||||
| -rw-r--r-- | package.yaml | 38 | ||||
| -rw-r--r-- | src/Data/Name.hs | 13 | ||||
| -rw-r--r-- | src/Data/Paper.hs | 48 | ||||
| -rw-r--r-- | src/Data/Presentation.hs | 29 |
6 files changed, 175 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..29c76fe --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +{ + description = "My CV"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + nix-filter.url = "github:numtide/nix-filter"; + }; + + outputs = { self, nixpkgs, flake-utils, nix-filter, ... }: { + overlays.default = import ./nix/overlay.nix { inherit nix-filter; }; + } // flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlays.default ]; + }; + in { + packages = { + inherit (pkgs.haskellPackages) mycv; + default = pkgs.haskellPackages.mycv; + }; + + devShells.default = pkgs.haskellPackages.shellFor { + packages = p: [ p.mycv ]; + withHoogle = true; + buildInputs = with pkgs.haskellPackages; [ + cabal-install + hpack + ]; + }; + }; +} diff --git a/nix/overlay.nix b/nix/overlay.nix new file mode 100644 index 0000000..086dd3d --- /dev/null +++ b/nix/overlay.nix @@ -0,0 +1,16 @@ +{ nix-filter, ... }: +final: prev: let + src = nix-filter { + root = ../.; + include = [ + ../src + ../app + ../package.yaml + ../mycv.cabal + ]; + }; +in { + haskellPackages = prev.haskellPackages.extend (hfinal: hprev: { + mycv = hfinal.callCabal2nix "mycv" src {}; + }) +} diff --git a/package.yaml b/package.yaml new file mode 100644 index 0000000..616f456 --- /dev/null +++ b/package.yaml @@ -0,0 +1,38 @@ +name: mycv +version: 0.1.0.0 +license: MIT +author: Chris Wells +maintainer: chris@mathematicaster.org +copyright: "2024 Chris Wells" + +dependencies: + - base >= 4.7 && < 5 + +language: GHC2021 + +ghc-options: + - -Wall + - -Wcompat + +library: + source-dirs: src + default-extensions: + - BangPatterns + - DeriveGeneric + - DeriveLift + - DerivingStrategies + - DefaultSignatures + - FunctionalDependencies + - GADTs + - LambdaCase + - MultiWayIf + - OverloadedStrings + - TypeFamilies + - ViewPatterns + dependencies: + - hatex + - lens + - megaparsec + - mtl + - parsec-combinators + - text diff --git a/src/Data/Name.hs b/src/Data/Name.hs new file mode 100644 index 0000000..4553cdc --- /dev/null +++ b/src/Data/Name.hs @@ -0,0 +1,13 @@ +module Text.Name + ( Name (..) + ) where + +data Name a = Name + { lastName :: !a + , firstName :: !a + , middleName :: !(Maybe a) + } deriving (Eq, Foldable, Functor, Generic, Ord, Show, Traversable) + +instance Applicative Name where + pure x = Name x x (pure x) + Name l f m <*> Name x y z = Name (l x) (f y) (m <*> z) diff --git a/src/Data/Paper.hs b/src/Data/Paper.hs new file mode 100644 index 0000000..40ac91a --- /dev/null +++ b/src/Data/Paper.hs @@ -0,0 +1,48 @@ +module Data.Paper + ( Paper (..) + , ArXiv (..) + , DOI (..) + ) where + +import Data.Name + +data Paper a = Paper + { date :: !Day + , authors :: ![Name a] + , title :: !a + , doi :: !(Maybe (DOI a)) + , arXiv :: !(Maybe (ArXiv a)) + , pubStatus :: !(PubStatus a) + , abstract :: !a + } + +data ArXiv a = ArXiv + { arxivDate :: !Day + , arxivID :: !a + , arxivClasses :: !(NonEmpty (ArXivClass a)) + } deriving (Eq, Foldable, Functor, Generic, Ord, Show, Traversable) + +data ArXivClass a = ArXiv + { archive :: !a + , subjectClass :: !a + } deriving (Eq, Foldable, Functor, Generic, Ord, Show, Traversable) + +newtype DOI a = DOI a + deriving stock (Eq, Foldable, Functor, Generic, Ord, Show, Traversable) + + +data PubStatus a + = Submitted + { journal :: !a + } + | Accepted + { journal :: !a + } + | Published + { journal :: !a + , volume :: !(Maybe a) + , number :: !(Maybe a) + , pages :: !(Maybe a) + } + | UnPublished + deriving (Eq, Foldable, Functor, Generic, Ord, Show, Traversable) diff --git a/src/Data/Presentation.hs b/src/Data/Presentation.hs new file mode 100644 index 0000000..fd6ee7a --- /dev/null +++ b/src/Data/Presentation.hs @@ -0,0 +1,29 @@ +module Data.Presentation + ( Presentation (..) + , EventType (..) + ) where + + +data Presentation a = Presentation + { date :: !Day + , title :: !a + , event :: !a + , location :: !a + , eventType :: !EventType + , attendenceType :: !AttendenceType + } deriving (Eq, Foldable, Functor, Generic, Ord, Show, Traversable) + + +data AttendenceType + = Invited + | Contributed + deriving (Eq, Generic, Ord, Show) + + +data EventType + = Conference + | Colloquium + | Seminar + | Workshop + | AtHome + deriving (Eq, Generic, Ord, Show) |
