projects
/
matthijs
/
master-project
/
cλash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0649eca
)
Learn flattenExpr about Let expressions.
author
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Wed, 11 Feb 2009 11:48:36 +0000
(12:48 +0100)
committer
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Wed, 11 Feb 2009 11:48:36 +0000
(12:48 +0100)
Flatten.hs
patch
|
blob
|
history
diff --git
a/Flatten.hs
b/Flatten.hs
index 7dc261e8d23138f90865b0f083ec45f04c71f598..20efce59225fff2d4409663262c0885208f1cb1c 100644
(file)
--- a/
Flatten.hs
+++ b/
Flatten.hs
@@
-294,6
+294,17
@@
flattenExpr binds app@(App _ _) = do
then error $ "Passing lambda expression or function as a function argument not supported: " ++ (showSDoc $ ppr arg)
else flat
then error $ "Passing lambda expression or function as a function argument not supported: " ++ (showSDoc $ ppr arg)
else flat
+flattenExpr binds l@(Let (NonRec b bexpr) expr) = do
+ (b_args, b_res) <- flattenExpr binds bexpr
+ if not (null b_args)
+ then
+ error $ "Higher order functions not supported in let expression: " ++ (showSDoc $ ppr l)
+ else
+ let binds' = (b, Left b_res) : binds in
+ flattenExpr binds' expr
+
+flattenExpr binds l@(Let (Rec _) _) = error $ "Recursive let definitions not supported: " ++ (showSDoc $ ppr l)
+
flattenExpr _ _ = do
return ([], Tuple [])
flattenExpr _ _ = do
return ([], Tuple [])