aboutsummaryrefslogtreecommitdiffstats
path: root/app/TreeGrepper/FileType.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-08 06:27:15 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-08 06:43:01 +0100
commit0d20548e3846cb80acca07fad2a1dc3cfe024528 (patch)
tree6605eb393af99914b4cce483f56e1becbcbe073d /app/TreeGrepper/FileType.hs
parent5842e730152a2ae11fc8772a505baa3ba81b1e9c (diff)
chore: drop tree-grepper
Regresses in that we only support Haskell for now, as Elm, Nix or Bash are not available as tree-sitter-* Haskell packages.
Diffstat (limited to 'app/TreeGrepper/FileType.hs')
-rw-r--r--app/TreeGrepper/FileType.hs75
1 files changed, 0 insertions, 75 deletions
diff --git a/app/TreeGrepper/FileType.hs b/app/TreeGrepper/FileType.hs
deleted file mode 100644
index 506cbc5..0000000
--- a/app/TreeGrepper/FileType.hs
+++ /dev/null
@@ -1,75 +0,0 @@
-module TreeGrepper.FileType
- ( FileType (..),
- all,
- Info (..),
- BlockInfo (..),
- info,
- )
-where
-
-import Data.Aeson (FromJSON (parseJSON))
-import Data.Binary (Binary)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-import Prelude hiding (all)
-
-data FileType
- = Elm
- | Haskell
- | Nix
- | Shell
- deriving (Eq, Show, Generic, Binary)
-
-instance FromJSON FileType where
- parseJSON v =
- parseJSON v >>= \case
- "elm" -> pure Elm
- "haskell" -> pure Haskell
- "nix" -> pure Nix
- "sh" -> pure Shell
- fileType -> fail ("parsing file_type failed, got " ++ fileType)
-
-all :: [FileType]
-all =
- [ Elm,
- Haskell,
- Nix,
- Shell
- ]
-
-data Info = Info
- { exts :: [String],
- lineStart :: Text,
- block :: Maybe BlockInfo
- }
-
-data BlockInfo = BlockInfo
- { blockStart :: [Text],
- blockEnd :: Text
- }
-
-info :: FileType -> Info
-info Elm =
- Info
- { exts = [".elm"],
- lineStart = "--",
- block = Just BlockInfo {blockStart = ["{-|", "{-"], blockEnd = "-}"}
- }
-info Haskell =
- Info
- { exts = [".hs"],
- lineStart = "--",
- block = Just BlockInfo {blockStart = ["{-"], blockEnd = "-}"}
- }
-info Nix =
- Info
- { exts = [".nix"],
- lineStart = "#",
- block = Just BlockInfo {blockStart = ["/*"], blockEnd = "*/"}
- }
-info Shell =
- Info
- { exts = [".sh"],
- lineStart = "#",
- block = Nothing
- }