@@ -72,10 +72,13 @@ instance Ord FixDecl where
7272
7373data Plicity = Imp | Exp deriving Show
7474
75−data PDecl' t = PFix Fixity [String] -- fixity declaration
76− | PTy Name t -- type declaration
77− | PClause t t -- pattern clause
78− | PData (PData' t) -- data declaration
75+data PDecl' t = PFix Fixity [String] -- fixity declaration
76+ | PTy Name t -- type declaration
77+ | PClauses [PClause' t] -- pattern clause
78+ | PData (PData' t) -- data declaration
79+ deriving Functor
80+
81+data PClause' t = PClause Name t t
7982 deriving Functor
8083
8184data PData' t = PDatadecl { d_name :: Name,
@@ -86,9 +89,9 @@ data PData' t = PDatadecl { d_name :: Name,
8689-- Handy to get a free function for applying PTerm -> PTerm functions
8790-- across a program, by deriving Functor
8891
89−type PDecl = PDecl' PTerm
90−type PData = PData' PTerm
91−
92+type PDecl = PDecl' PTerm
93+type PData = PData' PTerm
94+type PClause = PClause' PTerm
9295-- High level language terms
9396
9497data PTerm = PQuote Raw
@@ -100,18 +103,26 @@ data PTerm = PQuote Raw
100103 | PSet
101104 | Placeholder
102105
106+--- Pretty printing declarations and terms
107+
103108instance Show PTerm where
104109 show tm = showImp False tm
105110
106111instance Show PDecl where
107112 show (PFix f ops) = show f ++ " " ++ showSep ", " ops
108113 show (PTy n ty) = show n ++ " : " ++ show ty
109− show (PClause l r) = show l ++ " = " ++ show r
114+ show (PClauses c) = showSep "\n" (map show c)
110115 show (PData d) = show d
111116
117+instance Show PClause where
118+ show c = showCImp False c
119+
112120instance Show PData where
113121 show d = showDImp False d
114122
123+showCImp :: Bool -> PClause -> String
124+showCImp impl (PClause n l r) = showImp impl l ++ " = " ++ showImp impl r
125+
115126showDImp :: Bool -> PData -> String
116127showDImp impl (PDatadecl n ty cons)
117128 = "data " ++ show n ++ " : " ++ showImp impl ty ++ " where\n\t"