1module Nitpick.Pattern where
3import qualified Data.List as List
4import qualified Data.Set as Set
6import qualified AST.Literal as L
7import qualified AST.Pattern as P
8import qualified AST.Variable as Var
9import qualified Reporting.Annotation as A
13 = Data Var.Canonical [Pattern]
15 | Alias String Pattern
19 | AnythingBut (Set.Set L.Literal)
23fromCanonicalPattern :: P.CanonicalPattern -> Pattern
24fromCanonicalPattern (A.A _ pattern) =
26 P.Data tag patterns ->
27 Data tag (map fromCanonicalPattern patterns)
32 P.Alias name pattern ->
33 Alias name (fromCanonicalPattern pattern)
47toString :: Pattern -> String
51 List.intercalate " " (Var.toString tag : map toString args)
54 "{ " ++ List.intercalate ", " fields ++ " }"
56 Alias alias realPattern ->
57 toString realPattern ++ " as " ++ alias
68 AnythingBut literalSet ->
69 List.intercalate " " ("<values besides:" : map L.toString (Set.toList literalSet))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list