 
 import TinySQLite
 
-public enum ResultType {
-    case Success(data: Any?)
-    case Error(error: ErrorType)
+public enum Result<A: Any> {
+    case Success(A)
+    case Error(ErrorType)
 }
 
 extension SwiftyDB {

     - parameter type:      type of the objects to be retrieved
    */
    
    public func dataForType <S: Storable> (type: S.Type, matchingFilters filters: [String: SQLiteValue?] = [:], withCompletionHandler completionHandler: ((ResultType)->Void)) {
        
        dispatch_async(queue) { () -> Void in
            do {
                let data = try self.dataForType(type, matchingFilters: filters)
                completionHandler(ResultType.Success(data: data))
            } catch let error {
                completionHandler(ResultType.Error(error: error))
            }
        }
    }

     - parameter type:      type of the objects to be retrieved
    */
    
    public func objectsForType <D where D: Storable, D: NSObject> (type: D.Type, matchingFilters filters: [String: SQLiteValue?] = [:], withCompletionHandler completionHandler: ((Result<[D]>)->Void)) {
        
        dispatch_async(queue) { () -> Void in
            do {
                let objects = try self.objectsForType(type, matchingFilters: filters)
                completionHandler(Result.Success(objects))
            } catch let error {
                completionHandler(Result.Error(error))
            }
        }
    }
