1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
module PevalBase
( FunLhs, mkFuncCall
, Resultant, ppResultants, ppResultant
, Renaming, ppRenaming
) where
import Pretty hiding (indent)
import FlatCurry.Types
import FlatCurryGoodies
import FlatCurryPretty
type FunLhs = (QName, [VarIndex])
ppLhs :: FunLhs -> Doc
ppLhs = ppExp . mkFuncCall
mkFuncCall :: FunLhs -> Expr
mkFuncCall (f, vs) = Comb FuncCall f (map Var vs)
type Resultant = (FunLhs, Expr)
ppResultants :: [Resultant] -> Doc
ppResultants = compose (<$+$>) . map ppResultant
ppResultant :: Resultant -> Doc
ppResultant (lhs, rhs) = hsep [ppLhs lhs, equals, ppExp rhs]
type Renaming = [(Expr, FunLhs)]
ppRenaming :: Renaming -> Doc
ppRenaming = compose (<$+$>) . map ppRen
where ppRen (l, r) = indent (ppExp l) $$ char '\8658' <+> indent (ppLhs r)
|