From f7441a54eb2a86e95b3271132d239c46af2b6e2b Mon Sep 17 00:00:00 2001 From: Bram van den Heuvel Date: Fri, 17 Feb 2023 12:15:36 +0100 Subject: [PATCH] Remove old VersionControl.elm --- src/Internal/Api/VersionControl.elm | 61 ----------------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/Internal/Api/VersionControl.elm diff --git a/src/Internal/Api/VersionControl.elm b/src/Internal/Api/VersionControl.elm deleted file mode 100644 index e074f55..0000000 --- a/src/Internal/Api/VersionControl.elm +++ /dev/null @@ -1,61 +0,0 @@ -module Internal.Api.VersionControl exposing (..) - -import Internal.Tools.Exceptions as X -import Task exposing (Task) - - -type alias FinalPackage vin vout = - { supportedVersions : List String - , getEvent : String -> vin -> Task X.Error vout - } - - -type alias SingleVersion pIn pOut cIn cOut = - { version : String - , downcast : cIn -> pIn - , current : cIn -> Task X.Error cOut - , upcast : pOut -> cOut - } - - -firstVersion : SingleVersion () () vin vout -> FinalPackage vin vout -firstVersion packet = - { supportedVersions = [ packet.version ] - , getEvent = - \version -> - if packet.version == version then - packet.current - - else - \_ -> Task.fail X.UnsupportedVersion - } - - -updateWith : SingleVersion pIn pOut vin vout -> FinalPackage pIn pOut -> FinalPackage vin vout -updateWith packet oldFinal = - { supportedVersions = packet.version :: oldFinal.supportedVersions - , getEvent = - \version -> - if packet.version == version then - packet.current - - else - packet.downcast >> oldFinal.getEvent version >> Task.map packet.upcast - } - - -toFunction : FinalPackage vin vout -> List String -> vin -> Task X.Error vout -toFunction final versions x = - let - bestVersion : Maybe String - bestVersion = - versions - |> List.filter (\c -> List.member c final.supportedVersions) - |> List.head - in - case bestVersion of - Nothing -> - Task.fail X.UnsupportedVersion - - Just version -> - final.getEvent version x