id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
4798	Make HsIf more polymorphic with RebindableSyntax	nsch	nsch	"Currently, ifThenElse is typed this way:

{{{
ifThenElse :: pred_ty -> b_ty -> b_ty -> res_ty
}}}

I propose to change this to:

{{{
ifThenElse :: pred_ty -> b1_ty -> b2_ty -> res_ty
}}}

to support expressions like this:

{{{
ifThenElse :: Maybe a -> (a -> b) -> b -> b
ifThenElse (Just a) f _ = f a
ifThenElse Nothing  _ e = e

example :: String
example = if Just 2
             then \v -> show v
             else ""No value""
}}}

The fix is very simple and just one more line to add to the typechecker. Patch is attached."	feature request	closed	normal		Compiler (Type checker)	7.0.1	fixed			Unknown/Multiple	Unknown/Multiple	None/Unknown					
