 
 import Foundation
 
-public typealias LazyInit<Service> = () -> (Service)
+public typealias ServiceName = String
 
 public enum ServiceLocatorError: Error {
-    case duplicateService(String)
-    case duplicateLazyService(String)
+    case duplicateService(ServiceName)
+    case duplicateLazyService(ServiceName)
     case inexistentService
-    case serviceTypeMismatch(expected: String, found: String)
-    case lazyServiceTypeMismatch(expected: String, found: String)
+    case serviceTypeMismatch(expected: Any.Type, found: Any.Type)
+    case lazyServiceTypeMismatch(expected: Any.Type, found: Any.Type)
 }
 
 public final class ServiceLocator {
+
+    public typealias LazyInit<Service> = () -> (Service)
 
     private enum RegisteredService {
         case normal(Any)


    private func validateTypeAndReturn<Service>(lazyInit anyServiceInit: Any) throws -> Service {
        guard let serviceClosure = anyServiceInit as? LazyInit<Service> else {
            throw ServiceLocatorError.lazyServiceTypeMismatch(expected: "\(LazyInit<Service>.self)",
                found: "\(type(of: anyServiceInit))")
        }

        return serviceClosure()


    // MARK: - Private Methods

    private func locate<Service>(_ name: ServiceName) throws -> Service {
        guard let service = services[name] else { throw ServiceLocatorError.inexistentService }

        switch service {
