{-# LANGUAGE FlexibleContexts #-} module PGIP.GraphQL.Resolver.Signature (resolve) where import PGIP.GraphQL.Resolver.ToResult import PGIP.GraphQL.Result as GraphQLResult import PGIP.Shared import Driver.Options import Persistence.Database import Persistence.Utils import Persistence.Schema as DatabaseSchema import Database.Esqueleto import Control.Monad.IO.Class (MonadIO (..)) resolve :: HetcatsOpts -> Cache -> Int -> IO (Maybe GraphQLResult.Result) resolve :: HetcatsOpts -> Cache -> Int -> IO (Maybe Result) resolve opts :: HetcatsOpts opts _ idVar :: Int idVar = DBConfig -> DBMonad (NoLoggingT IO) (Maybe Result) -> IO (Maybe Result) forall (m :: * -> *) a. (MonadIO m, MonadBaseControl IO m, MonadUnliftIO m, MonadFail m) => DBConfig -> DBMonad (NoLoggingT m) a -> m a onDatabase (HetcatsOpts -> DBConfig databaseConfig HetcatsOpts opts) (DBMonad (NoLoggingT IO) (Maybe Result) -> IO (Maybe Result)) -> DBMonad (NoLoggingT IO) (Maybe Result) -> IO (Maybe Result) forall a b. (a -> b) -> a -> b $ Int -> DBMonad (NoLoggingT IO) (Maybe Result) forall (m :: * -> *). MonadIO m => Int -> DBMonad m (Maybe Result) resolveDB Int idVar resolveDB :: MonadIO m => Int -> DBMonad m (Maybe GraphQLResult.Result) resolveDB :: Int -> DBMonad m (Maybe Result) resolveDB idVar :: Int idVar = do [Entity Signature] signatureL <- SqlQuery (SqlExpr (Entity Signature)) -> ReaderT SqlBackend m [Entity Signature] forall a r (m :: * -> *). (SqlSelect a r, MonadIO m) => SqlQuery a -> SqlReadT m [r] select (SqlQuery (SqlExpr (Entity Signature)) -> ReaderT SqlBackend m [Entity Signature]) -> SqlQuery (SqlExpr (Entity Signature)) -> ReaderT SqlBackend m [Entity Signature] forall a b. (a -> b) -> a -> b $ (SqlExpr (Entity Signature) -> SqlQuery (SqlExpr (Entity Signature))) -> SqlQuery (SqlExpr (Entity Signature)) forall a b. From a => (a -> SqlQuery b) -> SqlQuery b from ((SqlExpr (Entity Signature) -> SqlQuery (SqlExpr (Entity Signature))) -> SqlQuery (SqlExpr (Entity Signature))) -> (SqlExpr (Entity Signature) -> SqlQuery (SqlExpr (Entity Signature))) -> SqlQuery (SqlExpr (Entity Signature)) forall a b. (a -> b) -> a -> b $ \signatures :: SqlExpr (Entity Signature) signatures -> do SqlExpr (Value Bool) -> SqlQuery () where_ (SqlExpr (Entity Signature) signatures SqlExpr (Entity Signature) -> EntityField Signature (Key Signature) -> SqlExpr (Value (Key Signature)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField Signature (Key Signature) forall typ. (typ ~ Key Signature) => EntityField Signature typ SignatureId SqlExpr (Value (Key Signature)) -> SqlExpr (Value (Key Signature)) -> SqlExpr (Value Bool) forall typ. PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) ==. Key Signature -> SqlExpr (Value (Key Signature)) forall typ. PersistField typ => typ -> SqlExpr (Value typ) val (Int64 -> Key Signature forall record. ToBackendKey SqlBackend record => Int64 -> Key record toSqlKey (Int64 -> Key Signature) -> Int64 -> Key Signature forall a b. (a -> b) -> a -> b $ Int -> Int64 forall a b. (Integral a, Num b) => a -> b fromIntegral Int idVar)) SqlExpr (Entity Signature) -> SqlQuery (SqlExpr (Entity Signature)) forall (m :: * -> *) a. Monad m => a -> m a return SqlExpr (Entity Signature) signatures case [Entity Signature] signatureL of [] -> Maybe Result -> DBMonad m (Maybe Result) forall (m :: * -> *) a. Monad m => a -> m a return Maybe Result forall a. Maybe a Nothing signatureEntity :: Entity Signature signatureEntity@(Entity signatureKey :: Key Signature signatureKey _) : _ -> do [Entity LocIdBase] omsL <- SqlQuery (SqlExpr (Entity LocIdBase)) -> ReaderT SqlBackend m [Entity LocIdBase] forall a r (m :: * -> *). (SqlSelect a r, MonadIO m) => SqlQuery a -> SqlReadT m [r] select (SqlQuery (SqlExpr (Entity LocIdBase)) -> ReaderT SqlBackend m [Entity LocIdBase]) -> SqlQuery (SqlExpr (Entity LocIdBase)) -> ReaderT SqlBackend m [Entity LocIdBase] forall a b. (a -> b) -> a -> b $ (InnerJoin (SqlExpr (Entity OMS)) (SqlExpr (Entity LocIdBase)) -> SqlQuery (SqlExpr (Entity LocIdBase))) -> SqlQuery (SqlExpr (Entity LocIdBase)) forall a b. From a => (a -> SqlQuery b) -> SqlQuery b from ((InnerJoin (SqlExpr (Entity OMS)) (SqlExpr (Entity LocIdBase)) -> SqlQuery (SqlExpr (Entity LocIdBase))) -> SqlQuery (SqlExpr (Entity LocIdBase))) -> (InnerJoin (SqlExpr (Entity OMS)) (SqlExpr (Entity LocIdBase)) -> SqlQuery (SqlExpr (Entity LocIdBase))) -> SqlQuery (SqlExpr (Entity LocIdBase)) forall a b. (a -> b) -> a -> b $ \(omsSql :: SqlExpr (Entity OMS) omsSql `InnerJoin` loc_id_bases :: SqlExpr (Entity LocIdBase) loc_id_bases) -> do SqlExpr (Value Bool) -> SqlQuery () on (SqlExpr (Value (Key OMS)) -> SqlExpr (Value (Key LocIdBase)) forall a b. SqlExpr (Value a) -> SqlExpr (Value b) coerceId (SqlExpr (Entity OMS) omsSql SqlExpr (Entity OMS) -> EntityField OMS (Key OMS) -> SqlExpr (Value (Key OMS)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField OMS (Key OMS) forall typ. (typ ~ Key OMS) => EntityField OMS typ OMSId) SqlExpr (Value (Key LocIdBase)) -> SqlExpr (Value (Key LocIdBase)) -> SqlExpr (Value Bool) forall typ. PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) ==. SqlExpr (Entity LocIdBase) loc_id_bases SqlExpr (Entity LocIdBase) -> EntityField LocIdBase (Key LocIdBase) -> SqlExpr (Value (Key LocIdBase)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField LocIdBase (Key LocIdBase) forall typ. (typ ~ Key LocIdBase) => EntityField LocIdBase typ LocIdBaseId) SqlExpr (Value Bool) -> SqlQuery () where_ (SqlExpr (Entity OMS) omsSql SqlExpr (Entity OMS) -> EntityField OMS (Key Signature) -> SqlExpr (Value (Key Signature)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField OMS (Key Signature) forall typ. (typ ~ Key Signature) => EntityField OMS typ OMSSignatureId SqlExpr (Value (Key Signature)) -> SqlExpr (Value (Key Signature)) -> SqlExpr (Value Bool) forall typ. PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) ==. Key Signature -> SqlExpr (Value (Key Signature)) forall typ. PersistField typ => typ -> SqlExpr (Value typ) val Key Signature signatureKey) SqlExpr (Entity LocIdBase) -> SqlQuery (SqlExpr (Entity LocIdBase)) forall (m :: * -> *) a. Monad m => a -> m a return SqlExpr (Entity LocIdBase) loc_id_bases [Entity SignatureMorphism] signatureMorphismsAsSourceL <- SqlQuery (SqlExpr (Entity SignatureMorphism)) -> ReaderT SqlBackend m [Entity SignatureMorphism] forall a r (m :: * -> *). (SqlSelect a r, MonadIO m) => SqlQuery a -> SqlReadT m [r] select (SqlQuery (SqlExpr (Entity SignatureMorphism)) -> ReaderT SqlBackend m [Entity SignatureMorphism]) -> SqlQuery (SqlExpr (Entity SignatureMorphism)) -> ReaderT SqlBackend m [Entity SignatureMorphism] forall a b. (a -> b) -> a -> b $ (SqlExpr (Entity SignatureMorphism) -> SqlQuery (SqlExpr (Entity SignatureMorphism))) -> SqlQuery (SqlExpr (Entity SignatureMorphism)) forall a b. From a => (a -> SqlQuery b) -> SqlQuery b from ((SqlExpr (Entity SignatureMorphism) -> SqlQuery (SqlExpr (Entity SignatureMorphism))) -> SqlQuery (SqlExpr (Entity SignatureMorphism))) -> (SqlExpr (Entity SignatureMorphism) -> SqlQuery (SqlExpr (Entity SignatureMorphism))) -> SqlQuery (SqlExpr (Entity SignatureMorphism)) forall a b. (a -> b) -> a -> b $ \signature_morphisms :: SqlExpr (Entity SignatureMorphism) signature_morphisms -> do SqlExpr (Value Bool) -> SqlQuery () where_ (SqlExpr (Entity SignatureMorphism) signature_morphisms SqlExpr (Entity SignatureMorphism) -> EntityField SignatureMorphism (Key Signature) -> SqlExpr (Value (Key Signature)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField SignatureMorphism (Key Signature) forall typ. (typ ~ Key Signature) => EntityField SignatureMorphism typ SignatureMorphismSourceId SqlExpr (Value (Key Signature)) -> SqlExpr (Value (Key Signature)) -> SqlExpr (Value Bool) forall typ. PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) ==. Key Signature -> SqlExpr (Value (Key Signature)) forall typ. PersistField typ => typ -> SqlExpr (Value typ) val Key Signature signatureKey) SqlExpr (Entity SignatureMorphism) -> SqlQuery (SqlExpr (Entity SignatureMorphism)) forall (m :: * -> *) a. Monad m => a -> m a return SqlExpr (Entity SignatureMorphism) signature_morphisms [Entity SignatureMorphism] signatureMorphismsAsTargetL <- SqlQuery (SqlExpr (Entity SignatureMorphism)) -> ReaderT SqlBackend m [Entity SignatureMorphism] forall a r (m :: * -> *). (SqlSelect a r, MonadIO m) => SqlQuery a -> SqlReadT m [r] select (SqlQuery (SqlExpr (Entity SignatureMorphism)) -> ReaderT SqlBackend m [Entity SignatureMorphism]) -> SqlQuery (SqlExpr (Entity SignatureMorphism)) -> ReaderT SqlBackend m [Entity SignatureMorphism] forall a b. (a -> b) -> a -> b $ (SqlExpr (Entity SignatureMorphism) -> SqlQuery (SqlExpr (Entity SignatureMorphism))) -> SqlQuery (SqlExpr (Entity SignatureMorphism)) forall a b. From a => (a -> SqlQuery b) -> SqlQuery b from ((SqlExpr (Entity SignatureMorphism) -> SqlQuery (SqlExpr (Entity SignatureMorphism))) -> SqlQuery (SqlExpr (Entity SignatureMorphism))) -> (SqlExpr (Entity SignatureMorphism) -> SqlQuery (SqlExpr (Entity SignatureMorphism))) -> SqlQuery (SqlExpr (Entity SignatureMorphism)) forall a b. (a -> b) -> a -> b $ \signature_morphisms :: SqlExpr (Entity SignatureMorphism) signature_morphisms -> do SqlExpr (Value Bool) -> SqlQuery () where_ (SqlExpr (Entity SignatureMorphism) signature_morphisms SqlExpr (Entity SignatureMorphism) -> EntityField SignatureMorphism (Key Signature) -> SqlExpr (Value (Key Signature)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField SignatureMorphism (Key Signature) forall typ. (typ ~ Key Signature) => EntityField SignatureMorphism typ SignatureMorphismTargetId SqlExpr (Value (Key Signature)) -> SqlExpr (Value (Key Signature)) -> SqlExpr (Value Bool) forall typ. PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) ==. Key Signature -> SqlExpr (Value (Key Signature)) forall typ. PersistField typ => typ -> SqlExpr (Value typ) val Key Signature signatureKey) SqlExpr (Entity SignatureMorphism) -> SqlQuery (SqlExpr (Entity SignatureMorphism)) forall (m :: * -> *) a. Monad m => a -> m a return SqlExpr (Entity SignatureMorphism) signature_morphisms [(Entity LocIdBase, Entity Symbol, Maybe (Entity FileRange))] symbolsWithFileRanges <- SqlQuery (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange))) -> ReaderT SqlBackend m [(Entity LocIdBase, Entity Symbol, Maybe (Entity FileRange))] forall a r (m :: * -> *). (SqlSelect a r, MonadIO m) => SqlQuery a -> SqlReadT m [r] select (SqlQuery (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange))) -> ReaderT SqlBackend m [(Entity LocIdBase, Entity Symbol, Maybe (Entity FileRange))]) -> SqlQuery (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange))) -> ReaderT SqlBackend m [(Entity LocIdBase, Entity Symbol, Maybe (Entity FileRange))] forall a b. (a -> b) -> a -> b $ (LeftOuterJoin (InnerJoin (InnerJoin (InnerJoin (SqlExpr (Entity Signature)) (SqlExpr (Entity SignatureSymbol))) (SqlExpr (Entity LocIdBase))) (SqlExpr (Entity Symbol))) (SqlExpr (Maybe (Entity FileRange))) -> SqlQuery (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange)))) -> SqlQuery (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange))) forall a b. From a => (a -> SqlQuery b) -> SqlQuery b from ((LeftOuterJoin (InnerJoin (InnerJoin (InnerJoin (SqlExpr (Entity Signature)) (SqlExpr (Entity SignatureSymbol))) (SqlExpr (Entity LocIdBase))) (SqlExpr (Entity Symbol))) (SqlExpr (Maybe (Entity FileRange))) -> SqlQuery (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange)))) -> SqlQuery (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange)))) -> (LeftOuterJoin (InnerJoin (InnerJoin (InnerJoin (SqlExpr (Entity Signature)) (SqlExpr (Entity SignatureSymbol))) (SqlExpr (Entity LocIdBase))) (SqlExpr (Entity Symbol))) (SqlExpr (Maybe (Entity FileRange))) -> SqlQuery (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange)))) -> SqlQuery (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange))) forall a b. (a -> b) -> a -> b $ \ (signatures :: SqlExpr (Entity Signature) signatures `InnerJoin` signature_symbols :: SqlExpr (Entity SignatureSymbol) signature_symbols `InnerJoin` loc_id_bases :: SqlExpr (Entity LocIdBase) loc_id_bases `InnerJoin` symbolsSql :: SqlExpr (Entity Symbol) symbolsSql `LeftOuterJoin` file_ranges :: SqlExpr (Maybe (Entity FileRange)) file_ranges) -> do SqlExpr (Value Bool) -> SqlQuery () on (SqlExpr (Maybe (Entity FileRange)) file_ranges SqlExpr (Maybe (Entity FileRange)) -> EntityField FileRange (Key FileRange) -> SqlExpr (Value (Maybe (Key FileRange))) forall val typ. (PersistEntity val, PersistField typ) => SqlExpr (Maybe (Entity val)) -> EntityField val typ -> SqlExpr (Value (Maybe typ)) ?. EntityField FileRange (Key FileRange) forall typ. (typ ~ Key FileRange) => EntityField FileRange typ FileRangeId SqlExpr (Value (Maybe (Key FileRange))) -> SqlExpr (Value (Maybe (Key FileRange))) -> SqlExpr (Value Bool) forall typ. PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) ==. SqlExpr (Entity Symbol) symbolsSql SqlExpr (Entity Symbol) -> EntityField Symbol (Maybe (Key FileRange)) -> SqlExpr (Value (Maybe (Key FileRange))) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField Symbol (Maybe (Key FileRange)) forall typ. (typ ~ Maybe (Key FileRange)) => EntityField Symbol typ SymbolFileRangeId) SqlExpr (Value Bool) -> SqlQuery () on (SqlExpr (Value (Key Symbol)) -> SqlExpr (Value (Key LocIdBase)) forall a b. SqlExpr (Value a) -> SqlExpr (Value b) coerceId (SqlExpr (Entity Symbol) symbolsSql SqlExpr (Entity Symbol) -> EntityField Symbol (Key Symbol) -> SqlExpr (Value (Key Symbol)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField Symbol (Key Symbol) forall typ. (typ ~ Key Symbol) => EntityField Symbol typ SymbolId) SqlExpr (Value (Key LocIdBase)) -> SqlExpr (Value (Key LocIdBase)) -> SqlExpr (Value Bool) forall typ. PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) ==. SqlExpr (Entity LocIdBase) loc_id_bases SqlExpr (Entity LocIdBase) -> EntityField LocIdBase (Key LocIdBase) -> SqlExpr (Value (Key LocIdBase)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField LocIdBase (Key LocIdBase) forall typ. (typ ~ Key LocIdBase) => EntityField LocIdBase typ LocIdBaseId) SqlExpr (Value Bool) -> SqlQuery () on (SqlExpr (Entity LocIdBase) loc_id_bases SqlExpr (Entity LocIdBase) -> EntityField LocIdBase (Key LocIdBase) -> SqlExpr (Value (Key LocIdBase)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField LocIdBase (Key LocIdBase) forall typ. (typ ~ Key LocIdBase) => EntityField LocIdBase typ LocIdBaseId SqlExpr (Value (Key LocIdBase)) -> SqlExpr (Value (Key LocIdBase)) -> SqlExpr (Value Bool) forall typ. PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) ==. SqlExpr (Entity SignatureSymbol) signature_symbols SqlExpr (Entity SignatureSymbol) -> EntityField SignatureSymbol (Key LocIdBase) -> SqlExpr (Value (Key LocIdBase)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField SignatureSymbol (Key LocIdBase) forall typ. (typ ~ Key LocIdBase) => EntityField SignatureSymbol typ SignatureSymbolSymbolId) SqlExpr (Value Bool) -> SqlQuery () on (SqlExpr (Entity SignatureSymbol) signature_symbols SqlExpr (Entity SignatureSymbol) -> EntityField SignatureSymbol (Key Signature) -> SqlExpr (Value (Key Signature)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField SignatureSymbol (Key Signature) forall typ. (typ ~ Key Signature) => EntityField SignatureSymbol typ SignatureSymbolSignatureId SqlExpr (Value (Key Signature)) -> SqlExpr (Value (Key Signature)) -> SqlExpr (Value Bool) forall typ. PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) ==. SqlExpr (Entity Signature) signatures SqlExpr (Entity Signature) -> EntityField Signature (Key Signature) -> SqlExpr (Value (Key Signature)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField Signature (Key Signature) forall typ. (typ ~ Key Signature) => EntityField Signature typ SignatureId) SqlExpr (Value Bool) -> SqlQuery () where_ (SqlExpr (Entity Signature) signatures SqlExpr (Entity Signature) -> EntityField Signature (Key Signature) -> SqlExpr (Value (Key Signature)) forall typ val. (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) ^. EntityField Signature (Key Signature) forall typ. (typ ~ Key Signature) => EntityField Signature typ SignatureId SqlExpr (Value (Key Signature)) -> SqlExpr (Value (Key Signature)) -> SqlExpr (Value Bool) forall typ. PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) ==. Key Signature -> SqlExpr (Value (Key Signature)) forall typ. PersistField typ => typ -> SqlExpr (Value typ) val Key Signature signatureKey) (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange))) -> SqlQuery (SqlExpr (Entity LocIdBase), SqlExpr (Entity Symbol), SqlExpr (Maybe (Entity FileRange))) forall (m :: * -> *) a. Monad m => a -> m a return (SqlExpr (Entity LocIdBase) loc_id_bases, SqlExpr (Entity Symbol) symbolsSql, SqlExpr (Maybe (Entity FileRange)) file_ranges) Maybe Result -> DBMonad m (Maybe Result) forall (m :: * -> *) a. Monad m => a -> m a return (Maybe Result -> DBMonad m (Maybe Result)) -> Maybe Result -> DBMonad m (Maybe Result) forall a b. (a -> b) -> a -> b $ Result -> Maybe Result forall a. a -> Maybe a Just (Result -> Maybe Result) -> Result -> Maybe Result forall a b. (a -> b) -> a -> b $ Signature -> Result SignatureResult (Signature -> Result) -> Signature -> Result forall a b. (a -> b) -> a -> b $ Entity Signature -> [Entity LocIdBase] -> [Entity SignatureMorphism] -> [Entity SignatureMorphism] -> [(Entity LocIdBase, Entity Symbol, Maybe (Entity FileRange))] -> Signature signatureToResult Entity Signature signatureEntity [Entity LocIdBase] omsL [Entity SignatureMorphism] signatureMorphismsAsSourceL [Entity SignatureMorphism] signatureMorphismsAsTargetL [(Entity LocIdBase, Entity Symbol, Maybe (Entity FileRange))] symbolsWithFileRanges