I am trying to write a simple function that would bind to LDAP server and return a IO Bool value so that I can analyze the return in a conditional statement later.
This little snippet below works and prints an error if bind fails but it is not what I need.

I get an error if I try to return anything but IO () by the function that deals with exception. I need it to return IO Bool.

'ldapSimpleBind' just throws an exception if unsuccessful and that's all. Catching exceptions will only allow me to return an IO ()
What I need is to return something meaningful so that I can do something useful with the return value.
I am clearly missing something as the signature of catchLDAP in the docs is :: IO a -> (LDAPException -> IO a) -> IO a

Thanks Adrian, I realize that in the above example it just returns the error. It's my bad I posted example that works with IO () but I actually forgot to post the snippet that I tried with IO Bool and which gave me grief. It looks like I just messed up the parentheses in front of the bind operator. But never mind ... It all works now. Thanks for clearing it up for me.
–
r.sendeckyDec 12 '12 at 6:26