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. This module looks for the right homeserver address.
@docs baseUrl
-} -}
import Internal.Api.Chain as C import Internal.Api.Chain as C
@ -19,6 +21,8 @@ import Internal.Values.Envelope as E
import Internal.Values.Vault as V 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 : BaseUrlInput -> C.TaskChain R.Error (E.EnvelopeUpdate V.VaultUpdate) ph { ph | baseUrl : () }
baseUrl data = baseUrl data =
R.toChain R.toChain

View File

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

View File

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

View File

@ -19,6 +19,8 @@ import Task
import Time import Time
{-| Get the current time and place it in the context.
-}
getNow : A.TaskChain a { a | now : () } getNow : A.TaskChain a { a | now : () }
getNow = 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. 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 import Internal.Values.Envelope as E
{-| Send a message event to the Matrix room.
-}
sendMessageEvent : SendMessageEventInput -> A.TaskChain (Phantom a) (Phantom a) sendMessageEvent : SendMessageEventInput -> A.TaskChain (Phantom a) (Phantom a)
sendMessageEvent = sendMessageEvent =
A.startWithVersion "r0.0.0" sendMessageEventV1 A.startWithVersion "r0.0.0" sendMessageEventV1
@ -44,8 +46,10 @@ sendMessageEvent =
|> A.versionChain |> A.versionChain
{-| Context needed for sending a message event
-}
type alias Phantom a = type alias Phantom a =
a { a | accessToken : (), baseUrl : (), versions : () }
type alias PhantomV1 a = 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 {-| 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 = getAccessToken c =
case Context.fromApiFormat c of case Context.fromApiFormat c of
context -> 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 -> Vault -> Vault
update (VaultUpdate vu) (Vault vault) = update (VaultUpdate vu) (Vault vault) =
vault vu.messages
|> Envelope.update Internal.update vu |> List.foldl (Envelope.update Internal.update) vault
|> Vault |> Vault