Compiles again.

master
Philippe Pittoli 2023-05-21 22:10:20 +02:00
parent 089ba00c58
commit df11d8e7aa
1 changed files with 4 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import Data.Codec.Argonaut as CA
import Data.Maybe
import Data.Either
import Data.Codec.Argonaut.Record as CAR
import Data.UInt (fromInt, UInt)
import Data.UInt (fromInt, toInt, UInt)
import Data.Tuple (Tuple(..))
import Data.ArrayBuffer.ArrayBuffer as ArrayBuffer
@ -180,9 +180,10 @@ serialize request
deserialize :: ArrayBuffer -> Effect (Either DecodeError AnswerMessage)
deserialize arraybuffer
= do
case (IPC.fromTypedIPC arraybuffer) of
value <- liftEffect $ IPC.fromTypedIPC arraybuffer
pure $ case (value) of
Left err -> Left (UnknownError $ show err)
Right (Tuple messageTypeNumber string) -> case (decode messageTypeNumber $ J.fromString string) of
Right (Tuple messageTypeNumber string) -> case (decode (toInt messageTypeNumber) $ J.fromString string) of
Left parsingError -> Left parsingError
Right answerMessage -> Right answerMessage