*/
@Override
public Expression simplify(SimplificationContext context) {
- value = value.simplify(context);
- in = in.simplify(context);
- pattern = pattern.simplify(context);
-
long loc = getLocation();
monadType = Types.canonical(monadType);
valueContentType = Types.canonical(valueContentType);
Type[] types = blockType == BlockType.MonadE
? new Type[] {monadType, valueContentType, effect, inContentType}
: new Type[] {monadType, valueContentType, inContentType};
- Expression simplified = new EApply(loc,
+ Expression simplified = new EApply(loc, effect,
new EConstant(loc, context.getValue(blockType == BlockType.MonadE ? Names.Prelude_bindE : Names.Prelude_bind), types),
monadEvidence,
value,
- new ELambda(loc, new Case[] {
+ new ELambda(loc, effect, new Case[] {
new Case(new Expression[] { pattern }, in)
}));
simplified.setType(getType());
this.cases = cases;
}
+ public ELambda(long loc, Type effect, Case ... cases) {
+ super(loc);
+ this.cases = cases;
+ this.effect = effect;
+ }
+
public ELambda(long loc, Expression pat, Expression exp) {
this(loc, new Case(new Expression[] {pat}, exp));
}
@Test public void MonadBug1() { test(); }
@Test public void Monads1() { test(); }
@Test public void MonadSyntax1() { test(); }
- @Test public void MonadSyntax3() { test(); }
+ @Test public void MonadSyntax3() { test(); }
+ @Test public void MonadSyntax4() { test(); }
@Test public void NoDefinitionErrorMessage() { test(); }
@Test public void NoInstance() { test(); }
@Test public void NoInstance2() { test(); }