Fix compiler bugs

4-compiler-bug
Bram 2024-05-26 18:53:31 +02:00
parent 4349a14a87
commit e335c150f0
7 changed files with 24 additions and 8 deletions

View File

@ -1,4 +1,4 @@
module Internal.Api.BaseUrl.Api exposing (..)
module Internal.Api.BaseUrl.Api exposing (baseUrl)
{-|
@ -7,6 +7,8 @@ module Internal.Api.BaseUrl.Api exposing (..)
This module looks for the right homeserver address.
@docs baseUrl
-}
import Internal.Api.Chain as C
@ -19,6 +21,8 @@ import Internal.Values.Envelope as E
import Internal.Values.Vault as V
{-| Get the homeserver base URL of a given server name.
-}
baseUrl : BaseUrlInput -> C.TaskChain R.Error (E.EnvelopeUpdate V.VaultUpdate) ph { ph | baseUrl : () }
baseUrl data =
R.toChain

View File

@ -22,6 +22,8 @@ import Internal.Values.Vault as V
import Json.Encode as E
{-| Log in using a username and password.
-}
loginWithUsernameAndPassword : LoginWithUsernameAndPasswordInput -> A.TaskChain (Phantom a) (Phantom { a | accessToken : () })
loginWithUsernameAndPassword =
A.startWithVersion "r0.0.0" loginWithUsernameAndPasswordV1
@ -46,8 +48,10 @@ loginWithUsernameAndPassword =
|> A.versionChain
{-| Context needed for logging in with a username and password
-}
type alias Phantom a =
{ a | baseUrl : (), versions : () }
{ a | baseUrl : (), now : (), versions : () }
type alias LoginWithUsernameAndPasswordInput =

View File

@ -28,6 +28,8 @@ import Internal.Values.Context as Context
import Internal.Values.Envelope as E
{-| Update message type that is being returned.
-}
type alias Msg =
Backpack

View File

@ -19,6 +19,8 @@ import Task
import Time
{-| Get the current time and place it in the context.
-}
getNow : A.TaskChain a { a | now : () }
getNow =
\_ ->

View File

@ -1,4 +1,4 @@
module Internal.Api.SendMessageEvent.Api exposing (..)
module Internal.Api.SendMessageEvent.Api exposing (Phantom, sendMessageEvent)
{-|
@ -7,7 +7,7 @@ module Internal.Api.SendMessageEvent.Api exposing (..)
This module helps send message events to rooms on the Matrix API.
@docs Phantom
@docs Phantom, sendMessageEvent
-}
@ -19,6 +19,8 @@ import Internal.Tools.Json as Json
import Internal.Values.Envelope as E
{-| Send a message event to the Matrix room.
-}
sendMessageEvent : SendMessageEventInput -> A.TaskChain (Phantom a) (Phantom a)
sendMessageEvent =
A.startWithVersion "r0.0.0" sendMessageEventV1
@ -44,8 +46,10 @@ sendMessageEvent =
|> A.versionChain
{-| Context needed for sending a message event
-}
type alias Phantom a =
a
{ a | accessToken : (), baseUrl : (), versions : () }
type alias PhantomV1 a =

View File

@ -65,7 +65,7 @@ type alias UFTask a b =
{-| Get an access token to talk to the Matrix API
-}
getAccessToken : UFTask { a | now : () } { a | accessToken : (), now : () }
getAccessToken : UFTask { a | baseUrl : (), now : (), versions : () } { a | accessToken : (), baseUrl : (), now : (), versions : () }
getAccessToken c =
case Context.fromApiFormat c of
context ->

View File

@ -56,6 +56,6 @@ sent a new message? Did someone send us an invite for a new room?
-}
update : VaultUpdate -> Vault -> Vault
update (VaultUpdate vu) (Vault vault) =
vault
|> Envelope.update Internal.update vu
vu.messages
|> List.foldl (Envelope.update Internal.update) vault
|> Vault