title: Haskell: LDAP Authentication
body: <p>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.</p>
  
  <pre><code>import LDAP.Init
  import LDAP.Exceptions
  
  auth :: IO ()
  auth = do
    c &lt;- ldapOpen "10.1.1.11" 3268
    let bnd =ldapSimpleBind c "myusername@domain.local" "mypassword"
    catchLDAP bnd (\_ -&gt; error "Wrong user name or password")
  </code></pre>
  
  <p>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.</p>
  
  <p>'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</p>
  
  <p>What am I doing wrong?
  Thanks.</p>