Skip to content

Commit

Permalink
Added byteSize for IOData
Browse files Browse the repository at this point in the history
  • Loading branch information
srstrong committed Apr 26, 2021
1 parent 63eb857 commit d775be0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Erl/Data/Binary/IOData.erl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-module(erl_data_binary_iOData@foreign).
-export([mempty_/0, append_/2, concat/1, fromIOList/1, fromBinary/1, toBinary/1]).
-export([mempty_/0, append_/2, concat/1, fromIOList/1, fromBinary/1, toBinary/1, byteSize/1]).

mempty_() -> [].
append_(X,Y) -> [X,Y].
Expand All @@ -8,4 +8,6 @@ concat(Xs) -> Xs.
fromIOList(X) -> X.
fromBinary(X) -> X.

toBinary(X) -> erlang:iolist_to_binary(X).
toBinary(X) -> erlang:iolist_to_binary(X).

byteSize(X) -> iolist_size(X).
5 changes: 4 additions & 1 deletion src/Erl/Data/Binary/IOData.purs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ foreign import fromBinary :: Binary -> IOData
foreign import toBinary :: IOData -> Binary

-- | Concatenate a list of IOData to an IOData. This is a no-op O(1).
foreign import concat :: List IOData -> IOData
foreign import concat :: List IOData -> IOData

-- | Calls iolist_size
foreign import byteSize :: IOData -> Int

0 comments on commit d775be0

Please sign in to comment.