Skip to content

Commit

Permalink
Fix #364
Browse files Browse the repository at this point in the history
The monadic map over types did not properly recurse for the result type
of an arrow type (it called `f result` rather than `typeMapM f result`).
  • Loading branch information
EliasC committed Apr 7, 2016
1 parent 57e1173 commit d3fc30a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/tests/encore/basic/functionCast.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def fun() : (String, String) {
("Hello", "world")
}

class Main {
def main() : void {
let foo = fun : () -> (String, String);
match foo() with
(h, w) => print("{} {}\n", h, w)
}
}
1 change: 1 addition & 0 deletions src/tests/encore/basic/functionCast.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello world
2 changes: 1 addition & 1 deletion src/types/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ typeMapM f ty@CapabilityType{capability} = do
f ty{capability = capability'}
typeMapM f ty@ArrowType{argTypes, resultType} = do
argTypes' <- mapM (typeMapM f) argTypes
resultType' <- f resultType
resultType' <- typeMapM f resultType
f ty{argTypes = argTypes'
,resultType = resultType'}
typeMapM f ty@TupleType{argTypes} = do
Expand Down

0 comments on commit d3fc30a

Please sign in to comment.