@@ -15,17 +15,29 @@ import qualified AST.Pattern as Pattern
15ports are all paired with definitions in the appropriate order, it collapses
15ports are all paired with definitions in the appropriate order, it collapses
16them into a Def that is easier to work with in later phases of compilation.
16them into a Def that is easier to work with in later phases of compilation.
18−type Expr = General.Expr Annotation.Region Def Var.Raw
19+ General.Expr Annotation.Region Def Var.Raw
19−type Expr' = General.Expr' Annotation.Region Def Var.Raw
23+ General.Expr' Annotation.Region Def Var.Raw
21data Def = Definition Pattern.RawPattern Expr (Maybe RawType)
26data Def = Definition Pattern.RawPattern Expr (Maybe RawType)
22 deriving (Show)
27 deriving (Show)
24instance Pretty Def where
30instance Pretty Def where
25 pretty (Definition pattern expr maybeTipe) =
31 pretty (Definition pattern expr maybeTipe) =
26 P.vcat [ annotation, definition ]
32 P.vcat [ annotation, definition ]
28− definition = pretty pattern <+> P.equals <+> pretty expr
35+ pretty pattern <+> P.equals <+> pretty expr
29− annotation = case maybeTipe of
38+ case maybeTipe of
30− Nothing -> P.empty
39+ Nothing ->
31− Just tipe -> pretty pattern <+> P.colon <+> pretty tipe
43+ pretty pattern <+> P.colon <+> pretty tipe