diff options
| author | Lars-Dominik Braun <lars@6xq.net> | 2024-08-17 07:44:14 +0200 |
|---|---|---|
| committer | Lars-Dominik Braun <lars@6xq.net> | 2024-08-17 07:47:16 +0200 |
| commit | 79aaf53023cd71c3eabdf63c7dd88523902fe0e4 (patch) | |
| tree | 760781cc02a68f8ada387e4de8294a2c693c4c55 /src/lib/Codec/Pesto/Lint.lhs | |
| parent | cc2aaa6e46dfac12dfad39414925d5a535a91d19 (diff) | |
| download | pesto-79aaf53023cd71c3eabdf63c7dd88523902fe0e4.tar.gz pesto-79aaf53023cd71c3eabdf63c7dd88523902fe0e4.tar.bz2 pesto-79aaf53023cd71c3eabdf63c7dd88523902fe0e4.zip | |
Fix non-exhaustive pattern warnings with GHC 9.2.
Diffstat (limited to 'src/lib/Codec/Pesto/Lint.lhs')
| -rw-r--r-- | src/lib/Codec/Pesto/Lint.lhs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/Codec/Pesto/Lint.lhs b/src/lib/Codec/Pesto/Lint.lhs index edeede7..5d9be7d 100644 --- a/src/lib/Codec/Pesto/Lint.lhs +++ b/src/lib/Codec/Pesto/Lint.lhs @@ -10,13 +10,15 @@ Linting > , parseMetadata > , extractMetadata > , Metadata(..) -> , LintResult(..)) where +> , LintResult(..) +> , LintStatus(..)) where > import Test.HUnit hiding (test, Node) > import Data.List (sort, isPrefixOf, insert, intersect) > import Text.Parsec hiding (parse) > import Data.Char (isSpace, toLower) > import Data.Ratio ((%)) > import Data.Maybe (fromMaybe) +> import Data.Either (fromRight) > import qualified Data.Map.Strict as M > > import Codec.Pesto.Graph hiding (test) @@ -70,6 +72,7 @@ Metadata The graph’s root node must be a result. It contains yield (amount and unit) and title (object) of the recipe. +> extractMetadata :: Nodes Instruction -> Edges -> Maybe [(NodeId, (String, Metadata))] > extractMetadata nodes edges = case walkRoot nodes edges of > [(i, Result q@(Quantity _ _ title))] -> > Just $ (i, ("title", MetaStr title)) @@ -445,8 +448,8 @@ Every lint test checks a single aspect of the graph. > withGraph doc f = f nodes edges > where -> (Right op) = (head . extract . snd . unzip) <$> parse ("%pesto " ++ doc) -> nodes = zip [firstNodeId..] op +> op = (head . extract . snd . unzip) <$> parse ("%pesto " ++ doc) +> nodes = zip [firstNodeId..] (fromRight (error "unreachable") op) > edges = toGraph nodes ++ resolveReferences nodes > cmpLint doc expect = withGraph doc (\nodes edges -> doc ~: sort (lint nodes edges) ~?= sort expect) |
