on master help sign in
Fixed a couple of bugs
commitf7c504d0e2efa298407eaf30d078895b073248bd authoriko <mail@iko.soy> dateWed 2 Aug 2023, 16:57 (3 years ago) parent4c68317
4 files changed+15−15
src/BitWriter.elm+5−5 src/Ur/Requests.elm+1−1 src/Ur/Run.elm+2−2 src/Ur/Uw.elm+7−7
src/BitWriter.elm+5−5
@@ -14,17 +14,17 @@ import Bytes.Encode as BE
1414
1515empty : BitWriter
1616empty =
17− BitWriter { running = Nothing, collected = BE.sequence [], offset = 0 }
17+ BitWriter { running = Nothing, collected = [], offset = 0 }
1818
1919
2020run : BitWriter -> Bytes
2121run (BitWriter { running, collected }) =
2222 case running of
2323 Nothing ->
24− BE.encode collected
24+ BE.encode (collected |> List.reverse |> BE.sequence)
2525
2626 Just { value } ->
27− BE.sequence [ collected, BE.unsignedInt8 value ] |> BE.encode
27+ BE.sequence (BE.unsignedInt8 value :: collected |> List.reverse) |> BE.encode
2828
2929
3030type BitWriter
@@ -35,7 +35,7 @@ type BitWriter
3535 , length : Int
3636 }
3737 , offset : Int
38− , collected : BE.Encoder
38+ , collected : List BE.Encoder
3939 }
4040
4141
@@ -68,7 +68,7 @@ bit b (BitWriter { running, collected, offset }) =
6868 if length == 7 then
6969 BitWriter
7070 { running = Nothing
71− , collected = BE.sequence [ collected, BE.unsignedInt8 newValue ]
71+ , collected = BE.unsignedInt8 newValue :: collected
7272 , offset = newOffset
7373 }
7474
src/Ur/Requests.elm+1−1
@@ -98,7 +98,7 @@ toNoun eventId req =
9898 C.cell (C.cord app) (C.listOf C.cord path)
9999
100100 Unsubscribe subId ->
101− C.cell (C.cord "usubscribe") <|
101+ C.cell (C.cord "unsubscribe") <|
102102 C.cell (C.int eventId) (C.int subId)
103103
104104 Poke { ship, agent, mark, noun } ->
src/Ur/Run.elm+2−2
@@ -178,7 +178,7 @@ update inp msg model =
178178 processUrSubs
179179 model.eventId
180180 model.subscriptions
181− (inp.urbitSubscriptions model.app |> (\(Ur.Sub.Internal.Sub x) -> x))
181+ (inp.urbitSubscriptions appModel |> (\(Ur.Sub.Internal.Sub x) -> x))
182182
183183 ( eventId_, cmds, urReqs ) =
184184 processCmd subsResult.eventId appCmds
@@ -282,7 +282,7 @@ update inp msg model =
282282 ( model, Cmd.none )
283283
284284 else
285− case D.run (D.cell D.ignore (D.cell D.ignore deconstructor) |> D.map (\((), ((), m)) -> m)) rest of
285+ case D.run (D.cell D.ignore (D.cell D.ignore deconstructor) |> D.map (\( (), ( (), m ) ) -> m)) rest of
286286 Just subMsg ->
287287 ( model_, pureCmd (AppMsg subMsg) )
288288
src/Ur/Uw.elm+7−7
@@ -29,24 +29,24 @@ decode string =
2929 -- 0w
3030 |> List.drop 2
3131
32− go : List Char -> BW.BitWriter -> BW.BitWriter
33− go cs writer =
32+ go : List Char -> List Int -> BW.BitWriter -> BW.BitWriter
33+ go cs append writer =
3434 case cs of
3535 [] ->
36− writer
36+ BW.bits append writer
3737
3838 '.' :: rest ->
39− go rest writer
39+ go rest append writer
4040
4141 c :: rest ->
4242 case Dict.get c charToBits of
4343 Just bits ->
44− go rest writer |> BW.bits bits
44+ go rest (bits ++ append) writer
4545
4646 Nothing ->
47− go rest writer
47+ go rest [] writer
4848 in
49− BW.run (go chars BW.empty)
49+ BW.run (go chars [] BW.empty)
5050
5151
5252{-| -}