having a bit of trouble with the following code. I keep getting an error message "saying parse error on input 'else' ". I cant see what im doing wrong, i have the else statement indented from the if and the syntax inside the statements are correct. Bit of background, its part of an insertion method for 2-3-4 trees, specifically for inserting where a fournode(Root3) needs to be split into its parent. x y and z are the values in the fournode while c1 - c4 are its child nodes. have looked at other questions on here about these types of errors but couldn't find anything useful :( Anyone have any ideas?
insert t (Root1 a left right) | t <= a = case left of
(Root3 x y z c1 c2 c3 c4) -> if t <= y then Root2 y a (insert t (Root1 x c1 c2) (Root1 z c3 c4) right else Root2 y a (Root1 x c1 c2) (insert t (Root1 z c3 c4)) right
_ -> Root1 a (insert t(left)) (right)