From 9b6b126a7b177aa9cf0b260cbbd183f957837574 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Thu, 24 Aug 2023 21:04:50 +0200 Subject: [PATCH 1/5] floke: Simplify packages function --- flake.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 4eb0f19..3272d7f 100644 --- a/flake.nix +++ b/flake.nix @@ -62,8 +62,7 @@ devShells.default = haskellPackages.shellFor { inherit (self.checks.${system}.pre-commit-check) shellHook; - packages = _: - pkgs.lib.filter (x: x != null) [ self.packages.${system}.default ]; + packages = _: [ self.packages.${system}.default ]; withHoogle = true; From 05428fa5205bdf412e8345936d6c6e8120ba939b Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Fri, 25 Aug 2023 23:13:00 +0200 Subject: [PATCH 2/5] WIP: Implement wordWrap --- src/HCat/Internal.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/HCat/Internal.hs b/src/HCat/Internal.hs index 69f0493..4bbbaae 100644 --- a/src/HCat/Internal.hs +++ b/src/HCat/Internal.hs @@ -1,6 +1,8 @@ -- | Internal module in order to facilitate testability. module HCat.Internal where +import Data.Text (Text) + -- | @parseArgs@ takes a list of strings and returns a single FilePath if there was exactly one element. -- -- >>> parseArgs ["foo"] @@ -28,3 +30,11 @@ chunksOf n xs@(_ : _) | otherwise = let (chunk, rest) = splitAt n xs in chunk : chunksOf n rest + +-- | @wordWrap@ splits the given Text if it is longer than the given margin. +-- +-- >>> :set -XOverloadedStrings +-- >>> wordWrap 3 $ "abcdef" +-- ["abc", "def"] +wordWrap :: Int -> Text -> [Text] +wordWrap = undefined From eeac31df245fa1764a0903e56007b5925e295ee4 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Thu, 24 Aug 2023 21:04:50 +0200 Subject: [PATCH 3/5] flake: Simplify packages function --- flake.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 4eb0f19..3272d7f 100644 --- a/flake.nix +++ b/flake.nix @@ -62,8 +62,7 @@ devShells.default = haskellPackages.shellFor { inherit (self.checks.${system}.pre-commit-check) shellHook; - packages = _: - pkgs.lib.filter (x: x != null) [ self.packages.${system}.default ]; + packages = _: [ self.packages.${system}.default ]; withHoogle = true; From 67b691d410c7cc35f7942a0629f56fb2b8817972 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Sat, 26 Aug 2023 01:12:35 +0200 Subject: [PATCH 4/5] flake: Install hspec-discover --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 3272d7f..0d630c6 100644 --- a/flake.nix +++ b/flake.nix @@ -69,6 +69,7 @@ nativeBuildInputs = with pkgs; [ haskellPackages.haskell-language-server haskellPackages.fourmolu + haskellPackages.hspec-discover cabal-install ghcid nixfmt From 4e3feae5e6ac86da60168ad547d9e2025548ce0b Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Fri, 25 Aug 2023 23:13:00 +0200 Subject: [PATCH 5/5] WIP: Implement wordWrap --- src/HCat/Internal.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/HCat/Internal.hs b/src/HCat/Internal.hs index 69f0493..4bbbaae 100644 --- a/src/HCat/Internal.hs +++ b/src/HCat/Internal.hs @@ -1,6 +1,8 @@ -- | Internal module in order to facilitate testability. module HCat.Internal where +import Data.Text (Text) + -- | @parseArgs@ takes a list of strings and returns a single FilePath if there was exactly one element. -- -- >>> parseArgs ["foo"] @@ -28,3 +30,11 @@ chunksOf n xs@(_ : _) | otherwise = let (chunk, rest) = splitAt n xs in chunk : chunksOf n rest + +-- | @wordWrap@ splits the given Text if it is longer than the given margin. +-- +-- >>> :set -XOverloadedStrings +-- >>> wordWrap 3 $ "abcdef" +-- ["abc", "def"] +wordWrap :: Int -> Text -> [Text] +wordWrap = undefined