diff --git a/src/BitWriter.elm b/src/BitWriter.elm index c87e8c9..8f42393 100644 --- a/src/BitWriter.elm +++ b/src/BitWriter.elm @@ -14,17 +14,17 @@ import Bytes.Encode as BE empty : BitWriter empty = - BitWriter { running = Nothing, collected = BE.sequence [], offset = 0 } + BitWriter { running = Nothing, collected = [], offset = 0 } run : BitWriter -> Bytes run (BitWriter { running, collected }) = case running of Nothing -> - BE.encode collected + BE.encode (collected |> List.reverse |> BE.sequence) Just { value } -> - BE.sequence [ collected, BE.unsignedInt8 value ] |> BE.encode + BE.sequence (BE.unsignedInt8 value :: collected |> List.reverse) |> BE.encode type BitWriter @@ -35,7 +35,7 @@ type BitWriter , length : Int } , offset : Int - , collected : BE.Encoder + , collected : List BE.Encoder } @@ -68,7 +68,7 @@ bit b (BitWriter { running, collected, offset }) = if length == 7 then BitWriter { running = Nothing - , collected = BE.sequence [ collected, BE.unsignedInt8 newValue ] + , collected = BE.unsignedInt8 newValue :: collected , offset = newOffset } diff --git a/src/Ur/Requests.elm b/src/Ur/Requests.elm index e29abf0..79cbbff 100644 --- a/src/Ur/Requests.elm +++ b/src/Ur/Requests.elm @@ -98,7 +98,7 @@ toNoun eventId req = C.cell (C.cord app) (C.listOf C.cord path) Unsubscribe subId -> - C.cell (C.cord "usubscribe") <| + C.cell (C.cord "unsubscribe") <| C.cell (C.int eventId) (C.int subId) Poke { ship, agent, mark, noun } -> diff --git a/src/Ur/Run.elm b/src/Ur/Run.elm index bd4f3d6..b97c814 100644 --- a/src/Ur/Run.elm +++ b/src/Ur/Run.elm @@ -178,7 +178,7 @@ update inp msg model = processUrSubs model.eventId model.subscriptions - (inp.urbitSubscriptions model.app |> (\(Ur.Sub.Internal.Sub x) -> x)) + (inp.urbitSubscriptions appModel |> (\(Ur.Sub.Internal.Sub x) -> x)) ( eventId_, cmds, urReqs ) = processCmd subsResult.eventId appCmds @@ -282,7 +282,7 @@ update inp msg model = ( model, Cmd.none ) else - case D.run (D.cell D.ignore (D.cell D.ignore deconstructor) |> D.map (\((), ((), m)) -> m)) rest of + case D.run (D.cell D.ignore (D.cell D.ignore deconstructor) |> D.map (\( (), ( (), m ) ) -> m)) rest of Just subMsg -> ( model_, pureCmd (AppMsg subMsg) ) diff --git a/src/Ur/Uw.elm b/src/Ur/Uw.elm index 780fa11..d73c6db 100644 --- a/src/Ur/Uw.elm +++ b/src/Ur/Uw.elm @@ -29,24 +29,24 @@ decode string = -- 0w |> List.drop 2 - go : List Char -> BW.BitWriter -> BW.BitWriter - go cs writer = + go : List Char -> List Int -> BW.BitWriter -> BW.BitWriter + go cs append writer = case cs of [] -> - writer + BW.bits append writer '.' :: rest -> - go rest writer + go rest append writer c :: rest -> case Dict.get c charToBits of Just bits -> - go rest writer |> BW.bits bits + go rest (bits ++ append) writer Nothing -> - go rest writer + go rest [] writer in - BW.run (go chars BW.empty) + BW.run (go chars [] BW.empty) {-| -}