on master help sign in
Improve indentation
commitb7c2f90c457b7c8f58b45a22b674ba857f55964e authorEvan Czaplicki <info@elm-lang.org> dateMon 6 Apr 2015, 15:09 (12 years ago) parentc8532b9
3 files changed+52−21
src/AST/Expression/Canonical.hs+19−7 src/AST/Expression/Source.hs+14−7 src/AST/Expression/Valid.hs+19−7
src/AST/Expression/Canonical.hs+19−7
@@ -14,17 +14,29 @@ import qualified AST.Variable as Var
1414{-| Canonicalized expressions. All variables are fully resolved to the module
1515they came from.
1616-}
17−type Expr = General.Expr Annotation.Region Def Var.Canonical
18−type Expr' = General.Expr' Annotation.Region Def Var.Canonical
17+type Expr =
18+ General.Expr Annotation.Region Def Var.Canonical
19+
20+
21+type Expr' =
22+ General.Expr' Annotation.Region Def Var.Canonical
23+
1924
2025data Def = Definition Pattern.CanonicalPattern Expr (Maybe CanonicalType)
2126 deriving (Show)
2227
28+
2329instance Pretty Def where
2430 pretty (Definition pattern expr maybeTipe) =
2531 P.vcat [ annotation, definition ]
26− where
27− definition = pretty pattern <+> P.equals <+> pretty expr
28− annotation = case maybeTipe of
29− Nothing -> P.empty
30− Just tipe -> pretty pattern <+> P.colon <+> pretty tipe
32+ where
33+ definition =
34+ pretty pattern <+> P.equals <+> pretty expr
35+
36+ annotation =
37+ case maybeTipe of
38+ Nothing ->
39+ P.empty
40+
41+ Just tipe ->
42+ pretty pattern <+> P.colon <+> pretty tipe
src/AST/Expression/Source.hs+14−7
@@ -15,18 +15,25 @@ import qualified AST.Pattern as Pattern
1515annotations and definitions, which is how they appear in source code and how
1616they are parsed.
1717-}
18−type Expr = General.Expr Annotation.Region Def Var.Raw
19−type Expr' = General.Expr' Annotation.Region Def Var.Raw
18+type Expr =
19+ General.Expr Annotation.Region Def Var.Raw
20+
21+
22+type Expr' =
23+ General.Expr' Annotation.Region Def Var.Raw
24+
2025
2126data Def
2227 = Definition Pattern.RawPattern Expr
2328 | TypeAnnotation String RawType
2429 deriving (Show)
2530
31+
2632instance Pretty Def where
2733 pretty def =
28− case def of
29− TypeAnnotation name tipe ->
30− variable name <+> P.colon <+> pretty tipe
31− Definition pattern expr ->
32− pretty pattern <+> P.equals <+> pretty expr
34+ case def of
35+ TypeAnnotation name tipe ->
36+ variable name <+> P.colon <+> pretty tipe
37+
38+ Definition pattern expr ->
39+ pretty pattern <+> P.equals <+> pretty expr
src/AST/Expression/Valid.hs+19−7
@@ -15,17 +15,29 @@ import qualified AST.Pattern as Pattern
1515ports are all paired with definitions in the appropriate order, it collapses
1616them into a Def that is easier to work with in later phases of compilation.
1717-}
18−type Expr = General.Expr Annotation.Region Def Var.Raw
19−type Expr' = General.Expr' Annotation.Region Def Var.Raw
18+type Expr =
19+ General.Expr Annotation.Region Def Var.Raw
20+
21+
22+type Expr' =
23+ General.Expr' Annotation.Region Def Var.Raw
24+
2025
2126data Def = Definition Pattern.RawPattern Expr (Maybe RawType)
2227 deriving (Show)
2328
29+
2430instance Pretty Def where
2531 pretty (Definition pattern expr maybeTipe) =
2632 P.vcat [ annotation, definition ]
27− where
28− definition = pretty pattern <+> P.equals <+> pretty expr
29− annotation = case maybeTipe of
30− Nothing -> P.empty
31− Just tipe -> pretty pattern <+> P.colon <+> pretty tipe
33+ where
34+ definition =
35+ pretty pattern <+> P.equals <+> pretty expr
36+
37+ annotation =
38+ case maybeTipe of
39+ Nothing ->
40+ P.empty
41+
42+ Just tipe ->
43+ pretty pattern <+> P.colon <+> pretty tipe